Fix broken VisControllers

c++11
scrawl 10 years ago
parent 4957ceeb1d
commit d486cde330

@ -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.

@ -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);
}

@ -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);

Loading…
Cancel
Save