Commit 40a0b490 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - setting a default bounding sphere for all root nodes ensures that...

[CHANGE] - setting a default bounding sphere for all root nodes ensures that the intial camera always shows the complete data box (in our case this 255x255x255 box). This is implemented dirty since we do not have a class managing our reference coordinate system! Hopefuly this solves the problem of needing to press space to see the scene completely.
parent 9d193c20
......@@ -82,6 +82,9 @@ void WGEGroupNode::SafeUpdaterCallback::operator()( osg::Node* node, osg::NodeVi
{
rootNode->addChild( ( *iter ) );
}
rootNode->dirtyBound();
// all children added -> clear
rootNode->m_insertionQueueDirty = false;
rootNode->m_childInsertionQueue.clear();
......@@ -102,6 +105,9 @@ void WGEGroupNode::SafeUpdaterCallback::operator()( osg::Node* node, osg::NodeVi
{
rootNode->removeChild( ( *iter ) );
}
rootNode->dirtyBound();
// all children added -> clear
rootNode->m_removalQueueDirty = false;
rootNode->m_childRemovalQueue.clear();
......
......@@ -22,6 +22,8 @@
//
//---------------------------------------------------------------------------
#include <osg/Node>
#include "../common/WLogger.h"
#include "WGEScene.h"
......@@ -30,6 +32,9 @@ WGEScene::WGEScene():
WGEGroupNode()
{
WLogger::getLogger()->addLogMessage( "Initializing OpenSceneGraph Root Node", "GE", LL_INFO );
// TODO(all): we definitely need a reference coordinate system on which everybody can rely
setInitialBound( osg::BoundingSphere( osg::Vec3( 128.0, 128.0, 128.0 ), 255.0 ) );
}
WGEScene::~WGEScene()
......
......@@ -165,3 +165,9 @@ osg::ref_ptr< WPickHandler > WGEViewer::getPickHandler()
{
return m_pickHandler;
}
void WGEViewer::reset()
{
m_View->home();
}
......@@ -97,6 +97,11 @@ public:
*/
osg::ref_ptr<osgViewer::View> getView();
/**
* Resets the view using the installed manipulator.
*/
void reset();
/**
* Sets the camera manipulator to use.
*
......
......@@ -157,13 +157,14 @@ void WMNavSlices::create()
m_rootNode->insert( m_ySliceNode );
m_rootNode->insert( m_zSliceNode );
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->insert( m_rootNode );
osg::StateSet* rootState = m_rootNode->getOrCreateStateSet();
initUniforms( rootState );
rootState->setAttributeAndModes( m_shader->getProgramObject(), osg::StateAttribute::ON );
m_rootNode->setUserData( this );
m_rootNode->addUpdateCallback( new sliceNodeCallback );
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->insert( m_rootNode );
}
osg::Vec3 wv3D2ov3( wmath::WVector3D v ) // WVector3D to osg::Vec3 conversion
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment