Package jme3utilities.debug
Class AxesVisualizer
java.lang.Object
com.jme3.scene.control.AbstractControl
jme3utilities.SimpleControl
jme3utilities.SubtreeControl
jme3utilities.debug.AxesVisualizer
- All Implemented Interfaces:
com.jme3.export.Savable,com.jme3.scene.control.Control,com.jme3.util.clone.JmeCloneable,Cloneable
A SubtreeControl to visualize the coordinate axes of a Node.
The controlled spatial must be a Node. TODO option to specify a subject spatial
A new Control is disabled by default. When enabled, it attaches up to 3 arrow geometries to the subtree, each of which represents an axis.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatmagic width value used to specify a solid arrowFields inherited from class com.jme3.scene.control.AbstractControl
enabled, spatial -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNo-argument constructor needed by SavableClassUtil.AxesVisualizer(com.jme3.asset.AssetManager manager, float length) Instantiate a (disabled) set of hidden solid coordinate axes.AxesVisualizer(com.jme3.asset.AssetManager manager, float length, float width) Instantiate a (disabled) set of hidden wireframe coordinate axes. -
Method Summary
Modifier and TypeMethodDescriptionfloatRead the length of the axis arrows.clone()Create a shallow copy of this Control.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.booleanRead the depth-test setting.floatRead the line width of the axis arrows.intnumAxes()Read the number of axis arrows.voidread(com.jme3.export.JmeImporter importer) De-serialize this Control from the specified importer, for example when loading from a J3O file.voidsetAxisLength(float length) Alter the length of the axis arrows.voidsetDepthTest(boolean newSetting) Alter the depth-test setting.voidsetEnabled(boolean newState) Alter the visibility of the visualization.voidsetLineWidth(float width) Alter the line width.voidsetNumAxes(int newNumber) Alter the number of axis arrows.com.jme3.math.Vector3ftipLocation(int axisIndex) Determine the tip location of the indexed axis arrow.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
cloneFields, cloneForSpatial, getSubtree, setSpatial, setSubtreeMethods inherited from class jme3utilities.SimpleControl
controlRender, isEnabled, toggleEnabledMethods inherited from class com.jme3.scene.control.AbstractControl
getSpatial, jmeClone, render, update
-
Field Details
-
widthForSolid
public static final float widthForSolidmagic width value used to specify a solid arrow- See Also:
-
-
Constructor Details
-
AxesVisualizer
protected AxesVisualizer()No-argument constructor needed by SavableClassUtil. -
AxesVisualizer
public AxesVisualizer(com.jme3.asset.AssetManager manager, float length) Instantiate a (disabled) set of hidden solid coordinate axes.- Parameters:
manager- for loading assets (not null, alias created)length- length of each axis arrow (in world units, >0)
-
AxesVisualizer
public AxesVisualizer(com.jme3.asset.AssetManager manager, float length, float width) Instantiate a (disabled) set of hidden wireframe coordinate axes.- Parameters:
manager- for loading material definitions (not null, alias created)length- length of each axis arrow (in world units, >0)width- thickness of each axis arrow (in pixels, ≥1)
-
-
Method Details
-
axisLength
public float axisLength()Read the length of the axis arrows.- Returns:
- length (in world units, >0)
-
isDepthTest
public boolean isDepthTest()Read 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()Read the line width of the axis arrows.- Returns:
- width (in pixels, ≥1) or 0 for solid arrows
-
numAxes
public int numAxes()Read the number of axis arrows.- Returns:
- count (≥1, ≤3)
-
setAxisLength
public void setAxisLength(float length) Alter the length of the axis arrows.- Parameters:
length- (in world units, >0)
-
setDepthTest
public void setDepthTest(boolean newSetting) Alter the depth-test setting. The test provides depth cues, but often hides the axes.- Parameters:
newSetting- true to enable test, false to disable it
-
setNumAxes
public void setNumAxes(int newNumber) Alter the number of axis arrows.- Parameters:
newNumber- (≥1, ≤3)
-
setLineWidth
public void setLineWidth(float width) Alter the line width.- Parameters:
width- (in pixels, ≥1) or 0 for solid arrows
-
tipLocation
public com.jme3.math.Vector3f tipLocation(int axisIndex) Determine the tip location of the indexed axis arrow.- Parameters:
axisIndex- which axis: 0→X, 1→Y, 2→Z- Returns:
- a new vector (in world coordinates) or null if not displayed
-
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
-
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
-