mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 20:19:57 +00:00
Cleanups
This commit is contained in:
parent
775162ccdf
commit
9b2cb2fb8c
2 changed files with 33 additions and 30 deletions
|
@ -572,13 +572,12 @@ namespace MWMechanics
|
|||
short effectId = effect.mId;
|
||||
if (target.getClass().canLock(target))
|
||||
{
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::MagicEffect *magiceffect;
|
||||
magiceffect = store.get<ESM::MagicEffect>().find(effectId);
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
|
||||
animation->addSpellCastGlow(magiceffect);
|
||||
if (effectId == ESM::MagicEffect::Lock)
|
||||
{
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::MagicEffect *magiceffect = store.get<ESM::MagicEffect>().find(effectId);
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
|
||||
animation->addSpellCastGlow(magiceffect);
|
||||
if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude
|
||||
{
|
||||
if (caster == getPlayer())
|
||||
|
@ -589,6 +588,10 @@ namespace MWMechanics
|
|||
}
|
||||
else if (effectId == ESM::MagicEffect::Open)
|
||||
{
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::MagicEffect *magiceffect = store.get<ESM::MagicEffect>().find(effectId);
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
|
||||
animation->addSpellCastGlow(magiceffect);
|
||||
if (target.getCellRef().getLockLevel() <= magnitude)
|
||||
{
|
||||
if (target.getCellRef().getLockLevel() > 0)
|
||||
|
|
|
@ -267,9 +267,15 @@ namespace MWRender
|
|||
}
|
||||
|
||||
virtual void setDefaults(osg::StateSet *stateset)
|
||||
{
|
||||
if (mDone)
|
||||
{
|
||||
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXTURE);
|
||||
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXGEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
stateset->setTextureMode(mTexUnit, GL_TEXTURE_2D, osg::StateAttribute::ON);
|
||||
|
||||
osg::TexGen* texGen = new osg::TexGen;
|
||||
texGen->setMode(osg::TexGen::SPHERE_MAP);
|
||||
|
||||
|
@ -283,11 +289,8 @@ namespace MWRender
|
|||
texEnv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);
|
||||
|
||||
stateset->setTextureAttributeAndModes(mTexUnit, texEnv, osg::StateAttribute::ON);
|
||||
|
||||
// Reduce the texture list back down by one when a temporary glow finishes
|
||||
// to allow FindLowestUnusedTexUnitVisitor to choose the same texunit again.
|
||||
if (mDone)
|
||||
stateset->getTextureAttributeList().resize(stateset->getTextureAttributeList().size() - 1);
|
||||
stateset->addUniform(new osg::Uniform("envMapColor", mColor));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
|
||||
|
@ -295,7 +298,6 @@ namespace MWRender
|
|||
if (mColorChanged){
|
||||
this->reset();
|
||||
setDefaults(stateset);
|
||||
mResourceSystem->getSceneManager()->recreateShaders(mNode);
|
||||
mColorChanged = false;
|
||||
}
|
||||
if (mDone)
|
||||
|
@ -313,10 +315,10 @@ namespace MWRender
|
|||
{
|
||||
if (mOriginalDuration >= 0) // if this glowupdater was a temporary glow since its creation
|
||||
{
|
||||
for (size_t i = 0; i < mTextures.size(); i++)
|
||||
stateset->removeTextureAttribute(mTexUnit, mTextures[i]);
|
||||
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXTURE);
|
||||
this->reset();
|
||||
mDone = true;
|
||||
mResourceSystem->getSceneManager()->recreateShaders(mNode);
|
||||
}
|
||||
if (mOriginalDuration < 0) // if this glowupdater was originally a permanent glow
|
||||
{
|
||||
|
@ -325,9 +327,7 @@ namespace MWRender
|
|||
mColor = mOriginalColor;
|
||||
this->reset();
|
||||
setDefaults(stateset);
|
||||
stateset->addUniform(new osg::Uniform("envMapColor", mColor));
|
||||
}
|
||||
mResourceSystem->getSceneManager()->recreateShaders(mNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue