Fixed top-down preview and opengl renderer

This commit is contained in:
Michaël Lemaire 2013-12-15 15:18:11 +01:00
parent 1685efcfbe
commit bd29ee97cf
4 changed files with 20 additions and 0 deletions

View file

@ -59,6 +59,11 @@ void OpenGLRenderer::paint()
}
double OpenGLRenderer::getPrecision(const Vector3 &)
{
return 0.0000001;
}
Color OpenGLRenderer::applyMediumTraversal(Vector3, Color color)
{
return color;

View file

@ -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;
};

View file

@ -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)

View file

@ -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;
};