mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 09:53:50 +00:00
Fix broken VisControllers
This commit is contained in:
parent
4957ceeb1d
commit
d486cde330
3 changed files with 7 additions and 5 deletions
|
@ -133,7 +133,8 @@ int main(int argc, char** argv)
|
||||||
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
|
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
|
||||||
viewer.addEventHandler(new WireframeKeyHandler(root));
|
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're going to change this from the event callback, set the variance to DYNAMIC so that
|
||||||
// we don't interfere with the draw thread.
|
// we don't interfere with the draw thread.
|
||||||
|
|
|
@ -316,7 +316,8 @@ void VisController::operator() (osg::Node* node, osg::NodeVisitor* nv)
|
||||||
if (hasInput())
|
if (hasInput())
|
||||||
{
|
{
|
||||||
bool vis = calculate(getInputValue(nv));
|
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);
|
traverse(node, nv);
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,14 +322,14 @@ namespace NifOsg
|
||||||
if (nifNode->recType == Nif::RC_RootCollisionNode)
|
if (nifNode->recType == Nif::RC_RootCollisionNode)
|
||||||
{
|
{
|
||||||
collisionNode = true;
|
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
|
// We could probably skip hidden nodes entirely if they don't have a VisController that
|
||||||
// might make them visible later
|
// might make them visible later
|
||||||
// FIXME: this disables update callbacks, so VisController no longer works
|
|
||||||
if (nifNode->flags & Nif::NiNode::Flag_Hidden)
|
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)
|
// Insert bones at position 0 to prevent update order problems (see comment in osg Skeleton.cpp)
|
||||||
parentNode->insertChild(0, transformNode);
|
parentNode->insertChild(0, transformNode);
|
||||||
|
|
Loading…
Reference in a new issue