paysages : Added clouds option to render preview.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@539 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2013-03-11 14:15:30 +00:00 committed by ThunderK
parent 954076af69
commit a35a9c6e8a
3 changed files with 29 additions and 12 deletions

View file

@ -12,7 +12,7 @@ class PreviewRenderLandscape:public BasePreview
public:
PreviewRenderLandscape(QWidget* parent):BasePreview(parent)
{
_renderer = rendererCreate();
_renderer = sceneryCreateStandardRenderer();
_renderer->applyTextures = _applyTextures;
_renderer->getCameraLocation = _getCameraLocation;
lightingManagerDisableSpecularity(_renderer->lighting);
@ -22,10 +22,14 @@ public:
_atmosphere = (AtmosphereDefinition*)AtmosphereDefinitionClass.create();
_terrain = (TerrainDefinition*)TerrainDefinitionClass.create();
_water = (WaterDefinition*)WaterDefinitionClass.create();
_clouds = (CloudsDefinition*)CloudsDefinitionClass.create();
_renderer->customData[0] = &_textures;
_clouds_enabled = true;
addOsd(QString("geolocation"));
addToggle("clouds", tr("Clouds"), false);
configHdrToneMapping(true);
configScaling(0.5, 200.0, 3.0, 50.0);
@ -53,18 +57,26 @@ protected:
{
sceneryGetTextures(&_textures);
sceneryGetWater(_water);
WaterRendererClass.bind(_renderer, _water);
sceneryGetAtmosphere(_atmosphere);
AtmosphereRendererClass.bind(_renderer, _atmosphere);
sceneryBindRenderer(_renderer);
_renderer->atmosphere->applyAerialPerspective = _applyAerialPerspective;
sceneryGetTerrain(_terrain);
TerrainRendererClass.bind(_renderer, _terrain);
if (!_clouds_enabled)
{
CloudsRendererClass.bind(_renderer, _clouds);
}
}
void toggleChangeEvent(QString key, bool value)
{
if (key == "clouds")
{
_clouds_enabled = value;
redraw();
}
}
private:
Renderer* _renderer;
bool _clouds_enabled;
CloudsDefinition* _clouds;
TerrainDefinition* _terrain;
WaterDefinition *_water;
TexturesDefinition _textures;

View file

@ -232,11 +232,15 @@ Renderer* sceneryCreateStandardRenderer()
result->unprojectPoint = _unprojectPoint;
result->getPrecision = _getPrecision;
AtmosphereRendererClass.bind(result, _atmosphere);
TerrainRendererClass.bind(result, _terrain);
CloudsRendererClass.bind(result, _clouds);
WaterRendererClass.bind(result, _water);
sceneryBindRenderer(result);
return result;
}
void sceneryBindRenderer(Renderer* renderer)
{
AtmosphereRendererClass.bind(renderer, _atmosphere);
TerrainRendererClass.bind(renderer, _terrain);
CloudsRendererClass.bind(renderer, _clouds);
WaterRendererClass.bind(renderer, _water);
}

View file

@ -52,6 +52,7 @@ void scenerySetWater(WaterDefinition* water);
void sceneryGetWater(WaterDefinition* water);
Renderer* sceneryCreateStandardRenderer();
void sceneryBindRenderer(Renderer* renderer);
void sceneryRenderFirstPass(Renderer* renderer);
#ifdef __cplusplus