fix particle alpha

pull/578/head
Julien Valentin 5 years ago
parent 4167bdf319
commit 6e2a651252

@ -1809,14 +1809,6 @@ namespace NifOsg
if (specFlags == 0)
mat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f,0.f,0.f,0.f));
// Particles don't have normals, so can't be diffuse lit.
if (particleMaterial)
{
// NB ignoring diffuse.a()
mat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(0,0,0,1));
mat->setColorMode(osg::Material::AMBIENT);
}
if (lightmode == 0)
{
osg::Vec4f diffuse = mat->getDiffuse(osg::Material::FRONT_AND_BACK);

@ -159,8 +159,11 @@ void ParticleColorAffector::operate(osgParticle::Particle* particle, double /* d
{
float time = static_cast<float>(particle->getAge()/particle->getLifeTime());
osg::Vec4f color = mData.interpKey(time);
float alpha = color.a();
color.a() = 1.0f;
particle->setColorRange(osgParticle::rangev4(color, color));
particle->setAlphaRange(osgParticle::rangef(alpha, alpha));
}
GravityAffector::GravityAffector(const Nif::NiGravity *gravity)

Loading…
Cancel
Save