Merge branch 'master' of git://gitorious.org/fg/fgdata
This commit is contained in:
commit
4182174502
23 changed files with 276 additions and 160 deletions
|
@ -67,6 +67,7 @@
|
|||
<program>
|
||||
<vertex-shader>Shaders/deferred-tree.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/deferred-tree.frag</fragment-shader>
|
||||
<fragment-shader>Shaders/gbuffer-functions.frag</fragment-shader>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>texture</name>
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#extension GL_EXT_gpu_shader4 : enable
|
||||
// -*- mode: C; -*-
|
||||
// Licence: GPL v2
|
||||
// Author: Frederic Bouvier.
|
||||
//
|
||||
// attachment 0: normal.x | normal.x | normal.y | normal.y
|
||||
// attachment 1: diffuse.r | diffuse.g | diffuse.b | material Id
|
||||
// attachment 2: specular.l | shininess | emission.l | unused
|
||||
//
|
||||
|
||||
varying vec3 ecNormal;
|
||||
varying float alpha;
|
||||
uniform int materialID;
|
||||
uniform sampler2D texture;
|
||||
|
||||
vec2 normal_encode(vec3 n);
|
||||
void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth);
|
||||
|
||||
void main() {
|
||||
vec4 texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
|
@ -20,7 +20,5 @@ void main() {
|
|||
float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb, vec3( 0.3, 0.59, 0.11 ) );
|
||||
|
||||
vec3 normal2 = normalize( (2.0 * gl_Color.a - 1.0) * ecNormal );
|
||||
gl_FragData[0] = vec4( normal_encode(normal2), 0.0, 1.0 );
|
||||
gl_FragData[1] = vec4( gl_Color.rgb * texel.rgb, float( materialID ) / 255.0 );
|
||||
gl_FragData[2] = vec4( specular, shininess / 128.0, emission, 1.0 );
|
||||
encode_gbuffer(normal2, gl_Color.rgb * texel.rgb, materialID, specular, shininess, emission, gl_FragCoord.z);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// -*- mode: C; -*-
|
||||
// Licence: GPL v2
|
||||
// Author: Frederic Bouvier.
|
||||
//
|
||||
// attachment 0: normal.x | normal.x | normal.y | normal.y
|
||||
// attachment 1: diffuse.r | diffuse.g | diffuse.b | material Id
|
||||
// attachment 2: specular.l | shininess | emission.l | unused
|
||||
//
|
||||
|
||||
varying vec3 ecNormal;
|
||||
varying float alpha;
|
||||
void main() {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
//
|
||||
uniform int materialID;
|
||||
uniform sampler2D texture;
|
||||
void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth);
|
||||
void main() {
|
||||
vec4 texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
if (texel.a < 0.1)
|
||||
|
@ -14,9 +15,6 @@ void main() {
|
|||
float shininess = 0.1;
|
||||
float emission = 0.0;
|
||||
|
||||
// Normal is straight towards the viewer.
|
||||
vec3 normal2 = vec3(0.0, 0.0, 0.0);
|
||||
gl_FragData[0] = vec4( 0.5, 0.5, 0.0, 1.0 );
|
||||
gl_FragData[1] = vec4( gl_Color.rgb * texel.rgb, float( materialID ) / 255.0 );
|
||||
gl_FragData[2] = vec4( specular, shininess / 255.0, emission, 1.0 );
|
||||
// Normal is straight towards the viewer. (FB: Are they really billboards ? )
|
||||
encode_gbuffer(vec3(0.5, 0.5, 0.0), gl_Color.rgb * texel.rgb, materialID, specular, shininess, emission, gl_FragCoord.z);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ uniform sampler2D lighting_tex;
|
|||
//uniform sampler2D ao_tex;
|
||||
uniform float exposure;
|
||||
uniform bool showBuffers;
|
||||
uniform bool fg_DepthInColor;
|
||||
|
||||
vec3 HDR(vec3 L) {
|
||||
L = L * exposure;
|
||||
|
@ -26,8 +27,8 @@ void main() {
|
|||
color = texture2D( specular_tex, (coords - vec2( 0.8, 0.8 )) * 5.0 );
|
||||
} else if (coords.x >= 0.8 && coords.y < 0.2) {
|
||||
color = texture2D( color_tex, (coords - vec2( 0.8, 0.0 )) * 5.0 );
|
||||
// } else if (coords.x < 0.2 && coords.y >= 0.8) {
|
||||
// color = texture2D( ao_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 );
|
||||
} else if (coords.x < 0.2 && coords.y >= 0.8 && fg_DepthInColor) {
|
||||
color = texture2D( depth_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 );
|
||||
} else {
|
||||
color = texture2D( lighting_tex, coords ) /* + texture2D( bloom_tex, coords ) */;
|
||||
//color = vec4( HDR( color.rgb ), 1.0 );
|
||||
|
|
|
@ -7,7 +7,7 @@ uniform float fg_FogDensity;
|
|||
uniform vec3 fg_Planes;
|
||||
varying vec3 ray;
|
||||
|
||||
vec3 position( vec3 viewdir, float depth );
|
||||
vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex );
|
||||
|
||||
void main() {
|
||||
vec2 coords = gl_TexCoord[0].xy;
|
||||
|
@ -15,11 +15,7 @@ void main() {
|
|||
if ( initialized < 0.1 )
|
||||
discard;
|
||||
vec3 normal;
|
||||
normal.xy = texture2D( normal_tex, coords ).rg * 2.0 - vec2(1.0,1.0);
|
||||
normal.z = sqrt( 1.0 - dot( normal.xy, normal.xy ) );
|
||||
float len = length(normal);
|
||||
normal /= len;
|
||||
vec3 pos = position( normalize(ray), texture2D( depth_tex, coords ).r );
|
||||
vec3 pos = position( normalize(ray), coords, depth_tex );
|
||||
|
||||
float fogFactor = 0.0;
|
||||
const float LOG2 = 1.442695;
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
// -*- mode: C; -*-
|
||||
// Licence: GPL v2
|
||||
// Author: Frederic Bouvier.
|
||||
|
||||
uniform vec3 fg_Planes;
|
||||
uniform bool fg_DepthInColor;
|
||||
|
||||
// normal compression functions from
|
||||
// http://aras-p.info/texts/CompactNormalStorage.html#method04spheremap
|
||||
|
@ -19,6 +24,27 @@ vec3 normal_decode(vec2 enc)
|
|||
return n;
|
||||
}
|
||||
|
||||
// depth to color encoding and decoding functions from
|
||||
// Deferred Shading Tutorial by Fabio Policarpo and Francisco Fonseca
|
||||
// (corrected by Frederic Bouvier)
|
||||
vec3 float_to_color(in float f)
|
||||
{
|
||||
vec3 color;
|
||||
f *= 255.0;
|
||||
color.x = floor(f);
|
||||
f = (f-color.x)*255.0;
|
||||
color.y = floor(f);
|
||||
color.z = f-color.y;
|
||||
color.xy /= 255.0;
|
||||
return color;
|
||||
}
|
||||
|
||||
float color_to_float(vec3 color)
|
||||
{
|
||||
const vec3 byte_to_float = vec3(1.0, 1.0/255.0, 1.0/(255.0*255.0));
|
||||
return dot(color,byte_to_float);
|
||||
}
|
||||
|
||||
vec3 position( vec3 viewDir, float depth )
|
||||
{
|
||||
vec3 pos;
|
||||
|
@ -26,3 +52,32 @@ vec3 position( vec3 viewDir, float depth )
|
|||
pos.xy = viewDir.xy / viewDir.z * pos.z;
|
||||
return pos;
|
||||
}
|
||||
|
||||
vec3 position( vec3 viewDir, vec3 depthColor )
|
||||
{
|
||||
return position( viewDir, color_to_float(depthColor) );
|
||||
}
|
||||
|
||||
vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex )
|
||||
{
|
||||
float depth;
|
||||
if (fg_DepthInColor)
|
||||
depth = color_to_float( texture2D( depth_tex, coords ).rgb );
|
||||
else
|
||||
depth = texture2D( depth_tex, coords ).r;
|
||||
return position( viewDir, depth );
|
||||
}
|
||||
|
||||
// attachment 0: normal.x | normal.y | 0.0 | 1.0
|
||||
// attachment 1: diffuse.r | diffuse.g | diffuse.b | material Id
|
||||
// attachment 2: specular.l | shininess | emission.l | unused
|
||||
// attachment 3: ---------- depth ------------ | unused (optional)
|
||||
//
|
||||
void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth)
|
||||
{
|
||||
gl_FragData[0] = vec4( normal_encode(normal), 0.0, 1.0 );
|
||||
gl_FragData[1] = vec4( color, float( mId ) / 255.0 );
|
||||
gl_FragData[2] = vec4( specular, shininess / 128.0, emission, 1.0 );
|
||||
if (fg_DepthInColor)
|
||||
gl_FragData[3] = vec4(float_to_color(depth), 1.0);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ uniform float Far;
|
|||
|
||||
varying vec4 ecPosition;
|
||||
|
||||
vec3 position( vec3 viewdir, float depth );
|
||||
vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex );
|
||||
vec3 normal_decode(vec2 enc);
|
||||
|
||||
void main() {
|
||||
|
@ -27,7 +27,7 @@ void main() {
|
|||
vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg);
|
||||
vec4 spec_emis = texture2D( spec_emis_tex, coords );
|
||||
|
||||
vec3 pos = position(viewDir, texture2D( depth_tex, coords ).r);
|
||||
vec3 pos = position(viewDir, coords, depth_tex);
|
||||
|
||||
if ( pos.z < ecPos3.z ) // Negative direction in z
|
||||
discard; // Don't light surface outside the light volume
|
||||
|
|
|
@ -19,7 +19,7 @@ uniform float Far;
|
|||
|
||||
varying vec4 ecPosition;
|
||||
|
||||
vec3 position( vec3 viewdir, float depth );
|
||||
vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex );
|
||||
vec3 normal_decode(vec2 enc);
|
||||
|
||||
void main() {
|
||||
|
@ -31,7 +31,7 @@ void main() {
|
|||
vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg);
|
||||
vec4 spec_emis = texture2D( spec_emis_tex, coords );
|
||||
|
||||
vec3 pos = position(viewDir, texture2D( depth_tex, coords ).r);
|
||||
vec3 pos = position(viewDir, coords, depth_tex);
|
||||
|
||||
if ( pos.z < ecPos3.z ) // Negative direction in z
|
||||
discard; // Don't light surface outside the light volume
|
||||
|
|
|
@ -12,7 +12,7 @@ uniform int fg_ShadowNumber;
|
|||
uniform vec4 fg_ShadowDistances;
|
||||
varying vec3 ray;
|
||||
|
||||
vec3 position( vec3 viewdir, float depth );
|
||||
vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex );
|
||||
vec3 normal_decode(vec2 enc);
|
||||
|
||||
vec4 DynamicShadow( in vec4 ecPosition, out vec4 tint )
|
||||
|
@ -57,7 +57,7 @@ void main() {
|
|||
float len = length(normal);
|
||||
normal /= len;
|
||||
vec3 viewDir = normalize(ray);
|
||||
vec3 pos = position( viewDir, texture2D( depth_tex, coords ).r );
|
||||
vec3 pos = position( viewDir, coords, depth_tex );
|
||||
|
||||
vec4 tint;
|
||||
float shadow = shadow2DProj( shadow_tex, DynamicShadow( vec4( pos, 1.0 ), tint ) ).r;
|
||||
|
|
|
@ -17,7 +17,7 @@ varying vec4 eyePlaneT;
|
|||
varying vec4 eyePlaneR;
|
||||
varying vec4 eyePlaneQ;
|
||||
|
||||
vec3 position( vec3 viewdir, float depth );
|
||||
vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex );
|
||||
vec3 normal_decode(vec2 enc);
|
||||
|
||||
vec4 DynamicShadow( in vec4 ecPosition, out vec4 tint )
|
||||
|
@ -43,7 +43,7 @@ void main() {
|
|||
float len = length(normal);
|
||||
normal /= len;
|
||||
vec3 viewDir = normalize(ray);
|
||||
vec3 pos = position( viewDir, texture2D( depth_tex, coords ).r );
|
||||
vec3 pos = position( viewDir, coords, depth_tex );
|
||||
|
||||
vec4 tint;
|
||||
float shadow;
|
||||
|
|
|
@ -14,7 +14,7 @@ uniform vec4 fg_ShadowDistances;
|
|||
uniform int filtering;
|
||||
varying vec3 ray;
|
||||
|
||||
vec3 position( vec3 viewdir, float depth );
|
||||
vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex );
|
||||
vec3 normal_decode(vec2 enc);
|
||||
|
||||
vec4 DynamicShadow( in vec4 ecPosition, out vec4 tint )
|
||||
|
@ -59,7 +59,7 @@ void main() {
|
|||
float len = length(normal);
|
||||
normal /= len;
|
||||
vec3 viewDir = normalize(ray);
|
||||
vec3 pos = position( viewDir, texture2D( depth_tex, coords ).r );
|
||||
vec3 pos = position( viewDir, coords, depth_tex );
|
||||
|
||||
vec4 tint;
|
||||
float shadow = 0.0;
|
||||
|
|
|
@ -56,7 +56,7 @@ uniform vec3 dirt_g_color;
|
|||
uniform vec3 dirt_b_color;
|
||||
|
||||
//uniform vec4 fg_SunAmbientColor;
|
||||
vec2 normal_encode(vec3 n);
|
||||
void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth);
|
||||
|
||||
///fog include//////////////////////
|
||||
uniform int fogType;
|
||||
|
@ -76,7 +76,8 @@ void main (void)
|
|||
//vec3 ambient = fg_SunAmbientColor.rgb;
|
||||
vec3 N;
|
||||
vec3 dotN;
|
||||
float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb + gl_FrontMaterial.emission , vec3( 0.3, 0.59, 0.11 ) );
|
||||
float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb + gl_FrontMaterial.emission,
|
||||
vec3( 0.3, 0.59, 0.11 ) );
|
||||
float pf;
|
||||
|
||||
///BEGIN bump
|
||||
|
@ -108,9 +109,9 @@ void main (void)
|
|||
reflFactor = reflmap.a + transparency_offset;
|
||||
} else if (nmap_enabled > 0) {
|
||||
// set the reflectivity proportional to shininess with user input
|
||||
reflFactor = (gl_FrontMaterial.shininess / 128.0) * nmap.a + transparency_offset;
|
||||
reflFactor = gl_FrontMaterial.shininess * 0.0078125 * nmap.a + transparency_offset;
|
||||
} else {
|
||||
reflFactor = gl_FrontMaterial.shininess/128.0 + transparency_offset;
|
||||
reflFactor = gl_FrontMaterial.shininess * 0.0078125 + transparency_offset;
|
||||
}
|
||||
reflFactor = clamp(reflFactor, 0.0, 1.0);
|
||||
|
||||
|
@ -131,16 +132,15 @@ void main (void)
|
|||
//begin DIRT
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
if (dirt_enabled > 0.0){
|
||||
float dirtFactorR = reflmap.r * dirt_r_factor;
|
||||
dirtFactorR = smoothstep(0.0, 1.0, dirtFactorR);
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_r_color, dirtFactorR);
|
||||
vec3 dirtFactorIn = vec3 (dirt_r_factor, dirt_g_factor, dirt_b_factor);
|
||||
vec3 dirtFactor.rgb = reflmap.rgb * dirtFactorIn.rgb;
|
||||
//dirtFactor.r = smoothstep(0.0, 1.0, dirtFactor.r);
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_r_color, smoothstep(0.0, 1.0, dirtFactor.r));
|
||||
if (dirt_multi > 0) {
|
||||
float dirtFactorG = reflmap.g * dirt_g_factor;
|
||||
float dirtFactorB = reflmap.b * dirt_b_factor;
|
||||
dirtFactorG = smoothstep(0.0, 1.0, dirtFactorG);
|
||||
dirtFactorB = smoothstep(0.0, 1.0, dirtFactorB);
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_g_color, dirtFactorG);
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_b_color, dirtFactorB);
|
||||
//dirtFactor.g = smoothstep(0.0, 1.0, dirtFactor.g);
|
||||
//dirtFactor.b = smoothstep(0.0, 1.0, dirtFactor.b);
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_g_color, smoothstep(0.0, 1.0, dirtFactor.g));
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_b_color, smoothstep(0.0, 1.0, dirtFactor.b));
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -162,25 +162,27 @@ void main (void)
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
if ( lightmap_enabled >= 1 ) {
|
||||
vec3 lightmapcolor;
|
||||
vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor, lightmap_b_factor, lightmap_a_factor);
|
||||
lightmapFactor = lightmapFactor * lightmapTexel;
|
||||
if (lightmap_multi >0 ){
|
||||
lightmapcolor = lightmap_r_color * lightmap_r_factor * lightmapTexel.r +
|
||||
lightmap_g_color * lightmap_g_factor * lightmapTexel.g +
|
||||
lightmap_b_color * lightmap_b_factor * lightmapTexel.b +
|
||||
lightmap_a_color * lightmap_a_factor * lightmapTexel.a ;
|
||||
emission = max(max(lightmap_r_factor * lightmapTexel.r, lightmap_g_factor * lightmapTexel.g),max( lightmap_b_factor * lightmapTexel.b, lightmap_a_factor * lightmapTexel.a));
|
||||
lightmapcolor = lightmap_r_color * lightmapFactor.r +
|
||||
lightmap_g_color * lightmapFactor.g +
|
||||
lightmap_b_color * lightmapFactor.b +
|
||||
lightmap_a_color * lightmapFactor.a ;
|
||||
emission = max(max(lightmapFactor.r * lightmapTexel.r, lightmapFactor.g * lightmapTexel.g),
|
||||
max( lightmapFactor.b * lightmapTexel.b, lightmapFactor.a * lightmapTexel.a));
|
||||
} else {
|
||||
lightmapcolor = lightmapTexel.r * lightmap_r_color * lightmap_r_factor;
|
||||
emission = lightmapTexel.r * lightmap_r_factor;
|
||||
lightmapcolor = lightmapTexel.rgb * lightmap_r_color * lightmapFactor.r;
|
||||
emission = lightmapTexel.r * lightmapFactor.r;
|
||||
}
|
||||
//fragColor.rgb = max(fragColor.rgb, lightmapcolor * gl_FrontMaterial.diffuse.rgb * mixedcolor);
|
||||
emission = length(lightmapcolor);
|
||||
fragColor.rgb = max(fragColor.rgb * (1.0 - emission), lightmapcolor * gl_FrontMaterial.diffuse.rgb * mixedcolor);
|
||||
fragColor.rgb = max(fragColor.rgb * (1.0 - emission),
|
||||
lightmapcolor * gl_FrontMaterial.diffuse.rgb * mixedcolor);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// END lightmap
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
gl_FragData[0]=vec4(normal_encode(N), 0.0, 1.0);
|
||||
gl_FragData[1]=vec4(fragColor.rgb,1.0/255.0);
|
||||
gl_FragData[2]=vec4(specular, gl_FrontMaterial.shininess/128.0, emission, 1.0);
|
||||
encode_gbuffer(N, fragColor.rgb, 1, specular, gl_FrontMaterial.shininess, emission, gl_FragCoord.z);
|
||||
}
|
|
@ -92,7 +92,8 @@ void main (void)
|
|||
float nDotVP = max(0.0, dot(N, normalize(gl_LightSource[0].position.xyz)));
|
||||
float nDotHV = max(0.0, dot(N, normalize(gl_LightSource[0].halfVector.xyz)));
|
||||
//glare on the backside of tranparent objects
|
||||
if ((gl_FrontMaterial.diffuse.a < 1.0 || texel.a < 1.0) && dot(N, normalize(gl_LightSource[0].position.xyz)) < 0.0) {
|
||||
if ((gl_FrontMaterial.diffuse.a < 1.0 || texel.a < 1.0)
|
||||
&& dot(N, normalize(gl_LightSource[0].position.xyz)) < 0.0) {
|
||||
nDotVP = max(0.0, dot(-N, normalize(gl_LightSource[0].position.xyz)));
|
||||
nDotHV = max(0.0, dot(-N, normalize(gl_LightSource[0].halfVector.xyz)));
|
||||
}
|
||||
|
@ -122,9 +123,9 @@ void main (void)
|
|||
reflFactor = reflmap.a + transparency_offset;
|
||||
} else if (nmap_enabled > 0 && shader_qual > 2) {
|
||||
// set the reflectivity proportional to shininess with user input
|
||||
reflFactor = (gl_FrontMaterial.shininess / 128.0) * nmap.a + transparency_offset;
|
||||
reflFactor = gl_FrontMaterial.shininess * 0.0078125 * nmap.a + transparency_offset;
|
||||
} else {
|
||||
reflFactor = gl_FrontMaterial.shininess/128.0 + transparency_offset;
|
||||
reflFactor = gl_FrontMaterial.shininess* 0.0078125 + transparency_offset;
|
||||
}
|
||||
reflFactor = clamp(reflFactor, 0.0, 1.0);
|
||||
|
||||
|
@ -148,16 +149,15 @@ void main (void)
|
|||
//begin DIRT
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
if (dirt_enabled > 0.0){
|
||||
float dirtFactorR = reflmap.r * dirt_r_factor;
|
||||
dirtFactorR = smoothstep(0.0, 1.0, dirtFactorR);
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_r_color, dirtFactorR);
|
||||
vec3 dirtFactorIn = vec3 (dirt_r_factor, dirt_g_factor, dirt_b_factor);
|
||||
vec3 dirtFactor = reflmap.rgb * dirtFactorIn.rgb;
|
||||
//dirtFactor.r = smoothstep(0.0, 1.0, dirtFactor.r);
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_r_color, smoothstep(0.0, 1.0, dirtFactor.r));
|
||||
if (dirt_multi > 0) {
|
||||
float dirtFactorG = reflmap.g * dirt_g_factor;
|
||||
float dirtFactorB = reflmap.b * dirt_b_factor;
|
||||
dirtFactorG = smoothstep(0.0, 1.0, dirtFactorG);
|
||||
dirtFactorB = smoothstep(0.0, 1.0, dirtFactorB);
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_g_color, dirtFactorG);
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_b_color, dirtFactorB);
|
||||
//dirtFactor.g = smoothstep(0.0, 1.0, dirtFactor.g);
|
||||
//dirtFactor.b = smoothstep(0.0, 1.0, dirtFactor.b);
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_g_color, smoothstep(0.0, 1.0, dirtFactor.g));
|
||||
mixedcolor.rgb = mix(mixedcolor.rgb, dirt_b_color, smoothstep(0.0, 1.0, dirtFactor.b));
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -167,7 +167,8 @@ void main (void)
|
|||
|
||||
// set ambient adjustment to remove bluiness with user input
|
||||
float ambient_offset = clamp(amb_correction, -1.0, 1.0);
|
||||
vec4 ambient_Correction = vec4(gl_LightSource[0].ambient.rg, gl_LightSource[0].ambient.b * 0.6, 0.5) * ambient_offset ;
|
||||
vec4 ambient_Correction = vec4(gl_LightSource[0].ambient.rg, gl_LightSource[0].ambient.b * 0.6, 0.5)
|
||||
* ambient_offset ;
|
||||
ambient_Correction = clamp(ambient_Correction, -1.0, 1.0);
|
||||
|
||||
color.a = texel.a * alpha;
|
||||
|
@ -182,13 +183,16 @@ void main (void)
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
if ( lightmap_enabled >= 1 ) {
|
||||
vec3 lightmapcolor;
|
||||
vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor,
|
||||
lightmap_b_factor, lightmap_a_factor);
|
||||
lightmapFactor = lightmapFactor * lightmapTexel;
|
||||
if (lightmap_multi >0 ){
|
||||
lightmapcolor = lightmap_r_color * lightmap_r_factor * lightmapTexel.r +
|
||||
lightmap_g_color * lightmap_g_factor * lightmapTexel.g +
|
||||
lightmap_b_color * lightmap_b_factor * lightmapTexel.b +
|
||||
lightmap_a_color * lightmap_a_factor * lightmapTexel.a ;
|
||||
lightmapcolor = lightmap_r_color * lightmapFactor.r +
|
||||
lightmap_g_color * lightmapFactor.g +
|
||||
lightmap_b_color * lightmapFactor.b +
|
||||
lightmap_a_color * lightmapFactor.a ;
|
||||
} else {
|
||||
lightmapcolor = lightmapTexel.rgb * lightmap_r_color * lightmap_r_factor;
|
||||
lightmapcolor = lightmapTexel.rgb * lightmap_r_color * lightmapFactor.r;
|
||||
}
|
||||
fragColor.rgb = max(fragColor.rgb, lightmapcolor * gl_FrontMaterial.diffuse.rgb * mixedcolor);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,8 @@ void main(void)
|
|||
}
|
||||
|
||||
if(rembrandt_enabled < 1){
|
||||
gl_FrontColor = gl_FrontMaterial.emission + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
gl_FrontColor = gl_FrontMaterial.emission + gl_Color
|
||||
* (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
} else {
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ int linear_search_steps = 10;
|
|||
int GlobalIterationCount = 0;
|
||||
int gIterationCap = 64;
|
||||
|
||||
vec2 normal_encode(vec3 n);
|
||||
void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth);
|
||||
|
||||
void QDM(inout vec3 p, inout vec3 v)
|
||||
{
|
||||
|
@ -190,7 +190,6 @@ void main (void)
|
|||
N.z = sqrt(1.0 - min(1.0,dot(N.xy, N.xy)));
|
||||
float Nz = N.z;
|
||||
N = normalize(N.x * tangent + N.y * binormal + N.z * normal);
|
||||
gl_FragData[0] = vec4( normal_encode(N), 0.0, 1.0 );
|
||||
|
||||
vec4 ambient_light = constantColor + vec4(gl_Color.rgb, 1.0);
|
||||
|
||||
|
@ -216,9 +215,6 @@ void main (void)
|
|||
|
||||
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depth_factor / s.z, 1.0 );
|
||||
|
||||
gl_FragData[1] = vec4( finalColor.rgb, 1.0 / 255.0 );
|
||||
gl_FragData[2] = vec4( dot(specular.xyz,vec3(0.3, 0.59, 0.11 )), specular.w/128.0, 0.0, 1.0 );
|
||||
|
||||
if (dot(normal,-V) > 0.1) {
|
||||
vec4 iproj = gl_ProjectionMatrix * p;
|
||||
iproj /= iproj.w;
|
||||
|
@ -226,4 +222,5 @@ void main (void)
|
|||
} else {
|
||||
gl_FragDepth = gl_FragCoord.z;
|
||||
}
|
||||
encode_gbuffer(N, finalColor.rgb, 1, dot(specular.xyz,vec3(0.3, 0.59, 0.11 )), specular.w, 0.0, gl_FragDepth);
|
||||
}
|
||||
|
|
|
@ -59,10 +59,11 @@
|
|||
|
||||
<!-- AI menu -->
|
||||
<ai>KI</ai>
|
||||
<scenario>Flugverkehr und Szenarien</scenario>
|
||||
<atc-in-range>ATC Stationen in der Nähe</atc-in-range>
|
||||
<wingman>Steuerung Flügelmann</wingman>
|
||||
<tanker>Steuerung Tanker</tanker>
|
||||
<carrier>Steuerung Flugzeugträger</carrier>
|
||||
<scenario>Auswahl der KI Szenarien (Neustart notwendig)</scenario>
|
||||
<jetway>Steuerung Fluggastbrücke</jetway>
|
||||
|
||||
<!-- Equipment -->
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
|
||||
<!-- FlightGear options translations for German -->
|
||||
<!-- FlightGear options: German language resource -->
|
||||
|
||||
<PropertyList>
|
||||
<!-- Fall back -->
|
||||
|
|
|
@ -62,10 +62,11 @@
|
|||
|
||||
<!-- AI menu -->
|
||||
<ai>AI</ai>
|
||||
<scenario>Traffic and Scenario Settings</scenario>
|
||||
<atc-in-range>ATC Services in Range</atc-in-range>
|
||||
<wingman>Wingman Controls</wingman>
|
||||
<tanker>Tanker Controls</tanker>
|
||||
<carrier>Carrier Controls</carrier>
|
||||
<scenario>Scenario Select (requires restart)</scenario>
|
||||
<jetway>Jetway Settings</jetway>
|
||||
|
||||
<!-- Multiplayer menu -->
|
||||
|
|
|
@ -51,16 +51,52 @@
|
|||
</group>
|
||||
<hrule/>
|
||||
|
||||
<!-- main dialog area -->
|
||||
<group>
|
||||
<layout>table</layout>
|
||||
<halign>center</halign>
|
||||
|
||||
<text>
|
||||
<row>0</row><col>0</col>
|
||||
<row>0</row>
|
||||
<col>0</col>
|
||||
<label>Options:</label>
|
||||
<halign>right</halign>
|
||||
</text>
|
||||
<checkbox>
|
||||
<row>0</row>
|
||||
<col>1</col>
|
||||
<colspan>2</colspan>
|
||||
<halign>left</halign>
|
||||
<name>hide-replay</name>
|
||||
<label>Hide replay sessions over MP (less annoying to other players)</label>
|
||||
<property>/sim/multiplay/freeze-on-replay</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
<object-name>hide-replay</object-name>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<checkbox>
|
||||
<row>1</row>
|
||||
<col>1</col>
|
||||
<colspan>2</colspan>
|
||||
<halign>left</halign>
|
||||
<name>ai-traffic</name>
|
||||
<label>Show AI Traffic (mixing MP and AI traffic may be confusing)</label>
|
||||
<property>/sim/traffic-manager/enabled</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
<object-name>ai-traffic</object-name>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<text>
|
||||
<row>2</row><col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Callsign:</label>
|
||||
</text>
|
||||
<input>
|
||||
<row>0</row><col>1</col>
|
||||
<row>2</row><col>1</col>
|
||||
<halign>left</halign>
|
||||
<property>/sim/multiplay/callsign</property>
|
||||
<enable>
|
||||
|
@ -69,19 +105,16 @@
|
|||
</not>
|
||||
</enable>
|
||||
</input>
|
||||
|
||||
<text>
|
||||
<row>0</row><col>2</col>
|
||||
<halign>left</halign>
|
||||
<label>(requires reconnect)</label>
|
||||
</text>
|
||||
<text>
|
||||
<row>1</row><col>0</col>
|
||||
<row>3</row><col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Server:</label>
|
||||
</text>
|
||||
<combo>
|
||||
<name>host</name>
|
||||
<row>1</row><col>1</col>
|
||||
<halign>left</halign>
|
||||
<row>3</row><col>1</col>
|
||||
<colspan>2</colspan>
|
||||
<pref-width>350</pref-width>
|
||||
<property>/sim/multiplay/selected-server</property>
|
||||
|
@ -99,12 +132,13 @@
|
|||
<value>mpserver12.flightgear.org (Amsterdam, Netherlands)</value>
|
||||
<value>mpserver13.flightgear.org (Grenoble, France)</value>
|
||||
</combo>
|
||||
|
||||
<!-- status area -->
|
||||
<text>
|
||||
<visible>
|
||||
<not><property>/sim/multiplay/online</property></not>
|
||||
</visible>
|
||||
<row>3</row>
|
||||
<row>5</row>
|
||||
<col>1</col>
|
||||
<halign>left</halign>
|
||||
<label>Not connected</label>
|
||||
|
@ -114,7 +148,7 @@
|
|||
<visible>
|
||||
<property>/sim/multiplay/online</property>
|
||||
</visible>
|
||||
<row>3</row>
|
||||
<row>5</row>
|
||||
<col>1</col>
|
||||
<halign>left</halign>
|
||||
<label>MMMMMMMMMMMMMMMMM</label>
|
||||
|
@ -124,6 +158,7 @@
|
|||
</text>
|
||||
</group>
|
||||
|
||||
<!-- button area -->
|
||||
<hrule/>
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
|
@ -160,6 +195,7 @@
|
|||
<subsystem>mp</subsystem>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
<button>
|
||||
<legend>Disconnect</legend>
|
||||
<equal>true</equal>
|
||||
|
@ -180,6 +216,7 @@
|
|||
<subsystem>mp</subsystem>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
<button>
|
||||
<row>1</row><col>2</col>
|
||||
<legend>Server Status</legend>
|
||||
|
@ -188,6 +225,7 @@
|
|||
<path>http://mpmap01.flightgear.org/mpstatus/</path>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
<button>
|
||||
<legend>Close</legend>
|
||||
<default>true</default>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<empty><stretch>true</stretch></empty>
|
||||
|
||||
<text>
|
||||
<label>AI Scenario Select</label>
|
||||
<label>AI Traffic and Scenario Settings</label>
|
||||
</text>
|
||||
|
||||
<empty><stretch>true</stretch></empty>
|
||||
|
@ -49,13 +49,39 @@
|
|||
|
||||
<hrule/>
|
||||
|
||||
<checkbox>
|
||||
<halign>left</halign>
|
||||
<label>Enable AI traffic</label>
|
||||
<name>enable-ai-traffic</name>
|
||||
<property>/sim/traffic-manager/enabled</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
<object-name>enable-ai-traffic</object-name>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<checkbox>
|
||||
<halign>left</halign>
|
||||
<label>Enable AI scenarios (requires restart)</label>
|
||||
<name>enable-ai-scenarios</name>
|
||||
<property>/sim/ai/scenarios-enabled</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
<object-name>enable-ai-scenarios</object-name>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<text><label/></text>
|
||||
|
||||
<text>
|
||||
<label>Choose active scenario(s) for the next program start</label>
|
||||
<enable>
|
||||
<property>/sim/ai/scenarios-enabled</property>
|
||||
</enable>
|
||||
</text>
|
||||
|
||||
<hrule/>
|
||||
|
||||
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
|
||||
|
@ -120,8 +146,12 @@
|
|||
var scenarioN = rootN.getNode("scenario");
|
||||
if( scenarioN == nil ) return;
|
||||
var descriptionN = rootN.getNode("description");
|
||||
if( descriptionN == nil )
|
||||
var descriptionN = scenarioN.getNode("description");
|
||||
var nameN = rootN.getNode("name");
|
||||
if( (descriptionN == nil)and(nameN == nil) )
|
||||
{
|
||||
descriptionN = scenarioN.getNode("description");
|
||||
nameN = scenarioN.getNode("name");
|
||||
}
|
||||
var description = descriptionN != nil ? descriptionN.getValue() : "";
|
||||
var propertyRoot = props.globals.getNode("sim/gui/dialogs/scenario",1).getChild( "scenario", nr, 1 );
|
||||
propertyRoot.getNode("selected",1).setBoolValue(isEnabledScenario(file));
|
||||
|
@ -131,8 +161,12 @@
|
|||
group.getNode("layout",1).setValue("hbox");
|
||||
var cb = group.getNode("checkbox",1);
|
||||
cb.getNode("property",1).setValue(propertyRoot.getNode("selected").getPath());
|
||||
cb.getNode("label",1).setValue(file);
|
||||
var label = string.replace(file, "_", " ");
|
||||
if (nameN != nil)
|
||||
label = nameN.getValue();
|
||||
cb.getNode("label",1).setValue(label);
|
||||
cb.getNode("name",1).setValue(file);
|
||||
cb.getNode("enable/property",1).setValue("/sim/ai/scenarios-enabled");
|
||||
group.getNode("empty",1).getNode("stretch",1).setValue("true");
|
||||
}
|
||||
|
||||
|
|
|
@ -22,14 +22,6 @@
|
|||
<script>gui.save_flight()</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Scenario</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>scenario</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
-->
|
||||
<item>
|
||||
<name>reset</name>
|
||||
|
@ -39,8 +31,8 @@
|
|||
<command>reset</command>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<!-- <item>
|
||||
<!--
|
||||
<item>
|
||||
<label>High-Res Snapshot</label>
|
||||
<enabled>false</enabled>
|
||||
<binding>
|
||||
|
@ -60,6 +52,7 @@
|
|||
</script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<name>snap-shot-dir</name>
|
||||
<label>Screenshot Directory</label>
|
||||
|
@ -452,14 +445,23 @@
|
|||
<menu>
|
||||
<name>ai</name>
|
||||
<label>AI</label>
|
||||
<!-- Not working at present
|
||||
|
||||
<item>
|
||||
<label>ATC Services in range</label>
|
||||
<label>Traffic and Scenario Settings</label>
|
||||
<name>scenario</name>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>scenario</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>ATC Services in Range</label>
|
||||
<name>atc-in-range</name>
|
||||
<binding>
|
||||
<command>ATC-freq-search</command>
|
||||
</binding>
|
||||
</item>
|
||||
-->
|
||||
|
||||
<item>
|
||||
<label>Wingman Controls</label>
|
||||
|
@ -489,15 +491,6 @@
|
|||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Scenario Select (requires restart)</label>
|
||||
<name>scenario</name>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>scenario</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Jetway Settings</label>
|
||||
<name>jetway</name>
|
||||
|
@ -598,7 +591,6 @@
|
|||
</binding>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<name>reload-panel</name>
|
||||
<label>Reload Panel</label>
|
||||
|
|
|
@ -68,6 +68,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<show-buffers type="bool" userarchive="y">true</show-buffers>
|
||||
<ambient-occlusion type="bool" userarchive="y">false</ambient-occlusion>
|
||||
<exposure type="float" userarchive="y">1.0</exposure>
|
||||
<use-color-for-depth type="bool">false</use-color-for-depth>
|
||||
<debug type="bool">false</debug>
|
||||
<realism type="int">5</realism>
|
||||
<filtering type="int">8</filtering>
|
||||
|
@ -748,13 +749,9 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
|
||||
<ai>
|
||||
<enabled type="bool">true</enabled>
|
||||
<scenarios-enabled type="bool" userarchive="y">true</scenarios-enabled>
|
||||
<scenario>nimitz_demo</scenario>
|
||||
<groundnet-cache type="bool">true</groundnet-cache>
|
||||
<!-- <scenario>balloon_demo</scenario> -->
|
||||
<!-- <scenario>aircraft_demo</scenario> -->
|
||||
<!-- <scenario>refueling_demo</scenario> -->
|
||||
<!-- <scenario>lead_aircraft</scenario> -->
|
||||
<!-- <scenario>vinson_demo</scenario> -->
|
||||
</ai>
|
||||
|
||||
<multiplay preserve="y">
|
||||
|
|
Loading…
Reference in a new issue