From c334a76a6f41f33ee6544cf6ccdbffde8844f898 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 15 Apr 2015 22:38:43 +0200 Subject: [PATCH] Fix skinning bug --- apps/openmw/mwrender/sky.cpp | 7 ++----- components/nifosg/nifloader.cpp | 21 ++++++--------------- components/sceneutil/attach.cpp | 1 + 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 1ac7ca10b..f843f9a43 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -546,12 +546,10 @@ void SkyManager::create() mCloudNode->accept(modClouds); mCloudUpdater = new CloudUpdater; - //mCloudNode->addUpdateCallback(mCloudUpdater); + mCloudNode->addUpdateCallback(mCloudUpdater); mCloudNode->getOrCreateStateSet()->setAttributeAndModes(createAlphaTrackingUnlitMaterial(), osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE); - mCloudNode->setNodeMask(0); - osg::ref_ptr depth = new osg::Depth; depth->setWriteMask(false); mRootNode->getOrCreateStateSet()->setAttributeAndModes(depth, osg::StateAttribute::ON); @@ -568,8 +566,7 @@ SkyManager::~SkyManager() int SkyManager::getMasserPhase() const { if (!mCreated) return 0; - return 0; - //return mMasser->getPhaseInt(); + return mMasser->getPhaseInt(); } int SkyManager::getSecundaPhase() const diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index b61e3824b..1f0c36839 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -222,21 +222,12 @@ namespace // Callback method called by the NodeVisitor when visiting a node. void operator()(osg::Node* node, osg::NodeVisitor* nv) { - if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) - { - osgAnimation::Bone* b = dynamic_cast(node); - if (!b) - { - OSG_WARN << "Warning: UpdateBone set on non-Bone object." << std::endl; - return; - } - - osgAnimation::Bone* parent = b->getBoneParent(); - if (parent) - b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace() * parent->getMatrixInSkeletonSpace()); - else - b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace()); - } + osgAnimation::Bone* b = static_cast(node); + osgAnimation::Bone* parent = b->getBoneParent(); + if (parent) + b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace() * parent->getMatrixInSkeletonSpace()); + else + b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace()); traverse(node,nv); } }; diff --git a/components/sceneutil/attach.cpp b/components/sceneutil/attach.cpp index 47efe986c..e06155a61 100644 --- a/components/sceneutil/attach.cpp +++ b/components/sceneutil/attach.cpp @@ -96,6 +96,7 @@ namespace SceneUtil bone->addUpdateCallback(old); } } + traverse(node); } private: