From c3de8851f88181046f8b72cfffb43ac3c62ecca3 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Thu, 2 Aug 2012 22:59:49 +0200 Subject: [PATCH] Fix incorrectly hardcoded effect in last Rembrandt stage --- src/Viewer/renderer.cxx | 10 +++++----- src/Viewer/renderer.hxx | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Viewer/renderer.cxx b/src/Viewer/renderer.cxx index 3b705f019..3def71336 100644 --- a/src/Viewer/renderer.cxx +++ b/src/Viewer/renderer.cxx @@ -1187,18 +1187,18 @@ FGRenderer::buildDeferredFullscreenCamera( flightgear::CameraInfo* info, osg::Gr } void -FGRenderer::buildDeferredDisplayCamera( osg::Camera* camera, flightgear::CameraInfo* info, const std::string& name, osg::GraphicsContext* gc ) +FGRenderer::buildDeferredDisplayCamera( osg::Camera* camera, flightgear::CameraInfo* info, const FGRenderingPipeline::Stage* stage, osg::GraphicsContext* gc ) { camera->setName( "DisplayC" ); - camera->setCullCallback( new FGDeferredRenderingCameraCullCallback( name, info ) ); + camera->setCullCallback( new FGDeferredRenderingCameraCullCallback( stage->name, info ) ); camera->setReferenceFrame(Transform::ABSOLUTE_RF); camera->setAllowEventFocus(false); osg::Geometry* g = osg::createTexturedQuadGeometry( osg::Vec3(-1.,-1.,0.), osg::Vec3(2.,0.,0.), osg::Vec3(0.,2.,0.) ); g->setUseDisplayList(false); //DEBUG simgear::EffectGeode* eg = new simgear::EffectGeode; - simgear::Effect* effect = simgear::makeEffect("Effects/display", true); + simgear::Effect* effect = simgear::makeEffect(stage->effect, true); if (!effect) { - SG_LOG(SG_VIEW, SG_ALERT, "Effects/display not found"); + SG_LOG(SG_VIEW, SG_ALERT, stage->effect + " not found"); return; } eg->setEffect(effect); @@ -1237,7 +1237,7 @@ FGRenderer::buildStage(CameraInfo* info, camera = buildDeferredFullscreenCamera(info, gc, stage); else if (stage->type == "display") { camera = mainCamera; - buildDeferredDisplayCamera(camera, info, stage->name, gc); + buildDeferredDisplayCamera(camera, info, stage, gc); } else throw sg_exception("Stage type is not supported"); diff --git a/src/Viewer/renderer.hxx b/src/Viewer/renderer.hxx index 75d5c16f7..2ff7c8252 100644 --- a/src/Viewer/renderer.hxx +++ b/src/Viewer/renderer.hxx @@ -152,7 +152,7 @@ protected: osg::Camera* buildDeferredLightingCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc, const FGRenderingPipeline::Stage* stage ); osg::Camera* buildDeferredFullscreenCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc, const FGRenderingPipeline::Stage* stage ); osg::Camera* buildDeferredFullscreenCamera( flightgear::CameraInfo* info, const FGRenderingPipeline::Pass* pass ); - void buildDeferredDisplayCamera( osg::Camera* camera, flightgear::CameraInfo* info, const std::string& name, osg::GraphicsContext* gc ); + void buildDeferredDisplayCamera( osg::Camera* camera, flightgear::CameraInfo* info, const FGRenderingPipeline::Stage* stage, osg::GraphicsContext* gc ); void updateShadowCascade(const flightgear::CameraInfo* info, osg::Camera* camera, osg::Group* grp, int idx, double left, double right, double bottom, double top, double zNear, double f1, double f2); osg::Vec3 getSunDirection() const;