Class Animator


  • public class Animator
    extends java.lang.Object
    Updates matrices according to glTF animation and skin definitions.

    Animator is owned by FilamentAsset and can be used for two things:

    • Updating matrices in TransformManager components according to glTF animation definitions.
    • Updating bone matrices in RenderableManager components according to glTF skin definitions.

    See Also:
    AssetLoader, FilamentAsset, ResourceLoader
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void applyAnimation​(int animationIndex, float time)
      Applies rotation, translation, and scale to entities that have been targeted by the given animation definition.
      int getAnimationCount()
      Returns the number of animation definitions in the glTF asset.
      float getAnimationDuration​(int animationIndex)
      Returns the duration of the specified glTF animation in seconds.
      java.lang.String getAnimationName​(int animationIndex)
      Returns a weak reference to the string name of the specified animation, or an empty string if none was specified.
      void updateBoneMatrices()
      Computes root-to-node transforms for all bone nodes, then passes the results into RenderableManager.setBonesAsMatrices(int, Buffer, int, int).
      • Methods inherited from class java.lang.Object

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

      • applyAnimation

        public void applyAnimation​(@IntRange(from=0L)
                                   int animationIndex,
                                   float time)
        Applies rotation, translation, and scale to entities that have been targeted by the given animation definition. Uses TransformManager.
        Parameters:
        animationIndex - Zero-based index for the animation of interest.
        time - Elapsed time of interest in seconds.
        See Also:
        getAnimationCount()
      • updateBoneMatrices

        public void updateBoneMatrices()
        Computes root-to-node transforms for all bone nodes, then passes the results into RenderableManager.setBonesAsMatrices(int, Buffer, int, int). Uses TransformManager and RenderableManager.

        NOTE: this operation is independent of animation.

      • getAnimationCount

        public int getAnimationCount()
        Returns the number of animation definitions in the glTF asset.
      • getAnimationDuration

        public float getAnimationDuration​(@IntRange(from=0L)
                                          int animationIndex)
        Returns the duration of the specified glTF animation in seconds.
        Parameters:
        animationIndex - Zero-based index for the animation of interest.
        See Also:
        getAnimationCount()
      • getAnimationName

        public java.lang.String getAnimationName​(@IntRange(from=0L)
                                                 int animationIndex)
        Returns a weak reference to the string name of the specified animation, or an empty string if none was specified.
        Parameters:
        animationIndex - Zero-based index for the animation of interest.
        See Also:
        getAnimationCount()