mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-29 17:15:34 +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
|
||||
// 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)
|
||||
mObjectRoot->setStateSet(previousStateset);
|
||||
|
|
|
@ -50,9 +50,9 @@ namespace MWRender
|
|||
{
|
||||
osgAnimation::Bone* parent = b->getBoneParent();
|
||||
if (parent)
|
||||
b->setMatrixInSkeletonSpace(matrix * parent->getMatrixInSkeletonSpace());
|
||||
else
|
||||
b->setMatrixInSkeletonSpace(matrix);
|
||||
matrix *= parent->getMatrixInSkeletonSpace();
|
||||
|
||||
b->setMatrixInSkeletonSpace(matrix);
|
||||
}
|
||||
|
||||
traverse(node, nv);
|
||||
|
|
|
@ -399,9 +399,7 @@ namespace Resource
|
|||
osg::Callback* cb = node.getUpdateCallback();
|
||||
while (cb)
|
||||
{
|
||||
osgAnimation::AnimationUpdateCallback<osg::NodeCallback>* animCb
|
||||
= dynamic_cast<osgAnimation::AnimationUpdateCallback<osg::NodeCallback>*>(cb);
|
||||
|
||||
auto animCb = dynamic_cast<osgAnimation::AnimationUpdateCallback<osg::NodeCallback>*>(cb);
|
||||
if (animCb)
|
||||
animCb->setName(Misc::StringUtils::underscoresToSpaces(animCb->getName()));
|
||||
|
||||
|
|
|
@ -50,14 +50,14 @@ namespace SceneUtil
|
|||
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
|
||||
class NodeMapVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
typedef std::unordered_map<std::string, osg::ref_ptr<osg::MatrixTransform>, Misc::StringUtils::CiHash,
|
||||
Misc::StringUtils::CiEqual>
|
||||
NodeMap;
|
||||
|
||||
NodeMapVisitor(NodeMap& map)
|
||||
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
||||
, mMap(map)
|
||||
|
@ -74,10 +74,6 @@ namespace SceneUtil
|
|||
class NodeMapVisitorBoneOnly : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
typedef std::unordered_map<std::string, osg::ref_ptr<osg::MatrixTransform>, Misc::StringUtils::CiHash,
|
||||
Misc::StringUtils::CiEqual>
|
||||
NodeMap;
|
||||
|
||||
NodeMapVisitorBoneOnly(NodeMap& map)
|
||||
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
||||
, mMap(map)
|
||||
|
|
Loading…
Reference in a new issue