#include <OSGCamera.h>
Inheritance diagram for osg::Camera:

Public Types | |
| typedef CameraPtr | Ptr |
| enum | { BeaconFieldId = Inherited::NextFieldId, NearFieldId = BeaconFieldId + 1, FarFieldId = NearFieldId + 1, NextFieldId = FarFieldId + 1 } |
Public Member Functions | |
transformation | |
| *virtual void | changed (BitVector whichField, UInt32 origin) |
Setup Rendering | |
| *virtual void | setup (DrawActionBase *action, const Viewport &port) |
| virtual void | setupProjection (DrawActionBase *action, const Viewport &port) |
| virtual void | draw (DrawAction *action, const Viewport &port) |
Access Parameters | |
| *virtual void | getProjection (Matrix &result, UInt32 width, UInt32 height) |
| virtual void | getProjectionTranslation (Matrix &result, UInt32 width, UInt32 height) |
| virtual void | getViewing (Matrix &result, UInt32 width, UInt32 height) |
| virtual void | getFrustum (FrustumVolume &result, const Viewport &port) |
| virtual void | getWorldToScreen (Matrix &result, 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 FieldContainerType & | getType (void) |
| virtual const FieldContainerType & | getType (void) const |
| virtual UInt32 | getContainerSize (void) const |
Field Get | |
| *virtual SFNodePtr * | getSFBeacon (void) |
| virtual SFReal32 * | getSFNear (void) |
| virtual SFReal32 * | getSFFar (void) |
| virtual NodePtr & | getBeacon (void) |
| virtual const NodePtr & | getBeacon (void) const |
| virtual Real32 & | getNear (void) |
| virtual const Real32 & | getNear (void) const |
| virtual Real32 & | getFar (void) |
| virtual const Real32 & | getFar (void) const |
Field Set | |
| *virtual void | setBeacon (const NodePtr &value) |
| virtual void | setNear (const Real32 &value) |
| virtual void | setFar (const Real32 &value) |
Binary Access | |
| *virtual UInt32 | getBinSize (const BitVector &whichField) |
| virtual void | copyToBin (BinaryDataHandler &pMem, const BitVector &whichField) |
| virtual void | copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField) |
Clone | |
| *virtual FieldContainerPtr | shallowCopy (void) const =0 |
Static Public Member Functions | |
Class Get | |
| *static const char * | getClassname (void) |
Class Get | |
| *static FieldContainerType & | getClassType (void) |
| access the type of the class | |
| static UInt32 | getClassTypeId (void) |
| access the numerical type of the class | |
Static Public Attributes | |
| static const osg::BitVector | BeaconFieldMask |
| static const osg::BitVector | NearFieldMask |
| static const osg::BitVector | FarFieldMask |
| static const osg::BitVector | MTInfluenceMask |
| static const BitVector | AttachmentsFieldMask |
| static const BitVector | NextFieldMask |
CoredNodePtr helper | |
| static const bool | isNodeCore = false |
Protected Member Functions | |
Constructors | |
| * | Camera (void) |
| Camera (const Camera &source) | |
Destructors | |
| *virtual | ~Camera (void) |
Sync | |
| *void | executeSyncImpl (CameraBase *pOther, const BitVector &whichField) |
| virtual void | executeSync (FieldContainer &other, const BitVector &whichField) |
MT Destruction | |
| *virtual void | onDestroy (void) |
Protected Attributes | |
Fields | |
| *SFNodePtr | _sfBeacon |
| SFReal32 | _sfNear |
| SFReal32 | _sfFar |
Private Types | |
| typedef CameraBase | Inherited |
Private Member Functions | |
| void | operator= (const Camera &source) |
Static Private Member Functions | |
| static void | initMethod (void) |
Friends | |
| class | FieldContainer |
| class | CameraBase |
The only common fields are _sfNear and _sfFar.
Definition at line 64 of file OSGCamera.h.
|
|
|
|
Reimplemented from osg::AttachmentContainer. Definition at line 94 of file OSGCameraBase.h. 00095 { 00096 BeaconFieldId = Inherited::NextFieldId, 00097 NearFieldId = BeaconFieldId + 1, 00098 FarFieldId = NearFieldId + 1, 00099 NextFieldId = FarFieldId + 1 00100 };
|
|
|
Definition at line 84 of file OSGCamera.cpp. 00084 : 00085 Inherited() 00086 { 00087 }
|
|
|
Definition at line 89 of file OSGCamera.cpp. 00089 : 00090 Inherited(source) 00091 { 00092 }
|
|
|
Definition at line 94 of file OSGCamera.cpp.
|
|
|
Reimplemented in osg::MatrixCamera, osg::OffCenterPerspectiveCamera, osg::PerspectiveCamera, and osg::TileCameraDecorator. Definition at line 73 of file OSGCamera.h.
|
|
||||||||||||
|
Reimplemented from osg::AttachmentContainer. Reimplemented in osg::CameraDecorator, osg::MatrixCamera, osg::MatrixCameraDecorator, osg::OffCenterPerspectiveCamera, osg::PerspectiveCamera, osg::ProjectionCameraDecorator, osg::ShearedStereoCameraDecorator, osg::StereoCameraDecorator, and osg::TileCameraDecorator. Definition at line 98 of file OSGCamera.cpp. References osg::AttachmentContainer::changed(). Referenced by osg::PerspectiveCamera::changed(), osg::MatrixCamera::changed(), and osg::CameraDecorator::changed(). 00099 { 00100 Inherited::changed(whichField, origin); 00101 }
|
|
||||||||||||
|
Setup OpenGL for rendering, call all the necessary commands to start rendering with this camera. Definition at line 109 of file OSGCamera.cpp. References osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), getProjection(), getProjectionTranslation(), osg::TransformationMatrix< ValueTypeT >::getValues(), getViewing(), and osg::TransformationMatrix< ValueTypeT >::mult(). 00111 { 00112 Matrix m, t; 00113 00114 // set the projection 00115 00116 getProjection ( m, port.getPixelWidth(), port.getPixelHeight() ); 00117 getProjectionTranslation( t, port.getPixelWidth(), port.getPixelHeight() ); 00118 00119 m.mult(t); 00120 00121 //SDEBUG << "Projection matrix: " << m << std::endl; 00122 00123 glMatrixMode( GL_PROJECTION ); 00124 glLoadMatrixf( m.getValues() ); 00125 00126 // set the viewing 00127 00128 getViewing( m, port.getPixelWidth(), port.getPixelHeight() ); 00129 00130 //SDEBUG << "Viewing matrix: " << m << std::endl; 00131 00132 glMatrixMode( GL_MODELVIEW ); 00133 glLoadMatrixf( m.getValues() ); 00134 }
|
|
||||||||||||
|
Setup OpenGL projection for rendering. Definition at line 138 of file OSGCamera.cpp. References osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), getProjection(), getProjectionTranslation(), osg::TransformationMatrix< ValueTypeT >::getValues(), and osg::TransformationMatrix< ValueTypeT >::mult(). Referenced by osg::RenderAction::start(). 00140 { 00141 Matrix m, t; 00142 00143 // set the projection 00144 00145 getProjection ( m, port.getPixelWidth(), port.getPixelHeight() ); 00146 getProjectionTranslation( t, port.getPixelWidth(), port.getPixelHeight() ); 00147 00148 m.mult(t); 00149 00150 //SDEBUG << "Projection matrix: " << m << std::endl; 00151 00152 glMatrixMode( GL_PROJECTION ); 00153 glLoadMatrixf( m.getValues() ); 00154 }
|
|
||||||||||||
|
Draw the camera's geometry (if any). Usually there is none. Reimplemented in osg::CameraDecorator, osg::MatrixCamera, osg::OffCenterPerspectiveCamera, and osg::PerspectiveCamera. Definition at line 158 of file OSGCamera.cpp.
|
|
||||||||||||||||
|
Get/calculate the projection matrix for this camera. Reimplemented in osg::CameraDecorator, osg::MatrixCamera, osg::MatrixCameraDecorator, osg::OffCenterPerspectiveCamera, osg::PerspectiveCamera, osg::ProjectionCameraDecorator, osg::ShearedStereoCameraDecorator, and osg::TileCameraDecorator. Definition at line 165 of file OSGCamera.cpp. References SFATAL. Referenced by calcViewRay(), osg::SkyBackground::clear(), osg::DVRIsoShader::getCoveredScreenRect(), getFrustum(), getWorldToScreen(), setup(), and setupProjection(). 00168 { 00169 SFATAL << "Camera::getProjection: NIY" << std::endl; 00170 abort(); 00171 }
|
|
||||||||||||||||
|
Get/calculate the projection translation matrix for this camera. The default is identity. Reimplemented in osg::CameraDecorator, osg::MatrixCameraDecorator, and osg::ProjectionCameraDecorator. Definition at line 176 of file OSGCamera.cpp. References osg::TransformationMatrix< ValueTypeT >::setIdentity(). Referenced by calcViewRay(), osg::SkyBackground::clear(), osg::DVRIsoShader::getCoveredScreenRect(), getFrustum(), getWorldToScreen(), setup(), and setupProjection(). 00179 { 00180 result.setIdentity(); 00181 }
|
|
||||||||||||||||
|
||||||||||||
|
Calculate the frustum of this camera's visible area. Definition at line 202 of file OSGCamera.cpp. References osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), getProjection(), getProjectionTranslation(), getViewing(), osg::TransformationMatrix< ValueTypeT >::mult(), and osg::FrustumVolume::setPlanes(). Referenced by osg::DrawActionBase::start(). 00203 { 00204 Matrix mv,prt,pr; 00205 00206 getProjection (pr , p.getPixelWidth(), p.getPixelHeight()); 00207 getProjectionTranslation(prt, p.getPixelWidth(), p.getPixelHeight()); 00208 getViewing (mv , p.getPixelWidth(), p.getPixelHeight()); 00209 00210 pr.mult(prt); 00211 pr.mult(mv ); 00212 00213 result.setPlanes(pr); 00214 }
|
|
||||||||||||
|
Calculate the matrix that transforms world coordinates into the screen coordinate system for this camera. Definition at line 219 of file OSGCamera.cpp. References osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), getProjection(), getProjectionTranslation(), getViewing(), and osg::TransformationMatrix< ValueTypeT >::mult(). 00220 { 00221 Matrix 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 }
|
|
||||||||||||||||||||
|
Calculate a ray that starts at the camera position and goes through the pixel x, y in the viewport port. x and y are relative to the viewport's lower left corner. Definition at line 235 of file OSGCamera.cpp. References osg::ViewportBase::getParent(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelLeft(), osg::Viewport::getPixelTop(), osg::Viewport::getPixelWidth(), getProjection(), getProjectionTranslation(), getViewing(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::TransformationMatrix< ValueTypeT >::invertFrom(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::TransformationMatrix< ValueTypeT >::multFullMatrixPnt(), and osg::Line::setValue(). 00236 { 00237 if(port.getPixelWidth() <= 0 || port.getPixelHeight() <= 0) 00238 { 00239 return false; 00240 } 00241 00242 Matrix proj, projtrans, view; 00243 00244 getProjection(proj, port.getPixelWidth(), port.getPixelHeight()); 00245 getProjectionTranslation(projtrans, port.getPixelWidth(), 00246 port.getPixelHeight()); 00247 getViewing(view, port.getPixelWidth(), port.getPixelHeight()); 00248 00249 Matrix wctocc = proj; 00250 wctocc.mult(projtrans); 00251 wctocc.mult(view); 00252 00253 Matrix cctowc; 00254 cctowc.invertFrom(wctocc); 00255 00256 Real32 rx = (x - port.getPixelLeft()) / (Real32) port.getPixelWidth() 00257 * 2.f - 1.f, 00258 ry = 1.f - ((y - (port.getParent()->getHeight() - 00259 port.getPixelTop()) 00260 ) / 00261 (Real32) port.getPixelHeight() 00262 ) * 2.f; 00263 00264 view.invert(); 00265 Pnt3f from(view[3][0], view[3][1], view[3][2]); 00266 00267 Pnt3f at; 00268 cctowc.multFullMatrixPnt(Pnt3f(rx, ry, 1), at); 00269 00270 line.setValue(from, at-from); 00271 00272 return true; 00273 }
|
|
||||||||||||
|
Reimplemented from osg::AttachmentContainer. Reimplemented in osg::CameraDecorator, osg::MatrixCamera, osg::MatrixCameraDecorator, osg::OffCenterPerspectiveCamera, osg::PerspectiveCamera, osg::ProjectionCameraDecorator, osg::ShearedStereoCameraDecorator, osg::StereoCameraDecorator, and osg::TileCameraDecorator. Definition at line 277 of file OSGCamera.cpp. References SLOG. 00279 { 00280 SLOG << "Dump Camera NI" << std::endl; 00281 }
|
|
|
Reimplemented in osg::CameraDecorator, osg::MatrixCamera, osg::MatrixCameraDecorator, osg::OffCenterPerspectiveCamera, osg::PerspectiveCamera, osg::ProjectionCameraDecorator, osg::ShearedStereoCameraDecorator, osg::StereoCameraDecorator, and osg::TileCameraDecorator. Definition at line 76 of file OSGCamera.cpp.
|
|
|
|
|
|
Reimplemented from osg::AttachmentContainer. Reimplemented in osg::CameraDecoratorBase, osg::MatrixCameraBase, osg::MatrixCameraDecoratorBase, osg::OffCenterPerspectiveCameraBase, osg::PerspectiveCameraBase, osg::ProjectionCameraDecoratorBase, osg::ShearedStereoCameraDecoratorBase, osg::StereoCameraDecoratorBase, and osg::TileCameraDecoratorBase. Definition at line 58 of file OSGCameraBase.inl. References osg::CameraBase::_type. 00059 { 00060 return _type; 00061 }
|
|
|
Reimplemented from osg::AttachmentContainer. Reimplemented in osg::CameraDecoratorBase, osg::MatrixCameraBase, osg::MatrixCameraDecoratorBase, osg::OffCenterPerspectiveCameraBase, osg::PerspectiveCameraBase, osg::ProjectionCameraDecoratorBase, osg::ShearedStereoCameraDecoratorBase, osg::StereoCameraDecoratorBase, and osg::TileCameraDecoratorBase. Definition at line 65 of file OSGCameraBase.inl. References osg::CameraBase::_type, and osg::TypeBase::getId(). 00066 { 00067 return _type.getId(); 00068 }
|
|
|
Reimplemented from osg::AttachmentContainer. Reimplemented in osg::CameraDecoratorBase, osg::MatrixCameraBase, osg::MatrixCameraDecoratorBase, osg::OffCenterPerspectiveCameraBase, osg::PerspectiveCameraBase, osg::ProjectionCameraDecoratorBase, osg::ShearedStereoCameraDecoratorBase, osg::StereoCameraDecoratorBase, and osg::TileCameraDecoratorBase. Definition at line 128 of file OSGCameraBase.cpp. References osg::CameraBase::_type. 00129 { 00130 return _type; 00131 }
|
|
|
Reimplemented from osg::AttachmentContainer. Reimplemented in osg::CameraDecoratorBase, osg::MatrixCameraBase, osg::MatrixCameraDecoratorBase, osg::OffCenterPerspectiveCameraBase, osg::PerspectiveCameraBase, osg::ProjectionCameraDecoratorBase, osg::ShearedStereoCameraDecoratorBase, osg::StereoCameraDecoratorBase, and osg::TileCameraDecoratorBase. Definition at line 133 of file OSGCameraBase.cpp. References osg::CameraBase::_type. 00134 { 00135 return _type; 00136 }
|
|
|
Reimplemented from osg::AttachmentContainer. Reimplemented in osg::CameraDecoratorBase, osg::MatrixCameraBase, osg::MatrixCameraDecoratorBase, osg::OffCenterPerspectiveCameraBase, osg::PerspectiveCameraBase, osg::ProjectionCameraDecoratorBase, osg::ShearedStereoCameraDecoratorBase, osg::StereoCameraDecoratorBase, and osg::TileCameraDecoratorBase. Definition at line 139 of file OSGCameraBase.cpp. 00140 { 00141 return sizeof(Camera); 00142 }
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 325 of file OSGCameraBase.cpp. References osg::CameraBase::_sfBeacon. 00326 { 00327 return &_sfBeacon; 00328 }
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 331 of file OSGCameraBase.cpp. References osg::CameraBase::_sfNear. 00332 { 00333 return &_sfNear; 00334 }
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 337 of file OSGCameraBase.cpp. References osg::CameraBase::_sfFar. 00338 { 00339 return &_sfFar; 00340 }
|
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 350 of file OSGCameraBase.cpp. References osg::CameraBase::_sfBeacon, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 362 of file OSGCameraBase.cpp. References osg::CameraBase::_sfNear, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). Referenced by osg::SkyBackground::clear(), osg::PerspectiveCamera::getProjection(), and osg::OffCenterPerspectiveCamera::getProjection().
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 368 of file OSGCameraBase.cpp. References osg::CameraBase::_sfNear, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 380 of file OSGCameraBase.cpp. References osg::CameraBase::_sfFar, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). Referenced by osg::SkyBackground::clear(), osg::PerspectiveCamera::getProjection(), and osg::OffCenterPerspectiveCamera::getProjection().
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 386 of file OSGCameraBase.cpp. References osg::CameraBase::_sfFar, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 356 of file OSGCameraBase.cpp. References osg::CameraBase::_sfBeacon, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 374 of file OSGCameraBase.cpp. References osg::CameraBase::_sfNear, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().
|
|
|
Reimplemented in osg::CameraDecoratorBase. Definition at line 392 of file OSGCameraBase.cpp. References osg::CameraBase::_sfFar, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().
|
|