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:

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.

Subclassed by CameraInputHandlerWalk, CameraInputHandlerZoom

Public Types

enum NavigationType

Navigation types.

Values:

enumerator NONE

No navigation.

enumerator PAN

Pan. Move the model in the screen plane.

enumerator WALK

Walk. Move the camera position (eye) forward or backward in the view direction.

enumerator ZOOM

Adjust the Field of view (perspective projection) or frustum height (orthographic projection) to resize the model.

enumerator ROTATE

Rotate the model around the current rotation point.

enumerator ROLL

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.

Vec3d rotationPoint() const

Returns the current rotation point.

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.

NavigationType activeNavigation() const

Returns the active navigation type.

void startNavigation(NavigationType navigationType, int x, int y)

Starts navigation with the given type and x,y position.

Note! This method is only used for more advanced navigation customization.

bool updateNavigation(int x, int y)

Updates the current navigation based on the x,y coordinate.

Note! This method is only used for more advanced navigation customization.

void endNavigation()

Ends the current navigation.

Note! This method is only used for more advanced navigation customization.

virtual NavigationType navigationTypeFromInputState(MouseButtons mouseButtons, KeyboardModifiers keyboardModifiers) const = 0

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.