diff --git a/include/osg/Camera b/include/osg/Camera index ca60948ea..38a2747db 100644 --- a/include/osg/Camera +++ b/include/osg/Camera @@ -508,6 +508,9 @@ class OSG_EXPORT Camera : public Transform, public CullSettings /** Transform method that must be defined to provide generic interface for scene graph traversals.*/ virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const; + /** Inherit the local cull settings variable from specified CullSettings object, according to the inheritance mask.*/ + virtual void inheritCullSettings(const CullSettings& settings, unsigned int inheritanceMask); + protected : virtual ~Camera(); diff --git a/src/osg/Camera.cpp b/src/osg/Camera.cpp index 41834b5c1..fc831445e 100644 --- a/src/osg/Camera.cpp +++ b/src/osg/Camera.cpp @@ -341,6 +341,18 @@ bool Camera::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const return true; } +void Camera::inheritCullSettings(const CullSettings& settings, unsigned int inheritanceMask) +{ + CullSettings::inheritCullSettings(settings, inheritanceMask); + + if (inheritanceMask & CLEAR_COLOR) + { + //osg::notify(osg::NOTICE)<<"Inheriting slave Camera"<(&settings); + _clearColor = camera->_clearColor; + } +} + void Camera::createCameraThread() { if (!_cameraThread) diff --git a/src/osg/View.cpp b/src/osg/View.cpp index 5a4e9cb95..fc2e4b8ce 100644 --- a/src/osg/View.cpp +++ b/src/osg/View.cpp @@ -157,8 +157,7 @@ void View::updateSlave(unsigned int i) slave._camera->setViewMatrix(_camera->getViewMatrix() * slave._viewOffset); } - slave._camera->inheritCullSettings(*_camera); - if (slave._camera->getInheritanceMask() & osg::CullSettings::CLEAR_COLOR) slave._camera->setClearColor(_camera->getClearColor()); + slave._camera->inheritCullSettings(*_camera, slave._camera->getInheritanceMask()); } bool View::addSlave(osg::Camera* camera, const osg::Matrix& projectionOffset, const osg::Matrix& viewOffset, bool useMastersSceneData) diff --git a/src/osgWrappers/osg/Camera.cpp b/src/osgWrappers/osg/Camera.cpp index 73c1ef537..346fafff8 100644 --- a/src/osgWrappers/osg/Camera.cpp +++ b/src/osgWrappers/osg/Camera.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -637,6 +638,11 @@ BEGIN_OBJECT_REFLECTOR(osg::Camera) __bool__computeWorldToLocalMatrix__Matrix_R1__NodeVisitor_P1, "Transform method that must be defined to provide generic interface for scene graph traversals. ", ""); + I_Method2(void, inheritCullSettings, IN, const osg::CullSettings &, settings, IN, unsigned int, inheritanceMask, + Properties::VIRTUAL, + __void__inheritCullSettings__C5_CullSettings_R1__unsigned_int, + "Inherit the local cull settings variable from specified CullSettings object, according to the inheritance mask. ", + ""); I_SimpleProperty(bool, AllowEventFocus, __bool__getAllowEventFocus, __void__setAllowEventFocus__bool);