Fix skinning bug

c++11
scrawl 10 years ago
parent 5b8c28f641
commit c334a76a6f

@ -546,12 +546,10 @@ void SkyManager::create()
mCloudNode->accept(modClouds); mCloudNode->accept(modClouds);
mCloudUpdater = new CloudUpdater; mCloudUpdater = new CloudUpdater;
//mCloudNode->addUpdateCallback(mCloudUpdater); mCloudNode->addUpdateCallback(mCloudUpdater);
mCloudNode->getOrCreateStateSet()->setAttributeAndModes(createAlphaTrackingUnlitMaterial(), osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE); mCloudNode->getOrCreateStateSet()->setAttributeAndModes(createAlphaTrackingUnlitMaterial(), osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
mCloudNode->setNodeMask(0);
osg::ref_ptr<osg::Depth> depth = new osg::Depth; osg::ref_ptr<osg::Depth> depth = new osg::Depth;
depth->setWriteMask(false); depth->setWriteMask(false);
mRootNode->getOrCreateStateSet()->setAttributeAndModes(depth, osg::StateAttribute::ON); mRootNode->getOrCreateStateSet()->setAttributeAndModes(depth, osg::StateAttribute::ON);
@ -568,8 +566,7 @@ SkyManager::~SkyManager()
int SkyManager::getMasserPhase() const int SkyManager::getMasserPhase() const
{ {
if (!mCreated) return 0; if (!mCreated) return 0;
return 0; return mMasser->getPhaseInt();
//return mMasser->getPhaseInt();
} }
int SkyManager::getSecundaPhase() const int SkyManager::getSecundaPhase() const

@ -222,21 +222,12 @@ namespace
// Callback method called by the NodeVisitor when visiting a node. // Callback method called by the NodeVisitor when visiting a node.
void operator()(osg::Node* node, osg::NodeVisitor* nv) void operator()(osg::Node* node, osg::NodeVisitor* nv)
{ {
if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) osgAnimation::Bone* b = static_cast<osgAnimation::Bone*>(node);
{ osgAnimation::Bone* parent = b->getBoneParent();
osgAnimation::Bone* b = dynamic_cast<osgAnimation::Bone*>(node); if (parent)
if (!b) b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace() * parent->getMatrixInSkeletonSpace());
{ else
OSG_WARN << "Warning: UpdateBone set on non-Bone object." << std::endl; b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace());
return;
}
osgAnimation::Bone* parent = b->getBoneParent();
if (parent)
b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace() * parent->getMatrixInSkeletonSpace());
else
b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace());
}
traverse(node,nv); traverse(node,nv);
} }
}; };

@ -96,6 +96,7 @@ namespace SceneUtil
bone->addUpdateCallback(old); bone->addUpdateCallback(old);
} }
} }
traverse(node);
} }
private: private:

Loading…
Cancel
Save