1
0
Fork 0

Merge branch 'master' of gitorious.org:fg/fgdata

This commit is contained in:
BARANGER Emmanuel 2014-03-10 22:16:52 +01:00
commit fadc3bf7fa
10 changed files with 626 additions and 10 deletions

View file

@ -116,6 +116,47 @@
<windN><use>/environment/sea/surface/wind-from-north-fps</use></windN>
<quality_level><use>/sim/rendering/shaders/landmass</use></quality_level>
<tquality_level><use>/sim/rendering/shaders/transition</use></tquality_level>
<cloudpos1_x><use>/local-weather/cloud-shadows/cloudpos-x[0]</use></cloudpos1_x>
<cloudpos1_y><use>/local-weather/cloud-shadows/cloudpos-y[0]</use></cloudpos1_y>
<cloudpos2_x><use>/local-weather/cloud-shadows/cloudpos-x[1]</use></cloudpos2_x>
<cloudpos2_y><use>/local-weather/cloud-shadows/cloudpos-y[1]</use></cloudpos2_y>
<cloudpos3_x><use>/local-weather/cloud-shadows/cloudpos-x[2]</use></cloudpos3_x>
<cloudpos3_y><use>/local-weather/cloud-shadows/cloudpos-y[2]</use></cloudpos3_y>
<cloudpos4_x><use>/local-weather/cloud-shadows/cloudpos-x[3]</use></cloudpos4_x>
<cloudpos4_y><use>/local-weather/cloud-shadows/cloudpos-y[3]</use></cloudpos4_y>
<cloudpos5_x><use>/local-weather/cloud-shadows/cloudpos-x[4]</use></cloudpos5_x>
<cloudpos5_y><use>/local-weather/cloud-shadows/cloudpos-y[4]</use></cloudpos5_y>
<cloudpos6_x><use>/local-weather/cloud-shadows/cloudpos-x[5]</use></cloudpos6_x>
<cloudpos6_y><use>/local-weather/cloud-shadows/cloudpos-y[5]</use></cloudpos6_y>
<cloudpos7_x><use>/local-weather/cloud-shadows/cloudpos-x[6]</use></cloudpos7_x>
<cloudpos7_y><use>/local-weather/cloud-shadows/cloudpos-y[6]</use></cloudpos7_y>
<cloudpos8_x><use>/local-weather/cloud-shadows/cloudpos-x[7]</use></cloudpos8_x>
<cloudpos8_y><use>/local-weather/cloud-shadows/cloudpos-y[7]</use></cloudpos8_y>
<cloudpos9_x><use>/local-weather/cloud-shadows/cloudpos-x[8]</use></cloudpos9_x>
<cloudpos9_y><use>/local-weather/cloud-shadows/cloudpos-y[8]</use></cloudpos9_y>
<cloudpos10_x><use>/local-weather/cloud-shadows/cloudpos-x[9]</use></cloudpos10_x>
<cloudpos10_y><use>/local-weather/cloud-shadows/cloudpos-y[9]</use></cloudpos10_y>
<cloudpos11_x><use>/local-weather/cloud-shadows/cloudpos-x[10]</use></cloudpos11_x>
<cloudpos11_y><use>/local-weather/cloud-shadows/cloudpos-y[10]</use></cloudpos11_y>
<cloudpos12_x><use>/local-weather/cloud-shadows/cloudpos-x[11]</use></cloudpos12_x>
<cloudpos12_y><use>/local-weather/cloud-shadows/cloudpos-y[11]</use></cloudpos12_y>
<cloudpos13_x><use>/local-weather/cloud-shadows/cloudpos-x[12]</use></cloudpos13_x>
<cloudpos13_y><use>/local-weather/cloud-shadows/cloudpos-y[12]</use></cloudpos13_y>
<cloudpos14_x><use>/local-weather/cloud-shadows/cloudpos-x[13]</use></cloudpos14_x>
<cloudpos14_y><use>/local-weather/cloud-shadows/cloudpos-y[13]</use></cloudpos14_y>
<cloudpos15_x><use>/local-weather/cloud-shadows/cloudpos-x[14]</use></cloudpos15_x>
<cloudpos15_y><use>/local-weather/cloud-shadows/cloudpos-y[14]</use></cloudpos15_y>
<cloudpos16_x><use>/local-weather/cloud-shadows/cloudpos-x[15]</use></cloudpos16_x>
<cloudpos16_y><use>/local-weather/cloud-shadows/cloudpos-y[15]</use></cloudpos16_y>
<cloudpos17_x><use>/local-weather/cloud-shadows/cloudpos-x[16]</use></cloudpos17_x>
<cloudpos17_y><use>/local-weather/cloud-shadows/cloudpos-y[16]</use></cloudpos17_y>
<cloudpos18_x><use>/local-weather/cloud-shadows/cloudpos-x[17]</use></cloudpos18_x>
<cloudpos18_y><use>/local-weather/cloud-shadows/cloudpos-y[17]</use></cloudpos18_y>
<cloudpos19_x><use>/local-weather/cloud-shadows/cloudpos-x[18]</use></cloudpos19_x>
<cloudpos19_y><use>/local-weather/cloud-shadows/cloudpos-y[18]</use></cloudpos19_y>
<cloudpos20_x><use>/local-weather/cloud-shadows/cloudpos-x[19]</use></cloudpos20_x>
<cloudpos20_y><use>/local-weather/cloud-shadows/cloudpos-y[19]</use></cloudpos20_y>
<cloud_shadow_flag><use>/local-weather/cloud-shadows/cloud-shadow-flag</use></cloud_shadow_flag>
</parameters>
<!-- put techniques at a "high" index to allow derived effects to
insert their own techniques first. -->
@ -249,6 +290,7 @@
<program>
<vertex-shader>Shaders/terrain-haze-ultra.vert</vertex-shader>
<fragment-shader>Shaders/terrain-haze-ultra.frag</fragment-shader>
<fragment-shader>Shaders/cloud-shadowfunc.frag</fragment-shader>
</program>
<uniform>
<name>grain_strength</name>
@ -385,6 +427,206 @@
<type>float</type>
<value><use>season</use></value>
</uniform>
<uniform>
<name>cloudpos1_x</name>
<type>float</type>
<value><use>cloudpos1_x</use></value>
</uniform>
<uniform>
<name>cloudpos1_y</name>
<type>float</type>
<value><use>cloudpos1_y</use></value>
</uniform>
<uniform>
<name>cloudpos2_x</name>
<type>float</type>
<value><use>cloudpos2_x</use></value>
</uniform>
<uniform>
<name>cloudpos2_y</name>
<type>float</type>
<value><use>cloudpos2_y</use></value>
</uniform>
<uniform>
<name>cloudpos3_x</name>
<type>float</type>
<value><use>cloudpos3_x</use></value>
</uniform>
<uniform>
<name>cloudpos3_y</name>
<type>float</type>
<value><use>cloudpos3_y</use></value>
</uniform>
<uniform>
<name>cloudpos4_x</name>
<type>float</type>
<value><use>cloudpos4_x</use></value>
</uniform>
<uniform>
<name>cloudpos4_y</name>
<type>float</type>
<value><use>cloudpos4_y</use></value>
</uniform>
<uniform>
<name>cloudpos5_x</name>
<type>float</type>
<value><use>cloudpos5_x</use></value>
</uniform>
<uniform>
<name>cloudpos5_y</name>
<type>float</type>
<value><use>cloudpos5_y</use></value>
</uniform>
<uniform>
<name>cloudpos6_x</name>
<type>float</type>
<value><use>cloudpos6_x</use></value>
</uniform>
<uniform>
<name>cloudpos6_y</name>
<type>float</type>
<value><use>cloudpos6_y</use></value>
</uniform>
<uniform>
<name>cloudpos7_x</name>
<type>float</type>
<value><use>cloudpos7_x</use></value>
</uniform>
<uniform>
<name>cloudpos7_y</name>
<type>float</type>
<value><use>cloudpos7_y</use></value>
</uniform>
<uniform>
<name>cloudpos8_x</name>
<type>float</type>
<value><use>cloudpos8_x</use></value>
</uniform>
<uniform>
<name>cloudpos8_y</name>
<type>float</type>
<value><use>cloudpos8_y</use></value>
</uniform>
<uniform>
<name>cloudpos9_x</name>
<type>float</type>
<value><use>cloudpos9_x</use></value>
</uniform>
<uniform>
<name>cloudpos9_y</name>
<type>float</type>
<value><use>cloudpos9_y</use></value>
</uniform>
<uniform>
<name>cloudpos10_x</name>
<type>float</type>
<value><use>cloudpos10_x</use></value>
</uniform>
<uniform>
<name>cloudpos10_y</name>
<type>float</type>
<value><use>cloudpos10_y</use></value>
</uniform>
<uniform>
<name>cloudpos11_x</name>
<type>float</type>
<value><use>cloudpos11_x</use></value>
</uniform>
<uniform>
<name>cloudpos11_y</name>
<type>float</type>
<value><use>cloudpos11_y</use></value>
</uniform>
<uniform>
<name>cloudpos12_x</name>
<type>float</type>
<value><use>cloudpos12_x</use></value>
</uniform>
<uniform>
<name>cloudpos12_y</name>
<type>float</type>
<value><use>cloudpos12_y</use></value>
</uniform>
<uniform>
<name>cloudpos13_x</name>
<type>float</type>
<value><use>cloudpos13_x</use></value>
</uniform>
<uniform>
<name>cloudpos13_y</name>
<type>float</type>
<value><use>cloudpos13_y</use></value>
</uniform>
<uniform>
<name>cloudpos14_x</name>
<type>float</type>
<value><use>cloudpos14_x</use></value>
</uniform>
<uniform>
<name>cloudpos14_y</name>
<type>float</type>
<value><use>cloudpos14_y</use></value>
</uniform>
<uniform>
<name>cloudpos15_x</name>
<type>float</type>
<value><use>cloudpos15_x</use></value>
</uniform>
<uniform>
<name>cloudpos15_y</name>
<type>float</type>
<value><use>cloudpos15_y</use></value>
</uniform>
<uniform>
<name>cloudpos16_x</name>
<type>float</type>
<value><use>cloudpos16_x</use></value>
</uniform>
<uniform>
<name>cloudpos16_y</name>
<type>float</type>
<value><use>cloudpos16_y</use></value>
</uniform>
<uniform>
<name>cloudpos17_x</name>
<type>float</type>
<value><use>cloudpos17_x</use></value>
</uniform>
<uniform>
<name>cloudpos17_y</name>
<type>float</type>
<value><use>cloudpos17_y</use></value>
</uniform>
<uniform>
<name>cloudpos18_x</name>
<type>float</type>
<value><use>cloudpos18_x</use></value>
</uniform>
<uniform>
<name>cloudpos18_y</name>
<type>float</type>
<value><use>cloudpos18_y</use></value>
</uniform>
<uniform>
<name>cloudpos19_x</name>
<type>float</type>
<value><use>cloudpos19_x</use></value>
</uniform>
<uniform>
<name>cloudpos19_y</name>
<type>float</type>
<value><use>cloudpos19_y</use></value>
</uniform>
<uniform>
<name>cloudpos20_x</name>
<type>float</type>
<value><use>cloudpos20_x</use></value>
</uniform>
<uniform>
<name>cloudpos20_y</name>
<type>float</type>
<value><use>cloudpos20_y</use></value>
</uniform>
<uniform>
<name>WindE</name>
<type>float</type>
@ -406,10 +648,15 @@
<value><use>tquality_level</use></value>
</uniform>
<uniform>
<name>wind_effects</name>
<type>int</type>
<value><use>wind_effects</use></value>
<name>wind_effects</name>
<type>int</type>
<value><use>wind_effects</use></value>
</uniform>
<uniform>
<name>cloud_shadow_flag</name>
<type>int</type>
<value><use>cloud_shadow_flag</use></value>
</uniform>
<uniform>
<name>texture</name>
<type>sampler-2d</type>

View file

@ -103,6 +103,10 @@
<box-bottom-thickness type="double" userarchive="n">0.2</box-bottom-thickness>
<box-bottom-n type="int" userarchive="n">12</box-bottom-n>
</tmp>
<cloud-shadows>
<cloud-shadow-flag type="bool" userarchive="y">0</cloud-shadow-flag>
<cloud-shadow-fov-flag type="bool" userarchive="y">0</cloud-shadow-fov-flag>
</cloud-shadows>
</PropertyList>

View file

@ -1656,6 +1656,7 @@ setprop(lw~"timing-loop-flag",0);
setprop(lw~"buffer-loop-flag",0);
setprop(lw~"housekeeping-loop-flag",0);
setprop(lw~"convective-loop-flag",0);
setprop(lw~"shadow-loop-flag",0);
weather_dynamics.convective_loop_kill_flag = 1; # long-running loop needs a different scheme to end
@ -1691,6 +1692,14 @@ n_effectVolumeArray = 0;
weather_tile_management.remove_impostors();
# clear out the visual shadows
for (var i = 0; i<cloudShadowArraySize; i=i+1)
{
setprop("/local-weather/cloud-shadows/cloudpos-x["~i~"]",0.0);
setprop("/local-weather/cloud-shadows/cloudpos-y["~i~"]",0.0);
}
# clear any wxradar echos
if (wxradar_support_flag ==1)
@ -1711,6 +1720,8 @@ settimer ( func {
setsize(alt_50_array,0);
setsize(alt_min_array,0);
setsize(alt_mean_array,0);
setsize(weather_dynamics.cloudShadowArray,0);
setsize(weather_dynamics.cloudShadowCandidateArray,0);
setsize(weather_dynamics.tile_convective_altitude,0);
setsize(weather_dynamics.tile_convective_strength,0);
setsize(weatherStationArray,0);
@ -1803,6 +1814,14 @@ if (edge_bias > 0.0) {height_bias = height_bias + 15.0 *edge_bias + 20.0 * rand
create_streak(btype,lat,lon, alt -offset_map["Congestus"] -900.0, 100.0,n_b,0.0,edge,0.3*x,1,0.0,0.0,0.3*y,alpha,1.0);
if (local_weather.cloud_shadow_flag == 1)
{
var cs = local_weather.cloudShadow.new(lat, lon, 0.9 * (1.5 * x)/5000.0 , 0.9);
cs.index = getprop(lw~"tiles/tile-counter");
append(cloudShadowCandidateArray,cs);
}
}
else if (size>1.1)
{
@ -1822,6 +1841,13 @@ if (edge_bias > 0.0) {height_bias = height_bias + 15.0 *edge_bias + 20.0 * rand
height_bias = 1.0;
create_streak(btype,lat,lon, alt -offset_map["Cumulus"] - 200.0, 100.0,n_b,0.0,edge,0.3*x,1,0.0,0.0,0.3*y,alpha,1.0);
if (local_weather.cloud_shadow_flag == 1)
{
var cs = local_weather.cloudShadow.new(lat, lon, 0.9 * (1.5 * x)/5000.0 , 0.8);
cs.index = getprop(lw~"tiles/tile-counter");
append(cloudShadowCandidateArray,cs);
}
}
else if (size>0.8)
{
@ -1998,7 +2024,7 @@ var alt_base = alt_20_array[tile_index -1];
#var alt_base = getprop(lw~"tmp/tile-alt-offset-ft");
# }
var sec_to_rad = 2.0 * math.pi/86400; # conversion factor for sinusoidal dependence on daytime
#var sec_to_rad = 2.0 * math.pi/86400; # conversion factor for sinusoidal dependence on daytime
calc_geo(blat);
@ -2190,7 +2216,7 @@ var detail_flag = detailed_clouds_flag;
alpha = alpha * math.pi/180.0; # the tile orientation
var sec_to_rad = 2.0 * math.pi/86400; # conversion factor for sinusoidal dependence on daytime
#var sec_to_rad = 2.0 * math.pi/86400; # conversion factor for sinusoidal dependence on daytime
# current aircraft position
@ -3984,6 +4010,16 @@ local_weather.init_sea_colors();
# create impostors - this should only happen when sufficiently high in air
weather_tile_management.create_impostors();
# start the cloud shadow loop
local_weather.cloud_shadow_flag = getprop("/local-weather/cloud-shadows/cloud-shadow-flag");
if (local_weather.cloud_shadow_flag == 1)
{
setprop(lw~"shadow-loop-flag",1);
weather_tile_management.shadow_management_loop(0);
}
# weather_tile_management.watchdog_loop();
}
@ -4400,6 +4436,7 @@ var lat_to_m = 110952.0; # latitude degrees to meters
var m_to_lat = 9.01290648208234e-06; # meters to latitude degrees
var ft_to_m = 0.30480;
var m_to_ft = 1.0/ft_to_m;
var sec_to_rad = 2.0 * math.pi/86400;
var lon_to_m = 0.0; # needs to be calculated dynamically
var m_to_lon = 0.0; # we do this on startup

View file

@ -16,6 +16,7 @@
# housekeeping_loop to shift clouds from the scenery into the buffer
# remove_impostors to delete a ring of impostors to mimick distant clouds
# create_impostors to create a ring of impostors to mimick distant clouds
# shadow_management_loop to manage cloud shadow information
# watchdog loop (debug helping structure)
# calc_geo to get local Cartesian geometry for latitude conversion
# get_lat to get latitude from Cartesian coordinates
@ -1120,6 +1121,19 @@ var housekeeping_loop = func (index, index1) {
if (local_weather.local_weather_running_flag == 0) {return;}
# supply a few properties which are used more generally
lwObserverLat = getprop("/position/latitude-deg");
lwObserverLon = getprop("/position/longitude-deg");
var heading = getprop("/orientation/heading-deg");
var offset = getprop("/sim/current-view/heading-offset-deg");
lwViewDir = (heading - offset) * math.pi/180.0 ;
setsize(lwViewVec,0);
append(lwViewVec,math.cos(lwViewDir));
append(lwViewVec,-math.sin(lwViewDir));
var n = 5;
var n_max = size(cloudSceneryArray);
n_cloudSceneryArray = n_max;
@ -1248,6 +1262,130 @@ weather_tiles.create_impostor_ring(lat, lon, alt, alpha, type, n);
}
###############################
# Cloud shadow management
###############################
var shadow_management_loop = func (index) {
if (local_weather.local_weather_running_flag == 0) {return;}
var n = 50;
var n_max = size(cloudShadowCandidateArray);
var s = size(active_tile_list);
# don't do anything as long as the array is empty
if (n_max == 0) # nothing to do, loop over
{if (getprop(lw~"shadow-loop-flag") ==1) {settimer( func {shadow_management_loop(index)}, 0);} return;}
# compute some general-purpose stuff for the loop
var eyeLat = lwObserverLat;
var eyeLon = lwObserverLon;
#var sec_to_rad = 2.0 * math.pi/86400;
var time = getprop("/sim/time/utc/day-seconds") + getprop("/sim/time/local-offset");
var sun_angle = getprop("/sim/time/sun-angle-rad");
var cloud_alt = getprop("/environment/ground-haze-thickness-m");
var offset_mag = cloud_alt * math.tan(sun_angle);
var offset_x = -math.cos(time * local_weather.sec_to_rad) * math.cos(eyeLat) * offset_mag;
var offset_y = -math.sin(time * local_weather.sec_to_rad) * math.sin(eyeLat) * offset_mag;
# indexing, we don't want to run through hundreds of candidates per frame
if (index > n_max-1) {index = 0;}
var i_max = index + n;
if (i_max > n_max) {i_max = n_max;}
for (var i = index; i < i_max; i = i+1)
{
var shadow = cloudShadowCandidateArray[i];
# housekeeping - delete shadows from deleted tiles
var flag = 0;
for (var j = 0; j < s; j = j+1)
{
if (active_tile_list[j] == shadow.index) {flag = 1; break;}
if (shadow.index == 0) {flag =1; break;} # clouds in tile index 0 are special
}
if (flag == 0)
{
#print("Shadow management housekeeping!");
cloudShadowCandidateArray = delete_from_vector(cloudShadowCandidateArray,i);
i = i -1; i_max = i_max - 1; n_max = n_max - 1;
continue;
}
# find nearest shadows
if (shadow.shadow_flag == 0)
{
var diffx = (shadow.lat - eyeLat) * local_weather.lat_to_m + offset_x;
var diffy = -(shadow.lon - eyeLon) * local_weather.lon_to_m + offset_y;
var dist = math.sqrt(diffx * diffx + diffy * diffy) ;
if (getprop("/local-weather/cloud-shadows/cloud-shadow-fov-flag")==1)
{
var viewDotPos = (diffx * lwViewVec[0] + diffy * lwViewVec[1])/dist;
if (viewDotPos <0.7) {dist = dist -(viewDotPos - 0.7) * 10000.0;}
}
if (dist < cloudShadowMaxDist)
{
#print("Shadow management:");
#print("Max. dist is now: ", dist);
#print("Adding cloud");
#print("Array size is now: ", size(cloudShadowArray));
#print("CloudShadowMinIndex is now: ", cloudShadowMinIndex);
cloudShadowMaxDist = dist;
if (size(cloudShadowArray)>cloudShadowArraySize-1)
{
cloudShadowArray[cloudShadowMinIndex].shadow_flag = 0;
cloudShadowArray = delete_from_vector(cloudShadowArray,cloudShadowMinIndex);
}
append(cloudShadowArray,shadow);
shadow.shadow_flag = 1;
break;
}
}
}
var index_max = -1;
var dist_max = -1.0;
var counter = 0;
foreach(s; cloudShadowArray)
{
var diffx = (s.lat - eyeLat) * local_weather.lat_to_m + offset_x;
var diffy = -(s.lon - eyeLon) * local_weather.lon_to_m + offset_y;
var dist = math.sqrt(diffx*diffx + diffy*diffy);
if (getprop("/local-weather/cloud-shadows/cloud-shadow-fov-flag")==1)
{
var viewDotPos = (diffx * lwViewVec[0] + diffy * lwViewVec[1])/dist;
if (viewDotPos <0.7) {dist = dist -(viewDotPos - 0.7) * 10000.0;}
}
if (dist > dist_max) {dist_max = dist; index_max = counter;}
setprop("/local-weather/cloud-shadows/cloudpos-x["~counter~"]",int(diffx) + s.size);
setprop("/local-weather/cloud-shadows/cloudpos-y["~counter~"]",int(diffy) + 0.9 );
counter = counter+1;
}
#print("Dist_max:", dist_max, " index_max: ", index_max);
cloudShadowMinIndex = index_max;
if (dist_max > 0.0) {cloudShadowMaxDist = dist_max;}
settimer( func {shadow_management_loop(i)}, 0);
}
###############################
# watchdog loop for debugging
@ -1374,12 +1512,22 @@ var hp_to_inhg = 1.0/inhg_to_hp;
var lon_to_m = 0.0; #local_weather.lon_to_m;
var m_to_lon = 0.0; # local_weather.m_to_lon;
var lw = "/local-weather/";
var cloud_shadow_flag = 0;
var cloud_view_distance = getprop(lw~"config/clouds-visible-range-m");
var modelArrays = [];
var active_tile_list = [];
# a bunch of variables to be updated per frame used by different
# routines, managed by the housekeeping loop
var lwObserverLat = 0.0;
var lwObserverLon = 0.0;
var lwViewDir = 0.0;
var lwViewVec = [];
var lwTileIndex = 0;
#####################################################
# hashes to manage clouds in scenery or in the buffer
@ -1442,6 +1590,24 @@ var cloudImpostor = {
};
var cloudShadowArray = [];
var cloudShadowCandidateArray = [];
var cloudShadowArraySize = 20;
var cloudShadowMaxDist = 100000.0;
var cloudShadowMinIndex = -1;
var cloudShadow = {
new: func (lat, lon, size, strength) {
var s = {parents: [cloudShadow] };
s.lat = lat;
s.lon = lon;
s.size = size;
s.strength = strength;
s.shadow_flag = 0;
return s;
},
};
var cloudSceneryArray = [];
var n_cloudSceneryArray = 0;

View file

@ -4257,6 +4257,27 @@ else
}
if (local_weather.cloud_shadow_flag == 1)
{
var cs = local_weather.cloudShadow.new(lat+get_lat(x,y+6000,phi), lon+get_lon(x,y+6000,phi) , 0.9 , 0.9);
cs.index = getprop(lw~"tiles/tile-counter");
append(cloudShadowCandidateArray,cs);
cs = local_weather.cloudShadow.new(lat+get_lat(x,y-6000,phi), lon+get_lon(x,y-6000,phi) , 0.9 , 0.9);
cs.index = getprop(lw~"tiles/tile-counter");
append(cloudShadowCandidateArray,cs);
cs = local_weather.cloudShadow.new(lat+get_lat(x,y-3000,phi), lon+get_lon(x,y-3000,phi) , 0.9 , 0.9);
cs.index = getprop(lw~"tiles/tile-counter");
append(cloudShadowCandidateArray,cs);
cs = local_weather.cloudShadow.new(lat+get_lat(x,y+3000,phi), lon+get_lon(x,y+3000,phi) , 0.9 , 0.9);
cs.index = getprop(lw~"tiles/tile-counter");
append(cloudShadowCandidateArray,cs);
}
}

View file

@ -0,0 +1,138 @@
#version 120
uniform float cloudpos1_x;
uniform float cloudpos1_y;
uniform float cloudpos2_x;
uniform float cloudpos2_y;
uniform float cloudpos3_x;
uniform float cloudpos3_y;
uniform float cloudpos4_x;
uniform float cloudpos4_y;
uniform float cloudpos5_x;
uniform float cloudpos5_y;
uniform float cloudpos6_x;
uniform float cloudpos6_y;
uniform float cloudpos7_x;
uniform float cloudpos7_y;
uniform float cloudpos8_x;
uniform float cloudpos8_y;
uniform float cloudpos9_x;
uniform float cloudpos9_y;
uniform float cloudpos10_x;
uniform float cloudpos10_y;
uniform float cloudpos11_x;
uniform float cloudpos11_y;
uniform float cloudpos12_x;
uniform float cloudpos12_y;
uniform float cloudpos13_x;
uniform float cloudpos13_y;
uniform float cloudpos14_x;
uniform float cloudpos14_y;
uniform float cloudpos15_x;
uniform float cloudpos15_y;
uniform float cloudpos16_x;
uniform float cloudpos16_y;
uniform float cloudpos17_x;
uniform float cloudpos17_y;
uniform float cloudpos18_x;
uniform float cloudpos18_y;
uniform float cloudpos19_x;
uniform float cloudpos19_y;
uniform float cloudpos20_x;
uniform float cloudpos20_y;
float shadow_func (in float x, in float y, in float noise, in float dist)
{
if (dist > 30000.0) {return 1.0;}
float width = fract((cloudpos1_x)) * 5000.0;
float strength = fract((cloudpos1_y));
float dlength = length( vec2 (x - cloudpos1_x, y - cloudpos1_y));
float shadeValue = strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos2_x, y - cloudpos2_y));
width = fract((cloudpos2_x)) * 5000.0; strength = fract((cloudpos2_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos3_x, y - cloudpos3_y));
width = fract((cloudpos3_x)) * 5000.0; strength = fract((cloudpos3_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos4_x, y - cloudpos4_y));
width = fract((cloudpos4_x)) * 5000.0; strength = fract((cloudpos4_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos5_x, y - cloudpos5_y));
width = fract((cloudpos5_x)) * 5000.0; strength = fract((cloudpos5_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos6_x, y - cloudpos6_y));
width = fract((cloudpos6_x)) * 5000.0; strength = fract((cloudpos6_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos7_x, y - cloudpos7_y));
width = fract((cloudpos7_x)) * 5000.0; strength = fract((cloudpos7_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos8_x, y - cloudpos8_y));
width = fract((cloudpos8_x)) * 5000.0; strength = fract((cloudpos8_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos9_x, y - cloudpos9_y));
width = fract((cloudpos9_x)) * 5000.0; strength = fract((cloudpos9_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos10_x, y - cloudpos10_y));
width = fract((cloudpos10_x)) * 5000.0; strength = fract((cloudpos10_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos11_x, y - cloudpos11_y));
width = fract((cloudpos11_x)) * 5000.0; strength = fract((cloudpos11_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos12_x, y - cloudpos12_y));
width = fract((cloudpos12_x)) * 5000.0; strength = fract((cloudpos12_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos13_x, y - cloudpos13_y));
width = fract((cloudpos13_x)) * 5000.0; strength = fract((cloudpos13_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos14_x, y - cloudpos14_y));
width = fract((cloudpos14_x)) * 5000.0; strength = fract((cloudpos14_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos15_x, y - cloudpos15_y));
width = fract((cloudpos15_x)) * 5000.0; strength = fract((cloudpos15_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos16_x, y - cloudpos16_y));
width = fract((cloudpos16_x)) * 5000.0; strength = fract((cloudpos16_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos17_x, y - cloudpos17_y));
width = fract((cloudpos17_x)) * 5000.0; strength = fract((cloudpos17_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos18_x, y - cloudpos18_y));
width = fract((cloudpos18_x)) * 5000.0; strength = fract((cloudpos18_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos19_x, y - cloudpos19_y));
width = fract((cloudpos19_x)) * 5000.0; strength = fract((cloudpos19_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
dlength = length ( vec2 (x - cloudpos20_x, y - cloudpos20_y));
width = fract((cloudpos20_x)) * 5000.0; strength = fract((cloudpos20_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength));
shadeValue = clamp(shadeValue * (0.5 + 2.0 * noise),0.0,1.0);
shadeValue = shadeValue * (1.0 - smoothstep(15000.0, 30000.0,dist));
//shadeValue = clamp(shadeValue * (0.5 + 0.5 * noise),0.0,1.0);
return 1.0 - shadeValue;// exp(- (dlength * dlength)/(width*width));
}

View file

@ -41,7 +41,7 @@ else
}
float light_sprite (in vec2 coord, in float transmission)
vec4 light_sprite (in vec2 coord, in float transmission)
{
coord.s = coord.s - 0.5;

View file

@ -54,9 +54,11 @@ uniform float dust_resistance;
uniform float WindE;
uniform float WindN;
uniform float osg_SimulationTime;
uniform int quality_level;
uniform int tquality_level;
uniform int wind_effects;
uniform int cloud_shadow_flag;
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@ -66,7 +68,7 @@ float eShade;
float yprime_alt;
float mie_angle;
float shadow_func (in float x, in float y, in float noise, in float dist);
float rand2D(in vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
@ -548,6 +550,7 @@ if ((dist < 5000.0)&& (quality_level > 3) && (combined_wetness>0.0))
NdotL = NdotL + (1.0-snow_mix_factor) * 0.3* dot_texel.a * (0.5* dotnoisegrad_10m * detail_fade(1.0 * dot_size, view_angle, dist) +0.5 * dotnoisegrad_10m * noise_01m * detail_fade(0.1, view_angle, dist)) ;
if (NdotL > 0.0) {
if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 0.3 * noise_250m + 0.5 * noise_500m+0.2 * noise_1500m, dist);}
color += diffuse_term * NdotL;
NdotHV = max(dot(n, halfVector), 0.0);
if (gl_FrontMaterial.shininess > 0.0)

View file

@ -507,7 +507,7 @@ void main(void)
specular_light = gl_Color.rgb;
specular_light = gl_Color.rgb * earthShade;
vec3 specular_color = vec3(specular_light)
@ -525,7 +525,7 @@ void main(void)
vec4 ambient_light;
//intensity = length(specular_light.rgb);
ambient_light.rgb = max(specular_light.rgb, vec3(0.1, 0.1, 0.1));
ambient_light.rgb = max(specular_light.rgb, vec3(0.05, 0.05, 0.05));
//ambient_light.rgb = max(intensity * normalize(vec3 (0.33, 0.4, 0.5)), vec3 (0.1,0.1,0.1));
ambient_light.a = 1.0;

View file

@ -407,7 +407,7 @@ void main(void)
vec4 ambient_light;
//intensity = length(specular_light.rgb);
ambient_light.rgb = max(specular_light.rgb, vec3(0.1, 0.1, 0.1));
ambient_light.rgb = max(specular_light.rgb, vec3(0.05, 0.05, 0.05));
//ambient_light.rgb = max(intensity * normalize(vec3 (0.33, 0.4, 0.5)), vec3 (0.1,0.1,0.1));
ambient_light.a = 1.0;