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(); horizontalDir = nif->getFloat();
horizontalAngle = nif->getFloat(); horizontalAngle = nif->getFloat();
/*normal?*/ nif->getVector3(); /*normal?*/ nif->getVector3();
/*color?*/ nif->getVector4(); color = nif->getVector4();
size = nif->getFloat(); size = nif->getFloat();
startTime = nif->getFloat(); startTime = nif->getFloat();
stopTime = nif->getFloat(); stopTime = nif->getFloat();

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

@ -1050,9 +1050,8 @@ namespace NifOsg
const osg::Vec3f& position = particledata->vertices[particle.vertex]; const osg::Vec3f& position = particledata->vertices[particle.vertex];
created->setPosition(position); created->setPosition(position);
osg::Vec4f partcolor (1.f,1.f,1.f,1.f); created->setColorRange(osgParticle::rangev4(partctrl->color, partctrl->color));
if (particle.vertex < particledata->colors.size()) created->setAlphaRange(osgParticle::rangef(1.f, 1.f));
partcolor = particledata->colors[particle.vertex];
float size = partctrl->size; float size = partctrl->size;
if (particle.vertex < particledata->sizes.size()) if (particle.vertex < particledata->sizes.size())
@ -1171,7 +1170,7 @@ namespace NifOsg
handleParticleInitialState(nifNode, partsys, partctrl); handleParticleInitialState(nifNode, partsys, partctrl);
partsys->getDefaultParticleTemplate().setSizeRange(osgParticle::rangef(partctrl->size, partctrl->size)); 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)); partsys->getDefaultParticleTemplate().setAlphaRange(osgParticle::rangef(1.f, 1.f));
if (!partctrl->emitter.empty()) if (!partctrl->emitter.empty())

Loading…
Cancel
Save