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:
parent
954076af69
commit
a35a9c6e8a
3 changed files with 29 additions and 12 deletions
|
@ -12,7 +12,7 @@ class PreviewRenderLandscape:public BasePreview
|
||||||
public:
|
public:
|
||||||
PreviewRenderLandscape(QWidget* parent):BasePreview(parent)
|
PreviewRenderLandscape(QWidget* parent):BasePreview(parent)
|
||||||
{
|
{
|
||||||
_renderer = rendererCreate();
|
_renderer = sceneryCreateStandardRenderer();
|
||||||
_renderer->applyTextures = _applyTextures;
|
_renderer->applyTextures = _applyTextures;
|
||||||
_renderer->getCameraLocation = _getCameraLocation;
|
_renderer->getCameraLocation = _getCameraLocation;
|
||||||
lightingManagerDisableSpecularity(_renderer->lighting);
|
lightingManagerDisableSpecularity(_renderer->lighting);
|
||||||
|
@ -22,10 +22,14 @@ public:
|
||||||
_atmosphere = (AtmosphereDefinition*)AtmosphereDefinitionClass.create();
|
_atmosphere = (AtmosphereDefinition*)AtmosphereDefinitionClass.create();
|
||||||
_terrain = (TerrainDefinition*)TerrainDefinitionClass.create();
|
_terrain = (TerrainDefinition*)TerrainDefinitionClass.create();
|
||||||
_water = (WaterDefinition*)WaterDefinitionClass.create();
|
_water = (WaterDefinition*)WaterDefinitionClass.create();
|
||||||
|
_clouds = (CloudsDefinition*)CloudsDefinitionClass.create();
|
||||||
|
|
||||||
_renderer->customData[0] = &_textures;
|
_renderer->customData[0] = &_textures;
|
||||||
|
|
||||||
|
_clouds_enabled = true;
|
||||||
|
|
||||||
addOsd(QString("geolocation"));
|
addOsd(QString("geolocation"));
|
||||||
|
addToggle("clouds", tr("Clouds"), false);
|
||||||
|
|
||||||
configHdrToneMapping(true);
|
configHdrToneMapping(true);
|
||||||
configScaling(0.5, 200.0, 3.0, 50.0);
|
configScaling(0.5, 200.0, 3.0, 50.0);
|
||||||
|
@ -53,18 +57,26 @@ protected:
|
||||||
{
|
{
|
||||||
sceneryGetTextures(&_textures);
|
sceneryGetTextures(&_textures);
|
||||||
|
|
||||||
sceneryGetWater(_water);
|
sceneryBindRenderer(_renderer);
|
||||||
WaterRendererClass.bind(_renderer, _water);
|
|
||||||
|
|
||||||
sceneryGetAtmosphere(_atmosphere);
|
|
||||||
AtmosphereRendererClass.bind(_renderer, _atmosphere);
|
|
||||||
_renderer->atmosphere->applyAerialPerspective = _applyAerialPerspective;
|
_renderer->atmosphere->applyAerialPerspective = _applyAerialPerspective;
|
||||||
|
|
||||||
sceneryGetTerrain(_terrain);
|
if (!_clouds_enabled)
|
||||||
TerrainRendererClass.bind(_renderer, _terrain);
|
{
|
||||||
|
CloudsRendererClass.bind(_renderer, _clouds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void toggleChangeEvent(QString key, bool value)
|
||||||
|
{
|
||||||
|
if (key == "clouds")
|
||||||
|
{
|
||||||
|
_clouds_enabled = value;
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Renderer* _renderer;
|
Renderer* _renderer;
|
||||||
|
bool _clouds_enabled;
|
||||||
|
CloudsDefinition* _clouds;
|
||||||
TerrainDefinition* _terrain;
|
TerrainDefinition* _terrain;
|
||||||
WaterDefinition *_water;
|
WaterDefinition *_water;
|
||||||
TexturesDefinition _textures;
|
TexturesDefinition _textures;
|
||||||
|
|
|
@ -232,11 +232,15 @@ Renderer* sceneryCreateStandardRenderer()
|
||||||
result->unprojectPoint = _unprojectPoint;
|
result->unprojectPoint = _unprojectPoint;
|
||||||
result->getPrecision = _getPrecision;
|
result->getPrecision = _getPrecision;
|
||||||
|
|
||||||
AtmosphereRendererClass.bind(result, _atmosphere);
|
sceneryBindRenderer(result);
|
||||||
TerrainRendererClass.bind(result, _terrain);
|
|
||||||
CloudsRendererClass.bind(result, _clouds);
|
|
||||||
WaterRendererClass.bind(result, _water);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sceneryBindRenderer(Renderer* renderer)
|
||||||
|
{
|
||||||
|
AtmosphereRendererClass.bind(renderer, _atmosphere);
|
||||||
|
TerrainRendererClass.bind(renderer, _terrain);
|
||||||
|
CloudsRendererClass.bind(renderer, _clouds);
|
||||||
|
WaterRendererClass.bind(renderer, _water);
|
||||||
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ void scenerySetWater(WaterDefinition* water);
|
||||||
void sceneryGetWater(WaterDefinition* water);
|
void sceneryGetWater(WaterDefinition* water);
|
||||||
|
|
||||||
Renderer* sceneryCreateStandardRenderer();
|
Renderer* sceneryCreateStandardRenderer();
|
||||||
|
void sceneryBindRenderer(Renderer* renderer);
|
||||||
void sceneryRenderFirstPass(Renderer* renderer);
|
void sceneryRenderFirstPass(Renderer* renderer);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in a new issue