scg3  0.6
scg::StereoCamera Class Reference

A perspective stereo camera (composite node). More...

#include "StereoCamera.h"

Inheritance diagram for scg::StereoCamera:
[legend]
Collaboration diagram for scg::StereoCamera:
[legend]

Public Member Functions

 StereoCamera ()
 
virtual ~StereoCamera ()
 
void init (GLfloat near, GLfloat far, GLfloat screenDist, GLfloat screenHeight, GLfloat interOcularDist)
 
void initBourke (GLfloat fovyDeg, GLfloat near, GLfloat far, GLfloat screenDist, GLfloat interOcularFactor)
 
virtual const glm::mat4 & getProjection ()
 
virtual const glm::mat4 & getViewTransform (RenderState *renderState)
 
virtual void updateProjection ()
 
virtual void render (RenderState *renderState)
 
- Public Member Functions inherited from scg::Camera
 Camera ()
 
virtual ~Camera ()
 
const glm::vec3 & getPosition () const
 
CamerasetPosition (const glm::vec3 &position)
 
const glm::quat & getOrientation () const
 
CamerasetOrientation (const glm::quat &orientation)
 
const glm::vec3 & getViewDirection () const
 
GLfloat getCenterDist () const
 
virtual CamerasetMatrix (const glm::mat4 &matrix)
 
virtual Cameratranslate (glm::vec3 translation)
 
virtual CamerarotateRad (GLfloat angleRad, glm::vec3 axis)
 
virtual Camerarotate (GLfloat angleDeg, glm::vec3 axis)
 
virtual Camerascale (glm::vec3 scaling)
 
Cameradolly (GLfloat distance)
 
CamerarotateAzimuthRad (GLfloat angleRad)
 
CamerarotateAzimuth (GLfloat angleDeg)
 
CamerarotateElevationRad (GLfloat angleRad)
 
CamerarotateElevation (GLfloat angleDeg)
 
CamerarotatePitchRad (GLfloat angleRad)
 
CamerarotatePitch (GLfloat angleDeg)
 
CamerarotateRollRad (GLfloat angleRad)
 
CamerarotateRoll (GLfloat angleDeg)
 
CamerarotateYawRad (GLfloat angleRad)
 
CamerarotateYaw (GLfloat angleDeg)
 
bool isDrawCenter () const
 
CamerasetDrawCenter (bool isDrawCenter)
 
void accept (Traverser *traverser)
 
virtual void acceptPost (Traverser *traverser)
 
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 ()
 
CompositeaddChild (NodeSP child)
 
CompositeremoveChild (Node *node, bool &result)
 
CompositeremoveChild (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)
 

Static Public Member Functions

static StereoCameraSP create ()
 
- Static Public Member Functions inherited from scg::Transformation
static TransformationSP create ()
 

Protected Attributes

GLint eyeFactor_
 
GLfloat near_
 
GLfloat far_
 
GLfloat screenDist_
 
GLfloat screenHalfWidth_
 
GLfloat screenHalfHeight_
 
GLfloat interOcularHalfDist_
 
- Protected Attributes inherited from scg::Camera
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_
 
Compositeparent_
 
std::vector< CoreSPcores_
 
bool isVisible_
 
std::unordered_map< std::string, std::string > metaInfo_
 

Additional Inherited Members

- Protected Member Functions inherited from scg::Camera
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)
 

Detailed Description

A perspective stereo camera (composite node).

Experimental: Does not work with multiple render passes since eye is switched with each call of render().

Initial parameters (Bourke method):

  • eye factor: -1 (left eye, direction of eye shift on x-axis)
  • vertical field of view: 60 deg
  • near distance: 0.01
  • far distance: 1000.0
  • screen distance: 1.5
  • ratio interocular distance / screen distance: 0.02

Definition at line 50 of file StereoCamera.h.

Constructor & Destructor Documentation

◆ StereoCamera()

scg::StereoCamera::StereoCamera ( )

Constructor.

◆ ~StereoCamera()

virtual scg::StereoCamera::~StereoCamera ( )
virtual

Destructor.

Member Function Documentation

◆ create()

static StereoCameraSP scg::StereoCamera::create ( )
static

Create shared pointer.

◆ getProjection()

virtual const glm::mat4& scg::StereoCamera::getProjection ( )
virtual

Get projection matrix for current (left or right) eye.

Reimplemented from scg::Camera.

◆ getViewTransform()

virtual const glm::mat4& scg::StereoCamera::getViewTransform ( RenderState renderState)
virtual

Get view transformation matrix according to camera position and orientation.

Reimplemented from scg::Camera.

◆ init()

void scg::StereoCamera::init ( GLfloat  near,
GLfloat  far,
GLfloat  screenDist,
GLfloat  screenHeight,
GLfloat  interOcularDist 
)

Initialize perspective stereo projection from screen dimensions. Aspect ratio is determined in updateProjection() from current viewport dimensions.

Parameters
nearnear distance
farfar distance
screenDistscreen distance (zero parallax plane)
screenHeightscreen height
interOcularDistinterocular distance

◆ initBourke()

void scg::StereoCamera::initBourke ( GLfloat  fovyDeg,
GLfloat  near,
GLfloat  far,
GLfloat  screenDist,
GLfloat  interOcularFactor 
)

Initialize perspective stereo projection according to Bourke method. Aspect ratio is determined in updateProjection() from current viewport dimensions.

Source (modified):
http://paulbourke.net/miscellaneous/stereographics/stereorender/

Parameters
fovyDegvertical field of view angle (degrees)
nearnear distance
farfar distance
screenDistscreen distance (zero parallax plane)
interOcularFactorratio interocular distance / screen distance

◆ render()

virtual void scg::StereoCamera::render ( RenderState renderState)
virtual

Render node, i.e., switch between left and right eye. Calls Camera::render().

Reimplemented from scg::Camera.

◆ updateProjection()

virtual void scg::StereoCamera::updateProjection ( )
virtual

Update projection matrix from current viewport dimensions, called by Renderer::render() (or derived class) if window has been resized.

Implements scg::Camera.

Member Data Documentation

◆ eyeFactor_

GLint scg::StereoCamera::eyeFactor_
protected

Definition at line 122 of file StereoCamera.h.

◆ far_

GLfloat scg::StereoCamera::far_
protected

Definition at line 124 of file StereoCamera.h.

◆ interOcularHalfDist_

GLfloat scg::StereoCamera::interOcularHalfDist_
protected

Definition at line 128 of file StereoCamera.h.

◆ near_

GLfloat scg::StereoCamera::near_
protected

Definition at line 123 of file StereoCamera.h.

◆ screenDist_

GLfloat scg::StereoCamera::screenDist_
protected

Definition at line 125 of file StereoCamera.h.

◆ screenHalfHeight_

GLfloat scg::StereoCamera::screenHalfHeight_
protected

Definition at line 127 of file StereoCamera.h.

◆ screenHalfWidth_

GLfloat scg::StereoCamera::screenHalfWidth_
protected

Definition at line 126 of file StereoCamera.h.


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