diff --git a/Effects/airfield.eff b/Effects/airfield.eff
index fac761d2e..7efbc8d14 100644
--- a/Effects/airfield.eff
+++ b/Effects/airfield.eff
@@ -23,7 +23,6 @@
1.0
0.0
1.0
- 0
@@ -115,7 +114,7 @@
Shaders/terrain-haze-ultra.vert
- Shaders/airfield.frag
+ Shaders/airfield-ALS.frag
Shaders/cloud-shadowfunc.frag
Shaders/noise.frag
Shaders/hazes.frag
@@ -221,6 +220,21 @@
float
+
+ view_pitch_offset
+ float
+
+
+
+ view_heading_offset
+ float
+
+
+
+ field_of_view
+ float
+
+
cloudpos1_x
float
@@ -441,10 +455,25 @@
int
-
- use_headlight
+
+ use_searchlight
int
-
+
+
+
+ use_landing_light
+ int
+
+
+
+ display_xsize
+ int
+
+
+
+ display_ysize
+ int
+
texture
diff --git a/Effects/runway.eff b/Effects/runway.eff
index a661ddbf9..692bc6bb0 100644
--- a/Effects/runway.eff
+++ b/Effects/runway.eff
@@ -84,7 +84,6 @@
- 0
@@ -161,7 +160,7 @@
Shaders/terrain-haze-ultra.vert
- Shaders/runway-lightfield.frag
+ Shaders/runway-ALS.frag
Shaders/cloud-shadowfunc.frag
Shaders/noise.frag
Shaders/hazes.frag
@@ -262,6 +261,21 @@
float
+
+ view_pitch_offset
+ float
+
+
+
+ view_heading_offset
+ float
+
+
+
+ field_of_view
+ float
+
+
cloudpos1_x
float
@@ -478,9 +492,24 @@
- use_headlight
+ use_searchlight
int
-
+
+
+
+ use_landing_light
+ int
+
+
+
+ display_xsize
+ int
+
+
+
+ display_ysize
+ int
+
texture
diff --git a/Effects/terrain-default.eff b/Effects/terrain-default.eff
index a622eae53..3d0b44996 100644
--- a/Effects/terrain-default.eff
+++ b/Effects/terrain-default.eff
@@ -116,6 +116,13 @@
+
+
+
+
+
+
+
@@ -295,6 +302,7 @@
Shaders/noise.frag
Shaders/cloud-shadowfunc.frag
Shaders/hazes.frag
+ Shaders/secondary_lights.frag
grain_strength
@@ -436,6 +444,21 @@
float
+
+ view_pitch_offset
+ float
+
+
+
+ view_heading_offset
+ float
+
+
+
+ field_of_view
+ float
+
+
cloudpos1_x
float
@@ -646,6 +669,26 @@
float
+
+ use_searchlight
+ int
+
+
+
+ use_landing_light
+ int
+
+
+
+ display_xsize
+ int
+
+
+
+ display_ysize
+ int
+
+
quality_level
int
diff --git a/Shaders/airfield.frag b/Shaders/airfield-ALS.frag
similarity index 98%
rename from Shaders/airfield.frag
rename to Shaders/airfield-ALS.frag
index 8822ee9f9..07f72d3ae 100644
--- a/Shaders/airfield.frag
+++ b/Shaders/airfield-ALS.frag
@@ -38,7 +38,8 @@ uniform int quality_level;
uniform int tquality_level;
uniform int cloud_shadow_flag;
uniform int use_overlay;
-uniform int use_headlight;
+uniform int use_searchlight;
+uniform int use_landing_light;
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@@ -54,7 +55,8 @@ float fog_func (in float targ, in float alt);
float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt);
float alt_factor(in float eye_alt, in float vertex_alt);
vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
-vec3 headlight(in float dist);
+vec3 searchlight(in float dist);
+vec3 landing_light(in float dist);
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
{
@@ -266,9 +268,13 @@ if (quality_level > 3)
- if (use_headlight == 1)
+ if (use_searchlight == 1)
{
- color.rgb += headlight(dist);
+ color.rgb += searchlight(dist);
+ }
+ if (use_landing_light == 1)
+ {
+ color.rgb += landing_light(dist);
}
fragColor = color * texel + specular;
diff --git a/Shaders/runway-lightfield.frag b/Shaders/runway-ALS.frag
similarity index 97%
rename from Shaders/runway-lightfield.frag
rename to Shaders/runway-ALS.frag
index d80b45d3d..21099b7a9 100644
--- a/Shaders/runway-lightfield.frag
+++ b/Shaders/runway-ALS.frag
@@ -35,7 +35,8 @@ uniform float uvstretch;
uniform int quality_level;
uniform int tquality_level;
uniform int cloud_shadow_flag;
-uniform int use_headlight;
+uniform int use_searchlight;
+uniform int use_landing_light;
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@@ -48,8 +49,8 @@ float mie_angle;
float shadow_func (in float x, in float y, in float noise, in float dist);
float Noise2D(in vec2 coord, in float wavelength);
float fog_func (in float targ, in float alt);
-vec3 headlight(in float dist);
-
+vec3 searchlight(in float dist);
+vec3 landing_light(in float dist);
@@ -245,9 +246,13 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0))
// is closer to what the OpenGL fixed function pipeline does.
color = clamp(color, 0.0, 1.0);
- if (use_headlight == 1)
+ if (use_searchlight == 1)
{
- color.rgb += headlight(dist);
+ color.rgb += searchlight(dist);
+ }
+ if (use_landing_light == 1)
+ {
+ color.rgb += landing_light(dist);
}
fragColor = color * texel + specular;
diff --git a/Shaders/secondary_lights.frag b/Shaders/secondary_lights.frag
index 883c1ba18..ce3d72fb1 100644
--- a/Shaders/secondary_lights.frag
+++ b/Shaders/secondary_lights.frag
@@ -1,9 +1,15 @@
// -*-C++-*-
-vec3 headlight(in float dist)
+uniform int display_xsize;
+uniform int display_ysize;
+uniform float field_of_view;
+uniform float view_pitch_offset;
+uniform float view_heading_offset;
+
+vec3 searchlight(in float dist)
{
-vec2 center = vec2 (600.0, 400.0);
+vec2 center = vec2 (float(display_xsize) * 0.5, float(display_ysize) * 0.4);
float angularDist;
float headlightIntensity;
@@ -11,7 +17,39 @@ angularDist = length(gl_FragCoord.xy -center);
if (angularDist <200.0)
{
headlightIntensity = pow(cos(angularDist/200.0 * 3.1415/2.0),2.0);
- headlightIntensity = headlightIntensity * min(1.0, 1000.0/(dist*dist));
+ headlightIntensity = headlightIntensity * min(1.0, 10000.0/(dist*dist));
+ return headlightIntensity * vec3 (0.5,0.5, 0.5);
+ }
+else return vec3 (0.0,0.0,0.0);
+}
+
+vec3 landing_light(in float dist)
+{
+
+float fov_h = field_of_view;
+float fov_v = float(display_ysize)/float(display_xsize) * field_of_view;
+
+float yaw_offset;
+
+if (view_heading_offset > 180.0)
+ {yaw_offset = -360.0+view_heading_offset;}
+else
+ {yaw_offset = view_heading_offset;}
+
+float x_offset = (float(display_xsize) / fov_h * yaw_offset);
+float y_offset = -(float(display_ysize) / fov_v * view_pitch_offset);
+
+vec2 center = vec2 (float(display_xsize) * 0.5 + x_offset, float(display_ysize) * 0.4 + y_offset);
+
+
+float angularDist;
+float headlightIntensity;
+
+angularDist = length(gl_FragCoord.xy -center);
+if (angularDist <200.0)
+ {
+ headlightIntensity = pow(cos(angularDist/200.0 * 3.1415/2.0),2.0);
+ headlightIntensity = headlightIntensity * min(1.0, 10000.0/(dist*dist));
return headlightIntensity * vec3 (0.5,0.5, 0.5);
}
else return vec3 (0.0,0.0,0.0);
diff --git a/Shaders/terrain-haze-ultra.frag b/Shaders/terrain-haze-ultra.frag
index f634bc03c..8c1d273e7 100644
--- a/Shaders/terrain-haze-ultra.frag
+++ b/Shaders/terrain-haze-ultra.frag
@@ -59,6 +59,8 @@ uniform int tquality_level;
uniform int wind_effects;
uniform int cloud_shadow_flag;
uniform int rock_strata;
+uniform int use_searchlight;
+uniform int use_landing_light;
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@@ -78,6 +80,8 @@ float fog_func (in float targ, in float alt);
float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt);
float alt_factor(in float eye_alt, in float vertex_alt);
vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
+vec3 searchlight(in float dist);
+vec3 landing_light(in float dist);
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
{
@@ -456,7 +460,14 @@ if ((dist < 5000.0)&& (quality_level > 3) && (combined_wetness>0.0))
// is closer to what the OpenGL fixed function pipeline does.
color = clamp(color, 0.0, 1.0);
-
+ if (use_searchlight == 1)
+ {
+ color.rgb += searchlight(dist);
+ }
+ if (use_landing_light == 1)
+ {
+ color.rgb += landing_light(dist);
+ }
fragColor = color * texel + specular;
diff --git a/preferences.xml b/preferences.xml
index ef6e49b57..d6562259a 100644
--- a/preferences.xml
+++ b/preferences.xml
@@ -287,6 +287,10 @@ Started September 2000 by David Megginson, david@megginson.com
16
+
+ false
+ false
+
120