summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/landmassShader.fs
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-20 13:51:54 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-20 13:59:46 +0000
commit7889392ad37213dc7419fb2423052b342e38de5b (patch)
tree87686b8b81cc9be715eefd3af3d80b28bb1584a6 /gfx/gl/shaders/landmassShader.fs
parentRemove now redundent Shader::Source class (diff)
downloadilt-7889392ad37213dc7419fb2423052b342e38de5b.tar.bz2
ilt-7889392ad37213dc7419fb2423052b342e38de5b.tar.xz
ilt-7889392ad37213dc7419fb2423052b342e38de5b.zip
dos2unix shader sources
Diffstat (limited to 'gfx/gl/shaders/landmassShader.fs')
-rw-r--r--gfx/gl/shaders/landmassShader.fs74
1 files changed, 37 insertions, 37 deletions
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;
+ }
+}