VolViz
A volume visualization tool
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
VolViz::Camera Class Reference

#include <Camera.h>

+ Collaboration diagram for VolViz::Camera:

Public Member Functions

 Camera () noexcept
 
Private_::CameraClient client () const noexcept
 
DepthRange depthRange () const noexcept
 

Public Attributes

Property< Orientationorientation {Orientation::Identity()}
 The camera's orientation. More...
 
Property< PhysicalPositionposition
 
Property< AngleverticalFieldOfView {110 * degree_angle}
 Vertical field of view in rad. More...
 
Property< float > aspectRatio {4.f / 3.f}
 Aspect ratio (width / height) or horizontal FOV / vertical FOV. More...
 

Private Types

template<class T >
using Property = AtomicWrapper< T, SetAndNotifyPolicy >
 

Private Member Functions

Matrix4 projectionMatrix () const noexcept
 Returns the camera's projection matrix. More...
 
Matrix4 viewMatrix () const noexcept
 Returns the camera's view matrix, i.e. the inverse camera transform. More...
 
Matrix4 viewProjectionMatrix () const noexcept
 Returns the product of projectionMatrix() * viewMatrix(...) More...
 
Position unproject (Position2 const &screenPos, float depth, Length ambientScale) const noexcept
 

Private Attributes

AtomicCache< Matrix4cachedProjectionMatrix_
 Cached projection matrix. More...
 
AtomicCache< Matrix4cachedViewMatrix_
 Cached view Matrix. More...
 
AtomicCache< Matrix4cachedViewProjectionMatrix_
 Cached product viewMatrix * projectionMatrix. More...
 
AtomicCache< AnglecachedVerticalFOV_
 Cached vertical FOV. More...
 
Length cachedScale_
 Cached scale of last call to viewMatrix(...) More...
 

Friends

class Private_::CameraClient
 

Detailed Description

Basic camera class. The camera has a physical location, an orientation and a field of view. The field of view is specified as the horizontal FOV, the vertical FOV is computed from the apect radius.

Note
All properties are thread safe.

Member Typedef Documentation

template<class T >
using VolViz::Camera::Property = AtomicWrapper<T, SetAndNotifyPolicy>
private

Constructor & Destructor Documentation

VolViz::Camera::Camera ( )
noexcept

Member Function Documentation

Private_::CameraClient VolViz::Camera::client ( ) const
noexcept

Returns a client object that can be used to access cached projection and view matrices, as well as methods like unprojecting.

See Also
CameraClient
Note
The retunred CameraClient object can only be accesses by an VisualizerImpl instance to prevent race coditions.
DepthRange VolViz::Camera::depthRange ( ) const
inlinenoexcept

Returns the depth range of the camera projection, i.e. the depth value of the nearest possible value (near plane) and the value of the farest possible depth value (far plane),

Matrix4 VolViz::Camera::projectionMatrix ( ) const
privatenoexcept

Returns the camera's projection matrix.

Position VolViz::Camera::unproject ( Position2 const &  screenPos,
float  depth,
Length  ambientScale 
) const
privatenoexcept

Unprojects a point in screen coordinates with known depth into the 3D scene

Parameters
screenPosthe source point in screen coordinate system, i.e. (-1, -1) is the bottom left, (1, 1) is the top right
depththe depth of the pixel at screenPos
ambientScalethe physical length of one unit in the target 3D space
Matrix4 VolViz::Camera::viewMatrix ( ) const
privatenoexcept

Returns the camera's view matrix, i.e. the inverse camera transform.

Matrix4 VolViz::Camera::viewProjectionMatrix ( ) const
privatenoexcept

Returns the product of projectionMatrix() * viewMatrix(...)

Friends And Related Function Documentation

friend class Private_::CameraClient
friend

Member Data Documentation

Property<float> VolViz::Camera::aspectRatio {4.f / 3.f}

Aspect ratio (width / height) or horizontal FOV / vertical FOV.

AtomicCache<Matrix4> VolViz::Camera::cachedProjectionMatrix_
mutableprivate
Initial value:
{
[this]() { return projectionMatrix(); }}

Cached projection matrix.

Length VolViz::Camera::cachedScale_
mutableprivate

Cached scale of last call to viewMatrix(...)

AtomicCache<Angle> VolViz::Camera::cachedVerticalFOV_
mutableprivate
Initial value:
{
[this]() { return static_cast<Angle>(verticalFieldOfView); }}

Cached vertical FOV.

AtomicCache<Matrix4> VolViz::Camera::cachedViewMatrix_
mutableprivate
Initial value:
{
[this]() { return viewMatrix(); }}

Cached view Matrix.

AtomicCache<Matrix4> VolViz::Camera::cachedViewProjectionMatrix_
mutableprivate
Initial value:
{
[this]() { return viewProjectionMatrix(); }}

Cached product viewMatrix * projectionMatrix.

Property<Orientation> VolViz::Camera::orientation {Orientation::Identity()}

The camera's orientation.

Property<PhysicalPosition> VolViz::Camera::position
Initial value:
{
PhysicalPosition{0 * milli * meter, 0 * milli *meter, 0 * milli *meter}}

Position of the camera plane in space, i.e. the orientation of the camera projection plane's normal

Property<Angle> VolViz::Camera::verticalFieldOfView {110 * degree_angle}

Vertical field of view in rad.


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