diff --git a/assets/shaders/cube.vert b/assets/shaders/cube.vert index 6e31124..b741b5d 100644 --- a/assets/shaders/cube.vert +++ b/assets/shaders/cube.vert @@ -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; } diff --git a/assets/shaders/cube.vert.spv b/assets/shaders/cube.vert.spv index 0b87b22..66f3666 100644 Binary files a/assets/shaders/cube.vert.spv and b/assets/shaders/cube.vert.spv differ