dtCore::Camera Class Reference

A dtCore::Camera is a view into the Scene. More...

#include <camera.h>

Inheritance diagram for dtCore::Camera:

dtCore::Transformable dtCore::DeltaDrawable dtCore::Base

List of all members.

Public Types

enum  AutoNearFarCullingMode { NO_AUTO_NEAR_FAR = 0, BOUNDING_VOLUME_NEAR_FAR, PRIMITIVE_NEAR_FAR }

Public Member Functions

 Camera (const std::string &name="camera")
 Camera (dtCore::View *view, const std::string &name="camera")
void SetNearFarCullingMode (AutoNearFarCullingMode mode)
 Change how the near/far culling planes get automatically calculated.
void SetEnabled (bool enabled)
bool GetEnabled () const
 Is this Camera enabled?
DeltaWinGetWindow ()
 Get the supplied DeltaWin (could be NULL).
const DeltaWinGetWindow () const
void SetWindow (DeltaWin *win)
 Use the supplied DeltaWin to draw into.
const std::string TakeScreenShot (const std::string &namePrefix)
 Take a screen shot at end of next frame.
void SetPerspectiveParams (double vfov, double aspectRatio, double nearClip, double farClip)
 Set the perspective parameters of this Camera.
void SetPerspective (double hfov, double vfov, double nearClip, double farClip)
 DEPRECATED 01/22/08.
void GetPerspectiveParams (double &vfov, double &aspectRatio, double &nearClip, double &farClip)
 Get the perspective parameters of this Camera.
void GetPerspective (double &hfov, double &vfov, double &nearClip, double &farClip)
 DEPRECATED 01/22/08.
void SetFrustum (double left, double right, double bottom, double top, double nearClip, double farClip)
 Set view frustrum of camera lens.
void GetFrustum (double &left, double &right, double &bottom, double &top, double &nearClip, double &farClip)
 Get view frustrum in the projection matrix.
void SetOrtho (double left, double right, double bottom, double top, double nearClip, double farClip)
 set orthographic mode
float GetHorizontalFov ()
 
Returns:
HOV

float GetVerticalFov ()
 
Returns:
FOV

void SetProjectionResizePolicy (osg::Camera::ProjectionResizePolicy prp)
osg::Camera::ProjectionResizePolicy GetProjection ()
void SetAspectRatio (double aspectRatio)
 takes a number from 0-1 to set as the aspect ratio
double GetAspectRatio ()
 
Returns:
aspect ratio

void SetClearColor (float r, float g, float b, float a)
 Get a handle to the Producer Lens that this Camera uses.
void SetClearColor (const osg::Vec4 &color)
void GetClearColor (float &r, float &g, float &b, float &a)
void GetClearColor (osg::Vec4 &color)
osg::Camera * GetOSGCamera ()
 Get a non-const handle to the underlying Producer::Camera.
const osg::Camera * GetOSGCamera () const
 Get a const handle to the underlying Producer::Camera.
void SetLODScale (float newScale)
 Changes the multiplier applied to the Level of Detail distance calculation when rendering.
float GetLODScale () const
 
Returns:
the multiplier applied to the Level of Detail distance calculation when rendering.

virtual void AddedToScene (Scene *scene)
 Supply the Scene this Camera has been added to.

Protected Member Functions

virtual ~Camera ()
virtual void FrameSynch (const double deltaFrameTime)
 Override for FrameSynch.
virtual void OnMessage (MessageData *data)
 Base override to receive messages.


Detailed Description

A dtCore::Camera is a view into the Scene.

It requires a dtCore::DeltaWin to render the the Scene into. If no DeltaWin is supplied, a default DeltaWin will be created and will be overridden when a valid DeltaWin is supplied using SetWindow().

The method SetScene() supplies the geometry to be rendered from the Camera's point of view.

Any part of the Scene that doesn't contain renderable geometry will be drawn a solid color using the values supplied to SetClearColor().

The Frame() method must be called once per frame. This will update the scene, then cull and draw the visual objects.


Member Enumeration Documentation

enum dtCore::Camera::AutoNearFarCullingMode

Enumerator:
NO_AUTO_NEAR_FAR  no auto calculation
BOUNDING_VOLUME_NEAR_FAR  use the scene graph bounding spheres
PRIMITIVE_NEAR_FAR  use the scene graph primitives


Constructor & Destructor Documentation

dtCore::Camera::Camera ( const std::string &  name = "camera"  ) 

dtCore::Camera::Camera ( dtCore::View view,
const std::string &  name = "camera" 
)

dtCore::Camera::~Camera (  )  [protected, virtual]


Member Function Documentation

void dtCore::Camera::SetNearFarCullingMode ( AutoNearFarCullingMode  mode  ) 

Change how the near/far culling planes get automatically calculated.

void dtCore::Camera::SetEnabled ( bool  enabled  ) 

bool dtCore::Camera::GetEnabled (  )  const

Is this Camera enabled?

DeltaWin* dtCore::Camera::GetWindow (  )  [inline]

Get the supplied DeltaWin (could be NULL).

const DeltaWin* dtCore::Camera::GetWindow (  )  const [inline]

void dtCore::Camera::SetWindow ( DeltaWin win  ) 

Use the supplied DeltaWin to draw into.

const std::string dtCore::Camera::TakeScreenShot ( const std::string &  namePrefix  ) 

Take a screen shot at end of next frame.

Parameters:
namePrefix the prefix of the screenshot file to write
Returns:
the final file name of the screenshot that will be written next frame.

void dtCore::Camera::SetPerspectiveParams ( double  vfov,
double  aspectRatio,
double  nearClip,
double  farClip 
)

Set the perspective parameters of this Camera.

Parameters:
vfov : the vertical field of view in degrees
aspectRatio : the aspect ratio of the camera (width/height)
nearClip : the distance from the Camera to the near clipping plane
farClip : the distance from the Camera to the far clipping plane

void dtCore::Camera::SetPerspective ( double  hfov,
double  vfov,
double  nearClip,
double  farClip 
) [inline]

DEPRECATED 01/22/08.

void dtCore::Camera::GetPerspectiveParams ( double &  vfov,
double &  aspectRatio,
double &  nearClip,
double &  farClip 
)

Get the perspective parameters of this Camera.

Parameters:
vfov : the vertical field of view in degrees
aspectRatio : the aspect ratio of the camera (width/height)
nearClip : the distance from the Camera to the near clipping plane
farClip : the distance from the Camera to the far clipping plane

void dtCore::Camera::GetPerspective ( double &  hfov,
double &  vfov,
double &  nearClip,
double &  farClip 
) [inline]

DEPRECATED 01/22/08.

void dtCore::Camera::SetFrustum ( double  left,
double  right,
double  bottom,
double  top,
double  nearClip,
double  farClip 
)

Set view frustrum of camera lens.

void dtCore::Camera::GetFrustum ( double &  left,
double &  right,
double &  bottom,
double &  top,
double &  nearClip,
double &  farClip 
)

Get view frustrum in the projection matrix.

void dtCore::Camera::SetOrtho ( double  left,
double  right,
double  bottom,
double  top,
double  nearClip,
double  farClip 
)

set orthographic mode

float dtCore::Camera::GetHorizontalFov (  ) 

Returns:
HOV

float dtCore::Camera::GetVerticalFov (  ) 

Returns:
FOV

void dtCore::Camera::SetProjectionResizePolicy ( osg::Camera::ProjectionResizePolicy  prp  )  [inline]

osg::Camera::ProjectionResizePolicy dtCore::Camera::GetProjection (  )  [inline]

void dtCore::Camera::SetAspectRatio ( double  aspectRatio  ) 

takes a number from 0-1 to set as the aspect ratio

double dtCore::Camera::GetAspectRatio (  ) 

Returns:
aspect ratio

void dtCore::Camera::SetClearColor ( float  r,
float  g,
float  b,
float  a 
)

Get a handle to the Producer Lens that this Camera uses.

void dtCore::Camera::SetClearColor ( const osg::Vec4 &  color  ) 

void dtCore::Camera::GetClearColor ( float &  r,
float &  g,
float &  b,
float &  a 
)

void dtCore::Camera::GetClearColor ( osg::Vec4 &  color  ) 

osg::Camera* dtCore::Camera::GetOSGCamera (  )  [inline]

Get a non-const handle to the underlying Producer::Camera.

const osg::Camera* dtCore::Camera::GetOSGCamera (  )  const [inline]

Get a const handle to the underlying Producer::Camera.

void dtCore::Camera::SetLODScale ( float  newScale  ) 

Changes the multiplier applied to the Level of Detail distance calculation when rendering.

For example, setting this to 2 would double the distance used when picking the LOD. This means the detail will decrease twice as fast.

float dtCore::Camera::GetLODScale (  )  const

Returns:
the multiplier applied to the Level of Detail distance calculation when rendering.

void dtCore::Camera::AddedToScene ( Scene scene  )  [virtual]

Supply the Scene this Camera has been added to.

Normally this is done inside dtCore::Scene. So you should probably never have to call this.

Parameters:
scene The Scene to which this Camera is being added to.

Reimplemented from dtCore::Transformable.

void dtCore::Camera::FrameSynch ( const double  deltaFrameTime  )  [protected, virtual]

Override for FrameSynch.

void dtCore::Camera::OnMessage ( MessageData data  )  [protected, virtual]

Base override to receive messages.

This method should be called from derived classes

Parameters:
data the message to receive

Reimplemented from dtCore::Base.


http://www.delta3d.org
2.0.0 generated 14 Feb 2008