diff --git a/components/nif/controller.cpp b/components/nif/controller.cpp index 7106335668..d4ba54b840 100644 --- a/components/nif/controller.cpp +++ b/components/nif/controller.cpp @@ -40,7 +40,7 @@ namespace Nif horizontalDir = nif->getFloat(); horizontalAngle = nif->getFloat(); /*normal?*/ nif->getVector3(); - /*color?*/ nif->getVector4(); + color = nif->getVector4(); size = nif->getFloat(); startTime = nif->getFloat(); stopTime = nif->getFloat(); diff --git a/components/nif/controller.hpp b/components/nif/controller.hpp index a3df63f913..e14aba46ad 100644 --- a/components/nif/controller.hpp +++ b/components/nif/controller.hpp @@ -52,6 +52,7 @@ struct NiParticleSystemController : public Controller float horizontalDir; float horizontalAngle; + osg::Vec4f color; float size; float startTime; float stopTime; diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 474fc30c32..fab39049e0 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -1050,9 +1050,8 @@ namespace NifOsg const osg::Vec3f& position = particledata->vertices[particle.vertex]; created->setPosition(position); - osg::Vec4f partcolor (1.f,1.f,1.f,1.f); - if (particle.vertex < particledata->colors.size()) - partcolor = particledata->colors[particle.vertex]; + created->setColorRange(osgParticle::rangev4(partctrl->color, partctrl->color)); + created->setAlphaRange(osgParticle::rangef(1.f, 1.f)); float size = partctrl->size; if (particle.vertex < particledata->sizes.size()) @@ -1171,7 +1170,7 @@ namespace NifOsg handleParticleInitialState(nifNode, partsys, partctrl); 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().setColorRange(osgParticle::rangev4(partctrl->color, partctrl->color)); partsys->getDefaultParticleTemplate().setAlphaRange(osgParticle::rangef(1.f, 1.f)); if (!partctrl->emitter.empty())