feat(app): render 3x3 neighbor landblocks with texture atlas
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
347a7e92ff
commit
560100e5b6
4 changed files with 109 additions and 79 deletions
|
|
@ -1,14 +1,10 @@
|
|||
#version 430 core
|
||||
in float vHeight;
|
||||
in vec2 vTex;
|
||||
in flat uint vLayer;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2DArray uAtlas;
|
||||
|
||||
void main() {
|
||||
float t = clamp(vHeight / 200.0, 0.0, 1.0);
|
||||
vec3 low = vec3(0.10, 0.35, 0.15); // green lowland
|
||||
vec3 mid = vec3(0.55, 0.45, 0.25); // brown mid
|
||||
vec3 high = vec3(0.90, 0.90, 0.95); // snowy peak
|
||||
vec3 color = t < 0.5
|
||||
? mix(low, mid, t * 2.0)
|
||||
: mix(mid, high, (t - 0.5) * 2.0);
|
||||
fragColor = vec4(color, 1.0);
|
||||
fragColor = texture(uAtlas, vec3(vTex, float(vLayer)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,17 @@
|
|||
layout(location = 0) in vec3 aPos;
|
||||
layout(location = 1) in vec3 aNormal;
|
||||
layout(location = 2) in vec2 aTex;
|
||||
layout(location = 3) in uint aTerrainLayer;
|
||||
|
||||
uniform mat4 uModel;
|
||||
uniform mat4 uView;
|
||||
uniform mat4 uProjection;
|
||||
|
||||
out float vHeight;
|
||||
out vec2 vTex;
|
||||
out flat uint vLayer;
|
||||
|
||||
void main() {
|
||||
vHeight = aPos.z;
|
||||
gl_Position = uProjection * uView * vec4(aPos, 1.0);
|
||||
vTex = aTex;
|
||||
vLayer = aTerrainLayer;
|
||||
gl_Position = uProjection * uView * uModel * vec4(aPos, 1.0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue