Class Compass3D
java.lang.Object
com.marginallyclever.ro3.apps.viewport.viewporttool.Compass3D
- All Implemented Interfaces:
ViewportTool
Draw a compass to show the orientation of the camera. If the user clicks on the handles for the compasss, orbit the camera to face that world axis.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is called when the tool is activated.voidForce cancel the tool.voidThis method is called when the tool is deactivated.voiddispose(com.jogamp.opengl.GL3 gl3) This is called when the OpenGL context is destroyed.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.voidinit(com.jogamp.opengl.GL3 gl3) This is called when the OpenGL context is created.booleanisInUse()Returns true if the tool is active (was clicked correctly and could be dragged)voidmouseDragged(MouseEvent 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.voidSets the frame of reference for the tool.voidsetViewport(Viewport viewport) voidTurn the camera to face the direction of the handle under the cursor.voidupdate(double deltaTime) Updates the tool's internal state, if necessary.
-
Constructor Details
-
Compass3D
public Compass3D()
-
-
Method Details
-
activate
Description copied from interface:ViewportToolThis method is called when the tool is activated. It receives a list containing the selected nodes and their initial world poses.- Specified by:
activatein interfaceViewportTool- Parameters:
list- The selected items to be manipulated by the tool.
-
deactivate
public void deactivate()Description copied from interface:ViewportToolThis 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.
-
update
public void update(double deltaTime) Description copied from interface:ViewportToolUpdates the tool's internal state, if necessary.- Specified by:
updatein interfaceViewportTool- Parameters:
deltaTime- Time elapsed since the last update.
-
render
Description copied from interface:ViewportToolRenders any tool-specific visuals to the 3D scene.- Specified by:
renderin interfaceViewportTool- Parameters:
gl3- The OpenGL context.
-
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.
-
mouseMoved
- Specified by:
mouseMovedin interfaceViewportTool
-
mousePressed
- Specified by:
mousePressedin interfaceViewportTool
-
mouseDragged
- Specified by:
mouseDraggedin interfaceViewportTool
-
mouseReleased
- Specified by:
mouseReleasedin interfaceViewportTool
-
turnCameraAccordingToHandle
public void turnCameraAccordingToHandle()Turn the camera to face the direction of the handle under the cursor. -
setFrameOfReference
Description copied from interface:ViewportToolSets the frame of reference for the tool.- Specified by:
setFrameOfReferencein interfaceViewportTool- Parameters:
index- 0 for world, 1 for local, 2 for camera.
-
init
public void init(com.jogamp.opengl.GL3 gl3) Description copied from interface:ViewportToolThis is called when the OpenGL context is created. It should create any resources.- Specified by:
initin interfaceViewportTool- Parameters:
gl3- the OpenGL context.
-
dispose
public void dispose(com.jogamp.opengl.GL3 gl3) Description copied from interface:ViewportToolThis is called when the OpenGL context is destroyed. It should release any resources.- Specified by:
disposein interfaceViewportTool- Parameters:
gl3- the OpenGL context.
-
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.
-