Class SelectionTool
java.lang.Object
java.awt.event.MouseAdapter
com.marginallyclever.ro3.apps.viewport.viewporttool.SelectionTool
- All Implemented Interfaces:
ViewportTool,MouseListener,MouseMotionListener,MouseWheelListener,EventListener
A selection tool allows the user to click on the 3D view and change the current Registry.selection.
-
Field Summary
Fields -
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)voidrender(com.jogamp.opengl.GL3 gl, ShaderProgram shaderProgram) Renders any tool-specific visuals to the 3D scene.voidSets the frame of reference for the tool.voidsetViewport(Viewport viewport) voidupdate(double deltaTime) Updates the tool's internal state, if necessary.Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMovedMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.marginallyclever.ro3.apps.viewport.viewporttool.ViewportTool
mouseDragged, mouseMoved, mousePressed, mouseReleased
-
Field Details
-
PICK_POINT_NAME
- See Also:
-
-
Constructor Details
-
SelectionTool
public SelectionTool()
-
-
Method Details
-
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.
-
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
Handles 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) 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:
gl- The OpenGL context.
-
setViewport
- Specified by:
setViewportin interfaceViewportTool
-
isInUse
public boolean isInUse()Returns 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()Force cancel the tool. useful if two viewporttools are activated at once.- Specified by:
cancelUsein interfaceViewportTool
-
getStartPoint
public javax.vecmath.Point3d getStartPoint()Returns 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.
-
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.
-