Merge remote-tracking branch 'upstream/master'

This commit is contained in:
KroArtem 2014-03-15 01:15:48 +04:00
commit ccd6019f48
265 changed files with 5440 additions and 3519 deletions

3
.gitignore vendored
View File

@ -18,6 +18,9 @@ data/textures
data/tracks
data/.svn
# Ignore doxygen output
src/html
*.o
*.d
*.a

View File

@ -20,7 +20,7 @@ no particular order):
- Esp. different platforms
6. Package creators
- Create packages for
- most common Linux Distributors
- most common Linux distributions
- Windows
7. Writers
- Write documentation, ranging from man page, to

View File

@ -1,17 +1,29 @@
<?xml version="1.0"?>
<achievements>
<achievement id="1" type="map" title="Christoffel Columbus" description="Play every official track at least once." >
<entry key="farm" goal="1"/>
<entry key="scotland" goal="1"/>
<entry key="lighthouse" goal="1"/>
<entry key="sandtrack" goal="1"/>
<entry key="olivermath" goal="1"/>
<entry key="subsea" goal="1"/>
<entry key="mansion" goal="1"/>
<entry key="minigolf" goal="1"/>
<entry key="hacienda" goal="1"/>
<entry key="jungle" goal="1"/>
<achievement id="1" check-type="all-at-least" reset-after-race="no"
title="Christoffel Columbus" description="Play every official track at least once." >
<farm goal="1"/>
<scotland goal="1"/>
<lighthouse goal="1"/>
<sandtrack goal="1"/>
<olivermath goal="1"/>
<subsea goal="1"/>
<mansion goal="1"/>
<minigolf goal="1"/>
<hacienda goal="1"/>
<jungle goal="1"/>
</achievement>
<achievement id="2" check-type="all-at-least" reset-after-race="no"
title="Strike!" description="Hit 10 karts with a bowling-ball.">
<ball goal="10"/>
</achievement>
<achievement id="3" check-type="one-at-least" reset-after-race="yes"
title="Arch Enemy" description="Hit the same kart at least 5 times in one race">
<hit goal="5"/>
</achievement>
<achievement id="4" check-type="all-at-least" reset-after-race="yes"
title="Marathoner" description="Make a race with 5 laps or more">
<laps goal="5"/>
</achievement>
<achievement id="2" type="single" goal="10" title="Strike!" description="Hit 10 karts with a bowling-ball." />
</achievements>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +1,13 @@
#version 330
uniform sampler2D tex;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main(void)
{

View File

@ -1,12 +1,18 @@
#version 330
uniform mat4 ModelViewMatrix;
uniform mat4 ProjectionMatrix;
uniform vec3 Position;
uniform vec2 Size;
#if __VERSION__ >= 130
in vec2 Corner;
in vec2 Texcoord;
out vec2 uv;
#else
attribute vec2 Corner;
attribute vec2 Texcoord;
varying vec2 uv;
#endif
void main(void)
{

View File

@ -1,9 +1,14 @@
#version 330
uniform sampler2D tex;
uniform float low;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,8 +1,13 @@
#version 330
uniform sampler2D tex;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform float power;
uniform sampler2D tex;

View File

@ -14,11 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#version 330
uniform sampler2D tex;
uniform float transparency;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -17,13 +17,21 @@
// Creates a bubble (wave) effect by distorting the texture depending on time
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform float time;
#if __VERSION__ >= 130
in vec3 Position;
in vec2 Texcoord;
out vec2 uv;
#else
attribute vec3 Position;
attribute vec2 Texcoord;
varying vec2 uv;
#endif
void main()
{

View File

@ -1,20 +1,32 @@
#version 330 compatibility
uniform sampler2D tex;
uniform sampler2D Albedo;
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
uniform sampler2D caustictex;
uniform vec2 dir;
uniform vec2 dir2;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{
vec2 tc = gl_TexCoord[0].xy;
vec2 tc = gl_FragCoord.xy / screen;
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
vec4 color = texture(Albedo, uv);
float ao = texture(SSAO, tc).x;
vec3 col = texture(tex, tc).xyz;
float caustic = texture(caustictex, tc + dir).x;
float caustic2 = texture(caustictex, (tc.yx + dir2 * vec2(-0.6, 0.3)) * vec2(0.6)).x;
float caustic = texture(caustictex, uv + dir).x;
float caustic2 = texture(caustictex, (uv.yx + dir2 * vec2(-0.6, 0.3)) * vec2(0.6)).x;
col += caustic * caustic2 * 10.0;
FragColor = vec4(col, 1.0);
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent + caustic * caustic2 * 10;
FragColor = vec4(color.xyz * LightFactor, 1.);
}

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform sampler2D tex;
uniform sampler2D oldtex;
uniform vec2 pixel;

View File

@ -1,20 +1,34 @@
#version 330
uniform sampler2D tex;
uniform sampler2D dtex;
uniform vec3 inlevel;
uniform vec2 outlevel;
uniform mat4 invprojm;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{
vec2 texc = uv;
//texc.y = 1.0 - texc.y;
vec4 col = texture(tex, uv);
float curdepth = texture(dtex, uv).x;
vec4 FragPos = invprojm * (2.0 * vec4(uv, curdepth, 1.0f) - 1.0f);
FragPos /= FragPos.w;
float depth = clamp(FragPos.z / 180, 0, 1);
depth = (1 - depth);
vec4 col = texture(tex, texc);
//col = col / (1 - col);
// Compute the vignette
vec2 inside = uv - 0.5;
float vignette = 1 - dot(inside, inside);
vignette = clamp(pow(vignette, 0.8), 0, 1);
vignette = clamp(vignette + vignette - 0.5, 0, 1.15);
float inBlack = inlevel.x;
float inWhite = inlevel.z;
@ -23,8 +37,11 @@ void main()
float outBlack = outlevel.x;
float outWhite = outlevel.y;
col.rgb = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
vec3 colSat = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0;
vec3 colFinal = colSat * depth + col.rgb * (1 - depth);
FragColor = vec4(col.rgb, 1.0);
FragColor = vec4(colFinal * vignette, 1.0);
//FragColor = vec4(vec3(depth), 1.0);
}

View File

@ -1,7 +1,11 @@
#version 330
uniform ivec4 color;
#if __VERSION__ >= 130
out vec4 FragColor;
#else
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,8 +1,12 @@
#version 330
uniform vec2 center;
uniform vec2 size;
#if __VERSION__ >= 130
in vec2 position;
#else
attribute vec2 position;
#endif
void main()
{

View File

@ -1,7 +1,11 @@
#version 330
uniform vec3 col;
#if __VERSION__ >= 130
out vec4 FragColor;
#else
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,14 +0,0 @@
#version 130
uniform vec3 col;
uniform sampler2D tex;
out vec4 FragColor;
void main()
{
float alpha = texture(tex, gl_TexCoord[0].xy).a;
if (alpha < 0.5)
discard;
FragColor = vec4(col, 1.0);
}

View File

@ -1,9 +1,16 @@
#version 330
uniform sampler2D tex;
#if __VERSION__ >= 130
in vec2 uv;
in vec4 col;
out vec4 FragColor;
#else
varying vec2 uv;
varying vec4 col;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,14 +1,22 @@
#version 330
uniform vec2 center;
uniform vec2 size;
uniform vec2 texcenter;
uniform vec2 texsize;
#if __VERSION__ >= 130
in vec2 position;
in vec2 texcoord;
in uvec4 color;
out vec2 uv;
out vec4 col;
#else
attribute vec2 position;
attribute vec2 texcoord;
attribute uvec4 color;
varying vec2 uv;
varying vec4 col;
#endif
void main()
{

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D Albedo;
uniform sampler2D Detail;
uniform sampler2D DiffuseMap;
@ -6,9 +5,18 @@ uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
#if __VERSION__ >= 130
in vec2 uv;
in vec2 uv_bis;
out vec4 FragColor;
#else
varying vec2 uv;
varying vec2 uv_bis;
#define FragColor gl_FragColor
#endif
void main(void)
{

View File

@ -0,0 +1,52 @@
uniform float blueLmn[9];
uniform float greenLmn[9];
uniform float redLmn[9];
uniform sampler2D ntex;
uniform mat4 TransposeViewMatrix;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 Diff;
out vec4 Spec;
#else
varying vec2 uv;
#define Diff gl_FragData[0]
#define Spec gl_FragData[1]
#endif
vec3 DecodeNormal(vec2 n)
{
float z = dot(n, n) * 2. - 1.;
vec2 xy = normalize(n) * sqrt(1. - z * z);
return vec3(xy,z);
}
mat4 getMatrix(float L[9])
{
float c1 = 0.429043, c2 = 0.511664, c3 = 0.743125, c4 = 0.886227, c5 = 0.247708;
return mat4(
c1 * L[8] /*L22*/, c1 * L[4] /*L2-2*/, c1 * L[7] /*L21*/, c2 * L[3] /*L11*/,
c1 * L[4], - c1 * L[8], c1 * L[5] /*L2-1*/, c2 * L[1] /*L1-1*/,
c1 * L[7], c1 * L[5], c3 * L[6] /*L20*/, c2 * L[2] /*L10*/,
c2 * L[3], c2 * L[1], c2 * L[2], c4 * L[0] /*L00*/ - c5 * L[6]
);
}
void main(void)
{
vec3 normal = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
// Convert normal in world space (where SH coordinates were computed)
vec4 extendednormal = TransposeViewMatrix * vec4(normal, 1.);
extendednormal.w = 1.;
mat4 rmat = getMatrix(redLmn);
mat4 gmat = getMatrix(greenLmn);
mat4 bmat = getMatrix(blueLmn);
float r = dot(extendednormal, rmat * extendednormal);
float g = dot(extendednormal, gmat * extendednormal);
float b = dot(extendednormal, bmat * extendednormal);
Diff = 0.25 * vec4(r, g, b, .1);
Spec = vec4(0.);
}

View File

@ -1,19 +1,29 @@
#version 330
uniform sampler2D tex;
uniform sampler2D displacement_tex;
uniform sampler2D mask_tex;
uniform sampler2D color_tex;
uniform vec2 screen;
uniform vec2 dir;
uniform vec2 dir2;
#if __VERSION__ >= 130
in vec2 uv;
in vec2 uv_bis;
in float camdist;
out vec4 FragColor;
#else
varying vec2 uv;
varying vec2 uv_bis;
varying float camdist;
#define FragColor gl_FragColor
#endif
const float maxlen = 0.02;
void main()
{
float horiz = texture(tex, uv + dir).x;
float vert = texture(tex, (uv.yx + dir2) * vec2(0.9)).x;
float horiz = texture(displacement_tex, uv + dir).x;
float vert = texture(displacement_tex, (uv.yx + dir2) * vec2(0.9)).x;
vec2 offset = vec2(horiz, vert);
offset *= 2.0;
@ -30,11 +40,20 @@ void main()
offset *= 50.0 * fade * maxlen;
vec4 col;
col.r = step(offset.x, 0.0) * -offset.x;
col.g = step(0.0, offset.x) * offset.x;
col.b = step(offset.y, 0.0) * -offset.y;
col.a = step(0.0, offset.y) * offset.y;
vec4 shiftval;
shiftval.r = step(offset.x, 0.0) * -offset.x;
shiftval.g = step(0.0, offset.x) * offset.x;
shiftval.b = step(offset.y, 0.0) * -offset.y;
shiftval.a = step(0.0, offset.y) * offset.y;
FragColor = col;
vec2 shift;
shift.x = -shiftval.x + shiftval.y;
shift.y = -shiftval.z + shiftval.w;
shift /= 50.;
vec2 tc = gl_FragCoord.xy / screen;
float mask = texture(mask_tex, tc + shift).x;
tc += (mask < 1.) ? vec2(0.) : shift;
FragColor = texture(color_tex, tc);
}

View File

@ -1,13 +1,23 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 ModelViewMatrix;
#if __VERSION__ >= 130
in vec3 Position;
in vec2 Texcoord;
in vec2 SecondTexcoord;
out vec2 uv;
out vec2 uv_bis;
out float camdist;
#else
attribute vec3 Position;
attribute vec2 Texcoord;
attribute vec2 SecondTexcoord;
varying vec2 uv;
varying vec2 uv_bis;
varying float camdist;
#endif
void main() {
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform mat4 ModelViewProjectionMatrix;
void main() {

View File

@ -1,4 +1,3 @@
#version 330
uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrix;

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D tex;
uniform float fogmax;
@ -9,8 +8,14 @@ uniform float end;
uniform vec3 col;
uniform mat4 ipvmat;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,11 +1,15 @@
#version 330
uniform sampler2D tex;
uniform vec2 pixel;
// Gaussian separated blur with radius 3.
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,11 +1,15 @@
#version 330
uniform sampler2D tex;
uniform vec2 pixel;
// Gaussian separated blur with radius 3.
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,11 +1,15 @@
#version 330
uniform sampler2D tex;
uniform vec2 pixel;
// Gaussian separated blur with radius 6.
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,11 +1,15 @@
#version 330
uniform sampler2D tex;
uniform vec2 pixel;
// Gaussian separated blur with radius 6.
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,8 +1,12 @@
#version 330
uniform sampler2D tex;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,11 +1,17 @@
#version 330 compatibility
uniform sampler2D tex;
uniform vec3 col;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{
vec4 res = texture(tex, gl_TexCoord[0].xy);
vec4 res = texture(tex, uv);
// Keep the sun fully bright, but fade the sky
float mul = distance(res.xyz, col);

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform sampler2D tex;
uniform vec2 sunpos;
@ -6,14 +5,20 @@ uniform vec2 sunpos;
const float decaystep = 0.88;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{
vec2 texc = gl_TexCoord[0].xy;
vec2 texc = uv;
vec2 tosun = sunpos - texc;
if (dot(tosun, tosun) > 0.49) discard;
// if (dot(tosun, tosun) > 0.49) discard;
vec2 dist = tosun * 1.0/(float(SAMPLES) * 1.12);

View File

@ -1,14 +1,24 @@
#version 330
uniform vec3 windDir;
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
#if __VERSION__ >= 130
in vec3 Position;
in vec3 Normal;
in vec2 Texcoord;
in vec4 Color;
noperspective out vec3 nor;
out vec3 nor;
out vec2 uv;
#else
attribute vec3 Position;
attribute vec3 Normal;
attribute vec2 Texcoord;
attribute vec4 Color;
varying vec3 nor;
varying vec2 uv;
#endif
void main()
{

View File

@ -1,11 +1,17 @@
#version 330
uniform vec3 windDir;
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ >= 130
in vec3 Position;
in vec2 Texcoord;
in vec4 Color;
out vec2 uv;
#else
attribute vec3 Position;
attribute vec2 Texcoord;
attribute vec4 Color;
varying vec2 uv;
#endif
void main()
{

View File

@ -1,5 +1,3 @@
#version 330 compatibility
uniform sampler2D tex;
uniform vec2 texsize;
uniform int notex;

View File

@ -17,7 +17,6 @@
// motion_blur.frag
#version 330
// The actual boost amount (which linearly scales the blur to be shown).
// should be in the range [0.0, 1.0], though a larger value might make
@ -41,8 +40,13 @@ uniform float mask_radius;
// Maximum height of texture used
uniform float max_tex_height;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
// Number of samples used for blurring
#define NB_SAMPLES 8

View File

@ -1,26 +0,0 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2013 the SuperTuxKart team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// motion_blur.vert
#version 330 compatibility
void main()
{
gl_TexCoord[0].st = vec2(gl_MultiTexCoord0.s, gl_MultiTexCoord0.t);
gl_Position = gl_Vertex;
}

View File

@ -1,22 +0,0 @@
#version 330
uniform sampler2D Albedo;
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
in vec2 uv;
out vec4 FragColor;
void main(void)
{
vec2 tc = gl_FragCoord.xy / screen;
vec4 color = texture(Albedo, uv);
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
float ao = texture(SSAO, tc).x;
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent * (1. - color.a);
FragColor = vec4(color.xyz * LightFactor * (0.4 + ao*0.6), 1.);
//FragColor = vec4(color.xyz * LightFactor, 1.);
}

View File

@ -1,16 +0,0 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TextureMatrix;
in vec3 Position;
in vec2 Texcoord;
in vec2 SecondTexcoord;
out vec2 uv;
out vec2 uv_bis;
void main(void)
{
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
uv_bis = SecondTexcoord;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
}

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform sampler2D tex1;
uniform sampler2D tex2;

View File

@ -1,10 +1,17 @@
#version 330
uniform sampler2D normalMap;
noperspective in vec3 tangent;
noperspective in vec3 bitangent;
#if __VERSION__ >= 130
in vec3 tangent;
in vec3 bitangent;
in vec2 uv;
out vec2 EncodedNormal;
#else
varying vec3 tangent;
varying vec3 bitangent;
varying vec2 uv;
#define EncodedNormal gl_FragColor.xy
#endif
// from Crytek "a bit more deferred CryEngine"
vec2 EncodeNormal(vec3 n)

View File

@ -1,14 +1,25 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
#if __VERSION__ >= 130
in vec3 Position;
in vec2 Texcoord;
in vec3 Tangent;
in vec3 Bitangent;
noperspective out vec3 tangent;
noperspective out vec3 bitangent;
out vec3 tangent;
out vec3 bitangent;
out vec2 uv;
#else
attribute vec3 Position;
attribute vec2 Texcoord;
attribute vec3 Tangent;
attribute vec3 Bitangent;
varying vec3 tangent;
varying vec3 bitangent;
varying vec2 uv;
#endif
void main()
{

View File

@ -1,6 +1,12 @@
#version 330
noperspective in vec3 nor;
#if __VERSION__ >= 130
in vec3 nor;
out vec2 EncodedNormal;
#else
varying vec3 nor;
#define EncodedNormal gl_FragColor.xy
#endif
// from Crytek "a bit more deferred CryEngine"
vec2 EncodeNormal(vec3 n)

View File

@ -1,10 +1,16 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
#if __VERSION__ >= 130
in vec3 Position;
in vec3 Normal;
noperspective out vec3 nor;
out vec3 nor;
#else
attribute vec3 Position;
attribute vec3 Normal;
varying vec3 nor;
#endif
void main(void)
{

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D Albedo;
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
@ -6,8 +5,14 @@ uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main(void)
{

View File

@ -1,15 +1,28 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TextureMatrix =
mat4(1., 0., 0., 0.,
0., 1., 0., 0.,
0., 0., 1., 0.,
0., 0., 0., 1.);
#if __VERSION__ >= 130
in vec3 Position;
in vec2 Texcoord;
in vec2 SecondTexcoord;
out vec2 uv;
out vec2 uv_bis;
#else
attribute vec3 Position;
attribute vec2 Texcoord;
attribute vec2 SecondTexcoord;
varying vec2 uv;
varying vec2 uv_bis;
#endif
void main(void)
{
uv = Texcoord;
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
uv_bis = SecondTexcoord;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
}

View File

@ -1,7 +1,13 @@
#version 330
uniform sampler2D tex;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main(void)
{

View File

@ -1,29 +0,0 @@
#version 330
uniform sampler2D tex;
uniform int hastex;
uniform float objectid;
noperspective in vec3 nor;
in vec2 uv0;
in vec2 uv1;
out vec4 Albedo;
out vec4 NormalDepth;
out vec4 Specular;
void main() {
//if (hastex != 0) {
vec4 col = texture(tex, uv0);
if (col.a < 0.5)
discard;
Albedo = vec4(col.xyz, 1.);
//} else {
// Albedo = gl_Color;
//}
NormalDepth = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
Specular = vec4(1. - col.a);
}

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D Albedo;
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
@ -6,10 +5,15 @@ uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
noperspective in vec3 normal;
#if __VERSION__ >= 130
in vec3 normal;
in vec2 uv;
out vec4 FragColor;
#else
varying vec3 normal;
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main() {
float rim = 1.0 - dot(normal, vec3(0., 0., -1));

View File

@ -1,16 +1,25 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
uniform mat4 TextureMatrix;
#if __VERSION__ >= 130
in vec3 Position;
in vec3 Normal;
in vec2 Texcoord;
in vec4 Color;
out vec2 uv;
noperspective out vec3 normal;
out vec3 normal;
#else
attribute vec3 Position;
attribute vec3 Normal;
attribute vec2 Texcoord;
attribute vec4 Color;
varying vec2 uv;
varying vec3 normal;
#endif
void main() {
normal = (TransposeInverseModelView * vec4(Normal, 0)).xyz;
uv = Texcoord;
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
}

View File

@ -1,22 +1,27 @@
#version 330
uniform sampler2D tex;
uniform samplerCube tex;
uniform mat4 invproj;
uniform vec2 screen;
uniform mat4 TransposeViewMatrix;
noperspective in vec3 nor;
#if __VERSION__ >= 130
in vec3 nor;
out vec4 FragColor;
#else
varying vec3 nor;
#define FragColor gl_FragColor
#endif
void main() {
// Calculate the spherical UV
const vec3 forward = vec3(0.0, 0.0, 1.0);
vec3 fpos = gl_FragCoord.xyz / vec3(screen, 1.);
vec4 xpos = 2.0 * vec4(fpos, 1.0) - 1.0;
xpos = invproj * xpos;
// get the angle between the forward vector and the horizontal portion of the normal
vec3 normal_x = normalize(vec3(nor.x, 0.0, nor.z));
float sin_theta_x = length(cross( forward, normal_x )) * nor.x / abs(nor.x);
xpos.xyz /= xpos.w;
vec3 viewSampleDir = reflect(xpos.xyz, nor);
// Convert sampleDir in world space (where tex was generated)
vec4 sampleDir = TransposeViewMatrix * vec4(viewSampleDir, 0.);
vec4 detail0 = texture(tex, sampleDir.xyz);
// get the angle between the forward vector and the vertical portion of the normal
vec3 normal_y = normalize(vec3(0.0, nor.y, nor.z));
float sin_theta_y = length(cross( forward, normal_y )) * nor.y / abs(nor.y);
vec4 detail0 = texture(tex, 0.5 * vec2(sin_theta_x, sin_theta_y) + 0.5);
FragColor = vec4(detail0.xyz, 1.);
FragColor = vec4(detail0.xyz, 1.);
}

View File

@ -1,9 +1,15 @@
#version 330
uniform sampler2D tex;
noperspective in vec3 nor;
#if __VERSION__ >= 130
in vec3 nor;
in vec2 uv;
out vec2 EncodedNormal;
#else
varying vec3 nor;
varying vec2 uv;
#define EncodedNormal gl_FragColor.xy
#endif
// from Crytek "a bit more deferred CryEngine"
vec2 EncodeNormal(vec3 n)

View File

@ -1,16 +1,30 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
uniform mat4 TextureMatrix =
mat4(1., 0., 0., 0.,
0., 1., 0., 0.,
0., 0., 1., 0.,
0., 0., 0., 1.);
#if __VERSION__ >= 130
in vec3 Position;
in vec3 Normal;
in vec2 Texcoord;
noperspective out vec3 nor;
out vec3 nor;
out vec2 uv;
#else
attribute vec3 Position;
attribute vec3 Normal;
attribute vec2 Texcoord;
varying vec3 nor;
varying vec2 uv;
#endif
void main(void)
{
uv = Texcoord;
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
}

View File

@ -1,12 +1,18 @@
#version 330
uniform sampler2D Albedo;
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main(void)
{

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D tex;
uniform sampler2D dtex;
uniform mat4 invproj;

View File

@ -1,4 +1,3 @@
#version 330
uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrix;

View File

@ -1,4 +1,3 @@
#version 330
uniform int dt;
uniform mat4 sourcematrix;
uniform int level;

View File

@ -1,9 +1,10 @@
#version 330 compatibility
#version 330
uniform sampler2D tex;
in vec2 uv;
out vec4 FragColor;
void main()
{
FragColor = texture(tex, gl_TexCoord[0].xy);
FragColor = texture(tex, uv);
}

View File

@ -1,9 +1,11 @@
// Passthrough shader for drawQuad()
#version 330 compatibility
#version 330
in vec3 Position;
in vec2 Texcoord;
out vec2 uv;
void main() {
uv = gl_MultiTexCoord0.xy;
gl_Position = gl_Vertex;
uv = Texcoord;
gl_Position = vec4(Position, 1.);
}

View File

@ -1,9 +1,14 @@
#version 330
uniform sampler2D tex;
uniform vec2 pixel;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
// Separated penumbra, horizontal
void main()

View File

@ -1,9 +1,14 @@
#version 330
uniform sampler2D tex;
uniform vec2 pixel;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
// Separated penumbra, vertical

View File

@ -1,4 +1,3 @@
#version 330
uniform int dt;
uniform mat4 sourcematrix;
uniform int level;

View File

@ -1,15 +1,14 @@
#version 330
uniform sampler2D ntex;
uniform sampler2D dtex;
uniform vec4 center[16];
uniform vec4 col[16];
uniform float energy[16];
uniform float spec;
uniform mat4 invproj;
uniform mat4 viewm;
uniform mat4 ViewMatrix;
uniform vec2 screen;
flat in vec3 center;
flat in float energy;
flat in vec3 col;
in vec2 uv;
out vec4 Diffuse;
out vec4 Specular;
@ -21,7 +20,7 @@ vec3 DecodeNormal(vec2 n)
}
void main() {
vec2 texc = uv;
vec2 texc = gl_FragCoord.xy / screen;
float z = texture(dtex, texc).x;
vec3 norm = normalize(DecodeNormal(2. * texture(ntex, texc).xy - 1.));
@ -32,26 +31,23 @@ void main() {
vec3 diffuse = vec3(0.), specular = vec3(0.);
for (int i = 0; i < 16; ++i) {
vec4 pseudocenter = viewm * vec4(center[i].xyz, 1.0);
pseudocenter /= pseudocenter.w;
vec3 light_pos = pseudocenter.xyz;
vec3 light_col = col[i].xyz;
float d = distance(light_pos, xpos.xyz);
float att = energy[i] * 200. / (4. * 3.14 * d * d);
float spec_att = (energy[i] + 10.) * 200. / (4. * 3.14 * d * d);
vec4 pseudocenter = ViewMatrix * vec4(center.xyz, 1.0);
pseudocenter /= pseudocenter.w;
vec3 light_pos = pseudocenter.xyz;
vec3 light_col = col.xyz;
float d = distance(light_pos, xpos.xyz);
float att = energy * 200. / (4. * 3.14 * d * d);
float spec_att = (energy + 10.) * 200. / (4. * 3.14 * d * d);
// Light Direction
vec3 L = normalize(xpos.xyz - light_pos);
// Light Direction
vec3 L = normalize(xpos.xyz - light_pos);
float NdotL = max(0.0, dot(norm, -L));
diffuse += NdotL * light_col * att;
// Reflected light dir
vec3 R = reflect(-L, norm);
float RdotE = max(0.0, dot(R, eyedir));
float Specular = pow(RdotE, spec);
specular += Specular * light_col * spec_att;
}
float NdotL = max(0.0, dot(norm, -L));
diffuse += NdotL * light_col * att;
// Reflected light dir
vec3 R = reflect(-L, norm);
float RdotE = max(0.0, dot(R, eyedir));
specular += pow(RdotE, spec) * light_col * spec_att;
Diffuse = vec4(diffuse, 1.);
Specular = vec4(specular , 1.);

View File

@ -0,0 +1,38 @@
uniform mat4 ViewMatrix;
uniform mat4 ProjectionMatrix;
in vec3 Position;
in float Energy;
in vec3 Color;
in vec2 Corner;
flat out vec3 center;
flat out float energy;
flat out vec3 col;
const float zNear = 1.;
void main(void)
{
// Beyond that value, light is too attenuated
float r = 40 * Energy;
center = Position;
energy = Energy;
vec4 Center = ViewMatrix * vec4(Position, 1.);
if (Center.z > zNear) // Light is in front of the cam
{
vec3 UnitCenter = normalize(-Center.xyz);
float clampedR = min(r, Center.z - 1.);
float cosTheta = dot(UnitCenter, vec3(0., 0., -1));
float d = clampedR / cosTheta;
Center.xyz += d * UnitCenter;
}
else if (Center.z + r > zNear) // Light is behind the cam but in range
{
Center.z = zNear;
// TODO: Change r so that we make the screen aligned quad fits light range.
}
col = Color;
gl_Position = ProjectionMatrix * (Center + r * vec4(Corner, 0., 0.));
}

View File

@ -1,30 +0,0 @@
#version 330
uniform sampler2D tex;
uniform sampler2D dtex;
uniform int viz;
in vec2 uv;
out vec4 FragColor;
void main()
{
vec2 tc = uv;
vec4 shiftval = texture(dtex, tc) / vec4(50.0);
vec2 shift;
shift.x = -shiftval.x + shiftval.y;
shift.y = -shiftval.z + shiftval.w;
tc += shift;
vec4 newcol = texture(tex, tc);
if (viz < 1)
{
FragColor = newcol;
} else
{
FragColor = shiftval * vec4(50.0);
}
}

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform sampler2D tex;
uniform sampler2D normals_and_depth;
uniform mat4 invproj;

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform float screenw;
void main()

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform float time;
uniform vec3 campos;
uniform mat4 viewm;

View File

@ -1,8 +1,12 @@
#version 330
in vec2 Position;
in vec2 Texcoord;
#if __VERSION__ >= 130
out vec2 uv;
#else
varying vec2 uv;
#endif
void main() {
uv = Texcoord;

View File

@ -1,4 +1,3 @@
#version 330
uniform mat4 ModelViewProjectionMatrix[4];
layout(triangles) in;

View File

@ -1,5 +1,3 @@
#version 330
in vec3 Position;
in vec2 Texcoord;

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D halft; // half is a reserved word
uniform sampler2D quarter;
uniform sampler2D eighth;

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform sampler2D ntex;
uniform sampler2D ctex;
uniform vec3 campos;

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform sampler2D dtex;
uniform mat4 ipvmat;
uniform mat4 shadowmat;

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform sampler2D tex;
uniform int hastex;
uniform int viz;

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform sampler2D warpx;
uniform sampler2D warpy;

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform sampler2D tex;
uniform int size;
uniform vec2 pixel;

View File

@ -1,4 +1,3 @@
#version 330 compatibility
uniform sampler2D tex;
uniform int size;
uniform vec2 pixel;

21
data/shaders/sky.frag Normal file
View File

@ -0,0 +1,21 @@
uniform samplerCube tex;
uniform mat4 InvProjView;
uniform vec2 screen;
#if __VERSION__ >= 130
out vec4 FragColor;
#else
#define FragColor gl_FragColor
#endif
void main(void)
{
vec3 eyedir = gl_FragCoord.xyz / vec3(screen, 1.);
eyedir = 2.0 * eyedir - 1.0;
vec4 tmp = (InvProjView * vec4(eyedir, 1.));
eyedir = tmp.xyz / tmp.w;
vec4 color = texture(tex, eyedir);
FragColor = vec4(color.xyz, 1.);
}

View File

@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#version 330 compatibility
uniform sampler2D tex;
uniform sampler2D glow_tex;
uniform float transparency;

View File

@ -17,7 +17,6 @@
// Creates a bubble (wave) effect by distorting the texture depending on time
#version 330 compatibility
uniform mat4 ModelViewProjectionMatrix;
uniform float time;

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D tex_layout;
uniform sampler2D tex_detail0;
uniform sampler2D tex_detail1;
@ -10,9 +9,16 @@ uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
#if __VERSION__ >= 130
in vec2 uv;
in vec2 uv_bis;
out vec4 FragColor;
#else
varying vec2 uv;
varying vec2 uv_bis;
#define FragColor gl_FragColor
#endif
void main() {
// Splatting part

View File

@ -15,15 +15,23 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
#if __VERSION__ >= 130
in vec3 Position;
in vec2 Texcoord;
in vec2 SecondTexcoord;
out vec2 uv;
out vec2 uv_bis;
#else
attribute vec3 Position;
attribute vec2 Texcoord;
attribute vec2 SecondTexcoord;
varying vec2 uv;
varying vec2 uv_bis;
#endif
void main()
{

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D ntex;
uniform sampler2D dtex;
uniform sampler2D noise_texture;
@ -6,8 +5,13 @@ uniform mat4 invprojm;
uniform mat4 projm;
uniform vec4 samplePoints[16];
#if __VERSION__ >= 130
in vec2 uv;
out float ao;
out float AO;
#else
varying vec2 uv;
#define AO gl_FragColor.x
#endif
const float strengh = 4.;
const float radius = .4f;
@ -39,7 +43,7 @@ void main(void)
vec3 norm = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
// Workaround for nvidia and skyboxes
float len = dot(vec3(1.0), abs(cur.xyz));
if (len < 0.2 || curdepth > 0.999) discard;
if (len < 0.2 || curdepth > 0.9955) discard;
// Make a tangent as random as possible
vec3 randvect = rand(uv);
vec3 tangent = normalize(cross(norm, randvect));
@ -65,5 +69,5 @@ void main(void)
bl += isOccluded ? smoothstep(radius, 0, distance(samplePos, FragPos)) : 0.;
}
ao = 1.0 - bl * invSamples;
AO = 1.0 - bl * invSamples;
}

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D ntex;
uniform sampler2D dtex;
//uniform sampler2D cloudtex;
@ -9,9 +8,16 @@ uniform mat4 invproj;
//uniform int hasclouds;
//uniform vec2 wind;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 Diff;
out vec4 Spec;
#else
varying vec2 uv;
#define Diff gl_FragData[0]
#define Spec gl_FragData[1]
#endif
vec3 DecodeNormal(vec2 n)
{

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D ntex;
uniform sampler2D dtex;
uniform sampler2DArrayShadow shadowtex;
@ -13,9 +12,16 @@ uniform mat4 shadowmat[4];
//uniform vec2 wind;
//uniform float shadowoffset;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 Diff;
out vec4 Spec;
#else
varying vec2 uv;
#define Diff gl_FragData[0]
#define Spec gl_FragData[1]
#endif
vec3 DecodeNormal(vec2 n)
{

View File

@ -1,8 +1,13 @@
#version 330
uniform sampler2D tex;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,12 +1,18 @@
#version 330
uniform vec2 center;
uniform vec2 size;
uniform vec2 texcenter;
uniform vec2 texsize;
#if __VERSION__ >= 130
in vec2 position;
in vec2 texcoord;
out vec2 uv;
#else
attribute vec2 position;
attribute vec2 texcoord;
varying vec2 uv;
#endif
void main()
{

View File

@ -1,8 +1,13 @@
#version 330
uniform sampler2D tex;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,10 +1,16 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TextureMatrix;
#if __VERSION__ >= 130
in vec3 Position;
in vec2 Texcoord;
out vec2 uv;
#else
attribute vec3 Position;
attribute vec2 Texcoord;
varying vec2 uv;
#endif
void main()
{

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D tex;
uniform float fogmax;
@ -10,8 +9,14 @@ uniform vec3 col;
uniform mat4 ipvmat;
uniform vec2 screen;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 FragColor;
#else
varying vec2 uv;
#define FragColor gl_FragColor
#endif
void main()
{

View File

@ -1,11 +1,17 @@
#version 330
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
#if __VERSION__ >= 130
in vec4 color;
out vec4 FragColor;
#else
varying vec4 color;
#define FragColor gl_FragColor
#endif
void main(void)
{

View File

@ -1,9 +1,15 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
#if __VERSION__ >= 130
in vec3 Position;
in vec4 Color;
out vec4 color;
#else
attribute vec3 Position;
attribute vec4 Color;
varying vec4 color;
#endif
void main(void)
{

View File

@ -8,9 +8,9 @@ uniform sampler2D DecalTex; //The texture
uniform vec2 delta1;
uniform vec2 delta2;
noperspective in vec3 lightVec;
noperspective in vec3 halfVec;
noperspective in vec3 eyeVec;
in vec3 lightVec;
in vec3 halfVec;
in vec3 eyeVec;
in vec2 uv;
out vec4 FragColor;

View File

@ -7,9 +7,9 @@ uniform float waveLength;
uniform vec3 lightdir;
noperspective out vec3 lightVec;
noperspective out vec3 halfVec;
noperspective out vec3 eyeVec;
out vec3 lightVec;
out vec3 halfVec;
out vec3 eyeVec;
out vec2 uv;
void main()

Some files were not shown because too many files have changed in this diff Show More