mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-06 13:11:32 +00:00
.nif check, matrix mult feedback, auto usage, reuse NodeMap typedef
This commit is contained in:
parent
d23c10622d
commit
8c2c66d59e
4 changed files with 9 additions and 15 deletions
|
@ -1491,7 +1491,7 @@ namespace MWRender
|
||||||
|
|
||||||
// osgAnimation formats with skeletons should have their nodemap be bone instances
|
// osgAnimation formats with skeletons should have their nodemap be bone instances
|
||||||
// FIXME: better way to detect osgAnimation here instead of relying on extension?
|
// FIXME: better way to detect osgAnimation here instead of relying on extension?
|
||||||
mRequiresBoneMap = mSkeleton != nullptr && !Misc::StringUtils::ciEndsWith(model, "nif");
|
mRequiresBoneMap = mSkeleton != nullptr && !Misc::StringUtils::ciEndsWith(model, ".nif");
|
||||||
|
|
||||||
if (previousStateset)
|
if (previousStateset)
|
||||||
mObjectRoot->setStateSet(previousStateset);
|
mObjectRoot->setStateSet(previousStateset);
|
||||||
|
|
|
@ -50,9 +50,9 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
osgAnimation::Bone* parent = b->getBoneParent();
|
osgAnimation::Bone* parent = b->getBoneParent();
|
||||||
if (parent)
|
if (parent)
|
||||||
b->setMatrixInSkeletonSpace(matrix * parent->getMatrixInSkeletonSpace());
|
matrix *= parent->getMatrixInSkeletonSpace();
|
||||||
else
|
|
||||||
b->setMatrixInSkeletonSpace(matrix);
|
b->setMatrixInSkeletonSpace(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
traverse(node, nv);
|
traverse(node, nv);
|
||||||
|
|
|
@ -399,9 +399,7 @@ namespace Resource
|
||||||
osg::Callback* cb = node.getUpdateCallback();
|
osg::Callback* cb = node.getUpdateCallback();
|
||||||
while (cb)
|
while (cb)
|
||||||
{
|
{
|
||||||
osgAnimation::AnimationUpdateCallback<osg::NodeCallback>* animCb
|
auto 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()));
|
||||||
|
|
||||||
|
|
|
@ -50,14 +50,14 @@ namespace SceneUtil
|
||||||
std::vector<osg::Node*> mFoundNodes;
|
std::vector<osg::Node*> mFoundNodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::unordered_map<std::string, osg::ref_ptr<osg::MatrixTransform>, Misc::StringUtils::CiHash,
|
||||||
|
Misc::StringUtils::CiEqual>
|
||||||
|
NodeMap;
|
||||||
|
|
||||||
/// Maps names to nodes
|
/// Maps names to nodes
|
||||||
class NodeMapVisitor : public osg::NodeVisitor
|
class NodeMapVisitor : public osg::NodeVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::unordered_map<std::string, osg::ref_ptr<osg::MatrixTransform>, Misc::StringUtils::CiHash,
|
|
||||||
Misc::StringUtils::CiEqual>
|
|
||||||
NodeMap;
|
|
||||||
|
|
||||||
NodeMapVisitor(NodeMap& map)
|
NodeMapVisitor(NodeMap& map)
|
||||||
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
||||||
, mMap(map)
|
, mMap(map)
|
||||||
|
@ -74,10 +74,6 @@ namespace SceneUtil
|
||||||
class NodeMapVisitorBoneOnly : public osg::NodeVisitor
|
class NodeMapVisitorBoneOnly : public osg::NodeVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::unordered_map<std::string, osg::ref_ptr<osg::MatrixTransform>, Misc::StringUtils::CiHash,
|
|
||||||
Misc::StringUtils::CiEqual>
|
|
||||||
NodeMap;
|
|
||||||
|
|
||||||
NodeMapVisitorBoneOnly(NodeMap& map)
|
NodeMapVisitorBoneOnly(NodeMap& map)
|
||||||
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
||||||
, mMap(map)
|
, mMap(map)
|
||||||
|
|
Loading…
Reference in a new issue