Blobalizer
Loading...
Searching...
No Matches
ArcBallCamera Class Reference

Arcball camera implementation integrated into the SceneGraph. More...

#include <ArcBallCamera.h>

Inheritance diagram for ArcBallCamera:
ArcBall

Public Member Functions

template<class Transformation >
 ArcBallCamera (SceneGraph::Scene< Transformation > &scene, const Vector3 &cameraPosition, const Vector3 &viewCenter, const Vector3 &upDir, Deg fov, const Vector2i &windowSize, const Vector2i &viewportSize)
 Creates a new arc ball camera.
 
void reshape (const Vector2i &windowSize, const Vector2i &viewportSize)
 Update screen and viewport size after the window has been resized.
 
bool update ()
 Update the SceneGraph camera if arc ball has been changed.
 
void draw (SceneGraph::DrawableGroup3D &drawables)
 Draw objects using the internal scene graph camera.
 
SceneGraph::Camera3D & camera () const
 Accessor to the raw camera object.
 
- Public Member Functions inherited from ArcBall
 ArcBall (const Vector3 &cameraPosition, const Vector3 &viewCenter, const Vector3 &upDir, Deg fov, const Vector2i &windowSize)
 Constructs a new instance.
 
void setViewParameters (const Vector3 &eye, const Vector3 &viewCenter, const Vector3 &upDir)
 Set the camera view parameters: eye position, view center, up direction.
 
void reset ()
 Reset the camera to its initial position, view center, and up dir.
 
void reshape (const Vector2i &windowSize)
 Update screen size after the window has been resized.
 
bool updateTransformation ()
 Update any unfinished transformation due to lagging.
 
Float lagging () const
 Get the amount of lagging such that the camera will (slowly) smoothly navigate.
 
void setLagging (Float lagging)
 Set the amount of lagging such that the camera will (slowly) smoothly navigate. Lagging must be in [0, 1).
 
void initTransformation (const Vector2i &mousePos)
 Initialize the first (screen) mouse position for camera transformation. This should be called from the mouse pressed event.
 
void rotate (const Vector2i &mousePos)
 Rotate the camera from the previous (screen) mouse position to the current(screen) position.
 
void translate (const Vector2i &mousePos)
 Translate the camera from the previous (screen) mouse position to the current(screen) mouse position.
 
void translateDelta (const Vector2 &translationNDC)
 Translate the camera by the delta amount of (NDC) mouse position. Note that NDC position must be in[-1, -1] to[1, 1].
 
void zoom (Float delta)
 Zoom the camera.
 
Deg fov () const
 Field of view.
 
const DualQuaternion & view () const
 Get the camera's view transformation as a dual quaternion.
 
Matrix4 viewMatrix () const
 Get the camera's view transformation as a matrix.
 
Matrix4 inverseViewMatrix () const
 Get the camera's inverse view matrix (which also produces transformation of the camera)
 
const DualQuaternion & transformation () const
 Get the camera's transformation as a dual quaternion.
 
Matrix4 transformationMatrix () const
 Get the camera's transformation matrix.
 
Float viewDistance () const
 Return the distance from the camera position to the center view.
 

Private Attributes

SceneGraph::AbstractTranslationRotation3D * _cameraObject {}
 
SceneGraph::Camera3D * _camera {}
 

Additional Inherited Members

- Protected Member Functions inherited from ArcBall
void updateInternalTransformations ()
 Update the camera transformations-.
 
Vector2 screenCoordToNDC (const Vector2i &mousePos) const
 Transform from screen coordinate to NDC - normalized device coordinate. The top - left of the screen corresponds to[-1, 1] NDC, and the bottom right is[1, -1] NDC.
 
- Protected Attributes inherited from ArcBall
Deg _fov
 
Vector2i _windowSize
 
Vector2 _prevMousePosNDC
 
Float _lagging {}
 
Vector3 _targetPosition
 
Vector3 _currentPosition
 
Vector3 _positionT0
 
Quaternion _targetQRotation
 
Quaternion _currentQRotation
 
Quaternion _qRotationT0
 
Float _targetZooming
 
Float _currentZooming
 
Float _zoomingT0
 
DualQuaternion _view
 
DualQuaternion _inverseView
 

Detailed Description

Arcball camera implementation integrated into the SceneGraph.

Constructor & Destructor Documentation

◆ ArcBallCamera()

template<class Transformation >
ArcBallCamera::ArcBallCamera ( SceneGraph::Scene< Transformation > &  scene,
const Vector3 &  cameraPosition,
const Vector3 &  viewCenter,
const Vector3 &  upDir,
Deg  fov,
const Vector2i &  windowSize,
const Vector2i &  viewportSize 
)
inline

Creates a new arc ball camera.

Template Parameters
Transformationthe type of transformation that makes up the scene.
Parameters
scenethe scene to add this camera to.
cameraPositionthe position of the new camera.
viewCenterthe center of the arc ball that this camera looks at.
upDira vector represeting the upwards direction.
fovthe field of view.
windowSizethe current size of the output window.
viewportSizethe current size of the viewport.

Member Function Documentation

◆ camera()

SceneGraph::Camera3D & ArcBallCamera::camera ( ) const
inline

Accessor to the raw camera object.

Returns
the raw camera object

◆ draw()

void ArcBallCamera::draw ( SceneGraph::DrawableGroup3D &  drawables)
inline

Draw objects using the internal scene graph camera.

Parameters
drawablesa group of drawable to draw.

◆ reshape()

void ArcBallCamera::reshape ( const Vector2i &  windowSize,
const Vector2i &  viewportSize 
)
inline

Update screen and viewport size after the window has been resized.

Parameters
windowSizethe current size of the output window.
viewportSizethe current size of the viewport.

◆ update()

bool ArcBallCamera::update ( )
inline

Update the SceneGraph camera if arc ball has been changed.

Returns
whether the transformation has changed and this camera has moved.

Member Data Documentation

◆ _camera

SceneGraph::Camera3D* ArcBallCamera::_camera {}
private

◆ _cameraObject

SceneGraph::AbstractTranslationRotation3D* ArcBallCamera::_cameraObject {}
private

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