Package jme3utilities.debug
Class BoundsVisualizer
java.lang.Object
com.jme3.scene.control.AbstractControl
jme3utilities.SimpleControl
jme3utilities.SubtreeControl
jme3utilities.debug.BoundsVisualizer
- All Implemented Interfaces:
com.jme3.export.Savable,com.jme3.scene.control.Control,com.jme3.util.clone.JmeCloneable,Cloneable
A SubtreeControl to visualize the world bounds of a subject spatial.
The controlled spatial must be a Node, but the subject may be a Geometry.
The Control is disabled by default. When enabled, it attaches a Geometry to the subtree.
-
Field Summary
Fields inherited from class com.jme3.scene.control.AbstractControl
enabled, spatial -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNo-argument constructor needed by SavableClassUtil.BoundsVisualizer(com.jme3.asset.AssetManager assetManager) Instantiate a disabled control. -
Method Summary
Modifier and TypeMethodDescriptionintDetermine which local axis is being used for billboarding.clone()Create a shallow copy of this Control.voidcloneFields(com.jme3.util.clone.Cloner cloner, Object original) Convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.protected voidcontrolUpdate(float updateInterval) Callback invoked when the controlled spatial's geometric state is about to be updated, once per frame while attached and enabled.com.jme3.math.ColorRGBAcopyLineColor(com.jme3.math.ColorRGBA storeResult) Copy the color of the lines.voidDisable billboarding.voidenableBillboarding(com.jme3.renderer.Camera camera, int axisIndex) Enable billboarding.com.jme3.renderer.CameraAccess the Camera used for billboarding.com.jme3.scene.SpatialAccess the Spatial whose bounds are being visualized.booleanDetermine the depth-test setting.floatDetermine the effective line width of the visualization.voidread(com.jme3.export.JmeImporter importer) De-serialize this Control from the specified importer, for example when loading from a J3O file.voidsetColor(com.jme3.math.ColorRGBA newColor) Alter the color of all lines.voidsetDepthTest(boolean newSetting) Alter the depth test setting.voidsetEnabled(boolean newState) Alter the visibility of the visualization.voidsetLineWidth(float newWidth) Alter the effective line width of the visualization.voidsetSphereType(SphereMeshes type) Alter the type of Mesh used to visualize spheres.voidsetSubject(com.jme3.scene.Spatial newSubject) Alter which spatial's bounds are being visualized.Read the type of Mesh used to visualize spheres.voidwrite(com.jme3.export.JmeExporter exporter) Serialize this Control to the specified exporter, for example when saving to a J3O file.Methods inherited from class jme3utilities.SubtreeControl
cloneForSpatial, getSubtree, setSpatial, setSubtreeMethods inherited from class jme3utilities.SimpleControl
controlRender, isEnabled, toggleEnabledMethods inherited from class com.jme3.scene.control.AbstractControl
getSpatial, jmeClone, render, update
-
Constructor Details
-
BoundsVisualizer
protected BoundsVisualizer()No-argument constructor needed by SavableClassUtil. -
BoundsVisualizer
public BoundsVisualizer(com.jme3.asset.AssetManager assetManager) Instantiate a disabled control.- Parameters:
assetManager- for loading material definitions (not null)
-
-
Method Details
-
billboardAxis
public int billboardAxis()Determine which local axis is being used for billboarding.- Returns:
- the axis index (≥0, ≤2) or -1 if not billboarding
-
copyLineColor
public com.jme3.math.ColorRGBA copyLineColor(com.jme3.math.ColorRGBA storeResult) Copy the color of the lines.- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- the color (either
storeResultor a new instance)
-
disableBillboarding
public void disableBillboarding()Disable billboarding. -
enableBillboarding
public void enableBillboarding(com.jme3.renderer.Camera camera, int axisIndex) Enable billboarding. Note: billboarding is implemented only for spheres, not axis-aligned boxes.- Parameters:
camera- the camera to use for billboarding (not null, alias created)axisIndex- which local axis should point toward the camera: 0→+X, 1→+Y, 2→+Z
-
getCamera
public com.jme3.renderer.Camera getCamera()Access the Camera used for billboarding.- Returns:
- the pre-existing instance (may be null)
-
getSubject
public com.jme3.scene.Spatial getSubject()Access the Spatial whose bounds are being visualized.- Returns:
- the pre-existing instance (may be null)
-
isDepthTest
public boolean isDepthTest()Determine the depth-test setting.The test provides depth cues, but might hide portions of the visualization.
- Returns:
- true if the test is enabled, otherwise false
-
lineWidth
public float lineWidth()Determine the effective line width of the visualization.- Returns:
- width (in pixels, ≥0)
-
setColor
public void setColor(com.jme3.math.ColorRGBA newColor) Alter the color of all lines.- Parameters:
newColor- (not null, unaffected)
-
setDepthTest
public void setDepthTest(boolean newSetting) Alter the depth test setting. The test provides depth cues, but might hide portions of the visualization.- Parameters:
newSetting- true to enable test, false to disable it
-
setLineWidth
public void setLineWidth(float newWidth) Alter the effective line width of the visualization.- Parameters:
newWidth- (in pixels, ≥0, values <1 hide the lines)
-
setSphereType
Alter the type of Mesh used to visualize spheres.- Parameters:
type- (not null)
-
setSubject
public void setSubject(com.jme3.scene.Spatial newSubject) Alter which spatial's bounds are being visualized.- Parameters:
newSubject- which spatial (may be null, alias created)
-
sphereType
Read the type of Mesh used to visualize spheres.- Returns:
- an enum value (not null)
-
clone
Create a shallow copy of this Control.- Overrides:
clonein classSubtreeControl- Returns:
- a new control, equivalent to this one
- Throws:
CloneNotSupportedException- if superclass isn't cloneable
-
cloneFields
Convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
cloneFieldsin interfacecom.jme3.util.clone.JmeCloneable- Overrides:
cloneFieldsin classSubtreeControl- Parameters:
cloner- the Cloner currently cloning this Controloriginal- the instance from which this Control was shallow-cloned
-
controlUpdate
protected void controlUpdate(float updateInterval) Callback invoked when the controlled spatial's geometric state is about to be updated, once per frame while attached and enabled.- Overrides:
controlUpdatein classSimpleControl- Parameters:
updateInterval- time interval between updates (in seconds, ≥0)
-
read
De-serialize this Control from the specified importer, for example when loading from a J3O file.- Specified by:
readin interfacecom.jme3.export.Savable- Overrides:
readin classSubtreeControl- Parameters:
importer- (not null)- Throws:
IOException- from the importer
-
setEnabled
public void setEnabled(boolean newState) Alter the visibility of the visualization.- Overrides:
setEnabledin classSubtreeControl- Parameters:
newState- if true, reveal the visualization; if false, hide it
-
write
Serialize this Control to the specified exporter, for example when saving to a J3O file.- Specified by:
writein interfacecom.jme3.export.Savable- Overrides:
writein classSubtreeControl- Parameters:
exporter- (not null)- Throws:
IOException- from the exporter
-