feat: add shader pipeline and chunk GLSL shaders

This commit is contained in:
2026-05-28 12:08:58 +02:00
parent d7ecf019cb
commit 50bb77cb2d
3 changed files with 96 additions and 0 deletions

13
Assets/shaders/chunk.frag Normal file
View File

@@ -0,0 +1,13 @@
#version 330 core
in vec2 vUv;
in float vShade;
out vec4 FragColor;
uniform sampler2D atlas;
void main()
{
vec4 texel = texture(atlas, vUv);
FragColor = vec4(texel.rgb * vShade, 1.0);
}

19
Assets/shaders/chunk.vert Normal file
View File

@@ -0,0 +1,19 @@
#version 330 core
layout(location = 0) in vec3 aPos;
layout(location = 1) in vec2 aUv;
layout(location = 2) in float aShade;
out vec2 vUv;
out float vShade;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
void main()
{
vUv = aUv;
vShade = aShade;
// Vector-on-left convention; matrices are uploaded with transpose=true.
gl_Position = vec4(aPos, 1.0) * model * view * projection;
}