OpenCS: apply visibility flags to osg node

This commit is contained in:
scrawl 2015-03-26 00:27:39 +01:00
parent 5fb8877746
commit 1edccdbe55
4 changed files with 12 additions and 3 deletions

View file

@ -71,8 +71,6 @@ void CSVRender::Object::update()
// TODO: use error marker mesh
std::cerr << e.what() << std::endl;
}
//mObject->setVisibilityFlags (Element_Reference);
}
}
@ -110,6 +108,9 @@ CSVRender::Object::Object (const CSMWorld::Data& data, osg::Group* parentNode,
mBaseNode = new osg::PositionAttitudeTransform;
parentNode->addChild(mBaseNode);
// 0x1 reserved for separating cull and update visitors
mBaseNode->setNodeMask(Element_Reference<<1);
if (referenceable)
{
mReferenceableId = id;

View file

@ -84,6 +84,12 @@ void SceneWidget::flagAsModified()
mView->requestRedraw();
}
void SceneWidget::setVisibilityMask(int mask)
{
// 0x1 reserved for separating cull and update visitors
mView->getCamera()->setCullMask(mask<<1);
}
CompositeViewer::CompositeViewer()
{
#if QT_VERSION >= 0x050000

View file

@ -37,6 +37,8 @@ namespace CSVRender
void flagAsModified();
void setVisibilityMask(int mask);
protected:
osg::ref_ptr<osgViewer::View> mView;

View file

@ -348,7 +348,7 @@ void CSVRender::WorldspaceWidget::debugProfileAboutToBeRemoved (const QModelInde
void CSVRender::WorldspaceWidget::elementSelectionChanged()
{
//setVisibilityMask (getVisibilityMask());
setVisibilityMask (getVisibilityMask());
flagAsModified();
updateOverlay();
}