Ejemplo n.º 1
0
        /// <summary>
        /// Creates a MeshGeometry3D object from the loaded file. Polygons are triangulated using triangle fans.
        /// </summary>
        /// <returns>
        /// A MeshGeometry3D.
        /// </returns>
        public MeshGeometry3D CreateMeshGeometry3D(ModelInfo info = default(ModelInfo))
        {
            var mb = new MeshBuilder(info.Normals, info.Tangents);
            foreach (var p in this.Vertices)
            {
                mb.Positions.Add(p);
            }

            foreach (var face in this.Faces)
            {
                mb.AddTriangleFan(face);
            }
            mb.ComputeNormalsAndTangents(info.Faces);
            return mb.ToMeshGeometry3D();
        }