From 5f0a33ba952b9ba9c6a27af06ee6d9fa9169236b Mon Sep 17 00:00:00 2001 From: gerrit Date: Thu, 26 Apr 2012 08:15:13 +0800 Subject: [PATCH] added: travMask to csm viewport --- .../Contrib/ComplexSceneManager/OSGCSMViewport.cpp | 1 + .../Contrib/ComplexSceneManager/OSGCSMViewport.fcd | 9 +++ .../ComplexSceneManager/OSGCSMViewportBase.cpp | 78 ++++++++++++++++++++++ .../ComplexSceneManager/OSGCSMViewportBase.h | 18 ++++- .../ComplexSceneManager/OSGCSMViewportBase.inl | 28 ++++++++ Source/System/Action/Base/OSGAction.cpp | 34 ++++++---- 6 files changed, 152 insertions(+), 16 deletions(-) diff --git a/Source/Contrib/ComplexSceneManager/OSGCSMViewport.cpp b/Source/Contrib/ComplexSceneManager/OSGCSMViewport.cpp index 9f1fd7000..9bd2c1b33 100644 --- a/Source/Contrib/ComplexSceneManager/OSGCSMViewport.cpp +++ b/Source/Contrib/ComplexSceneManager/OSGCSMViewport.cpp @@ -461,6 +461,7 @@ bool CSMViewport::init(CSMWindow *pCSMWin) (*vIt)->setRoot (_sfRoot .getValue()); (*vIt)->setBackground (_sfBackground .getValue()); (*vIt)->setRenderOptions(_sfRenderOptions.getValue()); + (*vIt)->setTravMask (_sfTravMask .getValue()); MFUnrecForegroundPtr::const_iterator fIt = getMFForegrounds()->begin(); MFUnrecForegroundPtr::const_iterator fEnd = getMFForegrounds()->end (); diff --git a/Source/Contrib/ComplexSceneManager/OSGCSMViewport.fcd b/Source/Contrib/ComplexSceneManager/OSGCSMViewport.fcd index fbcae8e9e..f8227c961 100644 --- a/Source/Contrib/ComplexSceneManager/OSGCSMViewport.fcd +++ b/Source/Contrib/ComplexSceneManager/OSGCSMViewport.fcd @@ -70,6 +70,15 @@ > + + (&CSMViewport::editHandleTravMask), + static_cast(&CSMViewport::getHandleTravMask)); + + oType.addInitialDesc(pDesc); + pDesc = new SFUnrecRenderOptionsPtr::Description( SFUnrecRenderOptionsPtr::getClassType(), "renderOptions", @@ -365,6 +381,15 @@ CSMViewportBase::TypeObject CSMViewportBase::_type( " >\n" " \n" " \n" + " \n" + " ::BitsSet)), _sfRenderOptions (NULL), _sfStereoMode (std::string("none")), _sfPassive (bool(false)), @@ -885,6 +937,7 @@ CSMViewportBase::CSMViewportBase(const CSMViewportBase &source) : _mfForegrounds (), _sfLeftBottom (source._sfLeftBottom ), _sfRightTop (source._sfRightTop ), + _sfTravMask (source._sfTravMask ), _sfRenderOptions (NULL), _sfStereoMode (source._sfStereoMode ), _sfPassive (source._sfPassive ), @@ -1100,6 +1153,31 @@ EditFieldHandlePtr CSMViewportBase::editHandleRightTop (void) return returnValue; } +GetFieldHandlePtr CSMViewportBase::getHandleTravMask (void) const +{ + SFUInt32::GetHandlePtr returnValue( + new SFUInt32::GetHandle( + &_sfTravMask, + this->getType().getFieldDesc(TravMaskFieldId), + const_cast(this))); + + return returnValue; +} + +EditFieldHandlePtr CSMViewportBase::editHandleTravMask (void) +{ + SFUInt32::EditHandlePtr returnValue( + new SFUInt32::EditHandle( + &_sfTravMask, + this->getType().getFieldDesc(TravMaskFieldId), + this)); + + + editSField(TravMaskFieldMask); + + return returnValue; +} + GetFieldHandlePtr CSMViewportBase::getHandleRenderOptions (void) const { SFUnrecRenderOptionsPtr::GetHandlePtr returnValue( diff --git a/Source/Contrib/ComplexSceneManager/OSGCSMViewportBase.h b/Source/Contrib/ComplexSceneManager/OSGCSMViewportBase.h index b5a25badb..de15e6427 100644 --- a/Source/Contrib/ComplexSceneManager/OSGCSMViewportBase.h +++ b/Source/Contrib/ComplexSceneManager/OSGCSMViewportBase.h @@ -70,9 +70,9 @@ #include "OSGBackgroundFields.h" // Background type #include "OSGForegroundFields.h" // Foregrounds type #include "OSGVecFields.h" // LeftBottom type +#include "OSGSysFields.h" // TravMask type #include "OSGRenderOptionsFields.h" // RenderOptions type #include "OSGBaseFields.h" // StereoMode type -#include "OSGSysFields.h" // Passive type #include "OSGCSMViewportFields.h" @@ -107,7 +107,8 @@ class OSG_CONTRIBCSM_DLLMAPPING CSMViewportBase : public FieldContainer ForegroundsFieldId = BackgroundFieldId + 1, LeftBottomFieldId = ForegroundsFieldId + 1, RightTopFieldId = LeftBottomFieldId + 1, - RenderOptionsFieldId = RightTopFieldId + 1, + TravMaskFieldId = RightTopFieldId + 1, + RenderOptionsFieldId = TravMaskFieldId + 1, StereoModeFieldId = RenderOptionsFieldId + 1, PassiveFieldId = StereoModeFieldId + 1, ServerIdFieldId = PassiveFieldId + 1, @@ -126,6 +127,8 @@ class OSG_CONTRIBCSM_DLLMAPPING CSMViewportBase : public FieldContainer (TypeTraits::One << LeftBottomFieldId); static const OSG::BitVector RightTopFieldMask = (TypeTraits::One << RightTopFieldId); + static const OSG::BitVector TravMaskFieldMask = + (TypeTraits::One << TravMaskFieldId); static const OSG::BitVector RenderOptionsFieldMask = (TypeTraits::One << RenderOptionsFieldId); static const OSG::BitVector StereoModeFieldMask = @@ -143,6 +146,7 @@ class OSG_CONTRIBCSM_DLLMAPPING CSMViewportBase : public FieldContainer typedef MFUnrecForegroundPtr MFForegroundsType; typedef SFVec2f SFLeftBottomType; typedef SFVec2f SFRightTopType; + typedef SFUInt32 SFTravMaskType; typedef SFUnrecRenderOptionsPtr SFRenderOptionsType; typedef SFString SFStereoModeType; typedef SFBool SFPassiveType; @@ -185,6 +189,9 @@ class OSG_CONTRIBCSM_DLLMAPPING CSMViewportBase : public FieldContainer SFVec2f *editSFRightTop (void); const SFVec2f *getSFRightTop (void) const; + + SFUInt32 *editSFTravMask (void); + const SFUInt32 *getSFTravMask (void) const; const SFUnrecRenderOptionsPtr *getSFRenderOptions (void) const; SFUnrecRenderOptionsPtr *editSFRenderOptions (void); @@ -212,6 +219,9 @@ class OSG_CONTRIBCSM_DLLMAPPING CSMViewportBase : public FieldContainer Vec2f &editRightTop (void); const Vec2f &getRightTop (void) const; + UInt32 &editTravMask (void); + UInt32 getTravMask (void) const; + RenderOptions * getRenderOptions (void) const; std::string &editStereoMode (void); @@ -233,6 +243,7 @@ class OSG_CONTRIBCSM_DLLMAPPING CSMViewportBase : public FieldContainer void setBackground (Background * const value); void setLeftBottom (const Vec2f &value); void setRightTop (const Vec2f &value); + void setTravMask (const UInt32 value); void setRenderOptions (RenderOptions * const value); void setStereoMode (const std::string &value); void setPassive (const bool value); @@ -313,6 +324,7 @@ class OSG_CONTRIBCSM_DLLMAPPING CSMViewportBase : public FieldContainer MFUnrecForegroundPtr _mfForegrounds; SFVec2f _sfLeftBottom; SFVec2f _sfRightTop; + SFUInt32 _sfTravMask; SFUnrecRenderOptionsPtr _sfRenderOptions; SFString _sfStereoMode; SFBool _sfPassive; @@ -357,6 +369,8 @@ class OSG_CONTRIBCSM_DLLMAPPING CSMViewportBase : public FieldContainer EditFieldHandlePtr editHandleLeftBottom (void); GetFieldHandlePtr getHandleRightTop (void) const; EditFieldHandlePtr editHandleRightTop (void); + GetFieldHandlePtr getHandleTravMask (void) const; + EditFieldHandlePtr editHandleTravMask (void); GetFieldHandlePtr getHandleRenderOptions (void) const; EditFieldHandlePtr editHandleRenderOptions (void); GetFieldHandlePtr getHandleStereoMode (void) const; diff --git a/Source/Contrib/ComplexSceneManager/OSGCSMViewportBase.inl b/Source/Contrib/ComplexSceneManager/OSGCSMViewportBase.inl index a4b81b8d9..c82074de7 100644 --- a/Source/Contrib/ComplexSceneManager/OSGCSMViewportBase.inl +++ b/Source/Contrib/ComplexSceneManager/OSGCSMViewportBase.inl @@ -172,6 +172,31 @@ void CSMViewportBase::setRightTop(const Vec2f &value) _sfRightTop.setValue(value); } +//! Get the value of the CSMViewport::_sfTravMask field. + +inline +UInt32 &CSMViewportBase::editTravMask(void) +{ + editSField(TravMaskFieldMask); + + return _sfTravMask.getValue(); +} + +//! Get the value of the CSMViewport::_sfTravMask field. +inline + UInt32 CSMViewportBase::getTravMask(void) const +{ + return _sfTravMask.getValue(); +} + +//! Set the value of the CSMViewport::_sfTravMask field. +inline +void CSMViewportBase::setTravMask(const UInt32 value) +{ + editSField(TravMaskFieldMask); + + _sfTravMask.setValue(value); +} //! Get the value of the CSMViewport::_sfRenderOptions field. inline @@ -303,6 +328,9 @@ void CSMViewportBase::execSync ( CSMViewportBase *pFrom, if(FieldBits::NoField != (RightTopFieldMask & whichField)) _sfRightTop.syncWith(pFrom->_sfRightTop); + if(FieldBits::NoField != (TravMaskFieldMask & whichField)) + _sfTravMask.syncWith(pFrom->_sfTravMask); + if(FieldBits::NoField != (RenderOptionsFieldMask & whichField)) _sfRenderOptions.syncWith(pFrom->_sfRenderOptions); diff --git a/Source/System/Action/Base/OSGAction.cpp b/Source/System/Action/Base/OSGAction.cpp index 6a837c0c6..b3dfa3cf6 100644 --- a/Source/System/Action/Base/OSGAction.cpp +++ b/Source/System/Action/Base/OSGAction.cpp @@ -145,17 +145,17 @@ Action *Action::getPrototype(void) */ Action::Action(void) : - Inherited ( ), - _enterFunctors( ), - _leaveFunctors( ), - _actNode (NULL ), - _actParent (NULL ), - _actList (NULL ), - _useNewList (false ), - _travMask (TypeTraits::getMax()), - _sTravMask ( ), - _nodeEnterCB ( ), - _nodeLeaveCB ( ) + Inherited ( ), + _enterFunctors( ), + _leaveFunctors( ), + _actNode (NULL ), + _actParent (NULL ), + _actList (NULL ), + _useNewList (false ), + _travMask (TypeTraits::BitsSet), + _sTravMask ( ), + _nodeEnterCB ( ), + _nodeLeaveCB ( ) { if(_defaultEnterFunctors) _enterFunctors = *_defaultEnterFunctors; @@ -300,8 +300,10 @@ Action::ResultE Action::recurse(Node * const node) if(node == NULL) return Continue; - if((node->getTravMask() & getTravMask()) == 0) + if((node->getTravMask() & getTravMask()) == 0x0000) + { return Continue; + } #if OSG_1_COMPAT if(node->getOcclusionMask() & 1) @@ -400,8 +402,10 @@ Action::ResultE Action::recurseNoCallback(Node * const node) if(node == NULL) return Continue; - if((node->getTravMask() & getTravMask()) == 0) + if((node->getTravMask() & getTravMask()) == 0x0000) + { return Continue; + } NodeCore *core = node->getCore(); @@ -455,8 +459,10 @@ Action::ResultE Action::recurseMultiCoreFrom(Node * const node, if(node == NULL) return Continue; - if((node->getTravMask() & getTravMask()) == 0) + if((node->getTravMask() & getTravMask()) == 0x0000) + { return Continue; + } OSG_ASSERT(node->getCore() == mcore); -- 2.11.4.GIT