#version autoadded to shaders and turn some v120

This commit is contained in:
Vincent Lejeune 2014-02-28 17:29:05 +01:00
parent 1903aee114
commit af862cb6c5
90 changed files with 455 additions and 148 deletions

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,4 +1,3 @@
#version 330 compatibility
uniform sampler2D tex;
uniform sampler2D caustictex;
uniform vec2 dir;

View File

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

View File

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

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,4 +1,3 @@
#version 130
uniform vec3 col;
uniform sampler2D tex;

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

@ -1,13 +1,20 @@
#version 330
uniform sampler2D tex;
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()

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,9 +1,13 @@
#version 330
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()
{

View File

@ -1,4 +1,3 @@
#version 330
uniform sampler2D tex;
uniform vec2 sunpos;
@ -6,8 +5,13 @@ 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()
{

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

@ -17,7 +17,6 @@
// motion_blur.vert
#version 330 compatibility
void main()
{

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,4 +1,3 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TextureMatrix =
mat4(1., 0., 0., 0.,
@ -6,11 +5,20 @@ uniform mat4 TextureMatrix =
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)
{

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,9 +1,8 @@
#version 330
uniform sampler2D tex;
uniform int hastex;
uniform float objectid;
noperspective in vec3 nor;
in vec3 nor;
in vec2 uv0;
in vec2 uv1;
out vec4 Albedo;

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,14 +1,22 @@
#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;

View File

@ -1,8 +1,13 @@
#version 330
uniform sampler2D tex;
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

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,4 +1,3 @@
#version 330
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
uniform mat4 TextureMatrix =
@ -7,11 +6,21 @@ uniform mat4 TextureMatrix =
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)
{

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,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,4 +1,3 @@
#version 330
uniform sampler2D ntex;
uniform sampler2D dtex;
@ -9,9 +8,16 @@ uniform float spec;
uniform mat4 invproj;
uniform mat4 viewm;
#if __VERSION__ >= 130
in vec2 uv;
out vec4 Diffuse;
out vec4 Specular;
#else
varying vec2 uv;
#define Diffuse gl_FragData[0]
#define Specular gl_FragData[1]
#endif
vec3 DecodeNormal(vec2 n)
{
@ -49,8 +55,7 @@ void main() {
// 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;
specular += pow(RdotE, spec) * light_col * spec_att;
}
Diffuse = vec4(diffuse, 1.);

View File

@ -1,11 +1,16 @@
#version 330
uniform sampler2D tex;
uniform sampler2D dtex;
uniform int viz;
#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 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;

View File

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

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;
@ -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()

View File

@ -1,5 +1,10 @@
#version 330
#if __VERSION__ >= 130
out vec4 FragColor;
#else
#define FragColor gl_FragColor
#endif
void main()
{
FragColor = vec4(1.0);

View File

@ -200,7 +200,7 @@ void initGL()
static
GLuint LoadShader(const char * file, unsigned type) {
GLuint Id = glCreateShader(type);
std::string Code;
std::string Code = "#version 330\n";
std::ifstream Stream(file, std::ios::in);
if (Stream.is_open())
{

View File

@ -105,52 +105,52 @@ void Shaders::loadShaders()
memcpy(saved_shaders, m_shaders, sizeof(m_shaders));
// Ok, go
m_shaders[ES_NORMAL_MAP] = glsl_noinput(dir + "normalmap.vert", dir + "normalmap.frag");
m_shaders[ES_NORMAL_MAP_LIGHTMAP] = glsl_noinput(dir + "normalmap.vert", dir + "normalmap.frag");
m_shaders[ES_NORMAL_MAP] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_NORMAL_MAP_LIGHTMAP] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_SKYBOX] = glslmat(dir + "skybox.vert", dir + "skybox.frag",
m_shaders[ES_SKYBOX] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_SKYBOX], EMT_TRANSPARENT_ALPHA_CHANNEL);
m_shaders[ES_SPLATTING] = glsl_noinput(dir + "splatting.vert", dir + "splatting.frag");
m_shaders[ES_SPLATTING] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_WATER] = glslmat(dir + "water.vert", dir + "water.frag",
m_shaders[ES_WATER] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_WATER], EMT_TRANSPARENT_ALPHA_CHANNEL);
m_shaders[ES_WATER_SURFACE] = glsl(dir + "water.vert", dir + "pass.frag",
m_shaders[ES_WATER_SURFACE] = glsl(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_WATER]);
m_shaders[ES_SPHERE_MAP] = glsl_noinput(std::string(""), dir + "objectpass_spheremap.frag");
m_shaders[ES_SPHERE_MAP] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_GRASS] = glslmat(std::string(""), dir + "pass.frag",
m_shaders[ES_GRASS] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_GRASS], EMT_TRANSPARENT_ALPHA_CHANNEL);
m_shaders[ES_GRASS_REF] = glslmat(std::string(""), dir + "pass.frag",
m_shaders[ES_GRASS_REF] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_GRASS], EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
m_shaders[ES_BUBBLES] = glslmat(dir + "bubble.vert", dir + "bubble.frag",
m_shaders[ES_BUBBLES] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_BUBBLES], EMT_TRANSPARENT_ALPHA_CHANNEL);
m_shaders[ES_RAIN] = glslmat(dir + "rain.vert", dir + "rain.frag",
m_shaders[ES_RAIN] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_RAIN], EMT_TRANSPARENT_ALPHA_CHANNEL);
m_shaders[ES_MOTIONBLUR] = glsl(std::string(""), dir + "motion_blur.frag",
m_shaders[ES_MOTIONBLUR] = glsl(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_MOTIONBLUR]);
m_shaders[ES_GAUSSIAN3H] = glslmat(dir + "pass.vert", dir + "gaussian3h.frag",
m_shaders[ES_GAUSSIAN3H] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_GAUSSIAN3H], EMT_SOLID);
m_shaders[ES_GAUSSIAN3V] = glslmat(dir + "pass.vert", dir + "gaussian3v.frag",
m_shaders[ES_GAUSSIAN3V] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_GAUSSIAN3V], EMT_SOLID);
m_shaders[ES_MIPVIZ] = glslmat(std::string(""), dir + "mipviz.frag",
m_shaders[ES_MIPVIZ] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_MIPVIZ], EMT_SOLID);
m_shaders[ES_COLORIZE] = glslmat(std::string(""), dir + "colorize.frag",
m_shaders[ES_COLORIZE] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_COLORIZE], EMT_SOLID);
m_shaders[ES_OBJECTPASS] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_OBJECT_UNLIT] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_OBJECTPASS_REF] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_OBJECTPASS_RIMLIT] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_OBJECTPASS] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_OBJECT_UNLIT] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_OBJECTPASS_REF] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_OBJECTPASS_RIMLIT] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_SUNLIGHT] = glsl_noinput(std::string(""), dir + "sunlight.frag");
m_shaders[ES_SUNLIGHT] = glsl_noinput(dir + "pass.vert", dir + "pass.frag");
m_shaders[ES_MLAA_COLOR1] = glsl(dir + "mlaa_offset.vert", dir + "mlaa_color1.frag",
m_callbacks[ES_MLAA_COLOR1]);
@ -159,37 +159,36 @@ void Shaders::loadShaders()
m_shaders[ES_MLAA_NEIGH3] = glsl(dir + "mlaa_offset.vert", dir + "mlaa_neigh3.frag",
m_callbacks[ES_MLAA_NEIGH3]);
m_shaders[ES_SHADOWPASS] = glsl(dir + "shadowpass.vert", dir + "shadowpass.frag",
m_shaders[ES_SHADOWPASS] = glsl(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_SHADOWPASS]);
m_shaders[ES_SHADOW_IMPORTANCE] = glsl(dir + "shadowimportance.vert",
dir + "shadowimportance.frag",
m_shaders[ES_SHADOW_IMPORTANCE] = glsl(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_SHADOW_IMPORTANCE]);
m_shaders[ES_COLLAPSE] = glsl(std::string(""), dir + "collapse.frag",
m_shaders[ES_COLLAPSE] = glsl(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_COLLAPSE]);
m_shaders[ES_SHADOW_WARPH] = glsl(std::string(""), dir + "shadowwarph.frag",
m_shaders[ES_SHADOW_WARPH] = glsl(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_COLLAPSE]);
m_shaders[ES_SHADOW_WARPV] = glsl(std::string(""), dir + "shadowwarpv.frag",
m_shaders[ES_SHADOW_WARPV] = glsl(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_COLLAPSE]);
m_shaders[ES_MULTIPLY_ADD] = glslmat(std::string(""), dir + "multiply.frag",
m_shaders[ES_MULTIPLY_ADD] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_MULTIPLY_ADD], EMT_ONETEXTURE_BLEND);
m_shaders[ES_PENUMBRAH] = glslmat(std::string(""), dir + "penumbrah.frag",
m_shaders[ES_PENUMBRAH] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_GAUSSIAN3H], EMT_SOLID);
m_shaders[ES_PENUMBRAV] = glslmat(std::string(""), dir + "penumbrav.frag",
m_shaders[ES_PENUMBRAV] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_GAUSSIAN3H], EMT_SOLID);
m_shaders[ES_SHADOWGEN] = glslmat(std::string(""), dir + "shadowgen.frag",
m_shaders[ES_SHADOWGEN] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_SHADOWGEN], EMT_SOLID);
m_shaders[ES_CAUSTICS] = glslmat(std::string(""), dir + "caustics.frag",
m_shaders[ES_CAUSTICS] = glslmat(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_CAUSTICS], EMT_TRANSPARENT_ALPHA_CHANNEL);
m_shaders[ES_DISPLACE] = glsl(dir + "displace.vert", dir + "displace.frag",
m_shaders[ES_DISPLACE] = glsl(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_DISPLACE]);
m_shaders[ES_PASSFAR] = glsl(dir + "farplane.vert", dir + "colorize.frag",
m_shaders[ES_PASSFAR] = glsl(dir + "pass.vert", dir + "pass.frag",
m_callbacks[ES_COLORIZE]);
// Check that all successfully loaded