|
||||||||||
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 | |
---|---|
protected java.nio.FloatBuffer |
binormalBuf
The geometry's per vertex normal information. |
protected BoundingVolume |
bound
The local bounds of this Geometry object. |
protected boolean |
castsShadows
|
protected java.nio.FloatBuffer |
colorBuf
The geometry's per vertex color information. |
protected static Vector3f |
compVect
Static computation field |
protected ColorRGBA |
defaultColor
|
protected int |
displayListID
Non -1 values signal that drawing this scene should use the provided display list instead of drawing from the buffers. |
protected boolean |
enabled
|
protected java.nio.FloatBuffer |
fogBuf
The geometry's per vertex fog buffer depth values |
protected boolean |
hasDirtyVertices
|
protected java.nio.FloatBuffer |
normBuf
The geometry's per vertex normal information. |
RenderState[] |
states
The compiled list of renderstates for this geometry, taking into account ancestors' states - updated with updateRenderStates() |
protected java.nio.FloatBuffer |
tangentBuf
The geometry's per vertex color information. |
protected java.util.ArrayList<TexCoords> |
texBuf
The geometry's per Texture per vertex texture coordinate information. |
protected VBOInfo |
vboInfo
The geometry's VBO information. |
protected java.nio.FloatBuffer |
vertBuf
The geometry's vertex information. |
protected int |
vertQuantity
The number of vertexes in this geometry. |
Fields inherited from class com.jme.scene.Spatial |
---|
cullHint, frustrumIntersects, geometricalControllers, isCollidable, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, 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,
java.nio.FloatBuffer vertex,
java.nio.FloatBuffer normal,
java.nio.FloatBuffer color,
TexCoords coords)
Constructor creates a new Geometry object. |
Method Summary | |
---|---|
void |
addTextureCoordinates(TexCoords textureCoords)
|
void |
addTextureCoordinates(TexCoords textureCoords,
int coordSize)
|
protected void |
applyRenderState(java.util.Stack<? extends RenderState>[] states)
applyRenderState determines if a particular render state
is set for this Geometry. |
protected void |
checkTextureCoordinates()
|
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 |
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. |
java.nio.FloatBuffer |
getBinormalBuffer()
|
java.nio.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()
|
java.nio.FloatBuffer |
getFogBuffer()
The fog depth coord buffer |
LightState |
getLightState()
|
BoundingVolume |
getModelBound()
getModelBound retrieves the bounding object that contains
the geometry's vertices. |
java.nio.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. |
java.nio.FloatBuffer |
getTangentBuffer()
|
java.util.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()
|
java.nio.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. |
java.nio.FloatBuffer |
getWorldCoords(java.nio.FloatBuffer store)
getWorldCoords translates/rotates and scales the
coordinates of this Geometry to world coordinates based on its world
settings. |
java.nio.FloatBuffer |
getWorldNormals(java.nio.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(java.nio.FloatBuffer vertices,
java.nio.FloatBuffer normals,
java.nio.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(java.nio.FloatBuffer binormalBuf)
|
void |
setCastsShadows(boolean castsShadows)
|
void |
setColorBuffer(java.nio.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(java.nio.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(java.nio.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(java.nio.FloatBuffer tangentBuf)
|
void |
setTextureCoords(java.util.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(java.nio.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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.jme.util.export.Savable |
---|
getClassTag |
Field Detail |
---|
protected BoundingVolume bound
protected int vertQuantity
protected transient java.nio.FloatBuffer colorBuf
protected transient java.nio.FloatBuffer normBuf
protected transient java.nio.FloatBuffer vertBuf
protected transient java.util.ArrayList<TexCoords> texBuf
protected transient java.nio.FloatBuffer tangentBuf
protected transient java.nio.FloatBuffer binormalBuf
protected transient java.nio.FloatBuffer fogBuf
protected transient VBOInfo vboInfo
protected boolean enabled
protected boolean castsShadows
protected boolean hasDirtyVertices
public RenderState[] states
protected ColorRGBA defaultColor
protected int displayListID
protected static final Vector3f compVect
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, java.nio.FloatBuffer vertex, java.nio.FloatBuffer normal, java.nio.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 Spatial
public void setVertexCount(int vertQuantity)
public int getTriangleCount()
getTriangleCount
in class Spatial
public void reconstruct(java.nio.FloatBuffer vertices, java.nio.FloatBuffer normals, java.nio.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 setVBOInfo
public VBOInfo getVBOInfo()
VBOInfo
public 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 java.nio.FloatBuffer getVertexBuffer()
getVertexBuffer
returns the float buffer that contains
this geometry's vertex information.
public void setVertexBuffer(java.nio.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(java.nio.FloatBuffer fogBuf)
fogBuf
- The fog buffer to use in this geometrypublic java.nio.FloatBuffer getFogBuffer()
public java.nio.FloatBuffer getNormalBuffer()
getNormalBuffer
retrieves this geometry's normal
information as a float buffer.
public void setNormalBuffer(java.nio.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 java.nio.FloatBuffer getColorBuffer()
getColorBufferfer
retrieves the float buffer that contains
this geometry's color information.
public void setColorBuffer(java.nio.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 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 java.util.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 Spatial
public void setModelBound(BoundingVolume modelBound)
setModelBound
sets the bounding object for this geometry.
setModelBound
in class Spatial
modelBound
- 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 Spatial
r
- 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 Spatial
Spatial.updateWorldBound()
protected void applyRenderState(java.util.Stack<? extends RenderState>[] states)
applyRenderState
determines if a particular render state
is set for this Geometry. If not, the default state will be used.
applyRenderState
in class Spatial
states
- An array of stacks for each state.public void sortLights()
sortLights
in class Spatial
public 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 Spatial
ray
- 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 java.nio.FloatBuffer getWorldCoords(java.nio.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 java.nio.FloatBuffer getWorldNormals(java.nio.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(java.util.ArrayList<TexCoords> texBuf)
public void clearTextureBuffers()
public void addTextureCoordinates(TexCoords textureCoords)
public void addTextureCoordinates(TexCoords textureCoords, int coordSize)
public void resizeTextureIds(int i)
protected void checkTextureCoordinates()
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 Spatial
r
- A renderer to lock against.Spatial.unlockMeshes(Renderer)
public void unlockMeshes(Renderer r)
Spatial
unlockMeshes
in class Spatial
r
- 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 java.io.IOException
write
in interface Savable
write
in class Spatial
java.io.IOException
public void read(JMEImporter e) throws java.io.IOException
read
in interface Savable
read
in class Spatial
java.io.IOException
public BoundingVolume getModelBound()
getModelBound
retrieves the bounding object that contains
the geometry's vertices.
public boolean hasDirtyVertices()
public void setHasDirtyVertices(boolean flag)
public void setTangentBuffer(java.nio.FloatBuffer tangentBuf)
public java.nio.FloatBuffer getTangentBuffer()
public void setBinormalBuffer(java.nio.FloatBuffer binormalBuf)
public java.nio.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 |