libgdx API

com.badlogic.gdx.graphics.g3d.model
Interface Model

All Known Subinterfaces:
AnimatedModel
All Known Implementing Classes:
KeyframedModel, SkeletonModel, SkeletonModelGpuSkinned, StillModel

public interface Model


Method Summary
 void dispose()
          This function releases memory once you are done with the 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 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.
 

Method Detail

render

void render()
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 setMaterials(Material...).


render

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. Do that by using setMaterials(Material...).

Parameters:
program - The shader program that you will use to draw this object to the screen. It must be non-null.

getSubModel

Model getSubModel(java.lang.String... subMeshNames)
Returns a Model that is made up of the sub-meshes with the provided names.

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.

getSubMesh

SubMesh getSubMesh(java.lang.String name)
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

SubMesh[] getSubMeshes()
Returns:
An array of every SubMesh that makes up this model.

getBoundingBox

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. This function sets the give BoundingBox to be one such enclosing box.
Bounding boxes are useful for very basic collision detection amongst other tasks.

Parameters:
bbox - The provided BoundingBox will have its internal values correctly set. (To allow Java Object reuse)

setMaterials

void setMaterials(Material... materials)
Sets every Material of every SubMesh in this Model to be the materials provided.

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

void setMaterial(Material material)
Sets the Material of every SubMesh in this Model to be the material provided.

Parameters:
material - The Material that you wish the whole object to be rendered with.

dispose

void dispose()
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.


libgdx API

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