summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/landmassShader.fs
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-15 00:08:20 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-15 00:08:20 +0100
commit48ec3a869029bad34773516df193519a4fe9103a (patch)
tree9539b9a849a2bf5dbb7c407b754d7fae2fcbcfd7 /gfx/gl/shaders/landmassShader.fs
parentMerge branch 'assimp' (diff)
downloadilt-48ec3a869029bad34773516df193519a4fe9103a.tar.bz2
ilt-48ec3a869029bad34773516df193519a4fe9103a.tar.xz
ilt-48ec3a869029bad34773516df193519a4fe9103a.zip
Rename lots of shader files
Names and paths still not perfect, but better and the weird name missuse is gone
Diffstat (limited to 'gfx/gl/shaders/landmassShader.fs')
-rw-r--r--gfx/gl/shaders/landmassShader.fs66
1 files changed, 0 insertions, 66 deletions
diff --git a/gfx/gl/shaders/landmassShader.fs b/gfx/gl/shaders/landmassShader.fs
deleted file mode 100644
index f3cc3e8..0000000
--- a/gfx/gl/shaders/landmassShader.fs
+++ /dev/null
@@ -1,66 +0,0 @@
-#version 330 core
-
-include(`materialInterface.glsl')
-include(`geometryOut.glsl')
-
-uniform sampler2D texture0;
-
-const vec3 grass = vec3(.1, .4, .05);
-const vec3 slope = vec3(.6, .6, .4);
-const vec3 rock = vec3(.2, .2, .1);
-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;
-
-const float slope_min = .99;
-const float slope_mid = .95;
-const float slope_max = .90;
-
-vec3
-mixBetween(vec3 colA, vec3 colB, float blend, float low, float high)
-{
- return mix(colA, colB, (blend - low) / (high - low));
-}
-
-void
-main()
-{
- vec3 color = texture(texture0, TexCoords).rgb;
-
- float height = FragPos.z;
- if (height < beachline) { // Sandy beach
- color *= sand;
- }
- else if (Normal.z < slope_max) { // Dark rocky face
- color *= rock;
- }
- else { // Colour by lesser slope
- if (Normal.z < slope_mid) {
- color *= mixBetween(rock, slope, Normal.z, slope_max, slope_mid);
- }
- else if (Normal.z < slope_min) {
- color *= mixBetween(slope, grass, Normal.z, slope_mid, slope_min);
- }
- else {
- color *= grass;
- }
-
- // Add a snow covering
- if (height > snowline_low) {
- vec3 tsnow = color * snow;
- if (height > snowline_high) {
- color = tsnow;
- }
- else {
- color = mixBetween(color, tsnow, height, snowline_low, snowline_high);
- }
- }
- }
-
- gPosition = vec4(FragPos, 1);
- gNormal = vec4(Normal, 1);
- gAlbedoSpec = vec4(color, 1);
-}