Cleanup some implicit casts
Signed-off-by: Emilian Huminiuc <emilianh@gmail.com>
This commit is contained in:
parent
be5629752b
commit
e67d04ead9
10 changed files with 55 additions and 55 deletions
|
@ -56,8 +56,8 @@ void relWind(out float rel_wind_speed_kts, out float rel_wind_from_rad)
|
||||||
float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts;
|
float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts;
|
||||||
|
|
||||||
//combine relative speeds north and east to get relative windspeed in kts
|
//combine relative speeds north and east to get relative windspeed in kts
|
||||||
rel_wind_speed_kts = sqrt(pow(abs(rel_wind_speed_from_east_kts), 2)
|
rel_wind_speed_kts = sqrt(pow(abs(rel_wind_speed_from_east_kts), 2.0)
|
||||||
+ pow(abs(rel_wind_speed_from_north_kts), 2));
|
+ pow(abs(rel_wind_speed_from_north_kts), 2.0));
|
||||||
|
|
||||||
//calculate the relative wind direction
|
//calculate the relative wind direction
|
||||||
float rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts));
|
float rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts));
|
||||||
|
@ -79,8 +79,8 @@ void main()
|
||||||
{
|
{
|
||||||
mat4 RotationMatrix;
|
mat4 RotationMatrix;
|
||||||
|
|
||||||
float relWindspd=0;
|
float relWindspd=0.0;
|
||||||
float relWinddir=0;
|
float relWinddir=0.0;
|
||||||
|
|
||||||
// compute relative wind speed and direction
|
// compute relative wind speed and direction
|
||||||
relWind (relWindspd, relWinddir);
|
relWind (relWindspd, relWinddir);
|
||||||
|
@ -93,9 +93,9 @@ void main()
|
||||||
vec4 pos = gl_Vertex;
|
vec4 pos = gl_Vertex;
|
||||||
vec4 oldpos = gl_Vertex;
|
vec4 oldpos = gl_Vertex;
|
||||||
|
|
||||||
float freq = (10 * relWindspd) + 10;
|
float freq = (10.0 * relWindspd) + 10.0;
|
||||||
pos.y = sin((pos.x * 5.0 + tsec * freq )/5.0) * 0.5 ;
|
pos.y = sin((pos.x * 5.0 + tsec * freq )/5.0) * 0.5 ;
|
||||||
pos.y += sin((pos.z * 5.0 + tsec * freq/2)/5.0) * 0.125 ;
|
pos.y += sin((pos.z * 5.0 + tsec * freq/2.0)/5.0) * 0.125 ;
|
||||||
|
|
||||||
pos.y *= pow(pos.x - Offset, 2.0) * AmpFactor;
|
pos.y *= pow(pos.x - Offset, 2.0) * AmpFactor;
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ void main (void)
|
||||||
//vec3 ambient = fg_SunAmbientColor.rgb;
|
//vec3 ambient = fg_SunAmbientColor.rgb;
|
||||||
vec3 N;
|
vec3 N;
|
||||||
vec3 dotN;
|
vec3 dotN;
|
||||||
float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb + gl_FrontMaterial.emission,
|
float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb + gl_FrontMaterial.emission.rgb,
|
||||||
vec3( 0.3, 0.59, 0.11 ) );
|
vec3( 0.3, 0.59, 0.11 ) );
|
||||||
float pf;
|
float pf;
|
||||||
|
|
||||||
|
|
|
@ -86,10 +86,10 @@ void main(void)
|
||||||
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
|
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
|
||||||
} else {
|
} else {
|
||||||
// hack to allow for Overcast not to be set by Local Weather
|
// hack to allow for Overcast not to be set by Local Weather
|
||||||
if (Overcast == 0){
|
if (Overcast == 0.0){
|
||||||
cover = 5;
|
cover = 5.0;
|
||||||
} else {
|
} else {
|
||||||
cover = Overcast * 5;
|
cover = Overcast * 5.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,5 +207,5 @@ void main(void)
|
||||||
vec3( 0.3, 0.59, 0.11 )
|
vec3( 0.3, 0.59, 0.11 )
|
||||||
);
|
);
|
||||||
float specular = smoothstep(0.0, 3.5, cover);
|
float specular = smoothstep(0.0, 3.5, cover);
|
||||||
encode_gbuffer(Normal, finalColor.rgb, 254, specular, 128, emission, gl_FragCoord.z);
|
encode_gbuffer(Normal, finalColor.rgb, 254, specular, 128.0, emission, gl_FragCoord.z);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ void main(void)
|
||||||
|
|
||||||
float Angle;
|
float Angle;
|
||||||
|
|
||||||
float windFactor = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.05;
|
float windFactor = sqrt(WindE * WindE + WindN * WindN) * 0.05;
|
||||||
|
|
||||||
if (WindN == 0.0 && WindE == 0.0) {
|
if (WindN == 0.0 && WindE == 0.0) {
|
||||||
Angle = 0.0;
|
Angle = 0.0;
|
||||||
|
|
|
@ -94,10 +94,10 @@ void main(void)
|
||||||
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
|
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
|
||||||
} else {
|
} else {
|
||||||
// hack to allow for Overcast not to be set by Local Weather
|
// hack to allow for Overcast not to be set by Local Weather
|
||||||
if (Overcast == 0){
|
if (Overcast == 0.0){
|
||||||
cover = 5;
|
cover = 5.0;
|
||||||
} else {
|
} else {
|
||||||
cover = Overcast * 5;
|
cover = Overcast * 5.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// This shader is mostly an adaptation of the shader found at
|
// This shader is mostly an adaptation of the shader found at
|
||||||
// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion
|
// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion
|
||||||
// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10
|
// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10
|
||||||
// © Michael Horsch - 2005
|
// Michael Horsch - 2005
|
||||||
// Major update and revisions - 2011-10-07
|
// Major update and revisions - 2011-10-07
|
||||||
// © Emilian Huminiuc and Vivian Meazza
|
// Emilian Huminiuc and Vivian Meazza
|
||||||
|
|
||||||
#version 120
|
#version 120
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ void main(void)
|
||||||
|
|
||||||
float Angle;
|
float Angle;
|
||||||
|
|
||||||
float windFactor = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.05;
|
float windFactor = sqrt(WindE * WindE + WindN * WindN) * 0.05;
|
||||||
|
|
||||||
if (WindN == 0.0 && WindE == 0.0) {
|
if (WindN == 0.0 && WindE == 0.0) {
|
||||||
Angle = 0.0;
|
Angle = 0.0;
|
||||||
|
|
|
@ -115,7 +115,7 @@ void sumWaves(float angle, float dangle, float windScale, float factor, out floa
|
||||||
{
|
{
|
||||||
mat4 RotationMatrix;
|
mat4 RotationMatrix;
|
||||||
float deriv;
|
float deriv;
|
||||||
vec4 P = waterTex1 * 1024;
|
vec4 P = waterTex1 * 1024.0;
|
||||||
|
|
||||||
rotationmatrix(radians(angle + dangle * windScale + 0.6 * sin(P.x * factor)), RotationMatrix);
|
rotationmatrix(radians(angle + dangle * windScale + 0.6 * sin(P.x * factor)), RotationMatrix);
|
||||||
P *= RotationMatrix;
|
P *= RotationMatrix;
|
||||||
|
@ -239,17 +239,17 @@ void main(void)
|
||||||
wave0.amp = WaveAmp;
|
wave0.amp = WaveAmp;
|
||||||
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle -= 45;
|
angle -= 45.0;
|
||||||
wave1.freq = WaveFreq * 2.0 ;
|
wave1.freq = WaveFreq * 2.0 ;
|
||||||
wave1.amp = WaveAmp * 1.25;
|
wave1.amp = WaveAmp * 1.25;
|
||||||
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle += 30;
|
angle += 30.0;
|
||||||
wave2.freq = WaveFreq * 3.5;
|
wave2.freq = WaveFreq * 3.5;
|
||||||
wave2.amp = WaveAmp * 0.75;
|
wave2.amp = WaveAmp * 0.75;
|
||||||
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle -= 50;
|
angle -= 50.0;
|
||||||
wave3.freq = WaveFreq * 3.0 ;
|
wave3.freq = WaveFreq * 3.0 ;
|
||||||
wave3.amp = WaveAmp * 0.75;
|
wave3.amp = WaveAmp * 0.75;
|
||||||
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
@ -270,17 +270,17 @@ void main(void)
|
||||||
wave0.amp = waveamp;
|
wave0.amp = waveamp;
|
||||||
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle -= 20;
|
angle -= 20.0;
|
||||||
wave1.freq = WaveFreq * 2.0 ;
|
wave1.freq = WaveFreq * 2.0 ;
|
||||||
wave1.amp = waveamp * 1.25;
|
wave1.amp = waveamp * 1.25;
|
||||||
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle += 35;
|
angle += 35.0;
|
||||||
wave2.freq = WaveFreq * 3.5;
|
wave2.freq = WaveFreq * 3.5;
|
||||||
wave2.amp = waveamp * 0.75;
|
wave2.amp = waveamp * 0.75;
|
||||||
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle -= 45;
|
angle -= 45.0;
|
||||||
wave3.freq = WaveFreq * 3.0 ;
|
wave3.freq = WaveFreq * 3.0 ;
|
||||||
wave3.amp = waveamp * 0.75;
|
wave3.amp = waveamp * 0.75;
|
||||||
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
|
@ -27,7 +27,7 @@ uniform float WindE, WindN;
|
||||||
|
|
||||||
uniform float hazeLayerAltitude;
|
uniform float hazeLayerAltitude;
|
||||||
uniform float terminator;
|
uniform float terminator;
|
||||||
uniform float terrain_alt;
|
uniform float terrain_alt;
|
||||||
uniform float avisibility;
|
uniform float avisibility;
|
||||||
uniform float visibility;
|
uniform float visibility;
|
||||||
uniform float overcast;
|
uniform float overcast;
|
||||||
|
@ -83,7 +83,7 @@ void main(void)
|
||||||
|
|
||||||
float Angle;
|
float Angle;
|
||||||
|
|
||||||
float windFactor = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.05;
|
float windFactor = sqrt(WindE * WindE + WindN * WindN) * 0.05;
|
||||||
if (WindN == 0.0 && WindE == 0.0) {
|
if (WindN == 0.0 && WindE == 0.0) {
|
||||||
Angle = 0.0;
|
Angle = 0.0;
|
||||||
}else{
|
}else{
|
||||||
|
@ -114,32 +114,32 @@ void main(void)
|
||||||
|
|
||||||
// first current altitude of eye position in model space
|
// first current altitude of eye position in model space
|
||||||
vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0);
|
vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0);
|
||||||
|
|
||||||
// and relative position to vector
|
// and relative position to vector
|
||||||
relPos = gl_Vertex.xyz - ep.xyz;
|
relPos = gl_Vertex.xyz - ep.xyz;
|
||||||
|
|
||||||
// unfortunately, we need the distance in the vertex shader, although the more accurate version
|
// unfortunately, we need the distance in the vertex shader, although the more accurate version
|
||||||
// is later computed in the fragment shader again
|
// is later computed in the fragment shader again
|
||||||
float dist = length(relPos);
|
float dist = length(relPos);
|
||||||
|
|
||||||
|
|
||||||
// altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m
|
// altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m
|
||||||
vertex_alt = max(gl_Vertex.z,100.0);
|
vertex_alt = max(gl_Vertex.z,100.0);
|
||||||
scattering = 0.5 + 0.5 * ground_scattering + 0.5* (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt);
|
scattering = 0.5 + 0.5 * ground_scattering + 0.5* (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt);
|
||||||
|
|
||||||
// branch dependent on daytime
|
// branch dependent on daytime
|
||||||
|
|
||||||
if (terminator < 1000000.0) // the full, sunrise and sunset computation
|
if (terminator < 1000000.0) // the full, sunrise and sunset computation
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// establish coordinates relative to sun position
|
// establish coordinates relative to sun position
|
||||||
|
|
||||||
//vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz;
|
//vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz;
|
||||||
//vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0));
|
//vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0));
|
||||||
vec3 lightHorizon = normalize(vec3(lightdir.x,lightdir.y, 0.0));
|
vec3 lightHorizon = normalize(vec3(lightdir.x,lightdir.y, 0.0));
|
||||||
|
|
||||||
|
|
||||||
// yprime is the distance of the vertex into sun direction
|
// yprime is the distance of the vertex into sun direction
|
||||||
yprime = -dot(relPos, lightHorizon);
|
yprime = -dot(relPos, lightHorizon);
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ if (terminator < 1000000.0) // the full, sunrise and sunset computation
|
||||||
// two times terminator width governs how quickly light fades into shadow
|
// two times terminator width governs how quickly light fades into shadow
|
||||||
// now the light-dimming factor
|
// now the light-dimming factor
|
||||||
earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4;
|
earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4;
|
||||||
|
|
||||||
// parametrized version of the Flightgear ground lighting function
|
// parametrized version of the Flightgear ground lighting function
|
||||||
lightArg = (terminator-yprime_alt)/100000.0;
|
lightArg = (terminator-yprime_alt)/100000.0;
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ if (terminator < 1000000.0) // the full, sunrise and sunset computation
|
||||||
// correct ambient light intensity and hue before sunrise
|
// correct ambient light intensity and hue before sunrise
|
||||||
if (earthShade < 0.5)
|
if (earthShade < 0.5)
|
||||||
{
|
{
|
||||||
intensity = length(specular_light.rgb);
|
intensity = length(specular_light.rgb);
|
||||||
specular_light.xyz = intensity * normalize(mix(specular_light.xyz, vec3 (0.45, 0.6, 0.8), 1.0 -smoothstep(0.1, 0.5,earthShade) ));
|
specular_light.xyz = intensity * normalize(mix(specular_light.xyz, vec3 (0.45, 0.6, 0.8), 1.0 -smoothstep(0.1, 0.5,earthShade) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ if (terminator < 1000000.0) // the full, sunrise and sunset computation
|
||||||
if (lightArg < 5.0)
|
if (lightArg < 5.0)
|
||||||
//{mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;}
|
//{mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;}
|
||||||
{mie_angle = (0.5 * dot(normalize(relPos), lightdir) ) + 0.5;}
|
{mie_angle = (0.5 * dot(normalize(relPos), lightdir) ) + 0.5;}
|
||||||
else
|
else
|
||||||
{mie_angle = 1.0;}
|
{mie_angle = 1.0;}
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ else
|
||||||
else // the faster, full-day version without lightfields
|
else // the faster, full-day version without lightfields
|
||||||
{
|
{
|
||||||
//vertex_alt = max(gl_Vertex.z,100.0);
|
//vertex_alt = max(gl_Vertex.z,100.0);
|
||||||
|
|
||||||
earthShade = 1.0;
|
earthShade = 1.0;
|
||||||
mie_angle = 1.0;
|
mie_angle = 1.0;
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ else // the faster, full-day version without lightfields
|
||||||
specular_light.g = 0.907 + lightArg * 0.091;
|
specular_light.g = 0.907 + lightArg * 0.091;
|
||||||
specular_light.r = 0.904 + lightArg * 0.092;
|
specular_light.r = 0.904 + lightArg * 0.092;
|
||||||
}
|
}
|
||||||
|
|
||||||
specular_light = specular_light * scattering;
|
specular_light = specular_light * scattering;
|
||||||
|
|
||||||
yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude);
|
yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude);
|
||||||
|
|
|
@ -97,7 +97,7 @@ float evaluateWaveSharp(Wave w, vec2 pos, float t, float k)
|
||||||
|
|
||||||
float evaluateWaveDerivSharp(Wave w, vec2 pos, float t, float k)
|
float evaluateWaveDerivSharp(Wave w, vec2 pos, float t, float k)
|
||||||
{
|
{
|
||||||
return k*w.freq*w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k - 1) * cos( dot(w.dir, pos)*w.freq + t*w.phase) ;
|
return k*w.freq*w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k - 1.0) * cos( dot(w.dir, pos)*w.freq + t*w.phase) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sumWaves(float angle, float dangle, float windScale, float factor, out float ddx, float ddy)
|
void sumWaves(float angle, float dangle, float windScale, float factor, out float ddx, float ddy)
|
||||||
|
@ -192,17 +192,17 @@ void main(void)
|
||||||
wave0.amp = WaveAmp ;
|
wave0.amp = WaveAmp ;
|
||||||
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
||||||
|
|
||||||
angle -= 45 ;
|
angle -= 45.0 ;
|
||||||
wave1.freq = WaveFreq * 2.0 ;
|
wave1.freq = WaveFreq * 2.0 ;
|
||||||
wave1.amp = WaveAmp * 1.25 ;
|
wave1.amp = WaveAmp * 1.25 ;
|
||||||
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
||||||
|
|
||||||
angle += 30;
|
angle += 30.0;
|
||||||
wave2.freq = WaveFreq * 3.5 ;
|
wave2.freq = WaveFreq * 3.5 ;
|
||||||
wave2.amp = WaveAmp * 0.75 ;
|
wave2.amp = WaveAmp * 0.75 ;
|
||||||
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
||||||
|
|
||||||
angle -= 50 ;
|
angle -= 50.0 ;
|
||||||
wave3.freq = WaveFreq * 3.0 ;
|
wave3.freq = WaveFreq * 3.0 ;
|
||||||
wave3.amp = WaveAmp * 0.75 ;
|
wave3.amp = WaveAmp * 0.75 ;
|
||||||
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
||||||
|
@ -223,17 +223,17 @@ void main(void)
|
||||||
wave0.amp = waveamp ;
|
wave0.amp = waveamp ;
|
||||||
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
||||||
|
|
||||||
angle -= 20 ;
|
angle -= 20.0 ;
|
||||||
wave1.freq = WaveFreq * 2.0 ;
|
wave1.freq = WaveFreq * 2.0 ;
|
||||||
wave1.amp = waveamp * 1.25 ;
|
wave1.amp = waveamp * 1.25 ;
|
||||||
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
||||||
|
|
||||||
angle += 35 ;
|
angle += 35.0 ;
|
||||||
wave2.freq = WaveFreq * 3.5 ;
|
wave2.freq = WaveFreq * 3.5 ;
|
||||||
wave2.amp = waveamp * 0.75 ;
|
wave2.amp = waveamp * 0.75 ;
|
||||||
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
||||||
|
|
||||||
angle -= 45 ;
|
angle -= 45.0 ;
|
||||||
wave3.freq = WaveFreq * 3.0 ;
|
wave3.freq = WaveFreq * 3.0 ;
|
||||||
wave3.amp = waveamp * 0.75 ;
|
wave3.amp = waveamp * 0.75 ;
|
||||||
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
|
||||||
|
@ -259,10 +259,10 @@ void main(void)
|
||||||
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4) ;
|
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4) ;
|
||||||
} else {
|
} else {
|
||||||
// hack to allow for Overcast not to be set by Local Weather
|
// hack to allow for Overcast not to be set by Local Weather
|
||||||
if (Overcast == 0){
|
if (Overcast == 0.0){
|
||||||
cover = 5;
|
cover = 5.0;
|
||||||
} else {
|
} else {
|
||||||
cover = Overcast * 5;
|
cover = Overcast * 5.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ float evaluateWaveSharp(Wave w, vec2 pos, float t, float k)
|
||||||
|
|
||||||
float evaluateWaveDerivSharp(Wave w, vec2 pos, float t, float k)
|
float evaluateWaveDerivSharp(Wave w, vec2 pos, float t, float k)
|
||||||
{
|
{
|
||||||
return k*w.freq*w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k - 1) * cos( dot(w.dir, pos)*w.freq + t*w.phase);
|
return k*w.freq*w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k - 1.0) * cos( dot(w.dir, pos)*w.freq + t*w.phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sumWaves(float angle, float dangle, float windScale, float factor, out float ddx, float ddy)
|
void sumWaves(float angle, float dangle, float windScale, float factor, out float ddx, float ddy)
|
||||||
|
@ -173,7 +173,7 @@ void main(void)
|
||||||
//uncomment to test
|
//uncomment to test
|
||||||
//range = -20000;
|
//range = -20000;
|
||||||
|
|
||||||
if (range > -15000 || dot(Normal,H) > 0.95 ) {
|
if (range > -15000.0 || dot(Normal,H) > 0.95 ) {
|
||||||
|
|
||||||
float ddx = 0.0, ddy = 0.0;
|
float ddx = 0.0, ddy = 0.0;
|
||||||
float ddx1 = 0.0, ddy1 = 0.0;
|
float ddx1 = 0.0, ddy1 = 0.0;
|
||||||
|
@ -187,17 +187,17 @@ void main(void)
|
||||||
wave0.amp = WaveAmp;
|
wave0.amp = WaveAmp;
|
||||||
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle -= 45;
|
angle -= 45.0;
|
||||||
wave1.freq = WaveFreq * 2.0 ;
|
wave1.freq = WaveFreq * 2.0 ;
|
||||||
wave1.amp = WaveAmp * 1.25;
|
wave1.amp = WaveAmp * 1.25;
|
||||||
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle += 30;
|
angle += 30.0;
|
||||||
wave2.freq = WaveFreq * 3.5;
|
wave2.freq = WaveFreq * 3.5;
|
||||||
wave2.amp = WaveAmp * 0.75;
|
wave2.amp = WaveAmp * 0.75;
|
||||||
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle -= 50;
|
angle -= 50.0;
|
||||||
wave3.freq = WaveFreq * 3.0 ;
|
wave3.freq = WaveFreq * 3.0 ;
|
||||||
wave3.amp = WaveAmp * 0.75;
|
wave3.amp = WaveAmp * 0.75;
|
||||||
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
@ -218,17 +218,17 @@ void main(void)
|
||||||
wave0.amp = waveamp;
|
wave0.amp = waveamp;
|
||||||
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle -= 20;
|
angle -= 20.0;
|
||||||
wave1.freq = WaveFreq * 2.0 ;
|
wave1.freq = WaveFreq * 2.0 ;
|
||||||
wave1.amp = waveamp * 1.25;
|
wave1.amp = waveamp * 1.25;
|
||||||
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle += 35;
|
angle += 35.0;
|
||||||
wave2.freq = WaveFreq * 3.5;
|
wave2.freq = WaveFreq * 3.5;
|
||||||
wave2.amp = waveamp * 0.75;
|
wave2.amp = waveamp * 0.75;
|
||||||
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
||||||
angle -= 45;
|
angle -= 45.0;
|
||||||
wave3.freq = WaveFreq * 3.0 ;
|
wave3.freq = WaveFreq * 3.0 ;
|
||||||
wave3.amp = waveamp * 0.75;
|
wave3.amp = waveamp * 0.75;
|
||||||
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
|
||||||
|
|
Loading…
Reference in a new issue