scg3
0.6
|
Base class for all cameras (composite node, abstract). More...
#include "Camera.h"
Public Member Functions | |
Camera () | |
virtual | ~Camera () |
virtual const glm::mat4 & | getProjection () |
virtual const glm::mat4 & | getViewTransform (RenderState *renderState) |
virtual void | updateProjection ()=0 |
const glm::vec3 & | getPosition () const |
Camera * | setPosition (const glm::vec3 &position) |
const glm::quat & | getOrientation () const |
Camera * | setOrientation (const glm::quat &orientation) |
const glm::vec3 & | getViewDirection () const |
GLfloat | getCenterDist () const |
virtual Camera * | setMatrix (const glm::mat4 &matrix) |
virtual Camera * | translate (glm::vec3 translation) |
virtual Camera * | rotateRad (GLfloat angleRad, glm::vec3 axis) |
virtual Camera * | rotate (GLfloat angleDeg, glm::vec3 axis) |
virtual Camera * | scale (glm::vec3 scaling) |
Camera * | dolly (GLfloat distance) |
Camera * | rotateAzimuthRad (GLfloat angleRad) |
Camera * | rotateAzimuth (GLfloat angleDeg) |
Camera * | rotateElevationRad (GLfloat angleRad) |
Camera * | rotateElevation (GLfloat angleDeg) |
Camera * | rotatePitchRad (GLfloat angleRad) |
Camera * | rotatePitch (GLfloat angleDeg) |
Camera * | rotateRollRad (GLfloat angleRad) |
Camera * | rotateRoll (GLfloat angleDeg) |
Camera * | rotateYawRad (GLfloat angleRad) |
Camera * | rotateYaw (GLfloat angleDeg) |
bool | isDrawCenter () const |
Camera * | setDrawCenter (bool isDrawCenter) |
void | accept (Traverser *traverser) |
virtual void | acceptPost (Traverser *traverser) |
virtual void | render (RenderState *renderState) |
virtual void | renderPost (RenderState *renderState) |
Public Member Functions inherited from scg::Transformation | |
Transformation () | |
virtual | ~Transformation () |
const glm::mat4 & | getMatrix () const |
Public Member Functions inherited from scg::Composite | |
Composite () | |
virtual | ~Composite ()=0 |
virtual void | destroy () |
Composite * | addChild (NodeSP child) |
Composite * | removeChild (Node *node, bool &result) |
Composite * | removeChild (Node *node) |
virtual void | traverse (Traverser *traverser) |
Public Member Functions inherited from scg::Node | |
Node () | |
virtual | ~Node ()=0 |
virtual void | clear () |
int | getNCores () const |
const std::string & | getMetaInfo (const std::string &key) const |
void | setMetaInfo (const std::string &key, const std::string &value) |
bool | isVisible () const |
void | setVisible (bool isVisible=true) |
Protected Member Functions | |
virtual void | update_ () |
Protected Member Functions inherited from scg::Node | |
void | addSibling_ (NodeSP sibling) |
void | removeSibling_ (Node *node, bool &result) |
void | processCores_ (RenderState *renderState) |
void | postProcessCores_ (RenderState *renderState) |
Protected Attributes | |
glm::mat4 | projection_ |
glm::mat4 | viewTransform_ |
glm::vec3 | eyePt_ |
glm::vec3 | centerPt_ |
GLfloat | centerDist_ |
glm::vec3 | viewDir_ |
glm::vec3 | upDir_ |
glm::vec3 | rightDir_ |
glm::quat | orientation_ |
bool | isDrawCenter_ |
Protected Attributes inherited from scg::Transformation | |
glm::mat4 | matrix_ |
Protected Attributes inherited from scg::Composite | |
NodeSP | leftChild_ |
Protected Attributes inherited from scg::Node | |
NodeSP | rightSibling_ |
Composite * | parent_ |
std::vector< CoreSP > | cores_ |
bool | isVisible_ |
std::unordered_map< std::string, std::string > | metaInfo_ |
Additional Inherited Members | |
Static Public Member Functions inherited from scg::Transformation | |
static TransformationSP | create () |
Base class for all cameras (composite node, abstract).
Camera offers transformation functions (partly inherited from Transformation) to change the position and orientation of the camera. It is possible to add further nodes, including shapes, as children of a camera, which will be transformed the same way as the camera itself.
If enabled by setDrawCenterMode(), xyz coordinate axes are drawn at the center point, i.e., the center of examination (x red, y green, z blue).
Initial parameters:
scg::Camera::Camera | ( | ) |
Constructor.
|
virtual |
Destructor.
|
virtual |
Accept traverser (visitor pattern).
Reimplemented from scg::Transformation.
|
virtual |
Accept traverser after traversing sub-tree (visitor pattern).
Reimplemented from scg::Transformation.
Camera* scg::Camera::dolly | ( | GLfloat | distance | ) |
Dolly camera in/out, leave center point fixed.
distance | positive for dolly in/forward |
GLfloat scg::Camera::getCenterDist | ( | ) | const |
Get distance to center point.
const glm::quat& scg::Camera::getOrientation | ( | ) | const |
Get camera orientation as quaternion.
const glm::vec3& scg::Camera::getPosition | ( | ) | const |
Get camera position.
|
virtual |
Get projection matrix.
Reimplemented in scg::StereoCamera.
const glm::vec3& scg::Camera::getViewDirection | ( | ) | const |
Get view direction.
|
virtual |
Get view transformation matrix according to camera position and orientation.
Reimplemented in scg::StereoCamera.
bool scg::Camera::isDrawCenter | ( | ) | const |
Get mode for drawing coordinate axes at center point.
|
virtual |
Render node, i.e., update model-view matrix of RenderState, draw center point (if enabled).
Reimplemented from scg::Transformation.
Reimplemented in scg::StereoCamera.
|
virtual |
Render transformaton after traversing sub-tree, i.e., restore model-view matrix.
Reimplemented from scg::Transformation.
|
inlinevirtual |
Rotate camera around given axis (degrees).
Reimplemented from scg::Transformation.
|
inline |
Camera* scg::Camera::rotateAzimuthRad | ( | GLfloat | angleRad | ) |
Rotate camera around center point in azimuth direction.
angleDeg | rotation angle (radians) |
|
inline |
Camera* scg::Camera::rotateElevationRad | ( | GLfloat | angleRad | ) |
Rotate camera around center point in elevation direction.
angleDeg | rotation angle (radians) |
|
inline |
Camera* scg::Camera::rotatePitchRad | ( | GLfloat | angleRad | ) |
Rotate camera around pitch axis.
angleDeg | rotation angle (radians) |
|
virtual |
Rotate camera around given axis (radians).
Reimplemented from scg::Transformation.
|
inline |
Camera* scg::Camera::rotateRollRad | ( | GLfloat | angleRad | ) |
Rotate camera around roll axis.
angleDeg | rotation angle (radians) |
|
inline |
Camera* scg::Camera::rotateYawRad | ( | GLfloat | angleRad | ) |
Rotate camera around yaw axis.
angleDeg | rotation angle (radians) |
|
virtual |
Ignore scaling (do nothing) for camera transformation.
Reimplemented from scg::Transformation.
Camera* scg::Camera::setDrawCenter | ( | bool | isDrawCenter | ) |
Set mode for drawing coordinate axes at center point.
|
virtual |
Set camera transformation matrix.
Reimplemented from scg::Transformation.
Camera* scg::Camera::setOrientation | ( | const glm::quat & | orientation | ) |
Set camera orientation as quaternion.
Camera* scg::Camera::setPosition | ( | const glm::vec3 & | position | ) |
Set camera position.
|
virtual |
Translate camera, move center point accordingly.
Reimplemented from scg::Transformation.
|
protectedvirtual |
Update direction vectors, center point, transformation matrix, and camera.
|
pure virtual |
Update projection matrix from current viewport dimensions, called by Renderer::render() (or derived class) if window has been resized.
Implemented in scg::StereoCamera, scg::OrthographicCamera, and scg::PerspectiveCamera.