|
|||||||||||
| 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
TriMesh 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, creating triangles on every
three points.
| Field Summary | |
protected int[] |
indices
|
protected int |
triangleQuantity
|
| Fields inherited from class com.jme.scene.Geometry |
bound, color, colorBuf, normal, normBuf, texBuf, texture, vertBuf, vertex, vertQuantity |
| Fields inherited from class com.jme.scene.Spatial |
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder |
| Constructor Summary | |
TriMesh()
Empty Constructor to be used internally only. |
|
TriMesh(java.lang.String name)
Constructor instantiates a new TriMesh object. |
|
TriMesh(java.lang.String name,
Vector3f[] vertices,
Vector3f[] normal,
ColorRGBA[] color,
Vector2f[] texture,
int[] indices)
Constructor instantiates a new TriMesh object. |
|
| Method Summary | |
void |
clearBuffers()
Clears the buffers of this TriMesh. |
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. |
void |
findCollisions(Spatial scene,
CollisionResults results)
determines if this TriMesh has made contact with the give scene. |
void |
findTriangleCollision(TriMesh toCheck,
java.util.ArrayList thisIndex,
java.util.ArrayList otherIndex)
This function finds all intersections between this trimesh and the checking one. |
void |
findTrianglePick(Ray toTest,
java.util.ArrayList results)
findTrianglePick determines the triangles of this trimesh
that are being touched by the ray. |
Matrix3f |
findWorldRotMat()
This function is ONLY to be used by the intersection testing code. |
java.nio.IntBuffer |
getIndexAsBuffer()
getIndexAsBuffer retrieves the indices array as an
IntBuffer. |
int[] |
getIndices()
getIndices retrieves the indices into the vertex array. |
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. |
boolean |
hasCollision(Spatial scene,
boolean checkTriangles)
determines if a collision between this trimesh and a given spatial occurs if it has true is returned, otherwise false is returned. |
boolean |
hasTriangleCollision(TriMesh toCheck)
This function checks for intersection between this trimesh and the given one. |
Spatial |
putClone(Spatial store,
CloneCreator properties)
sets the attributes of this TriMesh into a given spatial. |
void |
reconstruct(Vector3f[] vertices,
Vector3f[] normal,
ColorRGBA[] color,
Vector2f[] texture,
int[] indices)
Recreates the geometric information of this TriMesh from scratch. |
void |
setIndexBuffer(java.nio.IntBuffer toSet)
Sets this geometry's index buffer as a refrence to the passed IntBuffer. |
void |
setIndices(int[] indices)
setIndices sets the index array for this
TriMesh. |
void |
updateCollisionTree()
This function creates a collision tree from the TriMesh's current information. |
void |
updateIndexBuffer()
setIndexBuffers creates the IntBuffer that
contains the indices array. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int[] indices
protected int triangleQuantity
| Constructor Detail |
public TriMesh()
public TriMesh(java.lang.String name)
TriMesh object.
name - the name of the scene element. This is required for
identification and comparision purposes.
public TriMesh(java.lang.String name,
Vector3f[] vertices,
Vector3f[] normal,
ColorRGBA[] color,
Vector2f[] texture,
int[] indices)
TriMesh object. Provided
are the attributes that make up the mesh all attributes may be null,
except for vertices and indices.
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.| Method Detail |
public void reconstruct(Vector3f[] vertices,
Vector3f[] normal,
ColorRGBA[] color,
Vector2f[] texture,
int[] indices)
vertices array that
refrences a vertex of a triangle.
vertices - The vertex information for this TriMesh.normal - The normal information for this TriMesh.color - The color information for this TriMesh.texture - The texture information for this TriMesh.indices - The index information for this TriMesh.Geometry.reconstruct(com.jme.math.Vector3f[], com.jme.math.Vector3f[],
com.jme.renderer.ColorRGBA[], com.jme.math.Vector2f[])public int[] getIndices()
getIndices retrieves the indices into the vertex array.
public java.nio.IntBuffer getIndexAsBuffer()
getIndexAsBuffer retrieves the indices array as an
IntBuffer.
IntBuffer.
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
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.
i - vertices - public int getTriangleQuantity()
public void setIndices(int[] indices)
setIndices sets the index array for this
TriMesh.
indices - the index array.public void draw(Renderer r)
draw calls super to set the render state then passes
itself to the renderer.
LOGIC: 1. If we're not RenderQueue calling draw goto 2, if we are, goto 3
2. If we are supposed to use queue, add to queue and RETURN, else 3 3.
call super draw 4. tell renderer to draw me.
draw in class Geometryr - 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 Geometryr - the renderer to displaypublic void updateIndexBuffer()
setIndexBuffers creates the IntBuffer that
contains the indices array.
public void clearBuffers()
clearBuffers in class Geometrypublic void setIndexBuffer(java.nio.IntBuffer toSet)
IntBuffer. Incorrectly built IntBuffers can have
undefined results. Use with care.
toSet - The IntBuffer to set this geometry's index
buffer topublic void updateCollisionTree()
updateCollisionTree in class Spatial
public boolean hasCollision(Spatial scene,
boolean checkTriangles)
hasCollision in class Spatial
public void findCollisions(Spatial scene,
CollisionResults results)
findCollisions in class Spatialscene - the scene to test against.results - the results of the collisions.public boolean hasTriangleCollision(TriMesh toCheck)
toCheck - The intersection testing mesh.
public void findTriangleCollision(TriMesh toCheck,
java.util.ArrayList thisIndex,
java.util.ArrayList otherIndex)
toCheck - The TriMesh to check.thisIndex - The array of triangle indexes intersecting in this mesh.otherIndex - The array of triangle indexes intersecting in the given mesh.
public void findTrianglePick(Ray toTest,
java.util.ArrayList results)
findTrianglePick determines the triangles of this trimesh
that are being touched by the ray. The indices of the triangles are
stored in the provided ArrayList.
toTest - the ray to test.results - the indices to the triangles.public Matrix3f findWorldRotMat()
public Spatial putClone(Spatial store,
CloneCreator properties)
putClone in class Geometrystore - the Spatial to clone to.properties - the CloneCreator object that defines what is to be cloned.public Vector3f[] getMeshAsTriangles()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||