public class Geometry extends Spatial
Spatial.BatchHint, Spatial.CullHint, Spatial.DFSMode
Modifier and Type | Field and Description |
---|---|
protected Matrix4f |
cachedWorldMat |
protected GeometryGroupNode |
groupNode
Specifies which
GeometryGroupNode this Geometry
is managed by. |
protected boolean |
ignoreTransform
When true, the geometry's transform will not be applied.
|
protected int |
lodLevel |
protected Material |
material |
protected Mesh |
mesh |
static int |
SAVABLE_VERSION |
protected int |
startIndex
The start index of this
Geometry's inside
the GeometryGroupNode . |
batchHint, controls, cullHint, frustrumIntersects, key, localLights, localOverrides, localTransform, name, parent, queueBucket, queueDistance, refreshFlags, RF_BOUND, RF_CHILD_LIGHTLIST, RF_LIGHTLIST, RF_MATPARAM_OVERRIDE, RF_TRANSFORM, shadowMode, userData, worldBound, worldLights, worldOverrides, worldTransform
Constructor and Description |
---|
Geometry()
Instantiate a
Geometry with no name, no mesh, and no
material. |
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.
|
Modifier and Type | Method and Description |
---|---|
void |
associateWithGroupNode(GeometryGroupNode node,
int startIndex)
Associate this
Geometry with a GeometryGroupNode . |
protected void |
breadthFirstTraversal(SceneGraphVisitor visitor,
java.util.Queue<Spatial> queue) |
boolean |
checkCulling(Camera cam)
checkCulling checks the spatial with the camera to see if it
should be culled. |
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.
|
void |
cloneFields(Cloner cloner,
java.lang.Object original)
Called internally by com.jme3.util.clone.Cloner.
|
int |
collideWith(Collidable other,
CollisionResults results)
Check collision with another Collidable.
|
void |
computeWorldMatrix()
Recomputes the matrix returned by
getWorldMatrix() . |
Spatial |
deepClone()
Create a deep clone of the geometry.
|
void |
depthFirstTraversal(SceneGraphVisitor visitor,
Spatial.DFSMode mode)
Visit each scene graph element ordered by DFS.
|
MorphTarget |
getFallbackMorphTarget() |
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 mesh to use for this geometry
|
BoundingVolume |
getModelBound() |
float[] |
getMorphState()
returns the morph state of this Geometry.
|
float |
getMorphState(java.lang.String morphTarget)
Get the state of a morph
|
int |
getNbSimultaneousGPUMorph()
Return the number of morph targets that can be handled
on the GPU simultaneously for this geometry.
|
int |
getTriangleCount()
Returns this geometry's mesh triangle count.
|
int |
getVertexCount()
Returns this geometry's mesh vertex count.
|
Matrix4f |
getWorldMatrix()
|
boolean |
isBatched()
Deprecated.
Use
isGrouped() instead. |
boolean |
isDirtyMorph()
returns true if the morph state has changed on the last frame.
|
boolean |
isGrouped()
Determine whether this
Geometry is managed by a
GeometryGroupNode or not. |
boolean |
isIgnoreTransform() |
Spatial |
oldDeepClone() |
void |
read(JmeImporter im) |
boolean |
removeFromParent()
removeFromParent removes this Spatial from its parent. |
void |
setDirtyMorph(boolean dirtyMorph)
Seting this to true will stop this geometry morph buffer to be updated,
unless the morph state changes
|
void |
setFallbackMorphTarget(MorphTarget fallbackMorphTarget) |
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.
|
void |
setMorphState(float[] state) |
void |
setMorphState(java.lang.String morphTarget,
float state)
Set the state of the morph with the given name.
|
void |
setNbSimultaneousGPUMorph(int nbSimultaneousGPUMorph)
Sets the number of morph targets that can be handled
on the GPU simultaneously for this geometry.
|
protected void |
setParent(Node parent)
Called by
Node.attachChild(Spatial) and
Node.detachChild(Spatial) - don't call directly. |
void |
unassociateFromGroupNode()
Removes the
GeometryGroupNode association from 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 |
updateWorldLightList() |
protected void |
updateWorldTransforms()
Should only be called from updateGeometricState().
|
void |
write(JmeExporter ex) |
addControl, addLight, addMatParamOverride, breadthFirstTraversal, center, clearMatParamOverrides, depthFirstTraversal, forceRefresh, getBatchHint, getControl, getControl, getCullHint, getKey, getLastFrustumIntersection, getLocalBatchHint, getLocalCullHint, getLocalLightList, getLocalMatParamOverrides, getLocalQueueBucket, getLocalRotation, getLocalScale, getLocalShadowMode, getLocalToWorldMatrix, getLocalTransform, getLocalTranslation, getName, getNumControls, getParent, getQueueBucket, getShadowMode, getUserData, getUserDataKeys, getWorldBound, getWorldLightList, getWorldMatParamOverrides, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, jmeClone, localToWorld, lookAt, matches, move, move, oldClone, removeControl, removeControl, removeLight, removeMatParamOverride, rotate, rotate, rotateUpTo, runControlRender, scale, scale, setBatchHint, setBoundRefresh, setCullHint, setKey, setLastFrustumIntersection, setLightListRefresh, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalScale, setLocalTransform, setLocalTranslation, setLocalTranslation, setMatParamOverrideRefresh, setName, setQueueBucket, setRequiresUpdates, setShadowMode, setTransformRefresh, setUserData, toString, updateGeometricState, updateLogicalState, updateMatParamOverrides, worldToLocal
public static final int SAVABLE_VERSION
protected Mesh mesh
protected transient int lodLevel
protected Material material
protected boolean ignoreTransform
protected transient Matrix4f cachedWorldMat
protected GeometryGroupNode groupNode
GeometryGroupNode
this Geometry
is managed by.protected int startIndex
Geometry's
inside
the GeometryGroupNode
.public Geometry()
Geometry
with no name, no mesh, and no
material. The mesh and material must be set prior to rendering.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 geometrypublic boolean checkCulling(Camera cam)
Spatial
checkCulling
checks the spatial with the camera to see if it
should be culled.
This method is called by the renderer. Usually it should not be called directly.
checkCulling
in class Spatial
cam
- The camera to check against.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 geometryjava.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 updateWorldLightList()
updateWorldLightList
in class Spatial
public void associateWithGroupNode(GeometryGroupNode node, int startIndex)
Geometry
with a GeometryGroupNode
.
Should only be called by the parent GeometryGroupNode
.node
- Which GeometryGroupNode
to associate with.startIndex
- The starting index of this geometry in the group.public void unassociateFromGroupNode()
GeometryGroupNode
association from this
Geometry
.
Should only be called by the parent GeometryGroupNode
.public boolean removeFromParent()
Spatial
removeFromParent
removes this Spatial from its 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.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.DFSMode mode)
Spatial
depthFirstTraversal
in class Spatial
mode
- the traversal mode: pre order or post orderprotected void breadthFirstTraversal(SceneGraphVisitor visitor, java.util.Queue<Spatial> queue)
breadthFirstTraversal
in class Spatial
public boolean isGrouped()
Geometry
is managed by a
GeometryGroupNode
or not.GeometryGroupNode
.@Deprecated public boolean isBatched()
isGrouped()
instead.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 Spatial oldDeepClone()
public void cloneFields(Cloner cloner, java.lang.Object original)
cloneFields
in interface JmeCloneable
cloneFields
in class Spatial
cloner
- The cloner that is performing the cloning operation. The
cloneFields method can call back into the cloner to make
clones of its subordinate fields.original
- The original object from which this object was cloned.
This is provided for the very rare case that this object needs
to refer to its original for some reason. In general, all of
the relevant values should have been transferred during the
shallow clone and this object need merely clone what it wants.public void setMorphState(float[] state)
public void setMorphState(java.lang.String morphTarget, float state)
morphTarget
- The name of the morph to set the state ofstate
- The state to set the morph topublic boolean isDirtyMorph()
public void setDirtyMorph(boolean dirtyMorph)
dirtyMorph
- public float[] getMorphState()
public float getMorphState(java.lang.String morphTarget)
morphTarget
- the name of the morph to get the state ofpublic int getNbSimultaneousGPUMorph()
public void setNbSimultaneousGPUMorph(int nbSimultaneousGPUMorph)
nbSimultaneousGPUMorph
- the number of simultaneous morph targets to be handled on the GPU.public MorphTarget getFallbackMorphTarget()
public void setFallbackMorphTarget(MorphTarget fallbackMorphTarget)
public void write(JmeExporter ex) throws java.io.IOException
public void read(JmeImporter im) throws java.io.IOException