From 1fc7cb8191116c551dbabc69bd0204af6a86fbc3 Mon Sep 17 00:00:00 2001 From: Alexei Dobrohotov Date: Sun, 8 Aug 2021 03:36:35 +0300 Subject: [PATCH] Don't use FreezeOnCull for any particle system (#4744) --- CHANGELOG.md | 1 + apps/openmw/mwrender/animation.cpp | 3 --- apps/openmw/mwrender/sky.cpp | 3 --- apps/openmw/mwworld/projectilemanager.cpp | 3 --- components/nifosg/nifloader.cpp | 2 -- components/sceneutil/visitor.cpp | 11 ----------- components/sceneutil/visitor.hpp | 14 -------------- 7 files changed, 1 insertion(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d8405fb41..f735bd5a13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Bug #3846: Strings starting with "-" fail to compile if not enclosed in quotes Bug #3905: Great House Dagoth issues Bug #4203: Resurrecting an actor should close the loot GUI + Bug #4744: Invisible particles must still be processed Bug #4752: UpdateCellCommand doesn't undo properly Bug #5100: Persuasion doesn't always clamp the resulting disposition Bug #5120: Scripted object spawning updates physics system diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 53673d8a22..07b1deeff3 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1678,9 +1678,6 @@ namespace MWRender SceneUtil::FindMaxControllerLengthVisitor findMaxLengthVisitor; node->accept(findMaxLengthVisitor); - // FreezeOnCull doesn't work so well with effect particles, that tend to have moving emitters - SceneUtil::DisableFreezeOnCullVisitor disableFreezeOnCullVisitor; - node->accept(disableFreezeOnCullVisitor); node->setNodeMask(Mask_Effect); params.mMaxControllerLength = findMaxLengthVisitor.getMaxLength(); diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 2b58730fe1..05ce0f1560 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -1731,9 +1731,6 @@ void SkyManager::setWeather(const WeatherResult& weather) mParticleEffect->accept(alphaFaderSetupVisitor); - SceneUtil::DisableFreezeOnCullVisitor disableFreezeOnCullVisitor; - mParticleEffect->accept(disableFreezeOnCullVisitor); - SceneUtil::FindByClassVisitor findPSVisitor(std::string("ParticleSystem")); mParticleEffect->accept(findPSVisitor); diff --git a/apps/openmw/mwworld/projectilemanager.cpp b/apps/openmw/mwworld/projectilemanager.cpp index 439f5a4605..04f4573369 100644 --- a/apps/openmw/mwworld/projectilemanager.cpp +++ b/apps/openmw/mwworld/projectilemanager.cpp @@ -238,9 +238,6 @@ namespace MWWorld state.mNode->addChild(projectileLightSource); projectileLightSource->setLight(projectileLight); } - - SceneUtil::DisableFreezeOnCullVisitor disableFreezeOnCullVisitor; - state.mNode->accept(disableFreezeOnCullVisitor); state.mNode->addCullCallback(new SceneUtil::LightListCallback); diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 83b9fb61c2..17551e0b91 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -1103,8 +1103,6 @@ namespace NifOsg partsys->getDefaultParticleTemplate().setColorRange(osgParticle::rangev4(osg::Vec4f(1.f,1.f,1.f,1.f), osg::Vec4f(1.f,1.f,1.f,1.f))); partsys->getDefaultParticleTemplate().setAlphaRange(osgParticle::rangef(1.f, 1.f)); - partsys->setFreezeOnCull(true); - if (!partctrl->emitter.empty()) { osg::ref_ptr emitter = handleParticleEmitter(partctrl); diff --git a/components/sceneutil/visitor.cpp b/components/sceneutil/visitor.cpp index 1f5a0ea4cf..f1f15f786f 100644 --- a/components/sceneutil/visitor.cpp +++ b/components/sceneutil/visitor.cpp @@ -46,17 +46,6 @@ namespace SceneUtil { } - void DisableFreezeOnCullVisitor::apply(osg::MatrixTransform &node) - { - traverse(node); - } - - void DisableFreezeOnCullVisitor::apply(osg::Drawable& drw) - { - if (osgParticle::ParticleSystem* partsys = dynamic_cast(&drw)) - partsys->setFreezeOnCull(false); - } - void NodeMapVisitor::apply(osg::MatrixTransform& trans) { // Take transformation for first found node in file diff --git a/components/sceneutil/visitor.hpp b/components/sceneutil/visitor.hpp index 5e041dc454..fcf3c1f944 100644 --- a/components/sceneutil/visitor.hpp +++ b/components/sceneutil/visitor.hpp @@ -45,20 +45,6 @@ namespace SceneUtil std::vector mFoundNodes; }; - // Disable freezeOnCull for all visited particlesystems - class DisableFreezeOnCullVisitor : public osg::NodeVisitor - { - public: - DisableFreezeOnCullVisitor() - : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) - { - } - - void apply(osg::MatrixTransform& node) override; - - void apply(osg::Drawable& drw) override; - }; - /// Maps names to nodes class NodeMapVisitor : public osg::NodeVisitor {