Esempio n. 1
0
        public static SubMesh[] GenerateSubMeshes(IExportContainer container, Mesh instanceMesh, ref LOD origin)
        {
            int offset = 0;

            SubMesh[] instances = new SubMesh[origin.MeshData.Length];
            for (int i = 0; i < origin.MeshData.Length; i++)
            {
                MeshData meshData = origin.MeshData[i];
                SubMesh  instance = new SubMesh();
                instance.FirstByte = offset;
#warning TODO: stripping
                int indexCount = meshData.Faces.Length * 3;
                instance.IndexCount = indexCount;
                instance.Topology   = MeshTopology.Triangles;
                if (SubMesh.HasTriangleCount(container.ExportVersion))
                {
                    instance.TriangleCount = meshData.Faces.Length;
                }
                if (SubMesh.HasVertex(container.ExportVersion))
                {
                    SubMeshConverter.CalculateSubMeshVertexRangeAndBounds(container.ExportVersion, instanceMesh, ref instance);
                }
                instances[i] = instance;
                offset      += indexCount * sizeof(ushort);
            }
            return(instances);
        }
Esempio n. 2
0
 private static SubMesh[] GetSubMeshes(IExportContainer container, Mesh origin, Mesh instance)
 {
     if (Mesh.HasLODData(container.Version))
     {
         return(LODConverter.GenerateSubMeshes(container, instance, ref origin.LODData[0]));
     }
     else
     {
         return(SubMeshConverter.Convert(container, instance, origin.SubMeshes));
     }
 }