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 blue appearance at night
|
||||
- Finalize lighting refactoring
|
||||
=> Restore water and cloud filters
|
||||
=> Restore water filtering
|
||||
=> Restore cloud lighting
|
||||
=> Restore and improve skydome lighting
|
||||
- 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)
|
||||
{
|
||||
redraw();
|
||||
}
|
||||
|
||||
void BasePreview::redraw()
|
||||
|
|
|
@ -13,10 +13,12 @@ public:
|
|||
PreviewCloudsCoverage(QWidget* parent, CloudsLayerDefinition* layer):BasePreview(parent)
|
||||
{
|
||||
_renderer = cloudsCreatePreviewCoverageRenderer();
|
||||
_3d = true;
|
||||
|
||||
_original_layer = layer;
|
||||
_preview_definition = (CloudsDefinition*)CloudsDefinitionClass.create();
|
||||
|
||||
addToggle("3d", tr("Perspective"), true);
|
||||
configScaling(100.0, 1000.0, 20.0, 200.0);
|
||||
}
|
||||
~PreviewCloudsCoverage()
|
||||
|
@ -27,7 +29,15 @@ public:
|
|||
protected:
|
||||
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()
|
||||
{
|
||||
|
@ -40,6 +50,7 @@ private:
|
|||
Renderer* _renderer;
|
||||
CloudsLayerDefinition* _original_layer;
|
||||
CloudsDefinition* _preview_definition;
|
||||
bool _3d;
|
||||
};
|
||||
|
||||
class PreviewCloudsColor:public BasePreview
|
||||
|
|
|
@ -26,19 +26,33 @@ Renderer* cloudsCreatePreviewCoverageRenderer()
|
|||
return result;
|
||||
}
|
||||
|
||||
Color cloudsGetPreviewCoverage(Renderer* renderer, double x, double y, double scaling)
|
||||
Color cloudsGetPreviewCoverage(Renderer* renderer, double x, double y, double scaling, int perspective)
|
||||
{
|
||||
Vector3 eye, look;
|
||||
if (perspective)
|
||||
{
|
||||
Vector3 eye, look;
|
||||
|
||||
eye.x = 0.0;
|
||||
eye.y = scaling;
|
||||
eye.z = -10.0 * scaling;
|
||||
look.x = x * 0.01 / scaling;
|
||||
look.y = -y * 0.01 / scaling - 0.3;
|
||||
look.z = 1.0;
|
||||
look = v3Normalize(look);
|
||||
eye.x = 0.0;
|
||||
eye.y = scaling;
|
||||
eye.z = -10.0 * scaling;
|
||||
look.x = x * 0.01 / scaling;
|
||||
look.y = -y * 0.01 / scaling - 0.3;
|
||||
look.z = 1.0;
|
||||
look = v3Normalize(look);
|
||||
|
||||
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()
|
||||
|
|
|
@ -82,7 +82,7 @@ LayerType cloudsGetLayerType();
|
|||
void cloudsAutoPreset(CloudsLayerDefinition* definition, CloudsPreset preset);
|
||||
|
||||
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();
|
||||
Color cloudsGetPreviewColor(Renderer* renderer, double x, double y);
|
||||
|
|
Loading…
Reference in a new issue