Fix for blood effect texture overrides

coverity_scan^2
Allofich 8 years ago
parent a033ba3bd2
commit 01774c656c

@ -25,7 +25,7 @@ EffectManager::~EffectManager()
clear();
}
void EffectManager::addEffect(const std::string &model, const std::string& textureOverride, const osg::Vec3f &worldPosition, float scale)
void EffectManager::addEffect(const std::string &model, const std::string& textureOverride, const osg::Vec3f &worldPosition, float scale, bool isMagicVFX)
{
osg::ref_ptr<osg::Node> node = mResourceSystem->getSceneManager()->getInstance(model);
@ -46,7 +46,10 @@ void EffectManager::addEffect(const std::string &model, const std::string& textu
SceneUtil::AssignControllerSourcesVisitor assignVisitor(effect.mAnimTime);
node->accept(assignVisitor);
overrideFirstRootTexture(textureOverride, mResourceSystem, node);
if (isMagicVFX)
overrideFirstRootTexture(textureOverride, mResourceSystem, node);
else
overrideTexture(textureOverride, mResourceSystem, node);
mParentNode->addChild(trans);
mResourceSystem->getSceneManager()->notifyAttached(node);

@ -33,7 +33,7 @@ namespace MWRender
~EffectManager();
/// Add an effect. When it's finished playing, it will be removed automatically.
void addEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPosition, float scale);
void addEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPosition, float scale, bool isMagicVFX = true);
void update(float dt);

@ -742,9 +742,9 @@ namespace MWRender
mObjects->updatePtr(old, updated);
}
void RenderingManager::spawnEffect(const std::string &model, const std::string &texture, const osg::Vec3f &worldPosition, float scale)
void RenderingManager::spawnEffect(const std::string &model, const std::string &texture, const osg::Vec3f &worldPosition, float scale, bool isMagicVFX)
{
mEffectManager->addEffect(model, texture, worldPosition, scale);
mEffectManager->addEffect(model, texture, worldPosition, scale, isMagicVFX);
}
void RenderingManager::notifyWorldSpaceChanged()

@ -138,7 +138,7 @@ namespace MWRender
SkyManager* getSkyManager();
void spawnEffect(const std::string &model, const std::string &texture, const osg::Vec3f &worldPosition, float scale = 1.f);
void spawnEffect(const std::string &model, const std::string &texture, const osg::Vec3f &worldPosition, float scale = 1.f, bool isMagicVFX = true);
/// Clear all savegame-specific data
void clear();

@ -65,7 +65,7 @@ void overrideTexture(const std::string &texture, Resource::ResourceSystem *resou
else
stateset = new osg::StateSet;
stateset->setTextureAttribute(0, tex, osg::StateAttribute::PROTECTED);
stateset->setTextureAttribute(0, tex, osg::StateAttribute::OVERRIDE);
node->setStateSet(stateset);
}

@ -17,6 +17,8 @@ namespace Resource
namespace MWRender
{
// Overrides the texture of nodes in the mesh that had the same NiTexturingProperty as the first NiTexturingProperty of the .NIF file's root node,
// if it had a NiTexturingProperty. Used for applying "particle textures" to magic effects.
void overrideFirstRootTexture(const std::string &texture, Resource::ResourceSystem *resourceSystem, osg::ref_ptr<osg::Node> node);
void overrideTexture(const std::string& texture, Resource::ResourceSystem* resourceSystem, osg::ref_ptr<osg::Node> node);

@ -3145,7 +3145,7 @@ namespace MWWorld
modelName << roll;
std::string model = "meshes\\" + getFallback()->getFallbackString(modelName.str());
mRendering->spawnEffect(model, texture, worldPosition);
mRendering->spawnEffect(model, texture, worldPosition, 1.0f, false);
}
void World::spawnEffect(const std::string &model, const std::string &textureOverride, const osg::Vec3f &worldPos)

Loading…
Cancel
Save