|
|
@@ -30,13 +30,13 @@
|
|
|
"three": "../build/three.module.js",
|
|
|
"three/addons/": "./jsm/",
|
|
|
|
|
|
- "three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.9.9/build/index.module.js",
|
|
|
+ "three-mesh-bvh": "https://cdn.jsdelivr.net/npm/three-mesh-bvh@0.9.10/build/index.module.js",
|
|
|
|
|
|
- "@three.ez/batched-mesh-extensions": "https://cdn.jsdelivr.net/npm/@three.ez/batched-mesh-extensions@0.0.8/build/webgl.js",
|
|
|
+ "@three.ez/batched-mesh-extensions": "https://cdn.jsdelivr.net/npm/@three.ez/batched-mesh-extensions@0.0.11/build/webgl.js",
|
|
|
"bvh.js": "https://cdn.jsdelivr.net/npm/bvh.js@0.0.13/build/index.js",
|
|
|
|
|
|
"@three.ez/simplify-geometry": "https://cdn.jsdelivr.net/npm/@three.ez/simplify-geometry@0.0.1/build/index.js",
|
|
|
- "meshoptimizer": "https://cdn.jsdelivr.net/npm/meshoptimizer@0.23.0/+esm"
|
|
|
+ "meshoptimizer": "https://cdn.jsdelivr.net/npm/meshoptimizer@1.1.1/+esm"
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -131,7 +131,7 @@
|
|
|
// create BatchedMesh
|
|
|
const { vertexCount, indexCount, LODIndexCount } = getBatchedMeshLODCount( geometriesLODArray );
|
|
|
batchedMesh = new THREE.BatchedMesh( instancesCount, vertexCount, indexCount, new THREE.MeshStandardMaterial( { metalness: 1, roughness: 0.8 } ) );
|
|
|
-
|
|
|
+
|
|
|
// enable radix sort for better performance
|
|
|
batchedMesh.customSort = createRadixSort( batchedMesh );
|
|
|
|
|
|
@@ -140,10 +140,10 @@
|
|
|
|
|
|
const geometryLOD = geometriesLODArray[ i ];
|
|
|
const geometryId = batchedMesh.addGeometry( geometryLOD[ 0 ], - 1, LODIndexCount[ i ] );
|
|
|
- batchedMesh.addGeometryLOD( geometryId, geometryLOD[ 1 ], 50 );
|
|
|
- batchedMesh.addGeometryLOD( geometryId, geometryLOD[ 2 ], 100 );
|
|
|
- batchedMesh.addGeometryLOD( geometryId, geometryLOD[ 3 ], 125 );
|
|
|
- batchedMesh.addGeometryLOD( geometryId, geometryLOD[ 4 ], 200 );
|
|
|
+ batchedMesh.addGeometryLOD( geometryId, geometryLOD[ 1 ], 0.08 ); // used when below ~8% of the screen height
|
|
|
+ batchedMesh.addGeometryLOD( geometryId, geometryLOD[ 2 ], 0.04 ); // below ~4%
|
|
|
+ batchedMesh.addGeometryLOD( geometryId, geometryLOD[ 3 ], 0.033 ); // below ~3.3%
|
|
|
+ batchedMesh.addGeometryLOD( geometryId, geometryLOD[ 4 ], 0.02 ); // below ~2%
|
|
|
|
|
|
}
|
|
|
|