paysages3d/src/interface/modeler/quickapp/WaterModeler.cpp

29 lines
698 B
C++
Raw Normal View History

2014-08-28 13:09:47 +00:00
#include "WaterModeler.h"
#include "MainModelerWindow.h"
#include "Scenery.h"
#include "TerrainDefinition.h"
#include "FloatNode.h"
#include "Logs.h"
2014-08-28 13:09:47 +00:00
WaterModeler::WaterModeler(MainModelerWindow *main):
main(main)
{
QObject *item = main->findQmlObject("water_level");
if (item)
{
item->setProperty("value", propWaterHeight()->getValue() * 0.5 + 0.5);
2014-08-28 13:09:47 +00:00
connect(item, SIGNAL(changed(double)), this, SLOT(waterLevelChanged(double)));
}
}
void WaterModeler::waterLevelChanged(double value)
2014-08-28 13:09:47 +00:00
{
propWaterHeight()->setValue(value * 2.0 - 1.0);
}
FloatNode *WaterModeler::propWaterHeight() const
{
return main->getScenery()->getTerrain()->propWaterHeight();
2014-08-28 13:09:47 +00:00
}