Please can someone help Mesh.simplify does not seem to be working, in fact the whole mesh disappears when i try to have 2 LODs
// Meshes
const phongMeshes = [];
const pbrMeshes = [];
this.fpsCounter.iNumVerts = 0;
this.fpsCounter.iNumIndices = 0;
this.fpsCounter.iNumFaces = 0;
var lodSettings: Array<ISimplificationSettings> = []; //in JS: var settings = new Array();
lodSettings.push(new SimplificationSettings(1.0, 0, true));
lodSettings.push(new SimplificationSettings(1.0, 10, true));
//lodSettings.push(new SimplificationSettings(0.9, 2));
//lodSettings.push(new SimplificationSettings(0.8, 3));
// lodSettings.push(new SimplificationSettings(0.7, 4));
// lodSettings.push(new SimplificationSettings(0.6, 5));
for (const mesh of container.meshes) {
if (mesh.material instanceof PBRMaterial) {
pbrMeshes.push(mesh);
} else if (mesh.material instanceof StandardMaterial) {
phongMeshes.push(mesh);
}
const thisMesh = mesh as Mesh;
thisMesh.simplify(lodSettings, true);
// Mesh Optimizations
mesh.doNotSyncBoundingInfo = true;
//mesh.material.needDepthPrePass = true;
//mesh.cullingStrategy = AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION;
//mesh.cullingStrategy = AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;
this.fpsCounter.iNumVerts += thisMesh.getVerticesData.length;
this.fpsCounter.iNumIndices += thisMesh.getIndices.length;
this.fpsCounter.iNumFaces += Math.floor( thisMesh.getIndices.length / 3 );
}