Class BinaryLERPSource

java.lang.Object
com.ardor3d.extension.animation.skeletal.blendtree.AbstractTwoPartSource
com.ardor3d.extension.animation.skeletal.blendtree.BinaryLERPSource
All Implemented Interfaces:
BlendTreeSource

public class BinaryLERPSource extends AbstractTwoPartSource

Takes two blend sources and uses linear interpolation to merge TransformData values. If one of the sources is null, or does not have a key that the other does, we disregard weighting and use the non-null side's full value.

Source data that is not TransformData is not combined, rather A's value will always be used unless it is null.

  • Constructor Details

    • BinaryLERPSource

      public BinaryLERPSource()
      Construct a new lerp source. The two sub sources should be set separately before use.
    • BinaryLERPSource

      public BinaryLERPSource(BlendTreeSource sourceA, BlendTreeSource sourceB)
      Construct a new lerp source using the supplied sources.
      Parameters:
      sourceA - our first source.
      sourceB - our second source.
  • Method Details

    • getSourceData

      public Map<String,? extends Object> getSourceData(AnimationManager manager)
      Parameters:
      manager - the manager this is being called from.
      Returns:
      a map of source information from the blend tree node.
    • setTime

      public boolean setTime(double globalTime, AnimationManager manager)
      Description copied from interface: BlendTreeSource
      Move any clips or animation information to the given global time.
      Parameters:
      globalTime - our new "global" timeline time.
      manager - the manager this is being called from.
      Returns:
      true if we found at least one active clip in the tree
    • resetClips

      public void resetClips(AnimationManager manager, double globalStartTime)
      Description copied from interface: BlendTreeSource
      Reset any clips in this tree. This sets the start time to the given time and sets it active.
      Parameters:
      manager - the manager to use in resetting the clips.
      globalStartTime - the new start time to use.
    • combineSourceData

      public static Map<String,? extends Object> combineSourceData(Map<String,? extends Object> sourceAData, Map<String,? extends Object> sourceBData, Double blendWeight)
      Combines two sets of source data maps by matching elements with the same key. Map values of type TransformData are combined via linear interpolation. Other value types are not combined, rather the value from source A is used unless null. Keys that exist only in one map or the other are preserved in the resulting map.
      Parameters:
      sourceAData - our first source map
      sourceBData - our second source map
      blendWeight - our blend weight - used to perform linear interpolation on TransformData values.
      Returns:
      our combined data map.
    • combineSourceData

      public static Map<String,? extends Object> combineSourceData(Map<String,? extends Object> sourceAData, Map<String,? extends Object> sourceBData, double blendWeight, Map<String,Object> store)
    • blendFloatValue

      protected static void blendFloatValue(Map<String,Object> rVal, String key, double blendWeight, float[] dataA, float[] dataB)
    • blendDoubleValue

      protected static void blendDoubleValue(Map<String,Object> rVal, String key, double blendWeight, double[] dataA, double[] dataB)
    • isActive

      public boolean isActive(AnimationManager manager)
      Description copied from interface: BlendTreeSource
      Check if there are still active clips in the tree.
      Parameters:
      manager - the manager this is being called from.
      Returns:
      true if we found at least one active clip in the tree