paysages : Added cloud preview from above.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@507 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
309450deca
commit
fad0b9941b
5 changed files with 39 additions and 13 deletions
2
TODO
2
TODO
|
@ -9,7 +9,7 @@ Technology Preview 2 :
|
||||||
=> Fix artifacts on aerial perspective
|
=> Fix artifacts on aerial perspective
|
||||||
=> Fix blue appearance at night
|
=> Fix blue appearance at night
|
||||||
- Finalize lighting refactoring
|
- Finalize lighting refactoring
|
||||||
=> Restore water and cloud filters
|
=> Restore water filtering
|
||||||
=> Restore cloud lighting
|
=> Restore cloud lighting
|
||||||
=> Restore and improve skydome lighting
|
=> Restore and improve skydome lighting
|
||||||
- Apply Preetham's model usage
|
- Apply Preetham's model usage
|
||||||
|
|
|
@ -507,6 +507,7 @@ void BasePreview::addToggle(const QString& key, const QString& text, bool init_v
|
||||||
|
|
||||||
void BasePreview::toggleChangeEvent(QString, bool)
|
void BasePreview::toggleChangeEvent(QString, bool)
|
||||||
{
|
{
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasePreview::redraw()
|
void BasePreview::redraw()
|
||||||
|
|
|
@ -13,10 +13,12 @@ public:
|
||||||
PreviewCloudsCoverage(QWidget* parent, CloudsLayerDefinition* layer):BasePreview(parent)
|
PreviewCloudsCoverage(QWidget* parent, CloudsLayerDefinition* layer):BasePreview(parent)
|
||||||
{
|
{
|
||||||
_renderer = cloudsCreatePreviewCoverageRenderer();
|
_renderer = cloudsCreatePreviewCoverageRenderer();
|
||||||
|
_3d = true;
|
||||||
|
|
||||||
_original_layer = layer;
|
_original_layer = layer;
|
||||||
_preview_definition = (CloudsDefinition*)CloudsDefinitionClass.create();
|
_preview_definition = (CloudsDefinition*)CloudsDefinitionClass.create();
|
||||||
|
|
||||||
|
addToggle("3d", tr("Perspective"), true);
|
||||||
configScaling(100.0, 1000.0, 20.0, 200.0);
|
configScaling(100.0, 1000.0, 20.0, 200.0);
|
||||||
}
|
}
|
||||||
~PreviewCloudsCoverage()
|
~PreviewCloudsCoverage()
|
||||||
|
@ -27,7 +29,15 @@ public:
|
||||||
protected:
|
protected:
|
||||||
Color getColor(double x, double y)
|
Color getColor(double x, double y)
|
||||||
{
|
{
|
||||||
return cloudsGetPreviewCoverage(_renderer, x, y, scaling);
|
return cloudsGetPreviewCoverage(_renderer, x, y, scaling, _3d);
|
||||||
|
}
|
||||||
|
virtual void toggleChangeEvent(QString key, bool value)
|
||||||
|
{
|
||||||
|
if (key == "3d")
|
||||||
|
{
|
||||||
|
_3d = value;
|
||||||
|
}
|
||||||
|
BasePreview::toggleChangeEvent(key, value);
|
||||||
}
|
}
|
||||||
void updateData()
|
void updateData()
|
||||||
{
|
{
|
||||||
|
@ -40,6 +50,7 @@ private:
|
||||||
Renderer* _renderer;
|
Renderer* _renderer;
|
||||||
CloudsLayerDefinition* _original_layer;
|
CloudsLayerDefinition* _original_layer;
|
||||||
CloudsDefinition* _preview_definition;
|
CloudsDefinition* _preview_definition;
|
||||||
|
bool _3d;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PreviewCloudsColor:public BasePreview
|
class PreviewCloudsColor:public BasePreview
|
||||||
|
|
|
@ -26,7 +26,9 @@ Renderer* cloudsCreatePreviewCoverageRenderer()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color cloudsGetPreviewCoverage(Renderer* renderer, double x, double y, double scaling)
|
Color cloudsGetPreviewCoverage(Renderer* renderer, double x, double y, double scaling, int perspective)
|
||||||
|
{
|
||||||
|
if (perspective)
|
||||||
{
|
{
|
||||||
Vector3 eye, look;
|
Vector3 eye, look;
|
||||||
|
|
||||||
|
@ -40,6 +42,18 @@ Color cloudsGetPreviewCoverage(Renderer* renderer, double x, double y, double sc
|
||||||
|
|
||||||
return renderer->clouds->getColor(renderer, COLOR_BLUE, eye, v3Add(eye, v3Scale(look, 1000.0)));
|
return renderer->clouds->getColor(renderer, COLOR_BLUE, eye, v3Add(eye, v3Scale(look, 1000.0)));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector3 start, end;
|
||||||
|
|
||||||
|
start.x = end.x = x;
|
||||||
|
start.z = end.z = y;
|
||||||
|
start.y = 1000.0;
|
||||||
|
end.y = -1000.0;
|
||||||
|
|
||||||
|
return renderer->clouds->getColor(renderer, COLOR_BLUE, start, end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Renderer* cloudsCreatePreviewColorRenderer()
|
Renderer* cloudsCreatePreviewColorRenderer()
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,7 +82,7 @@ LayerType cloudsGetLayerType();
|
||||||
void cloudsAutoPreset(CloudsLayerDefinition* definition, CloudsPreset preset);
|
void cloudsAutoPreset(CloudsLayerDefinition* definition, CloudsPreset preset);
|
||||||
|
|
||||||
Renderer* cloudsCreatePreviewCoverageRenderer();
|
Renderer* cloudsCreatePreviewCoverageRenderer();
|
||||||
Color cloudsGetPreviewCoverage(Renderer* renderer, double x, double y, double scaling);
|
Color cloudsGetPreviewCoverage(Renderer* renderer, double x, double y, double scaling, int perspective);
|
||||||
|
|
||||||
Renderer* cloudsCreatePreviewColorRenderer();
|
Renderer* cloudsCreatePreviewColorRenderer();
|
||||||
Color cloudsGetPreviewColor(Renderer* renderer, double x, double y);
|
Color cloudsGetPreviewColor(Renderer* renderer, double x, double y);
|
||||||
|
|
Loading…
Reference in a new issue