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

public class AxesVisualizer extends SubtreeControl
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

    Fields
    Modifier and Type
    Field
    Description
    static final float
    magic width value used to specify a solid arrow

    Fields inherited from class com.jme3.scene.control.AbstractControl

    enabled, spatial
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    No-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 Type
    Method
    Description
    float
    Read the length of the axis arrows.
    Create a shallow copy of this Control.
    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.
    boolean
    Read the depth-test setting.
    float
    Read the line width of the axis arrows.
    int
    Read the number of axis arrows.
    void
    read(com.jme3.export.JmeImporter importer)
    De-serialize this Control from the specified importer, for example when loading from a J3O file.
    void
    setAxisLength(float length)
    Alter the length of the axis arrows.
    void
    setDepthTest(boolean newSetting)
    Alter the depth-test setting.
    void
    setEnabled(boolean newState)
    Alter the visibility of the visualization.
    void
    setLineWidth(float width)
    Alter the line width.
    void
    setNumAxes(int newNumber)
    Alter the number of axis arrows.
    com.jme3.math.Vector3f
    tipLocation(int axisIndex)
    Determine the tip location of the indexed axis arrow.
    void
    write(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, setSubtree

    Methods inherited from class jme3utilities.SimpleControl

    controlRender, isEnabled, toggleEnabled

    Methods inherited from class com.jme3.scene.control.AbstractControl

    getSpatial, jmeClone, render, update

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • widthForSolid

      public static final float widthForSolid
      magic 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:
      clone in class SubtreeControl
      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:
      controlUpdate in class SimpleControl
      Parameters:
      updateInterval - time interval between updates (in seconds, ≥0)
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize this Control from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Overrides:
      read in class SubtreeControl
      Parameters:
      importer - (not null)
      Throws:
      IOException - from the importer
    • setEnabled

      public void setEnabled(boolean newState)
      Alter the visibility of the visualization.
      Overrides:
      setEnabled in class SubtreeControl
      Parameters:
      newState - if true, reveal the visualization; if false, hide it
    • write

      public void write(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize this Control to the specified exporter, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Overrides:
      write in class SubtreeControl
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from the exporter