diff --git a/src/render/opengl/OpenGLRenderer.cpp b/src/render/opengl/OpenGLRenderer.cpp index 8ca3c5b..31bbfc6 100644 --- a/src/render/opengl/OpenGLRenderer.cpp +++ b/src/render/opengl/OpenGLRenderer.cpp @@ -59,6 +59,11 @@ void OpenGLRenderer::paint() } +double OpenGLRenderer::getPrecision(const Vector3 &) +{ + return 0.0000001; +} + Color OpenGLRenderer::applyMediumTraversal(Vector3, Color color) { return color; diff --git a/src/render/opengl/OpenGLRenderer.h b/src/render/opengl/OpenGLRenderer.h index 4d377af..075b3ac 100644 --- a/src/render/opengl/OpenGLRenderer.h +++ b/src/render/opengl/OpenGLRenderer.h @@ -21,6 +21,7 @@ public: void resize(int width, int height); void paint(); + virtual double getPrecision(const Vector3 &location) override; virtual Color applyMediumTraversal(Vector3 location, Color color) override; }; diff --git a/src/render/preview/SceneryTopDownPreviewRenderer.cpp b/src/render/preview/SceneryTopDownPreviewRenderer.cpp index ed5a82a..80923ff 100644 --- a/src/render/preview/SceneryTopDownPreviewRenderer.cpp +++ b/src/render/preview/SceneryTopDownPreviewRenderer.cpp @@ -6,6 +6,7 @@ #include "TerrainRenderer.h" #include "WaterRenderer.h" #include "CloudsRenderer.h" +#include "LightingManager.h" SceneryTopDownPreviewRenderer::SceneryTopDownPreviewRenderer(Scenery* scenery): scenery(scenery) @@ -21,6 +22,7 @@ void SceneryTopDownPreviewRenderer::bindEvent(BasePreview* preview) // TODO Translation preview->addOsd("geolocation"); preview->addToggle("clouds", "Clouds", false); + preview->addToggle("specularity", "Light reflection", false); preview->configHdrToneMapping(true); preview->configScaling(0.5, 200.0, 3.0, 50.0); @@ -35,6 +37,7 @@ void SceneryTopDownPreviewRenderer::updateEvent() { getScenery()->getClouds()->clear(); } + getLightingManager()->setSpecularity(specularity_enabled); prepare(); } @@ -63,6 +66,15 @@ void SceneryTopDownPreviewRenderer::toggleChangeEvent(const std::string &key, bo { clouds_enabled = value; } + else if (key == "specularity") + { + specularity_enabled = value; + } +} + +double SceneryTopDownPreviewRenderer::getPrecision(const Vector3 &) +{ + return 0.0000001; } Vector3 SceneryTopDownPreviewRenderer::getCameraLocation(const Vector3 &target) diff --git a/src/render/preview/SceneryTopDownPreviewRenderer.h b/src/render/preview/SceneryTopDownPreviewRenderer.h index 7c47c6b..5168cae 100644 --- a/src/render/preview/SceneryTopDownPreviewRenderer.h +++ b/src/render/preview/SceneryTopDownPreviewRenderer.h @@ -20,12 +20,14 @@ protected: virtual void toggleChangeEvent(const std::string &key, bool value) override; + virtual double getPrecision(const Vector3 &location) override; virtual Vector3 getCameraLocation(const Vector3 &target) override; virtual Color applyMediumTraversal(Vector3 location, Color color) override; private: Scenery* scenery; bool clouds_enabled; + bool specularity_enabled; CloudsDefinition* no_clouds; };