APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.graphics.g3d.utils

public Class BaseAnimationController

extends Object
Class Inheritance
Known Direct Subclasses
com.badlogic.gdx.graphics.g3d.utils.AnimationController
Imports
com.badlogic.gdx.graphics.g3d.ModelInstance, com.badlogic.gdx.graphics.g3d.model.Animation, .Node, .NodeAnimation, .NodeKeyframe, com.badlogic.gdx.math.Matrix4, .Quaternion, .Vector3, com.badlogic.gdx.utils.Array, .GdxRuntimeException, .ObjectMap, .ObjectMap.Entry, .Pool, .Pool.Poolable

Base class for applying one or more Animations to a ModelInstance. This class only applies the actual Node transformations, it does not manage animations or keep track of animation states. See AnimationController for an implementation of this class which does manage animations.
Author
Xoppa

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private boolean
public final ModelInstance
target

The ModelInstance on which the animations are being performed.

private static final BaseAnimationController.Transform
private final Pool<BaseAnimationController.Transform>
private static final ObjectMap<Node, BaseAnimationController.Transform>

Constructor Summary

AccessConstructor and Description
public
BaseAnimationController(final ModelInstance
The ModelInstance on which the animations are being performed.
target
)

Construct a new BaseAnimationController.

Method Summary

Modifier and TypeMethod and Description
protected void
apply(final Animation animation, final float time, final float
The blend weight of this animation relative to the previous applied animations.
weight
)

Apply an animation, must be called between {begin() and {end().

protected void
applyAnimation(final Animation animation, final float time)

Apply a single animation to the ModelInstance and update the it to reflect the changes.

protected static void
applyAnimation(final ObjectMap<Node, BaseAnimationController.Transform> out, final Pool<BaseAnimationController.Transform> pool, final float alpha, final Animation animation, final float time)

Helper method to apply one animation to either an objectmap for blending or directly to the bones.

protected void
applyAnimations(final Animation anim1, final float time1, final Animation anim2, final float time2, final float weight)

Apply two animations, blending the second onto to first using weight.

private static final void
applyNodeAnimationBlending(final NodeAnimation nodeAnim, final ObjectMap<Node, BaseAnimationController.Transform> out, final Pool<BaseAnimationController.Transform> pool, final float alpha, final float time)

private static final void
applyNodeAnimationDirectly(final NodeAnimation nodeAnim, final float time)

protected void
begin()

Begin applying multiple animations to the instance, must followed by one or more calls to { apply(Animation, float, float) and finally {end().

protected void
end()

End applying multiple animations to the instance and update it to reflect the changes.

pack-priv static final <T> int

Returns:

key frame index, 0 if time is out of key frames time range
getFirstKeyframeIndexAtTime
(final Array<NodeKeyframe<T>>
Key frames ordered by time ascending
arr
,
final float
Time to search
time
)

Find first key frame index just before a given time

private static final BaseAnimationController.Transform
getNodeAnimationTransform(final NodeAnimation nodeAnim, final float time)

private static final Quaternion
getRotationAtTime(final NodeAnimation nodeAnim, final float time, final Quaternion out)

private static final Vector3
getScalingAtTime(final NodeAnimation nodeAnim, final float time, final Vector3 out)

private static final Vector3
getTranslationAtTime(final NodeAnimation nodeAnim, final float time, final Vector3 out)

protected void
removeAnimation(final Animation animation)

Remove the specified animation, by marking the affected nodes as not animated.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

applyingback to summary
private boolean applying
targetback to summary
public final ModelInstance target

The ModelInstance on which the animations are being performed.

tmpTback to summary
private static final BaseAnimationController.Transform tmpT
transformPoolback to summary
private final Pool<BaseAnimationController.Transform> transformPool
transformsback to summary
private static final ObjectMap<Node, BaseAnimationController.Transform> transforms

Constructor Detail

BaseAnimationControllerback to summary
public BaseAnimationController(final ModelInstance target)

Construct a new BaseAnimationController.

Parameters
target:ModelInstance

The ModelInstance on which the animations are being performed.

Method Detail

applyback to summary
protected void apply(final Animation animation, final float time, final float weight)

Apply an animation, must be called between {begin() and {end().

Parameters
weight:float

The blend weight of this animation relative to the previous applied animations.

applyAnimationback to summary
protected void applyAnimation(final Animation animation, final float time)

Apply a single animation to the ModelInstance and update the it to reflect the changes.

applyAnimationback to summary
protected static void applyAnimation(final ObjectMap<Node, BaseAnimationController.Transform> out, final Pool<BaseAnimationController.Transform> pool, final float alpha, final Animation animation, final float time)

Helper method to apply one animation to either an objectmap for blending or directly to the bones.

applyAnimationsback to summary
protected void applyAnimations(final Animation anim1, final float time1, final Animation anim2, final float time2, final float weight)

Apply two animations, blending the second onto to first using weight.

applyNodeAnimationBlendingback to summary
private static final void applyNodeAnimationBlending(final NodeAnimation nodeAnim, final ObjectMap<Node, BaseAnimationController.Transform> out, final Pool<BaseAnimationController.Transform> pool, final float alpha, final float time)
applyNodeAnimationDirectlyback to summary
private static final void applyNodeAnimationDirectly(final NodeAnimation nodeAnim, final float time)
beginback to summary
protected void begin()

Begin applying multiple animations to the instance, must followed by one or more calls to { apply(Animation, float, float) and finally {end().

endback to summary
protected void end()

End applying multiple animations to the instance and update it to reflect the changes.

getFirstKeyframeIndexAtTimeback to summary
pack-priv static final <T> int getFirstKeyframeIndexAtTime(final Array<NodeKeyframe<T>> arr, final float time)

Find first key frame index just before a given time

Parameters
arr:Array<NodeKeyframe<T>>

Key frames ordered by time ascending

time:float

Time to search

Returns:int

key frame index, 0 if time is out of key frames time range

getNodeAnimationTransformback to summary
private static final BaseAnimationController.Transform getNodeAnimationTransform(final NodeAnimation nodeAnim, final float time)
getRotationAtTimeback to summary
private static final Quaternion getRotationAtTime(final NodeAnimation nodeAnim, final float time, final Quaternion out)
getScalingAtTimeback to summary
private static final Vector3 getScalingAtTime(final NodeAnimation nodeAnim, final float time, final Vector3 out)
getTranslationAtTimeback to summary
private static final Vector3 getTranslationAtTime(final NodeAnimation nodeAnim, final float time, final Vector3 out)
removeAnimationback to summary
protected void removeAnimation(final Animation animation)

Remove the specified animation, by marking the affected nodes as not animated. When switching animation, this should be call prior to applyAnimation(s).

com.badlogic.gdx.graphics.g3d.utils back to summary

public final Class BaseAnimationController.Transform

extends Object
implements Poolable
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.graphics.g3d.utils.BaseAnimationController.Transform
All Implemented Interfaces
com.badlogic.gdx.utils.Pool.Poolable

Field Summary

Modifier and TypeField and Description
public final Quaternion
public final Vector3
public final Vector3

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public BaseAnimationController.Transform
idt()

public BaseAnimationController.Transform
lerp(final BaseAnimationController.Transform target, final float alpha)

public BaseAnimationController.Transform
lerp(final Vector3 targetT, final Quaternion targetR, final Vector3 targetS, final float alpha)

public void
reset()

Implements com.badlogic.gdx.utils.Pool.Poolable.reset.

Resets the object for reuse.

public BaseAnimationController.Transform
set(final Vector3 t, final Quaternion r, final Vector3 s)

public BaseAnimationController.Transform
public Matrix4
toMatrix4(final Matrix4 out)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

rotationback to summary
public final Quaternion rotation
scaleback to summary
public final Vector3 scale
translationback to summary
public final Vector3 translation

Constructor Detail

Transformback to summary
public Transform()

Method Detail

idtback to summary
public BaseAnimationController.Transform idt()
lerpback to summary
public BaseAnimationController.Transform lerp(final BaseAnimationController.Transform target, final float alpha)
lerpback to summary
public BaseAnimationController.Transform lerp(final Vector3 targetT, final Quaternion targetR, final Vector3 targetS, final float alpha)
resetback to summary
public void reset()

Implements com.badlogic.gdx.utils.Pool.Poolable.reset.

Doc from com.badlogic.gdx.utils.Pool.Poolable.reset.

Resets the object for reuse. Object references should be nulled and fields may be set to default values.

Annotations
@Override
setback to summary
public BaseAnimationController.Transform set(final Vector3 t, final Quaternion r, final Vector3 s)
setback to summary
public BaseAnimationController.Transform set(final BaseAnimationController.Transform other)
toMatrix4back to summary
public Matrix4 toMatrix4(final Matrix4 out)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override