|
Physics Simulation & Visualization Tool 0.1
A C++ physics simulation engine with real-time 3D visualization
|
Abstract interface for objects that can be selected and interacted with using the mouse. More...
#include <IPickable.h>
Public Member Functions | |
| virtual | ~IPickable ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
| virtual std::optional< float > | intersectsRay (const Math::Ray &ray) const =0 |
| Tests if a ray intersects this object's geometry. | |
| virtual void | handleClick (const Math::Ray &ray, float distance)=0 |
| Handles a mouse click on this object. | |
| virtual void | setHovered (bool hovered)=0 |
| Sets the hover state of this object. | |
| virtual bool | getHovered () const =0 |
| Gets the current hover state of this object. | |
| virtual uint32_t | getObjectID () const =0 |
| Gets the unique identifier for this object. | |
Abstract interface for objects that can be selected and interacted with using the mouse.
This interface defines the contract for objects that support ray-based picking, hover states, and click handling. It is used by the scene manager to implement interactive object manipulation and selection.
The picking system uses CPU-based ray-object intersection tests, with some implementations delegating to GPU compute shaders for complex geometry.
Definition at line 28 of file IPickable.h.
|
virtualdefault |
Virtual destructor for proper cleanup of derived classes.
|
pure virtual |
Gets the current hover state of this object.
Implemented in Gizmo, and SceneObject.
|
pure virtual |
Gets the unique identifier for this object.
This ID is used to:
Implemented in Gizmo, and SceneObject.
|
pure virtual |
Handles a mouse click on this object.
Called by the scene manager when the user clicks on this object. Implementations can respond by:
| ray | The picking ray that intersected this object. |
| distance | The distance along the ray to the intersection point. |
Implemented in Gizmo, and SceneObject.
|
pure virtual |
Tests if a ray intersects this object's geometry.
Implementations should test the ray against the object's bounding volume or exact geometry and return the distance to the intersection point if hit.
| ray | The picking ray in world space coordinates. |
Example implementation:
Implemented in Gizmo, and SceneObject.
|
pure virtual |
Sets the hover state of this object.
Called by the scene manager when the mouse cursor enters or leaves this object. Implementations should update their internal state and may trigger visual feedback (e.g., highlighting).
The actual visual feedback is typically handled through the rendering system via uniform buffers (isHovered[objectID]).
| hovered | true if the mouse is hovering over this object, false otherwise. |
Implemented in Gizmo, and SceneObject.