|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme3.scene.Spatial
com.jme3.scene.Geometry
public 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 Material
object to define how the surface
should be shaded and the Mesh
data to contain the actual geometry.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jme3.scene.Spatial |
---|
Spatial.BatchHint, Spatial.CullHint |
Field Summary | |
---|---|
protected BatchNode |
batchNode
used when geometry is batched |
protected Matrix4f |
cachedOffsetMat
the cached offset matrix used when the geometry is batched |
protected Matrix4f |
cachedWorldMat
|
protected boolean |
ignoreTransform
When true, the geometry's transform will not be applied. |
protected int |
lodLevel
|
protected Material |
material
|
protected Mesh |
mesh
|
protected Transform |
prevBatchTransforms
the previous transforms of the geometry used to compute world transforms |
static int |
SAVABLE_VERSION
|
protected int |
startIndex
the start index of this geom's mesh in the batchNode mesh |
Fields inherited from class com.jme3.scene.Spatial |
---|
batchHint, controls, cullHint, frustrumIntersects, key, localLights, localTransform, name, parent, queueBucket, queueDistance, refreshFlags, RF_BOUND, RF_LIGHTLIST, RF_TRANSFORM, shadowMode, userData, worldBound, worldLights, worldTransform |
Constructor Summary | |
---|---|
Geometry()
Serialization only. |
|
Geometry(java.lang.String name)
Create a geometry node without any mesh data. |
|
Geometry(java.lang.String name,
Mesh mesh)
Create a geometry node with mesh data. |
Method Summary | |
---|---|
protected void |
batch(BatchNode node,
int startIndex)
Batch this geometry, should only be called by the BatchNode. |
protected void |
breadthFirstTraversal(SceneGraphVisitor visitor,
java.util.Queue<Spatial> queue)
|
Geometry |
clone()
This version of clone is a shallow clone, in other words, the same mesh is referenced as the original geometry. |
Geometry |
clone(boolean cloneMaterial)
This version of clone is a shallow clone, in other words, the same mesh is referenced as the original geometry. |
int |
collideWith(Collidable other,
CollisionResults results)
Check collision with another Collidable. |
void |
computeOffsetTransform()
Recomputes the cached offset matrix used when the geometry is batched * |
void |
computeWorldMatrix()
Recomputes the matrix returned by getWorldMatrix() . |
Spatial |
deepClone()
Creates a deep clone of the geometry, this creates an identical copy of the mesh with the vertexbuffer data duplicated. |
void |
depthFirstTraversal(SceneGraphVisitor visitor)
Visit each scene graph element ordered by DFS |
int |
getLodLevel()
Returns the LOD level set with setLodLevel(int) . |
Material |
getMaterial()
Returns the material that is used for this geometry. |
Mesh |
getMesh()
Returns the mseh to use for this geometry |
BoundingVolume |
getModelBound()
|
int |
getTriangleCount()
Returns this geometry's mesh triangle count. |
int |
getVertexCount()
Returns this geometry's mesh vertex count. |
Matrix4f |
getWorldMatrix()
A matrix that transforms the mesh
from model space to world space. |
boolean |
isBatched()
|
boolean |
isIgnoreTransform()
|
void |
read(JmeImporter im)
|
boolean |
removeFromParent()
removeFromParent removes this Spatial from it's parent. |
void |
setIgnoreTransform(boolean ignoreTransform)
|
void |
setLodLevel(int lod)
Sets the LOD level to use when rendering the mesh of this geometry. |
void |
setMaterial(Material material)
Sets the material to use for this geometry. |
void |
setMesh(Mesh mesh)
Sets the mesh to use for this geometry when rendering. |
void |
setModelBound(BoundingVolume modelBound)
Sets the model bound to use for this geometry. |
protected void |
setParent(Node parent)
Called by Node.attachChild(Spatial) and
Node.detachChild(Spatial) - don't call directly. |
protected void |
unBatch()
unBatch this geometry. |
void |
updateModelBound()
Updates the bounding volume of the mesh. |
protected void |
updateWorldBound()
updateWorldBound updates the bounding volume that contains
this geometry. |
protected void |
updateWorldTransforms()
Should only be called from updateGeometricState(). |
void |
write(JmeExporter ex)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SAVABLE_VERSION
protected Mesh mesh
protected transient int lodLevel
protected Material material
protected boolean ignoreTransform
protected transient Matrix4f cachedWorldMat
protected BatchNode batchNode
protected int startIndex
protected Transform prevBatchTransforms
protected Matrix4f cachedOffsetMat
Constructor Detail |
---|
public Geometry()
public Geometry(java.lang.String name)
name
- The name of this geometrypublic Geometry(java.lang.String name, Mesh mesh)
name
- The name of this geometrymesh
- The mesh data for this geometryMethod Detail |
---|
public boolean isIgnoreTransform()
setIgnoreTransform(boolean)
public void setIgnoreTransform(boolean ignoreTransform)
ignoreTransform
- If true, the geometry's transform will not be applied.public void setLodLevel(int lod)
Mesh.setLodLevels(com.jme3.scene.VertexBuffer[])
.
setLodLevel
in class Spatial
lod
- The lod level to setpublic int getLodLevel()
setLodLevel(int)
.
public int getVertexCount()
getVertexCount
in class Spatial
Mesh.getVertexCount()
public int getTriangleCount()
getTriangleCount
in class Spatial
Mesh.getTriangleCount()
public void setMesh(Mesh mesh)
mesh
- the mesh to use for this geometry
java.lang.IllegalArgumentException
- If mesh is nullpublic Mesh getMesh()
setMesh(com.jme3.scene.Mesh)
public void setMaterial(Material material)
setMaterial
in class Spatial
material
- the material to use for this geometrypublic Material getMaterial()
setMaterial(com.jme3.material.Material)
public BoundingVolume getModelBound()
public void updateModelBound()
updateModelBound
in class Spatial
protected 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 updateWorldTransforms()
Spatial
updateWorldTransforms
in class Spatial
protected void batch(BatchNode node, int startIndex)
node
- the batchNodestartIndex
- the starting index of this geometry in the batched meshprotected void unBatch()
public boolean removeFromParent()
Spatial
removeFromParent
removes this Spatial from it's parent.
removeFromParent
in class Spatial
protected void setParent(Node parent)
Spatial
Node.attachChild(Spatial)
and
Node.detachChild(Spatial)
- don't call directly.
setParent
sets the parent of this node.
setParent
in class Spatial
parent
- the parent of this node.public void computeOffsetTransform()
public void computeWorldMatrix()
getWorldMatrix()
.
This will require a localized transform update for this geometry.
public Matrix4f getWorldMatrix()
matrix
that transforms the mesh
from model space to world space. This matrix is computed based on the
world transform
of this geometry.
In order to receive updated values, you must call computeWorldMatrix()
before using this method.
public void setModelBound(BoundingVolume modelBound)
Mesh.setBound(com.jme3.bounding.BoundingVolume)
and
forces the world bounding volume to be recomputed.
setModelBound
in class Spatial
modelBound
- The model bound to setpublic int collideWith(Collidable other, CollisionResults results)
Collidable
other
- The object to check collision againstresults
- Will contain the list of CollisionResult
s.
public void depthFirstTraversal(SceneGraphVisitor visitor)
Spatial
depthFirstTraversal
in class Spatial
protected void breadthFirstTraversal(SceneGraphVisitor visitor, java.util.Queue<Spatial> queue)
breadthFirstTraversal
in class Spatial
public boolean isBatched()
public Geometry clone(boolean cloneMaterial)
clone
in class Spatial
Mesh.cloneForAnim()
public Geometry clone()
clone
in interface CloneableSmartAsset
clone
in class Spatial
Mesh.cloneForAnim()
public Spatial deepClone()
deepClone
in class Spatial
Spatial.clone()
public void write(JmeExporter ex) throws java.io.IOException
write
in interface Savable
write
in class Spatial
java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
read
in interface Savable
read
in class Spatial
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |