Introduce new osgViewer::Renderer class for implementing of the rendering
of cameras in viewers
This commit is contained in:
parent
1b36cfc928
commit
c346f5b943
@ -373,13 +373,23 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
|
||||
|
||||
|
||||
/** Set the Rendering object that is used to implement rendering of the subgraph.*/
|
||||
void setRenderer(osg::Object* rc) { _renderer = rc; }
|
||||
void setRenderer(osg::GraphicsOperation* rc) { _renderer = rc; }
|
||||
|
||||
/** Get the Rendering object that is used to implement rendering of the subgraph.*/
|
||||
osg::Object* getRenderer() { return _renderer.get(); }
|
||||
osg::GraphicsOperation* getRenderer() { return _renderer.get(); }
|
||||
|
||||
/** Get the const Rendering object that is used to implement rendering of the subgraph.*/
|
||||
const osg::Object* getRenderer() const { return _renderer.get(); }
|
||||
const osg::GraphicsOperation* getRenderer() const { return _renderer.get(); }
|
||||
|
||||
|
||||
/** Set the Rendering cache that is used for cached objects associated with rendering of subgraphs.*/
|
||||
void setRenderingCache(osg::Object* rc) { _renderingCache = rc; }
|
||||
|
||||
/** Get the Rendering cache that is used for cached objects associated with rendering of subgraphs.*/
|
||||
osg::Object* getRenderingCache() { return _renderingCache.get(); }
|
||||
|
||||
/** Get the const Rendering cache that is used for cached objects associated with rendering of subgraphs.*/
|
||||
const osg::Object* getRenderingCache() const { return _renderingCache.get(); }
|
||||
|
||||
|
||||
/** Draw callback for custom operations.*/
|
||||
@ -471,7 +481,8 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
|
||||
|
||||
ref_ptr<GraphicsContext> _graphicsContext;
|
||||
|
||||
ref_ptr<Object> _renderer;
|
||||
ref_ptr<GraphicsOperation> _renderer;
|
||||
ref_ptr<Object> _renderingCache;
|
||||
|
||||
ref_ptr<DrawCallback> _preDrawCallback;
|
||||
ref_ptr<DrawCallback> _postDrawCallback;
|
||||
|
@ -106,6 +106,17 @@ struct OSG_EXPORT FlushDeletedGLObjectsOperation : public GraphicsOperation
|
||||
double _availableTime;
|
||||
};
|
||||
|
||||
class OSG_EXPORT RunOperations : public osg::GraphicsOperation
|
||||
{
|
||||
public:
|
||||
|
||||
RunOperations():
|
||||
osg::GraphicsOperation("RunOperation",true) {}
|
||||
|
||||
virtual void operator () (osg::GraphicsContext* context);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -957,6 +957,9 @@ class OSG_EXPORT State : public Referenced
|
||||
inline void setFrameStamp(FrameStamp* fs) { _frameStamp = fs; }
|
||||
|
||||
/** Get the frame stamp for the current frame.*/
|
||||
inline FrameStamp* getFrameStamp() { return _frameStamp.get(); }
|
||||
|
||||
/** Get the const frame stamp for the current frame.*/
|
||||
inline const FrameStamp* getFrameStamp() const { return _frameStamp.get(); }
|
||||
|
||||
|
||||
|
@ -127,10 +127,13 @@ class OSG_EXPORT View : public osg::Object
|
||||
|
||||
void updateSlave(unsigned int i);
|
||||
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~View();
|
||||
|
||||
virtual osg::GraphicsOperation* createRenderer(osg::Camera* camera) {}
|
||||
|
||||
osg::ref_ptr<osg::Stats> _stats;
|
||||
|
||||
LightingMode _lightingMode;
|
||||
|
@ -158,10 +158,6 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced
|
||||
/** Start any threads required by the viewer, as per viewers ThreadingModel.*/
|
||||
void startThreading();
|
||||
|
||||
/** Set up the Operations to render the various viewer cameras on the viewers graphics windows.*/
|
||||
void setUpRenderingSupport();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
void constructorInit();
|
||||
@ -191,9 +187,6 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced
|
||||
|
||||
unsigned int _numThreadsOnBarrier;
|
||||
|
||||
typedef std::map<osg::ref_ptr<osg::Camera>, osg::ref_ptr<osgUtil::SceneView> > CameraSceneViewMap;
|
||||
CameraSceneViewMap _cameraSceneViewMap;
|
||||
|
||||
osg::Timer_t _startTick;
|
||||
osg::ref_ptr<osg::FrameStamp> _frameStamp;
|
||||
|
||||
|
103
include/osgViewer/Renderer
Normal file
103
include/osgViewer/Renderer
Normal file
@ -0,0 +1,103 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGVIEWER_RENDERER
|
||||
#define OSGVIEWER_RENDERER 1
|
||||
|
||||
#include <osg/Timer>
|
||||
#include <osgUtil/SceneView>
|
||||
#include <osgViewer/Export>
|
||||
|
||||
namespace osgViewer {
|
||||
|
||||
class OpenGLQuerySupport
|
||||
{
|
||||
public:
|
||||
OpenGLQuerySupport();
|
||||
|
||||
typedef std::pair<GLuint, int> QueryFrameNumberPair;
|
||||
typedef std::list<QueryFrameNumberPair> QueryFrameNumberList;
|
||||
typedef std::vector<GLuint> QueryList;
|
||||
|
||||
void setStartTick(osg::Timer_t startTick) { _startTick = startTick; }
|
||||
osg::Timer_t getStartTick() const { return _startTick; }
|
||||
|
||||
void checkQuery(osg::Stats* stats);
|
||||
|
||||
GLuint createQueryObject();
|
||||
void beginQuery(int frameNumber);
|
||||
inline void endQuery();
|
||||
void initialize(osg::State* state);
|
||||
|
||||
protected:
|
||||
|
||||
osg::Timer_t _startTick;
|
||||
bool _initialized;
|
||||
bool _timerQuerySupported;
|
||||
const osg::Drawable::Extensions* _extensions;
|
||||
QueryFrameNumberList _queryFrameNumberList;
|
||||
QueryList _availableQueryObjects;
|
||||
double _previousQueryTime;
|
||||
|
||||
};
|
||||
|
||||
class OSGVIEWER_EXPORT Renderer : public osg::GraphicsOperation, public OpenGLQuerySupport
|
||||
{
|
||||
public:
|
||||
|
||||
Renderer(osg::Camera* camera);
|
||||
|
||||
osgUtil::SceneView* getSceneView(unsigned int i) { return _sceneView[i].get(); }
|
||||
|
||||
void setDone(bool done) { _done = done; }
|
||||
bool getDone() { return _done; }
|
||||
|
||||
void setGraphicsThreadDoesCull(bool flag);
|
||||
bool getGraphicsThreadDoesCull() const { return _graphicsThreadDoesCull; }
|
||||
|
||||
void cull();
|
||||
void draw();
|
||||
void cull_draw();
|
||||
|
||||
virtual void operator () (osg::Object* object);
|
||||
|
||||
virtual void operator () (osg::GraphicsContext* context);
|
||||
|
||||
virtual void release();
|
||||
|
||||
protected:
|
||||
|
||||
void updateSceneView(osgUtil::SceneView* sceneView);
|
||||
|
||||
virtual ~Renderer();
|
||||
|
||||
osg::observer_ptr<osg::Camera> _camera;
|
||||
|
||||
bool _done;
|
||||
bool _graphicsThreadDoesCull;
|
||||
unsigned int _currentCull;
|
||||
unsigned int _currentDraw;
|
||||
|
||||
OpenThreads::Mutex _mutex[2];
|
||||
bool _lockHeld[2];
|
||||
osg::ref_ptr<osgUtil::SceneView> _sceneView[2];
|
||||
int _frameNumber[2];
|
||||
|
||||
osg::ref_ptr<osg::FlushDeletedGLObjectsOperation> _flushOperation;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -122,13 +122,13 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
|
||||
void computeActiveCoordinateSystemNodePath();
|
||||
|
||||
|
||||
/** Set the DsplaySettings object associated with this view.*/
|
||||
/** Set the DisplaySettings object associated with this view.*/
|
||||
void setDisplaySettings(osg::DisplaySettings* ds) { _displaySettings = ds; }
|
||||
|
||||
/** Set the DsplaySettings object associated with this view.*/
|
||||
/** Set the DisplaySettings object associated with this view.*/
|
||||
osg::DisplaySettings* getDisplaySettings() { return _displaySettings.get(); }
|
||||
|
||||
/** Set the DsplaySettings object associated with this view.*/
|
||||
/** Set the DisplaySettings object associated with this view.*/
|
||||
const osg::DisplaySettings* getDisplaySettings() const { return _displaySettings.get(); }
|
||||
|
||||
/** Set the FusionDistanceMode and Value. Note, is used only when working in stereo.*/
|
||||
@ -176,8 +176,6 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
|
||||
virtual void requestRedraw();
|
||||
virtual void requestContinuousUpdate(bool needed=true);
|
||||
virtual void requestWarpPointer(float x,float y);
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -186,9 +184,10 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
virtual ~View();
|
||||
|
||||
virtual osg::GraphicsOperation* createRenderer(osg::Camera* camera);
|
||||
|
||||
osg::ref_ptr<osgViewer::Scene> _scene;
|
||||
osg::ref_ptr<osgGA::EventQueue> _eventQueue;
|
||||
osg::ref_ptr<osgGA::MatrixManipulator> _cameraManipulator;
|
||||
|
@ -172,9 +172,6 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
|
||||
/** Start any threads required by the viewer.*/
|
||||
void startThreading();
|
||||
|
||||
/** Set up the Operations to render the various viewer cameras on the viewers graphics windows.*/
|
||||
void setUpRenderingSupport();
|
||||
|
||||
/** Get the keyboard and mouse usage of this viewer.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
@ -221,9 +218,6 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
|
||||
|
||||
unsigned int _numWindowsOpenAtLastSetUpThreading;
|
||||
|
||||
typedef std::list< osg::ref_ptr<osgUtil::SceneView> > SceneViews;
|
||||
SceneViews _sceneViews;
|
||||
|
||||
osg::Timer_t _startTick;
|
||||
osg::ref_ptr<osg::FrameStamp> _frameStamp;
|
||||
|
||||
|
@ -251,9 +251,9 @@ void Camera::detach(BufferComponent buffer)
|
||||
|
||||
void Camera::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
if (_renderer.valid())
|
||||
if (_renderingCache.valid())
|
||||
{
|
||||
const_cast<Camera*>(this)->_renderer->resizeGLObjectBuffers(maxSize);
|
||||
const_cast<Camera*>(this)->_renderingCache->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
Transform::resizeGLObjectBuffers(maxSize);
|
||||
@ -261,9 +261,9 @@ void Camera::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
|
||||
void Camera::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
if (_renderer.valid())
|
||||
if (_renderingCache.valid())
|
||||
{
|
||||
const_cast<Camera*>(this)->_renderer->releaseGLObjects(state);
|
||||
const_cast<Camera*>(this)->_renderingCache->releaseGLObjects(state);
|
||||
}
|
||||
|
||||
Transform::releaseGLObjects(state);
|
||||
|
@ -579,6 +579,14 @@ void GraphicsContext::removeAllOperations()
|
||||
|
||||
void GraphicsContext::runOperations()
|
||||
{
|
||||
for(osg::GraphicsContext::Cameras::iterator itr = _cameras.begin();
|
||||
itr != _cameras.end();
|
||||
++itr)
|
||||
{
|
||||
osg::Camera* camera = *itr;
|
||||
if (camera->getRenderer()) (*(camera->getRenderer()))(this);
|
||||
}
|
||||
|
||||
for(OperationQueue::iterator itr = _operations.begin();
|
||||
itr != _operations.end();
|
||||
)
|
||||
|
@ -127,3 +127,9 @@ void FlushDeletedGLObjectsOperation::operator () (GraphicsContext* context)
|
||||
|
||||
flushDeletedGLObjects(contextID, currentTime, availableTime);
|
||||
}
|
||||
|
||||
|
||||
void RunOperations::operator () (osg::GraphicsContext* context)
|
||||
{
|
||||
context->runOperations();
|
||||
}
|
||||
|
@ -23,19 +23,15 @@ View::View()
|
||||
|
||||
setLightingMode(HEADLIGHT);
|
||||
|
||||
setCamera(new osg::Camera);
|
||||
_camera = new osg::Camera;
|
||||
_camera->setView(this);
|
||||
|
||||
#if 1
|
||||
double height = osg::DisplaySettings::instance()->getScreenHeight();
|
||||
double width = osg::DisplaySettings::instance()->getScreenWidth();
|
||||
double distance = osg::DisplaySettings::instance()->getScreenDistance();
|
||||
|
||||
double vfov = osg::RadiansToDegrees(atan2(height/2.0f,distance)*2.0);
|
||||
|
||||
_camera->setProjectionMatrixAsPerspective( vfov, width/height, 1.0f,10000.0f);
|
||||
#else
|
||||
_camera->setProjectionMatrixAsFrustum(-0.325, 0.325, -0.26, 0.26, 1.0f,10000.0f);
|
||||
#endif
|
||||
|
||||
_camera->setClearColor(osg::Vec4f(0.2f, 0.2f, 0.4f, 1.0f));
|
||||
|
||||
@ -107,7 +103,12 @@ void View::setCamera(osg::Camera* camera)
|
||||
|
||||
_camera = camera;
|
||||
|
||||
if (_camera.valid()) _camera->setView(this);
|
||||
if (_camera.valid())
|
||||
{
|
||||
_camera->setView(this);
|
||||
|
||||
_camera->setRenderer(createRenderer(camera));
|
||||
}
|
||||
}
|
||||
|
||||
void View::updateSlaves()
|
||||
@ -145,6 +146,8 @@ bool View::addSlave(osg::Camera* camera, const osg::Matrix& projectionOffset, co
|
||||
_slaves.push_back(Slave(camera, projectionOffset, viewOffset, useMastersSceneData));
|
||||
|
||||
updateSlave(i);
|
||||
|
||||
camera->setRenderer(createRenderer(camera));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ SET(LIB_PUBLIC_HEADERS
|
||||
${HEADER_PATH}/CompositeViewer
|
||||
${HEADER_PATH}/Export
|
||||
${HEADER_PATH}/GraphicsWindow
|
||||
${HEADER_PATH}/Renderer
|
||||
${HEADER_PATH}/Scene
|
||||
${HEADER_PATH}/Version
|
||||
${HEADER_PATH}/View
|
||||
@ -21,9 +22,10 @@ SET(LIB_PUBLIC_HEADERS
|
||||
|
||||
SET(LIB_COMMON_FILES
|
||||
CompositeViewer.cpp
|
||||
HelpHandler.cpp
|
||||
Renderer.cpp
|
||||
Scene.cpp
|
||||
StatsHandler.cpp
|
||||
HelpHandler.cpp
|
||||
Version.cpp
|
||||
View.cpp
|
||||
Viewer.cpp
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <osgUtil/GLObjectsVisitor>
|
||||
#include <osgGA/TrackballManipulator>
|
||||
#include <osgViewer/CompositeViewer>
|
||||
#include <osgViewer/Renderer>
|
||||
#include <osgDB/Registry>
|
||||
|
||||
#include <osg/io_utils>
|
||||
@ -105,7 +106,6 @@ void CompositeViewer::addView(osgViewer::View* view)
|
||||
|
||||
_views.push_back(view);
|
||||
|
||||
setUpRenderingSupport();
|
||||
if (threadsWereRuinning) startThreading();
|
||||
}
|
||||
|
||||
@ -122,7 +122,6 @@ void CompositeViewer::removeView(osgViewer::View* view)
|
||||
|
||||
_views.erase(itr);
|
||||
|
||||
setUpRenderingSupport();
|
||||
if (threadsWereRuinning) startThreading();
|
||||
|
||||
return;
|
||||
@ -254,22 +253,6 @@ void CompositeViewer::stopThreading()
|
||||
_numThreadsOnBarrier = 0;
|
||||
}
|
||||
|
||||
// Draw operation, that does a draw on the scene graph.
|
||||
struct CompositeViewerRunOperations : public osg::Operation
|
||||
{
|
||||
CompositeViewerRunOperations():
|
||||
osg::Operation("RunOperation",true)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator () (osg::Object* object)
|
||||
{
|
||||
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
|
||||
if (!context) return;
|
||||
|
||||
context->runOperations();
|
||||
}
|
||||
};
|
||||
|
||||
unsigned int CompositeViewer::computeNumberOfThreadsIncludingMainRequired()
|
||||
{
|
||||
@ -373,7 +356,7 @@ void CompositeViewer::startThreading()
|
||||
gc->getGraphicsThread()->add(_startRenderingBarrier.get());
|
||||
|
||||
// add the rendering operation itself.
|
||||
gc->getGraphicsThread()->add(new CompositeViewerRunOperations());
|
||||
gc->getGraphicsThread()->add(new osg::RunOperations());
|
||||
|
||||
if (_endBarrierPosition==BeforeSwapBuffers)
|
||||
{
|
||||
@ -521,183 +504,6 @@ void CompositeViewer::getScenes(Scenes& scenes, bool onlyValid)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Draw operation, that does a draw on the scene graph.
|
||||
struct CompositeViewerRenderingOperation : public osg::Operation
|
||||
{
|
||||
CompositeViewerRenderingOperation(osgUtil::SceneView* sceneView, osgDB::DatabasePager* databasePager):
|
||||
osg::Operation("Render",true),
|
||||
_sceneView(sceneView),
|
||||
_databasePager(databasePager)
|
||||
{
|
||||
_sceneView->getCullVisitor()->setDatabaseRequestHandler(_databasePager.get());
|
||||
|
||||
_flushOperation = new osg::FlushDeletedGLObjectsOperation(0.1);
|
||||
}
|
||||
|
||||
virtual void operator () (osg::Object*)
|
||||
{
|
||||
if (!_sceneView) return;
|
||||
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"RenderingOperation"<<std::endl;
|
||||
|
||||
// pass on the fusion distance settings from the View to the SceneView
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_sceneView->getCamera()->getView());
|
||||
if (view) _sceneView->setFusionDistance(view->getFusionDistanceMode(), view->getFusionDistanceValue());
|
||||
|
||||
osg::GraphicsContext* compileContext = osg::GraphicsContext::getCompileContext(_sceneView->getState()->getContextID());
|
||||
osg::GraphicsThread* compileThread = compileContext ? compileContext->getGraphicsThread() : 0;
|
||||
|
||||
_sceneView->inheritCullSettings(*(_sceneView->getCamera()));
|
||||
_sceneView->cull();
|
||||
_sceneView->draw();
|
||||
|
||||
double availableTime = 0.004; // 4 ms
|
||||
|
||||
if (_databasePager.valid() && _databasePager->requiresExternalCompileGLObjects(_sceneView->getState()->getContextID()))
|
||||
{
|
||||
_databasePager->compileGLObjects(*(_sceneView->getState()), availableTime);
|
||||
}
|
||||
|
||||
if (compileThread)
|
||||
{
|
||||
compileThread->add(_flushOperation.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
_sceneView->flushDeletedGLObjects(availableTime);
|
||||
}
|
||||
}
|
||||
|
||||
osg::observer_ptr<osgUtil::SceneView> _sceneView;
|
||||
osg::observer_ptr<osgDB::DatabasePager> _databasePager;
|
||||
osg::ref_ptr<osg::FlushDeletedGLObjectsOperation> _flushOperation;
|
||||
};
|
||||
|
||||
void CompositeViewer::setUpRenderingSupport()
|
||||
{
|
||||
#if 1
|
||||
_cameraSceneViewMap.clear();
|
||||
|
||||
Contexts contexts;
|
||||
getContexts(contexts);
|
||||
|
||||
osg::FrameStamp* frameStamp = getFrameStamp();
|
||||
|
||||
for(Contexts::iterator gcitr = contexts.begin();
|
||||
gcitr != contexts.end();
|
||||
++gcitr)
|
||||
{
|
||||
(*gcitr)->removeAllOperations();
|
||||
|
||||
osg::GraphicsContext* gc = *gcitr;
|
||||
osg::GraphicsContext::Cameras& cameras = gc->getCameras();
|
||||
osg::State* state = gc->getState();
|
||||
|
||||
for(osg::GraphicsContext::Cameras::iterator citr = cameras.begin();
|
||||
citr != cameras.end();
|
||||
++citr)
|
||||
{
|
||||
osg::Camera* camera = *citr;
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(camera->getView());
|
||||
osgViewer::Scene* scene = view ? view->getScene() : 0;
|
||||
|
||||
osg::DisplaySettings* ds = view ? view->getDisplaySettings() : 0;
|
||||
if (!ds) ds = osg::DisplaySettings::instance();
|
||||
|
||||
osgDB::DatabasePager* dp = scene ? scene->getDatabasePager() : 0;
|
||||
|
||||
camera->setStats(new osg::Stats("Camera"));
|
||||
|
||||
osgUtil::SceneView* sceneView = new osgUtil::SceneView;
|
||||
_cameraSceneViewMap[camera] = sceneView;
|
||||
|
||||
sceneView->setGlobalStateSet(view ? view->getCamera()->getStateSet() : 0);
|
||||
sceneView->setDefaults();
|
||||
sceneView->setDisplaySettings(camera->getDisplaySettings()!=0 ? camera->getDisplaySettings() : ds);
|
||||
sceneView->setCamera(camera);
|
||||
sceneView->setState(state);
|
||||
sceneView->setFrameStamp(frameStamp);
|
||||
|
||||
if (dp) dp->setCompileGLObjectsForContextID(state->getContextID(), true);
|
||||
|
||||
gc->add(new CompositeViewerRenderingOperation(sceneView, dp));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
osg::FrameStamp* frameStamp = getFrameStamp();
|
||||
|
||||
// what should we do with the old sceneViews?
|
||||
_cameraSceneViewMap.clear();
|
||||
|
||||
Contexts contexts;
|
||||
getContexts(contexts);
|
||||
|
||||
// clear out all the previously assigned operations
|
||||
for(Contexts::iterator citr = contexts.begin();
|
||||
citr != contexts.end();
|
||||
++citr)
|
||||
{
|
||||
(*citr)->removeAllOperations();
|
||||
}
|
||||
|
||||
for(Views::iterator itr = _views.begin();
|
||||
itr != _views.end();
|
||||
++itr)
|
||||
{
|
||||
osgViewer::View* view = itr->get();
|
||||
osg::DisplaySettings* ds = view->getDisplaySettings() ? view->getDisplaySettings() : osg::DisplaySettings::instance();
|
||||
|
||||
osgDB::DatabasePager* dp = view->getScene() ? view->getScene()->getDatabasePager() : 0;
|
||||
|
||||
if (view->getCamera() && view->getCamera()->getGraphicsContext())
|
||||
{
|
||||
osgUtil::SceneView* sceneView = new osgUtil::SceneView;
|
||||
_cameraSceneViewMap[view->getCamera()] = sceneView;
|
||||
|
||||
sceneView->setGlobalStateSet(view->getCamera()->getStateSet());
|
||||
sceneView->setDefaults();
|
||||
sceneView->setDisplaySettings(view->getCamera()->getDisplaySettings()!=0 ? view->getCamera()->getDisplaySettings() : ds);
|
||||
sceneView->setCamera(view->getCamera());
|
||||
sceneView->setState(view->getCamera()->getGraphicsContext()->getState());
|
||||
sceneView->setSceneData(view->getSceneData());
|
||||
sceneView->setFrameStamp(frameStamp);
|
||||
|
||||
if (dp) dp->setCompileGLObjectsForContextID(view->getCamera()->getGraphicsContext()->getState()->getContextID(), true);
|
||||
|
||||
view->getCamera()->getGraphicsContext()->add(new CompositeViewerRenderingOperation(sceneView, dp));
|
||||
}
|
||||
|
||||
for(unsigned i=0; i<view->getNumSlaves(); ++i)
|
||||
{
|
||||
View::Slave& slave = view->getSlave(i);
|
||||
if (slave._camera.valid() && slave._camera->getGraphicsContext())
|
||||
{
|
||||
osgUtil::SceneView* sceneView = new osgUtil::SceneView;
|
||||
_cameraSceneViewMap[slave._camera] = sceneView;
|
||||
|
||||
sceneView->setGlobalStateSet(view->getCamera()->getStateSet());
|
||||
sceneView->setDefaults();
|
||||
sceneView->setCamera(slave._camera.get());
|
||||
sceneView->setDisplaySettings(slave._camera->getDisplaySettings()!=0 ? slave._camera->getDisplaySettings() : ds);
|
||||
sceneView->setState(slave._camera->getGraphicsContext()->getState());
|
||||
sceneView->setSceneData(view->getSceneData());
|
||||
sceneView->setFrameStamp(frameStamp);
|
||||
|
||||
if (dp) dp->setCompileGLObjectsForContextID(slave._camera->getGraphicsContext()->getState()->getContextID(), true);
|
||||
|
||||
slave._camera->getGraphicsContext()->add(new CompositeViewerRenderingOperation(sceneView, dp));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void CompositeViewer::realize()
|
||||
{
|
||||
//osg::notify(osg::INFO)<<"CompositeViewer::realize()"<<std::endl;
|
||||
@ -731,8 +537,6 @@ void CompositeViewer::realize()
|
||||
return;
|
||||
}
|
||||
|
||||
setUpRenderingSupport();
|
||||
|
||||
for(Contexts::iterator citr = contexts.begin();
|
||||
citr != contexts.end();
|
||||
++citr)
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
#include <osgViewer/Renderer>
|
||||
|
||||
#include <osg/PolygonMode>
|
||||
|
||||
@ -26,6 +27,7 @@ HelpHandler::HelpHandler(osg::ApplicationUsage* au):
|
||||
_initialized(false)
|
||||
{
|
||||
_camera = new osg::Camera;
|
||||
_camera->setRenderer(new Renderer(_camera.get()));
|
||||
}
|
||||
|
||||
|
||||
@ -76,14 +78,20 @@ bool HelpHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapt
|
||||
|
||||
void HelpHandler::setUpHUDCamera(osgViewer::Viewer* viewer)
|
||||
{
|
||||
osgViewer::Viewer::Windows windows;
|
||||
viewer->getWindows(windows);
|
||||
osgViewer::GraphicsWindow* window = dynamic_cast<osgViewer::GraphicsWindow*>(_camera->getGraphicsContext());
|
||||
|
||||
if (windows.empty()) return;
|
||||
if (!window)
|
||||
{
|
||||
osgViewer::Viewer::Windows windows;
|
||||
viewer->getWindows(windows);
|
||||
|
||||
osgViewer::GraphicsWindow* window = windows.front();
|
||||
if (windows.empty()) return;
|
||||
|
||||
window = windows.front();
|
||||
|
||||
_camera->setGraphicsContext(window);
|
||||
}
|
||||
|
||||
_camera = new osg::Camera;
|
||||
_camera->setGraphicsContext(window);
|
||||
_camera->setViewport(0, 0, window->getTraits()->width, window->getTraits()->height);
|
||||
|
||||
@ -94,8 +102,6 @@ void HelpHandler::setUpHUDCamera(osgViewer::Viewer* viewer)
|
||||
// only clear the depth buffer
|
||||
_camera->setClearMask(0);
|
||||
|
||||
viewer->setUpRenderingSupport();
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
|
573
src/osgViewer/Renderer.cpp
Normal file
573
src/osgViewer/Renderer.cpp
Normal file
@ -0,0 +1,573 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <osg/GLExtensions>
|
||||
|
||||
#include <osgUtil/Optimizer>
|
||||
#include <osgUtil/GLObjectsVisitor>
|
||||
|
||||
#include <osgViewer/Renderer>
|
||||
#include <osgViewer/View>
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#include <osgDB/DatabasePager>
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace osgViewer;
|
||||
|
||||
//#define DEBUG_MESSAGE osg::notify(osg::NOTICE)
|
||||
#define DEBUG_MESSAGE osg::notify(osg::INFO)
|
||||
|
||||
|
||||
OpenGLQuerySupport::OpenGLQuerySupport():
|
||||
_startTick(0),
|
||||
_initialized(false),
|
||||
_timerQuerySupported(false),
|
||||
_extensions(0),
|
||||
_previousQueryTime(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
void OpenGLQuerySupport::checkQuery(osg::Stats* stats)
|
||||
{
|
||||
for(QueryFrameNumberList::iterator itr = _queryFrameNumberList.begin();
|
||||
itr != _queryFrameNumberList.end();
|
||||
)
|
||||
{
|
||||
GLuint query = itr->first;
|
||||
GLint available = 0;
|
||||
_extensions->glGetQueryObjectiv(query, GL_QUERY_RESULT_AVAILABLE, &available);
|
||||
if (available)
|
||||
{
|
||||
GLuint64EXT timeElapsed = 0;
|
||||
_extensions->glGetQueryObjectui64v(query, GL_QUERY_RESULT, &timeElapsed);
|
||||
|
||||
double timeElapsedSeconds = double(timeElapsed)*1e-9;
|
||||
double currentTime = osg::Timer::instance()->delta_s(_startTick, osg::Timer::instance()->tick());
|
||||
double estimatedEndTime = (_previousQueryTime + currentTime) * 0.5;
|
||||
double estimatedBeginTime = estimatedEndTime - timeElapsedSeconds;
|
||||
|
||||
stats->setAttribute(itr->second, "GPU draw begin time", estimatedBeginTime);
|
||||
stats->setAttribute(itr->second, "GPU draw end time", estimatedEndTime);
|
||||
stats->setAttribute(itr->second, "GPU draw time taken", timeElapsedSeconds);
|
||||
|
||||
|
||||
itr = _queryFrameNumberList.erase(itr);
|
||||
_availableQueryObjects.push_back(query);
|
||||
}
|
||||
else
|
||||
{
|
||||
++itr;
|
||||
}
|
||||
|
||||
}
|
||||
_previousQueryTime = osg::Timer::instance()->delta_s(_startTick, osg::Timer::instance()->tick());
|
||||
}
|
||||
|
||||
GLuint OpenGLQuerySupport::createQueryObject()
|
||||
{
|
||||
if (_availableQueryObjects.empty())
|
||||
{
|
||||
GLuint query;
|
||||
_extensions->glGenQueries(1, &query);
|
||||
return query;
|
||||
}
|
||||
else
|
||||
{
|
||||
GLuint query = _availableQueryObjects.back();
|
||||
_availableQueryObjects.pop_back();
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLQuerySupport::beginQuery(int frameNumber)
|
||||
{
|
||||
GLuint query = createQueryObject();
|
||||
_extensions->glBeginQuery(GL_TIME_ELAPSED, query);
|
||||
_queryFrameNumberList.push_back(QueryFrameNumberPair(query, frameNumber));
|
||||
}
|
||||
|
||||
void OpenGLQuerySupport::endQuery()
|
||||
{
|
||||
_extensions->glEndQuery(GL_TIME_ELAPSED);
|
||||
}
|
||||
|
||||
void OpenGLQuerySupport::initialize(osg::State* state)
|
||||
{
|
||||
if (_initialized) return;
|
||||
|
||||
_initialized = true;
|
||||
_extensions = osg::Drawable::getExtensions(state->getContextID(),true);
|
||||
_timerQuerySupported = _extensions && _extensions->isTimerQuerySupported();
|
||||
_previousQueryTime = osg::Timer::instance()->delta_s(_startTick, osg::Timer::instance()->tick());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// Renderer
|
||||
|
||||
Renderer::Renderer(osg::Camera* camera):
|
||||
osg::GraphicsOperation("Renderer",true),
|
||||
OpenGLQuerySupport(),
|
||||
_camera(camera),
|
||||
_done(false),
|
||||
_graphicsThreadDoesCull(true)
|
||||
{
|
||||
|
||||
DEBUG_MESSAGE<<"Render::Render() "<<this<<std::endl;
|
||||
|
||||
_lockHeld[0] = false;
|
||||
_lockHeld[1] = false;
|
||||
|
||||
_sceneView[0] = new osgUtil::SceneView;
|
||||
_sceneView[1] = new osgUtil::SceneView;
|
||||
|
||||
unsigned int sceneViewOptions = osgUtil::SceneView::HEADLIGHT;
|
||||
|
||||
osg::Camera* masterCamera = _camera->getView() ? _camera->getView()->getCamera() : camera;
|
||||
osg::StateSet* stateset = masterCamera->getOrCreateStateSet();
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_camera->getView());
|
||||
|
||||
osg::DisplaySettings* ds = _camera->getDisplaySettings() ? _camera->getDisplaySettings() :
|
||||
((view &&view->getDisplaySettings()) ? view->getDisplaySettings() : osg::DisplaySettings::instance());
|
||||
|
||||
_sceneView[0]->setGlobalStateSet(stateset);
|
||||
_sceneView[1]->setGlobalStateSet(stateset);
|
||||
|
||||
_sceneView[0]->setDefaults(sceneViewOptions);
|
||||
_sceneView[1]->setDefaults(sceneViewOptions);
|
||||
|
||||
_sceneView[0]->setDisplaySettings(ds);
|
||||
_sceneView[1]->setDisplaySettings(ds);
|
||||
|
||||
_sceneView[0]->setCamera(_camera.get());
|
||||
_sceneView[1]->setCamera(_camera.get());
|
||||
|
||||
_currentCull = 0;
|
||||
_currentDraw = 0;
|
||||
|
||||
// lock the mutex for the current cull SceneView to
|
||||
// prevent the draw traversal from reading from it before the cull traversal has been completed.
|
||||
if (!_graphicsThreadDoesCull)
|
||||
{
|
||||
_mutex[_currentCull].lock();
|
||||
_lockHeld[_currentCull] = true;
|
||||
}
|
||||
|
||||
_flushOperation = new osg::FlushDeletedGLObjectsOperation(0.1);
|
||||
}
|
||||
|
||||
Renderer::~Renderer()
|
||||
{
|
||||
DEBUG_MESSAGE<<"Render::~Render() "<<this<<std::endl;
|
||||
}
|
||||
|
||||
void Renderer::setGraphicsThreadDoesCull(bool flag)
|
||||
{
|
||||
if (_graphicsThreadDoesCull==flag) return;
|
||||
|
||||
_graphicsThreadDoesCull = flag;
|
||||
|
||||
_currentCull = 0;
|
||||
_currentDraw = 0;
|
||||
|
||||
if (_graphicsThreadDoesCull)
|
||||
{
|
||||
// need to disable any locks held by the cull
|
||||
if (_lockHeld[0])
|
||||
{
|
||||
_lockHeld[0] = false;
|
||||
_mutex[0].unlock();
|
||||
}
|
||||
|
||||
if (_lockHeld[1])
|
||||
{
|
||||
_lockHeld[1] = false;
|
||||
_mutex[1].unlock();
|
||||
}
|
||||
|
||||
DEBUG_MESSAGE<<"Disabling locks in Renderer"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_MESSAGE<<"Enable locks in Renderer"<<std::endl;
|
||||
|
||||
// need to set a lock for cull
|
||||
_mutex[_currentCull].lock();
|
||||
_lockHeld[_currentCull] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::updateSceneView(osgUtil::SceneView* sceneView)
|
||||
{
|
||||
osg::Camera* masterCamera = _camera->getView() ? _camera->getView()->getCamera() : _camera.get();
|
||||
osg::StateSet* stateset = masterCamera->getOrCreateStateSet();
|
||||
|
||||
if (sceneView->getGlobalStateSet()!=stateset)
|
||||
{
|
||||
sceneView->setGlobalStateSet(stateset);
|
||||
}
|
||||
|
||||
osg::GraphicsContext* context = _camera->getGraphicsContext();
|
||||
osg::State* state = context ? context->getState() : 0;
|
||||
if (sceneView->getState()!=state)
|
||||
{
|
||||
sceneView->setState(state);
|
||||
}
|
||||
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_camera->getView());
|
||||
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(view);
|
||||
Scene* scene = view ? view->getScene() : 0;
|
||||
osgDB::DatabasePager* databasePager = scene ? scene->getDatabasePager() : 0;
|
||||
sceneView->getCullVisitor()->setDatabaseRequestHandler(databasePager);
|
||||
|
||||
sceneView->setFrameStamp(scene ? scene->getFrameStamp() : state->getFrameStamp());
|
||||
|
||||
if (databasePager) databasePager->setCompileGLObjectsForContextID(state->getContextID(), true);
|
||||
|
||||
osg::DisplaySettings* ds = _camera->getDisplaySettings() ? _camera->getDisplaySettings() :
|
||||
((view &&view->getDisplaySettings()) ? view->getDisplaySettings() : osg::DisplaySettings::instance());
|
||||
|
||||
sceneView->setDisplaySettings(ds);
|
||||
|
||||
if (viewer) _startTick = viewer->getStartTick();
|
||||
}
|
||||
|
||||
|
||||
void Renderer::cull()
|
||||
{
|
||||
DEBUG_MESSAGE<<"cull()"<<std::endl;
|
||||
|
||||
if (_done || _graphicsThreadDoesCull) return;
|
||||
|
||||
// note we assume lock has already been aquired.
|
||||
osgUtil::SceneView* sceneView = _sceneView[_currentCull].get();
|
||||
|
||||
if (sceneView)
|
||||
{
|
||||
updateSceneView(sceneView);
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"Culling buffer "<<_currentCull<<std::endl;
|
||||
|
||||
// pass on the fusion distance settings from the View to the SceneView
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(sceneView->getCamera()->getView());
|
||||
if (view) sceneView->setFusionDistance(view->getFusionDistanceMode(), view->getFusionDistanceValue());
|
||||
|
||||
osg::Stats* stats = sceneView->getCamera()->getStats();
|
||||
osg::State* state = sceneView->getState();
|
||||
const osg::FrameStamp* fs = state->getFrameStamp();
|
||||
int frameNumber = fs ? fs->getFrameNumber() : 0;
|
||||
|
||||
_frameNumber[_currentCull] = frameNumber;
|
||||
|
||||
// do cull taversal
|
||||
osg::Timer_t beforeCullTick = osg::Timer::instance()->tick();
|
||||
|
||||
sceneView->inheritCullSettings(*(sceneView->getCamera()));
|
||||
sceneView->cull();
|
||||
|
||||
osg::Timer_t afterCullTick = osg::Timer::instance()->tick();
|
||||
|
||||
#if 0
|
||||
if (sceneView->getDynamicObjectCount()==0 && state->getDynamicObjectRenderingCompletedCallback())
|
||||
{
|
||||
// osg::notify(osg::NOTICE)<<"Completed in cull"<<std::endl;
|
||||
state->getDynamicObjectRenderingCompletedCallback()->completed(state);
|
||||
}
|
||||
#endif
|
||||
if (stats && stats->collectStats("rendering"))
|
||||
{
|
||||
DEBUG_MESSAGE<<"Collecting rendering stats"<<std::endl;
|
||||
|
||||
stats->setAttribute(frameNumber, "Cull traversal begin time", osg::Timer::instance()->delta_s(_startTick, beforeCullTick));
|
||||
stats->setAttribute(frameNumber, "Cull traversal end time", osg::Timer::instance()->delta_s(_startTick, afterCullTick));
|
||||
stats->setAttribute(frameNumber, "Cull traversal time taken", osg::Timer::instance()->delta_s(beforeCullTick, afterCullTick));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// relase the mutex associated with this cull traversal, let the draw commence.
|
||||
_lockHeld[_currentCull] = false;
|
||||
_mutex[_currentCull].unlock();
|
||||
|
||||
// swap which SceneView we need to do cull traversal on next.
|
||||
_currentCull = 1 - _currentCull;
|
||||
|
||||
// aquire the lock for it for the new cull traversal
|
||||
_mutex[_currentCull].lock();
|
||||
_lockHeld[_currentCull] = true;
|
||||
|
||||
DEBUG_MESSAGE<<"end cull() "<<this<<std::endl;
|
||||
}
|
||||
|
||||
void Renderer::draw()
|
||||
{
|
||||
DEBUG_MESSAGE<<"draw() "<<this<<std::endl;
|
||||
|
||||
osgUtil::SceneView* sceneView = _sceneView[_currentDraw].get();
|
||||
|
||||
osg::GraphicsContext* compileContext = osg::GraphicsContext::getCompileContext(sceneView->getState()->getContextID());
|
||||
osg::GraphicsThread* compileThread = compileContext ? compileContext->getGraphicsThread() : 0;
|
||||
|
||||
if (sceneView || _done)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex[_currentDraw]);
|
||||
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_camera->getView());
|
||||
Scene* scene = view ? view->getScene() : 0;
|
||||
osgDB::DatabasePager* databasePager = scene ? scene->getDatabasePager() : 0;
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"Drawing buffer "<<_currentDraw<<std::endl;
|
||||
|
||||
if (_done)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"Renderer::release() causing draw to exit"<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_graphicsThreadDoesCull)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"Renderer::draw() completing early due to change in _graphicsThreadDoesCull flag."<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"RenderingOperation"<<std::endl;
|
||||
|
||||
osg::Stats* stats = sceneView->getCamera()->getStats();
|
||||
osg::State* state = sceneView->getState();
|
||||
int frameNumber = _frameNumber[_currentDraw];
|
||||
|
||||
if (!_initialized)
|
||||
{
|
||||
initialize(state);
|
||||
}
|
||||
|
||||
state->setDynamicObjectCount(sceneView->getDynamicObjectCount());
|
||||
|
||||
if (sceneView->getDynamicObjectCount()==0 && state->getDynamicObjectRenderingCompletedCallback())
|
||||
{
|
||||
// osg::notify(osg::NOTICE)<<"Completed in cull"<<std::endl;
|
||||
state->getDynamicObjectRenderingCompletedCallback()->completed(state);
|
||||
}
|
||||
|
||||
osg::Timer_t beforeDrawTick = osg::Timer::instance()->tick();
|
||||
|
||||
bool aquireGPUStats = stats && _timerQuerySupported && stats->collectStats("gpu");
|
||||
|
||||
if (aquireGPUStats)
|
||||
{
|
||||
checkQuery(stats);
|
||||
}
|
||||
|
||||
// do draw traveral
|
||||
if (aquireGPUStats)
|
||||
{
|
||||
checkQuery(stats);
|
||||
beginQuery(frameNumber);
|
||||
}
|
||||
|
||||
sceneView->draw();
|
||||
|
||||
double availableTime = 0.004; // 4 ms
|
||||
if (databasePager && databasePager->requiresExternalCompileGLObjects(sceneView->getState()->getContextID()))
|
||||
{
|
||||
databasePager->compileGLObjects(*(sceneView->getState()), availableTime);
|
||||
}
|
||||
|
||||
if (compileThread)
|
||||
{
|
||||
compileThread->add(_flushOperation.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
sceneView->flushDeletedGLObjects(availableTime);
|
||||
}
|
||||
|
||||
if (aquireGPUStats)
|
||||
{
|
||||
endQuery();
|
||||
checkQuery(stats);
|
||||
}
|
||||
|
||||
glFlush();
|
||||
|
||||
|
||||
osg::Timer_t afterDrawTick = osg::Timer::instance()->tick();
|
||||
|
||||
if (stats && stats->collectStats("rendering"))
|
||||
{
|
||||
stats->setAttribute(frameNumber, "Draw traversal begin time", osg::Timer::instance()->delta_s(_startTick, beforeDrawTick));
|
||||
stats->setAttribute(frameNumber, "Draw traversal end time", osg::Timer::instance()->delta_s(_startTick, afterDrawTick));
|
||||
stats->setAttribute(frameNumber, "Draw traversal time taken", osg::Timer::instance()->delta_s(beforeDrawTick, afterDrawTick));
|
||||
}
|
||||
}
|
||||
|
||||
_currentDraw = 1-_currentDraw;
|
||||
|
||||
DEBUG_MESSAGE<<"end draw() "<<this<<std::endl;
|
||||
}
|
||||
|
||||
void Renderer::cull_draw()
|
||||
{
|
||||
DEBUG_MESSAGE<<"cull_draw() "<<this<<std::endl;
|
||||
|
||||
osgUtil::SceneView* sceneView = _sceneView[_currentDraw].get();
|
||||
if (!sceneView || _done) return;
|
||||
|
||||
updateSceneView(sceneView);
|
||||
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_camera->getView());
|
||||
Scene* scene = view ? view->getScene() : 0;
|
||||
osgDB::DatabasePager* databasePager = scene ? scene->getDatabasePager() : 0;
|
||||
|
||||
osg::GraphicsContext* compileContext = osg::GraphicsContext::getCompileContext(sceneView->getState()->getContextID());
|
||||
osg::GraphicsThread* compileThread = compileContext ? compileContext->getGraphicsThread() : 0;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex[_currentDraw]);
|
||||
|
||||
if (_done)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"Render::release() causing cull_draw to exit"<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"RenderingOperation"<<std::endl;
|
||||
|
||||
// pass on the fusion distance settings from the View to the SceneView
|
||||
if (view) sceneView->setFusionDistance(view->getFusionDistanceMode(), view->getFusionDistanceValue());
|
||||
|
||||
osg::Stats* stats = sceneView->getCamera()->getStats();
|
||||
osg::State* state = sceneView->getState();
|
||||
const osg::FrameStamp* fs = state->getFrameStamp();
|
||||
int frameNumber = fs ? fs->getFrameNumber() : 0;
|
||||
|
||||
if (!_initialized)
|
||||
{
|
||||
initialize(state);
|
||||
}
|
||||
|
||||
bool aquireGPUStats = stats && _timerQuerySupported && stats->collectStats("gpu");
|
||||
|
||||
if (aquireGPUStats)
|
||||
{
|
||||
checkQuery(stats);
|
||||
}
|
||||
|
||||
// do cull taversal
|
||||
osg::Timer_t beforeCullTick = osg::Timer::instance()->tick();
|
||||
|
||||
sceneView->inheritCullSettings(*(sceneView->getCamera()));
|
||||
sceneView->cull();
|
||||
|
||||
osg::Timer_t afterCullTick = osg::Timer::instance()->tick();
|
||||
|
||||
#if 0
|
||||
if (state->getDynamicObjectCount()==0 && state->getDynamicObjectRenderingCompletedCallback())
|
||||
{
|
||||
state->getDynamicObjectRenderingCompletedCallback()->completed(state);
|
||||
}
|
||||
#endif
|
||||
|
||||
// do draw traveral
|
||||
if (aquireGPUStats)
|
||||
{
|
||||
checkQuery(stats);
|
||||
beginQuery(frameNumber);
|
||||
}
|
||||
|
||||
sceneView->draw();
|
||||
|
||||
double availableTime = 0.004; // 4 ms
|
||||
if (databasePager && databasePager->requiresExternalCompileGLObjects(sceneView->getState()->getContextID()))
|
||||
{
|
||||
databasePager->compileGLObjects(*(sceneView->getState()), availableTime);
|
||||
}
|
||||
|
||||
if (compileThread)
|
||||
{
|
||||
compileThread->add(_flushOperation.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
sceneView->flushDeletedGLObjects(availableTime);
|
||||
}
|
||||
|
||||
if (aquireGPUStats)
|
||||
{
|
||||
endQuery();
|
||||
checkQuery(stats);
|
||||
}
|
||||
|
||||
osg::Timer_t afterDrawTick = osg::Timer::instance()->tick();
|
||||
|
||||
if (stats && stats->collectStats("rendering"))
|
||||
{
|
||||
DEBUG_MESSAGE<<"Collecting rendering stats"<<std::endl;
|
||||
|
||||
stats->setAttribute(frameNumber, "Cull traversal begin time", osg::Timer::instance()->delta_s(_startTick, beforeCullTick));
|
||||
stats->setAttribute(frameNumber, "Cull traversal end time", osg::Timer::instance()->delta_s(_startTick, afterCullTick));
|
||||
stats->setAttribute(frameNumber, "Cull traversal time taken", osg::Timer::instance()->delta_s(beforeCullTick, afterCullTick));
|
||||
|
||||
stats->setAttribute(frameNumber, "Draw traversal begin time", osg::Timer::instance()->delta_s(_startTick, afterCullTick));
|
||||
stats->setAttribute(frameNumber, "Draw traversal end time", osg::Timer::instance()->delta_s(_startTick, afterDrawTick));
|
||||
stats->setAttribute(frameNumber, "Draw traversal time taken", osg::Timer::instance()->delta_s(afterCullTick, afterDrawTick));
|
||||
}
|
||||
|
||||
DEBUG_MESSAGE<<"end cull_draw() "<<this<<std::endl;
|
||||
|
||||
}
|
||||
|
||||
void Renderer::operator () (osg::Object* object)
|
||||
{
|
||||
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
|
||||
if (context) operator()(context);
|
||||
|
||||
osg::Camera* camera = dynamic_cast<osg::Camera*>(object);
|
||||
if (camera) cull();
|
||||
}
|
||||
|
||||
void Renderer::operator () (osg::GraphicsContext* context)
|
||||
{
|
||||
if (_graphicsThreadDoesCull)
|
||||
{
|
||||
cull_draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
draw();
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::release()
|
||||
{
|
||||
osg::notify(osg::INFO)<<"Renderer::release()"<<std::endl;
|
||||
_done = true;
|
||||
|
||||
if (_lockHeld[0])
|
||||
{
|
||||
_lockHeld[0] = false;
|
||||
_mutex[0].unlock();
|
||||
}
|
||||
|
||||
if (_lockHeld[1])
|
||||
{
|
||||
_lockHeld[1] = false;
|
||||
_mutex[1].unlock();
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
#include <osgViewer/Renderer>
|
||||
|
||||
#include <osg/PolygonMode>
|
||||
#include <osg/Geometry>
|
||||
@ -34,6 +35,7 @@ StatsHandler::StatsHandler():
|
||||
_blockMultiplier(10000.0)
|
||||
{
|
||||
_camera = new osg::Camera;
|
||||
_camera->setRenderer(new Renderer(_camera.get()));
|
||||
}
|
||||
|
||||
bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
|
||||
@ -224,7 +226,7 @@ void StatsHandler::setUpHUDCamera(osgViewer::Viewer* viewer)
|
||||
// only clear the depth buffer
|
||||
_camera->setClearMask(0);
|
||||
|
||||
viewer->setUpRenderingSupport();
|
||||
_camera->setRenderer(new Renderer(_camera.get()));
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
@ -479,13 +481,13 @@ void StatsHandler::setUpScene(osgViewer::Viewer* viewer)
|
||||
// collect all the relevant camers
|
||||
typedef std::vector<osg::Camera*> Cameras;
|
||||
Cameras cameras;
|
||||
if (viewer->getCamera()->getStats())
|
||||
if (viewer->getCamera()->getStats() && viewer->getCamera()->getGraphicsContext())
|
||||
{
|
||||
cameras.push_back(viewer->getCamera());
|
||||
}
|
||||
for(unsigned int si=0; si<viewer->getNumSlaves(); ++si)
|
||||
{
|
||||
if (viewer->getSlave(si)._camera->getStats())
|
||||
if (viewer->getSlave(si)._camera->getStats() && viewer->getSlave(si)._camera->getGraphicsContext())
|
||||
{
|
||||
cameras.push_back(viewer->getSlave(si)._camera.get());
|
||||
}
|
||||
@ -497,11 +499,14 @@ void StatsHandler::setUpScene(osgViewer::Viewer* viewer)
|
||||
citr != cameras.end();
|
||||
++citr)
|
||||
{
|
||||
unsigned int contextID = (*citr)->getGraphicsContext()->getState()->getContextID();
|
||||
const osg::Drawable::Extensions* extensions = osg::Drawable::getExtensions(contextID, false);
|
||||
if (extensions && extensions->isTimerQuerySupported())
|
||||
if ((*citr)->getGraphicsContext())
|
||||
{
|
||||
++numCamrasWithTimerQuerySupport;
|
||||
unsigned int contextID = (*citr)->getGraphicsContext()->getState()->getContextID();
|
||||
const osg::Drawable::Extensions* extensions = osg::Drawable::getExtensions(contextID, false);
|
||||
if (extensions && extensions->isTimerQuerySupported())
|
||||
{
|
||||
++numCamrasWithTimerQuerySupport;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osgViewer/Renderer>
|
||||
#include <osgViewer/View>
|
||||
#include <osgViewer/GraphicsWindow>
|
||||
|
||||
@ -126,6 +127,9 @@ View::View():
|
||||
|
||||
// make sure View is safe to reference multi-threaded.
|
||||
setThreadSafeRefUnref(true);
|
||||
|
||||
// need to attach a Renderer to the maaster camera which has been default constructed
|
||||
getCamera()->setRenderer(createRenderer(getCamera()));
|
||||
|
||||
setEventQueue(new osgGA::EventQueue);
|
||||
}
|
||||
@ -144,6 +148,14 @@ View::~View()
|
||||
// osg::notify(osg::NOTICE)<<"Destructing osgViewer::View"<<std::endl;
|
||||
}
|
||||
|
||||
osg::GraphicsOperation* View::createRenderer(osg::Camera* camera)
|
||||
{
|
||||
Renderer* render = new Renderer(camera);
|
||||
camera->setStats(new osg::Stats("Camera"));
|
||||
return render;
|
||||
}
|
||||
|
||||
|
||||
void View::init()
|
||||
{
|
||||
osg::notify(osg::INFO)<<"View::init()"<<std::endl;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,7 @@
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/DisplaySettings>
|
||||
#include <osg/GraphicsContext>
|
||||
#include <osg/GraphicsThread>
|
||||
#include <osg/Image>
|
||||
#include <osg/Matrix>
|
||||
#include <osg/Matrixd>
|
||||
@ -476,21 +477,36 @@ BEGIN_OBJECT_REFLECTOR(osg::Camera)
|
||||
__C5_GraphicsContext_P1__getGraphicsContext,
|
||||
"Get the const GraphicsContext. ",
|
||||
"");
|
||||
I_Method1(void, setRenderer, IN, osg::Object *, rc,
|
||||
I_Method1(void, setRenderer, IN, osg::GraphicsOperation *, rc,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setRenderer__osg_Object_P1,
|
||||
__void__setRenderer__osg_GraphicsOperation_P1,
|
||||
"Set the Rendering object that is used to implement rendering of the subgraph. ",
|
||||
"");
|
||||
I_Method0(osg::Object *, getRenderer,
|
||||
I_Method0(osg::GraphicsOperation *, getRenderer,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Object_P1__getRenderer,
|
||||
__osg_GraphicsOperation_P1__getRenderer,
|
||||
"Get the Rendering object that is used to implement rendering of the subgraph. ",
|
||||
"");
|
||||
I_Method0(const osg::Object *, getRenderer,
|
||||
I_Method0(const osg::GraphicsOperation *, getRenderer,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_osg_Object_P1__getRenderer,
|
||||
__C5_osg_GraphicsOperation_P1__getRenderer,
|
||||
"Get the const Rendering object that is used to implement rendering of the subgraph. ",
|
||||
"");
|
||||
I_Method1(void, setRenderingCache, IN, osg::Object *, rc,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setRenderingCache__osg_Object_P1,
|
||||
"Set the Rendering cache that is used for cached objects associated with rendering of subgraphs. ",
|
||||
"");
|
||||
I_Method0(osg::Object *, getRenderingCache,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Object_P1__getRenderingCache,
|
||||
"Get the Rendering cache that is used for cached objects associated with rendering of subgraphs. ",
|
||||
"");
|
||||
I_Method0(const osg::Object *, getRenderingCache,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_osg_Object_P1__getRenderingCache,
|
||||
"Get the const Rendering cache that is used for cached objects associated with rendering of subgraphs. ",
|
||||
"");
|
||||
I_Method1(void, setPreDrawCallback, IN, osg::Camera::DrawCallback *, cb,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setPreDrawCallback__DrawCallback_P1,
|
||||
@ -606,9 +622,12 @@ BEGIN_OBJECT_REFLECTOR(osg::Camera)
|
||||
I_SimpleProperty(osg::Camera::RenderTargetImplementation, RenderTargetImplementation,
|
||||
__RenderTargetImplementation__getRenderTargetImplementation,
|
||||
__void__setRenderTargetImplementation__RenderTargetImplementation);
|
||||
I_SimpleProperty(osg::Object *, Renderer,
|
||||
__osg_Object_P1__getRenderer,
|
||||
__void__setRenderer__osg_Object_P1);
|
||||
I_SimpleProperty(osg::GraphicsOperation *, Renderer,
|
||||
__osg_GraphicsOperation_P1__getRenderer,
|
||||
__void__setRenderer__osg_GraphicsOperation_P1);
|
||||
I_SimpleProperty(osg::Object *, RenderingCache,
|
||||
__osg_Object_P1__getRenderingCache,
|
||||
__void__setRenderingCache__osg_Object_P1);
|
||||
I_SimpleProperty(osg::Stats *, Stats,
|
||||
__osg_Stats_P1__getStats,
|
||||
__void__setStats__osg_Stats_P1);
|
||||
|
@ -105,6 +105,14 @@ BEGIN_OBJECT_REFLECTOR(osg::ReleaseContext_Block_MakeCurrentOperation)
|
||||
"");
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::RunOperations)
|
||||
I_DeclaringFile("osg/GraphicsThread");
|
||||
I_BaseType(osg::GraphicsOperation);
|
||||
I_Constructor0(____RunOperations,
|
||||
"",
|
||||
"");
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::SwapBuffersOperation)
|
||||
I_DeclaringFile("osg/GraphicsThread");
|
||||
I_BaseType(osg::GraphicsOperation);
|
||||
|
@ -621,10 +621,15 @@ BEGIN_OBJECT_REFLECTOR(osg::State)
|
||||
__void__setFrameStamp__FrameStamp_P1,
|
||||
"Set the frame stamp for the current frame. ",
|
||||
"");
|
||||
I_Method0(osg::FrameStamp *, getFrameStamp,
|
||||
Properties::NON_VIRTUAL,
|
||||
__FrameStamp_P1__getFrameStamp,
|
||||
"Get the frame stamp for the current frame. ",
|
||||
"");
|
||||
I_Method0(const osg::FrameStamp *, getFrameStamp,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_FrameStamp_P1__getFrameStamp,
|
||||
"Get the frame stamp for the current frame. ",
|
||||
"Get the const frame stamp for the current frame. ",
|
||||
"");
|
||||
I_Method1(void, setDisplaySettings, IN, osg::DisplaySettings *, vs,
|
||||
Properties::NON_VIRTUAL,
|
||||
@ -795,7 +800,7 @@ BEGIN_OBJECT_REFLECTOR(osg::State)
|
||||
0,
|
||||
__void__setFogCoordPointer__C5_Array_P1);
|
||||
I_SimpleProperty(osg::FrameStamp *, FrameStamp,
|
||||
0,
|
||||
__FrameStamp_P1__getFrameStamp,
|
||||
__void__setFrameStamp__FrameStamp_P1);
|
||||
I_SimpleProperty(const osg::StateAttribute *, GlobalDefaultAttribute,
|
||||
0,
|
||||
|
@ -169,6 +169,12 @@ BEGIN_OBJECT_REFLECTOR(osg::View)
|
||||
__void__updateSlave__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(osg::GraphicsOperation *, createRenderer, IN, osg::Camera *, camera,
|
||||
Properties::VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__osg_GraphicsOperation_P1__createRenderer__osg_Camera_P1,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(osg::Camera *, Camera,
|
||||
__osg_Camera_P1__getCamera,
|
||||
__void__setCamera__osg_Camera_P1);
|
||||
|
@ -277,11 +277,6 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer)
|
||||
__void__startThreading,
|
||||
"Start any threads required by the viewer, as per viewers ThreadingModel. ",
|
||||
"");
|
||||
I_Method0(void, setUpRenderingSupport,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setUpRenderingSupport,
|
||||
"Set up the Operations to render the various viewer cameras on the viewers graphics windows. ",
|
||||
"");
|
||||
I_ProtectedMethod0(void, constructorInit,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
|
152
src/osgWrappers/osgViewer/Renderer.cpp
Normal file
152
src/osgWrappers/osgViewer/Renderer.cpp
Normal file
@ -0,0 +1,152 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Generated automatically by genwrapper.
|
||||
// Please DO NOT EDIT this file!
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#include <osgIntrospection/ReflectionMacros>
|
||||
#include <osgIntrospection/TypedMethodInfo>
|
||||
#include <osgIntrospection/StaticMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/Camera>
|
||||
#include <osg/GraphicsContext>
|
||||
#include <osg/Object>
|
||||
#include <osg/State>
|
||||
#include <osg/Stats>
|
||||
#include <osg/Timer>
|
||||
#include <osgUtil/SceneView>
|
||||
#include <osgViewer/Renderer>
|
||||
|
||||
// Must undefine IN and OUT macros defined in Windows headers
|
||||
#ifdef IN
|
||||
#undef IN
|
||||
#endif
|
||||
#ifdef OUT
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
TYPE_NAME_ALIAS(std::pair< GLuint COMMA int >, osgViewer::OpenGLQuerySupport::QueryFrameNumberPair)
|
||||
|
||||
TYPE_NAME_ALIAS(std::list< osgViewer::OpenGLQuerySupport::QueryFrameNumberPair >, osgViewer::OpenGLQuerySupport::QueryFrameNumberList)
|
||||
|
||||
TYPE_NAME_ALIAS(std::vector< GLuint >, osgViewer::OpenGLQuerySupport::QueryList)
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osgViewer::OpenGLQuerySupport)
|
||||
I_DeclaringFile("osgViewer/Renderer");
|
||||
I_Constructor0(____OpenGLQuerySupport,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setStartTick, IN, osg::Timer_t, startTick,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setStartTick__osg_Timer_t,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osg::Timer_t, getStartTick,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Timer_t__getStartTick,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, checkQuery, IN, osg::Stats *, stats,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__checkQuery__osg_Stats_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(GLuint, createQueryObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__GLuint__createQueryObject,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, beginQuery, IN, int, frameNumber,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__beginQuery__int,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, endQuery,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__endQuery,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, initialize, IN, osg::State *, state,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__initialize__osg_State_P1,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(osg::Timer_t, StartTick,
|
||||
__osg_Timer_t__getStartTick,
|
||||
__void__setStartTick__osg_Timer_t);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgViewer::Renderer)
|
||||
I_DeclaringFile("osgViewer/Renderer");
|
||||
I_BaseType(osg::GraphicsOperation);
|
||||
I_BaseType(osgViewer::OpenGLQuerySupport);
|
||||
I_Constructor1(IN, osg::Camera *, camera,
|
||||
Properties::NON_EXPLICIT,
|
||||
____Renderer__osg_Camera_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osgUtil::SceneView *, getSceneView, IN, unsigned int, i,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osgUtil_SceneView_P1__getSceneView__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setDone, IN, bool, done,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setDone__bool,
|
||||
"",
|
||||
"");
|
||||
I_Method0(bool, getDone,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__getDone,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setGraphicsThreadDoesCull, IN, bool, flag,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setGraphicsThreadDoesCull__bool,
|
||||
"",
|
||||
"");
|
||||
I_Method0(bool, getGraphicsThreadDoesCull,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__getGraphicsThreadDoesCull,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, cull,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__cull,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, draw,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__draw,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, cull_draw,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__cull_draw,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, release,
|
||||
Properties::VIRTUAL,
|
||||
__void__release,
|
||||
"if this operation is a barrier then release it. ",
|
||||
"");
|
||||
I_ProtectedMethod1(void, updateSceneView, IN, osgUtil::SceneView *, sceneView,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__void__updateSceneView__osgUtil_SceneView_P1,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(bool, Done,
|
||||
__bool__getDone,
|
||||
__void__setDone__bool);
|
||||
I_SimpleProperty(bool, GraphicsThreadDoesCull,
|
||||
__bool__getGraphicsThreadDoesCull,
|
||||
__void__setGraphicsThreadDoesCull__bool);
|
||||
END_REFLECTOR
|
||||
|
||||
STD_LIST_REFLECTOR(std::list< osgViewer::OpenGLQuerySupport::QueryFrameNumberPair >)
|
||||
|
||||
STD_PAIR_REFLECTOR(std::pair< GLuint COMMA int >)
|
||||
|
@ -201,17 +201,17 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::View)
|
||||
I_Method1(void, setDisplaySettings, IN, osg::DisplaySettings *, ds,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setDisplaySettings__osg_DisplaySettings_P1,
|
||||
"Set the DsplaySettings object associated with this view. ",
|
||||
"Set the DisplaySettings object associated with this view. ",
|
||||
"");
|
||||
I_Method0(osg::DisplaySettings *, getDisplaySettings,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_DisplaySettings_P1__getDisplaySettings,
|
||||
"Set the DsplaySettings object associated with this view. ",
|
||||
"Set the DisplaySettings object associated with this view. ",
|
||||
"");
|
||||
I_Method0(const osg::DisplaySettings *, getDisplaySettings,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_osg_DisplaySettings_P1__getDisplaySettings,
|
||||
"Set the DsplaySettings object associated with this view. ",
|
||||
"Set the DisplaySettings object associated with this view. ",
|
||||
"");
|
||||
I_MethodWithDefaults2(void, setFusionDistance, IN, osgUtil::SceneView::FusionDistanceMode, mode, , IN, float, value, 1.0f,
|
||||
Properties::NON_VIRTUAL,
|
||||
@ -288,6 +288,12 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::View)
|
||||
__void__init,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(osg::GraphicsOperation *, createRenderer, IN, osg::Camera *, camera,
|
||||
Properties::VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__osg_GraphicsOperation_P1__createRenderer__osg_Camera_P1,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(osgGA::MatrixManipulator *, CameraManipulator,
|
||||
__osgGA_MatrixManipulator_P1__getCameraManipulator,
|
||||
__void__setCameraManipulator__osgGA_MatrixManipulator_P1);
|
||||
|
@ -274,11 +274,6 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer)
|
||||
__void__startThreading,
|
||||
"Start any threads required by the viewer. ",
|
||||
"");
|
||||
I_Method0(void, setUpRenderingSupport,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setUpRenderingSupport,
|
||||
"Set up the Operations to render the various viewer cameras on the viewers graphics windows. ",
|
||||
"");
|
||||
I_Method1(void, getUsage, IN, osg::ApplicationUsage &, usage,
|
||||
Properties::VIRTUAL,
|
||||
__void__getUsage__osg_ApplicationUsage_R1,
|
||||
|
Loading…
Reference in New Issue
Block a user