13 #include <vrecko/Export>
15 #include <osgViewer/ViewerBase>
16 #include <osgViewer/Viewer>
17 #include <osgViewer/CompositeViewer>
26 virtual osgViewer::ViewerBase* getViewer() = 0;
29 virtual void addView(osgViewer::View* view) = 0;
36 virtual void setDisplaySettings(osg::DisplaySettings* ds1, osg::DisplaySettings* ds2 = NULL) = 0;
39 virtual void setFusionDistance(osgUtil::SceneView::FusionDistanceMode mode,
float value=1.0f) = 0;
42 virtual void addEventHandler(osgGA::GUIEventHandler* eventHandler) = 0;
45 virtual void setSceneData(osg::Node*
node) = 0;
48 virtual void camera_setViewMatrixAsLookAt(
const osg::Vec3d& eye,
const osg::Vec3d& center,
const osg::Vec3d& up) = 0;
51 virtual void setLight(osg::Light* light) = 0;
54 virtual osg::Light* getLight() = 0;
57 virtual osg::Camera* getCamera(
int screenNum = 0) = 0;
60 virtual int getStereoMode() = 0;
64 return getViewer()->done();
69 getViewer()->realize();
73 getViewer()->setThreadingModel(threadingModel);
76 void getWindows(osgViewer::ViewerBase::Windows& windows,
bool onlyValid=
true) {
77 getViewer()->getWindows(windows, onlyValid);
80 void getCameras(osgViewer::ViewerBase::Cameras& cameras,
bool onlyActive=
true) {
81 getViewer()->getCameras(cameras, onlyActive);
84 void getContexts(osgViewer::ViewerBase::Contexts& contexts,
bool onlyValid=
true) {
85 getViewer()->getContexts(contexts, onlyValid);
88 void frame(
double simulationTime=USE_REFERENCE_TIME) {
89 getViewer()->frame(simulationTime);
98 osg::ref_ptr<osgViewer::Viewer>
viewer;
107 throw new std::exception(
"Not supported in this viewer.");
111 viewer->setDisplaySettings(ds1);
115 viewer->setFusionDistance(mode, value);
119 viewer->addEventHandler(eventHandler);
123 viewer->setSceneData(node);
127 viewer->getCamera()->setViewMatrixAsLookAt(eye, center, up);
135 return viewer->getLight();
139 return viewer->getCamera();
154 osg::ref_ptr<osgViewer::CompositeViewer>
viewer;
166 viewer->getView(0)->setDisplaySettings(ds1);
167 if(m_stereo == 5 && ds2)
viewer->getView(1)->setDisplaySettings(ds2);
171 viewer->getView(0)->setFusionDistance(mode, value);
172 if(m_stereo == 5)
viewer->getView(1)->setFusionDistance(mode, value);
176 viewer->getView(0)->addEventHandler(eventHandler);
180 viewer->getView(0)->setSceneData(node);
181 if(m_stereo == 5)
viewer->getView(1)->setSceneData(node);
185 viewer->getView(0)->getCamera()->setViewMatrixAsLookAt(eye, center, up);
186 if(m_stereo == 5)
viewer->getView(1)->getCamera()->setViewMatrixAsLookAt(eye, center, up);
190 viewer->getView(0)->setLight(light);
191 if(m_stereo == 5)
viewer->getView(1)->setLight(light);
195 return viewer->getView(0)->getLight();
199 return viewer->getView(screenNum)->getCamera();