Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Gui::CameraManipulator Class Referenceabstract

The CameraManipulator class is the generic class for camera manipulators. More...

#include <Gui/Viewer/CameraManipulator.hpp>

+ Inheritance diagram for Ra::Gui::CameraManipulator:
+ Collaboration diagram for Ra::Gui::CameraManipulator:

Public Slots

void mapCameraBehaviourToAabb (const Core::Aabb &aabb)
 Set the AABB to restrain the camera behavior against.
 
void unmapCameraBehaviourToAabb ()
 Free the camera from AABB restriction.
 
virtual void fitScene (const Core::Aabb &aabb)=0
 Setup the Camera according to the AABB of the scene to render.
 
virtual void setCameraPosition (const Core::Vector3 &position)=0
 Set the Camera position to position.
 
virtual void setCameraTarget (const Core::Vector3 &target)=0
 Set the Camera target to target.
 
virtual void resetCamera ()=0
 Reset the Camera settings to default values.
 
Camera properties setters
void setCameraSensitivity (Scalar sensitivity)
 
void setCameraFov (Scalar fov)
 
void setCameraFovInDegrees (Scalar fov)
 
void setCameraZNear (Scalar zNear)
 
void setCameraZFar (Scalar zFar)
 

Public Member Functions

 CameraManipulator ()
 Initializes a manipulator for a given viewport size.
 
 CameraManipulator (const CameraManipulator &other)
 
virtual ~CameraManipulator ()
 
virtual KeyMappingManager::Context mappingContext ()
 
virtual bool handleMousePressEvent (QMouseEvent *event, const Qt::MouseButtons &buttons, const Qt::KeyboardModifiers &modifiers, int key)
 
virtual bool handleMouseReleaseEvent (QMouseEvent *event)
 
virtual bool handleMouseMoveEvent (QMouseEvent *event, const Qt::MouseButtons &buttons, const Qt::KeyboardModifiers &modifiers, int key)
 
virtual bool handleWheelEvent (QWheelEvent *event, const Qt::MouseButtons &buttons, const Qt::KeyboardModifiers &modifiers, int key)
 
virtual bool handleKeyPressEvent (QKeyEvent *event, const KeyMappingManager::KeyMappingAction &action)
 
virtual bool handleKeyReleaseEvent (QKeyEvent *event, const KeyMappingManager::KeyMappingAction &action)
 
const Core::Asset::CameragetCamera () const
 Pointer access to the camera.
 
Core::Asset::CameragetCamera ()
 Pointer access to the camera.
 
virtual void updateCamera ()
 
void attachLight (Engine::Scene::Light *light)
 
bool hasLightAttached () const
 
Engine::Scene::LightgetLight ()
 pointer acces to the attached light if it exists, returns nullptr otherwise.
 

Protected Member Functions

std::pair< Scalar, Scalar > computeDeltaMouseMove (const QMouseEvent *mouseEvent)
 

Protected Attributes

Scalar m_lastMouseX { 0_ra }
 x-position of the mouse on the screen at the manipulation start.
 
Scalar m_lastMouseY { 0_ra }
 y-position of the mouse on the screen at the manipulation start.
 
Scalar m_cameraSensitivity { 1_ra }
 the Camera sensitivity to manipulation.
 
Scalar m_quickCameraModifier { 1_ra }
 Additional factor for camera sensitivity.
 
Scalar m_wheelSpeedModifier { 0.02_ra }
 Speed modifier on mouse wheel events.
 
Core::Aabb m_targetedAabb
 Camera behavior restriction AABB.
 
Scalar m_targetedAabbVolume { 0_ra }
 Volume of the m_targetedAabb.
 
bool m_mapCameraBahaviourToAabb { false }
 whether the camera is restrained or not
 
Core::Vector3 m_target { 0_ra, 0_ra, 0_ra }
 
Core::Asset::Cameram_camera { nullptr }
 The Camera.
 
Engine::Scene::Lightm_light { nullptr }
 The light attached to the Camera.
 

Detailed Description

The CameraManipulator class is the generic class for camera manipulators.

Definition at line 29 of file CameraManipulator.hpp.

Constructor & Destructor Documentation

◆ CameraManipulator() [1/2]

Ra::Gui::CameraManipulator::CameraManipulator ( )

Initializes a manipulator for a given viewport size.

Definition at line 25 of file CameraManipulator.cpp.

◆ CameraManipulator() [2/2]

Ra::Gui::CameraManipulator::CameraManipulator ( const CameraManipulator & other)
explicit

Initializes a manipulator keeping properties from an already existing one. This allows to switch from one manipulator to another while keeping the same visual experience.

Definition at line 14 of file CameraManipulator.cpp.

◆ ~CameraManipulator()

Ra::Gui::CameraManipulator::~CameraManipulator ( )
virtual

Destructor. As a Manipulator does not have ownership over the associated Camera, do not release the associated Camera.

Definition at line 32 of file CameraManipulator.cpp.

Member Function Documentation

◆ attachLight()

void Ra::Gui::CameraManipulator::attachLight ( Engine::Scene::Light * light)

Set the Light attached to the camera.

Note
CameraManipulator doesn't have ownership.

Definition at line 66 of file CameraManipulator.cpp.

+ Here is the call graph for this function:

◆ computeDeltaMouseMove()

std::pair< Scalar, Scalar > Ra::Gui::CameraManipulator::computeDeltaMouseMove ( const QMouseEvent * mouseEvent)
inlineprotected

Definition at line 126 of file CameraManipulator.hpp.

◆ getCamera() [1/2]

Core::Asset::Camera * Ra::Gui::CameraManipulator::getCamera ( )
inline

Pointer access to the camera.

Definition at line 79 of file CameraManipulator.hpp.

◆ getCamera() [2/2]

const Core::Asset::Camera * Ra::Gui::CameraManipulator::getCamera ( ) const
inline

Pointer access to the camera.

Definition at line 76 of file CameraManipulator.hpp.

◆ getLight()

Engine::Scene::Light * Ra::Gui::CameraManipulator::getLight ( )
inline

pointer acces to the attached light if it exists, returns nullptr otherwise.

Definition at line 93 of file CameraManipulator.hpp.

◆ handleKeyPressEvent()

bool Ra::Gui::CameraManipulator::handleKeyPressEvent ( QKeyEvent * event,
const KeyMappingManager::KeyMappingAction & action )
virtual
Returns
true if the event has been taken into account, false otherwise

Reimplemented in Ra::Gui::FlightCameraManipulator, and Ra::Gui::TrackballCameraManipulator.

Definition at line 100 of file CameraManipulator.cpp.

◆ handleKeyReleaseEvent()

bool Ra::Gui::CameraManipulator::handleKeyReleaseEvent ( QKeyEvent * event,
const KeyMappingManager::KeyMappingAction & action )
virtual
Returns
true if the event has been taken into account, false otherwise

Definition at line 105 of file CameraManipulator.cpp.

◆ handleMouseMoveEvent()

bool Ra::Gui::CameraManipulator::handleMouseMoveEvent ( QMouseEvent * event,
const Qt::MouseButtons & buttons,
const Qt::KeyboardModifiers & modifiers,
int key )
virtual
Returns
true if the event has been taken into account, false otherwise

Reimplemented in Ra::Gui::FlightCameraManipulator, and Ra::Gui::TrackballCameraManipulator.

Definition at line 86 of file CameraManipulator.cpp.

◆ handleMousePressEvent()

bool Ra::Gui::CameraManipulator::handleMousePressEvent ( QMouseEvent * event,
const Qt::MouseButtons & buttons,
const Qt::KeyboardModifiers & modifiers,
int key )
virtual
Returns
true if the event has been taken into account, false otherwise

Reimplemented in Ra::Gui::FlightCameraManipulator, and Ra::Gui::TrackballCameraManipulator.

Definition at line 75 of file CameraManipulator.cpp.

◆ handleMouseReleaseEvent()

bool Ra::Gui::CameraManipulator::handleMouseReleaseEvent ( QMouseEvent * event)
virtual
Returns
true if the event has been taken into account, false otherwise

Reimplemented in Ra::Gui::FlightCameraManipulator, and Ra::Gui::TrackballCameraManipulator.

Definition at line 82 of file CameraManipulator.cpp.

◆ handleWheelEvent()

bool Ra::Gui::CameraManipulator::handleWheelEvent ( QWheelEvent * event,
const Qt::MouseButtons & buttons,
const Qt::KeyboardModifiers & modifiers,
int key )
virtual
Returns
true if the event has been taken into account, false otherwise

Reimplemented in Ra::Gui::FlightCameraManipulator, and Ra::Gui::TrackballCameraManipulator.

Definition at line 93 of file CameraManipulator.cpp.

◆ hasLightAttached()

bool Ra::Gui::CameraManipulator::hasLightAttached ( ) const
inline
Returns
true if a Light is attached to the camera, false otherwise.

Definition at line 90 of file CameraManipulator.hpp.

◆ mapCameraBehaviourToAabb

void Ra::Gui::CameraManipulator::mapCameraBehaviourToAabb ( const Core::Aabb & aabb)
slot

Set the AABB to restrain the camera behavior against.

Definition at line 56 of file CameraManipulator.cpp.

◆ mappingContext()

KeyMappingManager::Context Ra::Gui::Gui::CameraManipulator::mappingContext ( )
virtual
Returns
the mapping context for keymapping, Index::Invalid() if no mapping is available

Reimplemented in Ra::Gui::FlightCameraManipulator, and Ra::Gui::TrackballCameraManipulator.

Definition at line 71 of file CameraManipulator.cpp.

◆ setCameraFov

void Ra::Gui::CameraManipulator::setCameraFov ( Scalar fov)
slot

Definition at line 38 of file CameraManipulator.cpp.

◆ setCameraFovInDegrees

void Ra::Gui::CameraManipulator::setCameraFovInDegrees ( Scalar fov)
slot

Definition at line 42 of file CameraManipulator.cpp.

◆ setCameraSensitivity

void Ra::Gui::CameraManipulator::setCameraSensitivity ( Scalar sensitivity)
slot

Definition at line 34 of file CameraManipulator.cpp.

◆ setCameraZFar

void Ra::Gui::CameraManipulator::setCameraZFar ( Scalar zFar)
slot

Definition at line 50 of file CameraManipulator.cpp.

◆ setCameraZNear

void Ra::Gui::CameraManipulator::setCameraZNear ( Scalar zNear)
slot

Definition at line 46 of file CameraManipulator.cpp.

◆ unmapCameraBehaviourToAabb

void Ra::Gui::CameraManipulator::unmapCameraBehaviourToAabb ( )
slot

Free the camera from AABB restriction.

Definition at line 62 of file CameraManipulator.cpp.

◆ updateCamera()

void Ra::Gui::CameraManipulator::updateCamera ( )
virtual

Reset manipulator internal data according to current active camera from manager. Call each time the active camera is changed to have coherent data.

Reimplemented in Ra::Gui::FlightCameraManipulator, and Ra::Gui::TrackballCameraManipulator.

Definition at line 54 of file CameraManipulator.cpp.

Member Data Documentation

◆ m_camera

Core::Asset::Camera* Ra::Gui::CameraManipulator::m_camera { nullptr }
protected

The Camera.

Definition at line 153 of file CameraManipulator.hpp.

◆ m_cameraSensitivity

Scalar Ra::Gui::CameraManipulator::m_cameraSensitivity { 1_ra }
protected

the Camera sensitivity to manipulation.

Definition at line 138 of file CameraManipulator.hpp.

◆ m_lastMouseX

Scalar Ra::Gui::CameraManipulator::m_lastMouseX { 0_ra }
protected

x-position of the mouse on the screen at the manipulation start.

Definition at line 132 of file CameraManipulator.hpp.

◆ m_lastMouseY

Scalar Ra::Gui::CameraManipulator::m_lastMouseY { 0_ra }
protected

y-position of the mouse on the screen at the manipulation start.

Definition at line 135 of file CameraManipulator.hpp.

◆ m_light

Engine::Scene::Light* Ra::Gui::CameraManipulator::m_light { nullptr }
protected

The light attached to the Camera.

Definition at line 154 of file CameraManipulator.hpp.

◆ m_mapCameraBahaviourToAabb

bool Ra::Gui::CameraManipulator::m_mapCameraBahaviourToAabb { false }
protected

whether the camera is restrained or not

Definition at line 146 of file CameraManipulator.hpp.

◆ m_quickCameraModifier

Scalar Ra::Gui::CameraManipulator::m_quickCameraModifier { 1_ra }
protected

Additional factor for camera sensitivity.

Definition at line 140 of file CameraManipulator.hpp.

◆ m_target

Core::Vector3 Ra::Gui::CameraManipulator::m_target { 0_ra, 0_ra, 0_ra }
protected

Target point of the camera (usefull for most of the manipulator metaphor) Be aware that m_target must always be on the line of sight of the camera so that it could be used as a "focus" point by a manipulator.

Definition at line 151 of file CameraManipulator.hpp.

◆ m_targetedAabb

Core::Aabb Ra::Gui::CameraManipulator::m_targetedAabb
protected

Camera behavior restriction AABB.

Definition at line 144 of file CameraManipulator.hpp.

◆ m_targetedAabbVolume

Scalar Ra::Gui::CameraManipulator::m_targetedAabbVolume { 0_ra }
protected

Volume of the m_targetedAabb.

Definition at line 145 of file CameraManipulator.hpp.

◆ m_wheelSpeedModifier

Scalar Ra::Gui::CameraManipulator::m_wheelSpeedModifier { 0.02_ra }
protected

Speed modifier on mouse wheel events.

Definition at line 142 of file CameraManipulator.hpp.


The documentation for this class was generated from the following files: