1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Fix broken VisControllers

This commit is contained in:
scrawl 2015-03-20 21:32:26 +01:00
parent 4957ceeb1d
commit d486cde330
3 changed files with 7 additions and 5 deletions

View file

@ -133,7 +133,8 @@ int main(int argc, char** argv)
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
viewer.addEventHandler(new WireframeKeyHandler(root));
//viewer.getCamera()->setCullMask()
// Mask to separate cull visitors from update visitors
viewer.getCamera()->setCullMask(~(0x1));
// We're going to change this from the event callback, set the variance to DYNAMIC so that
// we don't interfere with the draw thread.

View file

@ -316,7 +316,8 @@ void VisController::operator() (osg::Node* node, osg::NodeVisitor* nv)
if (hasInput())
{
bool vis = calculate(getInputValue(nv));
node->setNodeMask(vis ? ~0 : 0);
// Leave 0x1 enabled for UpdateVisitor, so we can make ourselves visible again in the future from this update callback
node->setNodeMask(vis ? ~0 : 0x1);
}
traverse(node, nv);
}

View file

@ -322,14 +322,14 @@ namespace NifOsg
if (nifNode->recType == Nif::RC_RootCollisionNode)
{
collisionNode = true;
transformNode->setNodeMask(0);
// Leave mask for UpdateVisitor enabled
transformNode->setNodeMask(0x1);
}
// We could probably skip hidden nodes entirely if they don't have a VisController that
// might make them visible later
// FIXME: this disables update callbacks, so VisController no longer works
if (nifNode->flags & Nif::NiNode::Flag_Hidden)
transformNode->setNodeMask(0);
transformNode->setNodeMask(0x1); // Leave mask for UpdateVisitor enabled
// Insert bones at position 0 to prevent update order problems (see comment in osg Skeleton.cpp)
parentNode->insertChild(0, transformNode);