java.lang.Object
com.marginallyclever.ro3.apps.viewport.viewporttools.move.RotateToolOneAxis
All Implemented Interfaces:
ViewportTool

public class RotateToolOneAxis extends Object implements ViewportTool
A tool to rotate Pose nodes in the Viewport.
  • Constructor Details

    • RotateToolOneAxis

      public RotateToolOneAxis(ColorRGB color)
  • Method Details

    • activate

      public void activate(List<Node> list)
      This method is called when the tool is activated. It receives the SelectedItems object containing the selected entities and their initial world poses.
      Specified by:
      activate in interface ViewportTool
      Parameters:
      list - The selected items to be manipulated by the tool.
    • setPivotMatrix

      public void setPivotMatrix(javax.vecmath.Matrix4d pivot)
    • deactivate

      public void deactivate()
      This method is called when the tool is deactivated. It allows the tool to perform any necessary cleanup actions before another tool takes over.
      Specified by:
      deactivate in interface ViewportTool
    • handleMouseEvent

      public void handleMouseEvent(MouseEvent event)
      Description copied from interface: ViewportTool
      Handles mouse input events for the tool.
      Specified by:
      handleMouseEvent in interface ViewportTool
      Parameters:
      event - The MouseEvent object representing the input event.
    • mouseMoved

      public void mouseMoved(MouseEvent event)
      Specified by:
      mouseMoved in interface ViewportTool
    • mousePressed

      public void mousePressed(MouseEvent event)
      Specified by:
      mousePressed in interface ViewportTool
    • mouseDragged

      public void mouseDragged(MouseEvent event)
      Specified by:
      mouseDragged in interface ViewportTool
    • roundToNearestSnap

      public static double roundToNearestSnap(double angleRadians, double snapRange, double nearest)
    • mouseReleased

      public void mouseReleased(MouseEvent event)
      Specified by:
      mouseReleased in interface ViewportTool
    • update

      public void update(double deltaTime)
      Updates the tool's internal state, if necessary.
      Specified by:
      update in interface ViewportTool
      Parameters:
      deltaTime - Time elapsed since the last update.
    • render

      public void render(com.jogamp.opengl.GL3 gl, ShaderProgram shaderProgram)
      Renders any tool-specific visuals to the 3D scene.
      Specified by:
      render in interface ViewportTool
      Parameters:
      gl - The OpenGL systems context.
    • setViewport

      public void setViewport(Viewport viewport)
      Specified by:
      setViewport in interface ViewportTool
    • isInUse

      public boolean isInUse()
      Description copied from interface: ViewportTool
      Returns true if the tool is active (was clicked correctly and could be dragged)
      Specified by:
      isInUse in interface ViewportTool
      Returns:
      true if the tool is active (was clicked correctly and could be dragged)
    • cancelUse

      public void cancelUse()
      Description copied from interface: ViewportTool
      Force cancel the tool. useful if two viewporttools are activated at once.
      Specified by:
      cancelUse in interface ViewportTool
    • getStartPoint

      public javax.vecmath.Point3d getStartPoint()
      Description copied from interface: ViewportTool
      Returns the point on the tool clicked by the user. This is used to determine which tool is closer to the user.
      Specified by:
      getStartPoint in interface ViewportTool
      Returns:
      the point on the tool clicked by the user.
    • setRotation

      public void setRotation(int i)
    • setFrameOfReference

      public void setFrameOfReference(FrameOfReference index)
      Sets the frame of reference for the tool.
      Specified by:
      setFrameOfReference in interface ViewportTool
      Parameters:
      index - 0 for world, 1 for local, 2 for camera.
    • init

      public void init(com.jogamp.opengl.GL3 gl3)
      Description copied from interface: ViewportTool
      This is called when the OpenGL context is created. It should create any resources.
      Specified by:
      init in interface ViewportTool
      Parameters:
      gl3 - the OpenGL context.
    • dispose

      public void dispose(com.jogamp.opengl.GL3 gl3)
      Description copied from interface: ViewportTool
      This is called when the OpenGL context is destroyed. It should release any resources.
      Specified by:
      dispose in interface ViewportTool
      Parameters:
      gl3 - the OpenGL context.