Use NiParticleSystemController's color for the initial particle color

check_span
Alexei Kotov 2 years ago
parent caf971b979
commit 014de72644

@ -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();

@ -52,6 +52,7 @@ struct NiParticleSystemController : public Controller
float horizontalDir;
float horizontalAngle;
osg::Vec4f color;
float size;
float startTime;
float stopTime;

@ -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())

Loading…
Cancel
Save