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

nvsg::SimpleCamera Class Reference

A simple camera. More...

#include <SimpleCamera.h>

Inheritance diagram for nvsg::SimpleCamera:

Inheritance graph
[legend]
Collaboration diagram for nvsg::SimpleCamera:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual NVSG_API const SimpleCameraclone (void) const =0
 Interface for cloning a SimpleCamera.
virtual NVSG_API bool isDataShared () const
 Determine whether the data of this object is shared.
virtual NVSG_API DataID getDataID () const
 Get the DataID of the data of this object.
virtual NVSG_API float getProjectionDx () const
 Get the projection translation (used with stereo only).
virtual NVSG_API void setProjectionDx (float dx)
 Set the project translation (used with stereo only).
virtual NVSG_API size_t getNumberOfHeadLights () const
 Get number of headlights attached to the camera.
virtual NVSG_API const LightSourcegetHeadLight (size_t index) const
 Get the indexed headlight of this camera.
virtual NVSG_API bool setHeadLightTrafo (const nvmath::Vec3f &trans, const nvmath::Quatf &quat, size_t index=0)
 Set the headlight position and orientation relative to the camera.
virtual NVSG_API void getHeadLightTrafo (nvmath::Vec3f &trans, nvmath::Quatf &quat, size_t index=0) const
 Get the position/orientation of the indexed headlight of this camera.
virtual NVSG_API void addHeadLight (const LightSource *pLight, const nvmath::Vec3f &position=nvmath::Vec3f(0.0f, 0.0f, 0.0f), const nvmath::Quatf &quat=nvmath::Quatf(0.0f, 0.0f, 0.0f, 1.0f))
 Add a headlight on this camera.
virtual NVSG_API bool removeHeadLight (size_t index=0)
 Remove a headlight.
virtual NVSG_API float getTargetDistance () const
 Get the distance to the target point.
virtual NVSG_API void setTargetDistance (float td)
 Set the distance to the target point.
virtual NVSG_API const nvmath::Vec3fgetPosition () const
 Get the camera position.
virtual NVSG_API void setPosition (const nvmath::Vec3f &pos)
 Set the camera position.
virtual NVSG_API nvmath::Vec3f getUpVector () const
 Get the up direction.
virtual NVSG_API void setUpVector (const nvmath::Vec3f &up)
 Set the up direction.
virtual NVSG_API nvmath::Vec3f getDirection () const
 Get viewing direction.
virtual NVSG_API void setDirection (const nvmath::Vec3f &dir)
 Set the viewing direction.
virtual NVSG_API void setOrientation (const nvmath::Quatf &quat)
 Set the orientation of the camera.
virtual NVSG_API void setOrientation (const nvmath::Vec3f &dir, const nvmath::Vec3f &up)
 Set the orientation of the camera.
virtual NVSG_API void setOrientation (const nvmath::Vec3f &axis, float angle)
 Interface for setting the orientation of the camera.
virtual NVSG_API nvmath::Quatf getOrientation (void) const
 Get the current orientation.
virtual NVSG_API nvmath::Mat44f getWorldToViewMatrix () const
 Get the world-to-view transformation.
virtual NVSG_API nvmath::Mat44f getViewToWorldMatrix () const
 Get the inverse of the camera specific world-to-view transformation.
virtual NVSG_API void setWindowOffset (const nvmath::Vec2f &offset)
 Set the window offset.
virtual NVSG_API const nvmath::Vec2fgetWindowOffset () const
 Get the window offset.
virtual NVSG_API void setWindowSize (const nvmath::Vec2f &size)
 Set the window size.
virtual NVSG_API const nvmath::Vec2fgetWindowSize () const
 Get the window size.
virtual NVSG_API void setAspectRatio (float ar, bool keepWidth=false)
 Set the aspect ratio.
virtual NVSG_API float getAspectRatio () const
 Get the current aspect ratio.
virtual NVSG_API void setWindowRegion (const nvmath::Vec2f &lowerLeft, const nvmath::Vec2f &upperRight)
 Set the relative window region to view.
virtual NVSG_API void getWindowRegion (nvmath::Vec2f &lowerLeft, nvmath::Vec2f &upperRight) const
 Get the relative window region to view.
virtual NVSG_API void setAutoClipPlanes (bool on)
 Enable/Disable automatic clip plane determination.
virtual NVSG_API bool isAutoClipPlanes () const
 Get auto clipping state.
virtual NVSG_API void calcNearFarDistances (const nvmath::Sphere3f &sphere)
 Calculate the distances to the near and far clipping planes.
virtual NVSG_API void setNearDistance (float nd)
 Set the near clipping distance.
virtual NVSG_API float getNearDistance () const
 Get distance to near clipping plane.
virtual NVSG_API float getFarDistance () const
 Get distance to far clipping plane.
virtual NVSG_API void setFarDistance (float fd)
 Set the far clipping distance.
virtual NVSG_API void move (const nvmath::Vec3f &delta)
 Move the camera.
virtual NVSG_API void orbit (const nvmath::Vec3f &axis, float rad)
 Orbit the camera.
virtual NVSG_API void rotate (const nvmath::Vec3f &axis, float rad, bool cameraRelative=true)
 Interface for rotating the camera.
virtual NVSG_API void zoom (float factor)
 Zoom by a factor.
virtual NVSG_API void zoom (const nvmath::Sphere3f &sphere, float fovy=-1.0f)
 Zoom to fit view to a sphere.

Protected Member Functions

NVSG_API SimpleCamera ()
 Constructor.
NVSG_API SimpleCamera (const SimpleCamera &rhs)
 Copy constructor.
virtual NVSG_API ~SimpleCamera ()
 Protected destructor to prevent explicit creation on stack.

Detailed Description

A simple camera.

This camera type is used to group the simple camera types (as Parallel/Perspective).


Constructor & Destructor Documentation

NVSG_API nvsg::SimpleCamera::SimpleCamera  )  [protected]
 

Constructor.

NVSG_API nvsg::SimpleCamera::SimpleCamera const SimpleCamera rhs  )  [protected]
 

Copy constructor.

Parameters:
rhs  source camera object

virtual NVSG_API nvsg::SimpleCamera::~SimpleCamera  )  [protected, virtual]
 

Protected destructor to prevent explicit creation on stack.


Member Function Documentation

virtual NVSG_API const SimpleCamera* nvsg::SimpleCamera::clone void   )  const [pure virtual]
 

Interface for cloning a SimpleCamera.

Implements nvsg::MonoCamera.

Implemented in nvsg::ParallelCamera, and nvsg::PerspectiveCamera.

virtual NVSG_API bool nvsg::SimpleCamera::isDataShared  )  const [virtual]
 

Determine whether the data of this object is shared.

Returns:
true if the object's data is shared, otherwise false.

Reimplemented from nvsg::Object.

virtual NVSG_API DataID nvsg::SimpleCamera::getDataID  )  const [virtual]
 

Get the DataID of the data of this object.

Returns:
DataID of the object's data.

Reimplemented from nvsg::Object.

virtual NVSG_API float nvsg::SimpleCamera::getProjectionDx  )  const [virtual]
 

Get the projection translation (used with stereo only).

Returns:
The projection translation in x

Implements nvsg::MonoCamera.

virtual NVSG_API void nvsg::SimpleCamera::setProjectionDx float  dx  )  [virtual]
 

Set the project translation (used with stereo only).

Parameters:
dx  shift of projection in x-direction

Implements nvsg::MonoCamera.

virtual NVSG_API size_t nvsg::SimpleCamera::getNumberOfHeadLights  )  const [virtual]
 

Get number of headlights attached to the camera.

Returns:
The number of headlights attached to camera

Implements nvsg::Camera.

const LightSource * nvsg::SimpleCamera::getHeadLight size_t  index  )  const [inline, virtual]
 

Get the indexed headlight of this camera.

Returns:
A constant pointer to the indexed headlight
Parameters:
index  index of head light to get

Implements nvsg::Camera.

virtual NVSG_API bool nvsg::SimpleCamera::setHeadLightTrafo const nvmath::Vec3f trans,
const nvmath::Quatf quat,
size_t  index = 0
[virtual]
 

Set the headlight position and orientation relative to the camera.

Returns:
true if a headlight with this index exists, otherwise false
Parameters:
trans  position of headlight
quat  orientation of headlight
index  index of headlight

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::getHeadLightTrafo nvmath::Vec3f trans,
nvmath::Quatf quat,
size_t  index = 0
const [virtual]
 

Get the position/orientation of the indexed headlight of this camera.

It is assumed that the camera holds at least index headlights.

Parameters:
trans  translation relative to the camera
quat  rotation relative to the camera
index  index of the headlight to get information from

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::addHeadLight const LightSource pLight,
const nvmath::Vec3f position = nvmath::Vec3f(0.0f, 0.0f, 0.0f),
const nvmath::Quatf quat = nvmath::Quatf(0.0f, 0.0f, 0.0f, 1.0f)
[virtual]
 

Add a headlight on this camera.

A camera can have a number of headlights that are positioned relative to the camera, i.e. they move together with the camera. These lights are not part of the scene, but part of the camera. The default position and orientation of a new headlight is the camera position and orientation.

Parameters:
pLight  The light source to add
position  The position relative to the camera
quat  The rotation relative to the camera

Implements nvsg::Camera.

virtual NVSG_API bool nvsg::SimpleCamera::removeHeadLight size_t  index = 0  )  [virtual]
 

Remove a headlight.

Returns:
true if headlight was removed, otherwise false
Parameters:
index  index of headlight to remove

Implements nvsg::Camera.

virtual NVSG_API float nvsg::SimpleCamera::getTargetDistance  )  const [virtual]
 

Get the distance to the target point.

Returns:
The distance to the target point

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setTargetDistance float  td  )  [virtual]
 

Set the distance to the target point.

Parameters:
td  distance to target point (or viewing plane)

Implements nvsg::Camera.

Reimplemented in nvsg::PerspectiveCamera.

virtual NVSG_API const nvmath::Vec3f& nvsg::SimpleCamera::getPosition  )  const [virtual]
 

Get the camera position.

Returns:
The position of camera

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setPosition const nvmath::Vec3f pos  )  [virtual]
 

Set the camera position.

Parameters:
pos  position

Implements nvsg::Camera.

virtual NVSG_API nvmath::Vec3f nvsg::SimpleCamera::getUpVector  )  const [virtual]
 

Get the up direction.

Returns:
The up direction of camera

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setUpVector const nvmath::Vec3f up  )  [virtual]
 

Set the up direction.

Parameters:
up  up direction (might change viewing direction)

Implements nvsg::Camera.

virtual NVSG_API nvmath::Vec3f nvsg::SimpleCamera::getDirection  )  const [virtual]
 

Get viewing direction.

The default viewing direction of a SimpleCamera is along the negative z-axis.

Returns:
The viewing direction

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setDirection const nvmath::Vec3f dir  )  [virtual]
 

Set the viewing direction.

Parameters:
dir  new viewing direction (might change upVector)

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setOrientation const nvmath::Quatf quat  )  [virtual]
 

Set the orientation of the camera.

Parameters:
quat  quaternion that determines direction and up vector

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setOrientation const nvmath::Vec3f dir,
const nvmath::Vec3f up
[virtual]
 

Set the orientation of the camera.

Parameters:
dir  direction to look at
up  up vector

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setOrientation const nvmath::Vec3f axis,
float  angle
[virtual]
 

Interface for setting the orientation of the camera.

Parameters:
axis  axis to rotate about
angle  angle to rotate

Implements nvsg::Camera.

virtual NVSG_API nvmath::Quatf nvsg::SimpleCamera::getOrientation void   )  const [virtual]
 

Get the current orientation.

Returns:
quaternion that describes the orientation

Implements nvsg::Camera.

virtual NVSG_API nvmath::Mat44f nvsg::SimpleCamera::getWorldToViewMatrix  )  const [virtual]
 

Get the world-to-view transformation.

Returns:
world-to-camera transformation

Implements nvsg::Camera.

virtual NVSG_API nvmath::Mat44f nvsg::SimpleCamera::getViewToWorldMatrix  )  const [virtual]
 

Get the inverse of the camera specific world-to-view transformation.

Returns:
inverse of the world-to-view transformation (i.e. view to world)

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setWindowOffset const nvmath::Vec2f offset  )  [virtual]
 

Set the window offset.

Parameters:
offset  window ofset to viewing reference point

Implements nvsg::Camera.

virtual NVSG_API const nvmath::Vec2f& nvsg::SimpleCamera::getWindowOffset  )  const [virtual]
 

Get the window offset.

Returns:
The window offset

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setWindowSize const nvmath::Vec2f size  )  [virtual]
 

Set the window size.

Parameters:
size  window size (world coordinates)

Implements nvsg::Camera.

virtual NVSG_API const nvmath::Vec2f& nvsg::SimpleCamera::getWindowSize  )  const [virtual]
 

Get the window size.

Returns:
The window size

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setAspectRatio float  ar,
bool  keepWidth = false
[virtual]
 

Set the aspect ratio.

Parameters:
ar  new aspect ratio
keepWidth  keep width or height constant

Implements nvsg::Camera.

virtual NVSG_API float nvsg::SimpleCamera::getAspectRatio  )  const [virtual]
 

Get the current aspect ratio.

Returns:
The width versus height of the camera window

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setWindowRegion const nvmath::Vec2f lowerLeft,
const nvmath::Vec2f upperRight
[virtual]
 

Set the relative window region to view.

Parameters:
lowerLeft  relative lower left position
upperRight  relative upper right position

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::getWindowRegion nvmath::Vec2f lowerLeft,
nvmath::Vec2f upperRight
const [virtual]
 

Get the relative window region to view.

Parameters:
lowerLeft  relative lower left position
upperRight  relative upper right position

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setAutoClipPlanes bool  on  )  [virtual]
 

Enable/Disable automatic clip plane determination.

Parameters:
on  true to enable, false to disable

Implements nvsg::Camera.

virtual NVSG_API bool nvsg::SimpleCamera::isAutoClipPlanes  )  const [virtual]
 

Get auto clipping state.

If auto clip is on, the camera determines the optimal near and front clipping distances out of the scene. If the user has additional information about the scene that might help clipping, it should be turned off.

Returns:
true, if auto clip is on, otherwise false

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::calcNearFarDistances const nvmath::Sphere3f sphere  )  [virtual]
 

Calculate the distances to the near and far clipping planes.

Near and far distances can be used internally to the camera to improve depth resolution. This function should determine these values such that the sphere given by center and radius just fits between them.

Parameters:
sphere  bounding sphere of the world to look at

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setNearDistance float  nd  )  [virtual]
 

Set the near clipping distance.

Parameters:
nd  near clipping distance

Implements nvsg::Camera.

virtual NVSG_API float nvsg::SimpleCamera::getNearDistance  )  const [virtual]
 

Get distance to near clipping plane.

Near and far distances can be used internally to the camera to improve depth resolution.

Returns:
The distance to the near clipping plane

Implements nvsg::Camera.

virtual NVSG_API float nvsg::SimpleCamera::getFarDistance  )  const [virtual]
 

Get distance to far clipping plane.

Near and far distances can be used internally to the camera to improve depth resolution.

Returns:
The distance to the far clipping plane

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::setFarDistance float  fd  )  [virtual]
 

Set the far clipping distance.

Parameters:
fd  far clipping distance

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::move const nvmath::Vec3f delta  )  [virtual]
 

Move the camera.

Parameters:
delta  delta to move the camera (camera coordinates)

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::orbit const nvmath::Vec3f axis,
float  rad
[virtual]
 

Orbit the camera.

Parameters:
axis  axis to orbit around (camera coordinates)
rad  angle to orbit (radians)

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::rotate const nvmath::Vec3f axis,
float  rad,
bool  cameraRelative = true
[virtual]
 

Interface for rotating the camera.

Parameters:
axis  axis to rotate around
rad  angle to rotate (radians)
cameraRelative  flag to indicate if the axis is camera or world relative

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::zoom float  factor  )  [virtual]
 

Zoom by a factor.

Parameters:
factor  zoom in/out by this factor; changes windowSize

Implements nvsg::Camera.

virtual NVSG_API void nvsg::SimpleCamera::zoom const nvmath::Sphere3f sphere,
float  fovy = -1.0f
[virtual]
 

Zoom to fit view to a sphere.

Parameters:
sphere  sphere to zoom on
fovy  field of view; if negative, keep the current

Implements nvsg::Camera.


The documentation for this class was generated from the following file:
Generated on Tue Mar 1 13:20:55 2005 for NVSGSDK by NVIDIA