diff --git a/TODO b/TODO index 1395bb5..2217f43 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ Technology Preview 2 : - InputInt doesn't honor small_step. -- Fix the fog impression when cloud layer overlaps with ground range. - Remove color gradations (replace with automatic boolean and simple colors). - Replace zone ranges with curves (with curve input and curve dialog). - Interface for textures thickness, slope_range and thickness_transparency (and correct slider ranges). diff --git a/lib_paysages/atmosphere.c b/lib_paysages/atmosphere.c index 3128f5f..f91dd39 100644 --- a/lib_paysages/atmosphere.c +++ b/lib_paysages/atmosphere.c @@ -87,6 +87,7 @@ Color atmosphereApply(AtmosphereDefinition* definition, Renderer* renderer, Vect Color mask = definition->color; double distance = v3Norm(v3Sub(renderer->camera_location, location)); double value; + double alpha; if (distance < definition->distance_near) { @@ -97,10 +98,15 @@ Color atmosphereApply(AtmosphereDefinition* definition, Renderer* renderer, Vect distance = definition->distance_far; } + alpha = base.a; + base.a = 1.0; + value = definition->full_mask * (distance - definition->distance_near) / (definition->distance_far - definition->distance_near); + mask.a = value; - colorMask(&base, &mask); + + base.a = alpha; return base; } diff --git a/lib_paysages/clouds.c b/lib_paysages/clouds.c index aa9abb0..c89932a 100644 --- a/lib_paysages/clouds.c +++ b/lib_paysages/clouds.c @@ -169,7 +169,7 @@ CloudsLayerDefinition cloudsLayerCreateDefinition() result.base_coverage = 0.35; result.shape_noise = noiseCreateGenerator(); noiseGenerateBaseNoise(result.shape_noise, 200000); - noiseAddLevelsSimple(result.shape_noise, 4, 1.0, 1.0); + noiseAddLevelsSimple(result.shape_noise, 5, 1.0, 1.0); result.edge_noise = noiseCreateGenerator(); noiseGenerateBaseNoise(result.edge_noise, 800000); noiseAddLevelsSimple(result.edge_noise, 8, 1.0, 1.0); @@ -575,7 +575,10 @@ Color cloudsGetLayerColor(CloudsLayerDefinition* definition, Renderer* renderer, col.a = 1.0; } - result = renderer->applyAtmosphere(renderer, start, result); + if (result.a > 0.000001) + { + result = renderer->applyAtmosphere(renderer, start, result); + } return result; } @@ -602,7 +605,7 @@ Color cloudsGetColor(CloudsDefinition* definition, Renderer* renderer, Vector3 s for (i = 0; i < definition->nblayers; i++) { layer_color = cloudsGetLayerColor(layers + i, renderer, start, end); - if (layer_color.a > 0.0) + if (layer_color.a > 0.000001) { colorMask(&result, &layer_color); } diff --git a/lib_paysages/system.c b/lib_paysages/system.c index c2d64ec..e06b8fa 100644 --- a/lib_paysages/system.c +++ b/lib_paysages/system.c @@ -1,6 +1,8 @@ #include "system.h" #include +/*#define DEBUG_ONETHREAD 1*/ + #ifdef WIN32 #include #endif