Class RenderableInstance

  • All Implemented Interfaces:
    AnimatableModel

    public class RenderableInstance
    extends java.lang.Object
    implements AnimatableModel
    Controls how a Renderable is displayed. There can be multiple RenderableInstances displaying a single Renderable.
    • Method Detail

      • getFilamentAsset

        @Nullable
        public com.google.android.filament.gltfio.FilamentAsset getFilamentAsset()
      • getEntity

        public int getEntity()
      • getRenderedEntity

        public int getRenderedEntity()
      • getRenderPriority

        public int getRenderPriority()
        Get the render priority that controls the order of rendering. The priority is between a range of 0 (rendered first) and 7 (rendered last). The default value is 4.
      • setRenderPriority

        public void setRenderPriority​(@IntRange(from=0L,to=7L)
                                      int renderPriority)
        Set the render priority to control the order of rendering. The priority is between a range of 0 (rendered first) and 7 (rendered last). The default value is 4.
      • isShadowCaster

        public boolean isShadowCaster()
        Returns true if configured to cast shadows on other renderables.
      • setShadowCaster

        public void setShadowCaster​(boolean isShadowCaster)
        Sets whether the renderable casts shadow on other renderables in the scene.
      • isShadowReceiver

        public boolean isShadowReceiver()
        Returns true if configured to receive shadows cast by other renderables.
      • setShadowReceiver

        public void setShadowReceiver​(boolean isShadowReceiver)
        Sets whether the renderable receives shadows cast by other renderables in the scene.
      • getMaterial

        public Material getMaterial()
        Returns the material bound to the first submesh.
      • getMaterialsCount

        public int getMaterialsCount()
        Returns the number of materials.
      • getMaterial

        public Material getMaterial​(int index)
        Returns the material bound to the specified index.
      • getMaterial

        public Material getMaterial​(java.lang.String name)
        Returns the material bound to the specified name.
      • setMaterial

        public void setMaterial​(Material material)
        Sets the material bound to the first index.
      • setMaterial

        public void setMaterial​(@IntRange(from=0L)
                                int primitiveIndex,
                                Material material)
        Sets the material bound to the specified index.
      • setMaterial

        public void setMaterial​(int entityIndex,
                                @IntRange(from=0L)
                                int primitiveIndex,
                                Material material)
        Sets the material bound to the specified index and entityIndex
      • getMaterialName

        public java.lang.String getMaterialName​(int index)
        Returns the name associated with the specified index.
      • getWorldModelMatrix

        public Matrix getWorldModelMatrix()
      • getAnimation

        public ModelAnimation getAnimation​(int animationIndex)
        Get the associated ModelAnimation at the given index or throw an IndexOutOfBoundsException.
        Specified by:
        getAnimation in interface AnimatableModel
        Parameters:
        animationIndex - Zero-based index for the animation of interest.
      • applyAnimationChange

        public boolean applyAnimationChange​(ModelAnimation animation)
        Description copied from interface: AnimatableModel
        Occurs when a ModelAnimation has received any property changed.
        Depending on the returned value, the ModelAnimation will set his isDirty to false or not.
        You can choose between applying changes on the ObjectAnimator Choreographer.FrameCallback or use your own Choreographer to handle an update/render update hierarchy.
        Time position should be applied inside a global Choreographer frame callback to ensure that the transformations are applied in a hierarchical order.
        Specified by:
        applyAnimationChange in interface AnimatableModel
        Returns:
        true is the changes have been applied/handled
      • prepareForDraw

        public void prepareForDraw()
      • attachToRenderer

        public void attachToRenderer​(Renderer renderer)
      • detachFromRenderer

        public void detachFromRenderer()
      • destroy

        public void destroy()
        Detach and destroy the instance
      • getRelativeTransform

        @Nullable
        public Matrix getRelativeTransform()
        Returns the transform of this renderable relative to it's node. This will be non-null if the .sfa file includes a scale other than 1 or has recentering turned on.
      • getRelativeTransformInverse

        @Nullable
        public Matrix getRelativeTransformInverse()
        Returns the inverse transform of this renderable relative to it's node. This will be non-null if the .sfa file includes a scale other than 1 or has recentering turned on.
      • updateAnimations

        public boolean updateAnimations​(boolean force)
        Apply animations changes if fore==true or the animation has dirty values.
        Parameters:
        force - Update even if the animation time position didn't changed.
        Returns:
        true if any animation update has been made.