API reference
API reference
Select your platform
No SDKs available
No versions available

MeshManager

MeshManager

class MeshManager(val scene: Scene, val meshCreators: HashMap<String, (ent: Entity) -> SceneMesh>, val sceneObjectSystem: SceneObjectSystem)
Manages 3D meshes for entities in the Aether framework.
MeshManager is responsible for loading, attaching, and destroying meshes for entities. It supports different mesh sources (mesh://, gfx://, file://, http://, https://) and manages the lifecycle of SceneObjects and SceneMeshes. It also handles input events for meshes and forwards them to the data model.
Example usage:
// 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)

Constructors

NameSummary
MeshManager
constructor(scene: Scene, meshCreators: HashMap<String, (ent: Entity) -> SceneMesh>, sceneObjectSystem: SceneObjectSystem)

Properties

NameSummary
meshCreators
val meshCreators: HashMap<String, (ent: Entity) -> SceneMesh>

Map of URI schemes to mesh creator functions
scene
val scene: Scene

The Scene instance used for rendering
sceneObjectSystem
val sceneObjectSystem: SceneObjectSystem

System for managing SceneObjects

Functions

NameSummary
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
fun setMeshForEntityDirectly(entity: Entity, mesh: SceneMesh)

Attaches a mesh directly to an Entity, bypassing the data model. Should use the Mesh component instead.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon