|
||||||||||
| 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
public abstract class 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.jme.scene.Spatial |
|---|
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode |
| Field Summary | |
|---|---|
RenderState[] |
states
The compiled list of renderstates for this geometry, taking into account ancestors' states - updated with updateRenderStates() |
| Fields inherited from class com.jme.scene.Spatial |
|---|
LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, queueDistance |
| Constructor Summary | |
|---|---|
Geometry()
Empty Constructor to be used internally only. |
|
Geometry(String name)
Constructor instantiates a new Geometry object. |
|
Geometry(String name,
FloatBuffer vertex,
FloatBuffer normal,
FloatBuffer color,
TexCoords coords)
Constructor creates a new Geometry object. |
|
| Method Summary | |
|---|---|
void |
addTextureCoordinates(TexCoords textureCoords)
|
void |
addTextureCoordinates(TexCoords textureCoords,
int coordSize)
|
void |
clearBuffers()
Clears all vertex, normal, texture, and color buffers by setting them to null. |
void |
clearTextureBuffers()
|
void |
copyTextureCoordinates(int fromIndex,
int toIndex,
float factor)
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 |
findPick(Ray ray,
PickResults results)
Check if this geom intersects the ray if yes add it to the results. |
FloatBuffer |
getBinormalBuffer()
|
FloatBuffer |
getColorBuffer()
getColorBufferfer retrieves the float buffer that contains
this geometry's color information. |
ColorRGBA |
getDefaultColor()
getDefaultColor returns the color used if no per vertex
colors are specified. |
int |
getDisplayListID()
|
FloatBuffer |
getFogBuffer()
The fog depth coord buffer |
LightState |
getLightState()
|
BoundingVolume |
getModelBound()
getModelBound retrieves the bounding object that contains
the geometry's vertices. |
FloatBuffer |
getNormalBuffer()
getNormalBuffer retrieves this geometry's normal
information as a float buffer. |
int |
getNumberOfUnits()
getNumberOfUnits returns the number of texture units this
geometry is currently using. |
FloatBuffer |
getTangentBuffer()
|
ArrayList<TexCoords> |
getTextureCoords()
getTextureBuffers retrieves this geometry's texture
information contained within a float buffer array. |
TexCoords |
getTextureCoords(int textureUnit)
getTextureAsFloatBuffer retrieves the texture buffer of a
given texture unit. |
int |
getTriangleCount()
|
VBOInfo |
getVBOInfo()
|
FloatBuffer |
getVertexBuffer()
getVertexBuffer returns the float buffer that contains
this geometry's vertex information. |
int |
getVertexCount()
returns the number of vertices contained in this geometry. |
FloatBuffer |
getWorldCoords(FloatBuffer store)
getWorldCoords translates/rotates and scales the
coordinates of this Geometry to world coordinates based on its world
settings. |
FloatBuffer |
getWorldNormals(FloatBuffer store)
getWorldNormals rotates the normals of this Geometry to
world normals based on its world settings. |
boolean |
hasDirtyVertices()
|
boolean |
isCastsShadows()
|
void |
lockMeshes(Renderer r)
Flags this spatial and those below it that any meshes in the specified scenegraph location or lower will not have changes in vertex, texcoord, normal or color data. |
void |
postdraw(Renderer r)
Called after renderer finishes drawing this geometry. |
boolean |
predraw(Renderer r)
Called just before renderer starts drawing this geometry. |
Vector3f |
randomVertex(Vector3f fill)
randomVertex returns a random vertex from the list of
vertices set to this geometry. |
void |
read(JMEImporter e)
|
void |
reconstruct(FloatBuffer vertices,
FloatBuffer normals,
FloatBuffer colors,
TexCoords coords)
reconstruct reinitializes the geometry with new data. |
void |
resizeTextureIds(int i)
|
void |
rotateNormals(Quaternion rotate)
|
void |
rotatePoints(Quaternion rotate)
|
void |
scaleTextureCoordinates(int index,
float factor)
|
void |
scaleTextureCoordinates(int index,
Vector2f factor)
|
void |
setBinormalBuffer(FloatBuffer binormalBuf)
|
void |
setCastsShadows(boolean castsShadows)
|
void |
setColorBuffer(FloatBuffer colorBuf)
setColorBuffer sets this geometry's colors via a float
buffer consisting of groups of four floats: r,g,b and a. |
void |
setDefaultColor(ColorRGBA color)
setDefaultColor sets the color to be used if no per vertex
color buffer is set. |
void |
setDisplayListID(int displayListID)
|
void |
setFogCoordBuffer(FloatBuffer fogBuf)
Set the fog coordinates buffer. |
void |
setHasDirtyVertices(boolean flag)
|
void |
setLightState(LightState lightState)
|
void |
setModelBound(BoundingVolume modelBound)
setModelBound sets the bounding object for this geometry. |
void |
setNormalBuffer(FloatBuffer normBuf)
setNormalBuffer sets this geometry's normals via a float
buffer consisting of groups of three floats: x,y and z. |
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 |
setTangentBuffer(FloatBuffer tangentBuf)
|
void |
setTextureCoords(ArrayList<TexCoords> texBuf)
|
void |
setTextureCoords(TexCoords coords)
setTextureBuffer sets this geometry's textures (position
0) via a float buffer. |
void |
setTextureCoords(TexCoords coords,
int unit)
setTextureBuffer sets this geometry's textures at the
position given via a float buffer. |
void |
setVBOInfo(VBOInfo info)
Sets VBO info on this Geometry. |
void |
setVertexBuffer(FloatBuffer vertBuf)
setVertexBuffer sets this geometry's vertices via a float
buffer consisting of groups of three floats: x,y and z. |
void |
setVertexCount(int vertQuantity)
|
void |
sortLights()
sorts the lights based on distance to geometry bounding volume |
void |
translatePoints(float x,
float y,
float z)
|
void |
translatePoints(Vector3f amount)
|
void |
unlockMeshes(Renderer r)
Flags this spatial and those below it to allow for mesh updating (the default). |
void |
updateModelBound()
updateBound recalculates the bounding object assigned to
the geometry. |
void |
updateWorldBound()
updateWorldBound updates the bounding volume that contains
this geometry. |
void |
write(JMEExporter e)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.jme.util.export.Savable |
|---|
getClassTag |
| Field Detail |
|---|
public RenderState[] states
| Constructor Detail |
|---|
public Geometry()
public Geometry(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(String name,
FloatBuffer vertex,
FloatBuffer normal,
FloatBuffer color,
TexCoords coords)
Geometry object. During
instantiation the geometry is set including vertex, normal, color and
texture information.
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.coords - the texture coordinates of the geometry (position 0.)| Method Detail |
|---|
public int getVertexCount()
getVertexCount in class Spatialpublic void setVertexCount(int vertQuantity)
public int getTriangleCount()
getTriangleCount in class Spatial
public void reconstruct(FloatBuffer vertices,
FloatBuffer normals,
FloatBuffer colors,
TexCoords coords)
reconstruct reinitializes the geometry with new data. This
will reuse the geometry object.
vertices - the new vertices to use.normals - the new normals to use.colors - the new colors to use.coords - the new texture coordinates to use (position 0).public void setVBOInfo(VBOInfo info)
info - the VBO info to setVBOInfopublic VBOInfo getVBOInfo()
VBOInfopublic void setSolidColor(ColorRGBA color)
setSolidColor sets the color array of this geometry to a
single color. For greater efficiency, try setting the the ColorBuffer to
null and using DefaultColor instead.
color - the color to set.public void setRandomColors()
public FloatBuffer getVertexBuffer()
getVertexBuffer returns the float buffer that contains
this geometry's vertex information.
public void setVertexBuffer(FloatBuffer vertBuf)
setVertexBuffer sets this geometry's vertices via a float
buffer consisting of groups of three floats: x,y and z.
vertBuf - the new vertex buffer.public void setFogCoordBuffer(FloatBuffer fogBuf)
fogBuf - The fog buffer to use in this geometrypublic FloatBuffer getFogBuffer()
public FloatBuffer getNormalBuffer()
getNormalBuffer retrieves this geometry's normal
information as a float buffer.
public void setNormalBuffer(FloatBuffer normBuf)
setNormalBuffer sets this geometry's normals via a float
buffer consisting of groups of three floats: x,y and z.
normBuf - the new normal buffer.public FloatBuffer getColorBuffer()
getColorBufferfer retrieves the float buffer that contains
this geometry's color information.
public void setColorBuffer(FloatBuffer colorBuf)
setColorBuffer sets this geometry's colors via a float
buffer consisting of groups of four floats: r,g,b and a.
colorBuf - the new color buffer.
public void copyTextureCoordinates(int fromIndex,
int toIndex,
float factor)
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. Coords are multiplied by the given factor.
fromIndex - the coordinates to copy.toIndex - the texture unit to set them to.factor - a multiple to apply when copyingpublic ArrayList<TexCoords> getTextureCoords()
getTextureBuffers retrieves this geometry's texture
information contained within a float buffer array.
public TexCoords getTextureCoords(int textureUnit)
getTextureAsFloatBuffer retrieves the texture buffer of a
given texture unit.
textureUnit - the texture unit to check.
public void setTextureCoords(TexCoords coords)
setTextureBuffer sets this geometry's textures (position
0) via a float buffer. This convenience method assumes we are setting
coordinates for texture unit 0 and that there are 2 coordinate values per
vertex.
coords - the new coords for unit 0.
public void setTextureCoords(TexCoords coords,
int unit)
setTextureBuffer sets this geometry's textures at the
position given via a float buffer. This convenience method assumes that
there are 2 coordinate values per vertex.
coords - the new coords.unit - the texture unit we are providing coordinates for.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.
updateModelBound in class Spatialpublic void setModelBound(BoundingVolume modelBound)
setModelBound sets the bounding object for this geometry.
setModelBound in class SpatialmodelBound - the bounding object for this 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 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()public void sortLights()
sortLights in class Spatialpublic Vector3f randomVertex(Vector3f fill)
randomVertex returns a random vertex from the list of
vertices set to this geometry. If there are no vertices set, null is
returned.
fill - a Vector3f to fill with the results. If null, one is created.
It is more efficient to pass in a nonnull vector.
public void findPick(Ray ray,
PickResults results)
findPick in class Spatialray - ray to check intersection with. The direction of the ray must
be normalized (length 1).results - result listpublic void setDefaultColor(ColorRGBA color)
setDefaultColor sets the color to be used if no per vertex
color buffer is set.
color - public FloatBuffer getWorldCoords(FloatBuffer store)
getWorldCoords translates/rotates and scales the
coordinates of this Geometry to world coordinates based on its world
settings. The results are stored in the given FloatBuffer. If given
FloatBuffer is null, one is created.
store - the FloatBuffer to store the results in, or null if you want
one created.
public FloatBuffer getWorldNormals(FloatBuffer store)
getWorldNormals rotates the normals of this Geometry to
world normals based on its world settings. The results are stored in the
given FloatBuffer. If given FloatBuffer is null, one is created.
store - the FloatBuffer to store the results in, or null if you want
one created.
public int getDisplayListID()
public void setDisplayListID(int displayListID)
public void setTextureCoords(ArrayList<TexCoords> texBuf)
public void clearTextureBuffers()
public void addTextureCoordinates(TexCoords textureCoords)
public void addTextureCoordinates(TexCoords textureCoords,
int coordSize)
public void resizeTextureIds(int i)
public void scaleTextureCoordinates(int index,
float factor)
public void scaleTextureCoordinates(int index,
Vector2f factor)
public boolean isCastsShadows()
public void setCastsShadows(boolean castsShadows)
public int getNumberOfUnits()
getNumberOfUnits returns the number of texture units this
geometry is currently using.
public void lockMeshes(Renderer r)
Spatial
lockMeshes in class Spatialr - A renderer to lock against.Spatial.unlockMeshes(Renderer)public void unlockMeshes(Renderer r)
Spatial
unlockMeshes in class Spatialr - The renderer used to lock against.Spatial.lockMeshes(Renderer)public boolean predraw(Renderer r)
public void postdraw(Renderer r)
public void translatePoints(float x,
float y,
float z)
public void translatePoints(Vector3f amount)
public void rotatePoints(Quaternion rotate)
public void rotateNormals(Quaternion rotate)
public ColorRGBA getDefaultColor()
getDefaultColor returns the color used if no per vertex
colors are specified.
public void write(JMEExporter e)
throws IOException
write in interface Savablewrite in class SpatialIOException
public void read(JMEImporter e)
throws IOException
read in interface Savableread in class SpatialIOExceptionpublic BoundingVolume getModelBound()
getModelBound retrieves the bounding object that contains
the geometry's vertices.
public boolean hasDirtyVertices()
public void setHasDirtyVertices(boolean flag)
public void setTangentBuffer(FloatBuffer tangentBuf)
public FloatBuffer getTangentBuffer()
public void setBinormalBuffer(FloatBuffer binormalBuf)
public FloatBuffer getBinormalBuffer()
public void setLightState(LightState lightState)
public LightState getLightState()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||