class MeshManager(val scene: Scene, val meshCreators: HashMap<String, (ent: Entity) -> SceneMesh>, val sceneObjectSystem: SceneObjectSystem)
// Register a custom mesh creator
meshManager.meshCreators["mesh://custom"] = { entity ->
// Create and return a custom SceneMesh for the entity
SceneMesh.box(
-0.5f, -0.5f, -0.5f,
0.5f, 0.5f, 0.5f,
material.generateSceneMaterial(entity, context)
)
}
// Set a mesh for an entity using a URI
meshManager.setMeshForEntity(
entity,
Uri.parse("models/cube.glb"),
Uri.parse("file:///data/data/com.example.app/files/models/cube.glb"),
"", // default shader override
-1, // default scene override
true // use cache
)
// Set a mesh directly for an entity
meshManager.setMeshForEntityDirectly(entity, sceneMesh)
| Name | Summary |
|---|---|
MeshManager | constructor(scene: Scene, meshCreators: HashMap<String, (ent: Entity) -> SceneMesh>, sceneObjectSystem: SceneObjectSystem) |
| Name | Summary |
|---|---|
meshCreators | |
scene | |
sceneObjectSystem |
| Name | Summary |
|---|---|
deleteMeshForEntity | fun deleteMeshForEntity(entity: Entity) This method removes the SceneObject associated with the entity and destroys any meshes that were created for it. |
destroy | fun destroy() |
retrieveAssociatedMeshFilesForEntity | fun retrieveAssociatedMeshFilesForEntity(entity: Entity): Array<<Error class: unknown class>>? |
setMeshForEntity | fun setMeshForEntity(entity: Entity, meshSimpleUri: <Error class: unknown class>, meshFullPathUri: <Error class: unknown class>, defaultShaderOverride: String, defaultSceneOverride: Int, useCache: Boolean = true) Attaches a mesh to an Entity based on the provided URIs. Avoid using this method directly and instead assign the Mesh component the Entity. |
setMeshForEntityDirectly |