Package com.jme3.scene
Class Geometry
java.lang.Object
com.jme3.scene.Spatial
com.jme3.scene.Geometry
- All Implemented Interfaces:
- HasLocalTransform,- CloneableSmartAsset,- Collidable,- Savable,- JmeCloneable,- Cloneable
- Direct Known Subclasses:
- InstancedGeometry,- ParticleEmitter,- Picture,- TerrainPatch
- 
Nested Class SummaryNested classes/interfaces inherited from class com.jme3.scene.SpatialSpatial.BatchHint, Spatial.CullHint, Spatial.DFSMode
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Matrix4fprotected GeometryGroupNodeSpecifies whichGeometryGroupNodethisGeometryis managed by.protected booleanWhen true, the geometry's transform will not be applied.protected intprotected Materialprotected Meshstatic final intprotected intThe start index of thisGeometry'sinside theGeometryGroupNode.Fields inherited from class com.jme3.scene.SpatialbatchHint, 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 SummaryConstructorsConstructorDescriptionGeometry()Instantiate aGeometrywith no name, no mesh, and no material.Create a geometry node without any mesh data.Create a geometry node with mesh data.Create a geometry node with mesh data and material.
- 
Method SummaryModifier and TypeMethodDescriptionvoidassociateWithGroupNode(GeometryGroupNode node, int startIndex) Associate thisGeometrywith aGeometryGroupNode.protected voidbreadthFirstTraversal(SceneGraphVisitor visitor, Queue<Spatial> queue) booleancheckCulling(Camera cam) checkCullingchecks the spatial with the camera to see if it should be culled.clone()This version of clone is a shallow clone, in other words, the same mesh is referenced as the original geometry.clone(boolean cloneMaterial) This version of clone is a shallow clone, in other words, the same mesh is referenced as the original geometry.voidcloneFields(Cloner cloner, Object original) Called internally by com.jme3.util.clone.Cloner.intcollideWith(Collidable other, CollisionResults results) Check collision with another Collidable.voidRecomputes the matrix returned bygetWorldMatrix().Create a deep clone of the geometry.voiddepthFirstTraversal(SceneGraphVisitor visitor, Spatial.DFSMode mode) Visit each scene graph element ordered by DFS.intReturns the LOD level set withsetLodLevel(int).Returns the material that is used for this geometry.getMesh()Returns the mesh to use for this geometryfloat[]returns the morph state of this Geometry.floatgetMorphState(String morphTarget) Get the state of a morphintReturn the number of morph targets that can be handled on the GPU simultaneously for this geometry.intReturns this geometry's mesh triangle count.intReturns this geometry's mesh vertex count.booleanDeprecated.booleanreturns true if the morph state has changed on the last frame.booleanDetermine whether thisGeometryis managed by aGeometryGroupNodeor not.booleanvoidread(JmeImporter im) booleanremoveFromParentremoves this Spatial from its parent.voidsetDirtyMorph(boolean dirtyMorph) Setting this to true will stop this geometry morph buffer to be updated, unless the morph state changesvoidsetFallbackMorphTarget(MorphTarget fallbackMorphTarget) voidsetIgnoreTransform(boolean ignoreTransform) voidsetLodLevel(int lod) Sets the LOD level to use when rendering the mesh of this geometry.voidsetMaterial(Material material) Sets the material to use for this geometry.voidSets the mesh to use for this geometry when rendering.voidsetModelBound(BoundingVolume modelBound) Sets the model bound to use for this geometry.voidsetMorphState(float[] state) voidsetMorphState(String morphTarget, float state) Set the state of the morph with the given name.voidsetNbSimultaneousGPUMorph(int nbSimultaneousGPUMorph) Sets the number of morph targets that can be handled on the GPU simultaneously for this geometry.protected voidCalled byNode.attachChild(Spatial)andNode.detachChild(Spatial)- don't call directly.voidRemoves theGeometryGroupNodeassociation from thisGeometry.voidUpdates the bounding volume of the mesh.protected voidupdateWorldBoundupdates the bounding volume that contains this geometry.protected voidprotected voidShould only be called from updateGeometricState().voidwrite(JmeExporter ex) Methods inherited from class com.jme3.scene.SpatialaddControl, addControlAt, 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
- 
Field Details- 
SAVABLE_VERSIONpublic static final int SAVABLE_VERSION- See Also:
 
- 
mesh
- 
lodLevelprotected transient int lodLevel
- 
material
- 
ignoreTransformprotected boolean ignoreTransformWhen true, the geometry's transform will not be applied.
- 
cachedWorldMat
- 
groupNodeSpecifies whichGeometryGroupNodethisGeometryis managed by.
- 
startIndexprotected int startIndexThe start index of thisGeometry'sinside theGeometryGroupNode.
 
- 
- 
Constructor Details- 
Geometrypublic Geometry()Instantiate aGeometrywith no name, no mesh, and no material. The mesh and material must be set prior to rendering.
- 
GeometryCreate a geometry node without any mesh data. Both the mesh and the material are null, the geometry cannot be rendered until those are set.- Parameters:
- name- The name of this geometry
 
- 
GeometryCreate a geometry node with mesh data. The material of the geometry is null, it cannot be rendered until it is set.- Parameters:
- name- The name of this geometry
- mesh- The mesh data for this geometry
 
- 
GeometryCreate a geometry node with mesh data and material.- Parameters:
- name- The name of this geometry
- mesh- The mesh data for this geometry
- material- The material for this geometry
 
 
- 
- 
Method Details- 
checkCullingDescription copied from class:SpatialcheckCullingchecks 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. - Overrides:
- checkCullingin class- Spatial
- Parameters:
- cam- The camera to check against.
- Returns:
- true if inside or intersecting camera frustum (should be rendered), false if outside.
 
- 
isIgnoreTransformpublic boolean isIgnoreTransform()- Returns:
- If ignoreTransform mode is set.
- See Also:
 
- 
setIgnoreTransformpublic void setIgnoreTransform(boolean ignoreTransform) - Parameters:
- ignoreTransform- If true, the geometry's transform will not be applied.
 
- 
setLodLevelpublic void setLodLevel(int lod) Sets the LOD level to use when rendering the mesh of this geometry. Level 0 indicates that the default index buffer should be used, levels [1, LodLevels + 1] represent the levels set on the mesh withMesh.setLodLevels(com.jme3.scene.VertexBuffer[]).- Overrides:
- setLodLevelin class- Spatial
- Parameters:
- lod- The lod level to set
 
- 
getLodLevelpublic int getLodLevel()Returns the LOD level set withsetLodLevel(int).- Returns:
- the LOD level set
 
- 
getVertexCountpublic int getVertexCount()Returns this geometry's mesh vertex count.- Specified by:
- getVertexCountin class- Spatial
- Returns:
- this geometry's mesh vertex count.
- See Also:
 
- 
getTriangleCountpublic int getTriangleCount()Returns this geometry's mesh triangle count.- Specified by:
- getTriangleCountin class- Spatial
- Returns:
- this geometry's mesh triangle count.
- See Also:
 
- 
setMeshSets the mesh to use for this geometry when rendering.- Parameters:
- mesh- the mesh to use for this geometry
- Throws:
- IllegalArgumentException- If mesh is null
 
- 
getMeshReturns the mesh to use for this geometry- Returns:
- the mesh to use for this geometry
- See Also:
 
- 
setMaterialSets the material to use for this geometry.- Overrides:
- setMaterialin class- Spatial
- Parameters:
- material- the material to use for this geometry
 
- 
getMaterialReturns the material that is used for this geometry.- Returns:
- the material that is used for this geometry
- See Also:
 
- 
getModelBound- Returns:
- The bounding volume of the mesh, in model space.
 
- 
updateModelBoundpublic void updateModelBound()Updates the bounding volume of the mesh. Should be called when the mesh has been modified.- Specified by:
- updateModelBoundin class- Spatial
 
- 
updateWorldBoundprotected void updateWorldBound()updateWorldBoundupdates the bounding volume that contains this geometry. The location of the geometry is based on the location of all this node's parents.- Overrides:
- updateWorldBoundin class- Spatial
- See Also:
 
- 
updateWorldTransformsprotected void updateWorldTransforms()Description copied from class:SpatialShould only be called from updateGeometricState(). In most cases should not be subclassed.- Overrides:
- updateWorldTransformsin class- Spatial
 
- 
updateWorldLightListprotected void updateWorldLightList()- Overrides:
- updateWorldLightListin class- Spatial
 
- 
associateWithGroupNodeAssociate thisGeometrywith aGeometryGroupNode. Should only be called by the parentGeometryGroupNode.- Parameters:
- node- Which- GeometryGroupNodeto associate with.
- startIndex- The starting index of this geometry in the group.
 
- 
unassociateFromGroupNodepublic void unassociateFromGroupNode()Removes theGeometryGroupNodeassociation from thisGeometry. Should only be called by the parentGeometryGroupNode.
- 
removeFromParentpublic boolean removeFromParent()Description copied from class:SpatialremoveFromParentremoves this Spatial from its parent.- Overrides:
- removeFromParentin class- Spatial
- Returns:
- true if it has a parent and performed the remove.
 
- 
setParentDescription copied from class:SpatialCalled byNode.attachChild(Spatial)andNode.detachChild(Spatial)- don't call directly.setParentsets the parent of this node.
- 
computeWorldMatrixpublic void computeWorldMatrix()Recomputes the matrix returned bygetWorldMatrix(). This will require a localized transform update for this geometry.
- 
getWorldMatrixAmatrixthat transforms themeshfrom model space to world space. This matrix is computed based on theworld transformof this geometry. In order to receive updated values, you must callcomputeWorldMatrix()before using this method.- Returns:
- Matrix to transform from local space to world space
 
- 
setModelBoundSets the model bound to use for this geometry. This alters the bound used on the mesh as well viaMesh.setBound(com.jme3.bounding.BoundingVolume)and forces the world bounding volume to be recomputed.- Specified by:
- setModelBoundin class- Spatial
- Parameters:
- modelBound- The model bound to set
 
- 
collideWithDescription copied from interface:CollidableCheck collision with another Collidable.- Parameters:
- other- The object to check collision against
- results- Will contain the list of- CollisionResults.
- Returns:
- how many collisions were found between this and other
 
- 
depthFirstTraversalDescription copied from class:SpatialVisit each scene graph element ordered by DFS. There are two modes: pre order and post order.- Specified by:
- depthFirstTraversalin class- Spatial
- Parameters:
- visitor- the action to take for each visited Spatial
- mode- the traversal mode: pre order or post order
 
- 
breadthFirstTraversal- Specified by:
- breadthFirstTraversalin class- Spatial
 
- 
isGroupedpublic boolean isGrouped()Determine whether thisGeometryis managed by aGeometryGroupNodeor not.- Returns:
- True if managed by a GeometryGroupNode.
 
- 
isBatchedDeprecated.UseisGrouped()instead.- Returns:
- true if managed by a GeometryGroupNode
 
- 
cloneThis version of clone is a shallow clone, in other words, the same mesh is referenced as the original geometry. Exception: if the mesh is marked as being a software animated mesh, (bind pose is set) then the positions and normals are deep copied.- Overrides:
- clonein class- Spatial
- Parameters:
- cloneMaterial- true to clone materials, false to share them
- Returns:
- A clone of this Spatial, the scene graph in its entirety is cloned and can be altered independently of the original scene graph. Note that meshes of geometries are not cloned explicitly, they are shared if static, or specially cloned if animated.
- See Also:
 
- 
cloneThis version of clone is a shallow clone, in other words, the same mesh is referenced as the original geometry. Exception: if the mesh is marked as being a software animated mesh, (bind pose is set) then the positions and normals are deep copied.- Specified by:
- clonein interface- CloneableSmartAsset
- Overrides:
- clonein class- Spatial
- Returns:
- A clone of this Spatial, the scene graph in its entirety is cloned and can be altered independently of the original scene graph. Note that meshes of geometries are not cloned explicitly, they are shared if static, or specially cloned if animated.
- See Also:
 
- 
deepCloneCreate a deep clone of the geometry. This creates an identical copy of the mesh with the vertex buffer data duplicated.
- 
oldDeepClone
- 
cloneFieldsCalled internally by com.jme3.util.clone.Cloner. Do not call directly.- Specified by:
- cloneFieldsin interface- JmeCloneable
- Overrides:
- cloneFieldsin class- Spatial
- Parameters:
- 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 only clone what it wants.
 
- 
setMorphStatepublic void setMorphState(float[] state) 
- 
setMorphStateSet the state of the morph with the given name. If the name of the morph is not found, no state will be set.- Parameters:
- morphTarget- The name of the morph to set the state of
- state- The state to set the morph to
 
- 
isDirtyMorphpublic boolean isDirtyMorph()returns true if the morph state has changed on the last frame.- Returns:
- true if changed, otherwise false
 
- 
setDirtyMorphpublic void setDirtyMorph(boolean dirtyMorph) Setting this to true will stop this geometry morph buffer to be updated, unless the morph state changes- Parameters:
- dirtyMorph- true→prevent updating, false→allow updating
 
- 
getMorphStatepublic float[] getMorphState()returns the morph state of this Geometry. Used internally by the MorphControl.- Returns:
- an array
 
- 
getMorphStateGet the state of a morph- Parameters:
- morphTarget- the name of the morph to get the state of
- Returns:
- the state of the morph, or -1 if the morph is not found
 
- 
getNbSimultaneousGPUMorphpublic int getNbSimultaneousGPUMorph()Return the number of morph targets that can be handled on the GPU simultaneously for this geometry. Note that it depends on the material set on this geometry. This number is computed and set by the MorphControl, so it might be available only after the first frame. Else it's set to -1.- Returns:
- the number of simultaneous morph targets handled on the GPU
 
- 
setNbSimultaneousGPUMorphpublic void setNbSimultaneousGPUMorph(int nbSimultaneousGPUMorph) Sets the number of morph targets that can be handled on the GPU simultaneously for this geometry. Note that it depends on the material set on this geometry. This number is computed and set by the MorphControl, so it might be available only after the first frame. Else it's set to -1. WARNING: setting this manually might crash the shader compilation if set too high. Do it at your own risk.- Parameters:
- nbSimultaneousGPUMorph- the number of simultaneous morph targets to be handled on the GPU.
 
- 
getFallbackMorphTarget
- 
setFallbackMorphTarget
- 
write- Specified by:
- writein interface- Savable
- Overrides:
- writein class- Spatial
- Throws:
- IOException
 
- 
read- Specified by:
- readin interface- Savable
- Overrides:
- readin class- Spatial
- Throws:
- IOException
 
 
- 
isGrouped()instead.