1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-27 18:41:37 +00:00

Clang format

This commit is contained in:
Sam Hellawell 2024-03-29 19:04:07 +00:00
parent 404bd2305f
commit 2c2ed5f7ff
3 changed files with 18 additions and 18 deletions

View file

@ -1457,9 +1457,7 @@ namespace MWRender
} }
} }
osg::ref_ptr<osg::Node> created osg::ref_ptr<osg::Node> created = getModelInstance(mResourceSystem, model, baseonly, inject, defaultSkeleton);
= getModelInstance(mResourceSystem, model, baseonly, inject, defaultSkeleton);
if (!forceskeleton) if (!forceskeleton)
{ {
mInsert->addChild(created); mInsert->addChild(created);

View file

@ -9,10 +9,10 @@
#include <osg/Node> #include <osg/Node>
#include <osg/UserDataContainer> #include <osg/UserDataContainer>
#include <osgAnimation/RigGeometry>
#include <osgAnimation/UpdateBone>
#include <osgAnimation/Skeleton>
#include <osgAnimation/Bone> #include <osgAnimation/Bone>
#include <osgAnimation/RigGeometry>
#include <osgAnimation/Skeleton>
#include <osgAnimation/UpdateBone>
#include <osgParticle/ParticleSystem> #include <osgParticle/ParticleSystem>
@ -359,28 +359,29 @@ namespace Resource
void updateVertexInfluenceMap(osgAnimation::RigGeometry& rig) void updateVertexInfluenceMap(osgAnimation::RigGeometry& rig)
{ {
osgAnimation::VertexInfluenceMap* vertexInfluenceMap = rig.getInfluenceMap(); osgAnimation::VertexInfluenceMap* vertexInfluenceMap = rig.getInfluenceMap();
if (!vertexInfluenceMap) return; if (!vertexInfluenceMap)
return;
std::vector<std::pair<std::string, std::string>> renameList; std::vector<std::pair<std::string, std::string>> renameList;
// Collecting updates // Collecting updates
for (const auto& influence : *vertexInfluenceMap) { for (const auto& influence : *vertexInfluenceMap)
{
const std::string& oldBoneName = influence.first; const std::string& oldBoneName = influence.first;
std::string newBoneName = Misc::StringUtils::underscoresToSpaces(oldBoneName); std::string newBoneName = Misc::StringUtils::underscoresToSpaces(oldBoneName);
if (newBoneName != oldBoneName) { if (newBoneName != oldBoneName)
renameList.emplace_back(oldBoneName, newBoneName); renameList.emplace_back(oldBoneName, newBoneName);
} }
}
// Applying updates (cant update map while iterating it!) // Applying updates (cant update map while iterating it!)
for (const auto& rename : renameList) { for (const auto& rename : renameList)
{
const std::string& oldName = rename.first; const std::string& oldName = rename.first;
const std::string& newName = rename.second; const std::string& newName = rename.second;
// Check if new name already exists to avoid overwriting // Check if new name already exists to avoid overwriting
if (vertexInfluenceMap->find(newName) == vertexInfluenceMap->end()) { if (vertexInfluenceMap->find(newName) == vertexInfluenceMap->end())
(*vertexInfluenceMap)[newName] = std::move((*vertexInfluenceMap)[oldName]); (*vertexInfluenceMap)[newName] = std::move((*vertexInfluenceMap)[oldName]);
}
vertexInfluenceMap->erase(oldName); vertexInfluenceMap->erase(oldName);
} }
@ -390,7 +391,9 @@ namespace Resource
{ {
public: public:
RenameBonesVisitor() RenameBonesVisitor()
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
{
}
void apply(osg::MatrixTransform& node) override void apply(osg::MatrixTransform& node) override
{ {
@ -400,8 +403,8 @@ namespace Resource
osg::Callback* cb = node.getUpdateCallback(); osg::Callback* cb = node.getUpdateCallback();
while (cb) while (cb)
{ {
osgAnimation::AnimationUpdateCallback<osg::NodeCallback>* animCb = osgAnimation::AnimationUpdateCallback<osg::NodeCallback>* animCb
dynamic_cast<osgAnimation::AnimationUpdateCallback<osg::NodeCallback>*>(cb); = dynamic_cast<osgAnimation::AnimationUpdateCallback<osg::NodeCallback>*>(cb);
if (animCb) if (animCb)
animCb->setName(Misc::StringUtils::underscoresToSpaces(animCb->getName())); animCb->setName(Misc::StringUtils::underscoresToSpaces(animCb->getName()));
@ -721,7 +724,6 @@ namespace Resource
new TemplateRef(newRiggeometryHolder->getGeometry(0))); new TemplateRef(newRiggeometryHolder->getGeometry(0)));
} }
} }
} }
node->getOrCreateStateSet()->addUniform(new osg::Uniform("emissiveMult", 1.f)); node->getOrCreateStateSet()->addUniform(new osg::Uniform("emissiveMult", 1.f));

View file

@ -9,10 +9,10 @@
#include <yaml-cpp/yaml.h> #include <yaml-cpp/yaml.h>
#include <components/misc/osguservalues.hpp> #include <components/misc/osguservalues.hpp>
#include <components/misc/strings/algorithm.hpp>
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
#include <components/sceneutil/depth.hpp> #include <components/sceneutil/depth.hpp>
#include <components/shader/shadermanager.hpp> #include <components/shader/shadermanager.hpp>
#include <components/misc/strings/algorithm.hpp>
namespace SceneUtil namespace SceneUtil
{ {