com.badlogic.gdx.graphics.g3d.Renderable
A Renderable contains all information about a single render instruction (typically a draw call). It defines what (the shape), how (the material) and where (the transform) should be rendered by which shader. The shape is defined using the {@link #mesh}, {@link #meshPartOffset}, {@link #meshPartSize} and {@link #primitiveType}members. This matches the members of the {@link MeshPart} class. The {@link #meshPartOffset} is used to specify the offsetwithin the mesh and the {@link #meshPartSize} is used to specify the part (in total number of vertices) to render. If the meshis indexed (which is when {@link Mesh#getNumIndices()} > 0) then both values are in number of indices within the indices arrayof the mesh, otherwise they are in number of vertices within the vertices array of the mesh. Note that some classes might require the mesh to be indexed. The {@link #material} and (optional) {@link #environment} values are combined to specify how the shape should look like.Typically these are used to specify uniform values or other OpenGL state changes. When a value is present in both the {@link #material} and {@link #environment}, then the value of the {@link #material} will be used.Renderables can be rendered directly using a {@link Shader} (in which case the {@link #shader} member is ignored). Though moretypically Renderables are rendered via a {@link ModelBatch}, either directly, or by passing a {@link RenderableProvider} like{@link ModelInstance} to the RenderBatch.A ModelInstance returns all Renderables via its {@link ModelInstance#getRenderables(Array,Pool)} method. In which case thevalue of {@link ModelInstance#userData} will be set to the {@link #userData} member. The {@link #userData} member can be usedto pass additional data to the shader. However, in most scenario's it is advised to use the {@link #material} or{@link #environment} member with custom {@link Attribute}s to pass data to the shader. In some cases, (for example for non-hierarchical basic game objects requiring only a single draw call) it is possible to extend the Renderable class and add additional fields to pass to the shader. While extending the Renderable class can be useful, the shader should not rely on it. Similar to the {@link #userData} member it is advised to use the {@link #material} and{@link #environment} members to pass data to the shader.When using a ModelBatch to render a Renderable, The Renderable and all its values must not be changed in between the call to {@link ModelBatch#begin(com.badlogic.gdx.graphics.Camera)} and {@link ModelBatch#end()}. Therefor Renderable instances cannot be reused for multiple render calls. When the {@link #shader} member of the Renderable is set, the {@link ShaderProvider} of the {@link ModelBatch} may decide touse that shader instead of the default shader. Therefor, to assure the default shader is used, the {@link #shader} member mustbe set to null.
@author badlogic, xoppa