Class AbstractAnimationChannel

java.lang.Object
com.ardor3d.extension.animation.skeletal.clip.AbstractAnimationChannel
All Implemented Interfaces:
Savable
Direct Known Subclasses:
InterpolatedDoubleChannel, InterpolatedFloatChannel, TransformChannel, TriggerChannel

public abstract class AbstractAnimationChannel extends Object implements Savable
Base class for animation channels. An animation channel describes a single element of an animation (such as the movement of a single joint, or the play back of a specific sound, etc.) These channels are grouped together in an AnimationClip to describe a full animation.
  • Field Details

    • _channelName

      protected final String _channelName
      The name of this channel.
    • _times

      protected final float[] _times
      Our time indices. Each index of the array should contain a value that is greater than the value in the previous index.
  • Constructor Details

    • AbstractAnimationChannel

      public AbstractAnimationChannel(String channelName, float[] times)
      Construct a new channel.
      Parameters:
      channelName - the name of our channel. This is immutable to this instance of the class.
      times - our time indices. Copied into the channel.
  • Method Details

    • getSampleCount

      public int getSampleCount()
      Returns:
      the number of samples in this channel.
    • getChannelName

      public String getChannelName()
    • getTimes

      public float[] getTimes()
    • updateSample

      public void updateSample(double clockTime, Object applyTo)
      Update the given applyTo object with information from this channel at the given time position.
      Parameters:
      clockTime - the current local clip time (where 0 == start of clip)
      applyTo - the Object to apply to. The type of the object and what data is set will depend on the Channel subclass.
    • setCurrentSample

      public abstract void setCurrentSample(int sampleIndex, double progressPercent, Object applyTo)
      Sets data on the given applyTo Object for the given sampleIndex and a percent progress towards the sample following it.
      Parameters:
      sampleIndex - the sample to pull information from.
      progressPercent - a value [0.0, 1.0] representing progress from sampleIndex to sampleIndex+1
      applyTo - the data object to apply this channel's information to.
    • createStateDataObject

      public abstract Object createStateDataObject(AnimationClipInstance instance)
      Parameters:
      instance - the instance creating and storing the state data object.
      Returns:
      an Object suitable for storing information for this type of animation channel.
    • getSubchannelBySample

      public AbstractAnimationChannel getSubchannelBySample(int startSample, int endSample)
      Returns a new channel of the same name and content as this, but trimmed to just the times between start and end sample.
      Parameters:
      startSample - the sample to start with (inclusive). Sample counting starts at 0.
      endSample - the sample to end with (inclusive). max is getSampleCount() - 1.
      Returns:
      the new channel.
    • getSubchannelBySample

      public abstract AbstractAnimationChannel getSubchannelBySample(String name, int startSample, int endSample)
      Returns a new channel of the same content as this, but trimmed to just the times between start and end sample.
      Parameters:
      name - the new name for our subchannel.
      startSample - the sample to start with (inclusive). Sample counting starts at 0.
      endSample - the sample to end with (inclusive). max is getSampleCount() - 1.
      Returns:
      the new channel.
      Throws:
      IllegalArgumentException - if start greater than end or end greater than or equal to getSampleCount.
    • getSubchannelByTime

      public AbstractAnimationChannel getSubchannelByTime(float startTime, float endTime)
      Returns a new channel of the same name and content as this, but trimmed to just the times between start and end times.
      Parameters:
      startTime - the time to start with (inclusive)
      endTime - the time to end with (inclusive)
      Returns:
      the new channel.
    • getSubchannelByTime

      public abstract AbstractAnimationChannel getSubchannelByTime(String name, float startTime, float endTime)
      Returns a new channel of the same content as this, but trimmed to just the times between start and end sample.
      Parameters:
      name - the new name for our subchannel.
      startTime - the time to start with (inclusive)
      endTime - the time to end with (inclusive)
      Returns:
      the new channel.
      Throws:
      IllegalArgumentException - if start greater than end or end greater than or equal to getSampleCount.
    • getMaxTime

      public float getMaxTime()
      Returns:
      the local time index of the last sample in this channel.
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Throws:
      IOException
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Throws:
      IOException