1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-22 02:09:49 +00:00

Merge branch 'skyfix' into 'master'

Do not lose existing callbacks for sky node

Closes #7427

See merge request OpenMW/openmw!3171
This commit is contained in:
AnyOldName3 2023-06-24 18:02:44 +00:00
commit f34b57656a
2 changed files with 5 additions and 2 deletions

View file

@ -147,7 +147,8 @@ namespace MWRender
void PrecipitationOccluder::enable() void PrecipitationOccluder::enable()
{ {
mSkyNode->setCullCallback(new PrecipitationOcclusionUpdater(mDepthTexture)); mSkyCullCallback = new PrecipitationOcclusionUpdater(mDepthTexture);
mSkyNode->addCullCallback(mSkyCullCallback);
mCamera->setCullCallback(new DepthCameraUpdater); mCamera->setCullCallback(new DepthCameraUpdater);
mRootNode->removeChild(mCamera); mRootNode->removeChild(mCamera);
@ -156,8 +157,9 @@ namespace MWRender
void PrecipitationOccluder::disable() void PrecipitationOccluder::disable()
{ {
mSkyNode->setCullCallback(nullptr); mSkyNode->removeCullCallback(mSkyCullCallback);
mCamera->setCullCallback(nullptr); mCamera->setCullCallback(nullptr);
mSkyCullCallback = nullptr;
mRootNode->removeChild(mCamera); mRootNode->removeChild(mCamera);
} }

View file

@ -23,6 +23,7 @@ namespace MWRender
osg::Group* mSkyNode; osg::Group* mSkyNode;
osg::Group* mSceneNode; osg::Group* mSceneNode;
osg::Group* mRootNode; osg::Group* mRootNode;
osg::ref_ptr<osg::Callback> mSkyCullCallback;
osg::ref_ptr<osg::Camera> mCamera; osg::ref_ptr<osg::Camera> mCamera;
osg::ref_ptr<osg::Camera> mSceneCamera; osg::ref_ptr<osg::Camera> mSceneCamera;
osg::ref_ptr<osg::Texture2D> mDepthTexture; osg::ref_ptr<osg::Texture2D> mDepthTexture;