Package gaia.cu9.ari.gaiaorbit.util.gdx
Class IntRenderable
- java.lang.Object
-
- gaia.cu9.ari.gaiaorbit.util.gdx.IntRenderable
-
public class IntRenderable extends java.lang.Object
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 mesh, meshPartOffset, meshPartSize and primitiveType members. This matches the members of theIntMeshPart
class. The meshPartOffset is used to specify the offset within the mesh and the meshPartSize is used to specify the part (in total number of vertices) to render. If the mesh is indexed (which is whenIntMesh.getNumIndices()
> 0) then both values are in number of indices within the indices array of 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. Thematerial
and (optional)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 thematerial
andenvironment
, then the value of thematerial
will be used. Renderables can be rendered directly using aIntShader
(in which case theshader
member is ignored). Though more typically Renderables are rendered via aIntModelBatch
, either directly, or by passing aIntRenderableProvider
likeIntModelInstance
to the RenderBatch. A ModelInstance returns all Renderables via itsIntModelInstance.getRenderables(Array, Pool)
method. In which case the value ofIntModelInstance.userData
will be set to theuserData
member. TheuserData
member can be used to pass additional data to the shader. However, in most scenario's it is advised to use thematerial
orenvironment
member with customAttribute
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 theuserData
member it is advised to use thematerial
andenvironment
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 toIntModelBatch.begin(com.badlogic.gdx.graphics.Camera)
andIntModelBatch.end()
. Therefor Renderable instances cannot be reused for multiple render calls. When theshader
member of the Renderable is set, theIntShaderProvider
of theIntModelBatch
may decide to use that shader instead of the default shader. Therefor, to assure the default shader is used, theshader
member must be set to null.
-
-
Field Summary
Fields Modifier and Type Field Description com.badlogic.gdx.math.Matrix4[]
bones
The bone transformations used for skinning, or null if not applicable.com.badlogic.gdx.graphics.g3d.Environment
environment
TheEnvironment
to be used to render this Renderable, may be null.com.badlogic.gdx.graphics.g3d.Material
material
TheMaterial
to be applied to the shape (part of the mesh), must not be null.IntMeshPart
meshPart
TheIntMeshPart
that contains the shape to renderIntShader
shader
TheIntShader
to be used to render this Renderable using aIntModelBatch
, may be null.java.lang.Object
userData
User definable value, may be null.com.badlogic.gdx.math.Matrix4
worldTransform
Used to specify the transformations (like translation, scale and rotation) to apply to the shape.
-
Constructor Summary
Constructors Constructor Description IntRenderable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntRenderable
set(IntRenderable renderable)
-
-
-
Field Detail
-
worldTransform
public final com.badlogic.gdx.math.Matrix4 worldTransform
Used to specify the transformations (like translation, scale and rotation) to apply to the shape. In other words: it is used to transform the vertices from model space into world space.
-
meshPart
public final IntMeshPart meshPart
TheIntMeshPart
that contains the shape to render
-
material
public com.badlogic.gdx.graphics.g3d.Material material
TheMaterial
to be applied to the shape (part of the mesh), must not be null.- See Also:
environment
-
environment
public com.badlogic.gdx.graphics.g3d.Environment environment
TheEnvironment
to be used to render this Renderable, may be null. When specified it will be combined by the shader with thematerial
. When both the material and environment contain an attribute of the same type, the attribute of the material will be used.
-
bones
public com.badlogic.gdx.math.Matrix4[] bones
The bone transformations used for skinning, or null if not applicable. When specified and the mesh contains one or moreVertexAttributes.Usage.BoneWeight
vertex attributes, then the BoneWeight index is used as index in the array. If the array isn't large enough then the identity matrix is used. Each BoneWeight weight is used to combine multiple bones into a single transformation matrix, which is used to transform the vertex to model space. In other words: the bone transformation is applied prior to theworldTransform
.
-
shader
public IntShader shader
TheIntShader
to be used to render this Renderable using aIntModelBatch
, may be null. It is not guaranteed that the shader will be used, the usedIntShaderProvider
is responsible for actually choosing the correct shader to use.
-
userData
public java.lang.Object userData
User definable value, may be null.
-
-
Method Detail
-
set
public IntRenderable set(IntRenderable renderable)
-
-