diff --git a/data/shaders/billboard.frag b/data/shaders/billboard.frag index 80a4942eb..9a9de2c5e 100644 --- a/data/shaders/billboard.frag +++ b/data/shaders/billboard.frag @@ -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) { diff --git a/data/shaders/billboard.vert b/data/shaders/billboard.vert index c707ab548..f6ec9e5f1 100644 --- a/data/shaders/billboard.vert +++ b/data/shaders/billboard.vert @@ -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) { diff --git a/data/shaders/bloom.frag b/data/shaders/bloom.frag index 5025f23aa..3be3cb60f 100644 --- a/data/shaders/bloom.frag +++ b/data/shaders/bloom.frag @@ -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() { diff --git a/data/shaders/bloomblend.frag b/data/shaders/bloomblend.frag index edcac3f31..b1003229a 100644 --- a/data/shaders/bloomblend.frag +++ b/data/shaders/bloomblend.frag @@ -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() { diff --git a/data/shaders/bloompower.frag b/data/shaders/bloompower.frag index 0c29ce9b2..dc2e1df5b 100644 --- a/data/shaders/bloompower.frag +++ b/data/shaders/bloompower.frag @@ -1,4 +1,3 @@ -#version 330 compatibility uniform float power; uniform sampler2D tex; diff --git a/data/shaders/bubble.frag b/data/shaders/bubble.frag index 0e1f2d4f9..6f69dfa74 100644 --- a/data/shaders/bubble.frag +++ b/data/shaders/bubble.frag @@ -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() { diff --git a/data/shaders/bubble.vert b/data/shaders/bubble.vert index 6e9981bfb..0d61b7d33 100644 --- a/data/shaders/bubble.vert +++ b/data/shaders/bubble.vert @@ -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() { diff --git a/data/shaders/caustics.frag b/data/shaders/caustics.frag index e92e03a8c..7fe0eecea 100644 --- a/data/shaders/caustics.frag +++ b/data/shaders/caustics.frag @@ -1,4 +1,3 @@ -#version 330 compatibility uniform sampler2D tex; uniform sampler2D caustictex; uniform vec2 dir; diff --git a/data/shaders/collapse.frag b/data/shaders/collapse.frag index 573631f9a..e4f0fc4c6 100644 --- a/data/shaders/collapse.frag +++ b/data/shaders/collapse.frag @@ -1,4 +1,3 @@ -#version 330 compatibility uniform sampler2D tex; uniform sampler2D oldtex; uniform vec2 pixel; diff --git a/data/shaders/color_levels.frag b/data/shaders/color_levels.frag index 58ccee832..a803c8a5e 100644 --- a/data/shaders/color_levels.frag +++ b/data/shaders/color_levels.frag @@ -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() { diff --git a/data/shaders/coloredquad.frag b/data/shaders/coloredquad.frag index 9216e0503..26d01339e 100644 --- a/data/shaders/coloredquad.frag +++ b/data/shaders/coloredquad.frag @@ -1,7 +1,11 @@ -#version 330 uniform ivec4 color; +#if __VERSION__ >= 130 out vec4 FragColor; +#else +#define FragColor gl_FragColor +#endif + void main() { diff --git a/data/shaders/coloredquad.vert b/data/shaders/coloredquad.vert index 31c2a0db1..2864e469a 100644 --- a/data/shaders/coloredquad.vert +++ b/data/shaders/coloredquad.vert @@ -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() { diff --git a/data/shaders/colorize.frag b/data/shaders/colorize.frag index b82462c1f..022fe59c0 100644 --- a/data/shaders/colorize.frag +++ b/data/shaders/colorize.frag @@ -1,7 +1,11 @@ -#version 330 uniform vec3 col; +#if __VERSION__ >= 130 out vec4 FragColor; +#else +#define FragColor gl_FragColor +#endif + void main() { diff --git a/data/shaders/colorize_ref.frag b/data/shaders/colorize_ref.frag index 743f32224..7db1e2584 100644 --- a/data/shaders/colorize_ref.frag +++ b/data/shaders/colorize_ref.frag @@ -1,4 +1,3 @@ -#version 130 uniform vec3 col; uniform sampler2D tex; diff --git a/data/shaders/colortexturedquad.frag b/data/shaders/colortexturedquad.frag index 1e14e5985..6c1aa7396 100644 --- a/data/shaders/colortexturedquad.frag +++ b/data/shaders/colortexturedquad.frag @@ -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() { diff --git a/data/shaders/colortexturedquad.vert b/data/shaders/colortexturedquad.vert index 4489e9cbf..c4e4d41a0 100644 --- a/data/shaders/colortexturedquad.vert +++ b/data/shaders/colortexturedquad.vert @@ -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() { diff --git a/data/shaders/detailledobject_pass2.frag b/data/shaders/detailledobject_pass2.frag index 7afaee691..c0c9527d0 100644 --- a/data/shaders/detailledobject_pass2.frag +++ b/data/shaders/detailledobject_pass2.frag @@ -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) { diff --git a/data/shaders/displace.frag b/data/shaders/displace.frag index 1c22fd42e..5691156c6 100644 --- a/data/shaders/displace.frag +++ b/data/shaders/displace.frag @@ -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() diff --git a/data/shaders/displace.vert b/data/shaders/displace.vert index 7c811d4aa..48b052077 100644 --- a/data/shaders/displace.vert +++ b/data/shaders/displace.vert @@ -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.); diff --git a/data/shaders/farplane.vert b/data/shaders/farplane.vert index eea0eeede..9d3a1b7db 100644 --- a/data/shaders/farplane.vert +++ b/data/shaders/farplane.vert @@ -1,4 +1,3 @@ -#version 330 compatibility uniform mat4 ModelViewProjectionMatrix; void main() { diff --git a/data/shaders/flipparticle.vert b/data/shaders/flipparticle.vert index 24ce2773a..7b479ec9f 100644 --- a/data/shaders/flipparticle.vert +++ b/data/shaders/flipparticle.vert @@ -1,4 +1,3 @@ -#version 330 uniform mat4 ProjectionMatrix; uniform mat4 ViewMatrix; diff --git a/data/shaders/fog.frag b/data/shaders/fog.frag index 60dd7dcf0..ce03d04af 100644 --- a/data/shaders/fog.frag +++ b/data/shaders/fog.frag @@ -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() { diff --git a/data/shaders/gaussian3h.frag b/data/shaders/gaussian3h.frag index 07f4d4092..d444ba11d 100644 --- a/data/shaders/gaussian3h.frag +++ b/data/shaders/gaussian3h.frag @@ -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() { diff --git a/data/shaders/gaussian3v.frag b/data/shaders/gaussian3v.frag index 365e25678..16e21a1a5 100644 --- a/data/shaders/gaussian3v.frag +++ b/data/shaders/gaussian3v.frag @@ -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() { diff --git a/data/shaders/gaussian6h.frag b/data/shaders/gaussian6h.frag index a2ee0eb26..c17766c4b 100644 --- a/data/shaders/gaussian6h.frag +++ b/data/shaders/gaussian6h.frag @@ -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() { diff --git a/data/shaders/gaussian6v.frag b/data/shaders/gaussian6v.frag index 8150cbbf6..31d361e60 100644 --- a/data/shaders/gaussian6v.frag +++ b/data/shaders/gaussian6v.frag @@ -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() { diff --git a/data/shaders/glow.frag b/data/shaders/glow.frag index 0821b420a..7902bd93b 100644 --- a/data/shaders/glow.frag +++ b/data/shaders/glow.frag @@ -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() { diff --git a/data/shaders/godfade.frag b/data/shaders/godfade.frag index cb16f93ab..fb60fe344 100644 --- a/data/shaders/godfade.frag +++ b/data/shaders/godfade.frag @@ -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() { diff --git a/data/shaders/godray.frag b/data/shaders/godray.frag index c0063e81d..8880d434d 100644 --- a/data/shaders/godray.frag +++ b/data/shaders/godray.frag @@ -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() { diff --git a/data/shaders/grass_pass1.vert b/data/shaders/grass_pass1.vert index 4d38b4f0a..647697da3 100644 --- a/data/shaders/grass_pass1.vert +++ b/data/shaders/grass_pass1.vert @@ -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() { diff --git a/data/shaders/grass_pass2.vert b/data/shaders/grass_pass2.vert index 0d60826ea..34ee95fd9 100644 --- a/data/shaders/grass_pass2.vert +++ b/data/shaders/grass_pass2.vert @@ -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() { diff --git a/data/shaders/mipviz.frag b/data/shaders/mipviz.frag index e63ca8158..da795da40 100644 --- a/data/shaders/mipviz.frag +++ b/data/shaders/mipviz.frag @@ -1,5 +1,3 @@ -#version 330 compatibility - uniform sampler2D tex; uniform vec2 texsize; uniform int notex; diff --git a/data/shaders/motion_blur.frag b/data/shaders/motion_blur.frag index 3be7cc652..43eb263bc 100644 --- a/data/shaders/motion_blur.frag +++ b/data/shaders/motion_blur.frag @@ -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 diff --git a/data/shaders/motion_blur.vert b/data/shaders/motion_blur.vert index 5c02f2bd3..50c721f79 100644 --- a/data/shaders/motion_blur.vert +++ b/data/shaders/motion_blur.vert @@ -17,7 +17,6 @@ // motion_blur.vert -#version 330 compatibility void main() { diff --git a/data/shaders/multiply.frag b/data/shaders/multiply.frag index 1e9303bf1..d3d16cbdd 100644 --- a/data/shaders/multiply.frag +++ b/data/shaders/multiply.frag @@ -1,4 +1,3 @@ -#version 330 compatibility uniform sampler2D tex1; uniform sampler2D tex2; diff --git a/data/shaders/normalmap.frag b/data/shaders/normalmap.frag index 00410d916..b07c307eb 100644 --- a/data/shaders/normalmap.frag +++ b/data/shaders/normalmap.frag @@ -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) diff --git a/data/shaders/normalmap.vert b/data/shaders/normalmap.vert index b7f74865d..5d5f79c21 100644 --- a/data/shaders/normalmap.vert +++ b/data/shaders/normalmap.vert @@ -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() { diff --git a/data/shaders/object_pass1.frag b/data/shaders/object_pass1.frag index ff55a147d..e119e2e0a 100644 --- a/data/shaders/object_pass1.frag +++ b/data/shaders/object_pass1.frag @@ -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) diff --git a/data/shaders/object_pass1.vert b/data/shaders/object_pass1.vert index edf27d885..12970e280 100644 --- a/data/shaders/object_pass1.vert +++ b/data/shaders/object_pass1.vert @@ -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) { diff --git a/data/shaders/object_pass2.frag b/data/shaders/object_pass2.frag index 7d4d81c27..426a79ec4 100644 --- a/data/shaders/object_pass2.frag +++ b/data/shaders/object_pass2.frag @@ -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) { diff --git a/data/shaders/object_pass2.vert b/data/shaders/object_pass2.vert index b912723a0..c04d75dfd 100644 --- a/data/shaders/object_pass2.vert +++ b/data/shaders/object_pass2.vert @@ -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) { diff --git a/data/shaders/object_unlit.frag b/data/shaders/object_unlit.frag index 3677baae3..5c60f9f43 100644 --- a/data/shaders/object_unlit.frag +++ b/data/shaders/object_unlit.frag @@ -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) { diff --git a/data/shaders/objectpass_ref.frag b/data/shaders/objectpass_ref.frag index 38b42a644..96840bb98 100644 --- a/data/shaders/objectpass_ref.frag +++ b/data/shaders/objectpass_ref.frag @@ -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; diff --git a/data/shaders/objectpass_rimlit.frag b/data/shaders/objectpass_rimlit.frag index a17f533b9..907dd8e9f 100644 --- a/data/shaders/objectpass_rimlit.frag +++ b/data/shaders/objectpass_rimlit.frag @@ -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)); diff --git a/data/shaders/objectpass_rimlit.vert b/data/shaders/objectpass_rimlit.vert index 3098e9963..59f1feab3 100644 --- a/data/shaders/objectpass_rimlit.vert +++ b/data/shaders/objectpass_rimlit.vert @@ -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; diff --git a/data/shaders/objectpass_spheremap.frag b/data/shaders/objectpass_spheremap.frag index 9d726b99a..c3a4c086a 100644 --- a/data/shaders/objectpass_spheremap.frag +++ b/data/shaders/objectpass_spheremap.frag @@ -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 diff --git a/data/shaders/objectref_pass1.frag b/data/shaders/objectref_pass1.frag index 06c8c413e..d322f9a5b 100644 --- a/data/shaders/objectref_pass1.frag +++ b/data/shaders/objectref_pass1.frag @@ -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) diff --git a/data/shaders/objectref_pass1.vert b/data/shaders/objectref_pass1.vert index 9e62e0e46..59fa0f3c5 100644 --- a/data/shaders/objectref_pass1.vert +++ b/data/shaders/objectref_pass1.vert @@ -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) { diff --git a/data/shaders/objectref_pass2.frag b/data/shaders/objectref_pass2.frag index e48755946..823d405d4 100644 --- a/data/shaders/objectref_pass2.frag +++ b/data/shaders/objectref_pass2.frag @@ -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) { diff --git a/data/shaders/particle.frag b/data/shaders/particle.frag index 1b6c5f200..cf405c01d 100644 --- a/data/shaders/particle.frag +++ b/data/shaders/particle.frag @@ -1,4 +1,3 @@ -#version 330 uniform sampler2D tex; uniform sampler2D dtex; uniform mat4 invproj; diff --git a/data/shaders/particle.vert b/data/shaders/particle.vert index 73b0dd8de..2376b86bd 100644 --- a/data/shaders/particle.vert +++ b/data/shaders/particle.vert @@ -1,4 +1,3 @@ -#version 330 uniform mat4 ProjectionMatrix; uniform mat4 ViewMatrix; diff --git a/data/shaders/particlesimheightmap.vert b/data/shaders/particlesimheightmap.vert index 09fa55a98..b34fb360e 100644 --- a/data/shaders/particlesimheightmap.vert +++ b/data/shaders/particlesimheightmap.vert @@ -1,4 +1,3 @@ -#version 330 uniform int dt; uniform mat4 sourcematrix; uniform int level; diff --git a/data/shaders/penumbrah.frag b/data/shaders/penumbrah.frag index 481db2dc8..2504d9752 100644 --- a/data/shaders/penumbrah.frag +++ b/data/shaders/penumbrah.frag @@ -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() diff --git a/data/shaders/penumbrav.frag b/data/shaders/penumbrav.frag index 7afc88173..715e07091 100644 --- a/data/shaders/penumbrav.frag +++ b/data/shaders/penumbrav.frag @@ -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 diff --git a/data/shaders/pointemitter.vert b/data/shaders/pointemitter.vert index 64a498dc7..333673f27 100644 --- a/data/shaders/pointemitter.vert +++ b/data/shaders/pointemitter.vert @@ -1,4 +1,3 @@ -#version 330 uniform int dt; uniform mat4 sourcematrix; uniform int level; diff --git a/data/shaders/pointlight.frag b/data/shaders/pointlight.frag index f21f49492..174732010 100644 --- a/data/shaders/pointlight.frag +++ b/data/shaders/pointlight.frag @@ -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.); diff --git a/data/shaders/ppdisplace.frag b/data/shaders/ppdisplace.frag index 717f77881..0e4217c03 100644 --- a/data/shaders/ppdisplace.frag +++ b/data/shaders/ppdisplace.frag @@ -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() { diff --git a/data/shaders/rain.frag b/data/shaders/rain.frag index 66af66dd3..39c1cde03 100644 --- a/data/shaders/rain.frag +++ b/data/shaders/rain.frag @@ -1,4 +1,3 @@ -#version 330 compatibility uniform sampler2D tex; uniform sampler2D normals_and_depth; uniform mat4 invproj; diff --git a/data/shaders/rain.vert b/data/shaders/rain.vert index e20bf80f3..6c999eb32 100644 --- a/data/shaders/rain.vert +++ b/data/shaders/rain.vert @@ -1,4 +1,3 @@ -#version 330 compatibility uniform float screenw; void main() diff --git a/data/shaders/rainsim.vert b/data/shaders/rainsim.vert index dca63e1bf..4a24d07e9 100644 --- a/data/shaders/rainsim.vert +++ b/data/shaders/rainsim.vert @@ -1,4 +1,3 @@ -#version 330 compatibility uniform float time; uniform vec3 campos; uniform mat4 viewm; diff --git a/data/shaders/screenquad.vert b/data/shaders/screenquad.vert index 1ba822b26..f13fbba0a 100644 --- a/data/shaders/screenquad.vert +++ b/data/shaders/screenquad.vert @@ -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; diff --git a/data/shaders/shadow.geom b/data/shaders/shadow.geom index 17754b677..a538974fe 100644 --- a/data/shaders/shadow.geom +++ b/data/shaders/shadow.geom @@ -1,4 +1,3 @@ -#version 330 uniform mat4 ModelViewProjectionMatrix[4]; layout(triangles) in; diff --git a/data/shaders/shadow.vert b/data/shaders/shadow.vert index 0bff7c743..e58ec7c63 100644 --- a/data/shaders/shadow.vert +++ b/data/shaders/shadow.vert @@ -1,5 +1,3 @@ -#version 330 - in vec3 Position; in vec2 Texcoord; diff --git a/data/shaders/shadowgen.frag b/data/shaders/shadowgen.frag index 2a44707de..565e9345c 100644 --- a/data/shaders/shadowgen.frag +++ b/data/shaders/shadowgen.frag @@ -1,4 +1,3 @@ -#version 330 uniform sampler2D halft; // half is a reserved word uniform sampler2D quarter; uniform sampler2D eighth; diff --git a/data/shaders/shadowimportance.frag b/data/shaders/shadowimportance.frag index 1bcc21cd0..7796780f1 100644 --- a/data/shaders/shadowimportance.frag +++ b/data/shaders/shadowimportance.frag @@ -1,4 +1,3 @@ -#version 330 compatibility uniform sampler2D ntex; uniform sampler2D ctex; uniform vec3 campos; diff --git a/data/shaders/shadowimportance.vert b/data/shaders/shadowimportance.vert index bb3a8b4b9..ddd0bad18 100644 --- a/data/shaders/shadowimportance.vert +++ b/data/shaders/shadowimportance.vert @@ -1,4 +1,3 @@ -#version 330 compatibility uniform sampler2D dtex; uniform mat4 ipvmat; uniform mat4 shadowmat; diff --git a/data/shaders/shadowpass.frag b/data/shaders/shadowpass.frag index bcec0ee01..5de466456 100644 --- a/data/shaders/shadowpass.frag +++ b/data/shaders/shadowpass.frag @@ -1,4 +1,3 @@ -#version 330 compatibility uniform sampler2D tex; uniform int hastex; uniform int viz; diff --git a/data/shaders/shadowpass.vert b/data/shaders/shadowpass.vert index 009f4b295..f6e1cf3fe 100644 --- a/data/shaders/shadowpass.vert +++ b/data/shaders/shadowpass.vert @@ -1,4 +1,3 @@ -#version 330 compatibility uniform sampler2D warpx; uniform sampler2D warpy; diff --git a/data/shaders/shadowwarph.frag b/data/shaders/shadowwarph.frag index 38d46dd89..2c22c20ee 100644 --- a/data/shaders/shadowwarph.frag +++ b/data/shaders/shadowwarph.frag @@ -1,4 +1,3 @@ -#version 330 compatibility uniform sampler2D tex; uniform int size; uniform vec2 pixel; diff --git a/data/shaders/shadowwarpv.frag b/data/shaders/shadowwarpv.frag index 5491d8f21..62bc6bf6c 100644 --- a/data/shaders/shadowwarpv.frag +++ b/data/shaders/shadowwarpv.frag @@ -1,4 +1,3 @@ -#version 330 compatibility uniform sampler2D tex; uniform int size; uniform vec2 pixel; diff --git a/data/shaders/sky.frag b/data/shaders/sky.frag index 60bacbfe0..0b5592c95 100644 --- a/data/shaders/sky.frag +++ b/data/shaders/sky.frag @@ -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) { diff --git a/data/shaders/skybox.frag b/data/shaders/skybox.frag index 1d150e975..e9425c61b 100644 --- a/data/shaders/skybox.frag +++ b/data/shaders/skybox.frag @@ -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; diff --git a/data/shaders/skybox.vert b/data/shaders/skybox.vert index 7d3097ca5..45ded6b85 100644 --- a/data/shaders/skybox.vert +++ b/data/shaders/skybox.vert @@ -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; diff --git a/data/shaders/splatting.frag b/data/shaders/splatting.frag index 38a8e9631..aada653ca 100644 --- a/data/shaders/splatting.frag +++ b/data/shaders/splatting.frag @@ -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 diff --git a/data/shaders/splatting.vert b/data/shaders/splatting.vert index c1a779ef1..2e7743b19 100644 --- a/data/shaders/splatting.vert +++ b/data/shaders/splatting.vert @@ -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() { diff --git a/data/shaders/ssao.frag b/data/shaders/ssao.frag index 1ae1cba7d..a4b168a85 100644 --- a/data/shaders/ssao.frag +++ b/data/shaders/ssao.frag @@ -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; } diff --git a/data/shaders/sunlight.frag b/data/shaders/sunlight.frag index 68c1049ed..fccf941d2 100644 --- a/data/shaders/sunlight.frag +++ b/data/shaders/sunlight.frag @@ -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) { diff --git a/data/shaders/sunlightshadow.frag b/data/shaders/sunlightshadow.frag index 66c617afb..69ffafd41 100644 --- a/data/shaders/sunlightshadow.frag +++ b/data/shaders/sunlightshadow.frag @@ -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) { diff --git a/data/shaders/texturedquad.frag b/data/shaders/texturedquad.frag index 48f7335b7..995a3c572 100644 --- a/data/shaders/texturedquad.frag +++ b/data/shaders/texturedquad.frag @@ -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() { diff --git a/data/shaders/texturedquad.vert b/data/shaders/texturedquad.vert index e8a73d3b8..bc6f1b03d 100644 --- a/data/shaders/texturedquad.vert +++ b/data/shaders/texturedquad.vert @@ -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() { diff --git a/data/shaders/transparent.frag b/data/shaders/transparent.frag index e5b1e7c69..4de578afd 100644 --- a/data/shaders/transparent.frag +++ b/data/shaders/transparent.frag @@ -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() { diff --git a/data/shaders/transparent.vert b/data/shaders/transparent.vert index b5451f0a5..9692fc549 100644 --- a/data/shaders/transparent.vert +++ b/data/shaders/transparent.vert @@ -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() { diff --git a/data/shaders/transparentfog.frag b/data/shaders/transparentfog.frag index 545587044..9e0e9ad0f 100644 --- a/data/shaders/transparentfog.frag +++ b/data/shaders/transparentfog.frag @@ -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() { diff --git a/data/shaders/untextured_object.frag b/data/shaders/untextured_object.frag index 24f4a54be..d4e7852ee 100644 --- a/data/shaders/untextured_object.frag +++ b/data/shaders/untextured_object.frag @@ -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) { diff --git a/data/shaders/untextured_object.vert b/data/shaders/untextured_object.vert index 5f0f91cf7..36020e0db 100644 --- a/data/shaders/untextured_object.vert +++ b/data/shaders/untextured_object.vert @@ -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) { diff --git a/data/shaders/water.frag b/data/shaders/water.frag index 1e9d434b3..29bac3458 100644 --- a/data/shaders/water.frag +++ b/data/shaders/water.frag @@ -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; diff --git a/data/shaders/water.vert b/data/shaders/water.vert index 78a1fe5c5..cf44b8e8c 100644 --- a/data/shaders/water.vert +++ b/data/shaders/water.vert @@ -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() diff --git a/data/shaders/white.frag b/data/shaders/white.frag index 3017ace18..d48e4e724 100644 --- a/data/shaders/white.frag +++ b/data/shaders/white.frag @@ -1,5 +1,10 @@ -#version 330 +#if __VERSION__ >= 130 out vec4 FragColor; +#else +#define FragColor gl_FragColor +#endif + + void main() { FragColor = vec4(1.0); diff --git a/src/graphics/glwrap.cpp b/src/graphics/glwrap.cpp index 466594ec0..3ec8beaa3 100644 --- a/src/graphics/glwrap.cpp +++ b/src/graphics/glwrap.cpp @@ -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()) { diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 7174ef7dc..9f259cce8 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -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