Module com.marginallyclever.ro3
Class RotateToolOneAxis
java.lang.Object
com.marginallyclever.ro3.apps.viewport.viewporttool.move.RotateToolOneAxis
- All Implemented Interfaces:
ViewportTool
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(SelectedItems list) This method is called when the tool is activated.voidForce cancel the tool.voidThis method is called when the tool is deactivated.voiddrawPivotPoint(com.jogamp.opengl.GL3 gl, ShaderProgram shaderProgram) voidgetComponents(List<JPanel> list) Build a Swing Component that represents this Tool.javax.vecmath.Point3dReturns the point on the tool clicked by the user.voidhandleMouseEvent(MouseEvent event) Handles mouse input events for the tool.booleanisInUse()Returns true if the tool is active (was clicked correctly and could be dragged)voidmouseDragged(MouseEvent event) called when the mouse is dragged after a successful mousePressed event.voidmouseMoved(MouseEvent event) voidmousePressed(MouseEvent event) voidmouseReleased(MouseEvent event) voidrender(com.jogamp.opengl.GL3 gl3, ShaderProgram shaderProgram) Renders any tool-specific visuals to the 3D scene.static doubleroundToNearestSnap(double angleRadians, double snapRange, double nearest) voidsetDrawPivotPoint(boolean b) voidSets the frame of reference for the tool.voidsetPivotMatrix(javax.vecmath.Matrix4d pivot) voidsetViewport(Viewport viewport) voidupdate(double deltaTime) Updates the tool's internal state, if necessary.
-
Constructor Details
-
RotateToolOneAxis
-
-
Method Details
-
setDrawPivotPoint
public void setDrawPivotPoint(boolean b) -
activate
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:
activatein interfaceViewportTool- 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:
deactivatein interfaceViewportTool
-
handleMouseEvent
Description copied from interface:ViewportToolHandles mouse input events for the tool.- Specified by:
handleMouseEventin interfaceViewportTool- Parameters:
event- The MouseEvent object representing the input event.
-
mouseMoved
- Specified by:
mouseMovedin interfaceViewportTool
-
mousePressed
- Specified by:
mousePressedin interfaceViewportTool
-
mouseDragged
called when the mouse is dragged after a successful mousePressed event. pivotMatrix is already set to the frame of reference such that pivotMatrix Z axis is the axis aroun which we want to rotate- Specified by:
mouseDraggedin interfaceViewportTool- Parameters:
event- the mouse event
-
roundToNearestSnap
public static double roundToNearestSnap(double angleRadians, double snapRange, double nearest) -
mouseReleased
- Specified by:
mouseReleasedin interfaceViewportTool
-
update
public void update(double deltaTime) Updates the tool's internal state, if necessary.- Specified by:
updatein interfaceViewportTool- Parameters:
deltaTime- Time elapsed since the last update.
-
render
Renders any tool-specific visuals to the 3D scene.- Specified by:
renderin interfaceViewportTool- Parameters:
gl3- The OpenGL systems context.
-
drawPivotPoint
-
setViewport
- Specified by:
setViewportin interfaceViewportTool
-
isInUse
public boolean isInUse()Description copied from interface:ViewportToolReturns true if the tool is active (was clicked correctly and could be dragged)- Specified by:
isInUsein interfaceViewportTool- Returns:
- true if the tool is active (was clicked correctly and could be dragged)
-
cancelUse
public void cancelUse()Description copied from interface:ViewportToolForce cancel the tool. useful if two viewporttools are activated at once.- Specified by:
cancelUsein interfaceViewportTool
-
getStartPoint
public javax.vecmath.Point3d getStartPoint()Description copied from interface:ViewportToolReturns the point on the tool clicked by the user. This is used to determine which tool is closer to the user.- Specified by:
getStartPointin interfaceViewportTool- Returns:
- the point on the tool clicked by the user.
-
setFrameOfReference
Sets the frame of reference for the tool.- Specified by:
setFrameOfReferencein interfaceViewportTool- Parameters:
index- 0 for world, 1 for local, 2 for camera.
-
getComponents
Description copied from interface:ViewportToolBuild a Swing Component that represents this Tool.- Specified by:
getComponentsin interfaceViewportTool- Parameters:
list- the list to add components to.
-