コード例 #1
0
ファイル: CMDL.cs プロジェクト: Ermelber/EveryFileExplorer
            public SeparateDataShape(EndianBinaryReader er)
            {
                Type = er.ReadUInt32();
                Signature = er.ReadString(Encoding.ASCII, 4);
                if (Signature != "SOBJ") throw new SignatureNotCorrectException(Signature, "SOBJ", er.BaseStream.Position);
                Revision = er.ReadUInt32();
                NameOffset = (UInt32)er.BaseStream.Position + er.ReadUInt32();
                Unknown2 = er.ReadUInt32();
                Unknown3 = er.ReadUInt32();
                Flags = (ShapeFlags)er.ReadUInt32();
                OrientedBoundingBoxOffset = (UInt32)er.BaseStream.Position + er.ReadUInt32();
                PositionOffset = er.ReadVector3();
                NrPrimitiveSets = er.ReadUInt32();
                PrimitiveSetOffsetsArrayOffset = (UInt32)er.BaseStream.Position + er.ReadUInt32();
                BaseAddress = er.ReadUInt32();
                NrVertexAttributes = er.ReadUInt32();
                VertexAttributeOffsetsArrayOffset = (UInt32)er.BaseStream.Position + er.ReadUInt32();
                BlendShapeOffset = er.ReadUInt32();
                if (BlendShapeOffset != 0) BlendShapeOffset += (UInt32)er.BaseStream.Position - 4;

                long curpos = er.BaseStream.Position;
                er.BaseStream.Position = NameOffset;
                Name = er.ReadStringNT(Encoding.ASCII);
                er.BaseStream.Position = OrientedBoundingBoxOffset;
                BoundingBox = BoundingVolume.FromStream(er);

                er.BaseStream.Position = PrimitiveSetOffsetsArrayOffset;
                PrimitiveSetOffsets = new uint[NrPrimitiveSets];
                for (int i = 0; i < NrPrimitiveSets; i++)
                {
                    PrimitiveSetOffsets[i] = (UInt32)er.BaseStream.Position + er.ReadUInt32();
                }

                er.BaseStream.Position = VertexAttributeOffsetsArrayOffset;
                VertexAttributeOffsets = new uint[NrVertexAttributes];
                for (int i = 0; i < NrVertexAttributes; i++)
                {
                    VertexAttributeOffsets[i] = (UInt32)er.BaseStream.Position + er.ReadUInt32();
                }

                PrimitiveSets = new PrimitiveSet[NrPrimitiveSets];
                for (int i = 0; i < NrPrimitiveSets; i++)
                {
                    er.BaseStream.Position = PrimitiveSetOffsets[i];
                    PrimitiveSets[i] = new PrimitiveSet(er);
                }

                VertexAttributes = new VertexAttributeCtr[NrVertexAttributes];
                if (NrVertexAttributes != 0)
                {
                    for (int i = 0; i < NrVertexAttributes; i++)
                    {
                        er.BaseStream.Position = VertexAttributeOffsets[i];
                        VertexAttributes[i] = VertexAttributeCtr.FromStream(er);
                    }
                }

                if (BlendShapeOffset != 0)
                {
                    er.BaseStream.Position = BlendShapeOffset;
                    BlendShape = new BlendShapeCtr(er);
                }

                er.BaseStream.Position = curpos;
            }
コード例 #2
0
ファイル: CMDL.cs プロジェクト: Ermelber/EveryFileExplorer
 public SeparateDataShape()
 {
     Type = 0x10000001;
     Signature = "SOBJ";
     Revision = 0;
     Name = "";
     BoundingBox = new OrientedBoundingBox();
     PositionOffset = new Vector3(0, 0, 0);
 }