summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'gfx')
-rw-r--r--gfx/gl/shaders/basicShader.fs30
-rw-r--r--gfx/gl/shaders/basicShader.vs36
-rw-r--r--gfx/gl/shaders/landmassShader.fs74
-rw-r--r--gfx/gl/shaders/landmassShader.vs38
-rw-r--r--gfx/gl/shaders/waterShader.fs26
-rw-r--r--gfx/gl/shaders/waterShader.vs44
6 files changed, 124 insertions, 124 deletions
diff --git a/gfx/gl/shaders/basicShader.fs b/gfx/gl/shaders/basicShader.fs
index fe9a6b3..c20035d 100644
--- a/gfx/gl/shaders/basicShader.fs
+++ b/gfx/gl/shaders/basicShader.fs
@@ -1,15 +1,15 @@
-#version 130
-
-in vec2 texCoord0;
-in vec3 normal0;
-
-uniform sampler2D sampler;
-uniform vec3 lightDirection;
-uniform vec3 lightColor;
-uniform vec3 ambientColor;
-
-void main()
-{
- gl_FragColor = texture(sampler, texCoord0);
- gl_FragColor.rgb *= clamp(ambientColor + (dot(-lightDirection, normal0) * lightColor), 0.0, 1.0);
-}
+#version 130
+
+in vec2 texCoord0;
+in vec3 normal0;
+
+uniform sampler2D sampler;
+uniform vec3 lightDirection;
+uniform vec3 lightColor;
+uniform vec3 ambientColor;
+
+void main()
+{
+ gl_FragColor = texture(sampler, texCoord0);
+ gl_FragColor.rgb *= clamp(ambientColor + (dot(-lightDirection, normal0) * lightColor), 0.0, 1.0);
+}
diff --git a/gfx/gl/shaders/basicShader.vs b/gfx/gl/shaders/basicShader.vs
index 406edc4..2ef6697 100644
--- a/gfx/gl/shaders/basicShader.vs
+++ b/gfx/gl/shaders/basicShader.vs
@@ -1,18 +1,18 @@
-#version 130
-
-in vec3 position;
-in vec2 texCoord;
-in vec3 normal;
-
-out vec2 texCoord0;
-out vec3 normal0;
-
-uniform mat4 viewProjection;
-uniform mat4 model;
-
-void main()
-{
- gl_Position = viewProjection * model * vec4(position, 1.0);
- texCoord0 = texCoord;
- normal0 = (model * vec4(normal, 0.0)).xyz;
-}
+#version 130
+
+in vec3 position;
+in vec2 texCoord;
+in vec3 normal;
+
+out vec2 texCoord0;
+out vec3 normal0;
+
+uniform mat4 viewProjection;
+uniform mat4 model;
+
+void main()
+{
+ gl_Position = viewProjection * model * vec4(position, 1.0);
+ texCoord0 = texCoord;
+ normal0 = (model * vec4(normal, 0.0)).xyz;
+}
diff --git a/gfx/gl/shaders/landmassShader.fs b/gfx/gl/shaders/landmassShader.fs
index 55c30ac..09e4565 100644
--- a/gfx/gl/shaders/landmassShader.fs
+++ b/gfx/gl/shaders/landmassShader.fs
@@ -1,37 +1,37 @@
-#version 130
-
-in vec2 texCoord0;
-in vec3 normal0;
-in float height;
-
-uniform sampler2D sampler;
-uniform vec3 lightDirection;
-uniform vec3 lightColor;
-uniform vec3 ambientColor;
-
-const vec3 grass = vec3(.1, .4, .05);
-const vec3 sand = vec3(.76, .7, .5);
-const vec3 snow = vec3(.97, .97, .99);
-
-const float beachline = .5;
-const float snowline_low = 28;
-const float snowline_high = 30;
-
-void
-main()
-{
- gl_FragColor = texture(sampler, texCoord0);
- gl_FragColor.rgb *= clamp(ambientColor + (dot(-lightDirection, normal0) * lightColor), 0.0, 1.0);
- if (height < beachline) {
- gl_FragColor.rgb *= sand;
- }
- else if (height > snowline_high) {
- gl_FragColor.rgb *= snow;
- }
- else if (height > snowline_low) {
- gl_FragColor.rgb *= mix(grass, snow, (height - snowline_low) / (snowline_high - snowline_low));
- }
- else {
- gl_FragColor.rgb *= grass;
- }
-}
+#version 130
+
+in vec2 texCoord0;
+in vec3 normal0;
+in float height;
+
+uniform sampler2D sampler;
+uniform vec3 lightDirection;
+uniform vec3 lightColor;
+uniform vec3 ambientColor;
+
+const vec3 grass = vec3(.1, .4, .05);
+const vec3 sand = vec3(.76, .7, .5);
+const vec3 snow = vec3(.97, .97, .99);
+
+const float beachline = .5;
+const float snowline_low = 28;
+const float snowline_high = 30;
+
+void
+main()
+{
+ gl_FragColor = texture(sampler, texCoord0);
+ gl_FragColor.rgb *= clamp(ambientColor + (dot(-lightDirection, normal0) * lightColor), 0.0, 1.0);
+ if (height < beachline) {
+ gl_FragColor.rgb *= sand;
+ }
+ else if (height > snowline_high) {
+ gl_FragColor.rgb *= snow;
+ }
+ else if (height > snowline_low) {
+ gl_FragColor.rgb *= mix(grass, snow, (height - snowline_low) / (snowline_high - snowline_low));
+ }
+ else {
+ gl_FragColor.rgb *= grass;
+ }
+}
diff --git a/gfx/gl/shaders/landmassShader.vs b/gfx/gl/shaders/landmassShader.vs
index dc92e95..44eed39 100644
--- a/gfx/gl/shaders/landmassShader.vs
+++ b/gfx/gl/shaders/landmassShader.vs
@@ -1,19 +1,19 @@
-#version 130
-
-in vec3 position;
-in vec2 texCoord;
-in vec3 normal;
-
-out vec2 texCoord0;
-out vec3 normal0;
-out float height;
-
-uniform mat4 viewProjection;
-
-void main()
-{
- gl_Position = viewProjection * vec4(position, 1.0);
- texCoord0 = texCoord;
- normal0 = normal;
- height = position.y;
-}
+#version 130
+
+in vec3 position;
+in vec2 texCoord;
+in vec3 normal;
+
+out vec2 texCoord0;
+out vec3 normal0;
+out float height;
+
+uniform mat4 viewProjection;
+
+void main()
+{
+ gl_Position = viewProjection * vec4(position, 1.0);
+ texCoord0 = texCoord;
+ normal0 = normal;
+ height = position.y;
+}
diff --git a/gfx/gl/shaders/waterShader.fs b/gfx/gl/shaders/waterShader.fs
index bdfbc33..c7d14cf 100644
--- a/gfx/gl/shaders/waterShader.fs
+++ b/gfx/gl/shaders/waterShader.fs
@@ -1,13 +1,13 @@
-#version 130
-
-in vec2 texCoord0;
-in float depth;
-
-uniform sampler2D sampler;
-uniform vec3 waves;
-
-void main()
-{
- gl_FragColor = texture(sampler, texCoord0);
- gl_FragColor.a *= clamp(-depth * .7, .1, 1.0);
-}
+#version 130
+
+in vec2 texCoord0;
+in float depth;
+
+uniform sampler2D sampler;
+uniform vec3 waves;
+
+void main()
+{
+ gl_FragColor = texture(sampler, texCoord0);
+ gl_FragColor.a *= clamp(-depth * .7, .1, 1.0);
+}
diff --git a/gfx/gl/shaders/waterShader.vs b/gfx/gl/shaders/waterShader.vs
index 2efff85..7a641b0 100644
--- a/gfx/gl/shaders/waterShader.vs
+++ b/gfx/gl/shaders/waterShader.vs
@@ -1,22 +1,22 @@
-#version 130
-
-in vec3 position;
-in vec2 texCoord;
-in vec3 normal;
-
-out vec2 texCoord0;
-out float depth;
-
-uniform mat4 viewProjection;
-uniform vec3 waves;
-
-void main()
-{
- vec3 wpos = vec3(
- position.x + cos(waves.x),
- cos(waves.x + position.x + (position.z / 8)) * .3,
- position.z + cos(waves.x * waves.z / 2));
- gl_Position = viewProjection * vec4(wpos, 1.0);
- texCoord0 = texCoord;
- depth = position.y;
-}
+#version 130
+
+in vec3 position;
+in vec2 texCoord;
+in vec3 normal;
+
+out vec2 texCoord0;
+out float depth;
+
+uniform mat4 viewProjection;
+uniform vec3 waves;
+
+void main()
+{
+ vec3 wpos = vec3(
+ position.x + cos(waves.x),
+ cos(waves.x + position.x + (position.z / 8)) * .3,
+ position.z + cos(waves.x * waves.z / 2));
+ gl_Position = viewProjection * vec4(wpos, 1.0);
+ texCoord0 = texCoord;
+ depth = position.y;
+}