Commits

Anonymous committed 9793fee Draft

Moved mask settings into ShadowSettings

Comments (0)

Files changed (4)

include/osgShadow/ShadowSettings

 
         META_Object(osgShadow, ShadowSettings);
 
+        void setReceivesShadowTraversalMask(unsigned int mask) { _receivesShadowTraversalMask = mask; }
+        unsigned int getReceivesShadowTraversalMask() const { return _receivesShadowTraversalMask; }
+
+        void setCastsShadowTraversalMask(unsigned int mask) { _castsShadowTraversalMask = mask; }
+        unsigned int getCastsShadowTraversalMask() const { return _castsShadowTraversalMask; }
+
         /** Set the LightNum of the light in the scene to assign a shadow for.
           * Default value is -1, which signifies that shadow technique should automatically select an active light
           * to assign a shadow, typically this will be the first active light found. */
 
         virtual ~ShadowSettings();
 
-        int                                     _lightNum;
-        unsigned int                            _baseShadowTextureUnit;
-        bool                                    _useShadowMapTextureOverride;
-        osg::Vec2s                              _textureSize;
 
-        double                                  _minimumShadowMapNearFarRatio;
-        ShadowMapProjectionHint                 _shadowMapProjectionHint;
-        double                                  _perspectiveShadowMapCutOffAngle;
+        unsigned int            _receivesShadowTraversalMask;
+        unsigned int            _castsShadowTraversalMask;
 
-        unsigned int                            _numShadowMapsPerLight;
-        MultipleShadowMapHint                   _multipleShadowMapHint;
+        int                     _lightNum;
+        unsigned int            _baseShadowTextureUnit;
+        bool                    _useShadowMapTextureOverride;
+        osg::Vec2s              _textureSize;
 
-        ShaderHint                              _shaderHint;
-        bool                                    _debugDraw;
+        double                  _minimumShadowMapNearFarRatio;
+        ShadowMapProjectionHint _shadowMapProjectionHint;
+        double                  _perspectiveShadowMapCutOffAngle;
+
+        unsigned int            _numShadowMapsPerLight;
+        MultipleShadowMapHint   _multipleShadowMapHint;
+
+        ShaderHint              _shaderHint;
+        bool                    _debugDraw;
 
 };
 

include/osgShadow/ShadowedScene

 
         virtual void traverse(osg::NodeVisitor& nv);
 
-        void setReceivesShadowTraversalMask(unsigned int mask) { _receivesShadowTraversalMask = mask; }
-        unsigned int getReceivesShadowTraversalMask() const { return _receivesShadowTraversalMask; }
-
-        void setCastsShadowTraversalMask(unsigned int mask) { _castsShadowTraversalMask = mask; }
-        unsigned int getCastsShadowTraversalMask() const { return _castsShadowTraversalMask; }
-
         void setShadowSettings(ShadowSettings* ss);
         ShadowSettings* getShadowSettings() { return _shadowSettings.get(); }
         const ShadowSettings* getShadowSettings() const { return _shadowSettings.get(); }
            * for all graphics contexts. */
         virtual void releaseGLObjects(osg::State* = 0) const;
 
+    public:
+
+        /** deprecated, moved to ShadowSettings.*/
+        void setReceivesShadowTraversalMask(unsigned int mask) { if (_shadowSettings.valid()) _shadowSettings->setReceivesShadowTraversalMask(mask); }
+        /** deprecated, moved to ShadowSettings.*/
+        unsigned int getReceivesShadowTraversalMask() const { return _shadowSettings.valid() ? _shadowSettings->getReceivesShadowTraversalMask() : 0xffffffff; }
+
+        /** deprecated, moved to ShadowSettings.*/
+        void setCastsShadowTraversalMask(unsigned int mask) { if (_shadowSettings.valid()) _shadowSettings->setCastsShadowTraversalMask(mask);  }
+        /** deprecated, moved to ShadowSettings.*/
+        unsigned int getCastsShadowTraversalMask() const { return _shadowSettings.valid() ? _shadowSettings->getCastsShadowTraversalMask() : 0xffffffff; }
+
 protected:
 
         virtual ~ShadowedScene();
 
-        unsigned int _receivesShadowTraversalMask;
-        unsigned int _castsShadowTraversalMask;
-
         osg::ref_ptr<ShadowSettings>    _shadowSettings;
         osg::ref_ptr<ShadowTechnique>   _shadowTechnique;
 

src/osgShadow/ShadowSettings.cpp

 using namespace osgShadow;
 
 ShadowSettings::ShadowSettings():
+     _receivesShadowTraversalMask(0xffffffff),
+     _castsShadowTraversalMask(0xffffffff),
     _lightNum(-1),
     _baseShadowTextureUnit(1),
     _useShadowMapTextureOverride(true),
 
 ShadowSettings::ShadowSettings(const ShadowSettings& ss, const osg::CopyOp& copyop):
     Object(ss,copyop),
+    _receivesShadowTraversalMask(ss._receivesShadowTraversalMask),
+    _castsShadowTraversalMask(ss._castsShadowTraversalMask),
     _lightNum(ss._lightNum),
     _baseShadowTextureUnit(ss._baseShadowTextureUnit),
     _useShadowMapTextureOverride(ss._useShadowMapTextureOverride),

src/osgShadow/ShadowedScene.cpp

 
 using namespace osgShadow;
 
-ShadowedScene::ShadowedScene(ShadowTechnique* st):
-    _receivesShadowTraversalMask(0xffffffff),
-    _castsShadowTraversalMask(0xffffffff)
+ShadowedScene::ShadowedScene(ShadowTechnique* st)
 {
     setNumChildrenRequiringUpdateTraversal(1);
 
 }
 
 ShadowedScene::ShadowedScene(const ShadowedScene& ss, const osg::CopyOp& copyop):
-    osg::Group(ss,copyop),
-    _receivesShadowTraversalMask(ss._receivesShadowTraversalMask),
-    _castsShadowTraversalMask(ss._castsShadowTraversalMask)
+    osg::Group(ss,copyop)
 {
     setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);