Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::InverseTransform Class Reference

InverseTransform class. See PageSystemInverseTransform for a description.

#include <OSGInverseTransform.h>

Inheritance diagram for osg::InverseTransform:

osg::InverseTransformBase osg::Group osg::GroupBase osg::NodeCore osg::AttachmentContainer osg::FieldContainer List of all members.

Public Types

typedef InverseTransformPtr Ptr
enum  { ParentsFieldId = Inherited::NextFieldId, NextFieldId = ParentsFieldId + 1 }

Public Member Functions

Sync
*virtual void changed (BitVector whichField, UInt32 origin)
calc the inverse matrix
*void initMatrix (const Matrix &mToWorld)
void calcMatrix (DrawActionBase *pAction, const Matrix &mToWorld, Matrix &mResult)
Output
*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
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
Parents
*MFNodePtrgetParents (void)
const MFNodePtrgetParents (void) const
MFNodePtrgetMFParents (void)
Volume
*virtual void invalidateVolume (void)

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
Construction
*static InverseTransformPtr create (void)
 create a new instance of the class
static InverseTransformPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype

Static Public Attributes

static const osg::BitVector MTInfluenceMask
static const BitVector ParentsFieldMask = (1 << NodeCore::ParentsFieldId )
static const BitVector AttachmentsFieldMask
static const BitVector NextFieldMask
CoredNodePtr helper
*static const bool isNodeCore = true

Protected Member Functions

Constructors
InverseTransform (void)
 InverseTransform (const InverseTransform &source)
Destructors
*virtual ~InverseTransform (void)
NodeCore Specific
*void adjustVolume (Volume &volume)
virtual void accumulateMatrix (Matrix &result)
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 (InverseTransformBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)
Sync
*void executeSyncImpl (GroupBase *pOther, const BitVector &whichField)
Sync
void executeSyncImpl (NodeCore *pOther, const BitVector &whichField)
Action Callbacks
Action::ResultE intersect (Action *action)
MT Destruction
*virtual void onDestroy (void)
Set / Get Parents
*void addParent (const NodePtr &parent)
void subParent (const NodePtr &parent)
Pointer
*NodeCorePtr getPtr (void) const

Protected Attributes

Fields
*MFNodePtr _parents

Static Protected Attributes

Type information
*static FieldDescription_desc []

Private Types

typedef InverseTransformBase Inherited

Private Member Functions

void operator= (const InverseTransform &source)

Static Private Member Functions

static void initMethod (void)

Private Attributes

Matrix _invWorld

Friends

class FieldContainer
class InverseTransformBase

Detailed Description

Definition at line 59 of file OSGInverseTransform.h.


Member Typedef Documentation

typedef InverseTransformBase osg::InverseTransform::Inherited [private]
 

Reimplemented from osg::InverseTransformBase.

Definition at line 63 of file OSGInverseTransform.h.

typedef InverseTransformPtr osg::InverseTransformBase::Ptr [inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 89 of file OSGInverseTransformBase.h.


Member Enumeration Documentation

anonymous enum [inherited]
 

Enumerator:
ParentsFieldId 
NextFieldId 

Reimplemented from osg::AttachmentContainer.

Definition at line 87 of file OSGNodeCore.h.

00088     { 
00089         ParentsFieldId     = Inherited::NextFieldId, 
00090         NextFieldId        = ParentsFieldId + 1
00091     };


Constructor & Destructor Documentation

InverseTransform::InverseTransform void   )  [protected]
 

Definition at line 138 of file OSGInverseTransform.cpp.

00138                                        :
00139     Inherited(),
00140     _invWorld()
00141 {
00142 }

InverseTransform::InverseTransform const InverseTransform source  )  [protected]
 

Definition at line 144 of file OSGInverseTransform.cpp.

00144                                                                  :
00145     Inherited(source),
00146     _invWorld(source._invWorld)
00147 {
00148 }

InverseTransform::~InverseTransform void   )  [protected, virtual]
 

Definition at line 150 of file OSGInverseTransform.cpp.

00151 {
00152 }


Member Function Documentation

void InverseTransform::changed BitVector  whichField,
UInt32  origin
[virtual]
 

Reimplemented from osg::Group.

Definition at line 156 of file OSGInverseTransform.cpp.

References osg::Group::changed().

00157 {
00158     Inherited::changed(whichField, origin);
00159 }

void InverseTransform::initMatrix const Matrix mToWorld  ) 
 

Definition at line 190 of file OSGInverseTransform.cpp.

References _invWorld, and osg::TransformationMatrix< ValueTypeT >::invertFrom().

00191 {
00192     _invWorld.invertFrom(mToWorld);
00193 }

void InverseTransform::calcMatrix DrawActionBase pAction,
const Matrix mToWorld,
Matrix mResult
 

Definition at line 181 of file OSGInverseTransform.cpp.

References _invWorld, and osg::TransformationMatrix< ValueTypeT >::invertFrom().

Referenced by drawEnter(), and renderEnter().

00184 {
00185     mResult.invertFrom(mToWorld);
00186 
00187     _invWorld = mResult;    // remember dynamically set matrix field
00188 }

void InverseTransform::dump UInt32  uiIndent = 0,
const BitVector  bvFlags = 0
const [virtual]
 

Reimplemented from osg::Group.

Definition at line 161 of file OSGInverseTransform.cpp.

References osg::Group::dump().

00163 {
00164     Inherited::dump(uiIndent, bvFlags);
00165 }

void InverseTransform::adjustVolume Volume volume  )  [protected, virtual]
 

Reimplemented from osg::NodeCore.

Definition at line 169 of file OSGInverseTransform.cpp.

References _invWorld, and osg::Volume::transform().

00170 {
00171     volume.transform(_invWorld);
00172 }

void InverseTransform::accumulateMatrix Matrix result  )  [protected, virtual]
 

Reimplemented from osg::NodeCore.

Definition at line 174 of file OSGInverseTransform.cpp.

References _invWorld, and osg::TransformationMatrix< ValueTypeT >::mult().

00175 {
00176     result.mult(_invWorld);
00177 }

Action::ResultE InverseTransform::drawEnter Action action  )  [protected]
 

Reimplemented from osg::Group.

Definition at line 198 of file OSGInverseTransform.cpp.

References calcMatrix(), osg::Action::Continue, osg::Action::getActNode(), and osg::TransformationMatrix< ValueTypeT >::getValues().

Referenced by initMethod().

00199 {
00200     DrawAction *da = dynamic_cast<DrawAction *>(action);
00201     Matrix mMat;
00202 
00203     calcMatrix(da, da->getActNode()->getToWorld(), mMat);
00204 
00205     // should use the chunk, but it's not updated yet
00206     glPushMatrix ();
00207     glMultMatrixf(mMat.getValues());
00208 
00209     return Action::Continue;
00210 }

Action::ResultE InverseTransform::drawLeave Action action  )  [protected]
 

Reimplemented from osg::Group.

Definition at line 212 of file OSGInverseTransform.cpp.

References osg::Action::Continue.

Referenced by initMethod().

00213 {
00214     glPopMatrix();
00215 
00216     return Action::Continue;
00217 }

Action::ResultE InverseTransform::intersectEnter Action action  )  [protected]
 

Definition at line 222 of file OSGInverseTransform.cpp.

References _invWorld, 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().

00223 {
00224     IntersectAction *ia = dynamic_cast<IntersectAction *>(action);
00225     Matrix           m(_invWorld);
00226 
00227     m.invert();
00228 
00229     Pnt3f pos;
00230     Vec3f dir;
00231 
00232     m.multFullMatrixPnt(ia->getLine().getPosition (), pos);
00233     m.multMatrixVec    (ia->getLine().getDirection(), dir);
00234 
00235     ia->setLine(Line(pos, dir), ia->getMaxDist());
00236     ia->scale(dir.length());
00237 
00238     return Action::Continue;
00239 }

Action::ResultE InverseTransform::intersectLeave Action action  )  [protected]
 

Definition at line 241 of file OSGInverseTransform.cpp.

References _invWorld, 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().

00242 {
00243     IntersectAction *ia = dynamic_cast<IntersectAction *>(action);
00244     Matrix           m(_invWorld);
00245 
00246     Pnt3f pos;
00247     Vec3f dir;
00248 
00249     m.multFullMatrixPnt(ia->getLine().getPosition (), pos);
00250     m.multMatrixVec    (ia->getLine().getDirection(), dir);
00251 
00252     ia->setLine(Line(pos, dir), ia->getMaxDist());
00253     ia->scale(dir.length());
00254 
00255     return Action::Continue;
00256 }

Action::ResultE InverseTransform::renderEnter Action action  )  [protected]
 

Reimplemented from osg::Group.

Definition at line 261 of file OSGInverseTransform.cpp.

References calcMatrix(), osg::Action::Continue, osg::RenderAction::push_matrix(), and osg::RenderAction::top_matrix().

Referenced by initMethod().

00262 {
00263     RenderAction *pAction = dynamic_cast<RenderAction *>(action);
00264     Matrix mMat;    // will be set to World^-1
00265 
00266     calcMatrix(pAction, pAction->top_matrix(), mMat);
00267 
00268     pAction->push_matrix(mMat);
00269 
00270     return Action::Continue;
00271 }

Action::ResultE InverseTransform::renderLeave Action action  )  [protected]
 

Reimplemented from osg::Group.

Definition at line 273 of file OSGInverseTransform.cpp.

References osg::Action::Continue, and osg::RenderAction::pop_matrix().

Referenced by initMethod().

00274 {
00275     RenderAction *pAction = dynamic_cast<RenderAction *>(action);
00276 
00277     pAction->pop_matrix();
00278 
00279     return Action::Continue;
00280 }

void InverseTransform::initMethod void   )  [static, private]
 

Reimplemented from osg::Group.

Definition at line 74 of file OSGInverseTransform.cpp.

References drawEnter(), drawLeave(), osg::InverseTransformBase::getClassType(), intersectEnter(), intersectLeave(), osg::osgTypedMethodFunctor2BaseCPtrRef(), osg::RenderAction::registerEnterDefault(), osg::IntersectAction::registerEnterDefault(), osg::DrawAction::registerEnterDefault(), osg::RenderAction::registerLeaveDefault(), osg::IntersectAction::registerLeaveDefault(), osg::DrawAction::registerLeaveDefault(), renderEnter(), and renderLeave().

void osg::InverseTransform::operator= const InverseTransform source  )  [private]
 

osg::FieldContainerType & osg::InverseTransformBase::getClassType void   )  [inline, static, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 58 of file OSGInverseTransformBase.inl.

References osg::InverseTransformBase::_type.

Referenced by osg::InverseTransformBase::create(), and initMethod().

00059 {
00060     return _type; 
00061 } 

osg::UInt32 osg::InverseTransformBase::getClassTypeId void   )  [inline, static, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 65 of file OSGInverseTransformBase.inl.

References osg::InverseTransformBase::_type, and osg::TypeBase::getId().

00066 {
00067     return _type.getId(); 
00068 } 

FieldContainerType & InverseTransformBase::getType void   )  [virtual, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 86 of file OSGInverseTransformBase.cpp.

References osg::InverseTransformBase::_type.

00087 {
00088     return _type; 
00089 } 

const FieldContainerType & InverseTransformBase::getType void   )  const [virtual, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 91 of file OSGInverseTransformBase.cpp.

References osg::InverseTransformBase::_type.

00092 {
00093     return _type;
00094 } 

UInt32 InverseTransformBase::getContainerSize void   )  const [virtual, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 106 of file OSGInverseTransformBase.cpp.

00107 { 
00108     return sizeof(InverseTransform); 
00109 }

UInt32 InverseTransformBase::getBinSize const BitVector whichField  )  [virtual, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 166 of file OSGInverseTransformBase.cpp.

References osg::GroupBase::getBinSize().

00167 {
00168     UInt32 returnValue = Inherited::getBinSize(whichField);
00169 
00170 
00171     return returnValue;
00172 }

void InverseTransformBase::copyToBin BinaryDataHandler pMem,
const BitVector whichField
[virtual, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 174 of file OSGInverseTransformBase.cpp.

References osg::GroupBase::copyToBin().

00176 {
00177     Inherited::copyToBin(pMem, whichField);
00178 
00179 
00180 }

void InverseTransformBase::copyFromBin BinaryDataHandler pMem,
const BitVector whichField
[virtual, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 182 of file OSGInverseTransformBase.cpp.

References osg::GroupBase::copyFromBin().

00184 {
00185     Inherited::copyFromBin(pMem, whichField);
00186 
00187 
00188 }

InverseTransformPtr osg::InverseTransformBase::create void   )  [inline, static, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 72 of file OSGInverseTransformBase.inl.

References osg::AttachmentContainerPtr::dcast(), osg::InverseTransformBase::getClassType(), osg::FieldContainerType::getPrototype(), osg::NullFC, and osg::InverseTransformBase::shallowCopy().

00073 {
00074     InverseTransformPtr fc; 
00075 
00076     if(getClassType().getPrototype() != OSG::NullFC) 
00077     {
00078         fc = InverseTransformPtr::dcast(
00079             getClassType().getPrototype()-> shallowCopy()); 
00080     }
00081     
00082     return fc; 
00083 }

InverseTransformPtr osg::InverseTransformBase::createEmpty void   )  [inline, static, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 87 of file OSGInverseTransformBase.inl.

References osg::FieldContainer::newPtr().

00088 { 
00089     InverseTransformPtr returnValue; 
00090     
00091     newPtr(returnValue); 
00092 
00093     return returnValue; 
00094 }

FieldContainerPtr InverseTransformBase::shallowCopy void   )  const [virtual, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 97 of file OSGInverseTransformBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by osg::InverseTransformBase::create().

00098 { 
00099     InverseTransformPtr returnValue; 
00100 
00101     newPtr(returnValue, dynamic_cast<const InverseTransform *>(this)); 
00102 
00103     return returnValue; 
00104 }

void InverseTransformBase::executeSyncImpl InverseTransformBase pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 191 of file OSGInverseTransformBase.cpp.

References osg::GroupBase::executeSyncImpl().

Referenced by osg::InverseTransformBase::executeSync().

00193 {
00194 
00195     Inherited::executeSyncImpl(pOther, whichField);
00196 
00197 
00198 }

void GroupBase::executeSyncImpl GroupBase pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 191 of file OSGGroupBase.cpp.

References osg::NodeCore::executeSyncImpl().

Referenced by osg::GroupBase::executeSync(), osg::TransformBase::executeSyncImpl(), osg::SwitchBase::executeSyncImpl(), osg::ProxyGroupBase::executeSyncImpl(), osg::MaterialPoolBase::executeSyncImpl(), osg::MaterialGroupBase::executeSyncImpl(), osg::InverseTransformBase::executeSyncImpl(), osg::DistanceLODBase::executeSyncImpl(), and osg::BillboardBase::executeSyncImpl().

00193 {
00194 
00195     Inherited::executeSyncImpl(pOther, whichField);
00196 
00197 
00198 }

void osg::NodeCore::executeSyncImpl NodeCore pOther,
const BitVector whichField
[inline, protected, inherited]
 

Definition at line 180 of file OSGNodeCore.inl.

References osg::NodeCore::_parents, osg::AttachmentContainer::executeSyncImpl(), osg::FieldBits::NoField, osg::NodeCore::ParentsFieldMask, and osg::MField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by osg::NodeCore::executeSync(), osg::StateSortingGroupBase::executeSyncImpl(), osg::LightEnvBase::executeSyncImpl(), osg::LightBase::executeSyncImpl(), osg::InlineBase::executeSyncImpl(), osg::GroupBase::executeSyncImpl(), osg::DVRVolumeBase::executeSyncImpl(), and osg::DrawableBase::executeSyncImpl().

00182 {
00183     Inherited::executeSyncImpl(pOther, whichField);
00184 
00185     if(FieldBits::NoField != (ParentsFieldMask & whichField))
00186     {
00187         _parents.syncWith(pOther->_parents);
00188     }
00189 }

void AttachmentContainer::executeSyncImpl AttachmentContainer pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 316 of file OSGAttachmentContainer.cpp.

References osg::AttachmentContainer::_attachmentMap, osg::AttachmentContainer::AttachmentsFieldMask, osg::FieldContainer::executeSyncImpl(), osg::FieldBits::NoField, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by osg::AttachmentContainer::executeSync(), osg::WindowBase::executeSyncImpl(), osg::ViewportBase::executeSyncImpl(), osg::ShaderParameterBase::executeSyncImpl(), osg::Node::executeSyncImpl(), osg::NodeCore::executeSyncImpl(), osg::MaterialBase::executeSyncImpl(), osg::ImageComposerBase::executeSyncImpl(), osg::ImageBase::executeSyncImpl(), osg::ForegroundBase::executeSyncImpl(), osg::DisplayCalibrationBase::executeSyncImpl(), osg::CameraBase::executeSyncImpl(), and osg::BackgroundBase::executeSyncImpl().

00319 {
00320     Inherited::executeSyncImpl(pOther, whichField);
00321 
00322     if (FieldBits::NoField != (AttachmentsFieldMask & whichField))
00323     {
00324         _attachmentMap.syncWith(pOther->_attachmentMap);
00325     }
00326 }

void osg::FieldContainer::executeSyncImpl FieldContainer pOther,
const BitVector whichField
[inline, protected, inherited]
 

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().

00335 {
00336 }

void InverseTransformBase::executeSync FieldContainer other,
const BitVector whichField
[protected, virtual, inherited]
 

Reimplemented from osg::GroupBase.

Definition at line 113 of file OSGInverseTransformBase.cpp.

References osg::InverseTransformBase::executeSyncImpl().

00115 {
00116     this->executeSyncImpl((InverseTransformBase *) &other, whichField);
00117 }

Action::ResultE Group::intersect Action action  )  [protected, inherited]
 

Reimplemented in osg::Switch.

Definition at line 139 of file OSGGroup.cpp.

References osg::Action::Continue, osg::Action::getActNode(), osg::IntersectAction::getLine(), osg::DynamicVolume::intersect(), osg::Volume::isValid(), and osg::Action::Skip.

Referenced by osg::Group::initMethod().

00140 {
00141           IntersectAction *ia = dynamic_cast<IntersectAction *>(action);
00142     const DynamicVolume   &dv = ia->getActNode()->getVolume();
00143     
00144     if(dv.isValid() && ! dv.intersect(ia->getLine()))
00145     {
00146         return Action::Skip;  //bv missed -> can not hit children
00147     }
00148     
00149     return Action::Continue;
00150 }

MFNodePtr & osg::NodeCore::getParents void   )  [inline, inherited]
 

Definition at line 56 of file OSGNodeCore.inl.

Referenced by osg::Surface::FindClosestPoint().

00057 {
00058     return _parents;
00059 }

const MFNodePtr & osg::NodeCore::getParents void   )  const [inline, inherited]
 

Definition at line 62 of file OSGNodeCore.inl.

References osg::NodeCore::_parents.

00063 {
00064     return _parents;
00065 }

MFNodePtr * osg::NodeCore::getMFParents void   )  [inline, inherited]
 

Definition at line 68 of file OSGNodeCore.inl.

References osg::NodeCore::_parents.

00069 {
00070     return &_parents;
00071 }

void osg::NodeCore::invalidateVolume void   )  [inline, virtual, inherited]
 

Definition at line 237 of file OSGNodeCore.inl.

References osg::NodeCore::_parents, and osg::MField< FieldTypeT, fieldNameSpace >::size().

Referenced by osg::Transform::changed().

00238 {
00239     for(UInt32 i = 0; i < _parents.size(); i++)
00240     {
00241         _parents[i]->invalidateVolume();
00242     }
00243 }

void osg::NodeCore::onDestroy void   )  [inline, protected, virtual, inherited]
 

Reimplemented from osg::FieldContainer.

Reimplemented in osg::MaterialPool.

Definition at line 142 of file OSGNodeCore.inl.

00143 {
00144 }

void osg::NodeCore::addParent const NodePtr parent  )  [inline, protected, inherited]
 

Definition at line 150 of file OSGNodeCore.inl.

References osg::NodeCore::_parents, and osg::MField< FieldTypeT, fieldNameSpace >::push_back().

00151 {
00152     _parents.push_back(parent);
00153 }

void osg::NodeCore::subParent const NodePtr parent  )  [inline, protected, inherited]
 

Definition at line 156 of file OSGNodeCore.inl.

References osg::NodeCore::_parents, osg::MField< FieldTypeT, fieldNameSpace >::end(), osg::MField< FieldTypeT, fieldNameSpace >::erase(), and osg::MField< FieldTypeT, fieldNameSpace >::find().