feat(assets): apply per-chunk world offset in voxel vertex shader

This commit is contained in:
Serkyo 2026-07-16 00:05:30 +02:00
parent dd8a969828
commit 5efe937168
2 changed files with 5 additions and 2 deletions

View file

@ -8,10 +8,13 @@ layout(location = 0) out vec3 frag_color;
layout(push_constant) uniform PushConstants {
mat4 mvp;
vec4 chunk_offset;
} push_constants;
void main() {
gl_Position = push_constants.mvp * vec4(in_position, 1.0);
// The chunk-local vertex is shifted into world space by the per-chunk offset before projection.
vec3 world_position = in_position + push_constants.chunk_offset.xyz;
gl_Position = push_constants.mvp * vec4(world_position, 1.0);
frag_color = in_color;
}

Binary file not shown.