RobWorkProject  23.9.11-
Public Types | Public Member Functions | Protected Attributes | List of all members
SceneCamera Class Reference

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< SceneCameraPtr
 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< SceneNodePtr
 Smart pointer type for SceneNode.
 
typedef std::list< SceneNode::PtrNodeList
 Type for the list of nodes.
 
typedef const std::list< SceneNode::PtrNodeListConst
 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
 
SceneCameraasCameraNode ()
 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 GroupNodeasGroupNode ()
 Get a pointer to a GroupNode, if this is a GroupNode. More...
 
virtual DrawableNodeasDrawableNode ()
 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...
 

Detailed Description

Node representing a camera in the scene. A SceneCamera sets up everything from rendering buffer to perspective transform.

Member Enumeration Documentation

◆ AspectRatioControl

Mode for aspect ratio control.

Enumerator
Auto 

The aspect is automatically adjusted to fit entire viewport.

Scale 

the aspect ratio is fixed and the scaling is performed such that the largest picure is obtained

ScaleX 

the apect ratio is fixed and the scaling is performed along x-axis

ScaleY 

the apect ratio is fixed and the scaling is performed along y-axis

Fixed 

the aspect ratio is fixed.

Constructor & Destructor Documentation

◆ SceneCamera()

SceneCamera ( const std::string &  name,
SceneNode::Ptr  subGraph 
)

constructor

Parameters
name[in] name of camera
subGraph[in] the root of the subgraph that this camera is supposed to render.

Member Function Documentation

◆ asCameraNode()

SceneCamera* asCameraNode ( )
inlinevirtual

Get a pointer to a CameraNode, if this is a CameraNode.

Returns
a pointer, or NULL if the SceneNode is not of correct type.

Reimplemented from SceneNode.

◆ attachTo()

void attachTo ( rw::graphics::SceneNode::Ptr  snode)
inline

Attach camera to scene node.

Parameters
snode[in] node to attach to.

◆ getAspectRatio()

double getAspectRatio ( )
inline

Get the aspect ratio.

Returns
the aspect ratio.

◆ getAspectRatioControl()

AspectRatioControl getAspectRatioControl ( )
inline

Get current mode of aspect ratio control.

Returns
the current mode.

◆ getAttachedNode()

rw::graphics::SceneNode::Ptr getAttachedNode ( )
inline

Get the node attached to.

Returns
the node.

◆ getDrawMask()

int getDrawMask ( )

Get the mask used when drawing in the scene.

Returns
the draw mask - see DrawableNode::DrawableTypeMask.

◆ getName()

std::string getName ( )

get the camera name

Returns
camera name

◆ getProjectionMatrix()

virtual rw::math::ProjectionMatrix getProjectionMatrix ( )
virtual

gets the projection matrix

Returns
the current camera projection matrix

◆ setAspectRatioControl()

void setAspectRatioControl ( AspectRatioControl  control)
inline

Change the mode for aspect ratio control.

Parameters
control[in] new mode.

◆ setDrawMask()

virtual void setDrawMask ( int  mask)
virtual

set the mask used when drawing in the scene

Parameters
mask[in] The draw mask - see DrawableNode::DrawableTypeMask.

◆ setPerspective()

void setPerspective ( double  fov,
int  w,
int  h,
double  zNear,
double  zFar 
)

sets the projection matrix of this camera to be a perspective projection

Parameters
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

◆ setProjectionMatrix()

virtual void setProjectionMatrix ( const rw::math::ProjectionMatrix matrix)
virtual

sets the current camera projection matrix

Parameters
matrix[in] a projection matrix

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