feat(assets): apply per-chunk world offset in voxel vertex shader
This commit is contained in:
parent
dd8a969828
commit
5efe937168
|
|
@ -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.
Loading…
Reference in a new issue