mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 19:36:40 +00:00
Make Lights with OffDefault flag not emit light nor particles when placed in a cell (Fixes #1796)
This commit is contained in:
parent
8866b5f860
commit
28fe81df90
6 changed files with 23 additions and 5 deletions
|
@ -56,8 +56,11 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
const std::string model = getModel(ptr);
|
||||||
|
|
||||||
|
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||||
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
// Insert even if model is empty, so that the light is added
|
// Insert even if model is empty, so that the light is added
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model, false, !(ref->mBase->mData.mFlags & ESM::Light::OffDefault));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||||
|
|
|
@ -1431,6 +1431,15 @@ void ObjectAnimation::addLight(const ESM::Light *light)
|
||||||
addExtraLight(mInsert->getCreator(), mObjectRoot, light);
|
addExtraLight(mInsert->getCreator(), mObjectRoot, light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectAnimation::removeParticles()
|
||||||
|
{
|
||||||
|
for (unsigned int i=0; i<mObjectRoot->mParticles.size(); ++i)
|
||||||
|
{
|
||||||
|
mObjectRoot->mSceneMgr->destroyParticleSystem(mObjectRoot->mParticles[i]);
|
||||||
|
}
|
||||||
|
mObjectRoot->mParticles.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class FindEntityTransparency {
|
class FindEntityTransparency {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -324,6 +324,7 @@ public:
|
||||||
ObjectAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
ObjectAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
||||||
|
|
||||||
void addLight(const ESM::Light *light);
|
void addLight(const ESM::Light *light);
|
||||||
|
void removeParticles();
|
||||||
|
|
||||||
bool canBatch() const;
|
bool canBatch() const;
|
||||||
void fillBatch(Ogre::StaticGeometry *sg);
|
void fillBatch(Ogre::StaticGeometry *sg);
|
||||||
|
|
|
@ -73,14 +73,19 @@ void Objects::insertBegin(const MWWorld::Ptr& ptr)
|
||||||
ptr.getRefData().setBaseNode(insert);
|
ptr.getRefData().setBaseNode(insert);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool batch)
|
void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool batch, bool addLight)
|
||||||
{
|
{
|
||||||
insertBegin(ptr);
|
insertBegin(ptr);
|
||||||
|
|
||||||
std::auto_ptr<ObjectAnimation> anim(new ObjectAnimation(ptr, mesh));
|
std::auto_ptr<ObjectAnimation> anim(new ObjectAnimation(ptr, mesh));
|
||||||
|
|
||||||
if(ptr.getTypeName() == typeid(ESM::Light).name())
|
if(ptr.getTypeName() == typeid(ESM::Light).name())
|
||||||
anim->addLight(ptr.get<ESM::Light>()->mBase);
|
{
|
||||||
|
if (addLight)
|
||||||
|
anim->addLight(ptr.get<ESM::Light>()->mBase);
|
||||||
|
else
|
||||||
|
anim->removeParticles();
|
||||||
|
}
|
||||||
|
|
||||||
if (!mesh.empty())
|
if (!mesh.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
, mRootNode(NULL)
|
, mRootNode(NULL)
|
||||||
{}
|
{}
|
||||||
~Objects(){}
|
~Objects(){}
|
||||||
void insertModel(const MWWorld::Ptr& ptr, const std::string &model, bool batch=false);
|
void insertModel(const MWWorld::Ptr& ptr, const std::string &model, bool batch=false, bool addLight=false);
|
||||||
|
|
||||||
ObjectAnimation* getAnimation(const MWWorld::Ptr &ptr);
|
ObjectAnimation* getAnimation(const MWWorld::Ptr &ptr);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ struct Light
|
||||||
Negative = 0x004, // Negative light - i.e. darkness
|
Negative = 0x004, // Negative light - i.e. darkness
|
||||||
Flicker = 0x008,
|
Flicker = 0x008,
|
||||||
Fire = 0x010,
|
Fire = 0x010,
|
||||||
OffDefault = 0x020, // Off by default
|
OffDefault = 0x020, // Off by default - does not burn while placed in a cell, but can burn when equipped by an NPC
|
||||||
FlickerSlow = 0x040,
|
FlickerSlow = 0x040,
|
||||||
Pulse = 0x080,
|
Pulse = 0x080,
|
||||||
PulseSlow = 0x100
|
PulseSlow = 0x100
|
||||||
|
|
Loading…
Reference in a new issue