Added extra view combinations too commandline
This commit is contained in:
parent
0873a8cea0
commit
c7211f41ec
@ -28,9 +28,11 @@
|
|||||||
|
|
||||||
#include <osgGA/TrackballManipulator>
|
#include <osgGA/TrackballManipulator>
|
||||||
#include <osgGA/FlightManipulator>
|
#include <osgGA/FlightManipulator>
|
||||||
|
#include <osgGA/StateSetManipulator>
|
||||||
|
|
||||||
#include <osgViewer/CompositeViewer>
|
#include <osgViewer/CompositeViewer>
|
||||||
|
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -47,7 +49,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
if (arguments.read("-1"))
|
if (arguments.read("-1"))
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
||||||
if (!wsi)
|
if (!wsi)
|
||||||
{
|
{
|
||||||
@ -82,43 +84,95 @@ int main( int argc, char **argv )
|
|||||||
osg::notify(osg::NOTICE)<<" GraphicsWindow has not been created successfully."<<std::endl;
|
osg::notify(osg::NOTICE)<<" GraphicsWindow has not been created successfully."<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
osgViewer::View* view_one = new osgViewer::View;
|
// view one
|
||||||
view_one->setSceneData(scene.get());
|
{
|
||||||
view_one->getCamera()->setViewport(new osg::Viewport(0,0, width/2, height/2));
|
osgViewer::View* view = new osgViewer::View;
|
||||||
view_one->getCamera()->setGraphicsContext(gc.get());
|
view->setSceneData(scene.get());
|
||||||
view_one->setCameraManipulator(new osgGA::TrackballManipulator);
|
view->getCamera()->setViewport(new osg::Viewport(0,0, width/2, height/2));
|
||||||
viewer.addView(view_one);
|
view->getCamera()->setGraphicsContext(gc.get());
|
||||||
|
view->setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
|
viewer.addView(view);
|
||||||
|
|
||||||
osgViewer::View* view_two = new osgViewer::View;
|
// add the state manipulator
|
||||||
view_two->setSceneData(scene.get());
|
osg::ref_ptr<osgGA::StateSetManipulator> statesetManipulator = new osgGA::StateSetManipulator;
|
||||||
view_two->getCamera()->setViewport(new osg::Viewport(width/2,0, width/2, height/2));
|
statesetManipulator->setStateSet(view->getCamera()->getOrCreateStateSet());
|
||||||
view_two->getCamera()->setGraphicsContext(gc.get());
|
|
||||||
view_two->setCameraManipulator(new osgGA::TrackballManipulator);
|
view->addEventHandler( statesetManipulator.get() );
|
||||||
viewer.addView(view_two);
|
}
|
||||||
#endif
|
|
||||||
osgViewer::View* view_three = new osgViewer::View;
|
// view two
|
||||||
view_three->setSceneData(osgDB::readNodeFile("town.ive"));
|
{
|
||||||
view_three->setUpViewAcrossAllScreens();
|
osgViewer::View* view = new osgViewer::View;
|
||||||
#if 0
|
view->setSceneData(scene.get());
|
||||||
view_three->getCamera()->setViewport(new osg::Viewport(0, height/2, width, height/2));
|
view->getCamera()->setViewport(new osg::Viewport(width/2,0, width/2, height/2));
|
||||||
view_three->getCamera()->setGraphicsContext(gc.get());
|
view->getCamera()->setGraphicsContext(gc.get());
|
||||||
#endif
|
view->setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
view_three->setCameraManipulator(new osgGA::FlightManipulator);
|
viewer.addView(view);
|
||||||
viewer.addView(view_three);
|
}
|
||||||
|
|
||||||
|
// view three
|
||||||
|
if (false)
|
||||||
|
{
|
||||||
|
osgViewer::View* view = new osgViewer::View;
|
||||||
|
view->setSceneData(osgDB::readNodeFile("town.ive"));
|
||||||
|
|
||||||
|
view->setUpViewAcrossAllScreens();
|
||||||
|
viewer.addView(view);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osgViewer::View* view_one = new osgViewer::View;
|
osgViewer::View* view = new osgViewer::View;
|
||||||
view_one->setUpViewOnSingleScreen(0);
|
view->setSceneData(osgDB::readNodeFile("town.ive"));
|
||||||
view_one->setSceneData(scene.get());
|
|
||||||
view_one->setCameraManipulator(new osgGA::TrackballManipulator);
|
|
||||||
viewer.addView(view_one);
|
|
||||||
|
|
||||||
osgViewer::View* view_two = new osgViewer::View;
|
view->getCamera()->setProjectionMatrixAsPerspective(30.0, double(width) / double(height/2), 1.0, 1000.0);
|
||||||
view_two->setUpViewOnSingleScreen(1);
|
view->getCamera()->setViewport(new osg::Viewport(0, height/2, width, height/2));
|
||||||
view_two->setSceneData(scene.get());
|
view->getCamera()->setGraphicsContext(gc.get());
|
||||||
view_two->setCameraManipulator(new osgGA::TrackballManipulator);
|
view->setCameraManipulator(new osgGA::FlightManipulator);
|
||||||
viewer.addView(view_two);
|
viewer.addView(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arguments.read("-2"))
|
||||||
|
{
|
||||||
|
{
|
||||||
|
osgViewer::View* view = new osgViewer::View;
|
||||||
|
view->setSceneData(osgDB::readNodeFile("town.ive"));
|
||||||
|
|
||||||
|
view->setUpViewAcrossAllScreens();
|
||||||
|
view->setCameraManipulator(new osgGA::FlightManipulator);
|
||||||
|
viewer.addView(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arguments.read("-3") || viewer.getNumViews()==0)
|
||||||
|
{
|
||||||
|
|
||||||
|
// view one
|
||||||
|
{
|
||||||
|
osgViewer::View* view = new osgViewer::View;
|
||||||
|
viewer.addView(view);
|
||||||
|
|
||||||
|
view->setUpViewOnSingleScreen(0);
|
||||||
|
view->setSceneData(scene.get());
|
||||||
|
view->setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
|
|
||||||
|
// add the state manipulator
|
||||||
|
osg::ref_ptr<osgGA::StateSetManipulator> statesetManipulator = new osgGA::StateSetManipulator;
|
||||||
|
statesetManipulator->setStateSet(view->getCamera()->getOrCreateStateSet());
|
||||||
|
|
||||||
|
view->addEventHandler( statesetManipulator.get() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// view two
|
||||||
|
{
|
||||||
|
osgViewer::View* view = new osgViewer::View;
|
||||||
|
viewer.addView(view);
|
||||||
|
|
||||||
|
view->setUpViewOnSingleScreen(1);
|
||||||
|
view->setSceneData(scene.get());
|
||||||
|
view->setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user