Fixed water previews
This commit is contained in:
parent
97a950947a
commit
7cda1efa54
5 changed files with 35 additions and 36 deletions
|
@ -63,6 +63,7 @@ FormWater::~FormWater()
|
||||||
|
|
||||||
void FormWater::revertConfig()
|
void FormWater::revertConfig()
|
||||||
{
|
{
|
||||||
|
previewCoverageRenderer->setTerrain(DesktopScenery::getCurrent()->getTerrain());
|
||||||
DesktopScenery::getCurrent()->getWater(_definition);
|
DesktopScenery::getCurrent()->getWater(_definition);
|
||||||
BaseForm::revertConfig();
|
BaseForm::revertConfig();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,36 +5,7 @@
|
||||||
#include "WaterDefinition.h"
|
#include "WaterDefinition.h"
|
||||||
#include "CameraDefinition.h"
|
#include "CameraDefinition.h"
|
||||||
#include "WaterRenderer.h"
|
#include "WaterRenderer.h"
|
||||||
|
#include "LightComponent.h"
|
||||||
/*static double _getWaterHeight(Renderer*)
|
|
||||||
{
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _getLightingStatus(Renderer* renderer, LightStatus* status, Vector3, int)
|
|
||||||
{
|
|
||||||
LightDefinition light;
|
|
||||||
bool lighting = *(bool*)renderer->customData[0];
|
|
||||||
light.color = COLOR_WHITE;
|
|
||||||
light.direction.x = 0.0;
|
|
||||||
light.direction.y = -0.4794;
|
|
||||||
light.direction.z = -0.8776;
|
|
||||||
light.altered = 0;
|
|
||||||
if (lighting)
|
|
||||||
{
|
|
||||||
light.reflection = 1.0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
light.reflection = 0.0;
|
|
||||||
}
|
|
||||||
lightingPushLight(status, &light);
|
|
||||||
}
|
|
||||||
|
|
||||||
static double _getPrecision(Renderer*, Vector3)
|
|
||||||
{
|
|
||||||
return 0.000001;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
WaterAspectPreviewRenderer::WaterAspectPreviewRenderer(WaterDefinition* definition):
|
WaterAspectPreviewRenderer::WaterAspectPreviewRenderer(WaterDefinition* definition):
|
||||||
definition(definition)
|
definition(definition)
|
||||||
|
@ -64,9 +35,23 @@ void WaterAspectPreviewRenderer::updateEvent()
|
||||||
getScenery()->getCamera()->setTarget(VECTOR_ZERO);
|
getScenery()->getCamera()->setTarget(VECTOR_ZERO);
|
||||||
prepare();
|
prepare();
|
||||||
|
|
||||||
//terrain->getWaterHeight = _getWaterHeight;
|
LightComponent light;
|
||||||
//atmosphere->getLightingStatus = _getLightingStatus;
|
std::vector<LightComponent> lights;
|
||||||
//getPrecision = _getPrecision;
|
light.color = COLOR_WHITE;
|
||||||
|
light.direction.x = 0.0;
|
||||||
|
light.direction.y = -0.4794;
|
||||||
|
light.direction.z = -0.8776;
|
||||||
|
light.altered = 0;
|
||||||
|
if (lighting)
|
||||||
|
{
|
||||||
|
light.reflection = 1.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
light.reflection = 0.0;
|
||||||
|
}
|
||||||
|
lights.push_back(light);
|
||||||
|
disableAtmosphere(lights);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterAspectPreviewRenderer::cameraEvent(double, double, double scaling)
|
void WaterAspectPreviewRenderer::cameraEvent(double, double, double scaling)
|
||||||
|
@ -116,6 +101,11 @@ void WaterAspectPreviewRenderer::choiceChangeEvent(const std::string &key, int p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double WaterAspectPreviewRenderer::getPrecision(const Vector3 &location)
|
||||||
|
{
|
||||||
|
return 0.000001;
|
||||||
|
}
|
||||||
|
|
||||||
RayCastingResult WaterAspectPreviewRenderer::rayWalking(const Vector3 &location, const Vector3 &direction, int, int, int, int)
|
RayCastingResult WaterAspectPreviewRenderer::rayWalking(const Vector3 &location, const Vector3 &direction, int, int, int, int)
|
||||||
{
|
{
|
||||||
RayCastingResult result;
|
RayCastingResult result;
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
virtual void toggleChangeEvent(const std::string &key, bool value) override;
|
virtual void toggleChangeEvent(const std::string &key, bool value) override;
|
||||||
virtual void choiceChangeEvent(const std::string &key, int position) override;
|
virtual void choiceChangeEvent(const std::string &key, int position) override;
|
||||||
|
|
||||||
|
virtual double getPrecision(const Vector3 &location) override;
|
||||||
virtual RayCastingResult rayWalking(const Vector3 &location, const Vector3 &direction, int terrain, int water, int sky, int clouds) override;
|
virtual RayCastingResult rayWalking(const Vector3 &location, const Vector3 &direction, int terrain, int water, int sky, int clouds) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -16,6 +16,12 @@ WaterCoveragePreviewRenderer::~WaterCoveragePreviewRenderer()
|
||||||
delete TerrainShapePreviewRenderer::_terrain;
|
delete TerrainShapePreviewRenderer::_terrain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WaterCoveragePreviewRenderer::setTerrain(TerrainDefinition *terrain)
|
||||||
|
{
|
||||||
|
terrain->copy(TerrainShapePreviewRenderer::_terrain);
|
||||||
|
getScenery()->setTerrain(terrain);
|
||||||
|
}
|
||||||
|
|
||||||
void WaterCoveragePreviewRenderer::bindEvent(BasePreview* preview)
|
void WaterCoveragePreviewRenderer::bindEvent(BasePreview* preview)
|
||||||
{
|
{
|
||||||
TerrainShapePreviewRenderer::bindEvent(preview);
|
TerrainShapePreviewRenderer::bindEvent(preview);
|
||||||
|
@ -36,10 +42,9 @@ void WaterCoveragePreviewRenderer::toggleChangeEvent(const std::string &key, boo
|
||||||
|
|
||||||
void WaterCoveragePreviewRenderer::updateEvent()
|
void WaterCoveragePreviewRenderer::updateEvent()
|
||||||
{
|
{
|
||||||
//RenderingScenery::getCurrent()->getTerrain(_terrain);
|
|
||||||
TerrainShapePreviewRenderer::updateEvent();
|
|
||||||
|
|
||||||
getScenery()->setWater(definition);
|
getScenery()->setWater(definition);
|
||||||
|
|
||||||
|
TerrainShapePreviewRenderer::updateEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
Color WaterCoveragePreviewRenderer::getWaterColor(double x, double y, double)
|
Color WaterCoveragePreviewRenderer::getWaterColor(double x, double y, double)
|
||||||
|
|
|
@ -14,6 +14,8 @@ public:
|
||||||
WaterCoveragePreviewRenderer(WaterDefinition* definition);
|
WaterCoveragePreviewRenderer(WaterDefinition* definition);
|
||||||
virtual ~WaterCoveragePreviewRenderer();
|
virtual ~WaterCoveragePreviewRenderer();
|
||||||
|
|
||||||
|
void setTerrain(TerrainDefinition* terrain);
|
||||||
|
|
||||||
virtual void bindEvent(BasePreview* preview) override;
|
virtual void bindEvent(BasePreview* preview) override;
|
||||||
virtual void updateEvent() override;
|
virtual void updateEvent() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue