summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/landmass.fs
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-02-25 00:23:11 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2025-02-25 00:23:11 +0000
commitf9962b0db5072870864a1f758687106139f740dc (patch)
treeae1b05395de5c07164151ef7fc7de202be19b9f0 /gfx/gl/shaders/landmass.fs
parentAdd VertexArrayObject::data for an external existing buffer (diff)
downloadilt-f9962b0db5072870864a1f758687106139f740dc.tar.bz2
ilt-f9962b0db5072870864a1f758687106139f740dc.tar.xz
ilt-f9962b0db5072870864a1f758687106139f740dc.zip
Improve Terrain::generateMeshes performanceHEADmain
Creates mesh per surface based on a single buffer of all vertices and a collection of per surfuce indices. Makes ColourBias a uniform instead of a vertex attribute.
Diffstat (limited to 'gfx/gl/shaders/landmass.fs')
-rw-r--r--gfx/gl/shaders/landmass.fs6
1 files changed, 3 insertions, 3 deletions
diff --git a/gfx/gl/shaders/landmass.fs b/gfx/gl/shaders/landmass.fs
index 55e3c24..382260e 100644
--- a/gfx/gl/shaders/landmass.fs
+++ b/gfx/gl/shaders/landmass.fs
@@ -3,10 +3,10 @@
include(`materialOut.glsl')
in vec3 FragPos;
in vec3 Normal;
-flat in vec3 ColourBias;
uniform sampler2D texture0;
uniform ivec3 viewPoint;
+uniform vec3 colourBias;
const vec3 grass = vec3(.1, .4, .05);
const vec3 slope = vec3(.6, .6, .4);
@@ -35,8 +35,8 @@ main()
vec3 color = texture(texture0, vec2(position.xy % 10000) / 10000.0).rgb;
int height = position.z;
- if (ColourBias.r >= 0) {
- color *= ColourBias;
+ if (colourBias.r >= 0) {
+ color *= colourBias;
}
else if (height < beachline) { // Sandy beach
color *= sand;