Fixed top-down render preview

This commit is contained in:
Michaël Lemaire 2013-12-15 14:50:43 +01:00
parent a814a530de
commit 02bf40c3c6
2 changed files with 22 additions and 20 deletions

View file

@ -5,21 +5,7 @@
#include "Scenery.h"
#include "TerrainRenderer.h"
#include "WaterRenderer.h"
/*static Vector3 _getCameraLocation(Renderer*, Vector3 location)
{
return v3Add(location, v3Scale(VECTOR_UP, 50.0));
}
static AtmosphereResult _applyAerialPerspective(Renderer*, Vector3, Color base)
{
AtmosphereResult result;
atmosphereInitResult(&result);
result.base = base;
result.final = base;
atmosphereUpdateResult(&result);
return result;
}*/
#include "CloudsRenderer.h"
SceneryTopDownPreviewRenderer::SceneryTopDownPreviewRenderer(Scenery* scenery):
scenery(scenery)
@ -39,7 +25,6 @@ void SceneryTopDownPreviewRenderer::bindEvent(BasePreview* preview)
preview->configHdrToneMapping(true);
preview->configScaling(0.5, 200.0, 3.0, 50.0);
preview->configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0);
}
void SceneryTopDownPreviewRenderer::updateEvent()
@ -52,10 +37,6 @@ void SceneryTopDownPreviewRenderer::updateEvent()
}
prepare();
/*getCameraLocation = _getCameraLocation;
lightingManagerDisableSpecularity(lighting);
atmosphere->applyAerialPerspective = _applyAerialPerspective;*/
}
Color SceneryTopDownPreviewRenderer::getColor2D(double x, double y, double scaling)
@ -84,3 +65,20 @@ void SceneryTopDownPreviewRenderer::toggleChangeEvent(const std::string &key, bo
}
}
Vector3 SceneryTopDownPreviewRenderer::getCameraLocation(const Vector3 &target)
{
return target.add(VECTOR_UP.scale(50.0));
}
Color SceneryTopDownPreviewRenderer::applyMediumTraversal(Vector3 location, Color color)
{
if (clouds_enabled)
{
return getCloudsRenderer()->getColor(getCameraLocation(location), location, color);
}
else
{
return color;
}
}

View file

@ -17,8 +17,12 @@ protected:
virtual void bindEvent(BasePreview* preview) override;
virtual void updateEvent() override;
virtual Color getColor2D(double x, double y, double scaling) override;
virtual void toggleChangeEvent(const std::string &key, bool value) override;
virtual Vector3 getCameraLocation(const Vector3 &target) override;
virtual Color applyMediumTraversal(Vector3 location, Color color) override;
private:
Scenery* scenery;
bool clouds_enabled;