Class IntMeshPart
java.lang.Object
gaiasky.util.gdx.model.IntMeshPart
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal com.badlogic.gdx.math.Vector3The offset to the center of the bounding box of the shape, only valid after the call toupdate().final com.badlogic.gdx.math.Vector3The location, relative tocenter, of the corner of the axis aligned bounding box of the shape.Unique id within model, may be null.The Mesh the part references, also stored inIntModelintThe offset in themeshto this part.intThe primitive type, OpenGL constant e.g:GL20.GL_TRIANGLES,GL20.GL_POINTS,GL20.GL_LINES,GL20.GL_LINE_STRIP,GL20.GL_TRIANGLE_STRIPfloatThe radius relative tocenterof the bounding sphere of the shape, or negative if not calculated yet.intThe size (in total number of vertices) of this part in themesh. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new MeshPart, with null values.IntMeshPart(com.badlogic.gdx.graphics.g3d.model.MeshPart other) IntMeshPart(IntMeshPart copyFrom) Construct a new MeshPart which is an exact copy of the provided MeshPart.IntMeshPart(String id, IntMesh mesh, int offset, int size, int type) Construct a new MeshPart and set all its values. -
Method Summary
Modifier and TypeMethodDescriptionbooleanequals(IntMeshPart other) Compares this MeshPart to the specified MeshPart and returns true if they both reference the sameIntMeshand theoffset,sizeandprimitiveTypemembers are equal.booleanvoidrender(ExtShaderProgram shader) Renders the mesh part using the specified shader, must be called in betweenExtShaderProgram.begin()andExtShaderProgram.end().voidrender(ExtShaderProgram shader, boolean autoBind) Renders the mesh part using the specified shader, must be called in betweenExtShaderProgram.begin()andExtShaderProgram.end().set(IntMeshPart other) Set this MeshPart to be a copy of the other MeshPartSet this MeshPart to given values, does notupdate()the bounding box values.voidupdate()
-
Field Details
-
center
public final com.badlogic.gdx.math.Vector3 centerThe offset to the center of the bounding box of the shape, only valid after the call toupdate(). -
halfExtents
public final com.badlogic.gdx.math.Vector3 halfExtentsThe location, relative tocenter, of the corner of the axis aligned bounding box of the shape. Or, in other words: half the dimensions of the bounding box of the shape, whereVector3.xis half the width,Vector3.yis half the height andVector3.zis half the depth. Only valid after the call toupdate(). -
id
Unique id within model, may be null. Will be ignored byequals(IntMeshPart) -
primitiveType
public int primitiveTypeThe primitive type, OpenGL constant e.g:GL20.GL_TRIANGLES,GL20.GL_POINTS,GL20.GL_LINES,GL20.GL_LINE_STRIP,GL20.GL_TRIANGLE_STRIP -
offset
public int offsetThe offset in themeshto this part. If the mesh is indexed (Mesh.getNumIndices()> 0), this is the offset in the indices array, otherwise it is the offset in the vertices array. -
size
public int sizeThe size (in total number of vertices) of this part in themesh. When the mesh is indexed (Mesh.getNumIndices()> 0), this is the number of indices, otherwise it is the number of vertices. -
mesh
-
radius
public float radiusThe radius relative tocenterof the bounding sphere of the shape, or negative if not calculated yet. This is the same as the length of thehalfExtentsmember. Seeupdate().
-
-
Constructor Details
-
IntMeshPart
public IntMeshPart()Construct a new MeshPart, with null values. The MeshPart is unusable until you set all members. -
IntMeshPart
public IntMeshPart(com.badlogic.gdx.graphics.g3d.model.MeshPart other) -
IntMeshPart
Construct a new MeshPart and set all its values.- Parameters:
id- The id of the new part, may be null.mesh- The mesh which holds all vertices and (optional) indices of this part.offset- The offset within the mesh to this part.size- The size (in total number of vertices) of the part.type- The primitive type of the part (e.g. GL_TRIANGLES, GL_LINE_STRIP, etc.).
-
IntMeshPart
Construct a new MeshPart which is an exact copy of the provided MeshPart.- Parameters:
copyFrom- The MeshPart to copy.
-
-
Method Details
-
set
Set this MeshPart to be a copy of the other MeshPart- Parameters:
other- The MeshPart from which to copy the values- Returns:
- this MeshPart, for chaining
-
set
Set this MeshPart to given values, does notupdate()the bounding box values.- Returns:
- this MeshPart, for chaining.
-
update
public void update()Calculates and updates thecenter,halfExtentsandradiusvalues. This is considered a costly operation and should not be called frequently. All vertices (points) of the shape are traversed to calculate the maximum and minimum x, y and z coordinate of the shape. Note that MeshPart is not aware of any transformation that might be applied when rendering. It calculates the untransformed (not moved, not scaled, not rotated) values. -
equals
Compares this MeshPart to the specified MeshPart and returns true if they both reference the sameIntMeshand theoffset,sizeandprimitiveTypemembers are equal. Theidmember is ignored.- Parameters:
other- The other IntMeshPart to compare this IntMeshPart to.- Returns:
- True when this IntMeshPart equals the other IntMeshPart (ignoring the
idmember), false otherwise.
-
equals
-
render
Renders the mesh part using the specified shader, must be called in betweenExtShaderProgram.begin()andExtShaderProgram.end().- Parameters:
shader- the shader to be usedautoBind- overrides the autoBind member of the Mesh
-
render
Renders the mesh part using the specified shader, must be called in betweenExtShaderProgram.begin()andExtShaderProgram.end().- Parameters:
shader- the shader to be used
-