Mesh, along with the primitive type. The vertices subset is
described by an offset and size. When the mesh is indexed (which is when Mesh#getNumIndices() > 0), then the
offset represents the offset in the indices array and size represents the number of indices. When the mesh
isn't indexed, then the offset member represents the offset in the vertices array and the size member
represents the number of vertices.
In other words: Regardless whether the mesh is indexed or not, when primitiveType is not a strip, then size
equals the number of primitives multiplied by the number of vertices per primitive. So if the MeshPart represents 4 triangles (
primitiveType is GL_TRIANGLES), then the size member is 12 (4 triangles * 3 vertices = 12 vertices total).
Likewise, if the part represents 12 lines (primitiveType is GL_LINES), then the size is 24 (12 lines * 2 vertices = 24
vertices total).
Note that some classes might require the mesh (part) to be indexed.
The Mesh referenced by the mesh member must outlive the MeshPart. When the mesh is disposed, the MeshPart is
unusable.
| Modifier and Type | Field and Description |
|---|---|
| private static final BoundingBox | bounds
Temporary static |
| public final Vector3 | |
| public final Vector3 | halfExtents
The location, relative to |
| public String | id
Unique id within model, may be null. |
| public Mesh | |
| public int | |
| public int | primitiveType
The primitive type, OpenGL constant e.g: |
| public float | |
| public int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | MeshPart(final String
The id of the new part, may be null. id, final Mesh The mesh which holds all vertices and (optional) indices of this part. mesh, final int The offset within the mesh to this part. offset, final int The size (in total number of vertices) of the part. size, final int The primitive type of the part (e.g. GL_TRIANGLES, GL_LINE_STRIP, etc.). type)Construct a new MeshPart and set all its values. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: True when this MeshPart equals the other MeshPart (ignoring theid member), false otherwise.The other MeshPart to compare this MeshPart to. other)Compares this MeshPart to the specified MeshPart and returns true if they both reference the same |
| public boolean | equals(final Object arg0)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public void | render(ShaderProgram
the shader to be used shader, boolean overrides the autoBind member of the Mesh autoBind)Renders the mesh part using the specified shader, must be called after |
| public void | render(ShaderProgram
the shader to be used shader)Renders the mesh part using the specified shader, must be called after |
| public MeshPart | |
| public MeshPart | |
| public void |
| bounds | back to summary |
|---|---|
| private static final BoundingBox bounds Temporary static | |
| center | back to summary |
|---|---|
| public final Vector3 center The offset to the center of the bounding box of the shape, only valid after the call to | |
| halfExtents | back to summary |
|---|---|
| public final Vector3 halfExtents The location, relative to | |
| id | back to summary |
|---|---|
| public String id Unique id within model, may be null. Will be ignored by | |
| mesh | back to summary |
|---|---|
| public Mesh mesh The Mesh the part references, also stored in | |
| offset | back to summary |
|---|---|
| public int offset The offset in the | |
| primitiveType | back to summary |
|---|---|
| public int primitiveType The primitive type, OpenGL constant e.g: | |
| radius | back to summary |
|---|---|
| public float radius The radius relative to | |
| size | back to summary |
|---|---|
| public int size The size (in total number of vertices) of this part in the | |
| MeshPart | back to summary |
|---|---|
| public MeshPart() Construct a new MeshPart, with null values. The MeshPart is unusable until you set all members. | |
| MeshPart | back to summary |
|---|---|
| public MeshPart(final String id, final Mesh mesh, final int offset, final int size, final int type) Construct a new MeshPart and set all its values.
| |
| MeshPart | back to summary |
|---|---|
| public MeshPart(final MeshPart copyFrom) Construct a new MeshPart which is an exact copy of the provided MeshPart.
| |
| equals | back to summary |
|---|---|
| public boolean equals(final MeshPart other) Compares this MeshPart to the specified MeshPart and returns true if they both reference the same | |
| equals | back to summary |
|---|---|
| public boolean equals(final Object arg0) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| render | back to summary |
|---|---|
| public void render(ShaderProgram shader, boolean autoBind) Renders the mesh part using the specified shader, must be called after
| |
| render | back to summary |
|---|---|
| public void render(ShaderProgram shader) Renders the mesh part using the specified shader, must be called after
| |
| set | back to summary |
|---|---|
| public MeshPart set(final MeshPart other) Set this MeshPart to be a copy of the other MeshPart | |
| set | back to summary |
|---|---|
| public MeshPart set(final String id, final Mesh mesh, final int offset, final int size, final int type) Set this MeshPart to given values, does not
| |
| update | back to summary |
|---|---|
| public void update() Calculates and updates the | |