Added FrameStats support into osgProducer lib, and removed them from the
osgproducer demo. Removed the producer config files osgproducer demo. Added a search the osgDB::DataFilePath for the producer config file.
This commit is contained in:
@@ -49,11 +49,13 @@ class OSGPRODUCER_EXPORT Viewer : public CameraGroup, public osgGA::GUIActionAda
|
||||
STATE_MANIPULATOR = 8,
|
||||
HEAD_LIGHT_SOURCE = 16,
|
||||
SKY_LIGHT_SOURCE = 32,
|
||||
STATS_MANIPULATOR = 64,
|
||||
STANDARD_SETTINGS = TRACKBALL_MANIPULATOR|
|
||||
DRIVE_MANIPULATOR |
|
||||
FLIGHT_MANIPULATOR |
|
||||
STATE_MANIPULATOR |
|
||||
HEAD_LIGHT_SOURCE
|
||||
HEAD_LIGHT_SOURCE |
|
||||
STATS_MANIPULATOR
|
||||
};
|
||||
|
||||
void setUpViewer(unsigned int options=STANDARD_SETTINGS);
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
|
||||
#include <osgProducer/Viewer>
|
||||
|
||||
#include "FrameStatsHandler"
|
||||
#include "StatsEventHandler"
|
||||
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
@@ -66,11 +63,6 @@ int main( int argc, char **argv )
|
||||
// set up the value with sensible defaults.
|
||||
viewer->setUpViewer();
|
||||
|
||||
Producer::FrameStatsHandler* fsh = new Producer::FrameStatsHandler;
|
||||
viewer->setStatsHandler(fsh);
|
||||
viewer->getCamera(0)->addPostDrawCallback(fsh);
|
||||
|
||||
|
||||
if( !pathfile.empty() ) {
|
||||
osg::ref_ptr<osgGA::AnimationPathManipulator> apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||
if( apm.valid() && apm->valid() )
|
||||
@@ -83,13 +75,6 @@ int main( int argc, char **argv )
|
||||
// set the scene to render
|
||||
viewer->setSceneData(loadedModel.get());
|
||||
|
||||
// set up the pthread stack size to large enough to run into problems.
|
||||
viewer->setStackSize( 20*1024*1024);
|
||||
|
||||
// add the stats event handler to handler keyboard events for
|
||||
// setting set block on vsync, instrumentation etc.
|
||||
viewer->getEventHandlerList().push_back(new StatsEventHandler(viewer));
|
||||
|
||||
// create the windows and run the threads.
|
||||
viewer->realize(Producer::CameraGroup::ThreadPerCamera);
|
||||
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
//#define SINGLE_PIPE
|
||||
#define ASSYMETRICAL_FRUSTUM
|
||||
|
||||
|
||||
Camera "Camera 1"
|
||||
{
|
||||
RenderSurface "Window 1"
|
||||
{
|
||||
Visual { VisualID 0x172 };
|
||||
#ifdef SINGLE_PIPE
|
||||
Screen 0;
|
||||
WindowRectangle 0 0 426 512;
|
||||
#else
|
||||
Screen 2;
|
||||
#endif
|
||||
Border off;
|
||||
};
|
||||
Lens {
|
||||
Frustum -0.55228475 0.55228475 -0.41421356 0.41421356 1 1000.0;
|
||||
};
|
||||
Offset {
|
||||
#ifdef ASSYMETRICAL_FRUSTUM
|
||||
Shear 1.5 0.0;
|
||||
#else
|
||||
Rotate -90.0 1 0 0;
|
||||
Rotate -45.0 0 0 1;
|
||||
Rotate 90.0 1 0 0;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
Camera "Camera 2"
|
||||
{
|
||||
RenderSurface "Window 2"
|
||||
{
|
||||
Visual { VisualID 0x74 };
|
||||
Screen 0;
|
||||
#ifdef SINGLE_PIPE
|
||||
WindowRectangle 426 0 426 512;
|
||||
#endif
|
||||
Border off;
|
||||
};
|
||||
Lens {
|
||||
Frustum -0.55228475 0.55228475 -0.41421356 0.41421356 1 1000.0;
|
||||
};
|
||||
}
|
||||
|
||||
Camera "Camera 3"
|
||||
{
|
||||
RenderSurface "Window 3"
|
||||
{
|
||||
Visual { VisualID 0xF3 };
|
||||
#ifdef SINGLE_PIPE
|
||||
Screen 0;
|
||||
WindowRectangle 852 0 426 512;
|
||||
#else
|
||||
Screen 1;
|
||||
#endif
|
||||
Border off;
|
||||
};
|
||||
Lens {
|
||||
Frustum -0.55228475 0.55228475 -0.41421356 0.41421356 1 1000.0;
|
||||
};
|
||||
Offset {
|
||||
#ifdef ASSYMETRICAL_FRUSTUM
|
||||
Shear -1.5 0.0;
|
||||
#else
|
||||
Rotate -90.0 1 0 0;
|
||||
Rotate 45.0 0 0 1;
|
||||
Rotate 90.0 1 0 0;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
InputArea
|
||||
{
|
||||
RenderSurface "Window 1" : -2.5 -0.5 -1.0 1.0;
|
||||
RenderSurface "Window 2" : -1.0 1.0 -1.0 1.0;
|
||||
RenderSurface "Window 3" : 0.5 2.5 -1.0 1.0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/*#define SINGLE_PIPE */
|
||||
#define ASSYMETRICAL_FRUSTUM
|
||||
|
||||
Camera "Camera 1"
|
||||
{
|
||||
RenderSurface "Window 1"
|
||||
{
|
||||
Visual { SetSimple };
|
||||
Screen 0;
|
||||
#ifdef SINGLE_PIPE
|
||||
WindowRectangle 0 0 426 512;
|
||||
#else
|
||||
#endif
|
||||
Border off;
|
||||
};
|
||||
Lens {
|
||||
Frustum -0.55228475 0.55228475 -0.41421356 0.41421356 1 1000.0;
|
||||
};
|
||||
Offset {
|
||||
#ifdef ASSYMETRICAL_FRUSTUM
|
||||
Shear 1.0 0.0;
|
||||
#else
|
||||
Rotate -90.0 1 0 0;
|
||||
Rotate -22.5 0 0 1;
|
||||
Rotate 90.0 1 0 0;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
Camera "Camera 2"
|
||||
{
|
||||
RenderSurface "Window 2"
|
||||
{
|
||||
Visual { SetSimple };
|
||||
#ifdef SINGLE_PIPE
|
||||
Screen 0;
|
||||
WindowRectangle 426 0 426 512;
|
||||
#else
|
||||
Screen 1;
|
||||
#endif
|
||||
Border off;
|
||||
};
|
||||
Lens {
|
||||
Frustum -0.55228475 0.55228475 -0.41421356 0.41421356 1 1000.0;
|
||||
};
|
||||
|
||||
Offset {
|
||||
#ifdef ASSYMETRICAL_FRUSTUM
|
||||
Shear -1.0 0.0;
|
||||
#else
|
||||
Rotate -90.0 1 0 0;
|
||||
Rotate 22.5 0 0 1;
|
||||
Rotate 90.0 1 0 0;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
InputArea
|
||||
{
|
||||
RenderSurface "Window 1" : -1.0 0.0 0.0 1.0;
|
||||
RenderSurface "Window 2" : 0.0 1.0 0.0 1.0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
|
||||
Camera "Camera 1"
|
||||
{
|
||||
RenderSurface "Pipe 0"
|
||||
{
|
||||
Visual { SetSimple };
|
||||
Screen 0;
|
||||
Border off;
|
||||
WindowRect 0 0 640 480;
|
||||
};
|
||||
Lens {
|
||||
Frustum -0.55228475 0.55228475 -0.41421356 0.41421356 1 1000.0;
|
||||
};
|
||||
Offset {
|
||||
Shear 0.8 0.0;
|
||||
};
|
||||
}
|
||||
|
||||
Camera "Camera 2"
|
||||
{
|
||||
RenderSurface "Pipe 1"
|
||||
{
|
||||
Visual { SetSimple };
|
||||
Screen 0;
|
||||
Border off;
|
||||
WindowRect 640 0 640 480;
|
||||
};
|
||||
Lens {
|
||||
Frustum -0.55228475 0.55228475 -0.41421356 0.41421356 1 1000.0;
|
||||
};
|
||||
Offset {
|
||||
Shear -0.8 0.0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,18 @@
|
||||
//as published by the Free Software Foundation.
|
||||
|
||||
#include <osgProducer/CameraGroup>
|
||||
#include <osgDB/FileUtils>
|
||||
|
||||
using namespace osgProducer;
|
||||
|
||||
std::string findCameraConfigFile(const std::string& configFile)
|
||||
{
|
||||
std::string foundFile = osgDB::findDataFile(configFile);
|
||||
if (foundFile.empty()) return "";
|
||||
else return foundFile;
|
||||
}
|
||||
|
||||
|
||||
CameraGroup::CameraGroup() : Producer::CameraGroup()
|
||||
{
|
||||
_init();
|
||||
@@ -16,7 +25,7 @@ CameraGroup::CameraGroup(Producer::CameraConfig *cfg): Producer::CameraGroup(cfg
|
||||
_init();
|
||||
}
|
||||
|
||||
CameraGroup::CameraGroup(const std::string& configFile) : Producer::CameraGroup(configFile)
|
||||
CameraGroup::CameraGroup(const std::string& configFile) : Producer::CameraGroup(findCameraConfigFile(configFile))
|
||||
{
|
||||
_init();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include <osgProducer/Viewer>
|
||||
#include <osgProducer/FrameStatsHandler>
|
||||
#include <osgProducer/StatsEventHandler>
|
||||
|
||||
#include <osg/LightSource>
|
||||
|
||||
@@ -103,6 +105,18 @@ void Viewer::setUpViewer(unsigned int options)
|
||||
_eventHandlerList.push_back(statesetManipulator.get());
|
||||
}
|
||||
|
||||
if (options&STATS_MANIPULATOR)
|
||||
{
|
||||
// register the drawing of stats to pipe 0.
|
||||
Producer::FrameStatsHandler* fsh = new Producer::FrameStatsHandler;
|
||||
setStatsHandler(fsh);
|
||||
getCamera(0)->addPostDrawCallback(fsh);
|
||||
|
||||
// register the event handler for stats.
|
||||
getEventHandlerList().push_back(new StatsEventHandler(this));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int Viewer::addCameraManipulator(osgGA::CameraManipulator* cm)
|
||||
|
||||
Reference in New Issue
Block a user