From f8fc22fbf73d4c769e98b7a0c62b8d6c69df78a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Sat, 2 Jun 2012 21:01:35 +0000 Subject: [PATCH] paysages : Added quick antialiasing to material small previews. git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@334 b1fd45b6-86a6-48da-8261-f70d1f35bdcc --- gui_qt/previewmaterial.cpp | 11 ++++++++--- lib_paysages/clouds.c | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gui_qt/previewmaterial.cpp b/gui_qt/previewmaterial.cpp index 1ebaeac..863a642 100644 --- a/gui_qt/previewmaterial.cpp +++ b/gui_qt/previewmaterial.cpp @@ -43,8 +43,9 @@ QColor SmallMaterialPreview::getColor(double x, double y) { double dist = sqrt(x * x + y * y); Vector3 point; + Color color; - if (dist > 1.0) + if (dist >= 1.0) { return colorToQColor(COLOR_TRANSPARENT); } @@ -62,8 +63,12 @@ QColor SmallMaterialPreview::getColor(double x, double y) } point = v3Normalize(point); - - return colorToQColor(lightingApplyToSurface(&_lighting, &_renderer, point, point, *_material)); + color = lightingApplyToSurface(&_lighting, &_renderer, point, point, *_material); + if (dist > 0.95) + { + color.a = (1.0 - dist) / 0.05; + } + return colorToQColor(color); } } diff --git a/lib_paysages/clouds.c b/lib_paysages/clouds.c index c425928..d7547cc 100644 --- a/lib_paysages/clouds.c +++ b/lib_paysages/clouds.c @@ -150,6 +150,7 @@ CloudsLayerDefinition cloudsLayerCreateDefinition() result.material.base.r = 0.7; result.material.base.g = 0.7; result.material.base.b = 0.7; + result.material.base.a = 1.0; result.material.reflection = 0.3; result.material.shininess = 0.8; result.hardness = 0.15;