Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# osg::CameraNode Class Reference

CameraNode - is a subclass of Transform which represents encapsulates the settings of a Camera. More...

Inheritance diagram for osg::CameraNode:

[legend]
List of all members.

## Public Types
typedef std::map< BufferComponent, Attachment > | BufferAttachmentMap
enum | TransformOrder { PRE_MULTIPLE, POST_MULTIPLE }
enum | RenderOrder { PRE_RENDER, NESTED_RENDER, POST_RENDER }
enum | RenderTargetImplementation { FRAME_BUFFER_OBJECT, PIXEL_BUFFER_RTT, PIXEL_BUFFER, FRAME_BUFFER, SEPERATE_WINDOW }
enum | BufferComponent { DEPTH_BUFFER, STENCIL_BUFFER, COLOR_BUFFER, COLOR_BUFFER0 = COLOR_BUFFER, COLOR_BUFFER1 = COLOR_BUFFER+1, COLOR_BUFFER2 = COLOR_BUFFER+2, COLOR_BUFFER3 = COLOR_BUFFER+3, COLOR_BUFFER4 = COLOR_BUFFER+4, COLOR_BUFFER5 = COLOR_BUFFER+5, COLOR_BUFFER6 = COLOR_BUFFER+6, COLOR_BUFFER7 = COLOR_BUFFER+7 }
## Public Member Functions
| CameraNode ()
| CameraNode (const CameraNode &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
| Copy constructor using CopyOp to manage deep vs shallow copy.
| META_Node (osg, CameraNode)
void | setClearColor (const Vec4 &color)
| Sets the clear color.
const Vec4 & | getClearColor () const
| Returns the clear color.
void | setClearMask (GLbitfield mask)
| Set the clear mask used in glClear(..).
GLbitfield | getClearMask () const
| Get the clear mask.
void | setColorMask (osg::ColorMask *colorMask)
| Set the color mask of the camera to use specified osg::ColorMask.
void | setColorMask (bool red, bool green, bool blue, bool alpha)
| Set the color mask of the camera to specified values.
const ColorMask * | getColorMask () const
| Get the const ColorMask.
ColorMask * | getColorMask ()
| Get the ColorMask.
void | setViewport (osg::Viewport *viewport)
| Set the viewport of the camera to use specified osg::Viewport.
void | setViewport (int x, int y, int width, int height)
| Set the viewport of the camera to specified dimensions.
const Viewport * | getViewport () const
| Get the const viewport.
Viewport * | getViewport ()
| Get the viewport.
void | setTransformOrder (TransformOrder order)
TransformOrder | getTransformOrder () const
void | setProjectionMatrix (const osg::Matrixf &matrix)
| Set the projection matrix.
void | setProjectionMatrix (const osg::Matrixd &matrix)
| Set the projection matrix.
void | setProjectionMatrixAsOrtho (double left, double right, double bottom, double top, double zNear, double zFar)
| Set to an orthographic projection.
void | setProjectionMatrixAsOrtho2D (double left, double right, double bottom, double top)
| Set to a 2D orthographic projection.
void | setProjectionMatrixAsFrustum (double left, double right, double bottom, double top, double zNear, double zFar)
| Set to a perspective projection.
void | setProjectionMatrixAsPerspective (double fovy, double aspectRatio, double zNear, double zFar)
| Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details.
osg::Matrixd & | getProjectionMatrix ()
| Get the projection matrix.
const osg::Matrixd & | getProjectionMatrix () const
| Get the const projection matrix.
bool | getProjectionMatrixAsOrtho (double &left, double &right, double &bottom, double &top, double &zNear, double &zFar)
| Get the othographic settings of the orthographic projection matrix.
bool | getProjectionMatrixAsFrustum (double &left, double &right, double &bottom, double &top, double &zNear, double &zFar)
| Get the frustum setting of a perspective projection matrix.
bool | getProjectionMatrixAsPerspective (double &fovy, double &aspectRatio, double &zNear, double &zFar)
| Get the frustum setting of a symmetric perspective projection matrix.
void | setViewMatrix (const osg::Matrixf &matrix)
| Set the view matrix.
void | setViewMatrix (const osg::Matrixd &matrix)
| Set the view matrix.
void | setViewMatrixAsLookAt (const osg::Vec3 &eye, const osg::Vec3 &center, const osg::Vec3 &up)
| Set to the position and orientation of view matrix, using the same convention as gluLookAt.
osg::Matrixd & | getViewMatrix ()
| Get the view matrix.
const osg::Matrixd & | getViewMatrix () const
| Get the const view matrix.
void | getViewMatrixAsLookAt (osg::Vec3 &eye, osg::Vec3 &center, osg::Vec3 &up, float lookDistance=1.0f)
| Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt.
Matrixd | getInverseViewMatrix () const
| Get the inverse view matrix.
void | setRenderOrder (RenderOrder order)
| Set the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within.
RenderOrder | getRenderOrder () const
| Get the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within.
void | setRenderTargetImplementation (RenderTargetImplementation impl)
void | setRenderTargetImplementation (RenderTargetImplementation impl, RenderTargetImplementation fallback)
RenderTargetImplementation | getRenderTargetImplementation () const
RenderTargetImplementation | getRenderTargetFallback () const
void | setDrawBuffer (GLenum buffer)
| Set the draw buffer used at the start of each frame draw.
GLenum | getDrawBuffer () const
| Get the draw buffer used at the start of each frame draw.
void | setReadBuffer (GLenum buffer)
| Set the read buffer for any required copy operations to use.
GLenum | getReadBuffer () const
| Get the read buffer for any required copy operations to use.
void | attach (BufferComponent buffer, GLenum internalFormat)
void | attach (BufferComponent buffer, osg::Texture *texture, unsigned int level=0, unsigned int face=0, bool mipMapGeneration=false)
void | attach (BufferComponent buffer, osg::Image *image)
void | detach (BufferComponent buffer)
BufferAttachmentMap & | getBufferAttachmentMap ()
| Get the BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads.
const BufferAttachmentMap & | getBufferAttachmentMap () const
| Get the const BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads.
void | setGraphicsContext (GraphicsContext *context)
| Set the GraphicsContext that provides the mechansim for managing the OpenGL graphics context associated with this camera.
GraphicsContext * | getGraphicsContext ()
| Get the GraphicsContext.
const GraphicsContext * | getGraphicsContext () const
| Get the const GraphicsContext.
void | setRenderingCache (unsigned int contextID, osg::Object *rc)
| Set the Rendering object that is used to implement rendering of the subgraph.
osg::Object * | getRenderingCache (unsigned int contextID)
| Get the Rendering object that is used to implement rendering of the subgraph.
const osg::Object * | getRenderingCache (unsigned int contextID) const
| Get the const Rendering object that is used to implement rendering of the subgraph.
void | setPostDrawCallback (DrawCallback *cb)
| Set the post draw callback for custom operations to do done after the drawing of the camera's subgraph has been completed.
DrawCallback * | getPostDrawCallback ()
| Get the post draw callback.
const DrawCallback * | getPostDrawCallback () const
| Get the const post draw callback.
OpenThreads::Mutex * | getDataChangeMutex () const
virtual bool | computeLocalToWorldMatrix (Matrix &matrix, NodeVisitor *) const
| Transform method that must be defined to provide generic interface for scene graph traversals.
virtual bool | computeWorldToLocalMatrix (Matrix &matrix, NodeVisitor *) const
| Transform method that must be defined to provide generic interface for scene graph traversals.
## Protected Member Functions
virtual | ~CameraNode ()
## Protected Attributes
OpenThreads::Mutex | _dataChangeMutex
Vec4 | _clearColor
GLbitfield | _clearMask
ref_ptr< ColorMask > | _colorMask
ref_ptr< Viewport > | _viewport
TransformOrder | _transformOrder
Matrixd | _projectionMatrix
Matrixd | _viewMatrix
RenderOrder | _renderOrder
GLenum | _drawBuffer
GLenum | _readBuffer
RenderTargetImplementation | _renderTargetImplementation
RenderTargetImplementation | _renderTargetFallback
BufferAttachmentMap | _bufferAttachmentMap
ref_ptr< GraphicsContext > | _graphicsContext
buffered_object< ref_ptr< Object > > | _renderingCache
ref_ptr< DrawCallback > | _postDrawCallback

## Detailed Description

CameraNode - is a subclass of Transform which represents encapsulates the settings of a Camera.

## Member Typedef Documentation

typedef std::map< BufferComponent, Attachment> osg::CameraNode::BufferAttachmentMap

## Member Enumeration Documentation

enum osg::CameraNode::BufferComponent

  | Enumeration values:
  DEPTH_BUFFER |
  STENCIL_BUFFER |
  COLOR_BUFFER |
  COLOR_BUFFER0 |
  COLOR_BUFFER1 |
  COLOR_BUFFER2 |
  COLOR_BUFFER3 |
  COLOR_BUFFER4 |
  COLOR_BUFFER5 |
  COLOR_BUFFER6 |
  COLOR_BUFFER7 |

enum osg::CameraNode::RenderOrder

  | Enumeration values:
  PRE_RENDER |
  NESTED_RENDER |
  POST_RENDER |

enum osg::CameraNode::RenderTargetImplementation

  | Enumeration values:
  FRAME_BUFFER_OBJECT |
  PIXEL_BUFFER_RTT |
  PIXEL_BUFFER |
  FRAME_BUFFER |
  SEPERATE_WINDOW |

enum osg::CameraNode::TransformOrder

  | Enumeration values:
  PRE_MULTIPLE |
  POST_MULTIPLE |

## Constructor & Destructor Documentation

osg::CameraNode::CameraNode | ( |  | ) |

osg::CameraNode::CameraNode | ( | const CameraNode & | ,
|  | const CopyOp & | copyop = CopyOp::SHALLOW_COPY
| ) |

| Copy constructor using CopyOp to manage deep vs shallow copy.

virtual osg::CameraNode::~CameraNode | ( |  | ) | `[protected, virtual]`

## Member Function Documentation

void osg::CameraNode::attach | ( | BufferComponent | buffer,
|  | osg::Image * | image
| ) |

void osg::CameraNode::attach | ( | BufferComponent | buffer,
|  | osg::Texture * | texture,
|  | unsigned int | level = 0,
|  | unsigned int | face = 0,
|  | bool | mipMapGeneration = false
| ) |

void osg::CameraNode::attach | ( | BufferComponent | buffer,
|  | GLenum | internalFormat
| ) |

virtual bool osg::CameraNode::computeLocalToWorldMatrix | ( | Matrix & | matrix,
|  | NodeVisitor * |
| ) | const`[virtual]`

| Transform method that must be defined to provide generic interface for scene graph traversals. Reimplemented from osg::Transform.

virtual bool osg::CameraNode::computeWorldToLocalMatrix | ( | Matrix & | matrix,
|  | NodeVisitor * |
| ) | const`[virtual]`

| Transform method that must be defined to provide generic interface for scene graph traversals. Reimplemented from osg::Transform.

void osg::CameraNode::detach | ( | BufferComponent | buffer | ) |

const BufferAttachmentMap& osg::CameraNode::getBufferAttachmentMap | ( |  | ) | const`[inline]`

| Get the const BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads.

BufferAttachmentMap& osg::CameraNode::getBufferAttachmentMap | ( |  | ) | `[inline]`

| Get the BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads.

const Vec4& osg::CameraNode::getClearColor | ( |  | ) | const`[inline]`

| Returns the clear color.

GLbitfield osg::CameraNode::getClearMask | ( |  | ) | const`[inline]`

| Get the clear mask.

ColorMask* osg::CameraNode::getColorMask | ( |  | ) | `[inline]`

| Get the ColorMask.

const ColorMask* osg::CameraNode::getColorMask | ( |  | ) | const`[inline]`

| Get the const ColorMask.

OpenThreads::Mutex* osg::CameraNode::getDataChangeMutex | ( |  | ) | const`[inline]`

GLenum osg::CameraNode::getDrawBuffer | ( |  | ) | const`[inline]`

| Get the draw buffer used at the start of each frame draw.

const GraphicsContext* osg::CameraNode::getGraphicsContext | ( |  | ) | const`[inline]`

| Get the const GraphicsContext.

GraphicsContext* osg::CameraNode::getGraphicsContext | ( |  | ) | `[inline]`

| Get the GraphicsContext.

Matrixd osg::CameraNode::getInverseViewMatrix | ( |  | ) | const

| Get the inverse view matrix.

const DrawCallback* osg::CameraNode::getPostDrawCallback | ( |  | ) | const`[inline]`

| Get the const post draw callback.

DrawCallback* osg::CameraNode::getPostDrawCallback | ( |  | ) | `[inline]`

| Get the post draw callback.

const osg::Matrixd& osg::CameraNode::getProjectionMatrix | ( |  | ) | const`[inline]`

| Get the const projection matrix.

osg::Matrixd& osg::CameraNode::getProjectionMatrix | ( |  | ) | `[inline]`

| Get the projection matrix.

bool osg::CameraNode::getProjectionMatrixAsFrustum | ( | double & | left,
|  | double & | right,
|  | double & | bottom,
|  | double & | top,
|  | double & | zNear,
|  | double & | zFar
| ) |

| Get the frustum setting of a perspective projection matrix. Returns false if matrix is not a perspective matrix, where parameter values are undefined.

bool osg::CameraNode::getProjectionMatrixAsOrtho | ( | double & | left,
|  | double & | right,
|  | double & | bottom,
|  | double & | top,
|  | double & | zNear,
|  | double & | zFar
| ) |

| Get the othographic settings of the orthographic projection matrix. Returns false if matrix is not an orthographic matrix, where parameter values are undefined.

bool osg::CameraNode::getProjectionMatrixAsPerspective | ( | double & | fovy,
|  | double & | aspectRatio,
|  | double & | zNear,
|  | double & | zFar
| ) |

| Get the frustum setting of a symmetric perspective projection matrix. Returns false if matrix is not a perspective matrix, where parameter values are undefined. Note, if matrix is not a symmetric perspective matrix then the shear will be lost. Asymmetric matrices occur when stereo, power walls, caves and reality center display are used. In these configurations one should use the 'getProjectionMatrixAsFrustum' method instead.

GLenum osg::CameraNode::getReadBuffer | ( |  | ) | const`[inline]`

| Get the read buffer for any required copy operations to use.

const osg::Object* osg::CameraNode::getRenderingCache | ( | unsigned int | contextID | ) | const`[inline]`

| Get the const Rendering object that is used to implement rendering of the subgraph.

osg::Object* osg::CameraNode::getRenderingCache | ( | unsigned int | contextID | ) | `[inline]`

| Get the Rendering object that is used to implement rendering of the subgraph.

RenderOrder osg::CameraNode::getRenderOrder | ( |  | ) | const`[inline]`

| Get the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within.

RenderTargetImplementation osg::CameraNode::getRenderTargetFallback | ( |  | ) | const`[inline]`

RenderTargetImplementation osg::CameraNode::getRenderTargetImplementation | ( |  | ) | const`[inline]`

TransformOrder osg::CameraNode::getTransformOrder | ( |  | ) | const`[inline]`

const osg::Matrixd& osg::CameraNode::getViewMatrix | ( |  | ) | const`[inline]`

| Get the const view matrix.

osg::Matrixd& osg::CameraNode::getViewMatrix | ( |  | ) | `[inline]`

| Get the view matrix.

void osg::CameraNode::getViewMatrixAsLookAt | ( | osg::Vec3 & | eye,
|  | osg::Vec3 & | center,
|  | osg::Vec3 & | up,
|  | float | lookDistance = 1.0f
| ) |

| Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt.

Viewport* osg::CameraNode::getViewport | ( |  | ) | `[inline]`

| Get the viewport.

const Viewport* osg::CameraNode::getViewport | ( |  | ) | const`[inline]`

| Get the const viewport.

osg::CameraNode::META_Node | ( | osg | ,
|  | CameraNode |
| ) |

void osg::CameraNode::setClearColor | ( | const Vec4 & | color | ) | `[inline]`

| Sets the clear color.

void osg::CameraNode::setClearMask | ( | GLbitfield | mask | ) | `[inline]`

| Set the clear mask used in glClear(..). Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT.

void osg::CameraNode::setColorMask | ( | bool | red,
|  | bool | green,
|  | bool | blue,
|  | bool | alpha
| ) |

| Set the color mask of the camera to specified values.

void osg::CameraNode::setColorMask | ( | osg::ColorMask * | colorMask | ) |

| Set the color mask of the camera to use specified osg::ColorMask.

void osg::CameraNode::setDrawBuffer | ( | GLenum | buffer | ) | `[inline]`

| Set the draw buffer used at the start of each frame draw. Note, a buffer value of GL_NONE is used to sepecify that the rendering back-end should choose the most appropriate buffer.

void osg::CameraNode::setGraphicsContext | ( | GraphicsContext * | context | ) | `[inline]`

| Set the GraphicsContext that provides the mechansim for managing the OpenGL graphics context associated with this camera.

void osg::CameraNode::setPostDrawCallback | ( | DrawCallback * | cb | ) | `[inline]`

| Set the post draw callback for custom operations to do done after the drawing of the camera's subgraph has been completed.

void osg::CameraNode::setProjectionMatrix | ( | const osg::Matrixd & | matrix | ) | `[inline]`

| Set the projection matrix. Can be thought of as setting the lens of a camera.

void osg::CameraNode::setProjectionMatrix | ( | const osg::Matrixf & | matrix | ) | `[inline]`

| Set the projection matrix. Can be thought of as setting the lens of a camera.

void osg::CameraNode::setProjectionMatrixAsFrustum | ( | double | left,
|  | double | right,
|  | double | bottom,
|  | double | top,
|  | double | zNear,
|  | double | zFar
| ) |

| Set to a perspective projection. See OpenGL glFrustum documentation for further details.

void osg::CameraNode::setProjectionMatrixAsOrtho | ( | double | left,
|  | double | right,
|  | double | bottom,
|  | double | top,
|  | double | zNear,
|  | double | zFar
| ) |

| Set to an orthographic projection. See OpenGL glOrtho for documentation further details.

void osg::CameraNode::setProjectionMatrixAsOrtho2D | ( | double | left,
|  | double | right,
|  | double | bottom,
|  | double | top
| ) |

| Set to a 2D orthographic projection. See OpenGL glOrtho2D documentation for further details.

void osg::CameraNode::setProjectionMatrixAsPerspective | ( | double | fovy,
|  | double | aspectRatio,
|  | double | zNear,
|  | double | zFar
| ) |

| Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details. Aspect ratio is defined as width/height.

void osg::CameraNode::setReadBuffer | ( | GLenum | buffer | ) | `[inline]`

| Set the read buffer for any required copy operations to use. Note, a buffer value of GL_NONE is used to sepecify that the rendering back-end should choose the most appropriate buffer.

void osg::CameraNode::setRenderingCache | ( | unsigned int | contextID,
|  | osg::Object * | rc
| ) | `[inline]`

| Set the Rendering object that is used to implement rendering of the subgraph.

void osg::CameraNode::setRenderOrder | ( | RenderOrder | order | ) | `[inline]`

| Set the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within. For rendering to a texture, one typically uses PRE_RENDER. For Head Up Displays, one would typically use POST_RENDER.

void osg::CameraNode::setRenderTargetImplementation | ( | RenderTargetImplementation | impl,
|  | RenderTargetImplementation | fallback
| ) |

void osg::CameraNode::setRenderTargetImplementation | ( | RenderTargetImplementation | impl | ) |

void osg::CameraNode::setTransformOrder | ( | TransformOrder | order | ) | `[inline]`

void osg::CameraNode::setViewMatrix | ( | const osg::Matrixd & | matrix | ) | `[inline]`

| Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates.

void osg::CameraNode::setViewMatrix | ( | const osg::Matrixf & | matrix | ) | `[inline]`

| Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates.

void osg::CameraNode::setViewMatrixAsLookAt | ( | const osg::Vec3 & | eye,
|  | const osg::Vec3 & | center,
|  | const osg::Vec3 & | up
| ) |

| Set to the position and orientation of view matrix, using the same convention as gluLookAt.

void osg::CameraNode::setViewport | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |

| Set the viewport of the camera to specified dimensions.

void osg::CameraNode::setViewport | ( | osg::Viewport * | viewport | ) |

| Set the viewport of the camera to use specified osg::Viewport.

## Member Data Documentation

BufferAttachmentMap osg::CameraNode::_bufferAttachmentMap`[protected]`

Vec4 osg::CameraNode::_clearColor`[protected]`

GLbitfield osg::CameraNode::_clearMask`[protected]`

ref_ptr<ColorMask> osg::CameraNode::_colorMask`[protected]`

OpenThreads::Mutex osg::CameraNode::_dataChangeMutex`[mutable, protected]`

GLenum osg::CameraNode::_drawBuffer`[protected]`

ref_ptr<GraphicsContext> osg::CameraNode::_graphicsContext`[protected]`

ref_ptr<DrawCallback> osg::CameraNode::_postDrawCallback`[protected]`

Matrixd osg::CameraNode::_projectionMatrix`[protected]`

GLenum osg::CameraNode::_readBuffer`[protected]`

buffered_object< ref_ptr<Object> > osg::CameraNode::_renderingCache`[protected]`

RenderOrder osg::CameraNode::_renderOrder`[protected]`

RenderTargetImplementation osg::CameraNode::_renderTargetFallback`[protected]`

RenderTargetImplementation osg::CameraNode::_renderTargetImplementation`[protected]`

TransformOrder osg::CameraNode::_transformOrder`[protected]`

Matrixd osg::CameraNode::_viewMatrix`[protected]`

ref_ptr<Viewport> osg::CameraNode::_viewport`[protected]`

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

- CameraNode