Fixed top-down preview and opengl renderer
This commit is contained in:
parent
1685efcfbe
commit
bd29ee97cf
4 changed files with 20 additions and 0 deletions
|
@ -59,6 +59,11 @@ void OpenGLRenderer::paint()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double OpenGLRenderer::getPrecision(const Vector3 &)
|
||||||
|
{
|
||||||
|
return 0.0000001;
|
||||||
|
}
|
||||||
|
|
||||||
Color OpenGLRenderer::applyMediumTraversal(Vector3, Color color)
|
Color OpenGLRenderer::applyMediumTraversal(Vector3, Color color)
|
||||||
{
|
{
|
||||||
return color;
|
return color;
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
void resize(int width, int height);
|
void resize(int width, int height);
|
||||||
void paint();
|
void paint();
|
||||||
|
|
||||||
|
virtual double getPrecision(const Vector3 &location) override;
|
||||||
virtual Color applyMediumTraversal(Vector3 location, Color color) override;
|
virtual Color applyMediumTraversal(Vector3 location, Color color) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "TerrainRenderer.h"
|
#include "TerrainRenderer.h"
|
||||||
#include "WaterRenderer.h"
|
#include "WaterRenderer.h"
|
||||||
#include "CloudsRenderer.h"
|
#include "CloudsRenderer.h"
|
||||||
|
#include "LightingManager.h"
|
||||||
|
|
||||||
SceneryTopDownPreviewRenderer::SceneryTopDownPreviewRenderer(Scenery* scenery):
|
SceneryTopDownPreviewRenderer::SceneryTopDownPreviewRenderer(Scenery* scenery):
|
||||||
scenery(scenery)
|
scenery(scenery)
|
||||||
|
@ -21,6 +22,7 @@ void SceneryTopDownPreviewRenderer::bindEvent(BasePreview* preview)
|
||||||
// TODO Translation
|
// TODO Translation
|
||||||
preview->addOsd("geolocation");
|
preview->addOsd("geolocation");
|
||||||
preview->addToggle("clouds", "Clouds", false);
|
preview->addToggle("clouds", "Clouds", false);
|
||||||
|
preview->addToggle("specularity", "Light reflection", false);
|
||||||
|
|
||||||
preview->configHdrToneMapping(true);
|
preview->configHdrToneMapping(true);
|
||||||
preview->configScaling(0.5, 200.0, 3.0, 50.0);
|
preview->configScaling(0.5, 200.0, 3.0, 50.0);
|
||||||
|
@ -35,6 +37,7 @@ void SceneryTopDownPreviewRenderer::updateEvent()
|
||||||
{
|
{
|
||||||
getScenery()->getClouds()->clear();
|
getScenery()->getClouds()->clear();
|
||||||
}
|
}
|
||||||
|
getLightingManager()->setSpecularity(specularity_enabled);
|
||||||
|
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
@ -63,6 +66,15 @@ void SceneryTopDownPreviewRenderer::toggleChangeEvent(const std::string &key, bo
|
||||||
{
|
{
|
||||||
clouds_enabled = value;
|
clouds_enabled = value;
|
||||||
}
|
}
|
||||||
|
else if (key == "specularity")
|
||||||
|
{
|
||||||
|
specularity_enabled = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double SceneryTopDownPreviewRenderer::getPrecision(const Vector3 &)
|
||||||
|
{
|
||||||
|
return 0.0000001;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 SceneryTopDownPreviewRenderer::getCameraLocation(const Vector3 &target)
|
Vector3 SceneryTopDownPreviewRenderer::getCameraLocation(const Vector3 &target)
|
||||||
|
|
|
@ -20,12 +20,14 @@ protected:
|
||||||
|
|
||||||
virtual void toggleChangeEvent(const std::string &key, bool value) override;
|
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 Vector3 getCameraLocation(const Vector3 &target) override;
|
||||||
virtual Color applyMediumTraversal(Vector3 location, Color color) override;
|
virtual Color applyMediumTraversal(Vector3 location, Color color) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Scenery* scenery;
|
Scenery* scenery;
|
||||||
bool clouds_enabled;
|
bool clouds_enabled;
|
||||||
|
bool specularity_enabled;
|
||||||
CloudsDefinition* no_clouds;
|
CloudsDefinition* no_clouds;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue