From 237040864d5afb6e651a4b7447b926315055e151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Thu, 6 Dec 2012 14:04:04 +0000 Subject: [PATCH] paysages : Small fix. git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@472 b1fd45b6-86a6-48da-8261-f70d1f35bdcc --- gui_qt/baseformlayer.cpp | 22 +++++++++++----------- gui_qt/baseformlayer.h | 6 +++--- gui_qt/formclouds.cpp | 26 +++++++++++++------------- gui_qt/formclouds.h | 4 ++-- gui_qt/formterraincanvas.cpp | 20 ++++++++++---------- gui_qt/formterraincanvas.h | 6 +++--- gui_qt/formtextures.cpp | 24 ++++++++++++------------ gui_qt/formtextures.h | 4 ++-- 8 files changed, 56 insertions(+), 56 deletions(-) diff --git a/gui_qt/baseformlayer.cpp b/gui_qt/baseformlayer.cpp index cff43f5..b88ed28 100644 --- a/gui_qt/baseformlayer.cpp +++ b/gui_qt/baseformlayer.cpp @@ -28,7 +28,7 @@ void BaseFormLayer::revertConfig() layersCopy(_layers_original, _layers_modified); layerSelectedEvent(currentLayer()); } - + BaseForm::revertConfig(); } @@ -38,7 +38,7 @@ void BaseFormLayer::applyConfig() { layersCopy(_layers_modified, _layers_original); } - + BaseForm::applyConfig(); } @@ -61,17 +61,17 @@ void BaseFormLayer::configChangeEvent() { if (_layers_modified) { - layerApply(layersGetLayer(_layers_modified, currentLayer())); + layerWriteCurrentTo(layersGetLayer(_layers_modified, currentLayer())); layersValidate(_layers_modified); } - + BaseForm::configChangeEvent(); } QStringList BaseFormLayer::getLayers() { QStringList result; - + if (_layers_modified) { for (int i = 0; i < layersCount(_layers_modified); i++) @@ -79,7 +79,7 @@ QStringList BaseFormLayer::getLayers() result << QString::fromUtf8(layersGetName(_layers_modified, i)); } } - + return result; } @@ -109,7 +109,7 @@ void BaseFormLayer::layerDeletedEvent(int layer) { layersDeleteLayer(_layers_modified, layer); } - + BaseForm::layerDeletedEvent(layer); } @@ -119,7 +119,7 @@ void BaseFormLayer::layerMovedEvent(int layer, int new_position) { layersMove(_layers_modified, layer, new_position); } - + BaseForm::layerMovedEvent(layer, new_position); } @@ -129,7 +129,7 @@ void BaseFormLayer::layerRenamedEvent(int layer, QString new_name) { layersSetName(_layers_modified, layer, new_name.toUtf8().data()); } - + BaseForm::layerRenamedEvent(layer, new_name); } @@ -137,8 +137,8 @@ void BaseFormLayer::layerSelectedEvent(int layer) { if (_layers_modified) { - layerGetCopy(layersGetLayer(_layers_modified, layer)); + layerReadCurrentFrom(layersGetLayer(_layers_modified, layer)); } - + BaseForm::layerSelectedEvent(layer); } diff --git a/gui_qt/baseformlayer.h b/gui_qt/baseformlayer.h index 9ae31ab..f4b8390 100644 --- a/gui_qt/baseformlayer.h +++ b/gui_qt/baseformlayer.h @@ -17,11 +17,11 @@ public: public slots: virtual void revertConfig(); virtual void applyConfig(); - + protected: void setLayers(Layers* layers); - virtual void layerGetCopy(void* layer_definition) = 0; - virtual void layerApply(void* layer_definition) = 0; + virtual void layerReadCurrentFrom(void* layer_definition) = 0; + virtual void layerWriteCurrentTo(void* layer_definition) = 0; virtual void afterLayerAdded(void* layer_definition); private: diff --git a/gui_qt/formclouds.cpp b/gui_qt/formclouds.cpp index 3a64573..7a1c64e 100644 --- a/gui_qt/formclouds.cpp +++ b/gui_qt/formclouds.cpp @@ -16,10 +16,10 @@ public: _renderer = rendererCreate(); _renderer.render_quality = 5; _renderer.applyLightStatus = _applyLightStatus; - + _original_layer = layer; _preview_layer = cloudsLayerCreateDefinition(); - + configScaling(100.0, 1000.0, 20.0, 200.0); } ~PreviewCloudsCoverage() @@ -64,7 +64,7 @@ public: PreviewCloudsColor(QWidget* parent, CloudsLayerDefinition* layer):BasePreview(parent) { LightDefinition light; - + _original_layer = layer; _preview_layer = cloudsLayerCreateDefinition(); @@ -79,14 +79,14 @@ public: light.reflection = 1.0; lightingAddLight(&_lighting, light); lightingValidateDefinition(&_lighting); - + _renderer = rendererCreate(); _renderer.render_quality = 8; _renderer.alterLight = _alterLight; _renderer.getLightStatus = _getLightStatus; _renderer.customData[0] = _preview_layer; _renderer.customData[1] = &_lighting; - + configScaling(0.5, 2.0, 0.1, 2.0); } protected: @@ -98,7 +98,7 @@ protected: start.x = x * _preview_layer->thickness * 0.5; start.y = -y * _preview_layer->thickness * 0.5; start.z = _preview_layer->thickness * 0.5; - + end.x = x * _preview_layer->thickness * 0.5; end.y = -y * _preview_layer->thickness * 0.5; end.z = -_preview_layer->thickness * 0.5; @@ -126,7 +126,7 @@ private: double coverage = curveGetValue(layer->_coverage_by_altitude, position.y / layer->thickness + 0.5); position.y = 0.0; double dist = v3Norm(position); - + if (dist >= layer->thickness * 0.5) { return 0.0; @@ -141,12 +141,12 @@ private: return (density < coverage) ? density : coverage; } } - + static void _alterLight(Renderer* renderer, LightDefinition* light, Vector3 location) { light->color = cloudsLayerFilterLight((CloudsLayerDefinition*)renderer->customData[0], renderer, light->color, location, v3Scale(light->direction, -1000.0), v3Scale(light->direction, -1.0)); } - + static void _getLightStatus(Renderer* renderer, LightStatus* status, Vector3 location) { lightingGetStatus((LightingDefinition*)renderer->customData[1], renderer, location, status); @@ -164,7 +164,7 @@ FormClouds::FormClouds(QWidget *parent): _definition = cloudsCreateDefinition(); _layer = cloudsLayerCreateDefinition(); - + _previewCoverage = new PreviewCloudsCoverage(parent, _layer); _previewColor = new PreviewCloudsColor(parent, _layer); addPreview(_previewCoverage, tr("Layer coverage (no lighting)")); @@ -204,15 +204,15 @@ void FormClouds::applyConfig() void FormClouds::configChangeEvent() { cloudsLayerValidateDefinition(_layer); - BaseForm::configChangeEvent(); + BaseFormLayer::configChangeEvent(); } -void FormClouds::layerGetCopy(void* layer_definition) +void FormClouds::layerReadCurrentFrom(void* layer_definition) { cloudsLayerCopyDefinition((CloudsLayerDefinition*)layer_definition, _layer); } -void FormClouds::layerApply(void* layer_definition) +void FormClouds::layerWriteCurrentTo(void* layer_definition) { cloudsLayerCopyDefinition(_layer, (CloudsLayerDefinition*)layer_definition); } diff --git a/gui_qt/formclouds.h b/gui_qt/formclouds.h index acefaed..5a64018 100644 --- a/gui_qt/formclouds.h +++ b/gui_qt/formclouds.h @@ -18,8 +18,8 @@ public slots: virtual void applyConfig(); protected: - virtual void layerGetCopy(void* layer_definition); - virtual void layerApply(void* layer_definition); + virtual void layerReadCurrentFrom(void* layer_definition); + virtual void layerWriteCurrentTo(void* layer_definition); virtual void autoPresetSelected(int preset); protected slots: diff --git a/gui_qt/formterraincanvas.cpp b/gui_qt/formterraincanvas.cpp index b90e620..69ca1a0 100644 --- a/gui_qt/formterraincanvas.cpp +++ b/gui_qt/formterraincanvas.cpp @@ -8,13 +8,13 @@ public: { _base_canvas = canvas; _preview_canvas = terrainCanvasCreate(); - + //addOsd(QString("geolocation")); - + configScaling(1.0, 1.0, 1.0, 1.0); //configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0); } - + ~PreviewTerrainCanvasHeight() { terrainCanvasDelete(_preview_canvas); @@ -34,13 +34,13 @@ protected: height = heightmapGetValue(&_preview_canvas->height_map, x + 0.5, y + 0.5); col.r = col.g = col.b = (height - _min) / (_max - _min); col.a = 1.0; - + mask.r = 0.3; mask.g = 0.0; mask.b = 0.0; mask.a = 1.0 - terrainCanvasGetMaskValue(_preview_canvas, x + 0.5, y + 0.5); colorMask(&col, &mask); - + return colorToQColor(col); } } @@ -60,7 +60,7 @@ FormTerrainCanvas::FormTerrainCanvas(QWidget *parent, Layers* layers): BaseFormLayer(parent, layers) { _definition = terrainCanvasCreate(); - + // TODO Area //addInputDouble(tr("Apply at height"), &_definition->offset_y, -20.0, 20.0, 0.1, 1.0); addInputHeightMap(tr("Height map"), &_definition->height_map, _definition); @@ -70,10 +70,10 @@ FormTerrainCanvas::FormTerrainCanvas(QWidget *parent, Layers* layers): addInputDouble(tr("Detail noise scaling"), &_definition->detail_scaling, 0.0, 20.0, 0.1, 1.0); addInputEnum(tr("Mask shape"), &_definition->mask.mode, QStringList(tr("Square")) << tr("Circle")); addInputDouble(tr("Mask smoothing"), &_definition->mask.smoothing, 0.0, 1.0, 0.01, 0.1); - + _previewHeight = new PreviewTerrainCanvasHeight(this, _definition); addPreview(_previewHeight, tr("Height preview (normalized)")); - + revertConfig(); } @@ -82,12 +82,12 @@ FormTerrainCanvas::~FormTerrainCanvas() terrainCanvasDelete(_definition); } -void FormTerrainCanvas::layerGetCopy(void* layer_definition) +void FormTerrainCanvas::layerReadCurrentFrom(void* layer_definition) { terrainCanvasCopy((TerrainCanvas*)layer_definition, _definition); } -void FormTerrainCanvas::layerApply(void* layer_definition) +void FormTerrainCanvas::layerWriteCurrentTo(void* layer_definition) { terrainCanvasCopy(_definition, (TerrainCanvas*)layer_definition); } diff --git a/gui_qt/formterraincanvas.h b/gui_qt/formterraincanvas.h index f9f7915..2b19db0 100644 --- a/gui_qt/formterraincanvas.h +++ b/gui_qt/formterraincanvas.h @@ -13,10 +13,10 @@ class FormTerrainCanvas : public BaseFormLayer public: FormTerrainCanvas(QWidget* parent, Layers* layers); ~FormTerrainCanvas(); - + protected: - virtual void layerGetCopy(void* layer_definition); - virtual void layerApply(void* layer_definition); + virtual void layerReadCurrentFrom(void* layer_definition); + virtual void layerWriteCurrentTo(void* layer_definition); virtual void afterLayerAdded(void* layer_definition); private: diff --git a/gui_qt/formtextures.cpp b/gui_qt/formtextures.cpp index 8b4db04..0ca382f 100644 --- a/gui_qt/formtextures.cpp +++ b/gui_qt/formtextures.cpp @@ -18,17 +18,17 @@ public: PreviewTexturesCoverage(QWidget* parent, TextureLayerDefinition* layer):BasePreview(parent) { _terrain = terrainCreateDefinition(); - + _renderer = rendererCreate(); _renderer.render_quality = 3; _renderer.getTerrainHeight = _getTerrainHeight; _renderer.customData[0] = &_terrain; - + _original_layer = layer; _preview_layer = texturesLayerCreateDefinition(); - + addOsd(QString("geolocation")); - + configScaling(0.5, 200.0, 1.0, 50.0); configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0); } @@ -74,7 +74,7 @@ public: _original_layer = layer; _preview_layer = texturesLayerCreateDefinition(); - + _lighting = lightingCreateDefinition(); light.color = COLOR_WHITE; light.direction.x = 0.0; @@ -85,7 +85,7 @@ public: light.reflection = 1.0; lightingAddLight(&_lighting, light); lightingValidateDefinition(&_lighting); - + _renderer = rendererCreate(); _renderer.render_quality = 3; _renderer.getLightStatus = _getLightStatus; @@ -93,9 +93,9 @@ public: _renderer.camera_location.x = 0.0; _renderer.camera_location.y = 20.0; _renderer.camera_location.z = 0.0; - + _zone = zoneCreate(); - + configScaling(0.01, 1.0, 0.01, 0.1); configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0); } @@ -123,7 +123,7 @@ private: TextureLayerDefinition* _original_layer; TextureLayerDefinition* _preview_layer; LightingDefinition _lighting; - + static void _getLightStatus(Renderer* renderer, LightStatus* status, Vector3 location) { lightingGetStatus((LightingDefinition*)renderer->customData[0], renderer, location, status); @@ -177,7 +177,7 @@ void FormTextures::applyConfig() scenerySetTextures(&_definition); } -void FormTextures::layerGetCopy(void* layer_definition) +void FormTextures::layerReadCurrentFrom(void* layer_definition) { TextureLayerDefinition* source = (TextureLayerDefinition*)layer_definition; texturesLayerCopyDefinition(source, _layer); @@ -186,11 +186,11 @@ void FormTextures::layerGetCopy(void* layer_definition) zoneGetSlopeCurve(source->zone, _supp.slope_curve); } -void FormTextures::layerApply(void* layer_definition) +void FormTextures::layerWriteCurrentTo(void* layer_definition) { TextureLayerDefinition* destination = (TextureLayerDefinition*)layer_definition; texturesLayerCopyDefinition(_layer, destination); - + zoneSetHeightCurve(destination->zone, _supp.height_curve); zoneSetSlopeCurve(destination->zone, _supp.slope_curve); } diff --git a/gui_qt/formtextures.h b/gui_qt/formtextures.h index 5254c8f..1bd9a5b 100644 --- a/gui_qt/formtextures.h +++ b/gui_qt/formtextures.h @@ -19,8 +19,8 @@ public slots: virtual void applyConfig(); protected: - virtual void layerGetCopy(void* layer_definition); - virtual void layerApply(void* layer_definition); + virtual void layerReadCurrentFrom(void* layer_definition); + virtual void layerWriteCurrentTo(void* layer_definition); private: TexturesDefinition _definition;