cee::vis::CameraInputHandler
-
class CameraInputHandler : public RefCountedObject
Class for manipulating a camera from input events (typically mouse interaction).
CameraInputHandler is the base class for camera manipulation classes. CEETRON Envision has two built in classes:
CameraInputHandlerZoom: Ceetron style zoom navigation. This is the default navigation handler.
CameraInputHandlerWalk: Ceetron style walk navigation.
The easiest way to add a custom navigation scheme is to derive from this class and override the navigationTypeFromInputState() method.
In more advanced cases the user can also override the mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent() and wheelEvent() methods and create a fully custom user experience.
See also
Subclassed by CameraInputHandlerWalk, CameraInputHandlerZoom
Public Types
Navigation types.
Values:
No navigation.
Pan. Move the model in the screen plane.
Walk. Move the camera position (eye) forward or backward in the view direction.
Adjust the Field of view (perspective projection) or frustum height (orthographic projection) to resize the model.
Rotate the model around the current rotation point.
Roll. Rotate the model around view direction.
Public Functions
-
CameraInputHandler()
Constructs a camera manipulation handler connected to the given camera.
-
virtual void mousePressEvent(MouseButton buttonPressed, const MouseEvent &mouseEvent)
Processes the mouse press event.
This is typically called from the viewer (platform dependent class derived from cee::vis::Viewer) based on mouse input.
-
virtual bool mouseMoveEvent(const MouseEvent &mouseEvent)
Processes the mouse move event.
Returns true if a redraw of the screen is needed.
This is typically called from the viewer (platform dependent class derived from cee::vis::Viewer) based on mouse input.
-
virtual void mouseReleaseEvent(MouseButton buttonReleased, const MouseEvent &mouseEvent)
Processes the mouse press event.
This is typically called from the viewer (platform dependent class derived from cee::vis::Viewer) based on mouse input.
-
virtual void wheelEvent(const WheelEvent &theWheelEvent)
Processes the mouse wheel event.
This is typically called from the viewer (platform dependent class derived from cee::vis::Viewer) based on mouse input.
-
virtual void wheelEvent(const WheelEvent &theWheelEvent, const cee::Vec3d &position)
Processes the mouse wheel event.
This is typically called from the viewer (platform dependent class derived from cee::vis::Viewer) based on mouse input.
Also offers a position position which are typically used to implement zoom to cursor. position is not handled on this base class. See derived classes.
-
virtual void setRotationPoint(const Vec3d &rotationPoint)
Sets the navigation rotation point to rotationPoint.
-
double rotationSensitivity() const
Returns the current rotation sensitivity.
-
void setRotationSensitivity(double sensitivity)
Sets the current rotation sensitivity.
-
double rollSensitivity() const
Returns the current roll sensitivity.
-
void setRollSensitivity(double sensitivity)
Sets the current roll sensitivity.
-
double walkSensitivity() const
Returns the current walk sensitivity.
-
void setWalkSensitivity(double sensitivity)
Sets the current walk sensitivity.
Returns the active navigation type.
Starts navigation with the given type and x,y position.
Note! This method is only used for more advanced navigation customization.
Updates the current navigation based on the x,y coordinate.
Note! This method is only used for more advanced navigation customization.
Ends the current navigation.
Note! This method is only used for more advanced navigation customization.
Returns the navigation type based on the state of the input event. Must be implemented in all derived classes.
-
virtual bool reverseZoom() const
Returns true in derived classes to reverse the zoom direction.
Protected Functions
Returns the navigation type to use for the mouse wheel. Base class returns NONE.
-
void setMinimumWalkTargetDistance(double distance)
Sets the minimum distance for the walk calculation with respect to the rotation point.
The walk navigation features a dynamic walk speed to make it possible to navigate large models The walk speed is reduced when we get closer to the rotation point, and this method specifies the minimum distance to use in the calculations.
This is useful if the navigation slows down too much when getting close to the rotation point.