Esempio n. 1
0
        public static SHP1 Create(Scene scene, Dictionary <string, int> boneNames, VertexData vertData, out EVP1 evp1, out DRW1 drw1)
        {
            evp1 = new EVP1();
            drw1 = new DRW1();

            SHP1 shp1 = new SHP1(scene, vertData, boneNames, evp1, drw1);

            return(shp1);
        }
Esempio n. 2
0
        public Model(EndianBinaryReader reader)
        {
            int j3d2Magic  = reader.ReadInt32();
            int modelMagic = reader.ReadInt32();

            if (j3d2Magic != 0x4A334432)
            {
                throw new Exception("Model was not a BMD or BDL! (J3D2 magic not found)");
            }
            if ((modelMagic != 0x62646C34) && (modelMagic != 0x626D6433))
            {
                throw new Exception("Model was not a BMD or BDL! (Model type was not bmd3 or bdl4)");
            }

            int modelSize    = reader.ReadInt32();
            int sectionCount = reader.ReadInt32();

            // Skip the dummy section, SVR3
            reader.Skip(16);

            Scenegraph        = new INF1(reader, 32);
            VertexData        = new VTX1(reader, (int)reader.BaseStream.Position);
            SkinningEnvelopes = new EVP1(reader, (int)reader.BaseStream.Position);
            PartialWeightData = new DRW1(reader, (int)reader.BaseStream.Position);
            Joints            = new JNT1(reader, (int)reader.BaseStream.Position);
            Shapes            = SHP1.Create(reader, (int)reader.BaseStream.Position);
            Materials         = new MAT3(reader, (int)reader.BaseStream.Position);
            SkipMDL3(reader);
            Textures = new TEX1(reader, (int)reader.BaseStream.Position);

            foreach (Geometry.Shape shape in Shapes.Shapes)
            {
                packetCount += shape.Packets.Count;
            }

            vertexCount = VertexData.Attributes.Positions.Count;
        }