1
0
Fork 0

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

This commit is contained in:
BARANGER Emmanuel 2012-08-01 15:23:20 +02:00
commit a24021a33f
13 changed files with 68 additions and 64 deletions

View file

@ -15,11 +15,13 @@ void main() {
// Position and scaling
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;
float sr = sin(gl_FogCoord);
float cr = cos(gl_FogCoord);
float sr = sin(gl_FogCoord + gl_Color.x);
float cr = cos(gl_FogCoord + gl_Color.x);
// Rotation of the generic quad to specific one for the tree.
position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr)));
// Move to correct location (stored in gl_Color)
position = position + gl_Color.xyz;
gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0);

View file

@ -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;
//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)
+ pow(abs(rel_wind_speed_from_north_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.0));
//calculate the relative wind direction
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;
float relWindspd=0;
float relWinddir=0;
float relWindspd=0.0;
float relWinddir=0.0;
// compute relative wind speed and direction
relWind (relWindspd, relWinddir);
@ -93,9 +93,9 @@ void main()
vec4 pos = 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.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;

View file

@ -28,9 +28,6 @@ varying float earthShade;
varying float yprime_alt;
varying float mie_angle;
uniform int colorMode;
uniform float hazeLayerAltitude;
uniform float terminator;
@ -41,7 +38,6 @@ uniform float overcast;
//uniform float scattering;
uniform float ground_scattering;
// This is the value used in the skydome scattering shader - use the same here for consistency?
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@ -75,8 +71,12 @@ void main()
float numVarieties = gl_Normal.z;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
float sr = sin(gl_FogCoord);
float cr = cos(gl_FogCoord);
// Determine the rotation for the tree. The Fog Coordinate provides rotation information
// to rotate one of the quands by 90 degrees. We then apply an additional position seed
// so that trees aren't all oriented N/S
float sr = sin(gl_FogCoord + gl_Color.x);
float cr = cos(gl_FogCoord + gl_Color.x);
gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0);
// scaling
@ -84,6 +84,8 @@ void main()
// Rotation of the generic quad to specific one for the tree.
position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr)));
// Move to correct location (stored in gl_Color)
position = position + gl_Color.xyz;
gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0);

View file

@ -76,7 +76,7 @@ void main (void)
//vec3 ambient = fg_SunAmbientColor.rgb;
vec3 N;
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 ) );
float pf;

View file

@ -86,10 +86,10 @@ void main(void)
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
} else {
// hack to allow for Overcast not to be set by Local Weather
if (Overcast == 0){
cover = 5;
if (Overcast == 0.0){
cover = 5.0;
} else {
cover = Overcast * 5;
cover = Overcast * 5.0;
}
}
@ -207,5 +207,5 @@ void main(void)
vec3( 0.3, 0.59, 0.11 )
);
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);
}

View file

@ -48,7 +48,7 @@ void main(void)
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) {
Angle = 0.0;

View file

@ -94,10 +94,10 @@ void main(void)
cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4);
} else {
// hack to allow for Overcast not to be set by Local Weather
if (Overcast == 0){
cover = 5;
if (Overcast == 0.0){
cover = 5.0;
} else {
cover = Overcast * 5;
cover = Overcast * 5.0;
}
}

View file

@ -1,9 +1,9 @@
// This shader is mostly an adaptation of the shader found at
// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion
// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10
// © Michael Horsch - 2005
// Michael Horsch - 2005
// Major update and revisions - 2011-10-07
// © Emilian Huminiuc and Vivian Meazza
// Emilian Huminiuc and Vivian Meazza
#version 120
@ -39,7 +39,7 @@ void main(void)
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) {
Angle = 0.0;

View file

@ -115,7 +115,7 @@ void sumWaves(float angle, float dangle, float windScale, float factor, out floa
{
mat4 RotationMatrix;
float deriv;
vec4 P = waterTex1 * 1024;
vec4 P = waterTex1 * 1024.0;
rotationmatrix(radians(angle + dangle * windScale + 0.6 * sin(P.x * factor)), RotationMatrix);
P *= RotationMatrix;
@ -239,17 +239,17 @@ void main(void)
wave0.amp = WaveAmp;
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 45;
angle -= 45.0;
wave1.freq = WaveFreq * 2.0 ;
wave1.amp = WaveAmp * 1.25;
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle += 30;
angle += 30.0;
wave2.freq = WaveFreq * 3.5;
wave2.amp = WaveAmp * 0.75;
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 50;
angle -= 50.0;
wave3.freq = WaveFreq * 3.0 ;
wave3.amp = WaveAmp * 0.75;
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
@ -270,17 +270,17 @@ void main(void)
wave0.amp = waveamp;
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 20;
angle -= 20.0;
wave1.freq = WaveFreq * 2.0 ;
wave1.amp = waveamp * 1.25;
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle += 35;
angle += 35.0;
wave2.freq = WaveFreq * 3.5;
wave2.amp = waveamp * 0.75;
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 45;
angle -= 45.0;
wave3.freq = WaveFreq * 3.0 ;
wave3.amp = waveamp * 0.75;
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));

View file

@ -83,7 +83,7 @@ void main(void)
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) {
Angle = 0.0;
}else{

View file

@ -97,7 +97,7 @@ float evaluateWaveSharp(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)
@ -192,17 +192,17 @@ void main(void)
wave0.amp = WaveAmp ;
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
angle -= 45 ;
angle -= 45.0 ;
wave1.freq = WaveFreq * 2.0 ;
wave1.amp = WaveAmp * 1.25 ;
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
angle += 30;
angle += 30.0;
wave2.freq = WaveFreq * 3.5 ;
wave2.amp = WaveAmp * 0.75 ;
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
angle -= 50 ;
angle -= 50.0 ;
wave3.freq = WaveFreq * 3.0 ;
wave3.amp = WaveAmp * 0.75 ;
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
@ -223,17 +223,17 @@ void main(void)
wave0.amp = waveamp ;
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
angle -= 20 ;
angle -= 20.0 ;
wave1.freq = WaveFreq * 2.0 ;
wave1.amp = waveamp * 1.25 ;
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
angle += 35 ;
angle += 35.0 ;
wave2.freq = WaveFreq * 3.5 ;
wave2.amp = waveamp * 0.75 ;
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))) ;
angle -= 45 ;
angle -= 45.0 ;
wave3.freq = WaveFreq * 3.0 ;
wave3.amp = waveamp * 0.75 ;
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) ;
} else {
// hack to allow for Overcast not to be set by Local Weather
if (Overcast == 0){
cover = 5;
if (Overcast == 0.0){
cover = 5.0;
} else {
cover = Overcast * 5;
cover = Overcast * 5.0;
}
}

View file

@ -90,7 +90,7 @@ float evaluateWaveSharp(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)
@ -173,7 +173,7 @@ void main(void)
//uncomment to test
//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 ddx1 = 0.0, ddy1 = 0.0;
@ -187,17 +187,17 @@ void main(void)
wave0.amp = WaveAmp;
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 45;
angle -= 45.0;
wave1.freq = WaveFreq * 2.0 ;
wave1.amp = WaveAmp * 1.25;
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle += 30;
angle += 30.0;
wave2.freq = WaveFreq * 3.5;
wave2.amp = WaveAmp * 0.75;
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 50;
angle -= 50.0;
wave3.freq = WaveFreq * 3.0 ;
wave3.amp = WaveAmp * 0.75;
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));
@ -218,17 +218,17 @@ void main(void)
wave0.amp = waveamp;
wave0.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 20;
angle -= 20.0;
wave1.freq = WaveFreq * 2.0 ;
wave1.amp = waveamp * 1.25;
wave1.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle += 35;
angle += 35.0;
wave2.freq = WaveFreq * 3.5;
wave2.amp = waveamp * 0.75;
wave2.dir = vec2(cos(radians(angle)), sin(radians(angle)));
angle -= 45;
angle -= 45.0;
wave3.freq = WaveFreq * 3.0 ;
wave3.amp = waveamp * 0.75;
wave3.dir = vec2(cos(radians(angle)), sin(radians(angle)));

View file

@ -86,7 +86,7 @@
i = 0;
foreach (var park; a.parking()) {
parking.getNode("value[" ~ i ~ "]", 1).setValue(park);
parking.getNode("value[" ~ i ~ "]", 1).setValue(park.name);
i += 1;
}