Skip to content

Commit

Permalink
Add metadata flags to noa's generated terrain/object meshes, in case
Browse files Browse the repository at this point in the history
client needs to find/distinguish them
  • Loading branch information
fenomas committed May 19, 2023
1 parent 2bd7693 commit e6c305e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/lib/objectMesher.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ export function ObjectMesher(noa) {
}
}
this.allBaseMeshes.push(mesh)
if (!mesh.metadata) mesh.metadata = {}
mesh.metadata[objectMeshFlag] = true
return managers[id] = new InstanceManager(noa, mesh)
}

var objectMeshFlag = 'noa_object_base_mesh'



Expand Down
5 changes: 4 additions & 1 deletion src/lib/terrainMesher.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ export function TerrainMesher(noa) {
mesh.freezeNormals()
mesh.freezeWorldMatrix()
chunk._terrainMeshes.push(mesh)
if (!mesh.metadata) mesh.metadata = {}
mesh.metadata[terrainMeshFlag] = true
})
}
var terrainMeshFlag = 'noa_chunk_terrain_mesh'

}

Expand Down Expand Up @@ -705,7 +708,7 @@ function MeshBuilder(noa, terrainMatManager) {
mesh.setVerticesData('texAtlasIndices', atlasIndexes, false, 1)
}

// disable some babylon bounding internals
// disable some unnecessary bounding checks
mesh.isPickable = false
mesh.doNotSyncBoundingInfo = true
mesh._refreshBoundingInfo = () => mesh
Expand Down

0 comments on commit e6c305e

Please sign in to comment.