Пример #1
0
 private void BuildTriangle(mesh_vertex_t v0, mesh_vertex_t v1, mesh_vertex_t v2, mstudio_mesh_t mesh, mstudio_model_t mdl)
 {
     var textureId = mesh.skinref;
     if ((v0.v == v1.v) || (v0.v == v2.v) || (v1.v == v2.v))
         return;
     mesh.Faces.Add(new ModelFace() {
         Texture = modelTextures[textureId],
         Vertex0 = BuildVertex(v0, mdl, textureId),
         Vertex1 = BuildVertex(v1, mdl, textureId),
         Vertex2 = BuildVertex(v2, mdl, textureId)
     });
 }
Пример #2
0
        private void ReadTrianglesStrip(BinaryReader source, mstudio_mesh_t mesh, mstudio_model_t mdl, int numVertices)
        {
            mesh_vertex_t v0 = new mesh_vertex_t();
            v0.Read(source);
            mesh_vertex_t v1 = new mesh_vertex_t();
            v1.Read(source);
            for (int i = 2; i < numVertices; ++i)
            {
                mesh_vertex_t v2 = new mesh_vertex_t();
                v2.Read(source);

                BuildTriangle(v0, v1, v2, mesh, mdl);

                //v0 = v1;
                //v1 = v2;
                if (0 == (i & 1))
                    v0 = v2;
                else
                    v1 = v2;
            }
        }
Пример #3
0
 private void BuildMesh(mstudio_mesh_t src, ModelMesh mesh)
 {
     foreach (var face in src.Faces)
         mesh.Faces.Add(face);
 }