Merge branch 'master' of git://gitorious.org/fg/fgdata
This commit is contained in:
commit
2851711b0c
7 changed files with 171 additions and 12 deletions
|
@ -12,6 +12,8 @@
|
|||
# Global API. Automatically selects the right walker for the current view.
|
||||
|
||||
# NOTE: Coordinates are always 3 component lists: [x, y, z].
|
||||
# The coordinate system is the same as the main 3d model one.
|
||||
# X - back, Y - right and Z - up.
|
||||
|
||||
# Set the forward speed of the active walker.
|
||||
# speed - walker speed in m/sec
|
||||
|
@ -39,6 +41,17 @@ var side_step = func (speed) {
|
|||
}
|
||||
}
|
||||
|
||||
# Get the currently active walker.
|
||||
# Returns the active walker object or nil otherwise.
|
||||
var active_walker = func {
|
||||
var cv = view.current.getPath();
|
||||
if (contains(walkers, cv)) {
|
||||
return walkers[cv];
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# The walker class.
|
||||
# ==============================================================================
|
||||
|
@ -77,6 +90,10 @@ var side_step = func (speed) {
|
|||
# [19.5, 0.3, -8.85]);
|
||||
# var walker = walkview.walker.new("Passenger View", constraint);
|
||||
#
|
||||
# NOTES:
|
||||
# Currently there can only be one view manager per view so the
|
||||
# walk view should not have any other view manager.
|
||||
#
|
||||
var walker = {
|
||||
new : func (view_name, constraints = nil) {
|
||||
var obj = { parents : [walker] };
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<write-mask>false</write-mask>
|
||||
</depth>
|
||||
<render-bin>
|
||||
<bin-number>10</bin-number>
|
||||
<bin-number>9</bin-number>
|
||||
<bin-name>DepthSortedBin</bin-name>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
|
|
15
Shaders/contrail.frag
Normal file
15
Shaders/contrail.frag
Normal file
|
@ -0,0 +1,15 @@
|
|||
uniform sampler2D baseTexture;
|
||||
|
||||
varying float fogFactor;
|
||||
varying float distanceFactor;
|
||||
varying vec2 texCoord;
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 base = texture2D( baseTexture, gl_TexCoord[0].st);
|
||||
vec4 finalColor = base * gl_Color;
|
||||
gl_FragColor.rgb = mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor);
|
||||
gl_FragColor.a = mix(0.0, finalColor.a, distanceFactor);
|
||||
}
|
||||
|
99
Shaders/contrail.vert
Normal file
99
Shaders/contrail.vert
Normal file
|
@ -0,0 +1,99 @@
|
|||
// -*-C++-*-
|
||||
#version 120
|
||||
|
||||
varying float fogFactor;
|
||||
varying float distanceFactor;
|
||||
|
||||
uniform sampler3D Noise;
|
||||
|
||||
uniform float scale_x;
|
||||
uniform float scale_y;
|
||||
uniform float scale_z;
|
||||
|
||||
uniform float offset_x;
|
||||
uniform float offset_y;
|
||||
uniform float offset_z;
|
||||
|
||||
uniform float fade_max;
|
||||
uniform float fade_min;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 rawpos = gl_Vertex;
|
||||
|
||||
float shade = 0.9;
|
||||
float cloud_height = 30000.0;
|
||||
|
||||
// map noise vectors
|
||||
vec4 noisevec = texture3D(Noise, rawpos.xyz);
|
||||
float noise0 = (noisevec.r * 2) - 1;
|
||||
float noise1 =(noisevec.g * 2) - 1;
|
||||
vec2 noise2 = noisevec.xy;
|
||||
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
//gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0);
|
||||
vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0);
|
||||
vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0);
|
||||
vec3 u = normalize(ep.xyz - l.xyz);
|
||||
|
||||
// Find a rotation matrix that rotates 1,0,0 into u. u, r and w are
|
||||
// the columns of that matrix.
|
||||
vec3 absu = abs(u);
|
||||
vec3 r = normalize(vec3(-u.y, u.x, 0));
|
||||
vec3 w = cross(u, r);
|
||||
|
||||
// Do the matrix multiplication by [ u r w pos]. Scale
|
||||
// the x component first
|
||||
gl_Position = vec4(gl_Vertex.x * scale_x, 0.0, 0.0, 1.0);
|
||||
gl_Position.xyz += gl_Vertex.x * u;
|
||||
gl_Position.xyz += gl_Vertex.y * r * scale_y;
|
||||
gl_Position.xyz += gl_Vertex.z * w * scale_z;
|
||||
|
||||
// Adjust the position post-rotation and scaling
|
||||
gl_Position.yz -= 3/2;
|
||||
|
||||
// Offset in y and z directions using a random noise factor
|
||||
float offset_Y = (noise0 * offset_y) + offset_y/2;
|
||||
float offset_Z = (noise0 * offset_z) + offset_z/2;
|
||||
|
||||
distanceFactor = 1.0 - clamp(abs(noise0), fade_min, fade_max);
|
||||
// distanceFactor = 0.5;
|
||||
|
||||
gl_Position.y += offset_Y;
|
||||
gl_Position.z += offset_Z;
|
||||
|
||||
gl_Position.xyz += gl_Color.xyz;
|
||||
|
||||
// Determine a lighting normal based on the vertex position from the
|
||||
// center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker.
|
||||
float n = dot(normalize(-gl_LightSource[0].position.xyz),
|
||||
normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));;
|
||||
|
||||
// Determine the position - used for fog and shading calculations
|
||||
vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position);
|
||||
float fogCoord = abs(ecPosition.z);
|
||||
float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height);
|
||||
|
||||
// Final position of the sprite
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
|
||||
|
||||
// Calculate the total offset distance in the yx plane, normalised
|
||||
/*float distance = normalize(sqrt(pow(gl_Position.y, 2) + pow(gl_Position.z, 2)));
|
||||
distanceFactor = 1.0 - clamp(distance, 0.5, 1.0);*/
|
||||
// Determine the shading of the sprite based on its vertical position and position relative to the sun.
|
||||
n = min(smoothstep(-0.5, 0.0, n), fract);
|
||||
|
||||
// Determine the shading based on a mixture from the backlight to the front
|
||||
vec4 backlight = gl_LightSource[0].diffuse * shade;
|
||||
|
||||
gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n);
|
||||
gl_FrontColor += gl_FrontLightModelProduct.sceneColor;
|
||||
|
||||
// As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out.
|
||||
gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1 - smoothstep(30000.0, 40000.0, fogCoord));
|
||||
gl_BackColor = gl_FrontColor;
|
||||
|
||||
// Fog doesn't affect clouds as much as other objects.
|
||||
fogFactor = exp( -gl_Fog.density * fogCoord);
|
||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||
}
|
|
@ -270,6 +270,15 @@
|
|||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<checkbox>
|
||||
<halign>left</halign>
|
||||
<label>Persistent contrails</label>
|
||||
<property>/sim/rendering/contrail-shader</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</checkbox>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
|
|
|
@ -2935,7 +2935,7 @@ Shared parameters for various materials.
|
|||
<r>0.92157</r>
|
||||
<g>0.92157</g>
|
||||
<b>0.76471</b>
|
||||
<a>1</a>
|
||||
<a>1.0</a>
|
||||
</emissive>
|
||||
</material>
|
||||
|
||||
|
@ -2945,7 +2945,7 @@ Shared parameters for various materials.
|
|||
<r>0.92157</r>
|
||||
<g>0.92157</g>
|
||||
<b>0.76471</b>
|
||||
<a>1</a>
|
||||
<a>1.0</a>
|
||||
</emissive>
|
||||
</material>
|
||||
|
||||
|
@ -2955,7 +2955,7 @@ Shared parameters for various materials.
|
|||
<r>0.92157</r>
|
||||
<g>0.92157</g>
|
||||
<b>0.76471</b>
|
||||
<a>1</a>
|
||||
<a>1.0</a>
|
||||
</emissive>
|
||||
</material>
|
||||
|
||||
|
@ -2985,7 +2985,7 @@ Shared parameters for various materials.
|
|||
<r>0.92157</r>
|
||||
<g>0.92157</g>
|
||||
<b>0.76471</b>
|
||||
<a>1</a>
|
||||
<a>1.0</a>
|
||||
</emissive>
|
||||
</material>
|
||||
|
||||
|
@ -2995,7 +2995,7 @@ Shared parameters for various materials.
|
|||
<r>0.92157</r>
|
||||
<g>0.92157</g>
|
||||
<b>0.76471</b>
|
||||
<a>1</a>
|
||||
<a>1.0</a>
|
||||
</emissive>
|
||||
</material>
|
||||
|
||||
|
@ -3005,7 +3005,7 @@ Shared parameters for various materials.
|
|||
<r>0.92157</r>
|
||||
<g>0.84314</g>
|
||||
<b>0.078431</b>
|
||||
<a>1</a>
|
||||
<a>1.0</a>
|
||||
</emissive>
|
||||
</material>
|
||||
|
||||
|
@ -3035,7 +3035,7 @@ Shared parameters for various materials.
|
|||
<r>0.92157</r>
|
||||
<g>0.35294</g>
|
||||
<b>0.35294</b>
|
||||
<a>1</a>
|
||||
<a>1.0</a>
|
||||
</emissive>
|
||||
</material>
|
||||
|
||||
|
@ -3065,7 +3065,7 @@ Shared parameters for various materials.
|
|||
<r>0.078431</r>
|
||||
<g>0.92157</g>
|
||||
<b>0.078431</b>
|
||||
<a>1</a>
|
||||
<a>1.0</a>
|
||||
</emissive>
|
||||
</material>
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<debug type="bool">false</debug>
|
||||
<realism>5</realism>
|
||||
<filtering>8</filtering>
|
||||
<multithreading-mode>AutomaticSelection</multithreading-mode>
|
||||
<static-lod>
|
||||
<detailed userarchive="y">1500</detailed>
|
||||
<rough userarchive="y">9000</rough>
|
||||
|
@ -137,9 +138,11 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<landmass-shader userarchive="y">0</landmass-shader>
|
||||
<water-shader userarchive="y">0</water-shader>
|
||||
<urban-shader userarchive="y">0</urban-shader>
|
||||
<contrail-shader userarchive="y">0</contrail-shader>
|
||||
<snow-level-m type="double">2000.0</snow-level-m>
|
||||
<quality-level type="double" userarchive="y">0.0</quality-level>
|
||||
</rendering>
|
||||
|
||||
</rendering>
|
||||
<model-hz type="int">120</model-hz>
|
||||
<navdb>
|
||||
<localizers>
|
||||
|
@ -783,6 +786,22 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<wind-speed-change-rel>1.3</wind-speed-change-rel>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<elevation-ft>30000</elevation-ft>
|
||||
<wind-from-heading-deg>330</wind-from-heading-deg>
|
||||
<wind-speed-kt>50</wind-speed-kt>
|
||||
<wind-heading-change-deg>35</wind-heading-change-deg>
|
||||
<wind-speed-change-rel>1.3</wind-speed-change-rel>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<elevation-ft>40000</elevation-ft>
|
||||
<wind-from-heading-deg>340</wind-from-heading-deg>
|
||||
<wind-speed-kt>70</wind-speed-kt>
|
||||
<wind-heading-change-deg>35</wind-heading-change-deg>
|
||||
<wind-speed-change-rel>1.3</wind-speed-change-rel>
|
||||
</entry>
|
||||
|
||||
</aloft>
|
||||
|
||||
</config>
|
||||
|
@ -790,14 +809,14 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<clouds>
|
||||
<status>true</status>
|
||||
<layer n="0">
|
||||
<coverage>scattered</coverage>
|
||||
<coverage>clear</coverage>
|
||||
<elevation-ft>4000</elevation-ft>
|
||||
<thickness-ft>600</thickness-ft>
|
||||
<transition-ft>150</transition-ft>
|
||||
<span-m>40000</span-m>
|
||||
</layer>
|
||||
<layer n="1">
|
||||
<coverage>cirrus</coverage>
|
||||
<coverage>clear</coverage>
|
||||
<elevation-ft>19500</elevation-ft>
|
||||
<thickness-ft>65</thickness-ft>
|
||||
<transition-ft>25</transition-ft>
|
||||
|
|
Loading…
Reference in a new issue