1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 07:53:51 +00:00

fix particle alpha

This commit is contained in:
Julien Valentin 2020-04-16 02:48:42 +02:00
parent 4167bdf319
commit 6e2a651252
2 changed files with 3 additions and 8 deletions

View file

@ -1809,14 +1809,6 @@ namespace NifOsg
if (specFlags == 0) if (specFlags == 0)
mat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f,0.f,0.f,0.f)); 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) if (lightmode == 0)
{ {
osg::Vec4f diffuse = mat->getDiffuse(osg::Material::FRONT_AND_BACK); osg::Vec4f diffuse = mat->getDiffuse(osg::Material::FRONT_AND_BACK);

View file

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