1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-14 21:39:41 +00:00

Remove redundant bool argument from ActorAnimation::attachMesh

This commit is contained in:
elsid 2024-09-19 00:13:41 +02:00
parent d7e99f988b
commit 8ba4ff9946
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
2 changed files with 11 additions and 16 deletions

View file

@ -67,7 +67,7 @@ namespace MWRender
}
PartHolderPtr ActorAnimation::attachMesh(
VFS::Path::NormalizedView model, std::string_view bonename, bool enchantedGlow, osg::Vec4f* glowColor)
VFS::Path::NormalizedView model, std::string_view bonename, const osg::Vec4f* glowColor)
{
osg::Group* parent = getBoneByName(bonename);
if (!parent)
@ -80,7 +80,7 @@ namespace MWRender
if (found == nodeMap.end())
return {};
if (enchantedGlow)
if (glowColor != nullptr)
mGlowUpdater = SceneUtil::addEnchantedGlow(instance, mResourceSystem, *glowColor);
return std::make_unique<PartHolder>(instance);
@ -221,15 +221,15 @@ namespace MWRender
return;
constexpr std::string_view boneName = "Bip01 AttachShield";
osg::Vec4f glowColor = shield->getClass().getEnchantmentColor(*shield);
const bool isEnchanted = !shield->getClass().getEnchantment(*shield).empty();
const osg::Vec4f glowColor = isEnchanted ? shield->getClass().getEnchantmentColor(*shield) : osg::Vec4f();
const VFS::Path::Normalized holsteredName = addSuffixBeforeExtension(mesh, "_sh");
bool isEnchanted = !shield->getClass().getEnchantment(*shield).empty();
// If we have no dedicated sheath model, use basic shield model as fallback.
if (!mResourceSystem->getVFS()->exists(holsteredName))
mHolsteredShield = attachMesh(mesh, boneName, isEnchanted, &glowColor);
mHolsteredShield = attachMesh(mesh, boneName, isEnchanted ? &glowColor : nullptr);
else
mHolsteredShield = attachMesh(holsteredName, boneName, isEnchanted, &glowColor);
mHolsteredShield = attachMesh(holsteredName, boneName, isEnchanted ? &glowColor : nullptr);
if (!mHolsteredShield)
return;
@ -348,13 +348,14 @@ namespace MWRender
// If the scabbard is not found, use the weapon mesh as fallback.
const VFS::Path::Normalized scabbardName = addSuffixBeforeExtension(mesh, "_sh");
bool isEnchanted = !weapon->getClass().getEnchantment(*weapon).empty();
const bool isEnchanted = !weapon->getClass().getEnchantment(*weapon).empty();
if (!mResourceSystem->getVFS()->exists(scabbardName))
{
if (showHolsteredWeapons)
{
osg::Vec4f glowColor = weapon->getClass().getEnchantmentColor(*weapon);
mScabbard = attachMesh(mesh, boneName, isEnchanted, &glowColor);
const osg::Vec4f glowColor
= isEnchanted ? weapon->getClass().getEnchantmentColor(*weapon) : osg::Vec4f();
mScabbard = attachMesh(mesh, boneName, isEnchanted ? &glowColor : nullptr);
if (mScabbard)
resetControllers(mScabbard->getNode());
}

View file

@ -55,13 +55,7 @@ namespace MWRender
virtual std::string_view getHolsteredWeaponBoneName(const MWWorld::ConstPtr& weapon);
PartHolderPtr attachMesh(
VFS::Path::NormalizedView model, std::string_view bonename, bool enchantedGlow, osg::Vec4f* glowColor);
PartHolderPtr attachMesh(VFS::Path::NormalizedView model, std::string_view bonename)
{
osg::Vec4f stubColor = osg::Vec4f(0, 0, 0, 0);
return attachMesh(model, bonename, false, &stubColor);
}
VFS::Path::NormalizedView model, std::string_view bonename, const osg::Vec4f* glowColor = nullptr);
osg::ref_ptr<osg::Node> attach(
VFS::Path::NormalizedView model, std::string_view bonename, std::string_view bonefilter, bool isLight);