//create our progressive mesh
progressiveMesh = new ProgressiveMesh(tempMesh,adj,null,1,MeshFlags.SimplifyVertex);
//set the initial mesh to the max
progressiveMesh.NumberFaces = progressiveMesh.MaxFaces;
progressiveMesh.NumberVertices = progressiveMesh.MaxVertices;
}
}
}
注意,我们使用了两个临时mesh来创建progressiveMesh对象。其中一个clean过的mesh来完成真正的创建。对于progressiveMesh的构造函数来说,第四个参数是最重要的:根据所使用的MeshFlags选项,它是所创建mesh的顶点或面的最小值。显然,这只是一个近似值,即使不能把mesh简化到这个级别,这个方法还是会成功。
你应该还注意到,我们马上就把面数和顶点数设置为了最大值。创建mesh并保留在简化状态(generating the mesh leaves it simplified)。设置progressiveMesh中面或顶点数中的任意一个,都可以在渲染时更改mesh的细节。因为我们想初始化时显示所有细节,自然把面和顶点值都设置为最大值。