Package jme3utilities.debug
Class VectorVisualizer
java.lang.Object
com.jme3.scene.control.AbstractControl
jme3utilities.SimpleControl
jme3utilities.SubtreeControl
jme3utilities.debug.VectorVisualizer
- All Implemented Interfaces:
com.jme3.export.Savable,com.jme3.scene.control.Control,com.jme3.util.clone.JmeCloneable,Cloneable
A SubtreeControl to visualize a vector.
The controlled spatial must be a Node.
A new Control is disabled by default. When enabled, it attaches an arrow geometry to its subtree.
-
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.VectorVisualizer(com.jme3.asset.AssetManager manager, float width) Instantiate a (disabled) arrow. -
Method Summary
Modifier and TypeMethodDescriptionclone()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.com.jme3.math.ColorRGBAcolor(com.jme3.math.ColorRGBA storeResult) Determine the color of the arrow.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.booleanDetermine the depth-test setting.floatDetermine the line width of the arrow.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 color) Alter the color of the arrow.voidsetDepthTest(boolean newSetting) Alter the depth-test setting.voidsetEnabled(boolean newState) Alter the visibility of the visualization.voidsetLineWidth(float width) Alter the line width.voidsetTipOffset(com.jme3.math.Vector3f offset) Alter the offset of the arrow's tip in local coordinates.com.jme3.math.Vector3fDetermine the location of the arrow's tip.com.jme3.math.Vector3ftipOffset(com.jme3.math.Vector3f storeResult) Determine the offset of the arrow's tip in local coordinates.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
-
Field Details
-
widthForSolid
public static final float widthForSolidmagic width value used to specify a solid arrow- See Also:
-
-
Constructor Details
-
VectorVisualizer
protected VectorVisualizer()No-argument constructor needed by SavableClassUtil. -
VectorVisualizer
public VectorVisualizer(com.jme3.asset.AssetManager manager, float width) Instantiate a (disabled) arrow.- Parameters:
manager- for loading material definitions (not null, alias created)width- thickness of the arrow (in pixels, ≥0)
-
-
Method Details
-
color
public com.jme3.math.ColorRGBA color(com.jme3.math.ColorRGBA storeResult) Determine the color of the arrow.- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- the color value (either storeResult or a new instance)
-
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 line width of the arrow.- Returns:
- width (in pixels, ≥1) or 0 for a solid arrow
-
setColor
public void setColor(com.jme3.math.ColorRGBA color) Alter the color of the arrow.- Parameters:
color- the desired color (not null, unaffected)
-
setDepthTest
public void setDepthTest(boolean newSetting) Alter the depth-test setting. The test provides depth cues, but often hides the arrow.- Parameters:
newSetting- true to enable test, false to disable it
-
setLineWidth
public void setLineWidth(float width) Alter the line width.- Parameters:
width- (in pixels, ≥1) or 0 for a solid arrow
-
setTipOffset
public void setTipOffset(com.jme3.math.Vector3f offset) Alter the offset of the arrow's tip in local coordinates.- Parameters:
offset- the desired offset (not null, unaffected)
-
tipLocation
public com.jme3.math.Vector3f tipLocation()Determine the location of the arrow's tip.- Returns:
- a new vector (in world coordinates) or null if not displayed
-
tipOffset
public com.jme3.math.Vector3f tipOffset(com.jme3.math.Vector3f storeResult) Determine the offset of the arrow's tip in local coordinates.- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- the offset (in local coordinates, either storeResult or a new instance)
-
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
-