Fix for blood effect texture overrides

This commit is contained in:
Allofich 2016-09-14 23:18:29 +09:00
parent a033ba3bd2
commit 01774c656c
7 changed files with 13 additions and 8 deletions

View file

@ -25,7 +25,7 @@ EffectManager::~EffectManager()
clear(); 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); 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); SceneUtil::AssignControllerSourcesVisitor assignVisitor(effect.mAnimTime);
node->accept(assignVisitor); node->accept(assignVisitor);
overrideFirstRootTexture(textureOverride, mResourceSystem, node); if (isMagicVFX)
overrideFirstRootTexture(textureOverride, mResourceSystem, node);
else
overrideTexture(textureOverride, mResourceSystem, node);
mParentNode->addChild(trans); mParentNode->addChild(trans);
mResourceSystem->getSceneManager()->notifyAttached(node); mResourceSystem->getSceneManager()->notifyAttached(node);

View file

@ -33,7 +33,7 @@ namespace MWRender
~EffectManager(); ~EffectManager();
/// Add an effect. When it's finished playing, it will be removed automatically. /// 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); void update(float dt);

View file

@ -742,9 +742,9 @@ namespace MWRender
mObjects->updatePtr(old, updated); 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() void RenderingManager::notifyWorldSpaceChanged()

View file

@ -138,7 +138,7 @@ namespace MWRender
SkyManager* getSkyManager(); 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 /// Clear all savegame-specific data
void clear(); void clear();

View file

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

View file

@ -17,6 +17,8 @@ namespace Resource
namespace MWRender 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 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); void overrideTexture(const std::string& texture, Resource::ResourceSystem* resourceSystem, osg::ref_ptr<osg::Node> node);

View file

@ -3145,7 +3145,7 @@ namespace MWWorld
modelName << roll; modelName << roll;
std::string model = "meshes\\" + getFallback()->getFallbackString(modelName.str()); 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) void World::spawnEffect(const std::string &model, const std::string &textureOverride, const osg::Vec3f &worldPos)