libgdx API

com.badlogic.gdx.graphics.g3d.model.skeleton
Class SkeletonModel

java.lang.Object
  extended by com.badlogic.gdx.graphics.g3d.model.skeleton.SkeletonModel
All Implemented Interfaces:
AnimatedModel, Model
Direct Known Subclasses:
SkeletonModelGpuSkinned

public class SkeletonModel
extends java.lang.Object
implements AnimatedModel


Field Summary
protected  SkeletonAnimation[] animations
           
 Skeleton skeleton
           
 SkeletonSubMesh[] subMeshes
           
 
Constructor Summary
SkeletonModel(Skeleton skeleton, SubMesh[] subMeshes)
           
 
Method Summary
 void dispose()
          This function releases memory once you are done with the Model.
 SkeletonAnimation getAnimation(java.lang.String name)
          Get a specific named animation out of the model.
 SkeletonAnimation[] getAnimations()
          Get an array containing all of the animations in this model.
 void getBoundingBox(BoundingBox bbox)
          Generates the bounding box for the Model.

For every finite 3D object there exists a box that can enclose the object.
 SubMesh getSubMesh(java.lang.String name)
           
 SubMesh[] getSubMeshes()
           
 Model getSubModel(java.lang.String... subMeshNames)
          Returns a Model that is made up of the sub-meshes with the provided names.
 void render()
          Renders the model using the GL10 pipeline.

Important: This model must have materials set before you can use this render function.
 void render(ShaderProgram program)
          Renders this model using the GL20 shader pipeline.

IMPORTANT: This model must have materials set before you can use this render function.
 void setAnimation(java.lang.String animation, float time, boolean loop)
          Start playing the given animation at the given time in the animation and specify wether or not the animation will loop.
 void setBindPose()
           
 void setMaterial(Material material)
          Sets the Material of every SubMesh in this Model to be the material provided.
 void setMaterials(Material... materials)
          Sets every Material of every SubMesh in this Model to be the materials provided.
 void skin(SkeletonSubMesh subMesh, Array<Matrix4> boneMatrices)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

skeleton

public final Skeleton skeleton

subMeshes

public final SkeletonSubMesh[] subMeshes

animations

protected SkeletonAnimation[] animations
Constructor Detail

SkeletonModel

public SkeletonModel(Skeleton skeleton,
                     SubMesh[] subMeshes)
Method Detail

setBindPose

public void setBindPose()

setAnimation

public void setAnimation(java.lang.String animation,
                         float time,
                         boolean loop)
Description copied from interface: AnimatedModel
Start playing the given animation at the given time in the animation and specify wether or not the animation will loop.

Specified by:
setAnimation in interface AnimatedModel
Parameters:
animation - The name of the animation in this Model that you should play.
time - The time, in seconds, of the section to start the animation.
loop - Whether or not the animation will loop if the time is after the end of the animation. (TODO what happens when you reach the end of the animation and this is not set?)

skin

public void skin(SkeletonSubMesh subMesh,
                 Array<Matrix4> boneMatrices)

render

public void render()
Description copied from interface: Model
Renders the model using the GL10 pipeline.

Important: This model must have materials set before you can use this render function. Do that by using Model.setMaterials(Material...).

Specified by:
render in interface Model

render

public void render(ShaderProgram program)
Description copied from interface: Model
Renders this model using the GL20 shader pipeline.

IMPORTANT: This model must have materials set before you can use this render function. Do that by using Model.setMaterials(Material...).

Specified by:
render in interface Model
Parameters:
program - The shader program that you will use to draw this object to the screen. It must be non-null.

setMaterials

public void setMaterials(Material... materials)
Description copied from interface: Model
Sets every Material of every SubMesh in this Model to be the materials provided.

Specified by:
setMaterials in interface Model
Parameters:
materials - A list of the materials to set the submeshes to for this model. (The length of the list of materials must be the same as the number of SubMeshes in this Model. Failure to do so will result in an UnsupportedOperationException)

setMaterial

public void setMaterial(Material material)
Description copied from interface: Model
Sets the Material of every SubMesh in this Model to be the material provided.

Specified by:
setMaterial in interface Model
Parameters:
material - The Material that you wish the whole object to be rendered with.

getSubMesh

public SubMesh getSubMesh(java.lang.String name)
Specified by:
getSubMesh in interface Model
Parameters:
name - The name of the SubMesh to be acquired.
Returns:
The SubMesh that matches that name; or null, if one does not exist.

getSubMeshes

public SubMesh[] getSubMeshes()
Specified by:
getSubMeshes in interface Model
Returns:
An array of every SubMesh that makes up this model.

getAnimation

public SkeletonAnimation getAnimation(java.lang.String name)
Description copied from interface: AnimatedModel
Get a specific named animation out of the model.

Specified by:
getAnimation in interface AnimatedModel
Parameters:
name - The name of the animation that you wish to get.
Returns:
The Animation that you requested; or, if the animation does not exist, null is returned.

getAnimations

public SkeletonAnimation[] getAnimations()
Description copied from interface: AnimatedModel
Get an array containing all of the animations in this model.

Specified by:
getAnimations in interface AnimatedModel
Returns:
An array containing a list of all of the animations in this model.

getSubModel

public Model getSubModel(java.lang.String... subMeshNames)
Description copied from interface: Model
Returns a Model that is made up of the sub-meshes with the provided names.

Specified by:
getSubModel in interface Model
Parameters:
subMeshNames - A list of names of each SubMesh that is to be extracted from this model.
Returns:
A new Model that is only made up of the parts you requested.

getBoundingBox

public void getBoundingBox(BoundingBox bbox)
Description copied from interface: Model
Generates the bounding box for the Model.

For every finite 3D object there exists a box that can enclose the object. This function sets the give BoundingBox to be one such enclosing box.
Bounding boxes are useful for very basic collision detection amongst other tasks.

Specified by:
getBoundingBox in interface Model
Parameters:
bbox - The provided BoundingBox will have its internal values correctly set. (To allow Java Object reuse)

dispose

public void dispose()
Description copied from interface: Model
This function releases memory once you are done with the Model. Once you are finished with the Model you MUST call this function or else you will suffer memory leaks.

Specified by:
dispose in interface Model

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)