#include <OSGProjectionCameraDecorator.h>
Inheritance diagram for osg::ProjectionCameraDecorator:

The parameters are defined by the _sfUser and _mfSurface fields.
Dev:
The derived parameters used to actually calculate the matrix are stored in the _sfLeft, _sfBottom, _sfNormal, sfWidth and _sfHeight fields.
Definition at line 55 of file OSGProjectionCameraDecorator.h.
|
|
Reimplemented from osg::ProjectionCameraDecoratorBase. Definition at line 59 of file OSGProjectionCameraDecorator.h. |
|
|
Reimplemented from osg::StereoCameraDecoratorBase. Definition at line 96 of file OSGProjectionCameraDecoratorBase.h. |
|
|
Reimplemented from osg::StereoCameraDecoratorBase. Definition at line 98 of file OSGProjectionCameraDecoratorBase.h. 00099 { 00100 UserFieldId = Inherited::NextFieldId, 00101 SurfaceFieldId = UserFieldId + 1, 00102 LeftFieldId = SurfaceFieldId + 1, 00103 BottomFieldId = LeftFieldId + 1, 00104 NormalFieldId = BottomFieldId + 1, 00105 WidthFieldId = NormalFieldId + 1, 00106 HeightFieldId = WidthFieldId + 1, 00107 NextFieldId = HeightFieldId + 1 00108 };
|
|
|
Definition at line 79 of file OSGProjectionCameraDecorator.cpp. 00079 : 00080 Inherited() 00081 { 00082 }
|
|
|
Definition at line 84 of file OSGProjectionCameraDecorator.cpp. 00084 : 00085 Inherited(source) 00086 { 00087 }
|
|
|
Definition at line 89 of file OSGProjectionCameraDecorator.cpp.
|
|
||||||||||||
|
Reimplemented from osg::StereoCameraDecorator. Definition at line 99 of file OSGProjectionCameraDecorator.cpp. References osg::StereoCameraDecorator::changed(), osg::ProjectionCameraDecoratorBase::SurfaceFieldMask, and updateData(). 00100 { 00101 Inherited::changed(whichField, origin); 00102 00103 if(whichField & SurfaceFieldMask) 00104 updateData(); 00105 }
|
|
||||||||||||
|
Reimplemented from osg::StereoCameraDecorator. Definition at line 107 of file OSGProjectionCameraDecorator.cpp. References SLOG. 00109 { 00110 SLOG << "Dump ProjectionCameraDecorator NI" << std::endl; 00111 }
|
|
||||||||||||||||
|
Get/calculate the viewing matrix for this camera. This is the inverse of the beacon's toWorld transformation. Reimplemented from osg::CameraDecorator. Definition at line 152 of file OSGProjectionCameraDecorator.cpp. References FWARNING, osg::ProjectionCameraDecoratorBase::getUser(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::NullFC, and osg::TransformationMatrix< ValueTypeT >::setIdentity(). 00155 { 00156 if ( getUser() == NullFC ) 00157 { 00158 FWARNING(("ProjectionCameraDecorator::getViewing: no user!")); 00159 result.setIdentity(); 00160 return; 00161 } 00162 00163 getUser()->getToWorld( result ); 00164 result.invert(); 00165 }
|
|
||||||||||||||||
|
Get/calculate the projection matrix for this camera. Reimplemented from osg::CameraDecorator. Definition at line 167 of file OSGProjectionCameraDecorator.cpp. References osg::Plane::distance(), FWARNING, osg::ProjectionCameraDecoratorBase::getBottom(), osg::CameraDecoratorBase::getDecoratee(), osg::StereoCameraDecoratorBase::getEyeSeparation(), osg::ProjectionCameraDecoratorBase::getHeight(), osg::ProjectionCameraDecoratorBase::getLeft(), osg::StereoCameraDecoratorBase::getLeftEye(), osg::ProjectionCameraDecoratorBase::getNormal(), osg::ProjectionCameraDecoratorBase::getUser(), osg::ProjectionCameraDecoratorBase::getWidth(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::MatrixFrustum(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::NullFC, and osg::TransformationMatrix< ValueTypeT >::setIdentity(). 00170 { 00171 CameraPtr camera = getDecoratee(); 00172 00173 if(camera == NullFC) 00174 { 00175 FWARNING(("ProjectionCameraDecorator::getProjection: no decoratee!\n")); 00176 result.setIdentity(); 00177 return; 00178 } 00179 00180 Matrix cam,user; 00181 00182 camera->getBeacon()->getToWorld(cam); 00183 getUser()->getToWorld(user); 00184 cam.invert(); 00185 00186 cam.mult(user); 00187 00188 Pnt3f viewer(cam[3]); 00189 00190 Real32 eyeFac; 00191 00192 if(getLeftEye()) 00193 { 00194 eyeFac=-.5; 00195 } 00196 else 00197 { 00198 eyeFac=+.5; 00199 } 00200 00201 viewer += Vec3f(cam[0]) * eyeFac * getEyeSeparation(); 00202 00203 Real32 dist = getNormal().distance(viewer), 00204 dl = getLeft ().distance(viewer), 00205 db = getBottom().distance(viewer), 00206 f = camera->getNear() / dist; 00207 00208 MatrixFrustum(result, -dl * f, (getWidth ()-dl) * f, 00209 -db * f, (getHeight()-db) * f, 00210 camera->getNear(), camera->getFar() ); 00211 }
|
|
||||||||||||||||
|
Get/calculate the projection translation matrix for this camera. The default is identity. Reimplemented from osg::CameraDecorator. Definition at line 214 of file OSGProjectionCameraDecorator.cpp. References osg::VectorInterface< ValueTypeT, StorageInterfaceT >::cross(), FFATAL, osg::ProjectionCameraDecoratorBase::getBottom(), osg::CameraDecoratorBase::getDecoratee(), osg::StereoCameraDecoratorBase::getEyeSeparation(), osg::StereoCameraDecoratorBase::getLeftEye(), osg::ProjectionCameraDecoratorBase::getNormal(), osg::ProjectionCameraDecoratorBase::getUser(), osg::QuaternionBase< ValueTypeT >::getValue(), osg::QuaternionBase< ValueTypeT >::getValueAsAxisDeg(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::NullFC, osg::TransformationMatrix< ValueTypeT >::setIdentity(), osg::TransformationMatrix< ValueTypeT >::setValue(), and osg::QuaternionBase< ValueTypeT >::setValueAsAxisDeg(). 00217 { 00218 CameraPtr camera = getDecoratee(); 00219 00220 if(camera == NullFC) 00221 { 00222 FFATAL(("ProjectionCameraDecorator::getProjectionTranslation: " 00223 "no decoratee!\n")); 00224 result.setIdentity(); 00225 return; 00226 } 00227 00228 Matrix cam,user; 00229 00230 camera->getBeacon()->getToWorld(cam); 00231 getUser()->getToWorld(user); 00232 00233 cam.invert(); 00234 cam.mult(user); 00235 00236 Vec3f dir(getNormal().getNormal()), 00237 up (getBottom().getNormal()), 00238 right; 00239 Vec3f pos(cam[3]); 00240 00241 Real32 eyeFac; 00242 00243 if(getLeftEye()) 00244 { 00245 eyeFac=-.5; 00246 } 00247 else 00248 { 00249 eyeFac=+.5; 00250 } 00251 00252 pos += Vec3f(cam[0]) * eyeFac * getEyeSeparation(); 00253 00254 right = up.cross(dir); 00255 up = dir.cross(right); 00256 00257 result.setIdentity(); 00258 result.setValue(right, up, dir, pos); 00259 result.invert(); 00260 00261 result.mult(cam); 00262 #if 0 00263 static bool hack = true; 00264 Quaternion q( getNormal().getNormal(), Vec3f(0,0,1)); 00265 00266 Vec3f v; 00267 Real32 a; 00268 q.getValueAsAxisDeg(v,a); 00269 00270 // HACKKK 00271 if(hack && a > 50) 00272 { 00273 q.getValue(result); 00274 00275 Real32 ang1 = 54.44; 00276 Real32 ang2 = 6.27; 00277 00278 if(v[1] < 0) ang1 = -ang1; 00279 00280 Quaternion q1,q2; 00281 Matrix m1,m2; 00282 00283 q1.setValueAsAxisDeg(0,1,0,ang1); 00284 q2.setValueAsAxisDeg(1,0,0,ang2); 00285 00286 q1.getValue(m1); 00287 q2.getValue(m2); 00288 00289 result = m2; 00290 result.mult(m1); 00291 } 00292 #endif 00293 }
|
|
|
|
Reimplemented from osg::StereoCameraDecorator. Definition at line 95 of file OSGProjectionCameraDecorator.cpp.
|
|
|
|
|
|
Reimplemented from osg::StereoCameraDecoratorBase. Definition at line 58 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_type. Referenced by osg::ProjectionCameraDecoratorBase::create(). 00059 { 00060 return _type; 00061 }
|
|
|
Reimplemented from osg::StereoCameraDecoratorBase. Definition at line 65 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_type, and osg::TypeBase::getId(). 00066 { 00067 return _type.getId(); 00068 }
|
|
|
Reimplemented from osg::StereoCameraDecoratorBase. Definition at line 172 of file OSGProjectionCameraDecoratorBase.cpp. References osg::ProjectionCameraDecoratorBase::_type. 00173 { 00174 return _type; 00175 }
|
|
|
Reimplemented from osg::StereoCameraDecoratorBase. Definition at line 177 of file OSGProjectionCameraDecoratorBase.cpp. References osg::ProjectionCameraDecoratorBase::_type. 00178 { 00179 return _type; 00180 }
|
|
|
Reimplemented from osg::StereoCameraDecoratorBase. Definition at line 192 of file OSGProjectionCameraDecoratorBase.cpp. 00193 { 00194 return sizeof(ProjectionCameraDecorator); 00195 }
|
|
|
Definition at line 101 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_sfUser. 00102 { 00103 return &_sfUser; 00104 }
|
|
|
Definition at line 108 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_mfSurface. 00109 { 00110 return &_mfSurface; 00111 }
|
|
|
Definition at line 136 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_sfWidth. 00137 { 00138 return &_sfWidth; 00139 }
|
|
|
Definition at line 143 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_sfHeight. 00144 { 00145 return &_sfHeight; 00146 }
|
|
|
Definition at line 151 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_sfUser, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). Referenced by getProjection(), getProjectionTranslation(), and getViewing(). 00152 { 00153 return _sfUser.getValue(); 00154 }
|
|
|
Definition at line 158 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_sfUser, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00159 { 00160 return _sfUser.getValue(); 00161 }
|
|
|
Definition at line 235 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_sfWidth, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). Referenced by getProjection(). 00236 { 00237 return _sfWidth.getValue(); 00238 }
|
|
|
Definition at line 242 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_sfWidth, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00243 { 00244 return _sfWidth.getValue(); 00245 }
|
|
|
Definition at line 256 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_sfHeight, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). Referenced by getProjection(). 00257 { 00258 return _sfHeight.getValue(); 00259 }
|
|
|
Definition at line 263 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_sfHeight, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00264 { 00265 return _sfHeight.getValue(); 00266 }
|
|
|
Definition at line 278 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_mfSurface. 00279 { 00280 return _mfSurface[index]; 00281 }
|
|
|
Definition at line 285 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_mfSurface. Referenced by updateData(). 00286 { 00287 return _mfSurface; 00288 }
|
|
|
Definition at line 292 of file OSGProjectionCameraDecoratorBase.inl. References osg::ProjectionCameraDecoratorBase::_mfSurface. 00293 { 00294 return _mfSurface; 00295 }
|