|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.graphics.g3d.keyframed.KeyframedModel
public class KeyframedModel
An animated model with KeyframeAnimation
s. Currently the animations can only be instanced from an MD5Animation
.
Support for binary serialization may be included in loadFuture development.
Constructor Summary | |
---|---|
KeyframedModel()
|
Method Summary | |
---|---|
void |
dispose()
|
KeyframeAnimation |
getAnimation(java.lang.String animKey)
Gets the specified KeyframeAnimation from the animation map. |
Animator |
getAnimator()
Gets the KeyframeAnimator for this model. |
void |
getJointData(int tagIndex,
Vector3 pos,
Quaternion orient)
|
void |
render()
Draws the model using the current interpolated animation frame and the material list set by setMaterials(com.badlogic.gdx.graphics.g3d.Material[]) . |
KeyframeAnimation |
sampleAnimationFromMD5(MD5Model md5model,
MD5Renderer md5renderer,
MD5Animator md5animator,
MD5Animation md5animation,
float sampleRate,
java.lang.String modelAsset,
java.lang.String animKey)
Loads a single KeyframeAnimation from an MD5Animation , then stores it in the animation dictionary for
runtime playback. |
void |
setAnimation(java.lang.String animKey,
Animator.WrapMode wrapMode)
Set the current playing animation. |
void |
setMaterials(Material[] mats)
Sets the Material list for this model, one for each mesh, in mesh order. |
void |
setMeshVisible(int idx,
boolean visible)
Sets the specified mesh's visibility (MD5 models typically consist of a number of meshes). |
void |
setTaggedJoints(java.util.ArrayList<java.lang.String> joints)
Sets the tagged joints for this model's animations. |
void |
update(float dt)
Updates the model, causing the model's KeyframeAnimator to interpolate the animation and update the render geometry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyframedModel()
Method Detail |
---|
public Animator getAnimator()
KeyframeAnimator
for this model.
public void setMaterials(Material[] mats)
Material
list for this model, one for each mesh, in mesh order.
mats
- An array of materials.public void setTaggedJoints(java.util.ArrayList<java.lang.String> joints)
joints
- An array of joint names.public KeyframeAnimation sampleAnimationFromMD5(MD5Model md5model, MD5Renderer md5renderer, MD5Animator md5animator, MD5Animation md5animation, float sampleRate, java.lang.String modelAsset, java.lang.String animKey)
KeyframeAnimation
from an MD5Animation
, then stores it in the animation dictionary for
runtime playback. The dictionary manages ref counted animations so you do not have multiple copies of 100k animations in
memory when you only need one per unique MD5 model. You must call dispose() when finished with this class.
md5model
- The source MD5Model
.md5renderer
- An MD5Renderer
instance, used to calculate the skinned geometry.md5animator
- An MD5Animator
instance to control the MD5 animation cycle the keyframing samples from.md5animation
- The MD5Animation
to sample.sampleRate
- The sample rate (use smaller values for smoother animation but greater memory usage). Recommended value:
0.3modelAsset
- The name of the model asset. Must be unique to the model. Using its path is recommendedanimKey
- The name used to store the animation in the mode's animation map.public void getJointData(int tagIndex, Vector3 pos, Quaternion orient)
public void setAnimation(java.lang.String animKey, Animator.WrapMode wrapMode)
animKey
- The name of the animation.wrapMode
- The animation Animator.WrapMode
.public KeyframeAnimation getAnimation(java.lang.String animKey)
KeyframeAnimation
from the animation map.
animKey
- The name of the animation.
public void update(float dt)
KeyframeAnimator
to interpolate the animation and update the render geometry.
dt
- Delta time since last frame.public void render()
setMaterials(com.badlogic.gdx.graphics.g3d.Material[])
.
update(float)
must be called prior to this.
public void setMeshVisible(int idx, boolean visible)
idx
- the mesh's index (same order as found in the .md5mesh file)visible
- whether the mesh should be drawn or notpublic void dispose()
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |