1
0
Fork 0

Choose renderer from /sim/rendering/rembrandt property

This commit is contained in:
Frederic Bouvier 2012-03-11 15:50:18 +01:00
parent 1a3f69723b
commit 94e3ae4c67
2 changed files with 49 additions and 1 deletions

View file

@ -439,6 +439,7 @@ FGRenderer::splashinit( void ) {
void
FGRenderer::init( void )
{
_classicalRenderer = !fgGetBool("/sim/rendering/rembrandt", false);
_scenery_loaded = fgGetNode("/sim/sceneryloaded", true);
_scenery_override = fgGetNode("/sim/sceneryloaded-override", true);
_panel_hotspots = fgGetNode("/sim/panel-hotspots", true);
@ -527,10 +528,23 @@ void installCullVisitor(Camera* camera)
}
}
flightgear::CameraInfo* FGRenderer::buildRenderingPipeline(flightgear::CameraGroup* cgroup, unsigned flags, Camera* camera,
flightgear::CameraInfo*
FGRenderer::buildRenderingPipeline(flightgear::CameraGroup* cgroup, unsigned flags, Camera* camera,
const Matrix& view,
const Matrix& projection,
bool useMasterSceneData)
{
if (_classicalRenderer || (flags & (CameraGroup::GUI | CameraGroup::ORTHO)))
return buildClassicalPipeline( cgroup, flags, camera, view, projection, useMasterSceneData );
else
return buildDeferredPipeline( cgroup, flags, camera, view, projection );
}
flightgear::CameraInfo*
FGRenderer::buildClassicalPipeline(flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
const osg::Matrix& view,
const osg::Matrix& projection,
bool useMasterSceneData)
{
CameraInfo* info = new CameraInfo(flags);
// The camera group will always update the camera
@ -576,6 +590,26 @@ flightgear::CameraInfo* FGRenderer::buildRenderingPipeline(flightgear::CameraGro
return info;
}
flightgear::CameraInfo*
FGRenderer::buildDeferredPipeline(flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
const osg::Matrix& view,
const osg::Matrix& projection)
{
CameraInfo* info = new CameraInfo(flags);
// The camera group will always update the camera
camera->setReferenceFrame(Transform::ABSOLUTE_RF);
Camera* farCamera = 0;
cgroup->getViewer()->addSlave(camera, projection, view, false);
installCullVisitor(camera);
info->camera = camera;
info->slaveIndex = cgroup->getViewer()->getNumSlaves() - 1;
camera->setRenderOrder(Camera::POST_RENDER, info->slaveIndex);
cgroup->addCamera(info);
return info;
}
void
FGRenderer::setupView( void )
{

View file

@ -89,6 +89,19 @@ public:
const osg::Matrix& projection,
bool useMasterSceneData);
/**
*/
flightgear::CameraInfo* buildClassicalPipeline(flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
const osg::Matrix& view,
const osg::Matrix& projection,
bool useMasterSceneData);
/**
*/
flightgear::CameraInfo* buildDeferredPipeline(flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
const osg::Matrix& view,
const osg::Matrix& projection);
SGSky* getSky() const { return _sky; }
/**
@ -108,6 +121,7 @@ protected:
SGPropertyNode_ptr _virtual_cockpit;
SGTimeStamp _splash_time;
SGSky* _sky;
bool _classicalRenderer;
};
bool fgDumpSceneGraphToFile(const char* filename);