Class AbstractAnimationChannel
java.lang.Object
com.ardor3d.extension.animation.skeletal.clip.AbstractAnimationChannel
- All Implemented Interfaces:
Savable
- Direct Known Subclasses:
InterpolatedDoubleChannel
,InterpolatedFloatChannel
,TransformChannel
,TriggerChannel
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 Summary
Modifier and TypeFieldDescriptionprotected final String
The name of this channel.protected final float[]
Our time indices. -
Constructor Summary
ConstructorDescriptionAbstractAnimationChannel
(String channelName, float[] times) Construct a new channel. -
Method Summary
Modifier and TypeMethodDescriptionabstract Object
createStateDataObject
(AnimationClipInstance instance) float
int
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.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.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.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.float[]
getTimes()
void
read
(InputCapsule capsule) 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.void
updateSample
(double clockTime, Object applyTo) Update the given applyTo object with information from this channel at the given time position.void
write
(OutputCapsule capsule) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ardor3d.util.export.Savable
getClassTag
-
Field Details
-
_channelName
The name of this channel. -
_times
protected final float[] _timesOur time indices. Each index of the array should contain a value that is greater than the value in the previous index.
-
-
Constructor Details
-
AbstractAnimationChannel
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
-
getTimes
public float[] getTimes() -
updateSample
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
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+1applyTo
- the data object to apply this channel's information to.
-
createStateDataObject
- 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
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
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
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-