Disable lighting for particles

Fixes magic cast visuals being too dark depending on the environment.
deque
scrawl 11 years ago
parent 4648524df4
commit c69a311ad8

@ -106,7 +106,7 @@ Ogre::String NIFMaterialLoader::getMaterial(const Nif::ShapeData *shapedata,
const Nif::NiZBufferProperty *zprop,
const Nif::NiSpecularProperty *specprop,
const Nif::NiWireframeProperty *wireprop,
bool &needTangents)
bool &needTangents, bool disableLighting)
{
Ogre::MaterialManager &matMgr = Ogre::MaterialManager::getSingleton();
Ogre::MaterialPtr material = matMgr.getByName(name);
@ -245,6 +245,14 @@ Ogre::String NIFMaterialLoader::getMaterial(const Nif::ShapeData *shapedata,
}
}
if (disableLighting)
{
ambient = Ogre::Vector3(0.f);
diffuse = Ogre::Vector3(0.f);
specular = Ogre::Vector3(0.f);
emissive = Ogre::Vector3(1.f);
}
{
// Generate a hash out of all properties that can affect the material.
size_t h = 0;

@ -49,7 +49,7 @@ public:
const Nif::NiZBufferProperty *zprop,
const Nif::NiSpecularProperty *specprop,
const Nif::NiWireframeProperty *wireprop,
bool &needTangents);
bool &needTangents, bool disableLighting=false);
};
}

@ -850,7 +850,10 @@ class NIFObjectLoader
partsys->setMaterialName(NIFMaterialLoader::getMaterial(particledata, fullname, group,
texprop, matprop, alphaprop,
vertprop, zprop, specprop,
wireprop, needTangents));
wireprop, needTangents,
// MW doesn't light particles, but the MaterialProperty
// used still has lighting, so that must be ignored.
true));
partsys->setCullIndividually(false);
partsys->setParticleQuota(particledata->numParticles);

Loading…
Cancel
Save