# 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. HOOPS Envision has two built in classes:

  - CameraInputHandlerZoom: Envision style zoom navigation. This is the default navigation handler.
  - CameraInputHandlerWalk: Envision 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

  CameraInputHandlerZoom and CameraInputHandlerWalk

  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.

  Protected Functions

  virtual NavigationType `wheelNavigationType`() const

    Returns the navigation type to use for the mouse wheel. Base class returns NONE.

  Camera *`camera`()

    Returns the host camera.

  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.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Envision for Desktop or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...