RobWorkProject
23.9.11-
|
Node representing a camera in the scene. A SceneCamera sets up everything from rendering buffer to perspective transform. More...
#include <SceneCamera.hpp>
Inherits SceneNode.
Public Types | |
enum | AspectRatioControl { Auto , Scale , ScaleX , ScaleY , Fixed } |
Mode for aspect ratio control. More... | |
typedef rw::core::Ptr< SceneCamera > | Ptr |
Smart pointer type for SceneCamera. | |
Public Types inherited from SceneNode | |
enum | AddPolicy { Front , Back } |
Policy for adding parent nodes. More... | |
enum | NodeType { GroupType = 0 , CameraType , DrawableType , UserBeginType = 1024 } |
Node types. More... | |
typedef rw::core::Ptr< SceneNode > | Ptr |
Smart pointer type for SceneNode. | |
typedef std::list< SceneNode::Ptr > | NodeList |
Type for the list of nodes. | |
typedef const std::list< SceneNode::Ptr > | NodeListConst |
Type for a const list of nodes. | |
Public Member Functions | |
SceneCamera (const std::string &name, SceneNode::Ptr subGraph) | |
constructor More... | |
virtual | ~SceneCamera () |
destructor | |
void | setPerspective (double fov, int w, int h, double zNear, double zFar) |
sets the projection matrix of this camera to be a perspective projection More... | |
virtual rw::math::ProjectionMatrix | getProjectionMatrix () |
gets the projection matrix More... | |
virtual void | setProjectionMatrix (const rw::math::ProjectionMatrix &matrix) |
sets the current camera projection matrix More... | |
virtual void | setViewport (int x, int y, int width, int height) |
set viewport settings | |
virtual void | getViewport (int &x, int &y, int &width, int &height) |
get viewport settings | |
virtual void | setClearBufferEnabled (bool enabled) |
set to true if the render buffer should be cleared before drawing | |
virtual bool | isClearBufferEnabled () |
test if buffers is cleared before drawing | |
virtual void | setClearBufferMask (int mask) |
choose which buffers that should be cleared | |
virtual int | getClearBufferMask () |
get the clear buffer mask that describe which buffers are cleared before drawing | |
virtual void | setDepthTestEnabled (bool enabled) |
enable or disable the use of depth tests (depth buffer) | |
virtual bool | isDepthTestEnabled () |
test if depth testing is enabled | |
virtual void | setLightningEnabled (bool enabled) |
enable or disable the use of lightning | |
virtual bool | isLightningEnabled () |
test if lightning is enabled | |
virtual SceneNode::Ptr | getRefNode () |
get the reference node | |
virtual void | setRefNode (SceneNode::Ptr snode) |
set the reference node of the camera | |
virtual bool | isEnabled () |
test if this camera is enabled | |
virtual void | setEnabled (bool enabled) |
enable or disable this camera | |
SceneCamera * | asCameraNode () |
Get a pointer to a CameraNode, if this is a CameraNode. More... | |
void | setTransform (const rw::math::Transform3D<> &t3d) |
set the camera transform relative to reference node (getRefNode) | |
rw::math::Transform3D | getTransform () |
get the camera transform | |
void | setAspectRatioControl (AspectRatioControl control) |
Change the mode for aspect ratio control. More... | |
AspectRatioControl | getAspectRatioControl () |
Get current mode of aspect ratio control. More... | |
virtual void | setDrawMask (int mask) |
set the mask used when drawing in the scene More... | |
int | getDrawMask () |
Get the mask used when drawing in the scene. More... | |
std::string | getName () |
get the camera name More... | |
void | attachTo (rw::graphics::SceneNode::Ptr snode) |
Attach camera to scene node. More... | |
rw::graphics::SceneNode::Ptr | getAttachedNode () |
Get the node attached to. More... | |
double | getAspectRatio () |
Get the aspect ratio. More... | |
Public Member Functions inherited from SceneNode | |
virtual | ~SceneNode () |
Destructor. | |
void | addParent (SceneNode::Ptr node, AddPolicy policy=Back) |
Add a parent node. More... | |
bool | hasParent (SceneNode::Ptr parent) |
Check if the given node is a parent node. More... | |
void | removeParent (SceneNode::Ptr node) |
erases the parent from the parent list. More... | |
virtual GroupNode * | asGroupNode () |
Get a pointer to a GroupNode, if this is a GroupNode. More... | |
virtual DrawableNode * | asDrawableNode () |
Get a pointer to a DrawableNode, if this is a DrawableNode. More... | |
int | getType () |
Get the NodeType. More... | |
const std::string & | getName () |
Get the name of the node. More... | |
void | setName (const std::string &name) |
Set the name of this node. More... | |
Protected Attributes | |
rw::math::ProjectionMatrix | _pmatrix |
Projection matrix for camera. | |
int | _x |
Viewport x. | |
int | _y |
Viewport y. | |
int | _w |
Viewport width. | |
int | _h |
Viewport height. | |
int | _drawMask |
Mask for what to draw. See DrawableNode::DrawableTypeMask. | |
int | _clearMask |
Mask for what should be cleared. | |
bool | _depthTestEnabled |
Enable/disable depth test. | |
bool | _lightningEnabled |
Enable/disable light. | |
bool | _clearBufferEnabled |
Enable/disable clear buffer. | |
bool | _enabled |
Enable/disable camera. | |
rw::graphics::DrawableNode::RenderInfo | _renderInfo |
Rendering info used by the camera. | |
SceneNode::Ptr | _subGraph |
The reference node of the camera. | |
SceneNode::Ptr | _attachedTo |
Node that the camera is attached to. | |
std::string | _cameraName |
rw::math::Transform3D | _t3d |
Transform of the camera. | |
double | _aspectRatio |
The aspect ratio. | |
AspectRatioControl | _ratioControl |
Mode of aspect ratio control. | |
Additional Inherited Members | |
Static Public Member Functions inherited from SceneNode | |
static void | removeParent (SceneNode::Ptr node, SceneNode::Ptr parent) |
Remove a parent node. More... | |
Public Attributes inherited from SceneNode | |
std::string | _name |
The name of the node. | |
std::list< SceneNode::Ptr > | _parentNodes |
The list of parent nodes. | |
int | _type |
The NodeType. | |
Protected Member Functions inherited from SceneNode | |
SceneNode (const std::string &name, int type) | |
Construct new scene node. More... | |
Node representing a camera in the scene. A SceneCamera sets up everything from rendering buffer to perspective transform.
enum AspectRatioControl |
Mode for aspect ratio control.
SceneCamera | ( | const std::string & | name, |
SceneNode::Ptr | subGraph | ||
) |
constructor
name | [in] name of camera |
subGraph | [in] the root of the subgraph that this camera is supposed to render. |
|
inlinevirtual |
|
inline |
Attach camera to scene node.
snode | [in] node to attach to. |
|
inline |
Get the aspect ratio.
|
inline |
Get current mode of aspect ratio control.
|
inline |
Get the node attached to.
int getDrawMask | ( | ) |
Get the mask used when drawing in the scene.
std::string getName | ( | ) |
get the camera name
|
virtual |
gets the projection matrix
|
inline |
Change the mode for aspect ratio control.
control | [in] new mode. |
|
virtual |
set the mask used when drawing in the scene
mask | [in] The draw mask - see DrawableNode::DrawableTypeMask. |
void setPerspective | ( | double | fov, |
int | w, | ||
int | h, | ||
double | zNear, | ||
double | zFar | ||
) |
sets the projection matrix of this camera to be a perspective projection
fov | [in] field of view in radians. |
w | [in] view width |
h | [in] view height |
zNear | [in] near clipping plane |
zFar | [in] far clipping plane |
|
virtual |
sets the current camera projection matrix
matrix | [in] a projection matrix |