|
|||||||||||
| 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
Geometry defines a leaf node of the scene graph. The leaf node
contains the geometric data for rendering objects. It manages all rendering
information such as a collection of states and the data for a model.
Subclasses define what the model data is.
| Field Summary | |
protected BoundingVolume |
bound
The local bounds of this Geometry object. |
protected ColorRGBA[] |
color
The geometry's per vertex color information. |
protected java.nio.FloatBuffer |
colorBuf
|
protected Vector3f[] |
normal
The geometry's per vertex normal information. |
protected java.nio.FloatBuffer |
normBuf
|
protected java.nio.FloatBuffer[] |
texBuf
|
protected Vector2f[][] |
texture
The geometry's per Texture per vertex texture coordinate information. |
protected java.nio.FloatBuffer |
vertBuf
|
protected Vector3f[] |
vertex
The geometry's vertex information. |
protected int |
vertQuantity
The number of vertexes in this geometry. |
| 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 | |
Geometry()
Empty Constructor to be used internally only. |
|
Geometry(java.lang.String name)
Constructor instantiates a new Geometry object. |
|
Geometry(java.lang.String name,
Vector3f[] vertex,
Vector3f[] normal,
ColorRGBA[] color,
Vector2f[] texture)
Constructor creates a new Geometry object. |
|
| Method Summary | |
protected void |
applyRenderState(java.util.Stack[] states)
applyRenderState determines if a particular render state
is set for this Geometry. |
void |
applyStates()
setStates applies all the render states for this
particular geometry. |
void |
clearBuffers()
Clears all vertex, normal, texture, and color buffers by setting them to null. |
void |
copyTextureCoords(int fromIndex,
int toIndex)
copyTextureCoords copys the texture coordinates of a given
texture unit to another location. |
void |
draw(Renderer r)
draw prepares the geometry for rendering to the display. |
void |
drawBounds(Renderer r)
drawBounds calls super to set the render state then passes
itself to the renderer. |
void |
findPick(Ray ray,
PickResults results)
|
Vector2f[][] |
getAllTextures()
Returns the geometry's texture coordinate information. |
int |
getCloneID()
Returns the ID number that identifies this Geometry's clone ID. |
java.nio.FloatBuffer |
getColorAsFloatBuffer()
getColorAsFloatBuffer retrieves the float buffer that
contains this geometry's color information. |
ColorRGBA[] |
getColors()
getColors returns the color information of the geometry. |
BoundingVolume |
getModelBound()
getModelBound retrieves the bounding object that contains
the geometry node's vertices. |
java.nio.FloatBuffer |
getNormalAsFloatBuffer()
getNormalAsFloatBuffer retrieves this geometry's normal
information as a float buffer. |
Vector3f[] |
getNormals()
getNormals returns the array that contains this geometry's
normal information. |
int |
getNumberOfUnits()
getNumberOfUnits returns the number of texture units this
geometry supports. |
java.nio.FloatBuffer |
getTextureAsFloatBuffer()
getTextureAsFloatBuffer retrieves this geometry's texture
information contained within a float buffer. |
java.nio.FloatBuffer |
getTextureAsFloatBuffer(int textureUnit)
getTextureAsFloatBuffer retrieves the texture buffer of a
given texture unit. |
Vector2f[] |
getTextures()
getTextures retrieves the texture array that contains this
geometry's texture information. |
Vector2f[] |
getTextures(int textureUnit)
getTextures retrieves the texture array that contains this
geometry's texture information for a given texture unit. |
int |
getVBOColorID()
|
int |
getVBONormalID()
|
int |
getVBOTextureID(int index)
|
int |
getVBOVertexID()
|
java.nio.FloatBuffer |
getVerticeAsFloatBuffer()
getVerticeAsFloatBuffer returns the float buffer that
contains this geometry's vertex information. |
Vector3f[] |
getVertices()
getVertices returns the vertex array for this geometry. |
int |
getVertQuantity()
Returns the number of vertexes defined in this Geometry object. |
boolean |
isVBOColorEnabled()
Returns true if VBO (Vertex Buffer) is enabled for color information. |
boolean |
isVBONormalEnabled()
Returns true if VBO (Vertex Buffer) is enabled for normal information. |
boolean |
isVBOTextureEnabled()
Returns true if VBO (Vertex Buffer) is enabled for texture information. |
boolean |
isVBOVertexEnabled()
Returns true if VBO (Vertex Buffer) is enabled for vertex information. |
Spatial |
putClone(Spatial store,
CloneCreator properties)
|
Vector3f |
randomVertice()
randomVertice returns a random vertex from the list of
vertices set to this geometry. |
void |
reconstruct(Vector3f[] vertices,
Vector3f[] normal,
ColorRGBA[] color,
Vector2f[] texture)
reconstruct reinitializes the geometry with new data. |
void |
setAllTextures(Vector2f[][] texture)
Sets all texture coordinates to those defined in the given array of arrays. |
void |
setColor(int index,
ColorRGBA value)
setColor sets a single colorRGBA into the color array. |
void |
setColors(ColorRGBA[] color)
setColors sets the color array of this geometry. |
protected void |
setFloatBuffer(java.nio.FloatBuffer toSet)
Sets this geometry's color buffer as a refrence to the passed FloatBuffer. |
void |
setForceView(boolean value)
When true, this geometry object will always be rendered as long as its parent is rendered. |
void |
setModelBound(BoundingVolume modelBound)
setModelBound sets the bounding object for this geometry. |
void |
setNormal(int index,
Vector3f value)
setNormal sets a single normal into the normal array. |
protected void |
setNormalBuffer(java.nio.FloatBuffer toSet)
Sets this geometry's normal buffer as a refrence to the passed FloatBuffer. |
void |
setNormals(Vector3f[] normal)
setNormals sets this geometry's normals to a new array of
normal values. |
void |
setRandomColors()
Sets every color of this geometry's color array to a random color. |
void |
setSolidColor(ColorRGBA color)
setSolidColor sets the color array of this geometry to a
single color. |
void |
setTexture(int index,
Vector2f value)
setTexture sets a single texture coordinate into the
texture array. |
void |
setTexture(int index,
Vector2f value,
int textureUnit)
setTexture sets a single texture coordinate into the
texture array. |
protected void |
setTextureBuffer(java.nio.FloatBuffer toSet)
Sets this geometry's first texture buffer as a refrence to the passed FloatBuffer. |
void |
setTextureCoord(int textureUnit,
int index,
Vector2f value)
setTextureCoord sets a single coord into the texture
array. |
void |
setTextures(Vector2f[] texture)
setTextures sets this geometry's texture array to a new
array. |
void |
setTextures(Vector2f[] textures,
int textureUnit)
setTextures sets the texture coordinates of a given
texture unit. |
void |
setVBOColorEnabled(boolean enabled)
Enables or disables Vertex Buffer Objects for color information. |
void |
setVBOColorID(int id)
|
void |
setVBONormalEnabled(boolean enabled)
Enables or disables Vertex Buffer Objects for normal information. |
void |
setVBONormalID(int id)
|
void |
setVBOTextureEnabled(boolean enabled)
Enables or disables Vertex Buffer Objects for texture coordinate information. |
void |
setVBOTextureID(int index,
int id)
|
void |
setVBOVertexEnabled(boolean enabled)
Enables or disables Vertex Buffer Objects for vertex information. |
void |
setVBOVertexID(int id)
|
void |
setVertex(int index,
Vector3f value)
setVertex sets a single vertex into the vertex array. |
protected void |
setVertexBuffer(java.nio.FloatBuffer toSet)
Sets this geometry's vertex buffer as a refrence to the passed FloatBuffer. |
void |
setVertices(Vector3f[] vertex)
setVertices sets the vertices of this geometry. |
void |
updateColorBuffer()
setColorBuffer calculates the FloatBuffer
that contains all the color information of this geometry. |
void |
updateColorBuffer(int quantity)
setColorBuffer calculates the FloatBuffer
that contains all the color information of this geometry. |
void |
updateModelBound()
updateBound recalculates the bounding object assigned to
the geometry. |
void |
updateNormalBuffer()
updateNormalBuffer sets the float buffer that contains
this geometry's normal information. |
void |
updateNormalBuffer(int quantity)
updateNormalBuffer sets the float buffer that contains
this geometry's normal information. |
void |
updateTextureBuffer()
updateTextureBuffer sets the float buffer that contains
this geometry's texture information. |
void |
updateTextureBuffer(int textureUnit)
updateTextureBuffer sets the float buffer that contains
this geometry's texture information. |
void |
updateTextureBuffer(int textureUnit,
int quantity)
updateTextureBuffer sets the float buffer that contains
this geometry's texture information. |
void |
updateVertexBuffer()
updateVertexBuffer sets the float buffer that contains
this geometry's vertex information. |
void |
updateVertexBuffer(int quantity)
updateVertexBuffer sets the float buffer that contains
this geometry's vertex information. |
void |
updateWorldBound()
updateWorldBound updates the bounding volume that contains
this geometry. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected BoundingVolume bound
protected Vector3f[] vertex
protected Vector3f[] normal
protected ColorRGBA[] color
protected Vector2f[][] texture
protected int vertQuantity
protected transient java.nio.FloatBuffer colorBuf
protected transient java.nio.FloatBuffer normBuf
protected transient java.nio.FloatBuffer vertBuf
protected transient java.nio.FloatBuffer[] texBuf
| Constructor Detail |
public Geometry()
public Geometry(java.lang.String name)
Geometry object. This is
the default object which has an empty vertex array. All other data is
null.
name - the name of the scene element. This is required for
identification and comparision purposes.
public Geometry(java.lang.String name,
Vector3f[] vertex,
Vector3f[] normal,
ColorRGBA[] color,
Vector2f[] texture)
Geometry object. During
instantiation the geometry is set including vertex, normal, color and
texture information. Any part may be null except for the vertex
information. If this is null, an exception will be thrown.
name - the name of the scene element. This is required for
identification and comparision purposes.vertex - the points that make up the geometry.normal - the normals of the geometry.color - the color of each point of the geometry.texture - the texture coordinates of the geometry.| Method Detail |
public void reconstruct(Vector3f[] vertices,
Vector3f[] normal,
ColorRGBA[] color,
Vector2f[] texture)
reconstruct reinitializes the geometry with new data. This
will reuse the geometry object.
vertices - the new vertices to use.normal - the new normals to use.color - the new colors to use.texture - the new texture coordinates to use.public boolean isVBOVertexEnabled()
public boolean isVBOTextureEnabled()
public boolean isVBONormalEnabled()
public boolean isVBOColorEnabled()
public void setVBOVertexEnabled(boolean enabled)
enabled - If true, VBO enabled for vertexes.public void setVBOTextureEnabled(boolean enabled)
enabled - If true, VBO enabled for texture coordinates.public void setVBONormalEnabled(boolean enabled)
enabled - If true, VBO enabled for normalspublic void setVBOColorEnabled(boolean enabled)
enabled - If true, VBO enabled for colorspublic int getVBOVertexID()
public int getVBOTextureID(int index)
public int getVBONormalID()
public int getVBOColorID()
public void setVBOVertexID(int id)
public void setVBOTextureID(int index,
int id)
public void setVBONormalID(int id)
public void setVBOColorID(int id)
public ColorRGBA[] getColors()
getColors returns the color information of the geometry.
This may be null and should be check for such a case.
public void setColors(ColorRGBA[] color)
setColors sets the color array of this geometry.
color - the new color array.
public void setColor(int index,
ColorRGBA value)
setColor sets a single colorRGBA into the color array. The
index to set it is given, and due to speed considerations, no bounds
checking is done. Therefore, if an invalid index is given, an
ArrayIndexOutOfBoundsException will be thrown.
index - the index of the color to set.value - the color to set.public void setSolidColor(ColorRGBA color)
setSolidColor sets the color array of this geometry to a
single color.
color - the color to set.public void setRandomColors()
public java.nio.FloatBuffer getColorAsFloatBuffer()
getColorAsFloatBuffer retrieves the float buffer that
contains this geometry's color information.
public Vector3f[] getVertices()
getVertices returns the vertex array for this geometry.
public void setVertices(Vector3f[] vertex)
setVertices sets the vertices of this geometry. The
vertices may not be null and will throw an exception if so.
vertex - the new vertices of this geometry.
public void setVertex(int index,
Vector3f value)
setVertex sets a single vertex into the vertex array. The
index to set it is given, and due to speed considerations, no bounds
checking is done. Therefore, if an invalid index is given, an
ArrayIndexOutOfBoundsException will be thrown.
index - the index of the vertex to set.value - the vertex to set.
public void setTextureCoord(int textureUnit,
int index,
Vector2f value)
setTextureCoord sets a single coord into the texture
array. The index to set it is given, and due to speed considerations, no
bounds checking is done. Therefore, if an invalid index is given, an
ArrayIndexOutOfBoundsException will be thrown.
textureUnit - the textureUnit to set on.index - the index of the coord to set.value - the vertex to set.public java.nio.FloatBuffer getVerticeAsFloatBuffer()
getVerticeAsFloatBuffer returns the float buffer that
contains this geometry's vertex information.
public Vector3f[] getNormals()
getNormals returns the array that contains this geometry's
normal information.
public void setNormals(Vector3f[] normal)
setNormals sets this geometry's normals to a new array of
normal values.
normal - the new normal values.
public void setNormal(int index,
Vector3f value)
setNormal sets a single normal into the normal array. The
index to set it is given, and due to speed considerations, no bounds
checking is done. Therefore, if an invalid index is given, an
ArrayIndexOutOfBoundsException will be thrown.
index - the index of the normal to set.value - the normal to set.public java.nio.FloatBuffer getNormalAsFloatBuffer()
getNormalAsFloatBuffer retrieves this geometry's normal
information as a float buffer.
public Vector2f[] getTextures()
getTextures retrieves the texture array that contains this
geometry's texture information. The texture coordinates are those of the
first texture unit.
public Vector2f[] getTextures(int textureUnit)
getTextures retrieves the texture array that contains this
geometry's texture information for a given texture unit. If the texture
unit is invalid, or no texture coordinates are set for the texture unit,
null is returned.
textureUnit - the texture unit to retrieve the coordinates for.
public void setTextures(Vector2f[] texture)
setTextures sets this geometry's texture array to a new
array.
texture - the new texture information for this geometry.
public void setTextures(Vector2f[] textures,
int textureUnit)
setTextures sets the texture coordinates of a given
texture unit. If the texture unit is not valid, then the coordinates are
ignored.
textures - the coordinates to set.textureUnit - the texture unit to set them to.
public void setTexture(int index,
Vector2f value)
setTexture sets a single texture coordinate into the
texture array. The index to set it is given, and due to speed
considerations, no bounds checking is done. Therefore, if an invalid
index is given, an ArrayIndexOutOfBoundsException will be thrown.
index - the index of the texture coordinate to set.value - the texture coordinate to set.
public void setTexture(int index,
Vector2f value,
int textureUnit)
setTexture sets a single texture coordinate into the
texture array. The index to set it is given, and due to speed
considerations, no bounds checking is done. Therefore, if an invalid
index is given, an ArrayIndexOutOfBoundsException will be thrown.
index - the index of the texture coordinate to set.value - the texture coordinate to set.textureUnit - the texture unit to alter.
public void copyTextureCoords(int fromIndex,
int toIndex)
copyTextureCoords copys the texture coordinates of a given
texture unit to another location. If the texture unit is not valid, then
the coordinates are ignored.
fromIndex - the coordinates to copy.toIndex - the texture unit to set them to.public java.nio.FloatBuffer getTextureAsFloatBuffer()
getTextureAsFloatBuffer retrieves this geometry's texture
information contained within a float buffer.
public java.nio.FloatBuffer getTextureAsFloatBuffer(int textureUnit)
getTextureAsFloatBuffer retrieves the texture buffer of a
given texture unit. If the texture unit is not valid, null is returned.
textureUnit - the texture unit to check.
public int getNumberOfUnits()
getNumberOfUnits returns the number of texture units this
geometry supports.
public int getVertQuantity()
public void setAllTextures(Vector2f[][] texture)
texture - The new texture coordinates.public Vector2f[][] getAllTextures()
public void clearBuffers()
public void updateModelBound()
updateBound recalculates the bounding object assigned to
the geometry. This resets it parameters to adjust for any changes to the
vertex information.
public BoundingVolume getModelBound()
getModelBound retrieves the bounding object that contains
the geometry node's vertices.
public void setModelBound(BoundingVolume modelBound)
setModelBound sets the bounding object for this geometry.
modelBound - the bounding object for this geometry.public void setForceView(boolean value)
setForceView in class Spatialvalue - The new forced view flag for this object.public void applyStates()
setStates applies all the render states for this
particular geometry.
public void draw(Renderer r)
draw prepares the geometry for rendering to the display.
The renderstate is set and the subclass is responsible for rendering the
actual data.
draw in class Spatialr - the renderer that displays to the context.Spatial.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 Spatialr - the renderer to displaypublic void updateWorldBound()
updateWorldBound updates the bounding volume that contains
this geometry. The location of the geometry is based on the location of
all this node's parents.
updateWorldBound in class SpatialSpatial.updateWorldBound()protected void applyRenderState(java.util.Stack[] states)
applyRenderState determines if a particular render state
is set for this Geometry. If not, the default state will be used.
applyRenderState in class Spatialstates - An array of stacks for each state.public void updateColorBuffer()
setColorBuffer calculates the FloatBuffer
that contains all the color information of this geometry.
public void updateColorBuffer(int quantity)
setColorBuffer calculates the FloatBuffer
that contains all the color information of this geometry.
quantity - The number of vertices to update the buffer with colors for.public void updateVertexBuffer()
updateVertexBuffer sets the float buffer that contains
this geometry's vertex information.
public void updateVertexBuffer(int quantity)
updateVertexBuffer sets the float buffer that contains
this geometry's vertex information.
quantity - The number of vertices to update the buffer with.public void updateNormalBuffer()
updateNormalBuffer sets the float buffer that contains
this geometry's normal information.
public void updateNormalBuffer(int quantity)
updateNormalBuffer sets the float buffer that contains
this geometry's normal information.
quantity - The number of vertices to update the buffer with normals for.public void updateTextureBuffer()
updateTextureBuffer sets the float buffer that contains
this geometry's texture information. Updates textureUnit 0.
public void updateTextureBuffer(int textureUnit)
updateTextureBuffer sets the float buffer that contains
this geometry's texture information.
textureUnit -
public void updateTextureBuffer(int textureUnit,
int quantity)
updateTextureBuffer sets the float buffer that contains
this geometry's texture information.
textureUnit - quantity - public Vector3f randomVertice()
randomVertice returns a random vertex from the list of
vertices set to this geometry. If there are no vertices set, null is
returned.
public void findPick(Ray ray,
PickResults results)
findPick in class Spatialprotected void setTextureBuffer(java.nio.FloatBuffer toSet)
FloatBuffer. Incorrectly built FloatBuffers can have
undefined results. Use with care.
toSet - The FloatBuffer to set this geometry's first
texture buffer toprotected void setNormalBuffer(java.nio.FloatBuffer toSet)
FloatBuffer. Incorrectly built FloatBuffers can have
undefined results. Use with care.
toSet - The FloatBuffer to set this geometry's normal
buffer toprotected void setVertexBuffer(java.nio.FloatBuffer toSet)
FloatBuffer. Incorrectly built FloatBuffers can have
undefined results. Use with care.
toSet - The FloatBuffer to set this geometry's vertex
buffer toprotected void setFloatBuffer(java.nio.FloatBuffer toSet)
FloatBuffer. Incorrectly built FloatBuffers can have
undefined results. Use with care.
toSet - The FloatBuffer to set this geometry's color
buffer to
public Spatial putClone(Spatial store,
CloneCreator properties)
putClone in class Spatialpublic int getCloneID()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||