Hi WeSee, I have just done a review of the changes but won't merge for now as I'm not clear on that actual need for this particular bit of functionality change. It may be that what you are looking for could be solved in a another way or perhaps it shows a wider flaw in the StatsHandler that should be addressed in a another way.
In particular I am curious about the nature of your pre-render Cameras. FYI, The StatsHandler just collects stats on the Camera's that the Viewer, it doesn't differentiate between the types of Camera's assigned to the Viewer - they could be pre-rendering Camera, post-rendering Camera or just default Camera rendering directly to the GraphicsWindow(s). Given this I can presume you must be interested in the Cameras embedded into the scene graph rather than Camera's assigned to the Viewer. Robert. On 1 December 2015 at 16:39, We See <[email protected]> wrote: > Hi Robert, > > The StatsHandler is actually not able to show the time consumed for > prerender-cameras. This submission contains an extension for StatsHandler, > which makes it possible to show statistics about prerender-cameras (and other > cameras). > > The following changes are made by this patch: > > 1.) a new virtual method getStatCameras() is introduced in StatsHandler.cpp > (and declared in ViewerEventHandlers). It makes it possible in an inherited > StatsHandler-class to add prerender-cameras. > > 2.) Because prerender-cameras are not assigned to a view, the method > updateSceneView() in Renderer.cpp is extended to get the starttick from > EventQueue > > Here an example, how to show statistics of a prerender-cam: > > Code: > > class MyStatsHandler : public osgViewer::StatsHandler > { > public: > > MyStatsHandler() {}; > virtual ~MyStatsHandler() {}; > > virtual void getStatCameras(osgViewer::ViewerBase::Cameras& cameras, > osgViewer::ViewerBase* viewer); > > static void addCamera(osg::Camera* camera); > static void removeCamera(osg::Camera* camera); > > typedef std::vector<osg::Camera*> CamerasType; > static CamerasType _prerenderCameras; > } > > void CoDisiStatsHandler::addCamera(osg::Camera* camera) > { > _prerenderCameras.push_back(camera); > } > > void MyStatsHandler::removeCamera(osg::Camera* camera) > { > for(CamerasType::iterator itr = _prerenderCameras.begin(); > itr != _prerenderCameras.end(); > ++itr) > { > if ((*itr) == camera) > { > _prerenderCameras.erase(itr); > break; > } > } > } > > void MyStatsHandler::getStatCameras(osgViewer::ViewerBase::Cameras& cameras, > osgViewer::ViewerBase* viewer) > { > viewer->getCameras(cameras); > > for(CamerasType::iterator itr = _prerenderCameras.begin(); > itr != _prerenderCameras.end(); > ++itr) > { > cameras.push_back(*itr); > } > } > > > > > The code is based on OSG-3.4.0 > > Thank you for merging this! > > Prost, > WeSee > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=65810#65810 > > > > > Attachments: > http://forum.openscenegraph.org//files/stathandler_extension_669.zip > > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
