#include <OSGBillboard.h>
Inheritance diagram for osg::Billboard:

Public Types | |
| typedef BillboardPtr | Ptr |
| enum | { AxisOfRotationFieldId = Inherited::NextFieldId, FocusOnCameraFieldId = AxisOfRotationFieldId + 1, AlignToScreenFieldId = FocusOnCameraFieldId + 1, MinAngleFieldId = AlignToScreenFieldId + 1, MaxAngleFieldId = MinAngleFieldId + 1, NextFieldId = MaxAngleFieldId + 1 } |
Public Member Functions | |
Sync | |
| *virtual void | changed (BitVector whichField, UInt32 origin) |
| react to field changes | |
calc the model matrix | |
| *void | calcMatrix (DrawActionBase *pAction, const Matrix &mToWorld, Matrix &mResult) |
Output | |
| *virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const |
| output the instance for debug purposes | |
FieldContainer Get | |
| *virtual FieldContainerType & | getType (void) |
| virtual const FieldContainerType & | getType (void) const |
| virtual UInt32 | getContainerSize (void) const |
Field Get | |
| *SFVec3f * | getSFAxisOfRotation (void) |
| Get the Billboard::_sfAxisOfRotation field. | |
| SFBool * | getSFFocusOnCamera (void) |
| Get the Billboard::_sfFocusOnCamera field. | |
| SFBool * | getSFAlignToScreen (void) |
| Get the Billboard::_sfAlignToScreen field. | |
| SFReal32 * | getSFMinAngle (void) |
| Get the Billboard::_sfMinAngle field. | |
| SFReal32 * | getSFMaxAngle (void) |
| Get the Billboard::_sfMaxAngle field. | |
| Vec3f & | getAxisOfRotation (void) |
| Get the value of the Billboard::_sfAxisOfRotation field. | |
| const Vec3f & | getAxisOfRotation (void) const |
| Get the value of the Billboard::_sfAxisOfRotation field. | |
| bool & | getFocusOnCamera (void) |
| Get the value of the Billboard::_sfFocusOnCamera field. | |
| const bool & | getFocusOnCamera (void) const |
| Get the value of the Billboard::_sfFocusOnCamera field. | |
| bool & | getAlignToScreen (void) |
| Get the value of the Billboard::_sfAlignToScreen field. | |
| const bool & | getAlignToScreen (void) const |
| Get the value of the Billboard::_sfAlignToScreen field. | |
| Real32 & | getMinAngle (void) |
| Get the value of the Billboard::_sfMinAngle field. | |
| const Real32 & | getMinAngle (void) const |
| Get the value of the Billboard::_sfMinAngle field. | |
| Real32 & | getMaxAngle (void) |
| Get the value of the Billboard::_sfMaxAngle field. | |
| const Real32 & | getMaxAngle (void) const |
| Get the value of the Billboard::_sfMaxAngle field. | |
Field Set | |
| *void | setAxisOfRotation (const Vec3f &value) |
| Set the value of the Billboard::_sfAxisOfRotation field. | |
| void | setFocusOnCamera (const bool &value) |
| Set the value of the Billboard::_sfFocusOnCamera field. | |
| void | setAlignToScreen (const bool &value) |
| Set the value of the Billboard::_sfAlignToScreen field. | |
| void | setMinAngle (const Real32 &value) |
| Set the value of the Billboard::_sfMinAngle field. | |
| void | setMaxAngle (const Real32 &value) |
| Set the value of the Billboard::_sfMaxAngle 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 |
Static Public Member Functions | |
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 BillboardPtr | create (void) |
| create a new instance of the class | |
| static BillboardPtr | createEmpty (void) |
| create an empty new instance of the class, do not copy the prototype | |
Static Public Attributes | |
| static const osg::BitVector | AxisOfRotationFieldMask |
| static const osg::BitVector | FocusOnCameraFieldMask |
| static const osg::BitVector | AlignToScreenFieldMask |
| static const osg::BitVector | MinAngleFieldMask |
| static const osg::BitVector | MaxAngleFieldMask |
| static const osg::BitVector | MTInfluenceMask |
| static const BitVector | ParentsFieldMask = (1 << NodeCore::ParentsFieldId ) |
| static const BitVector | AttachmentsFieldMask |
| static const BitVector | NextFieldMask |
Protected Member Functions | |
Constructors | |
| * | Billboard (void) |
| Constructor. | |
| Billboard (const Billboard &source) | |
| Copy Constructor. | |
Destructors | |
| *virtual | ~Billboard (void) |
| Destructor. | |
NodeCore Specific | |
| *virtual void | accumulateMatrix (Matrix &result) |
| void | adjustVolume (Volume &volume) |
Draw & Intersect & Render | |
| *Action::ResultE | drawEnter (Action *action) |
| Action::ResultE | drawLeave (Action *action) |
| Action::ResultE | intersectEnter (Action *action) |
| Action::ResultE | intersectLeave (Action *action) |
| Action::ResultE | renderEnter (Action *action) |
| Action::ResultE | renderLeave (Action *action) |
Sync | |
| *void | executeSyncImpl (BillboardBase *pOther, const BitVector &whichField) |
| virtual void | executeSync (FieldContainer &other, const BitVector &whichField) |
Protected Attributes | |
Fields | |
| *SFVec3f | _sfAxisOfRotation |
| SFBool | _sfFocusOnCamera |
| SFBool | _sfAlignToScreen |
| SFReal32 | _sfMinAngle |
| SFReal32 | _sfMaxAngle |
Private Types | |
| typedef BillboardBase | Inherited |
Private Member Functions | |
| void | operator= (const Billboard &source) |
Static Private Member Functions | |
| static void | initMethod (void) |
| initialize the static features of the class, e.g. action callbacks | |
Private Attributes | |
| Matrix | _camTransform |
Friends | |
| class | FieldContainer |
| class | BillboardBase |
Definition at line 57 of file OSGBillboard.h.
|
|
Reimplemented from osg::BillboardBase. Definition at line 61 of file OSGBillboard.h. |
|
|
Reimplemented from osg::GroupBase. Definition at line 94 of file OSGBillboardBase.h. |
|
|
Reimplemented from osg::NodeCore. Definition at line 96 of file OSGBillboardBase.h. 00097 { 00098 AxisOfRotationFieldId = Inherited::NextFieldId, 00099 FocusOnCameraFieldId = AxisOfRotationFieldId + 1, 00100 AlignToScreenFieldId = FocusOnCameraFieldId + 1, 00101 MinAngleFieldId = AlignToScreenFieldId + 1, 00102 MaxAngleFieldId = MinAngleFieldId + 1, 00103 NextFieldId = MaxAngleFieldId + 1 00104 };
|
|
|
Definition at line 69 of file OSGBillboard.cpp. 00069 : 00070 Inherited(), 00071 _camTransform() 00072 { 00073 }
|
|
|
Definition at line 77 of file OSGBillboard.cpp. 00077 : 00078 Inherited(source), 00079 _camTransform(source._camTransform) 00080 { 00081 }
|
|
|
Definition at line 85 of file OSGBillboard.cpp.
|
|
||||||||||||
|
Reimplemented from osg::Group. Definition at line 148 of file OSGBillboard.cpp. References osg::Group::changed(). 00149 { 00150 Inherited::changed(whichField, origin); 00151 }
|
|
||||||||||||||||
|
Definition at line 191 of file OSGBillboard.cpp. References _camTransform, osg::BillboardBase::_sfAlignToScreen, osg::BillboardBase::_sfFocusOnCamera, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::cross(), osg::BillboardBase::getAxisOfRotation(), osg::DrawActionBase::getCameraToWorld(), osg::BillboardBase::getMaxAngle(), osg::BillboardBase::getMinAngle(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), osg::QuaternionBase< ValueTypeT >::getValueAsAxisRad(), osg::TransformationMatrix< ValueTypeT >::invertFrom(), osg::QuaternionBase< ValueTypeT >::mult(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::QuaternionBase< ValueTypeT >::multVec(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), osg::VectorInterface< Real32, VecStorage3 >::Null, osg::TransformationMatrix< ValueTypeT >::setTransform(), osg::QuaternionBase< ValueTypeT >::setValue(), osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue(), and osg::QuaternionBase< ValueTypeT >::setValueAsAxisRad(). Referenced by drawEnter(), and renderEnter(). 00194 { 00195 Pnt3f eyepos(0.f, 0.f, 0.f); 00196 Pnt3f objpos(0.f, 0.f, 0.f); 00197 00198 Vec3f vDir; 00199 Vec3f n(0.f, 0.f, 1.f); 00200 00201 Quaternion q1; 00202 00203 Matrix mCamToWorld = pAction->getCameraToWorld(); 00204 00205 mResult.invertFrom(mToWorld); 00206 00207 mToWorld.mult(n); 00208 00209 if(getAxisOfRotation() == Vec3f::Null) 00210 { 00211 if(_sfFocusOnCamera.getValue() == true) 00212 { 00213 Vec3f vUp; 00214 Vec3f uW; 00215 Vec3f vX; 00216 00217 mCamToWorld.mult(eyepos); 00218 mToWorld .mult(objpos); 00219 00220 vDir = eyepos - objpos; 00221 00222 vUp.setValue (mCamToWorld[0]); 00223 00224 vUp = vDir.cross(vUp); 00225 00226 vUp.normalize(); 00227 vDir.normalize(); 00228 00229 Matrix mTr; 00230 00231 vX = vUp.cross(vDir); 00232 vX.normalize(); 00233 00234 mTr[0][0] = vX[0]; 00235 mTr[0][1] = vX[1]; 00236 mTr[0][2] = vX[2]; 00237 mTr[1][0] = vUp[0]; 00238 mTr[1][1] = vUp[1]; 00239 mTr[1][2] = vUp[2]; 00240 mTr[2][0] = vDir[0]; 00241 mTr[2][1] = vDir[1]; 00242 mTr[2][2] = vDir[2]; 00243 00244 q1.setValue(mTr); 00245 } 00246 else 00247 { 00248 if(_sfAlignToScreen.getValue() == false) 00249 { 00250 Vec3f u (0.f, 1.f, 0.f); 00251 Vec3f vUp; 00252 Vec3f uW; 00253 00254 mCamToWorld.mult(eyepos); 00255 mToWorld .mult(objpos); 00256 00257 vDir = eyepos - objpos; 00258 00259 // vDir.setValue(mCamToWorld[2]); 00260 00261 vUp.setValue (mCamToWorld[1]); 00262 00263 Quaternion qN(n, vDir); 00264 00265 mToWorld.mult(u); 00266 00267 qN.multVec(u, uW); 00268 00269 q1.setValue(uW, vUp); 00270 00271 q1.mult(qN); 00272 } 00273 else 00274 { 00275 Vec3f u (0.f, 1.f, 0.f); 00276 Vec3f vUp; 00277 Vec3f uW; 00278 00279 vDir.setValue(mCamToWorld[2]); 00280 00281 vUp.setValue (mCamToWorld[1]); 00282 00283 Quaternion qN(n, vDir); 00284 00285 mToWorld.mult(u); 00286 00287 qN.multVec(u, uW); 00288 00289 q1.setValue(uW, vUp); 00290 00291 q1.mult(qN); 00292 } 00293 } 00294 } 00295 else 00296 { 00297 Vec3f wUp; 00298 Vec3f s; 00299 Vec3f tDir; 00300 00301 mCamToWorld.mult(eyepos); 00302 00303 mToWorld.mult(objpos); 00304 00305 mToWorld.mult(getAxisOfRotation(), wUp); 00306 00307 vDir = eyepos - objpos; 00308 00309 s = vDir.cross(wUp); 00310 tDir = wUp .cross(s ); 00311 00312 q1.setValue(n, tDir); 00313 00314 // clamp angle to [min; max] 00315 Vec3f axis; 00316 Real32 angle; 00317 00318 if ( getMinAngle() <= getMaxAngle() ) { 00319 q1.getValueAsAxisRad(axis, angle); 00320 00321 if (angle < getMinAngle()) 00322 angle = getMinAngle(); 00323 if (angle > getMaxAngle()) 00324 angle = getMaxAngle(); 00325 00326 q1.setValueAsAxisRad(axis, angle); 00327 } 00328 } 00329 00330 Matrix mTrans; 00331 Matrix mMat; 00332 00333 mTrans[3][0] = mToWorld[3][0]; 00334 mTrans[3][1] = mToWorld[3][1]; 00335 mTrans[3][2] = mToWorld[3][2]; 00336 00337 mMat.setTransform(q1); 00338 00339 mResult.mult(mTrans); 00340 mResult.mult(mMat ); 00341 00342 mTrans[3][0] = -mToWorld[3][0]; 00343 mTrans[3][1] = -mToWorld[3][1]; 00344 mTrans[3][2] = -mToWorld[3][2]; 00345 00346 mResult.mult(mTrans); 00347 mResult.mult(mToWorld); 00348 00349 _camTransform = mResult; 00350 }
|
|
||||||||||||
|
Reimplemented from osg::Group. Definition at line 155 of file OSGBillboard.cpp. References osg::Group::dump(). 00157 { 00158 Inherited::dump(uiIndent, bvFlags); 00159 }
|
|
|
Reimplemented from osg::NodeCore. Definition at line 186 of file OSGBillboard.cpp. References _camTransform, and osg::TransformationMatrix< ValueTypeT >::mult(). 00187 { 00188 result.mult(_camTransform); 00189 }
|
|
|
Reimplemented from osg::NodeCore. Definition at line 164 of file OSGBillboard.cpp. References osg::NodeCore::adjustVolume(), osg::extend(), osg::Volume::extendBy(), osg::Volume::getBounds(), osg::PointInterface< ValueTypeT, StorageInterfaceT >::maxValue(), osg::VecStorage3< ValueTypeT >::setValues(), and osg::Sqrt2. 00165 { 00166 Inherited::adjustVolume(volume); 00167 00168 // enlarge the volume to adjust for rotations 00169 // keep the center, but make it a cube big enough to contain the 00170 // billboard in all orientations 00171 00172 Pnt3f min, max; 00173 00174 volume.getBounds(min, max); 00175 00176 Vec3f dia = max - min; 00177 Pnt3f center = min + dia * .5; 00178 Real32 extend = dia.maxValue(); 00179 00180 dia.setValues(extend * Sqrt2, extend * Sqrt2, extend * Sqrt2); 00181 00182 volume.extendBy( center - dia ); 00183 volume.extendBy( center + dia ); 00184 }
|
|
|
Reimplemented from osg::Group. Definition at line 355 of file OSGBillboard.cpp. References calcMatrix(), osg::Action::Continue, osg::Action::getActNode(), and osg::TransformationMatrix< ValueTypeT >::getValues(). Referenced by initMethod(). 00356 { 00357 DrawAction *da = dynamic_cast<DrawAction *>(action); 00358 00359 Matrix mMat; 00360 00361 calcMatrix(da, 00362 da->getActNode()->getToWorld(), 00363 mMat); 00364 00365 // should use the chunk, but it's not updated yet 00366 glPushMatrix (); 00367 glMultMatrixf(mMat.getValues()); 00368 00369 // !!! can't use visibles, as ToWorld gives garbage leading to wrong culling 00370 // da->selectVisibles(); 00371 00372 return Action::Continue; 00373 }
|
|
|
Reimplemented from osg::Group. Definition at line 375 of file OSGBillboard.cpp. References osg::Action::Continue. Referenced by initMethod(). 00376 { 00377 glPopMatrix(); 00378 00379 return Action::Continue; 00380 }
|
|
|
Definition at line 385 of file OSGBillboard.cpp. References _camTransform, osg::Action::Continue, osg::Line::getDirection(), osg::IntersectAction::getLine(), osg::IntersectAction::getMaxDist(), osg::Line::getPosition(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::length(), osg::TransformationMatrix< ValueTypeT >::multFullMatrixPnt(), osg::TransformationMatrix< ValueTypeT >::multMatrixVec(), osg::IntersectAction::scale(), and osg::IntersectAction::setLine(). Referenced by initMethod(). 00386 { 00387 IntersectAction *ia = dynamic_cast<IntersectAction *>(action); 00388 Matrix m(_camTransform); 00389 00390 m.invert(); 00391 00392 Pnt3f pos; 00393 Vec3f dir; 00394 00395 m.multFullMatrixPnt(ia->getLine().getPosition (), pos); 00396 m.multMatrixVec (ia->getLine().getDirection(), dir); 00397 00398 ia->setLine(Line(pos, dir), ia->getMaxDist()); 00399 ia->scale(dir.length()); 00400 00401 return Action::Continue; 00402 }
|
|
|
Definition at line 404 of file OSGBillboard.cpp. References _camTransform, osg::Action::Continue, osg::Line::getDirection(), osg::IntersectAction::getLine(), osg::IntersectAction::getMaxDist(), osg::Line::getPosition(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::length(), osg::TransformationMatrix< ValueTypeT >::multFullMatrixPnt(), osg::TransformationMatrix< ValueTypeT >::multMatrixVec(), osg::IntersectAction::scale(), and osg::IntersectAction::setLine(). Referenced by initMethod(). 00405 { 00406 IntersectAction *ia = dynamic_cast<IntersectAction *>(action); 00407 Matrix m(_camTransform); 00408 00409 Pnt3f pos; 00410 Vec3f dir; 00411 00412 m.multFullMatrixPnt(ia->getLine().getPosition (), pos); 00413 m.multMatrixVec (ia->getLine().getDirection(), dir); 00414 00415 ia->setLine(Line(pos, dir), ia->getMaxDist()); 00416 ia->scale(dir.length()); 00417 00418 return Action::Continue; 00419 }
|
|
|
Reimplemented from osg::Group. Definition at line 424 of file OSGBillboard.cpp. References calcMatrix(), osg::Action::Continue, osg::RenderAction::push_matrix(), and osg::RenderAction::top_matrix(). Referenced by initMethod(). 00425 { 00426 RenderAction *pAction = dynamic_cast<RenderAction *>(action); 00427 00428 Matrix mMat; 00429 00430 calcMatrix(pAction, pAction->top_matrix(), mMat); 00431 00432 pAction->push_matrix(mMat); 00433 00434 // !!! can't use visibles, as ToWorld gives garbage leading to wrong culling 00435 // pAction->selectVisibles(); 00436 00437 return Action::Continue; 00438 }
|
|
|
Reimplemented from osg::Group. Definition at line 440 of file OSGBillboard.cpp. References osg::Action::Continue, and osg::RenderAction::pop_matrix(). Referenced by initMethod(). 00441 { 00442 RenderAction *pAction = dynamic_cast<RenderAction *>(action); 00443 00444 pAction->pop_matrix(); 00445 00446 return Action::Continue; 00447 }
|
|
|
|
|
|
|
Reimplemented from osg::GroupBase. Definition at line 58 of file OSGBillboardBase.inl. References osg::BillboardBase::_type. Referenced by osg::BillboardBase::create(), initMethod(), osg::SplitGraphOp::isGroup(), and osg::MergeGraphOp::isGroup(). 00059 { 00060 return _type; 00061 }
|
|
|
Reimplemented from osg::GroupBase. Definition at line 65 of file OSGBillboardBase.inl. References osg::BillboardBase::_type, and osg::TypeBase::getId(). 00066 { 00067 return _type.getId(); 00068 }
|
|
|
Reimplemented from osg::GroupBase. Definition at line 150 of file OSGBillboardBase.cpp. References osg::BillboardBase::_type. 00151 { 00152 return _type; 00153 }
|
|
|
Reimplemented from osg::GroupBase. Definition at line 155 of file OSGBillboardBase.cpp. References osg::BillboardBase::_type. 00156 { 00157 return _type; 00158 }
|
|
|
Reimplemented from osg::GroupBase. Definition at line 170 of file OSGBillboardBase.cpp. 00171 { 00172 return sizeof(Billboard); 00173 }
|
|
|
Definition at line 101 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfAxisOfRotation. 00102 { 00103 return &_sfAxisOfRotation; 00104 }
|
|
|
Definition at line 108 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfFocusOnCamera. 00109 { 00110 return &_sfFocusOnCamera; 00111 }
|
|
|
Definition at line 115 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfAlignToScreen. 00116 { 00117 return &_sfAlignToScreen; 00118 }
|
|
|
Definition at line 122 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfMinAngle. 00123 { 00124 return &_sfMinAngle; 00125 }
|
|
|
Definition at line 129 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfMaxAngle. 00130 { 00131 return &_sfMaxAngle; 00132 }
|
|
|
Definition at line 137 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfAxisOfRotation, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). Referenced by calcMatrix(). 00138 { 00139 return _sfAxisOfRotation.getValue(); 00140 }
|
|
|
Definition at line 144 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfAxisOfRotation, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00145 { 00146 return _sfAxisOfRotation.getValue(); 00147 }
|
|
|
Definition at line 158 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfFocusOnCamera, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00159 { 00160 return _sfFocusOnCamera.getValue(); 00161 }
|
|
|
Definition at line 165 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfFocusOnCamera, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00166 { 00167 return _sfFocusOnCamera.getValue(); 00168 }
|
|
|
Definition at line 179 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfAlignToScreen, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00180 { 00181 return _sfAlignToScreen.getValue(); 00182 }
|
|
|
Definition at line 186 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfAlignToScreen, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00187 { 00188 return _sfAlignToScreen.getValue(); 00189 }
|
|
|
Definition at line 200 of file OSGBillboardBase.inl. References osg::BillboardBase::_sfMinAngle, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). Referenced by calcMatrix(). 00201 { 00202 return _sfMinAngle.getValue(); 00203 }
|