@@ -13,13 +13,15 @@ const CHROME_VERSION_FOR_INSTANCED_MESH = 139
1313const detectInstancedMeshSupport = ( ) : boolean => {
1414 const userAgent = navigator . userAgent
1515 const chromeMatch = userAgent . match ( / C h r o m e \/ ( \d + ) / )
16-
16+
1717 if ( chromeMatch ) {
1818 const chromeVersion = parseInt ( chromeMatch [ 1 ] , 10 )
19- console . log ( `Detected Chrome ${ chromeVersion } , using ${ chromeVersion >= CHROME_VERSION_FOR_INSTANCED_MESH ? 'InstancedMesh' : 'BatchedMesh' } ` )
19+ console . log (
20+ `Detected Chrome ${ chromeVersion } , using ${ chromeVersion >= CHROME_VERSION_FOR_INSTANCED_MESH ? "InstancedMesh" : "BatchedMesh" } `
21+ )
2022 return chromeVersion >= CHROME_VERSION_FOR_INSTANCED_MESH
2123 }
22-
24+
2325 console . log ( `Non-Chrome browser detected (${ userAgent } ), using BatchedMesh` )
2426 return false
2527}
@@ -194,7 +196,7 @@ class MirabufInstance {
194196 Object . values ( instances ) . forEach ( instance => {
195197 const definition = assembly . data ! . parts ! . partDefinitions ! [ instance . partDefinitionReference ! ]
196198 const bodies = definition ?. bodies ?? [ ]
197-
199+
198200 bodies . forEach ( body => {
199201 const mesh = body ?. triangleMesh ?. mesh
200202 if ( ! mesh ?. verts || ! mesh . normals || ! mesh . uv || ! mesh . indices ) return
@@ -208,7 +210,7 @@ class MirabufInstance {
208210
209211 const geometry = new THREE . BufferGeometry ( )
210212 transformGeometry ( geometry , mesh )
211-
213+
212214 // Create InstancedMesh with count of 1 for this body
213215 const instancedMesh = new THREE . InstancedMesh ( geometry , material , 1 )
214216 instancedMesh . castShadow = true
@@ -245,7 +247,7 @@ class MirabufInstance {
245247
246248 const batchMap = new Map < THREE . Material , Map < string , [ mirabuf . IBody , Array < mirabuf . IPartInstance > ] > > ( )
247249 const countMap = new Map < THREE . Material , BatchCounts > ( )
248-
250+
249251 // Filter all instances by first material, then body
250252 Object . values ( instances ) . forEach ( instance => {
251253 const definition = assembly . data ! . parts ! . partDefinitions ! [ instance . partDefinitionReference ! ]
0 commit comments