hyades.MeshReader.ExtractTrianglesFrom C# (CSharp) Method

ExtractTrianglesFrom() public static method

public static ExtractTrianglesFrom ( Model model, List vertices, List indices, Matrix world ) : void
model Microsoft.Xna.Framework.Graphics.Model
vertices List
indices List
world Matrix
return void
        public static void ExtractTrianglesFrom(Model model, List<Vector3> vertices, List<Triangle> indices, Matrix world)
        {
            Matrix transform = Matrix.Identity;
            foreach (ModelMesh mesh in model.Meshes)
            {
                // If the model has bones the vertices have to be transformed by the bone position
                transform = Matrix.Multiply(GetAbsoluteTransform(mesh.ParentBone), world);
                ExtractModelMeshData(mesh, ref transform, vertices, indices);
            }
        }

Usage Example

Exemplo n.º 1
0
        public ShapeBuilder(Model model)
        {
            this.model = model;

            if (index_dictionary.ContainsKey(model))
            {
                this.vertices = vertex_dictionary[model];
                this.indices  = index_dictionary[model];
            }
            else
            {
                this.indices  = new List <Triangle>();
                this.vertices = new List <Vector3>();

                MeshReader.ExtractTrianglesFrom(model, vertices, indices, Matrix.Identity);

                index_dictionary.Add(model, indices);
                vertex_dictionary.Add(model, vertices);
            }
        }