pull/35/head
Allofich 9 years ago
parent 775162ccdf
commit 9b2cb2fb8c

@ -571,14 +571,13 @@ 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)

@ -268,26 +268,29 @@ namespace MWRender
virtual void setDefaults(osg::StateSet *stateset)
{
stateset->setTextureMode(mTexUnit, GL_TEXTURE_2D, osg::StateAttribute::ON);
osg::TexGen* texGen = new osg::TexGen;
texGen->setMode(osg::TexGen::SPHERE_MAP);
stateset->setTextureAttributeAndModes(mTexUnit, texGen, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
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);
osg::TexEnvCombine* texEnv = new osg::TexEnvCombine;
texEnv->setSource0_RGB(osg::TexEnvCombine::CONSTANT);
texEnv->setConstantColor(mColor);
texEnv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
texEnv->setSource2_RGB(osg::TexEnvCombine::TEXTURE);
texEnv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);
stateset->setTextureAttributeAndModes(mTexUnit, texGen, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
stateset->setTextureAttributeAndModes(mTexUnit, texEnv, osg::StateAttribute::ON);
osg::TexEnvCombine* texEnv = new osg::TexEnvCombine;
texEnv->setSource0_RGB(osg::TexEnvCombine::CONSTANT);
texEnv->setConstantColor(mColor);
texEnv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
texEnv->setSource2_RGB(osg::TexEnvCombine::TEXTURE);
texEnv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);
// 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->setTextureAttributeAndModes(mTexUnit, texEnv, osg::StateAttribute::ON);
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…
Cancel
Save