VTK-m  2.0
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
vtkm::rendering::Camera Class Reference

#include <Camera.h>

Classes

struct  Camera2DStruct
 
struct  Camera3DStruct
 

Public Types

enum  Mode { Mode::TwoD, Mode::ThreeD }
 

Public Member Functions

VTKM_CONT Camera (Mode vtype=Camera::Mode::ThreeD)
 
vtkm::Matrix< vtkm::Float32, 4, 4 > CreateViewMatrix () const
 
vtkm::Matrix< vtkm::Float32, 4, 4 > CreateProjectionMatrix (vtkm::Id screenWidth, vtkm::Id screenHeight) const
 
void GetRealViewport (vtkm::Id screenWidth, vtkm::Id screenHeight, vtkm::Float32 &left, vtkm::Float32 &right, vtkm::Float32 &bottom, vtkm::Float32 &top) const
 
VTKM_CONT vtkm::rendering::Camera::Mode GetMode () const
 The mode of the camera (2D or 3D). More...
 
VTKM_CONT void SetMode (vtkm::rendering::Camera::Mode mode)
 
VTKM_CONT void SetModeTo3D ()
 
VTKM_CONT void SetModeTo2D ()
 
VTKM_CONT vtkm::Range GetClippingRange () const
 The clipping range of the camera. More...
 
VTKM_CONT void SetClippingRange (vtkm::Float32 nearPlane, vtkm::Float32 farPlane)
 
VTKM_CONT void SetClippingRange (vtkm::Float64 nearPlane, vtkm::Float64 farPlane)
 
VTKM_CONT void SetClippingRange (const vtkm::Range &nearFarRange)
 
VTKM_CONT void GetViewport (vtkm::Float32 &left, vtkm::Float32 &right, vtkm::Float32 &bottom, vtkm::Float32 &top) const
 The viewport of the projection. More...
 
VTKM_CONT void GetViewport (vtkm::Float64 &left, vtkm::Float64 &right, vtkm::Float64 &bottom, vtkm::Float64 &top) const
 
VTKM_CONT vtkm::Bounds GetViewport () const
 
VTKM_CONT void SetViewport (vtkm::Float32 left, vtkm::Float32 right, vtkm::Float32 bottom, vtkm::Float32 top)
 
VTKM_CONT void SetViewport (vtkm::Float64 left, vtkm::Float64 right, vtkm::Float64 bottom, vtkm::Float64 top)
 
VTKM_CONT void SetViewport (const vtkm::Bounds &viewportBounds)
 
const VTKM_CONT vtkm::Vec3f_32GetLookAt () const
 The focal point the camera is looking at in 3D mode. More...
 
VTKM_CONT void SetLookAt (const vtkm::Vec3f_32 &lookAt)
 
VTKM_CONT void SetLookAt (const vtkm::Vec< Float64, 3 > &lookAt)
 
const VTKM_CONT vtkm::Vec3f_32GetPosition () const
 The spatial position of the camera in 3D mode. More...
 
VTKM_CONT void SetPosition (const vtkm::Vec3f_32 &position)
 
VTKM_CONT void SetPosition (const vtkm::Vec3f_64 &position)
 
const VTKM_CONT vtkm::Vec3f_32GetViewUp () const
 The up orientation of the camera in 3D mode. More...
 
VTKM_CONT void SetViewUp (const vtkm::Vec3f_32 &viewUp)
 
VTKM_CONT void SetViewUp (const vtkm::Vec3f_64 &viewUp)
 
VTKM_CONT vtkm::Float32 GetXScale () const
 The xscale of the camera. More...
 
VTKM_CONT void SetXScale (vtkm::Float32 xscale)
 
VTKM_CONT void SetXScale (vtkm::Float64 xscale)
 
VTKM_CONT vtkm::Float32 GetFieldOfView () const
 The field of view angle. More...
 
VTKM_CONT void SetFieldOfView (vtkm::Float32 fov)
 
VTKM_CONT void SetFieldOfView (vtkm::Float64 fov)
 
void Pan (vtkm::Float32 dx, vtkm::Float32 dy)
 Pans the camera. More...
 
VTKM_CONT void Pan (vtkm::Float64 dx, vtkm::Float64 dy)
 Pans the camera. More...
 
VTKM_CONT void Pan (vtkm::Vec2f_32 direction)
 
VTKM_CONT void Pan (vtkm::Vec2f_64 direction)
 
VTKM_CONT vtkm::Vec2f_32 GetPan () const
 
void Zoom (vtkm::Float32 zoom)
 Zooms the camera in or out. More...
 
VTKM_CONT void Zoom (vtkm::Float64 zoom)
 
VTKM_CONT vtkm::Float32 GetZoom () const
 
void TrackballRotate (vtkm::Float32 startX, vtkm::Float32 startY, vtkm::Float32 endX, vtkm::Float32 endY)
 Moves the camera as if a point was dragged along a sphere. More...
 
VTKM_CONT void TrackballRotate (vtkm::Float64 startX, vtkm::Float64 startY, vtkm::Float64 endX, vtkm::Float64 endY)
 
void ResetToBounds (const vtkm::Bounds &dataBounds)
 Set up the camera to look at geometry. More...
 
void ResetToBounds (const vtkm::Bounds &dataBounds, vtkm::Float64 dataViewPadding)
 Set up the camera to look at geometry with padding. More...
 
void ResetToBounds (const vtkm::Bounds &dataBounds, vtkm::Float64 XDataViewPadding, vtkm::Float64 YDataViewPadding, vtkm::Float64 ZDataViewPadding)
 
void Roll (vtkm::Float32 angleDegrees)
 Roll the camera. More...
 
VTKM_CONT void Roll (vtkm::Float64 angleDegrees)
 
void Azimuth (vtkm::Float32 angleDegrees)
 Rotate the camera about the view up vector centered at the focal point. More...
 
VTKM_CONT void Azimuth (vtkm::Float64 angleDegrees)
 
void Elevation (vtkm::Float32 angleDegrees)
 Rotate the camera vertically around the focal point. More...
 
VTKM_CONT void Elevation (vtkm::Float64 angleDegrees)
 
void Dolly (vtkm::Float32 value)
 Move the camera toward or away from the focal point. More...
 
VTKM_CONT void Dolly (vtkm::Float64 value)
 
VTKM_CONT void GetViewRange2D (vtkm::Float32 &left, vtkm::Float32 &right, vtkm::Float32 &bottom, vtkm::Float32 &top) const
 The viewable region in the x-y plane. More...
 
VTKM_CONT vtkm::Bounds GetViewRange2D () const
 
VTKM_CONT void SetViewRange2D (vtkm::Float32 left, vtkm::Float32 right, vtkm::Float32 bottom, vtkm::Float32 top)
 
VTKM_CONT void SetViewRange2D (vtkm::Float64 left, vtkm::Float64 right, vtkm::Float64 bottom, vtkm::Float64 top)
 
VTKM_CONT void SetViewRange2D (const vtkm::Range &xRange, const vtkm::Range &yRange)
 
VTKM_CONT void SetViewRange2D (const vtkm::Bounds &viewRange)
 
VTKM_CONT void Print () const
 

Private Attributes

Mode ModeType
 
Camera3DStruct Camera3D
 
Camera2DStruct Camera2D
 
vtkm::Float32 NearPlane
 
vtkm::Float32 FarPlane
 
vtkm::Float32 ViewportLeft
 
vtkm::Float32 ViewportRight
 
vtkm::Float32 ViewportBottom
 
vtkm::Float32 ViewportTop
 

Member Enumeration Documentation

◆ Mode

Enumerator
TwoD 
ThreeD 

Constructor & Destructor Documentation

◆ Camera()

VTKM_CONT vtkm::rendering::Camera::Camera ( Mode  vtype = Camera::Mode::ThreeD)
inline

Member Function Documentation

◆ Azimuth() [1/2]

void vtkm::rendering::Camera::Azimuth ( vtkm::Float32  angleDegrees)

Rotate the camera about the view up vector centered at the focal point.

Note that the view up vector is whatever was set via SetViewUp, and is not necessarily perpendicular to the direction of projection. The angle is given in degrees.

Azimuth only makes sense for 3D cameras, so the camera mode will be set to 3D when this method is called.

◆ Azimuth() [2/2]

VTKM_CONT void vtkm::rendering::Camera::Azimuth ( vtkm::Float64  angleDegrees)
inline

◆ CreateProjectionMatrix()

vtkm::Matrix<vtkm::Float32, 4, 4> vtkm::rendering::Camera::CreateProjectionMatrix ( vtkm::Id  screenWidth,
vtkm::Id  screenHeight 
) const

◆ CreateViewMatrix()

vtkm::Matrix<vtkm::Float32, 4, 4> vtkm::rendering::Camera::CreateViewMatrix ( ) const

◆ Dolly() [1/2]

void vtkm::rendering::Camera::Dolly ( vtkm::Float32  value)

Move the camera toward or away from the focal point.

Specifically, this divides the camera's distance from the focal point (LookAt) by the given value. Use a value greater than one to dolly in toward the focal point, and use a value less than one to dolly-out away from the focal point.

Dolly only makes sense for 3D cameras, so the camera mode will be set to 3D when this method is called.

◆ Dolly() [2/2]

VTKM_CONT void vtkm::rendering::Camera::Dolly ( vtkm::Float64  value)
inline

◆ Elevation() [1/2]

void vtkm::rendering::Camera::Elevation ( vtkm::Float32  angleDegrees)

Rotate the camera vertically around the focal point.

Specifically, this rotates the camera about the cross product of the negative of the direction of projection and the view up vector, using the focal point (LookAt) as the center of rotation. The angle is given in degrees.

Elevation only makes sense for 3D cameras, so the camera mode will be set to 3D when this method is called.

◆ Elevation() [2/2]

VTKM_CONT void vtkm::rendering::Camera::Elevation ( vtkm::Float64  angleDegrees)
inline

◆ GetClippingRange()

VTKM_CONT vtkm::Range vtkm::rendering::Camera::GetClippingRange ( ) const
inline

The clipping range of the camera.

The clipping range establishes the near and far clipping planes. These clipping planes are parallel to the viewing plane. The planes are defined by simply specifying the distance from the viewpoint. Renderers can (and usually do) remove any geometry closer than the near plane and further than the far plane.

For precision purposes, it is best to place the near plane as far away as possible (while still being in front of any geometry). The far plane usually has less effect on the depth precision, so can be placed well far behind the geometry.

◆ GetFieldOfView()

VTKM_CONT vtkm::Float32 vtkm::rendering::Camera::GetFieldOfView ( ) const
inline

The field of view angle.

The field of view defines the angle (in degrees) that are visible from the camera position.

Setting the field of view changes the mode to 3D.

◆ GetLookAt()

const VTKM_CONT vtkm::Vec3f_32& vtkm::rendering::Camera::GetLookAt ( ) const
inline

The focal point the camera is looking at in 3D mode.

When in 3D mode, the camera is set up to be facing the LookAt position. If LookAt is set, the mode is changed to 3D mode.

◆ GetMode()

VTKM_CONT vtkm::rendering::Camera::Mode vtkm::rendering::Camera::GetMode ( ) const
inline

The mode of the camera (2D or 3D).

vtkm::Camera can be set to a 2D or 3D mode. 2D mode is used for looking at data in the x-y plane. 3D mode allows the camera to be positioned anywhere and pointing at any place in 3D.

◆ GetPan()

VTKM_CONT vtkm::Vec2f_32 vtkm::rendering::Camera::GetPan ( ) const
inline

◆ GetPosition()

const VTKM_CONT vtkm::Vec3f_32& vtkm::rendering::Camera::GetPosition ( ) const
inline

The spatial position of the camera in 3D mode.

When in 3D mode, the camera is modeled to be at a particular location. If Position is set, the mode is changed to 3D mode.

◆ GetRealViewport()

void vtkm::rendering::Camera::GetRealViewport ( vtkm::Id  screenWidth,
vtkm::Id  screenHeight,
vtkm::Float32 left,
vtkm::Float32 right,
vtkm::Float32 bottom,
vtkm::Float32 top 
) const

◆ GetViewport() [1/3]

VTKM_CONT vtkm::Bounds vtkm::rendering::Camera::GetViewport ( ) const
inline

◆ GetViewport() [2/3]

VTKM_CONT void vtkm::rendering::Camera::GetViewport ( vtkm::Float32 left,
vtkm::Float32 right,
vtkm::Float32 bottom,
vtkm::Float32 top 
) const
inline

The viewport of the projection.

The projection of the camera can be offset to be centered around a subset of the rendered image. This is established with a "viewport," which is defined by the left/right and bottom/top of this viewport. The values of the viewport are relative to the rendered image's bounds. The left and bottom of the image are at -1 and the right and top are at 1.

◆ GetViewport() [3/3]

VTKM_CONT void vtkm::rendering::Camera::GetViewport ( vtkm::Float64 left,
vtkm::Float64 right,
vtkm::Float64 bottom,
vtkm::Float64 top 
) const
inline

◆ GetViewRange2D() [1/2]

VTKM_CONT vtkm::Bounds vtkm::rendering::Camera::GetViewRange2D ( ) const
inline

◆ GetViewRange2D() [2/2]

VTKM_CONT void vtkm::rendering::Camera::GetViewRange2D ( vtkm::Float32 left,
vtkm::Float32 right,
vtkm::Float32 bottom,
vtkm::Float32 top 
) const
inline

The viewable region in the x-y plane.

When the camera is in 2D, it is looking at some region of the x-y plane. The region being looked at is defined by the range in x (determined by the left and right sides) and by the range in y (determined by the bottom and top sides).

SetViewRange2D changes the camera mode to 2D.

◆ GetViewUp()

const VTKM_CONT vtkm::Vec3f_32& vtkm::rendering::Camera::GetViewUp ( ) const
inline

The up orientation of the camera in 3D mode.

When in 3D mode, the camera is modeled to be at a particular location and looking at a particular spot. The view up vector orients the rotation of the image so that the top of the image is in the direction pointed to by view up. If ViewUp is set, the mode is changed to 3D mode.

◆ GetXScale()

VTKM_CONT vtkm::Float32 vtkm::rendering::Camera::GetXScale ( ) const
inline

The xscale of the camera.

The xscale forces the 2D curves to be full-frame

Setting the xscale changes the mode to 2D.

◆ GetZoom()

VTKM_CONT vtkm::Float32 vtkm::rendering::Camera::GetZoom ( ) const
inline

◆ Pan() [1/4]

void vtkm::rendering::Camera::Pan ( vtkm::Float32  dx,
vtkm::Float32  dy 
)

Pans the camera.

◆ Pan() [2/4]

VTKM_CONT void vtkm::rendering::Camera::Pan ( vtkm::Float64  dx,
vtkm::Float64  dy 
)
inline

Pans the camera.

◆ Pan() [3/4]

VTKM_CONT void vtkm::rendering::Camera::Pan ( vtkm::Vec2f_32  direction)
inline

◆ Pan() [4/4]

VTKM_CONT void vtkm::rendering::Camera::Pan ( vtkm::Vec2f_64  direction)
inline

◆ Print()

VTKM_CONT void vtkm::rendering::Camera::Print ( ) const

◆ ResetToBounds() [1/3]

void vtkm::rendering::Camera::ResetToBounds ( const vtkm::Bounds dataBounds)

Set up the camera to look at geometry.

ResetToBounds takes a Bounds structure containing the bounds in 3D space that contain the geometry being rendered. This method sets up the camera so that it is looking at this region in space. The view direction is preserved.

◆ ResetToBounds() [2/3]

void vtkm::rendering::Camera::ResetToBounds ( const vtkm::Bounds dataBounds,
vtkm::Float64  dataViewPadding 
)

Set up the camera to look at geometry with padding.

ResetToBounds takes a Bounds structure containing the bounds in 3D space that contain the geometry being rendered and a Float64 value representing the percent that a view should be padded in x, y, and z. This method sets up the camera so that it is looking at this region in

◆ ResetToBounds() [3/3]

void vtkm::rendering::Camera::ResetToBounds ( const vtkm::Bounds dataBounds,
vtkm::Float64  XDataViewPadding,
vtkm::Float64  YDataViewPadding,
vtkm::Float64  ZDataViewPadding 
)

◆ Roll() [1/2]

void vtkm::rendering::Camera::Roll ( vtkm::Float32  angleDegrees)

Roll the camera.

Rotates the camera around the view direction by the given angle. The angle is given in degrees.

Roll is currently only supported for 3D cameras.

◆ Roll() [2/2]

VTKM_CONT void vtkm::rendering::Camera::Roll ( vtkm::Float64  angleDegrees)
inline

◆ SetClippingRange() [1/3]

VTKM_CONT void vtkm::rendering::Camera::SetClippingRange ( const vtkm::Range nearFarRange)
inline

◆ SetClippingRange() [2/3]

VTKM_CONT void vtkm::rendering::Camera::SetClippingRange ( vtkm::Float32  nearPlane,
vtkm::Float32  farPlane 
)
inline

◆ SetClippingRange() [3/3]

VTKM_CONT void vtkm::rendering::Camera::SetClippingRange ( vtkm::Float64  nearPlane,
vtkm::Float64  farPlane 
)
inline

◆ SetFieldOfView() [1/2]

VTKM_CONT void vtkm::rendering::Camera::SetFieldOfView ( vtkm::Float32  fov)
inline

◆ SetFieldOfView() [2/2]

VTKM_CONT void vtkm::rendering::Camera::SetFieldOfView ( vtkm::Float64  fov)
inline

◆ SetLookAt() [1/2]

VTKM_CONT void vtkm::rendering::Camera::SetLookAt ( const vtkm::Vec3f_32 lookAt)
inline

◆ SetLookAt() [2/2]

VTKM_CONT void vtkm::rendering::Camera::SetLookAt ( const vtkm::Vec< Float64, 3 > &  lookAt)
inline

◆ SetMode()

VTKM_CONT void vtkm::rendering::Camera::SetMode ( vtkm::rendering::Camera::Mode  mode)
inline

◆ SetModeTo2D()

VTKM_CONT void vtkm::rendering::Camera::SetModeTo2D ( )
inline

◆ SetModeTo3D()

VTKM_CONT void vtkm::rendering::Camera::SetModeTo3D ( )
inline

◆ SetPosition() [1/2]

VTKM_CONT void vtkm::rendering::Camera::SetPosition ( const vtkm::Vec3f_32 position)
inline

◆ SetPosition() [2/2]

VTKM_CONT void vtkm::rendering::Camera::SetPosition ( const vtkm::Vec3f_64 position)
inline

◆ SetViewport() [1/3]

VTKM_CONT void vtkm::rendering::Camera::SetViewport ( const vtkm::Bounds viewportBounds)
inline

◆ SetViewport() [2/3]

VTKM_CONT void vtkm::rendering::Camera::SetViewport ( vtkm::Float32  left,
vtkm::Float32  right,
vtkm::Float32  bottom,
vtkm::Float32  top 
)
inline

◆ SetViewport() [3/3]

VTKM_CONT void vtkm::rendering::Camera::SetViewport ( vtkm::Float64  left,
vtkm::Float64  right,
vtkm::Float64  bottom,
vtkm::Float64  top 
)
inline

◆ SetViewRange2D() [1/4]

VTKM_CONT void vtkm::rendering::Camera::SetViewRange2D ( const vtkm::Bounds viewRange)
inline

◆ SetViewRange2D() [2/4]

VTKM_CONT void vtkm::rendering::Camera::SetViewRange2D ( const vtkm::Range xRange,
const vtkm::Range yRange 
)
inline

◆ SetViewRange2D() [3/4]

VTKM_CONT void vtkm::rendering::Camera::SetViewRange2D ( vtkm::Float32  left,
vtkm::Float32  right,
vtkm::Float32  bottom,
vtkm::Float32  top 
)
inline

◆ SetViewRange2D() [4/4]

VTKM_CONT void vtkm::rendering::Camera::SetViewRange2D ( vtkm::Float64  left,
vtkm::Float64  right,
vtkm::Float64  bottom,
vtkm::Float64  top 
)
inline

◆ SetViewUp() [1/2]

VTKM_CONT void vtkm::rendering::Camera::SetViewUp ( const vtkm::Vec3f_32 viewUp)
inline

◆ SetViewUp() [2/2]

VTKM_CONT void vtkm::rendering::Camera::SetViewUp ( const vtkm::Vec3f_64 viewUp)
inline

◆ SetXScale() [1/2]

VTKM_CONT void vtkm::rendering::Camera::SetXScale ( vtkm::Float32  xscale)
inline

◆ SetXScale() [2/2]

VTKM_CONT void vtkm::rendering::Camera::SetXScale ( vtkm::Float64  xscale)
inline

◆ TrackballRotate() [1/2]

void vtkm::rendering::Camera::TrackballRotate ( vtkm::Float32  startX,
vtkm::Float32  startY,
vtkm::Float32  endX,
vtkm::Float32  endY 
)

Moves the camera as if a point was dragged along a sphere.

TrackballRotate takes the normalized screen coordinates (in the range -1 to 1) and rotates the camera around the LookAt position. The rotation first projects the points to a sphere around the LookAt position. The camera is then rotated as if the start point was dragged to the end point along with the world.

TrackballRotate changes the mode to 3D.

◆ TrackballRotate() [2/2]

VTKM_CONT void vtkm::rendering::Camera::TrackballRotate ( vtkm::Float64  startX,
vtkm::Float64  startY,
vtkm::Float64  endX,
vtkm::Float64  endY 
)
inline

◆ Zoom() [1/2]

void vtkm::rendering::Camera::Zoom ( vtkm::Float32  zoom)

Zooms the camera in or out.

Zooming the camera scales everything in the image up or down. Positive zoom makes the geometry look bigger or closer. Negative zoom has the opposite effect. A zoom of 0 has no effect.

◆ Zoom() [2/2]

VTKM_CONT void vtkm::rendering::Camera::Zoom ( vtkm::Float64  zoom)
inline

Member Data Documentation

◆ Camera2D

Camera2DStruct vtkm::rendering::Camera::Camera2D
private

◆ Camera3D

Camera3DStruct vtkm::rendering::Camera::Camera3D
private

◆ FarPlane

vtkm::Float32 vtkm::rendering::Camera::FarPlane
private

◆ ModeType

Mode vtkm::rendering::Camera::ModeType
private

◆ NearPlane

vtkm::Float32 vtkm::rendering::Camera::NearPlane
private

◆ ViewportBottom

vtkm::Float32 vtkm::rendering::Camera::ViewportBottom
private

◆ ViewportLeft

vtkm::Float32 vtkm::rendering::Camera::ViewportLeft
private

◆ ViewportRight

vtkm::Float32 vtkm::rendering::Camera::ViewportRight
private

◆ ViewportTop

vtkm::Float32 vtkm::rendering::Camera::ViewportTop
private

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