Batch indexing/no-fixed-function WIP.

This commit is contained in:
Shyotl
2011-08-09 01:11:05 -05:00
parent 1e7415095c
commit 9bda97786f
225 changed files with 2120 additions and 729 deletions

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);

View File

@@ -5,11 +5,10 @@
* $/LicenseInfo$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable
uniform sampler2D diffuseMap;
uniform sampler2DRectShadow shadowMap0;
uniform sampler2DRectShadow shadowMap1;
uniform sampler2DRectShadow shadowMap2;
@@ -105,7 +104,7 @@ void main()
}
}
vec4 diff= texture2D(diffuseMap, gl_TexCoord[0].xy);
vec4 diff = diffuseLookup(gl_TexCoord[0].xy);
vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a);
vec4 color = diff * col;

View File

@@ -0,0 +1,125 @@
/**
* @file alphaF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRectShadow shadowMap0;
uniform sampler2DRectShadow shadowMap1;
uniform sampler2DRectShadow shadowMap2;
uniform sampler2DRectShadow shadowMap3;
uniform sampler2DRect depthMap;
uniform sampler2D diffuseMap;
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform vec2 screen_res;
uniform vec2 shadow_res;
vec3 atmosLighting(vec3 light);
vec3 scaleSoftClip(vec3 light);
varying vec3 vary_ambient;
varying vec3 vary_directional;
varying vec3 vary_fragcoord;
varying vec3 vary_position;
varying vec3 vary_pointlight_col;
uniform float shadow_bias;
uniform mat4 inv_proj;
vec4 getPosition(vec2 pos_screen)
{
float depth = texture2DRect(depthMap, pos_screen.xy).a;
vec2 sc = pos_screen.xy*2.0;
sc /= screen_res;
sc -= vec2(1.0,1.0);
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
vec4 pos = inv_proj * ndc;
pos.xyz /= pos.w;
pos.w = 1.0;
return pos;
}
float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
{
stc.xyz /= stc.w;
stc.z += shadow_bias;
float cs = shadow2DRect(shadowMap, stc.xyz).x;
float shadow = cs;
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, scl, 0.0)).x, cs);
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, -scl, 0.0)).x, cs);
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, scl, 0.0)).x, cs);
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, -scl, 0.0)).x, cs);
return shadow/5.0;
}
void main()
{
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
frag *= screen_res;
float shadow = 1.0;
vec4 pos = vec4(vary_position, 1.0);
vec4 spos = pos;
if (spos.z > -shadow_clip.w)
{
vec4 lpos;
if (spos.z < -shadow_clip.z)
{
lpos = shadow_matrix[3]*spos;
lpos.xy *= shadow_res;
shadow = pcfShadow(shadowMap3, lpos, 1.5);
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
}
else if (spos.z < -shadow_clip.y)
{
lpos = shadow_matrix[2]*spos;
lpos.xy *= shadow_res;
shadow = pcfShadow(shadowMap2, lpos, 1.5);
}
else if (spos.z < -shadow_clip.x)
{
lpos = shadow_matrix[1]*spos;
lpos.xy *= shadow_res;
shadow = pcfShadow(shadowMap1, lpos, 1.5);
}
else
{
lpos = shadow_matrix[0]*spos;
lpos.xy *= shadow_res;
shadow = pcfShadow(shadowMap0, lpos, 1.5);
}
}
vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy);
vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a);
vec4 color = diff * col;
color.rgb = atmosLighting(color.rgb);
color.rgb = scaleSoftClip(color.rgb);
color.rgb += diff.rgb * vary_pointlight_col.rgb;
//gl_FragColor = gl_Color;
gl_FragColor = color;
//gl_FragColor.r = 0.0;
//gl_FragColor = vec4(1,shadow,1,1);
}

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);

View File

@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
#version 120
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -22,6 +22,7 @@ varying vec3 vary_directional;
varying vec3 vary_fragcoord;
varying vec3 vary_position;
varying vec3 vary_pointlight_col;
varying float vary_texture_index;
uniform float near_clip;
uniform float shadow_offset;
@@ -55,11 +56,13 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
//transform vertex
gl_Position = ftransform();
vec4 vert = vec4(gl_Vertex.xyz, 1.0);
vary_texture_index = gl_Vertex.w;
gl_Position = gl_ModelViewProjectionMatrix * vert;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
vec4 pos = (gl_ModelViewMatrix * vert);
vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
@@ -94,7 +97,7 @@ void main()
gl_FogFragCoord = pos.z;
pos = gl_ModelViewProjectionMatrix * gl_Vertex;
pos = gl_ModelViewProjectionMatrix * vert;
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
}

View File

@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
#version 120
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
@@ -37,19 +37,24 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
//get distance
float d = length(lv);
//normalize light vector
lv *= 1.0/d;
float da = 0.0;
if (d > 0.0 && la > 0.0 && fa > 0.0)
{
//normalize light vector
lv *= 1.0/d;
//distance attenuation
float dist2 = d*d/(la*la);
float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
//distance attenuation
float dist2 = d*d/(la*la);
da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
da *= spot*spot; // GL_SPOT_EXPONENT=2
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
da *= spot*spot; // GL_SPOT_EXPONENT=2
//angular attenuation
da *= calcDirectionalLight(n, lv);
//angular attenuation
da *= calcDirectionalLight(n, lv);
}
return da;
}

View File

@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable
@@ -22,7 +22,7 @@ uniform vec2 screen_res;
float getDepth(vec2 pos_screen)
{
float z = texture2DRect(depthMap, pos_screen.xy).a;
float z = texture2DRect(depthMap, pos_screen.xy).r;
z = z*2.0-1.0;
vec4 ndc = vec4(0.0, 0.0, z, 1.0);
vec4 p = inv_proj*ndc;

View File

@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
#version 120
varying vec2 vary_fragcoord;
uniform vec2 screen_res;

View File

@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable
@@ -91,7 +91,7 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
vec4 getPosition(vec2 pos_screen)
{
float depth = texture2DRect(depthMap, pos_screen.xy).a;
float depth = texture2DRect(depthMap, pos_screen.xy).r;
vec2 sc = pos_screen.xy*2.0;
sc /= screen_res;
sc -= vec2(1.0,1.0);

View File

@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable
@@ -288,54 +288,8 @@ void main()
float sa = dot(refnormpersp, vary_light.xyz);
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
/*
// screen-space cheap fakey reflection map
//
vec3 refnorm = normalize(reflect(vec3(0,0,-1), norm.xyz));
depth -= 0.5; // unbias depth
// first figure out where we'll make our 2D guess from
vec2 ref2d = (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
// Offset the guess source a little according to a trivial
// checkerboard dither function and spec.a.
// This is meant to be similar to sampling a blurred version
// of the diffuse map. LOD would be better in that regard.
// The goal of the blur is to soften reflections in surfaces
// with low shinyness, and also to disguise our lameness.
float checkerboard = floor(mod(tc.x+tc.y, 2.0)); // 0.0, 1.0
float checkoffset = (3.0 + (7.0*(1.0-spec.a)))*(checkerboard-0.5);
ref2d += vec2(checkoffset, checkoffset);
ref2d += tc.xy; // use as offset from destination
// Get attributes from the 2D guess point.
// We average two samples of diffuse (not of anything else) per
// pixel to try to reduce aliasing some more.
vec3 refcol = 0.5 * (texture2DRect(diffuseRect, ref2d + vec2(0.0, -checkoffset)).rgb +
texture2DRect(diffuseRect, ref2d + vec2(-checkoffset, 0.0)).rgb);
float refdepth = texture2DRect(depthMap, ref2d).a;
vec3 refpos = getPosition_d(ref2d, refdepth).xyz;
float refshad = texture2DRect(lightMap, ref2d).r;
vec3 refn = texture2DRect(normalMap, ref2d).rgb;
refn = vec3((refn.xy-0.5)*2.0,refn.z); // unpack norm
refn = normalize(refn);
// figure out how appropriate our guess actually was
float refapprop = max(0.0, dot(-refnorm, normalize(pos - refpos)));
// darken reflections from points which face away from the reflected ray - our guess was a back-face
//refapprop *= step(dot(refnorm, refn), 0.0);
refapprop = min(refapprop, max(0.0, -dot(refnorm, refn))); // more conservative variant
// get appropriate light strength for guess-point
// reflect light direction to increase the illusion that
// these are reflections.
vec3 reflight = reflect(lightnorm.xyz, norm.xyz);
float reflit = min(max(dot(refn, reflight.xyz), 0.0), refshad);
// apply sun color to guess-point, dampen according to inappropriateness of guess
float refmod = min(refapprop, reflit);
vec3 refprod = vary_SunlitColor * refcol.rgb * refmod;
vec3 ssshiny = (refprod * spec.a);
ssshiny *= 0.3; // dampen it even more
*/
vec3 ssshiny = vec3(0,0,0);
// add the two types of shiny together
col += (ssshiny + dumbshiny) * spec.rgb;
col += dumbshiny * spec.rgb;
}
col = atmosLighting(col);

View File

@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
#version 120
uniform vec2 screen_res;

View File

@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable

View File

@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable
@@ -45,7 +45,7 @@ uniform float spot_shadow_offset;
vec4 getPosition(vec2 pos_screen)
{
float depth = texture2DRect(depthMap, pos_screen.xy).a;
float depth = texture2DRect(depthMap, pos_screen.xy).r;
vec2 sc = pos_screen.xy*2.0;
sc /= screen_res;
sc -= vec2(1.0,1.0);

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable

View File

@@ -5,7 +5,7 @@
* $/LicenseInfo$
*/
#version 120
varying vec4 vary_light;
varying vec2 vary_fragcoord;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect RenderTexture;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
uniform vec2 texelSize;
uniform vec2 blurDirection;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect RenderTexture;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
void main(void)
{

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect RenderTexture;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect RenderTexture;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect RenderTexture;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
uniform sampler2D detail_0;
uniform sampler2D detail_1;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
void calcAtmospherics(vec3 inPositionEye);

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
uniform sampler2D detail_0;
uniform sampler2D detail_1;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
uniform sampler2D diffuseMap;
uniform sampler2D bumpMap;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
vec3 scaleSoftClip(vec3 inColor);
vec3 atmosTransport(vec3 inColor);

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
uniform vec4 lightnorm;
uniform vec4 waterPlane;

View File

@@ -5,16 +5,14 @@
* $License$
*/
#version 120
uniform sampler2D diffuseMap;
vec3 atmosLighting(vec3 light);
vec3 scaleSoftClip(vec3 light);
void default_lighting()
{
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
color.rgb = atmosLighting(color.rgb);

View File

@@ -5,16 +5,14 @@
* $License$
*/
#version 120
uniform sampler2D diffuseMap;
vec3 fullbrightAtmosTransport(vec3 light);
vec3 fullbrightScaleSoftClip(vec3 light);
void fullbright_lighting()
{
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
color.rgb = fullbrightAtmosTransport(color.rgb);

View File

@@ -0,0 +1,25 @@
/**
* @file lightFullbrightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
vec3 fullbrightAtmosTransport(vec3 light);
vec3 fullbrightScaleSoftClip(vec3 light);
uniform sampler2D diffuseMap;
void fullbright_lighting()
{
vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
color.rgb = fullbrightAtmosTransport(color.rgb);
color.rgb = fullbrightScaleSoftClip(color.rgb);
gl_FragColor = color;
}

View File

@@ -5,9 +5,8 @@
* $License$
*/
#version 120
uniform sampler2D diffuseMap;
uniform samplerCube environmentMap;
vec3 fullbrightShinyAtmosTransport(vec3 light);
@@ -15,7 +14,7 @@ vec3 fullbrightScaleSoftClip(vec3 light);
void fullbright_shiny_lighting()
{
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy);
vec4 color = diffuseLookup(gl_TexCoord[0].xy);
color.rgb *= gl_Color.rgb;
vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;

View File

@@ -0,0 +1,32 @@
/**
* @file lightFullbrightShinyF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
uniform samplerCube environmentMap;
uniform sampler2D diffuseMap;
vec3 fullbrightShinyAtmosTransport(vec3 light);
vec3 fullbrightScaleSoftClip(vec3 light);
void fullbright_shiny_lighting()
{
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy);
color.rgb *= gl_Color.rgb;
vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;
color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
color.rgb = fullbrightShinyAtmosTransport(color.rgb);
color.rgb = fullbrightScaleSoftClip(color.rgb);
color.a = max(color.a, gl_Color.a);
gl_FragColor = color;
}

View File

@@ -5,9 +5,9 @@
* $License$
*/
#version 120
uniform sampler2D diffuseMap;
uniform samplerCube environmentMap;
vec3 fullbrightShinyAtmosTransport(vec3 light);
@@ -16,7 +16,7 @@ vec4 applyWaterFog(vec4 color);
void fullbright_shiny_lighting_water()
{
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy);
vec4 color = diffuseLookup(gl_TexCoord[0].xy);
color.rgb *= gl_Color.rgb;
vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;

View File

@@ -0,0 +1,32 @@
/**
* @file lightFullbrightShinyWaterF.glsl
*
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
* $License$
*/
uniform samplerCube environmentMap;
uniform sampler2D diffuseMap;
vec3 fullbrightShinyAtmosTransport(vec3 light);
vec3 fullbrightScaleSoftClip(vec3 light);
vec4 applyWaterFog(vec4 color);
void fullbright_shiny_lighting_water()
{
vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
color.rgb *= gl_Color.rgb;
vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;
color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
color.rgb = fullbrightShinyAtmosTransport(color.rgb);
color.rgb = fullbrightScaleSoftClip(color.rgb);
color.a = max(color.a, gl_Color.a);
gl_FragColor = applyWaterFog(color);
}

View File

@@ -5,16 +5,16 @@
* $License$
*/
#version 120
uniform sampler2D diffuseMap;
vec4 diffuseLookup(vec2 texcoord);
vec3 fullbrightAtmosTransport(vec3 light);
vec4 applyWaterFog(vec4 color);
void fullbright_lighting_water()
{
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
color.rgb = fullbrightAtmosTransport(color.rgb);

View File

@@ -0,0 +1,23 @@
/**
* @file lightFullbrightWaterF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
uniform sampler2D diffuseMap;
vec3 fullbrightAtmosTransport(vec3 light);
vec4 applyWaterFog(vec4 color);
void fullbright_lighting_water()
{
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
color.rgb = fullbrightAtmosTransport(color.rgb);
gl_FragColor = applyWaterFog(color);
}

View File

@@ -0,0 +1,25 @@
/**
* @file lightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
uniform sampler2D diffuseMap;
vec3 atmosLighting(vec3 light);
vec3 scaleSoftClip(vec3 light);
void default_lighting()
{
vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
color.rgb = atmosLighting(color.rgb);
color.rgb = scaleSoftClip(color.rgb);
gl_FragColor = color;
}

View File

@@ -5,9 +5,9 @@
* $License$
*/
#version 120
uniform sampler2D diffuseMap;
uniform samplerCube environmentMap;
vec3 scaleSoftClip(vec3 light);
@@ -16,7 +16,7 @@ vec4 applyWaterFog(vec4 color);
void shiny_lighting()
{
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy);
vec4 color = diffuseLookup(gl_TexCoord[0].xy);
color.rgb *= gl_Color.rgb;
vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;

View File

@@ -0,0 +1,32 @@
/**
* @file lightShinyF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
uniform samplerCube environmentMap;
uniform sampler2D diffuseMap;
vec3 scaleSoftClip(vec3 light);
vec3 atmosLighting(vec3 light);
vec4 applyWaterFog(vec4 color);
void shiny_lighting()
{
vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
color.rgb *= gl_Color.rgb;
vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;
color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
color.rgb = atmosLighting(color.rgb);
color.rgb = scaleSoftClip(color.rgb);
color.a = max(color.a, gl_Color.a);
gl_FragColor = color;
}

View File

@@ -5,10 +5,9 @@
* $License$
*/
#version 120
uniform sampler2D diffuseMap;
uniform samplerCube environmentMap;
vec3 atmosLighting(vec3 light);
@@ -16,7 +15,7 @@ vec4 applyWaterFog(vec4 color);
void shiny_lighting_water()
{
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy);
vec4 color = diffuseLookup(gl_TexCoord[0].xy);
color.rgb *= gl_Color.rgb;
vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;

View File

@@ -0,0 +1,29 @@
/**
* @file lightShinyWaterF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
uniform sampler2D diffuseMap;
uniform samplerCube environmentMap;
vec3 atmosLighting(vec3 light);
vec4 applyWaterFog(vec4 color);
void shiny_lighting_water()
{
vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
color.rgb *= gl_Color.rgb;
vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;
color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
color.rgb = atmosLighting(color.rgb);
color.a = max(color.a, gl_Color.a);
gl_FragColor = applyWaterFog(color);
}

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
// All lights, no specular highlights

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
// All lights, no specular highlights

View File

@@ -5,16 +5,14 @@
* $License$
*/
#version 120
uniform sampler2D diffuseMap;
vec3 atmosLighting(vec3 light);
vec4 applyWaterFog(vec4 color);
void default_lighting_water()
{
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
color.rgb = atmosLighting(color.rgb);

View File

@@ -0,0 +1,23 @@
/**
* @file lightWaterF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
uniform sampler2D diffuseMap;
vec3 atmosLighting(vec3 light);
vec4 applyWaterFog(vec4 color);
void default_lighting_water()
{
vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
color.rgb = atmosLighting(color.rgb);
gl_FragColor = applyWaterFog(color);
}

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da);
vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol);

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
float calcDirectionalLight(vec3 n, vec3 l);
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);

View File

@@ -0,0 +1,35 @@
/**
* @file fullbrightShinyV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
void calcAtmospherics(vec3 inPositionEye);
uniform vec4 origin;
varying float vary_texture_index;
void main()
{
//transform vertex
vec4 vert = vec4(gl_Vertex.xyz,1.0);
vary_texture_index = gl_Vertex.w;
gl_Position = gl_ModelViewProjectionMatrix*vert;
vec4 pos = (gl_ModelViewMatrix * vert);
vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
vec3 ref = reflect(pos.xyz, -norm);
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
gl_FrontColor = gl_Color;
gl_FogFragCoord = pos.z;
}

View File

@@ -0,0 +1,29 @@
/**
* @file fullbrightV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
void calcAtmospherics(vec3 inPositionEye);
varying float vary_texture_index;
void main()
{
//transform vertex
vec4 vert = vec4(gl_Vertex.xyz,1.0);
vary_texture_index = gl_Vertex.w;
gl_Position = gl_ModelViewProjectionMatrix*vert;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
vec4 pos = (gl_ModelViewMatrix * vert);
calcAtmospherics(pos.xyz);
gl_FrontColor = gl_Color;
gl_FogFragCoord = pos.z;
}

View File

@@ -5,20 +5,24 @@
* $License$
*/
#version 120
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
varying float vary_texture_index;
uniform vec4 origin;
void main()
{
//transform vertex
gl_Position = ftransform();
vec4 vert = vec4(gl_Vertex.xyz,1.0);
vary_texture_index = gl_Vertex.w;
gl_Position = gl_ModelViewProjectionMatrix*vert;
vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
vec4 pos = (gl_ModelViewMatrix * vert);
vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
vec3 ref = reflect(pos.xyz, -norm);

View File

@@ -0,0 +1,33 @@
/**
* @file simpleV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* $/LicenseInfo$
*/
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
varying float vary_texture_index;
void main()
{
//transform vertex
vec4 vert = vec4(gl_Vertex.xyz,1.0);
vary_texture_index = gl_Vertex.w;
gl_Position = gl_ModelViewProjectionMatrix*vert;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
vec4 pos = (gl_ModelViewMatrix * vert);
vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
calcAtmospherics(pos.xyz);
vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
gl_FrontColor = color;
gl_FogFragCoord = pos.z;
}

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
//////////////////////////////////////////////////////////
// The fragment shader for the terrain atmospherics

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
// Output variables
vec3 getSunlitColor();

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
// varying param funcs
void setSunlitColor(vec3 v);

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
varying vec3 vary_PositionEye;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
varying vec3 vary_PositionEye;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
/////////////////////////////////////////////////////////////////////////
// The fragment shader for the sky

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
//////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
uniform vec4 gamma;

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
/////////////////////////////////////////////////////////////////////////
// The fragment shader for the sky

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
// SKY ////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky

View File

@@ -5,7 +5,7 @@
* $License$
*/
#version 120
//////////////////////////////////////////////////////////
// The fragment shader for the terrain atmospherics