Sceneview
 All Classes Functions Variables Enumerations Enumerator Groups Pages
Public Types | Public Member Functions | Friends | List of all members
sv::CameraNode Class Reference

Camera. More...

#include <sceneview/camera_node.hpp>

Inheritance diagram for sv::CameraNode:
sv::SceneNode

Public Types

enum  ProjectionType { kOrthographic, kPerspective, kManual }
 

Public Member Functions

SceneNodeType NodeType () const override
 Retrieve the node type.
 
void CopyFrom (const CameraNode &other)
 Copies parameters in from the specified camera. More...
 
void SetViewportSize (int width, int height)
 Sets the size of the viewport. More...
 
QSize GetViewportSize () const
 Retrieve the viewport size.
 
void SetPerspective (double vfov_deg, double z_near, double z_far)
 Sets perspective projection mode. More...
 
void SetOrthographic (double vfov_deg, double z_near, double z_far)
 Sets orthographic projection mode. More...
 
void SetManual (const QMatrix4x4 &proj_mat)
 Sets a manual projection matrix.
 
ProjectionType GetProjectionType () const
 Retrieve the current projection type.
 
void LookAt (const QVector3D &eye, const QVector3D &look_at, const QVector3D &up)
 Rotate and translate the camera to look at the specified point.
 
double GetVFovDeg () const
 Retrieve the vertical field of view, in degrees.
 
double GetZNear () const
 Retrieve the near clipping plane.
 
double GetZFar () const
 Retrieve the far clipping plane.
 
QVector3D GetLookDir () const
 Retrieve the direction the camera is facing. More...
 
QVector3D GetLookAt () const
 Retrieve the look at point.
 
QVector3D GetUpDir () const
 Retrieve the camera's up vector.
 
QVector3D Unproject (double x, double y)
 Computes a world-space direction corresponding to the specified screen-space pixel. More...
 
QMatrix4x4 GetProjectionMatrix ()
 Retrieve the camera projection matrix.
 
QMatrix4x4 GetViewMatrix ()
 Retrieve the camera view matrix. More...
 
QMatrix4x4 GetViewProjectionMatrix ()
 Gets the combined projection and view matrix. More...
 
const AxisAlignedBoxWorldBoundingBox () override
 Retrieve the world-space bounding box of the node and all of its children (if applicable). More...
 
void SetTranslation (const QVector3D &vec) override
 Sets the translation component of the node transform.
 
void SetRotation (const QQuaternion &quat) override
 Sets the rotation component of the node to parent transform.
 
- Public Member Functions inherited from sv::SceneNode
 SceneNode (const SceneNode &)=delete
 
SceneNodeoperator= (const SceneNode &)=delete
 
const QString Name () const
 Retrieve the node name.
 
const QVector3D & Translation () const
 Retrieve the translation component of the node to parent transform.
 
const QQuaternion & Rotation () const
 Retrieve the rotation component of the node to parent transform.
 
const QVector3D & Scale () const
 Retrieve the scale component of the node to parent transform.
 
const QMatrix4x4 & WorldTransform ()
 Retrieve the transform from node coordinates to world coordinates. More...
 
bool Visible () const
 Check if the node is visible or not.
 
void SetTranslation (double x, double y, double z)
 Sets the translation component of the node transform.
 
virtual void SetScale (const QVector3D &vec)
 Sets the scale component of the node to parent transform.
 
void SetScale (double x, double y, double z)
 Sets the scale component of the node to parent transform.
 
virtual void SetVisible (bool visible)
 Sets the node visibility. More...
 
GroupNodeParentNode ()
 Retrieve the parent of this node.
 
void SetParentNode (GroupNode *parent)
 Sets the node's parent. More...
 
void SetSelectionMask (int64_t mask)
 Sets the selection mask for this node. More...
 
int64_t GetSelectionMask () const
 Retrieve the selection mask for this node.
 

Friends

class Scene
 

Additional Inherited Members

- Protected Member Functions inherited from sv::SceneNode
 SceneNode (const QString &name)
 Constructs a scene node with an identity transform.
 
virtual void TransformChanged ()
 Internal method, used to enable lazy matrix computations. More...
 
virtual void BoundingBoxChanged ()
 Internal method, used to enable lazy bounding box computations. More...
 

Detailed Description

Camera.

Computes transforms between:

Member Function Documentation

void sv::CameraNode::CopyFrom ( const CameraNode other)

Copies parameters in from the specified camera.

Attributes copied in are:

  • extrinsics (eye, look, up vectors)
  • projection parameters (vfov, clipping planes, etc.)
  • viewport size
QVector3D sv::CameraNode::GetLookDir ( ) const

Retrieve the direction the camera is facing.

This is always of unit length.

QMatrix4x4 sv::CameraNode::GetViewMatrix ( )

Retrieve the camera view matrix.

The view matrix transforms from world Cartesian coordinates to camera-centric Cartesian coordinates.

QMatrix4x4 sv::CameraNode::GetViewProjectionMatrix ( )

Gets the combined projection and view matrix.

Equivalent to:

void sv::CameraNode::SetOrthographic ( double  vfov_deg,
double  z_near,
double  z_far 
)

Sets orthographic projection mode.

Parameters
vfov_degvertical field of view, in degrees. For orthographic projection, this is calculated at the look_at point.
z_nearnear clipping plane
z_varfar clipping plane
void sv::CameraNode::SetPerspective ( double  vfov_deg,
double  z_near,
double  z_far 
)

Sets perspective projection mode.

Parameters
vfov_degvertical field of view, in degrees.
z_nearnear clipping plane
z_varfar clipping plane
void sv::CameraNode::SetViewportSize ( int  width,
int  height 
)

Sets the size of the viewport.

You generally don't need to call this method. When a camera is attached to the viewport, the Viewport class automatically calls this method.

QVector3D sv::CameraNode::Unproject ( double  x,
double  y 
)

Computes a world-space direction corresponding to the specified screen-space pixel.

The resulting vector is guaranteed to be unit length.

const AxisAlignedBox& sv::CameraNode::WorldBoundingBox ( )
overridevirtual

Retrieve the world-space bounding box of the node and all of its children (if applicable).

Used internally in view frustum culling and selection queries.

Implements sv::SceneNode.


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