Beispiel #1
0
        Vector3 GetPosition(int index)
        {
            const int itemSize = 0x6;

            binaryReader.Goto(PositionOffset + itemSize * index);
            Vector3 pos = new Vector3(binaryReader.ReadS16() / GlobalScale, binaryReader.ReadS16() / GlobalScale, binaryReader.ReadS16() / GlobalScale);

            binaryReader.Back();
            return(pos);
        }
Beispiel #2
0
        public uint     unk6;     // zeroes

        public Material(ABinaryReader binaryReader)
        {
            textureIndex = binaryReader.ReadS16();
            unk1         = binaryReader.ReadS16();
            wrapS        = (WrapMode)binaryReader.Read8();
            wrapT        = (WrapMode)binaryReader.Read8();
            unk3         = binaryReader.Read16();
            unk4         = binaryReader.Read32();
            unk5         = binaryReader.Read32();
            unk6         = binaryReader.Read32();
        }
Beispiel #3
0
        public GraphObject(ABinaryReader binaryReader)
        {
            Visible     = true;
            ParentIndex = binaryReader.ReadS16();
            ChildIndex  = binaryReader.ReadS16();
            NextIndex   = binaryReader.ReadS16();
            PrevIndex   = binaryReader.ReadS16();

            if (binaryReader.Read8() != 0)
            {
#if AROOKAS_DEMOLISHER_CHECKPADDING
                throw new Exception(String.Format("GraphObject padding != 0 at 0x{0:X8}.", binaryReader.Stream.Position));
#endif
            }

            RenderFlags = (GraphObjectRenderFlags)binaryReader.Read8();

            if (binaryReader.Read16() != 0)
            {
#if AROOKAS_DEMOLISHER_CHECKPADDING
                throw new Exception(String.Format("GraphObject padding != 0 at 0x{0:X8}.", binaryReader.Stream.Position));
#endif
            }

            Scale       = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
            Rotation    = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
            Position    = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
            BoundingBox = new BoundingBox(binaryReader.ReadVector3D().ToVector3(), binaryReader.ReadVector3D().ToVector3());
            unk3        = binaryReader.ReadSingle();

            int partCount = binaryReader.ReadS16();

            if (binaryReader.Read16() != 0)
            {
#if AROOKAS_DEMOLISHER_CHECKPADDING
                throw new Exception(String.Format("GraphObject padding != 0 at 0x{0:X8}.", binaryReader.Stream.Position));
#endif
            }

            int partOffset = binaryReader.ReadS32();

            if (binaryReader.Read32s(7).Any(zero => zero != 0))
            {
#if AROOKAS_DEMOLISHER_CHECKPADDING
                throw new Exception(String.Format("GraphObject padding != 0 at 0x{0:X8}.", binaryReader.Stream.Position));
#endif
            }

            binaryReader.Goto(partOffset);
            parts = CollectionHelper.Initialize <Part>(partCount, () => new Part(binaryReader));
            binaryReader.Back();
        }
Beispiel #4
0
 // Token: 0x0600023B RID: 571 RVA: 0x000070FE File Offset: 0x000052FE
 public sfModList(ABinaryReader binaryReader)
 {
     this.sfModSrcOper    = binaryReader.Read16();
     this.sfModDestOper   = binaryReader.Read16();
     this.modAmount       = binaryReader.ReadS16();
     this.sfModAmtSrcOper = binaryReader.Read16();
     this.sfModTransOper  = (SFTransform)binaryReader.Read16();
 }
Beispiel #5
0
        // stupid f*****g C#
        public Vertex(ABinaryReader binaryReader, bool useNBT, int uvCount, BatchAttributes attributes)
            : this()
        {
            MatrixIndex = null;
            PositionIndex = null;
            NormalIndex = null;
            BinormalIndex = null;
            TangentIndex = null;
            ColorIndex = new short?[2];
            UVIndex = new short?[8];

            if (attributes.HasFlag(BatchAttributes.Position))
            {
                PositionIndex = binaryReader.ReadS16();
            }

            if (attributes.HasFlag(BatchAttributes.Normal))
            {
                NormalIndex = binaryReader.ReadS16();

                if (useNBT)
                {
                    BinormalIndex = binaryReader.ReadS16();
                    TangentIndex = binaryReader.ReadS16();
                }
            }

            if (attributes.HasFlag(BatchAttributes.Color0))
            {
                ColorIndex[0] = binaryReader.ReadS16();
            }

            if (attributes.HasFlag(BatchAttributes.Color1))
            {
                ColorIndex[1] = binaryReader.ReadS16();
            }

            for (int texCoord = 0; texCoord < uvCount; texCoord++)
            {
                if (attributes.HasFlag((BatchAttributes)(1 << (13 + texCoord))))
                {
                    UVIndex[texCoord] = binaryReader.ReadS16();
                }
            }
        }
Beispiel #6
0
        public Vertex(ABinaryReader binaryReader, bool useNBT, int uvCount, BatchAttributes attributes)
            : this()             // stupid f*****g C#
        {
            MatrixIndex   = null;
            PositionIndex = null;
            NormalIndex   = null;
            BinormalIndex = null;
            TangentIndex  = null;
            ColorIndex    = new short?[2];
            UVIndex       = new short?[8];

            if (attributes.HasFlag(BatchAttributes.Position))
            {
                PositionIndex = binaryReader.ReadS16();
            }

            if (attributes.HasFlag(BatchAttributes.Normal))
            {
                NormalIndex = binaryReader.ReadS16();

                if (useNBT)
                {
                    BinormalIndex = binaryReader.ReadS16();
                    TangentIndex  = binaryReader.ReadS16();
                }
            }

            if (attributes.HasFlag(BatchAttributes.Color0))
            {
                ColorIndex[0] = binaryReader.ReadS16();
            }

            if (attributes.HasFlag(BatchAttributes.Color1))
            {
                ColorIndex[1] = binaryReader.ReadS16();
            }

            for (int texCoord = 0; texCoord < uvCount; texCoord++)
            {
                if (attributes.HasFlag((BatchAttributes)(1 << (13 + texCoord))))
                {
                    UVIndex[texCoord] = binaryReader.ReadS16();
                }
            }
        }
Beispiel #7
0
 public Part(ABinaryReader binaryReader)
     : this()             // stupid f*****g C#
 {
     ShaderIndex = binaryReader.ReadS16();
     BatchIndex  = binaryReader.ReadS16();
 }