OSG::Camera Class Reference

Camera base class. See PageSystemWindowCamera for a description. More...

#include <OSGCamera.h>

Inheritance diagram for OSG::Camera:

OSG::CameraBase OSG::AttachmentContainer OSG::FieldContainer OSG::ReflexiveContainer OSG::CameraDecoratorBase OSG::MatrixCameraBase OSG::OrthographicCameraBase OSG::PerspectiveCameraBase OSG::CameraDecorator OSG::MatrixCamera OSG::OrthographicCamera OSG::PerspectiveCamera OSG::MatrixCameraDecoratorBase OSG::StereoCameraDecoratorBase OSG::TileCameraDecoratorBase OSG::OffCenterPerspectiveCameraBase OSG::MatrixCameraDecorator OSG::StereoCameraDecorator OSG::TileCameraDecorator OSG::OffCenterPerspectiveCamera OSG::ProjectionCameraDecoratorBase OSG::ShearedStereoCameraDecoratorBase OSG::ProjectionCameraDecorator OSG::ShearedStereoCameraDecorator List of all members.

dcast



typedef AttachmentContainer Self
typedef FieldContainerAttachment AttachmentObj
typedef FieldContainerAttachmentPtr AttachmentObjPtr
typedef SFFieldContainerAttachmentPtrMap SFAttachmentObjPtrMap
typedef SFAttachmentObjPtrMap::StoredType AttachmentObjPtrMap
typedef AttachmentObjPtrMap::iterator AttachmentObjPtrMapIt
 OSG_GEN_INTERNALPTR (AttachmentContainer)

Type definitions



 OSG_GEN_INTERNALPTR (FieldContainer)
 OSG_RC_FIRST_FIELD_DECL (ChangedCallbacks)
 OSG_RC_LAST_FIELD_DECL (ChangedCallbacks)
static const bool isNodeCore = false

Public Types

typedef CameraBase Inherited
enum  { BeaconFieldId = Inherited::NextFieldId, NearFieldId = BeaconFieldId + 1, FarFieldId = NearFieldId + 1, NextFieldId = FarFieldId + 1 }
typedef AttachmentContainer ParentContainer
typedef Inherited::TypeObject TypeObject
typedef TypeObject::InitPhase InitPhase
Type definitions


typedef Field *(ReflexiveContainer::*) FieldEditMethod (void)
typedef const Field *(ReflexiveContainer::*) FieldGetMethod (void) const

Public Member Functions

 OSG_GEN_INTERNALPTR (Camera)
transformation


virtual void changed (ConstFieldMaskArg whichField, UInt32 origin, BitVector detail)
Setup Rendering


virtual void setup (DrawActionBase *action, const Viewport &port)
virtual void setupProjection (DrawActionBase *action, const Viewport &port)
Access Parameters


virtual void getProjection (Matrixr &result, UInt32 width, UInt32 height)
virtual void getProjectionTranslation (Matrixr &result, UInt32 width, UInt32 height)
virtual void getViewing (Matrixr &result, UInt32 width, UInt32 height)
virtual void getFrustum (FrustumVolume &result, const Viewport &port)
virtual void getWorldToScreen (Matrixr &result, const Viewport &port)
virtual void getDecoration (Matrixr &result, UInt32 width, UInt32 height)
virtual Matrixr getProjectionVal (UInt32 width, UInt32 height)
virtual Matrixr getProjectionTranslationVal (UInt32 width, UInt32 height)
virtual Matrixr getViewingVal (UInt32 width, UInt32 height)
virtual Matrixr getWorldToScreenVal (const Viewport &port)
virtual Matrixr getDecorationVal (UInt32 width, UInt32 height)
virtual FrustumVolume getFrustumVal (const Viewport &port)
Intersection Helper


bool calcViewRay (Line &line, Int32 x, Int32 y, const Viewport &port)
dump


virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
FieldContainer Get


virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get


virtual const SFNodePtr * getSFBeacon (void) const
 Get the Camera::_sfBeacon field.
virtual SFReal32 * editSFNear (void)
 Get the Camera::_sfBeacon field.
virtual const SFReal32 * getSFNear (void) const
 Get the Camera::_sfBeacon field.
virtual SFReal32 * editSFFar (void)
 Get the Camera::_sfBeacon field.
virtual const SFReal32 * getSFFar (void) const
 Get the Camera::_sfBeacon field.
virtual NodePtrConst getBeacon (void) const
 Get the value of the Camera::_sfBeacon field.
virtual Real32 & editNear (void)
 Get the value of the Camera::_sfNear field.
virtual const Real32 & getNear (void) const
 Get the value of the Camera::_sfNear field.
virtual Real32 & editFar (void)
 Get the value of the Camera::_sfFar field.
virtual const Real32 & getFar (void) const
 Get the value of the Camera::_sfFar field.
Field Set


virtual void setBeacon (NodePtrConstArg value)
 Set the value of the Camera::_sfBeacon field.
virtual void setNear (const Real32 &value)
 Set the value of the Camera::_sfNear field.
virtual void setFar (const Real32 &value)
 Set the value of the Camera::_sfFar field.
Binary Access


virtual UInt32 getBinSize (ConstFieldMaskArg whichField)
virtual void copyToBin (BinaryDataHandler &pMem, ConstFieldMaskArg whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, ConstFieldMaskArg whichField)
Constructors


 OSG_RC_FIRST_FIELD_DECL (Attachments)
 OSG_RC_LAST_FIELD_DECL (Attachments)
Set


void addAttachment (const AttachmentObjPtr attachmentP, UInt16 binding=0)
void subAttachment (const AttachmentObjPtr attachmentP, UInt16 binding=0)
AttachmentObjPtr findAttachment (UInt32 groupId, UInt16 binding=0)
AttachmentObjPtr findAttachment (const FieldContainerType &type, UInt16 binding=0)
your_category


const SFAttachmentObjPtrMapgetSFAttachments (void) const
Get


virtual ObjPtr shallowCopy (void) const=0
Set


void callChangedFunctors (ConstFieldMaskArg whichField)
Container Access


UInt32 addChangedFunctor (ChangedFunctor func, std::string createSymbol)
template<class FunctorT>
void subChangedFunctor (FunctorT func)
void subChangedFunctor (UInt32 uiId)
void clearChangedFunctors (void)
Field Flags


const FieldFlagsgetFieldFlags (void)
Helper


OSG_SYSTEM_DLLMAPPING void addReference (void)
OSG_SYSTEM_DLLMAPPING void subReference (void)
OSG_SYSTEM_DLLMAPPING void subReferenceLocalVar (void)
OSG_SYSTEM_DLLMAPPING Int32 getRefCount (void) const
Comparison


virtual OSG_SYSTEM_DLLMAPPING
void 
invalidateVolume (void)
dcast


OSG_SYSTEM_DLLMAPPING UInt32 getTypeId (void) const
OSG_SYSTEM_DLLMAPPING UInt16 getGroupId (void) const
OSG_SYSTEM_DLLMAPPING const
Char8 * 
getTypeName (void) const
Get Field


OSG_SYSTEM_DLLMAPPING UInt32 getNumFields (void) const
OSG_SYSTEM_DLLMAPPING EditFieldHandlePtr editField (UInt32 fieldId)
OSG_SYSTEM_DLLMAPPING EditFieldHandlePtr editField (const Char8 *fieldName)
OSG_SYSTEM_DLLMAPPING GetFieldHandlePtr getField (UInt32 fieldId) const
OSG_SYSTEM_DLLMAPPING GetFieldHandlePtr getField (const Char8 *fieldName) const
Get Field Description


OSG_SYSTEM_DLLMAPPING FieldDescriptionBasegetFieldDescription (UInt32 fieldId)
OSG_SYSTEM_DLLMAPPING FieldDescriptionBasegetFieldDescription (const Char8 *fieldName)
Comparison


OSG_SYSTEM_DLLMAPPING EditFieldHandlePtr invalidEditField (void)
OSG_SYSTEM_DLLMAPPING GetFieldHandlePtr invalidGetField (void) const

Static Public Member Functions

Class Get


static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
static UInt16 getClassGroupId (void)
 access the type of the class

Public Attributes

General Fieldcontainer Declaration


 OSG_ABSTR_FIELD_CONTAINER_DECL

Static Public Attributes

static const OSG::BitVector BeaconFieldMask
static const OSG::BitVector NearFieldMask
static const OSG::BitVector FarFieldMask
static const OSG::BitVector NextFieldMask

Protected Member Functions

Constructors


 Camera (void)
 Camera (const Camera &source)
Destructors


virtual ~Camera (void)
onCreate


void onCreate (const Camera *source=NULL)
MT Construction


OSG_SYSTEM_DLLMAPPING void onCreate (const FieldContainer *source=NULL)
OSG_SYSTEM_DLLMAPPING void onCreateAspect (const FieldContainer *createAspect, const FieldContainer *source=NULL)
virtual OSG_SYSTEM_DLLMAPPING
void 
onDestroy (UInt32 uiContainerId)
Changed


OSG_SYSTEM_DLLMAPPING void onCreate (const ReflexiveContainer *source=NULL)
virtual OSG_SYSTEM_DLLMAPPING
void 
onDestroyAspect (UInt32 uiContainerId, UInt32 uiAspect)
Generic Field Access


GetFieldHandlePtr getHandleBeacon (void) const
EditFieldHandlePtr editHandleBeacon (void)
GetFieldHandlePtr getHandleNear (void) const
EditFieldHandlePtr editHandleNear (void)
GetFieldHandlePtr getHandleFar (void) const
EditFieldHandlePtr editHandleFar (void)
Sync


virtual void resolveLinks (void)
Sync


EditFieldHandlePtr editHandleAttachments (void)
GetFieldHandlePtr getHandleAttachments (void) const
Edit


OSG_SYSTEM_DLLMAPPING void subReferenceUnresolved (void)
MT Construction


virtual OSG_SYSTEM_DLLMAPPING
bool 
deregister (UInt32 uiContainerId)
MT Construction


OSG_SYSTEM_DLLMAPPING void registerChangedContainer (void)
virtual OSG_SYSTEM_DLLMAPPING
void 
registerChangedContainerV (void)
Local Edit


void editSField (ConstFieldMaskArg whichField)
template<class FieldT>
void editMField (ConstFieldMaskArg whichField, FieldT &oField)
MT Destruction


void execEndEdit (ConstFieldMaskArg whichField)
void clearChangeEntry (ContainerChangeEntry *pRef)
Edit


OSG_SYSTEM_DLLMAPPING void setId (UInt32 uiContainerId)
OSG_SYSTEM_DLLMAPPING UInt32 getId (void) const

Static Protected Member Functions

static void classDescInserter (TypeObject &oType)
static Char8 * getClassname (void)
Init


static void initMethod (InitPhase ePhase)
Fields


static void classDescInserter (TypeObject &oType)
MT Construction


template<class ObjectT>
static void newPtr (typename ObjectT::ObjPtr &result, const ObjectT *prototypeP)
template<class ObjectT>
static void newPtr (typename ObjectT::ObjPtr &result)

Protected Attributes

Fields


SFNodePtr _sfBeacon
SFReal32 _sfNear
SFReal32 _sfFar
Fields


SFAttachmentObjPtrMap _sfAttachments
Type information


FieldFlags_pFieldFlags
MFChangedFunctorCallback _mfChangedFunctors
Int32 _iRefCount
Member


BitVector _bvChanged
ContainerChangeEntry_pContainerChanges
UInt32 _uiContainerId

Static Protected Attributes

static TypeObject _type

Private Member Functions

void operator= (const Camera &source)

Friends

class FieldContainer
class CameraBase

Detailed Description

The Camera base class, see PageSystemWindowCamera for a description.

The only common fields are _sfNear and _sfFar.

Definition at line 62 of file OSGCamera.h.


Member Typedef Documentation

Definition at line 70 of file OSGAttachmentContainer.h.

typedef FieldContainerAttachmentPtr OSG::AttachmentContainer::AttachmentObjPtr [inherited]

Definition at line 71 of file OSGAttachmentContainer.h.

typedef SFFieldContainerAttachmentPtrMap OSG::AttachmentContainer::SFAttachmentObjPtrMap [inherited]

Definition at line 72 of file OSGAttachmentContainer.h.

typedef SFAttachmentObjPtrMap::StoredType OSG::AttachmentContainer::AttachmentObjPtrMap [inherited]

Definition at line 74 of file OSGAttachmentContainer.h.

typedef AttachmentObjPtrMap::iterator OSG::AttachmentContainer::AttachmentObjPtrMapIt [inherited]

Definition at line 75 of file OSGAttachmentContainer.h.

typedef Field*(ReflexiveContainer::*) OSG::ReflexiveContainer::FieldEditMethod(void) [inherited]

Definition at line 79 of file OSGReflexiveContainer.h.

typedef const Field*(ReflexiveContainer::*) OSG::ReflexiveContainer::FieldGetMethod(void) const [inherited]

Definition at line 81 of file OSGReflexiveContainer.h.


Member Enumeration Documentation

anonymous enum [inherited]

Enumerator:
BeaconFieldId 
NearFieldId 
FarFieldId 
NextFieldId 

Definition at line 96 of file OSGCameraBase.h.

00097     {
00098         BeaconFieldId = Inherited::NextFieldId,
00099         NearFieldId = BeaconFieldId + 1,
00100         FarFieldId = NearFieldId + 1,
00101         NextFieldId = FarFieldId + 1
00102     };


Constructor & Destructor Documentation

Camera::Camera ( void   )  [protected]

Definition at line 78 of file OSGCamera.cpp.

00078                    :
00079     Inherited()
00080 {
00081 }

Camera::Camera ( const Camera source  )  [protected]

Definition at line 83 of file OSGCamera.cpp.

00083                                    :
00084     Inherited(source)
00085 {
00086 }

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

Definition at line 88 of file OSGCamera.cpp.

00089 {
00090 }


Member Function Documentation

void Camera::changed ( ConstFieldMaskArg  whichField,
UInt32  origin,
BitVector  detail 
) [virtual]

virtual void OSG::Camera::setup ( DrawActionBase action,
const Viewport port 
) [virtual]

virtual void OSG::Camera::setupProjection ( DrawActionBase action,
const Viewport port 
) [virtual]

virtual void OSG::Camera::getProjection ( Matrixr result,
UInt32  width,
UInt32  height 
) [virtual]

virtual void OSG::Camera::getProjectionTranslation ( Matrixr result,
UInt32  width,
UInt32  height 
) [virtual]

virtual void OSG::Camera::getViewing ( Matrixr result,
UInt32  width,
UInt32  height 
) [virtual]

void Camera::getFrustum ( FrustumVolume result,
const Viewport p 
) [virtual]

Calculate the frustum of this camera's visible area.

Definition at line 201 of file OSGCamera.cpp.

References getProjection(), getProjectionTranslation(), getViewing(), OSG::TransformationMatrix< ValueTypeT >::mult(), OSG::p, and OSG::FrustumVolume::setPlanes().

Referenced by getFrustumVal(), OSG::RenderTraversalActionBase::start(), and OSG::DrawActionBase::start().

00202 {
00203     Matrixr mv,prt,pr;
00204 
00205     getProjection           (pr , p.getPixelWidth(), p.getPixelHeight());
00206     getProjectionTranslation(prt, p.getPixelWidth(), p.getPixelHeight());
00207     getViewing              (mv , p.getPixelWidth(), p.getPixelHeight());
00208 
00209     pr.mult(prt);
00210     pr.mult(mv );
00211 
00212     result.setPlanes(pr);
00213 }

void Camera::getWorldToScreen ( Matrixr result,
const Viewport p 
) [virtual]

Calculate the matrix that transforms world coordinates into the screen coordinate system for this camera.

Definition at line 219 of file OSGCamera.cpp.

References getProjection(), getProjectionTranslation(), getViewing(), OSG::TransformationMatrix< ValueTypeT >::mult(), and OSG::p.

Referenced by getWorldToScreenVal(), OSG::ScreenLOD::renderEnter(), and OSG::RenderAction::start().

00220 {
00221     Matrixr mv,prt,pr;
00222 
00223     getProjection           (result, p.getPixelWidth(), p.getPixelHeight());
00224     getProjectionTranslation(prt   , p.getPixelWidth(), p.getPixelHeight());
00225     getViewing              (mv    , p.getPixelWidth(), p.getPixelHeight());
00226 
00227     result.mult(prt);
00228     result.mult(mv );
00229 }

void Camera::getDecoration ( Matrixr result,
UInt32  width,
UInt32  height 
) [virtual]

Get/calculate the decoration matrix for this camera. The default is identity.

Reimplemented in OSG::TileCameraDecorator, and OSG::ShearedStereoCameraDecorator.

Definition at line 235 of file OSGCamera.cpp.

References OSG::TransformationMatrix< ValueTypeT >::setIdentity().

Referenced by OSG::PolygonBackground::clear(), OSG::PolygonForeground::draw(), and getDecorationVal().

00236 {
00237     result.setIdentity();
00238 }

Matrixr Camera::getProjectionVal ( UInt32  width,
UInt32  height 
) [virtual]

Definition at line 241 of file OSGCamera.cpp.

References getProjection().

00243 {
00244    Matrixr temp_mat;
00245    this->getProjection(temp_mat, width,height);
00246    return temp_mat;
00247 }

Matrixr Camera::getProjectionTranslationVal ( UInt32  width,
UInt32  height 
) [virtual]

Definition at line 249 of file OSGCamera.cpp.

References getProjectionTranslation().

00251 {
00252    Matrixr temp_mat;
00253    this->getProjectionTranslation(temp_mat, width, height);
00254    return temp_mat;
00255 }

Matrixr Camera::getViewingVal ( UInt32  width,
UInt32  height 
) [virtual]

Definition at line 257 of file OSGCamera.cpp.

References getViewing().

00259 {
00260    Matrixr temp_mat;
00261    this->getViewing(temp_mat, width, height);
00262    return temp_mat;
00263 }

Matrixr Camera::getWorldToScreenVal ( const Viewport port  )  [virtual]

Definition at line 272 of file OSGCamera.cpp.

References getWorldToScreen().

00273 {
00274    Matrixr temp_mat;
00275    this->getWorldToScreen(temp_mat, port);
00276    return temp_mat;
00277 }

Matrixr Camera::getDecorationVal ( UInt32  width,
UInt32  height 
) [virtual]

Definition at line 279 of file OSGCamera.cpp.

References getDecoration().

00280 {
00281    Matrixr temp_mat;
00282    this->getDecoration(temp_mat, width, height);
00283    return temp_mat;
00284 }

FrustumVolume Camera::getFrustumVal ( const Viewport port  )  [virtual]

Definition at line 265 of file OSGCamera.cpp.

References getFrustum().

00266 {
00267    FrustumVolume vol;
00268    this->getFrustum(vol, port);
00269    return vol;
00270 }

bool Camera::calcViewRay ( Line line,
Int32  x,
Int32  y,
const Viewport port 
)

Definition at line 292 of file OSGCamera.cpp.

References OSG::Viewport::getParent(), OSG::Viewport::getPixelHeight(), OSG::Viewport::getPixelLeft(), OSG::Viewport::getPixelTop(), OSG::Viewport::getPixelWidth(), getProjection(), getProjectionTranslation(), getViewing(), OSG::TransformationMatrix< ValueTypeT >::invertFrom(), OSG::TransformationMatrix< ValueTypeT >::mult(), OSG::TransformationMatrix< ValueTypeT >::multFullMatrixPnt(), and OSG::Line::setValue().

00293 {
00294     if(port.getPixelWidth() <= 0 || port.getPixelHeight() <= 0)
00295     {
00296         return false;
00297     }
00298 
00299     Matrix proj, projtrans, view;
00300 
00301     getProjection(proj,
00302                   port.getPixelWidth(),
00303                   port.getPixelHeight());
00304 
00305     getProjectionTranslation(projtrans,
00306                              port.getPixelWidth(),
00307                              port.getPixelHeight());
00308 
00309     getViewing(view,
00310                port.getPixelWidth(),
00311                port.getPixelHeight());
00312 
00313     Matrix wctocc = proj;
00314 
00315     wctocc.mult(projtrans);
00316     wctocc.mult(view);
00317 
00318     Matrix cctowc;
0031