28 #include <osg/ShapeDrawable>
32 #include <osgGA/FlightManipulator>
33 #include <osgGA/DriveManipulator>
34 #include <osgGA/UFOManipulator>
35 #include <osgGA/KeySwitchMatrixManipulator>
36 #include <osgGA/StateSetManipulator>
37 #include <osgGA/AnimationPathManipulator>
38 #include <osgGA/TerrainManipulator>
39 #include <osgViewer/ViewerEventHandlers>
40 #include <osgViewer/View>
42 #include <osgDB/ReadFile>
44 #include "exceptions/WGEInitFailed.h"
45 #include "WGE2DManipulator.h"
46 #include "WGENoOpManipulator.h"
47 #include "WGEZoomTrackballManipulator.h"
48 #include "WPickHandler.h"
49 #include "../common/WConditionOneShot.h"
51 #include "WGEViewer.h"
63 m_View = osg::ref_ptr<osgViewer::View>(
new osgViewer::View );
66 m_View = osg::ref_ptr<osgViewer::Viewer>(
new osgViewer::Viewer );
69 m_View->setCamera(
new WGECamera( width, height, projectionMode ) );
79 switch( projectionMode )
81 case( WGECamera::ORTHOGRAPHIC ):
84 if( name != std::string(
"main" ) )
86 case( WGECamera::PERSPECTIVE ):
90 m_View->setLightingMode( osg::View::HEADLIGHT );
93 case( WGECamera::TWO_D ):
96 case( WGECamera::TWO_D_UNIT ):
101 throw WGEInitFailed( std::string(
"Unknown projection mode" ) );
105 m_View->addEventHandler(
new osgViewer::StatsHandler );
109 throw WGEInitFailed( std::string(
"Initialization of WGEViewer failed" ) );
120 osg::ref_ptr<osgViewer::Viewer>
122 osg::ref_ptr<osgViewer::View>
131 m_View->setCameraManipulator( manipulator );
137 return m_View->getCameraManipulator();
142 m_View->setCamera( camera );
148 return m_View->getCamera();
153 m_View->setSceneData( node );
164 m_View->getCamera()->setClearColor( bgColor );
176 m_View->getEventQueue()->windowResize( 0, 0, width, height );
181 m_View->getCamera()->setViewport( 0, 0, width, height );
235 const GLubyte* vendor = glGetString( GL_VENDOR );
236 m_vendor =
reinterpret_cast< const char*
>( vendor );
239 m_camera->setInitialDrawCallback( NULL );