Package 

Class FilamentAsset


  • 
    public class FilamentAsset
    
                        

    Owns 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 TransformManager component, and some entities also have compnents managed by NameComponentManager, RenderableManager, and others.

    In addition to the aforementioned entities, an asset has strong ownership over a list of VertexBuffer, IndexBuffer, and Texture.

    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
      FilamentInstance getInstance()
      int getRoot() Gets the transform root for the asset, which has no matching glTF node.
      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.
      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.
      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.
      int getFirstEntityByName(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.
      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.
      String getName(int entity) Gets the NameComponentManager label for the given entity, if it exists.
      String getExtras(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.
      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().
      Engine getEngine()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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.

      • 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.

      • 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 NameComponentManager label 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.
      • 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.