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

nvsg::JitterCamera Class Reference

A jittering camera. More...

#include <JitterCamera.h>

Inheritance diagram for nvsg::JitterCamera:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual NVSG_API const JitterCameraclone (void) const
 Create a clone of this JitterCamera.
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.
NVSG_API void getJitters (std::vector< nvmath::Vec2f > &jitters) const
 Get the jitters.
NVSG_API void setJitters (const std::vector< nvmath::Vec2f > &jitters)
 Set the jitters.
NVSG_API size_t getNumberOfPasses () const
 Get the number of passes.
NVSG_API void updateSimpleCameras (size_t vpWidth, size_t vpHeight) const
 Update the simple base cameras with the current camera settings and the viewport size.
NVSG_API const SimpleCameragetBaseCamera () const
 Get the base camera.
NVSG_API const SimpleCameragetCamera (size_t index) const
 Get camera.
virtual NVSG_API nvmath::Mat44f getProjection () const
 Get the projection matrix.
virtual NVSG_API float getProjectionDx () const
 Get the projection translation (used with stereo only).
virtual NVSG_API nvmath::Mat44f getInverseProjection () const
 Get the inverse projection matrix.
virtual NVSG_API void setProjectionDx (float dx)
 Set the projection translation (used with stereo only).
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))
 Interface for adding a headlight to this camera.
virtual NVSG_API bool removeHeadLight (size_t index=0)
 Interface for removing a headlight.
virtual NVSG_API size_t getNumberOfHeadLights () const
 Interface for getting the number of headlights attached to the camera.
virtual NVSG_API const LightSourcegetHeadLight (size_t index) const
 Interface for getting a headlight of this camera.
virtual NVSG_API void getHeadLightTrafo (nvmath::Vec3f &trans, nvmath::Quatf &quat, size_t index=0) const
 Interface for getting the position/orientation of a camera's headlight.
virtual NVSG_API bool setHeadLightTrafo (const nvmath::Vec3f &trans, const nvmath::Quatf &quat, size_t index=0)
 Interface for setting the headlight position and orientation relative to the camera.
virtual NVSG_API nvmath::Vec3f getDirection () const
 Interface for getting the viewing direction.
virtual NVSG_API void setDirection (const nvmath::Vec3f &dir)
 Interface for setting the viewing direction.
virtual NVSG_API float getTargetDistance () const
 Interface for getting the distance to the target point.
virtual NVSG_API void setTargetDistance (float td)
 Interface for setting the distance to the target point.
virtual NVSG_API const nvmath::Vec3fgetPosition () const
 Interface for getting the camera position.
virtual NVSG_API void setPosition (const nvmath::Vec3f &pos)
 Interface for setting the camera position.
virtual NVSG_API void setUpVector (const nvmath::Vec3f &up)
 Interface for setting the up direction.
virtual NVSG_API nvmath::Vec3f getUpVector () const
 Interface for getting the up direction.
virtual NVSG_API void setOrientation (const nvmath::Quatf &quat)
 Interface for setting the camera orientation.
virtual NVSG_API void setOrientation (const nvmath::Vec3f &dir, const nvmath::Vec3f &up)
 Interface for setting the camera orientation.
virtual NVSG_API void setOrientation (const nvmath::Vec3f &axis, float angle)
 Interface for setting the camera orientation.
virtual NVSG_API nvmath::Quatf getOrientation (void) const
 Get the current orientation.
virtual NVSG_API nvmath::Mat44f getWorldToViewMatrix () const
 Interface for getting the world-to-view transformation.
virtual NVSG_API nvmath::Mat44f getViewToWorldMatrix () const
 Interface for getting the inverse world-to-view transformation.
virtual NVSG_API const nvmath::Vec2fgetWindowOffset () const
 Interface for getting the window offset.
virtual NVSG_API void setWindowOffset (const nvmath::Vec2f &offset)
 Interface for setting the window offset.
virtual NVSG_API void getWindowRegion (nvmath::Vec2f &lowerLeft, nvmath::Vec2f &upperRight) const
 Interface for getting the relative window region to view.
virtual NVSG_API void setWindowRegion (const nvmath::Vec2f &lowerLeft, const nvmath::Vec2f &upperRight)
 Interface for setting the relative window region to view.
virtual NVSG_API const nvmath::Vec2fgetWindowSize () const
 Interface for getting the window size.
virtual NVSG_API void setWindowSize (const nvmath::Vec2f &size)
 Interface for setting the window size.
virtual NVSG_API float getAspectRatio () const
 Interface for getting the current aspect ratio.
virtual NVSG_API void setAspectRatio (float ar, bool keepWidth=false)
 Interface for setting the aspect ratio.
virtual NVSG_API bool isAutoClipPlanes () const
 Interface for determining if auto clipping is on.
virtual NVSG_API void setAutoClipPlanes (bool on)
 Interface for enabling/disabling automatic clip plane determination.
virtual NVSG_API void calcNearFarDistances (const nvmath::Sphere3f &sphere)
 Interface for calculating the near and far clipping distances.
virtual NVSG_API float getFarDistance () const
 Interface for getting the far clipping distance.
virtual NVSG_API void setFarDistance (float fd)
 Interface for setting the far clipping distance.
virtual NVSG_API float getNearDistance () const
 Interface for getting the near clipping distance.
virtual NVSG_API void setNearDistance (float nd)
 Interface for setting the near clipping distance.
virtual NVSG_API void move (const nvmath::Vec3f &delta)
 Interface for moving the camera.
virtual NVSG_API void orbit (const nvmath::Vec3f &axis, float rad)
 Interface for orbiting 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)
 Interface for zooming by a factor.
virtual NVSG_API void zoom (const nvmath::Sphere3f &sphere, float fovy=-1.0f)
 Interface for zooming to fit view to a sphere.

Static Public Member Functions

static NVSG_API const JitterCameracreate (const SimpleCamera &base, const std::vector< nvmath::Vec2f > &jitters)
 Create a JitterCamera.
static NVSG_API const JitterCameracreateFromBase (const MonoCamera &rhs, const SimpleCamera &base, const std::vector< nvmath::Vec2f > &jitters)

Protected Member Functions

NVSG_API JitterCamera (const SimpleCamera &base, const std::vector< nvmath::Vec2f > &jitters)
 Constructor.
NVSG_API JitterCamera (const MonoCamera &rhs, const SimpleCamera &base, const std::vector< nvmath::Vec2f > &jitters)
 Partial Constructur.
NVSG_API JitterCamera (const JitterCamera &rhs)
 Copy constructor.
virtual NVSG_API ~JitterCamera (void)
 Protected destructor to prevent explicit creation on stack.

Detailed Description

A jittering camera.

A JitterCamera is a MonoCamera that produces an average of a number of slightly jittered projections. This results in full-scene antialiased images.

Jittering
If you need to take nine or sixteen samples to antialias an image, you might think that the best choice of points is an equally spaced grid across the pixel. Surprisingly, this is not necessarily true. In fact, sometimes it's a good idea to take points that lie in adjacent pixels. You might want a uniform distribution or a normalized distribution, clustering toward the center of the pixel. Following is a short example code showing how to set jitters for a JitterCamera:
   vector<Vec2f> jitters;
   jitters.resize(2);
   jitters[0] = Vec2f( 0.25f, 0.75f );
   jitters[1] = Vec2f( 0.75f, 0.25f );
   jitterCamera->setJitters( jitters );
Following are a few sets of reasonable jitter values to use for selected sample counts. All of these examples are uniformly distributed in the pixel and all lie within the pixel.
   Count   Values
     2     { 0.25,  0.75 }, { 0.75,  0.25 }
     4     { 0.375, 0.25 }, { 0.125, 0.75 }, { 0.875, 0.25 }, { 0.625, 075 }
     8     { 0.5625, 0.4375 }, { 0.0625, 0.9375 }, { 0.3125, 0.6875 }, { 0.6875, 0.8125 },
           { 0.8125, 0.1875 }, { 0.9375, 0.5625 }, { 0.4375, 0.0625 }, { 0.1875, 0.3125 }


Constructor & Destructor Documentation

NVSG_API nvsg::JitterCamera::JitterCamera const SimpleCamera base,
const std::vector< nvmath::Vec2f > &  jitters
[protected]
 

Constructor.

Constructs a JitterCamera with the SimpleCamera base as it's base. The size of jitters gives the numbers of passes to make, and the Vec2f elements determine the amount to jitter in each pass. The units of the jitters are pixels.

Parameters:
base  base camera to use
jitters  vector of jitters

NVSG_API nvsg::JitterCamera::JitterCamera const MonoCamera rhs,
const SimpleCamera base,
const std::vector< nvmath::Vec2f > &  jitters
[protected]
 

Partial Constructur.

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

Copy constructor.

Parameters:
rhs  source camera object

virtual NVSG_API nvsg::JitterCamera::~JitterCamera void   )  [protected, virtual]
 

Protected destructor to prevent explicit creation on stack.


Member Function Documentation

static NVSG_API const JitterCamera* nvsg::JitterCamera::create const SimpleCamera base,
const std::vector< nvmath::Vec2f > &  jitters
[static]
 

Create a JitterCamera.

Returns:
a constant pointer to a JitterCamera.
Parameters:
base  base camera to use
jitters  vectors of jitter

static NVSG_API const JitterCamera* nvsg::JitterCamera::createFromBase const MonoCamera rhs,
const SimpleCamera base,
const std::vector< nvmath::Vec2f > &  jitters
[static]
 

Parameters:
rhs  MonoCamera to copy from
base  base camera to use
jitters  vectors of jitter

virtual NVSG_API const JitterCamera* nvsg::JitterCamera::clone void   )  const [virtual]
 

Create a clone of this JitterCamera.

Returns:
const pointer to the new JitterCamera as a pointer to a MonoCamera

Implements nvsg::MonoCamera.

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

Determine whether the data of this object is shared.

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

Reimplemented from nvsg::Object.

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

Get the DataID of the data of this object.

Returns:
The DataID of the object's data.

Reimplemented from nvsg::Object.

void nvsg::JitterCamera::getJitters std::vector< nvmath::Vec2f > &  jitters  )  const [inline]
 

Get the jitters.

The jitter vector of Vec2f defines the number of passes and the jitter of each pass. The jitter units are pixels.

Parameters:
jitters  vector of Vec2f to fill with jitters

NVSG_API void nvsg::JitterCamera::setJitters const std::vector< nvmath::Vec2f > &  jitters  ) 
 

Set the jitters.

The size of jitters gives the number of passes to make, and the Vec2f elements determine the amount to jitter in each pass. The jitter units are pixels.

Parameters:
jitters  vector of jitters

size_t nvsg::JitterCamera::getNumberOfPasses  )  const [inline]
 

Get the number of passes.

Returns:
The number of jittering passes (actually the size of the jitter vector)

NVSG_API void nvsg::JitterCamera::updateSimpleCameras size_t  vpWidth,
size_t  vpHeight
const
 

Update the simple base cameras with the current camera settings and the viewport size.

The viewport width and height are used to scale the jitter values, allowing the jitters to be in pixel units.

Parameters:
vpWidth  viewport width
vpHeight  viewport height

const SimpleCamera * nvsg::JitterCamera::getBaseCamera  )  const [inline]
 

Get the base camera.

The base camera of a jitter camera is a SimpleCamera that is used in multiple passes, each one slightly jittered.

Returns:
A const pointer to the base camera

const SimpleCamera * nvsg::JitterCamera::getCamera size_t  index  )  const [inline]
 

Get camera.

Returns:
Camera at index index.
Parameters:
index  Zero based index.

virtual NVSG_API nvmath::Mat44f nvsg::JitterCamera::getProjection  )  const [virtual]
 

Get the projection matrix.

Returns:
The projection matrix (unjittered)

Implements nvsg::MonoCamera.

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

Get the projection translation (used with stereo only).

Returns:
The projection translation in x (unjittered)

Implements nvsg::MonoCamera.

virtual NVSG_API nvmath::Mat44f nvsg::JitterCamera::getInverseProjection  )  const [virtual]
 

Get the inverse projection matrix.

Returns:
The inverse projection matrix (unjittered)

Implements nvsg::MonoCamera.

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

Set the projection translation (used with stereo only).

Parameters:
dx  shift of projection in x-direction

Implements nvsg::MonoCamera.

virtual NVSG_API void nvsg::JitterCamera::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]
 

Interface for adding a headlight to this camera.

Parameters:
pLight  A pointer to the LightSource to add.
position  The position relative to the camera.
quat  The rotation relative to the camera.

Implements nvsg::Camera.

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

Interface for removing a headlight.

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

Implements nvsg::Camera.

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

Interface for getting the number of headlights attached to the camera.

Returns:
The number of headlights attached to this camera.

Implements nvsg::Camera.

virtual NVSG_API const LightSource* nvsg::JitterCamera::getHeadLight size_t  index  )  const [virtual]
 

Interface for getting a headlight of this camera.

Returns:
A constant pointer to the headlight at index index
Parameters:
index  Index of headlight to get

Implements nvsg::Camera.

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

Interface for getting the position/orientation of a camera's headlight.

Parameters:
trans  The translation relative to the camera will be received here.
quat  The rotation relative to the camera will be received here.
index  Index of the headlight to get transform information from.

Implements nvsg::Camera.

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

Interface for setting the headlight position and orientation relative to the camera.

Returns:
true if a head light with this index exists, false otherwise.
Parameters:
trans  position of headlight - default is (0,0,0)
quat  orientation of headlight - default is (0,0,0,1)
index  index of headlight

Implements nvsg::Camera.

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

Interface for getting the viewing direction.

Returns:
The viewing direction

Implements nvsg::Camera.

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

Interface for setting the viewing direction.

Parameters:
dir  new viewing direction (might change upVector)

Implements nvsg::Camera.

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

Interface for getting the distance to the target point.

Returns:
The distance to the target point

Implements nvsg::Camera.

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

Interface for setting the distance to the target point.

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

Implements nvsg::Camera.

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

Interface for getting the camera position.

Returns:
The camera position

Implements nvsg::Camera.

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

Interface for setting the camera position.

Parameters:
pos  new camera position

Implements nvsg::Camera.

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

Interface for setting the up direction.

Parameters:
up  up direction (might change viewing direction)

Implements nvsg::Camera.

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

Interface for getting the up direction.

Returns:
The camera up direction

Implements nvsg::Camera.

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

Interface for setting the camera orientation.

Parameters:
quat  quaternion that determines direction and up vector

Implements nvsg::Camera.

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

Interface for setting the camera orientation.

Parameters:
dir  direction to look at
up  up vector

Implements nvsg::Camera.

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

Interface for setting the camera orientation.

Parameters:
axis  axis to rotate about
angle  angle to rotate

Implements nvsg::Camera.

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

Get the current orientation.

Returns:
quaternion that describes the orientation

Implements nvsg::Camera.

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

Interface for getting the world-to-view transformation.

Returns:
world-to-camera transformation

Implements nvsg::Camera.

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

Interface for getting the inverse world-to-view transformation.

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

Implements nvsg::Camera.

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

Interface for getting the window offset.

Returns:
The window offset

Implements nvsg::Camera.

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

Interface for setting the window offset.

Parameters:
offset  window ofset to viewing reference point

Implements nvsg::Camera.

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

Interface for getting 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::JitterCamera::setWindowRegion const nvmath::Vec2f lowerLeft,
const nvmath::Vec2f upperRight
[virtual]
 

Interface for setting the relative window region to view.

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

Implements nvsg::Camera.

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

Interface for getting the window size.

Returns:
The window size

Implements nvsg::Camera.

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

Interface for setting the window size.

Parameters:
size  window size (world coordinates)

Implements nvsg::Camera.

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

Interface for getting the current aspect ratio.

Returns:
The width verus height of the camera window

Implements nvsg::Camera.

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

Interface for setting the aspect ratio.

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

Implements nvsg::Camera.

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

Interface for determining if auto clipping is on.

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 c\ false

Implements nvsg::Camera.

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

Interface for enabling/disabling automatic clip plane determination.

Parameters:
on  true to enable, false to disable

Implements nvsg::Camera.

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

Interface for calculating the near and far clipping distances.

Parameters:
sphere  bounding sphere of the world to look at

Implements nvsg::Camera.

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

Interface for getting the far clipping distance.

Returns:
The distance to the far clipping plane

Implements nvsg::Camera.

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

Interface for setting the far clipping distance.

Parameters:
fd  far clipping distance

Implements nvsg::Camera.

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

Interface for getting the near clipping distance.

Returns:
The distance to the near clipping plane

Implements nvsg::Camera.

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

Interface for setting the near clipping distance.

Parameters:
nd  near clipping distance

Implements nvsg::Camera.

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

Interface for moving the camera.

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

Implements nvsg::Camera.

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

Interface for orbiting the camera.

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

Implements nvsg::Camera.

virtual NVSG_API void nvsg::JitterCamera::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::JitterCamera::zoom float  factor  )  [virtual]
 

Interface for zooming by a factor.

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

Implements nvsg::Camera.

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

Interface for zooming 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:48 2005 for NVSGSDK by NVIDIA