From 4bbbbb00f659d261fc7ebf58d4aea3437075335f Mon Sep 17 00:00:00 2001 From: "glassmancody.info" Date: Fri, 14 May 2021 10:52:19 -0700 Subject: [PATCH] use particle data for particle system quota --- CHANGELOG.md | 1 + components/nifosg/nifloader.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 647a8fa569..7f22c4aa20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -123,6 +123,7 @@ Bug #5995: NiUVController doesn't calculate the UV offset properly Bug #6007: Crash when ending cutscene is playing Bug #6016: Greeting interrupts Fargoth's sneak-walk + Bug #6028: Particle system controller values are incorrectly used Feature #390: 3rd person look "over the shoulder" Feature #832: OpenMW-CS: Handle deleted references Feature #1536: Show more information about level on menu diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index f7d6fd3ed5..ab25fd744d 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -954,13 +954,17 @@ namespace NifOsg } // Load the initial state of the particle system, i.e. the initial particles and their positions, velocity and colors. - void handleParticleInitialState(const Nif::Node* nifNode, osgParticle::ParticleSystem* partsys, const Nif::NiParticleSystemController* partctrl) + void handleParticleInitialState(const Nif::Node* nifNode, ParticleSystem* partsys, const Nif::NiParticleSystemController* partctrl) { auto particleNode = static_cast(nifNode); if (particleNode->data.empty() || particleNode->data->recType != Nif::RC_NiParticlesData) + { + partsys->setQuota(partctrl->numParticles); return; + } auto particledata = static_cast(particleNode->data.getPtr()); + partsys->setQuota(particledata->numParticles); osg::BoundingBox box; @@ -1095,8 +1099,6 @@ namespace NifOsg handleParticleInitialState(nifNode, partsys, partctrl); - partsys->setQuota(partctrl->numParticles); - partsys->getDefaultParticleTemplate().setSizeRange(osgParticle::rangef(partctrl->size, partctrl->size)); 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));