|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.scene.Spatial
com.jme.scene.Geometry
com.jme.scene.TriMesh
com.jme.scene.CompositeMesh
Composite
defines a geometry mesh. This mesh defines a three dimensional object via a collection of points, colors, normals and textures. The points are referenced via a indices array. This array instructs the renderer the order in which to draw the points, with exact meaning of indices being defined by IndexRange collection. Index ranges are interpreted one after another, consuming their 'count' indices each time. Every range use same vertex data, so it is perfectly possible to reference already used indices from different kind of range.
Nested Class Summary | |
---|---|
static class |
CompositeMesh.IndexRange This class represents range of indexes to be interpreted in a way depending on 'kind' attribute. |
Field Summary |
---|
Fields inherited from class com.jme.scene.Spatial |
---|
defaultStateList, queueDistance |
Constructor Summary | |
---|---|
CompositeMesh(java.lang.String name) Constructor instantiates a new CompositeMesh object. |
|
CompositeMesh(java.lang.String name, Vector3f[] vertices, Vector3f[] normal, ColorRGBA[] color, Vector2f[] texture, int[] indices, CompositeMesh.IndexRange[] ranges) Constructor instantiates a new CompositeMesh object. |
Method Summary | |
---|---|
static CompositeMesh.IndexRange |
createQuadRange(int count) Create index range representing free, unconnected quads. |
static CompositeMesh.IndexRange |
createQuadStrip(int count) Create index range representing quad strip |
static CompositeMesh.IndexRange |
createTriangleFan(int count) Create index range representing triangle fan |
static CompositeMesh.IndexRange |
createTriangleRange(int count) Create index range representing free, unconnected triangles. |
static CompositeMesh.IndexRange |
createTriangleStrip(int count) Create index range representing triangle strip |
void |
draw(Renderer r) draw calls super to set the render state then passes itself to the renderer. |
void |
drawBounds(Renderer r) drawBounds calls super to set the render state then passes itself to the renderer. |
CompositeMesh.IndexRange[] |
getIndexRanges() |
Vector3f[] |
getMeshAsTriangles() Return this mesh object as triangles. |
void |
getTriangle(int i, int[] storage) Stores in the storage array the indices of triangle i . |
void |
getTriangle(int i, Vector3f[] vertices) Stores in the vertices array the vertex values of triangle i . |
int |
getTriangleQuantity() Returns the number of triangles this TriMesh contains. |
void |
reconstruct(Vector3f[] vertices, Vector3f[] normal, ColorRGBA[] color, Vector2f[] texture, int[] indices, CompositeMesh.IndexRange[] ranges) Recreates the geometric information of this CompositeMesh from scratch. |
void |
setIndexRanges(CompositeMesh.IndexRange[] ranges) Sets new index ranges - be sure to match it with updates to indices array if needed |
void |
updateIndexBuffer() setIndexBuffers creates the IntBuffer that contains the indices array. |
Methods inherited from class com.jme.scene.TriMesh |
---|
clearBuffers, findCollisions, findTriangleCollision, findTrianglePick, findWorldRotMat, getIndexAsBuffer, getIndices, hasCollision, hasTriangleCollision, putClone, reconstruct, setIndexBuffer, setIndices, updateCollisionTree |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CompositeMesh(java.lang.String name)
CompositeMesh
object.
name
- the name of the scene element. This is required for identification and comparision purposes.public CompositeMesh(java.lang.String name, Vector3f[] vertices, Vector3f[] normal, ColorRGBA[] color, Vector2f[] texture, int[] indices, CompositeMesh.IndexRange[] ranges)
CompositeMesh
object. Provided are the attributes that make up the mesh all attributes may be null, except for vertices,indices and ranges
name
- the name of the scene element. This is required for identification and comparision purposes.vertices
- the vertices of the geometry.normal
- the normals of the geometry.color
- the colors of the geometry.texture
- the texture coordinates of the mesh.indices
- the indices of the vertex array.ranges
- the list of index ranges to be used in renderingMethod Detail |
---|
public void reconstruct(Vector3f[] vertices, Vector3f[] normal, ColorRGBA[] color, Vector2f[] texture, int[] indices, CompositeMesh.IndexRange[] ranges)
vertices
- the vertices of the geometry.normal
- the normals of the geometry.color
- the colors of the geometry.texture
- the texture coordinates of the mesh.indices
- the indices of the vertex array.ranges
- the list of index ranges to be used in renderingpublic CompositeMesh.IndexRange[] getIndexRanges()
public void setIndexRanges(CompositeMesh.IndexRange[] ranges)
ranges
-public void draw(Renderer r)
draw
calls super to set the render state then passes itself to the renderer.
draw
in class TriMesh
r
- the renderer to displaySpatial.draw(com.jme.renderer.Renderer)
public void drawBounds(Renderer r)
drawBounds
calls super to set the render state then passes itself to the renderer.
drawBounds
in class TriMesh
r
- the renderer to displaypublic int getTriangleQuantity()
TriMesh
getTriangleQuantity
in class TriMesh
public void updateIndexBuffer()
setIndexBuffers
creates the IntBuffer
that contains the indices array.
updateIndexBuffer
in class TriMesh
public static CompositeMesh.IndexRange createTriangleRange(int count)
count
- number of indexes to be put in this rangepublic static CompositeMesh.IndexRange createTriangleStrip(int count)
count
- number of indexes to be put in this rangepublic static CompositeMesh.IndexRange createTriangleFan(int count)
count
- number of indexes to be put in this rangepublic static CompositeMesh.IndexRange createQuadRange(int count)
count
- number of indexes to be put in this rangepublic static CompositeMesh.IndexRange createQuadStrip(int count)
count
- number of indexes to be put in this rangepublic Vector3f[] getMeshAsTriangles()
getMeshAsTriangles
in class TriMesh
public void getTriangle(int i, int[] storage)
storage
array the indices of triangle i
. If i
is an invalid index, or if storage.length<3
, then nothing happens For composite mesh, this operation is more costly than for Trimesh.
getTriangle
in class TriMesh
i
- The index of the triangle to get.storage
- The array that will hold the i's indexes.public void getTriangle(int i, Vector3f[] vertices)
vertices
array the vertex values of triangle i
. If i
is an invalid triangle index, nothing happens.
getTriangle
in class TriMesh
i
-vertices
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |