diff --git a/simgear/scene/viewer/Compositor.cxx b/simgear/scene/viewer/Compositor.cxx index 8c591e9c..15188e9d 100644 --- a/simgear/scene/viewer/Compositor.cxx +++ b/simgear/scene/viewer/Compositor.cxx @@ -148,7 +148,6 @@ Compositor::Compositor(osg::View *view, new osg::Uniform("fg_CameraPositionGeod", osg::Vec3f()), new osg::Uniform("fg_NearFar", osg::Vec2f()), new osg::Uniform("fg_Planes", osg::Vec3f()), - new osg::Uniform("fg_Fcoef", 0.0f), new osg::Uniform("fg_SunDirection", osg::Vec3f()), new osg::Uniform("fg_SunDirectionWorld", osg::Vec3f()), } @@ -237,10 +236,6 @@ Compositor::update(const osg::Matrix &view_matrix, case SG_UNIFORM_SUN_DIRECTION: u->set(osg::Vec3f(sun_dir_view.x(), sun_dir_view.y(), sun_dir_view.z())); break; - case SG_UNIFORM_FCOEF: - if (zFar != 0.0) - u->set(2.0f / log2(float(zFar) + 1.0f)); - break; default: // Unknown uniform break; diff --git a/simgear/scene/viewer/Compositor.hxx b/simgear/scene/viewer/Compositor.hxx index 1706867a..fa621a91 100644 --- a/simgear/scene/viewer/Compositor.hxx +++ b/simgear/scene/viewer/Compositor.hxx @@ -59,7 +59,6 @@ public: SG_UNIFORM_CAMERA_POSITION_GEOD, SG_UNIFORM_NEAR_FAR, SG_UNIFORM_PLANES, - SG_UNIFORM_FCOEF, SG_UNIFORM_SUN_DIRECTION, SG_UNIFORM_SUN_DIRECTION_WORLD, SG_TOTAL_BUILTIN_UNIFORMS @@ -113,7 +112,7 @@ public: typedef std::array< osg::ref_ptr, SG_TOTAL_BUILTIN_UNIFORMS> BuiltinUniforms; - const BuiltinUniforms &getUniforms() const { return _uniforms; } + const BuiltinUniforms &getBuiltinUniforms() const { return _uniforms; } void addBuffer(const std::string &name, Buffer *buffer); void addPass(Pass *pass); diff --git a/simgear/scene/viewer/CompositorPass.cxx b/simgear/scene/viewer/CompositorPass.cxx index 0b047b61..c5588d65 100644 --- a/simgear/scene/viewer/CompositorPass.cxx +++ b/simgear/scene/viewer/CompositorPass.cxx @@ -451,7 +451,7 @@ public: | osg::StateAttribute::PROTECTED); osg::StateSet *ss = camera->getOrCreateStateSet(); - for (const auto &uniform : compositor->getUniforms()) + for (const auto &uniform : compositor->getBuiltinUniforms()) ss->addUniform(uniform); return pass.release(); @@ -743,6 +743,10 @@ public: osg::Camera *camera = pass->camera; camera->setAllowEventFocus(true); + const SGPropertyNode *p_lod_scale = root->getNode("lod-scale"); + if (p_lod_scale) + camera->setLODScale(p_lod_scale->getFloatValue()); + const SGPropertyNode *p_clustered = root->getNode("clustered-shading"); ClusteredShading *clustered = nullptr; if (p_clustered) { @@ -760,8 +764,7 @@ public: pass->update_callback = new SceneUpdateCallback(cubemap_face, zNear, zFar); osg::StateSet *ss = camera->getOrCreateStateSet(); - auto &uniforms = compositor->getUniforms(); - ss->addUniform(uniforms[Compositor::SG_UNIFORM_FCOEF]); + auto &uniforms = compositor->getBuiltinUniforms(); ss->addUniform(uniforms[Compositor::SG_UNIFORM_SUN_DIRECTION]); ss->addUniform(uniforms[Compositor::SG_UNIFORM_SUN_DIRECTION_WORLD]);