-
public class FilamentAssetOwns a bundle of Filament objects that have been created by
AssetLoader.For usage instructions, see the documentation for AssetLoader.
This class owns a hierarchy of entities that have been loaded from a glTF asset. Every entity has a
TransformManagercomponent, and some entities also have compnents managed byNameComponentManager,RenderableManager, and others.In addition to the aforementioned entities, an asset has strong ownership over a list of
VertexBuffer,IndexBuffer, andTexture.Clients can use ResourceLoader to create textures, compute tangent quaternions, and upload data into vertex buffers and index buffers.
-
-
Method Summary
Modifier and Type Method Description FilamentInstancegetInstance()intgetRoot()Gets the transform root for the asset, which has no matching glTF node. intpopRenderable()Pops a ready renderable off the queue, or returns 0 if no renderables have become ready.NOTE: To determine the progress percentage or completion status, please useResourceLoader#asyncGetLoadProgress.This helper method allows clients to progressively add renderables to the scene as texturesgradually become ready through asynchronous loading.See also ResourceLoader#asyncBeginLoad. intpopRenderables(@Nullable() Array<int> entities)Pops one or more renderables off the queue, or returns the available number.Returns the number of entities written into the given array. Array<int>getEntities()Gets the list of entities, one for each glTF node. Array<int>getLightEntities()Gets only the entities that have light components. Array<int>getRenderableEntities()Gets only the entities that have renderable components. Array<int>getCameraEntities()Gets only the entities that have camera components. intgetFirstEntityByName(String name)Returns the first entity with the given name, or 0 if none exist. Array<int>getEntitiesByName(String name)Gets a list of entities with the given name. Array<int>getEntitiesByPrefix(String prefix)Gets a list of entities whose names start with the given prefix. BoxgetBoundingBox()Gets the bounding box computed from the supplied min / max values in glTF accessors.This does not return a bounding box over all FilamentInstance, it's just a straightforwardAAAB that can be determined at load time from the asset data. StringgetName(int entity)Gets the NameComponentManagerlabel for the given entity, if it exists.StringgetExtras(int entity)Gets the glTF extras string for the asset or a specific node. Array<String>getMorphTargetNames(int entity)Gets the names of all morph targets in the given entity. Array<String>getResourceUris()Gets resource URIs for all externally-referenced buffers. voidreleaseSourceData()Reclaims CPU-side memory for URI strings, binding lists, and raw animation data.This should only be called after ResourceLoader#loadResources() orResourceLoader#asyncBeginLoad(). EnginegetEngine()-
-
Method Detail
-
getInstance
FilamentInstance getInstance()
-
getRoot
int getRoot()
Gets the transform root for the asset, which has no matching glTF node.
-
popRenderable
int popRenderable()
Pops a ready renderable off the queue, or returns 0 if no renderables have become ready.NOTE: To determine the progress percentage or completion status, please useResourceLoader#asyncGetLoadProgress.This helper method allows clients to progressively add renderables to the scene as texturesgradually become ready through asynchronous loading.See also ResourceLoader#asyncBeginLoad.
-
popRenderables
int popRenderables(@Nullable() Array<int> entities)
Pops one or more renderables off the queue, or returns the available number.Returns the number of entities written into the given array. If the given arrayis null, returns the number of available renderables.
-
getEntities
@NonNull() Array<int> getEntities()
Gets the list of entities, one for each glTF node.
All of these have a transform component. Some of the returned entities may also have arenderable or light component.
-
getLightEntities
@NonNull() Array<int> getLightEntities()
Gets only the entities that have light components.
-
getRenderableEntities
@NonNull() Array<int> getRenderableEntities()
Gets only the entities that have renderable components.
-
getCameraEntities
@NonNull() Array<int> getCameraEntities()
Gets only the entities that have camera components.
Note about aspect ratios:gltfio always uses an aspect ratio of 1.0 when setting the projection matrix for perspectivecameras. gltfio then sets the camera's scaling matrix with the aspect ratio specified in theglTF file (if present).The camera's scaling matrix allows clients to adjust the aspect ratio independently from thecamera's projection.
-
getFirstEntityByName
int getFirstEntityByName(String name)
Returns the first entity with the given name, or 0 if none exist.
-
getEntitiesByName
@NonNull() Array<int> getEntitiesByName(String name)
Gets a list of entities with the given name.
-
getEntitiesByPrefix
@NonNull() Array<int> getEntitiesByPrefix(String prefix)
Gets a list of entities whose names start with the given prefix.
-
getBoundingBox
@NonNull() Box getBoundingBox()
Gets the bounding box computed from the supplied min / max values in glTF accessors.This does not return a bounding box over all FilamentInstance, it's just a straightforwardAAAB that can be determined at load time from the asset data.
-
getName
String getName(int entity)
Gets the
NameComponentManagerlabel for the given entity, if it exists.
-
getExtras
@Nullable() String getExtras(int entity)
Gets the glTF extras string for the asset or a specific node.
- Parameters:
entity- the entity corresponding to the glTF node, or 0 to get the asset-level string.
-
getMorphTargetNames
@NonNull() Array<String> getMorphTargetNames(int entity)
Gets the names of all morph targets in the given entity.
-
getResourceUris
@NonNull() Array<String> getResourceUris()
Gets resource URIs for all externally-referenced buffers.
-
releaseSourceData
void releaseSourceData()
Reclaims CPU-side memory for URI strings, binding lists, and raw animation data.This should only be called after ResourceLoader#loadResources() orResourceLoader#asyncBeginLoad(). If this is an instanced asset, this prevents creation of newinstances.
-
getEngine
Engine getEngine()
-
-
-
-