#include <OSGOffCenterPerspectiveCamera.h>
Inheritance diagram for osg::OffCenterPerspectiveCamera:

Public Types | |
| typedef OffCenterPerspectiveCameraPtr | Ptr |
| enum | { PrincipalPointFieldId = Inherited::NextFieldId, NextFieldId = PrincipalPointFieldId + 1 } |
Public Member Functions | |
transformation | |
| *virtual void | changed (BitVector whichField, UInt32 origin) |
your_category | |
| *virtual void | draw (DrawAction *action, const Viewport &port) |
| virtual void | getProjection (Matrix &result, UInt32 width, UInt32 height) |
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 | |
| *SFVec2f * | getSFPrincipalPoint (void) |
| Get the OffCenterPerspectiveCamera::_sfPrincipalPoint field. | |
| Vec2f & | getPrincipalPoint (void) |
| Get the value of the OffCenterPerspectiveCamera::_sfPrincipalPoint field. | |
| const Vec2f & | getPrincipalPoint (void) const |
| Get the value of the OffCenterPerspectiveCamera::_sfPrincipalPoint field. | |
Field Set | |
| *void | setPrincipalPoint (const Vec2f &value) |
| Set the value of the OffCenterPerspectiveCamera::_sfPrincipalPoint field. | |
Binary Access | |
| *virtual UInt32 | getBinSize (const BitVector &whichField) |
| virtual void | copyToBin (BinaryDataHandler &pMem, const BitVector &whichField) |
| virtual void | copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField) |
Copy | |
| *virtual FieldContainerPtr | shallowCopy (void) const |
Field Get | |
| *SFReal32 * | getSFFov (void) |
| Get the PerspectiveCamera::_sfFov field. | |
| SFReal32 * | getSFAspect (void) |
| Get the PerspectiveCamera::_sfAspect field. | |
| Real32 & | getFov (void) |
| Get the value of the PerspectiveCamera::_sfFov field. | |
| const Real32 & | getFov (void) const |
| Get the value of the PerspectiveCamera::_sfFov field. | |
| Real32 & | getAspect (void) |
| Get the value of the PerspectiveCamera::_sfAspect field. | |
| const Real32 & | getAspect (void) const |
| Get the value of the PerspectiveCamera::_sfAspect field. | |
Field Set | |
| *void | setFov (const Real32 &value) |
| Set the value of the PerspectiveCamera::_sfFov field. | |
| void | setAspect (const Real32 &value) |
| Set the value of the PerspectiveCamera::_sfAspect field. | |
Setup Rendering | |
| *virtual void | setup (DrawActionBase *action, const Viewport &port) |
| virtual void | setupProjection (DrawActionBase *action, const Viewport &port) |
Access Parameters | |
| 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) |
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) |
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 | |
Construction | |
| *static OffCenterPerspectiveCameraPtr | create (void) |
| create a new instance of the class | |
| static OffCenterPerspectiveCameraPtr | createEmpty (void) |
| create an empty new instance of the class, do not copy the prototype | |
Static Public Attributes | |
| static const osg::BitVector | PrincipalPointFieldMask |
| static const osg::BitVector | MTInfluenceMask |
| static const osg::BitVector | FovFieldMask |
| static const osg::BitVector | AspectFieldMask |
| static const osg::BitVector | BeaconFieldMask |
| static const osg::BitVector | NearFieldMask |
| static const osg::BitVector | FarFieldMask |
| static const BitVector | AttachmentsFieldMask |
| static const BitVector | NextFieldMask |
Protected Member Functions | |
Constructors | |
| * | OffCenterPerspectiveCamera (void) |
| OffCenterPerspectiveCamera (const OffCenterPerspectiveCamera &source) | |
Destructors | |
| *virtual | ~OffCenterPerspectiveCamera (void) |
Sync | |
| *void | executeSyncImpl (OffCenterPerspectiveCameraBase *pOther, const BitVector &whichField) |
| virtual void | executeSync (FieldContainer &other, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (PerspectiveCameraBase *pOther, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (CameraBase *pOther, const BitVector &whichField) |
Protected Attributes | |
Fields | |
| *SFVec2f | _sfPrincipalPoint |
Fields | |
| *SFReal32 | _sfFov |
| SFReal32 | _sfAspect |
Fields | |
| *SFNodePtr | _sfBeacon |
| SFReal32 | _sfNear |
| SFReal32 | _sfFar |
Private Types | |
| typedef OffCenterPerspectiveCameraBase | Inherited |
Private Member Functions | |
| void | operator= (const OffCenterPerspectiveCamera &source) |
| bool | MatrixPerspectivePrincipalPnt (Matrix &result, Real32 rFovy, Real32 rAspect, Real32 rNear, Real32 rFar, Real32 rPrincipalPointX, Real32 rPrincipalPointY) |
Static Private Member Functions | |
| static void | initMethod (void) |
Friends | |
| class | FieldContainer |
| class | OffCenterPerspectiveCameraBase |
The only new parameter is the _sfPrincipalPoint field.
The OffCenter Perspective Camera provides a more general camera than the Perspective Camera. The viewing frustrum is by default the same as given by the Perspective Camera. Iff principal points params are unequal zero the viewing frustrums parameters (left,right,top,bottom) are simple shifted in the camera's image plane. The principal point parameters are relative to left--right (or respectively bottom--top). A value of x=2 means the left value is equal to default right value. A value of x=-2 means the right value is equal to default left value. Marginal note: Iff the principal point is unequal zero the field of view value is unequal to the real field of view of the camera. (mail to: dherzog (at) mip.informatik.uni-kiel.de)
Definition at line 59 of file OSGOffCenterPerspectiveCamera.h.
|
|
Reimplemented from osg::OffCenterPerspectiveCameraBase. Definition at line 117 of file OSGOffCenterPerspectiveCamera.h. |
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 90 of file OSGOffCenterPerspectiveCameraBase.h. |
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 92 of file OSGOffCenterPerspectiveCameraBase.h. 00093 { 00094 PrincipalPointFieldId = Inherited::NextFieldId, 00095 NextFieldId = PrincipalPointFieldId + 1 00096 };
|
|
|
Definition at line 117 of file OSGOffCenterPerspectiveCamera.cpp. 00117 : 00118 Inherited() 00119 { 00120 }
|
|
|
Definition at line 123 of file OSGOffCenterPerspectiveCamera.cpp. 00123 : 00124 Inherited(source) 00125 { 00126 }
|
|
|
Definition at line 128 of file OSGOffCenterPerspectiveCamera.cpp.
|
|
|
Reimplemented from osg::PerspectiveCamera. Definition at line 68 of file OSGOffCenterPerspectiveCamera.h.
|
|
||||||||||||
|
Reimplemented from osg::PerspectiveCamera. Definition at line 132 of file OSGOffCenterPerspectiveCamera.cpp. References osg::PerspectiveCamera::changed(). 00133 { 00134 Inherited::changed(whichField, origin); 00135 }
|
|
||||||||||||
|
Draw the camera's geometry (if any). Usually there is none. Reimplemented from osg::PerspectiveCamera. Definition at line 139 of file OSGOffCenterPerspectiveCamera.cpp.
|
|
||||||||||||||||
|
Get/calculate the projection matrix for this camera. Reimplemented from osg::PerspectiveCamera. Definition at line 201 of file OSGOffCenterPerspectiveCamera.cpp. References osg::PerspectiveCameraBase::getAspect(), osg::CameraBase::getFar(), osg::PerspectiveCameraBase::getFov(), osg::CameraBase::getNear(), osg::OffCenterPerspectiveCameraBase::getPrincipalPoint(), osg::MatrixPerspective(), MatrixPerspectivePrincipalPnt(), osg::osgdegree2rad(), osg::Pi, and osg::TransformationMatrix< ValueTypeT >::setIdentity(). 00203 { 00204 Real32 fov = getFov(); 00205 00206 // catch some illegal cases 00207 if(fov < 0 || width == 0 || height == 0) 00208 { 00209 result.setIdentity(); 00210 return; 00211 } 00212 00213 // try to be nice to people giving degrees... 00214 if(fov > Pi) 00215 fov = osgdegree2rad(fov); 00216 00217 Real32 principalPointX = getPrincipalPoint()[0]; 00218 Real32 principalPointY = getPrincipalPoint()[1]; 00219 00220 // if principal point (x,y) is default (==(0,0)) everything works 00221 // like before or rather for an symmetical camera 00222 if ( principalPointX==Real32(0) && principalPointY==Real32(0) ) { 00223 MatrixPerspective(result, fov / 2, 00224 width /(Real32) height * getAspect(), 00225 getNear(), getFar()); 00226 } 00227 else { 00228 MatrixPerspectivePrincipalPnt(result, fov / 2, 00229 width /(Real32) height * getAspect(), 00230 getNear(), getFar(), 00231 principalPointX, principalPointY); 00232 } 00233 }
|
|
||||||||||||
|
Reimplemented from osg::PerspectiveCamera. Definition at line 238 of file OSGOffCenterPerspectiveCamera.cpp. References SLOG. 00240 { 00241 SLOG << "Dump OffCenterPerspectiveCamera NI" << std::endl; 00242 }
|
|
|
Reimplemented from osg::PerspectiveCamera. Definition at line 102 of file OSGOffCenterPerspectiveCamera.cpp.
|
|
|
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 145 of file OSGOffCenterPerspectiveCamera.cpp. References osg::Eps, osg::MatrixFrustum(), osg::osgabs(), osg::osgtan(), osg::TransformationMatrix< ValueTypeT >::setIdentity(), and SWARNING. Referenced by getProjection(). 00152 { 00153 Real32 ct = osgtan(rFovy); 00154 bool error = false; 00155 00156 if(rNear > rFar) 00157 { 00158 SWARNING << "MatrixPerspective: near " << rNear << " > far " << rFar 00159 << "!\n" << std::endl; 00160 error = true; 00161 } 00162 00163 if(rFovy <= Eps) 00164 { 00165 SWARNING << "MatrixPerspective: fovy " << rFovy << " very small!\n" 00166 << std::endl; 00167 error = true; 00168 } 00169 00170 if(osgabs(rNear - rFar) < Eps) 00171 { 00172 SWARNING << "MatrixPerspective: near " << rNear << " ~= far " << rFar 00173 << "!\n" << std::endl; 00174 error = true; 00175 } 00176 00177 if(rAspect < Eps) 00178 { 00179 SWARNING << "MatrixPerspective: aspect ratio " << rAspect 00180 << " very small!\n" << std::endl; 00181 error = true; 00182 } 00183 00184 if(error) 00185 { 00186 result.setIdentity(); 00187 return true; 00188 } 00189 00190 MatrixFrustum( result, 00191 -rNear * ct * rAspect * (Real32(1)+rPrincipalPointX), 00192 rNear * ct * rAspect * (Real32(1)-rPrincipalPointX), 00193 -rNear * ct * (Real32(1)+rPrincipalPointY), 00194 rNear * ct * (Real32(1)-rPrincipalPointY), 00195 rNear, 00196 rFar ); 00197 00198 return false; 00199 }
|
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 58 of file OSGOffCenterPerspectiveCameraBase.inl. References osg::OffCenterPerspectiveCameraBase::_type. Referenced by osg::OffCenterPerspectiveCameraBase::create(). 00059 { 00060 return _type; 00061 }
|
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 65 of file OSGOffCenterPerspectiveCameraBase.inl. References osg::OffCenterPerspectiveCameraBase::_type, and osg::TypeBase::getId(). 00066 { 00067 return _type.getId(); 00068 }
|
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 106 of file OSGOffCenterPerspectiveCameraBase.cpp. References osg::OffCenterPerspectiveCameraBase::_type. 00107 { 00108 return _type; 00109 }
|
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 111 of file OSGOffCenterPerspectiveCameraBase.cpp. References osg::OffCenterPerspectiveCameraBase::_type. 00112 { 00113 return _type; 00114 }
|
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 126 of file OSGOffCenterPerspectiveCameraBase.cpp. 00127 { 00128 return sizeof(OffCenterPerspectiveCamera); 00129 }
|
|
|
Definition at line 101 of file OSGOffCenterPerspectiveCameraBase.inl. References osg::OffCenterPerspectiveCameraBase::_sfPrincipalPoint. 00102 { 00103 return &_sfPrincipalPoint; 00104 }
|
|
|
Definition at line 109 of file OSGOffCenterPerspectiveCameraBase.inl. References osg::OffCenterPerspectiveCameraBase::_sfPrincipalPoint, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). Referenced by getProjection(). 00110 { 00111 return _sfPrincipalPoint.getValue(); 00112 }
|
|
|
Definition at line 116 of file OSGOffCenterPerspectiveCameraBase.inl. References osg::OffCenterPerspectiveCameraBase::_sfPrincipalPoint, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00117 { 00118 return _sfPrincipalPoint.getValue(); 00119 }
|
|
|
Definition at line 123 of file OSGOffCenterPerspectiveCameraBase.inl. References osg::OffCenterPerspectiveCameraBase::_sfPrincipalPoint, and osg::SField< FieldTypeT, fieldNameSpace >::setValue(). 00124 { 00125 _sfPrincipalPoint.setValue(value); 00126 }
|
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 183 of file OSGOffCenterPerspectiveCameraBase.cpp. References osg::OffCenterPerspectiveCameraBase::_sfPrincipalPoint, osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::PerspectiveCameraBase::getBinSize(), osg::FieldBits::NoField, and osg::OffCenterPerspectiveCameraBase::PrincipalPointFieldMask. 00184 { 00185 UInt32 returnValue = Inherited::getBinSize(whichField); 00186 00187 if(FieldBits::NoField != (PrincipalPointFieldMask & whichField)) 00188 { 00189 returnValue += _sfPrincipalPoint.getBinSize(); 00190 } 00191 00192 00193 return returnValue; 00194 }
|
|
||||||||||||
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 196 of file OSGOffCenterPerspectiveCameraBase.cpp. References osg::OffCenterPerspectiveCameraBase::_sfPrincipalPoint, osg::SField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::PerspectiveCameraBase::copyToBin(), osg::FieldBits::NoField, and osg::OffCenterPerspectiveCameraBase::PrincipalPointFieldMask. 00198 { 00199 Inherited::copyToBin(pMem, whichField); 00200 00201 if(FieldBits::NoField != (PrincipalPointFieldMask & whichField)) 00202 { 00203 _sfPrincipalPoint.copyToBin(pMem); 00204 } 00205 00206 00207 }
|
|
||||||||||||
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 209 of file OSGOffCenterPerspectiveCameraBase.cpp. References osg::OffCenterPerspectiveCameraBase::_sfPrincipalPoint, osg::SField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::PerspectiveCameraBase::copyFromBin(), osg::FieldBits::NoField, and osg::OffCenterPerspectiveCameraBase::PrincipalPointFieldMask. 00211 { 00212 Inherited::copyFromBin(pMem, whichField); 00213 00214 if(FieldBits::NoField != (PrincipalPointFieldMask & whichField)) 00215 { 00216 _sfPrincipalPoint.copyFromBin(pMem); 00217 } 00218 00219 00220 }
|
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 72 of file OSGOffCenterPerspectiveCameraBase.inl. References osg::AttachmentContainerPtr::dcast(), osg::OffCenterPerspectiveCameraBase::getClassType(), osg::FieldContainerType::getPrototype(), osg::NullFC, and osg::OffCenterPerspectiveCameraBase::shallowCopy(). 00073 { 00074 OffCenterPerspectiveCameraPtr fc; 00075 00076 if(getClassType().getPrototype() != OSG::NullFC) 00077 { 00078 fc = OffCenterPerspectiveCameraPtr::dcast( 00079 getClassType().getPrototype()-> shallowCopy()); 00080 } 00081 00082 return fc; 00083 }
|
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 87 of file OSGOffCenterPerspectiveCameraBase.inl. References osg::FieldContainer::newPtr(). 00088 { 00089 OffCenterPerspectiveCameraPtr returnValue; 00090 00091 newPtr(returnValue); 00092 00093 return returnValue; 00094 }
|
|
|
Reimplemented from osg::PerspectiveCameraBase. Definition at line 117 of file OSGOffCenterPerspectiveCameraBase.cpp. References osg::FieldContainer::newPtr(). Referenced by osg::OffCenterPerspectiveCameraBase::create(). 00118 { 00119 OffCenterPerspectiveCameraPtr returnValue; 00120 00121 newPtr(returnValue, dynamic_cast<const OffCenterPerspectiveCamera *>(this)); 00122 00123 return returnValue; 00124 }
|
|
||||||||||||
|
Definition at line 223 of file OSGOffCenterPerspectiveCameraBase.cpp. References osg::OffCenterPerspectiveCameraBase::_sfPrincipalPoint, osg::PerspectiveCameraBase::executeSyncImpl(), osg::FieldBits::NoField, osg::OffCenterPerspectiveCameraBase::PrincipalPointFieldMask, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith(). Referenced by osg::OffCenterPerspectiveCameraBase::executeSync(). 00225 { 00226 00227 Inherited::executeSyncImpl(pOther, whichField); 00228 00229 if(FieldBits::NoField != (PrincipalPointFieldMask & whichField)) 00230 _sfPrincipalPoint.syncWith(pOther->_sfPrincipalPoint); 00231 00232 00233 }
|
|
||||||||||||
|
Definition at line 256 of file OSGPerspectiveCameraBase.cpp. References osg::PerspectiveCameraBase::_sfAspect, osg::PerspectiveCameraBase::_sfFov, osg::PerspectiveCameraBase::AspectFieldMask, osg::CameraBase::executeSyncImpl(), osg::PerspectiveCameraBase::FovFieldMask, osg::FieldBits::NoField, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith(). Referenced by osg::PerspectiveCameraBase::executeSync(), and osg::OffCenterPerspectiveCameraBase::executeSyncImpl(). 00258 { 00259 00260 Inherited::executeSyncImpl(pOther, whichField); 00261 00262 if(FieldBits::NoField != (FovFieldMask & whichField)) 00263 _sfFov.syncWith(pOther->_sfFov); 00264 00265 if(FieldBits::NoField != (AspectFieldMask & whichField)) 00266 _sfAspect.syncWith(pOther->_sfAspect); 00267 00268 00269 }
|
|
||||||||||||
|
Definition at line 275 of file OSGCameraBase.cpp. References osg::CameraBase::_sfBeacon, osg::CameraBase::_sfFar, osg::CameraBase::_sfNear, osg::CameraBase::BeaconFieldMask, osg::AttachmentContainer::executeSyncImpl(), osg::CameraBase::FarFieldMask, osg::CameraBase::NearFieldMask, osg::FieldBits::NoField, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith(). Referenced by osg::CameraBase::executeSync(), osg::PerspectiveCameraBase::executeSyncImpl(), osg::MatrixCameraBase::executeSyncImpl(), and osg::CameraDecoratorBase::executeSyncImpl(). 00277 { 00278 00279 Inherited::executeSyncImpl(pOther, whichField); 00280 00281 if(FieldBits::NoField != (BeaconFieldMask & whichField)) 00282 _sfBeacon.syncWith(pOther->_sfBeacon); 00283 00284 if(FieldBits::NoField != (NearFieldMask & whichField)) 00285 _sfNear.syncWith(pOther->_sfNear); 00286 00287 if(FieldBits::NoField != (FarFieldMask & whichField)) 00288 _sfFar.syncWith(pOther->_sfFar); 00289 00290 00291 }
|
|
||||||||||||
|
||||||||||||
|
Definition at line 333 of file OSGFieldContainerImpl.inl. Referenced by osg::StateBase::executeSyncImpl(), osg::DVRShaderBase::executeSyncImpl(), osg::DVRClipGeometryBase::executeSyncImpl(), osg::AttachmentContainer::executeSyncImpl(), and osg::Attachment::executeSyncImpl().
|
|
|