feat(assets): size and tint debug raster passes in the vertex shader
This commit is contained in:
parent
5c10aefee9
commit
8af6ae9661
|
|
@ -8,13 +8,24 @@ layout(location = 0) out vec3 frag_color;
|
|||
|
||||
layout(push_constant) uniform PushConstants {
|
||||
mat4 mvp;
|
||||
// xyz is the chunk's world offset; w is the debug-tint weight, 0.0 for normal rendering and 1.0 for a debug raster pass.
|
||||
vec4 chunk_offset;
|
||||
} push_constants;
|
||||
|
||||
// Colour applied to debug raster passes, chosen to contrast with terrain and to remain legible when overlaid on filled geometry.
|
||||
const vec3 DEBUG_COLOR = vec3(1.0, 0.0, 1.0);
|
||||
|
||||
// Size, in pixels, of the points emitted under VK_POLYGON_MODE_POINT. Sizes above 1.0 require the largePoints device feature.
|
||||
const float DEBUG_POINT_SIZE = 5.0;
|
||||
|
||||
void main() {
|
||||
// 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;
|
||||
// Point size is consulted whenever the polygon mode is POINT; leaving it unwritten renders points of undefined size. It is ignored by the FILL and LINE pipelines, so it is written unconditionally.
|
||||
gl_PointSize = DEBUG_POINT_SIZE;
|
||||
|
||||
float debug_tint = push_constants.chunk_offset.w;
|
||||
frag_color = mix(in_color, DEBUG_COLOR, debug_tint);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e96757ea7c663e85f5bb366e9475eb3621a1477c0c2afbef33c3a33a99564de8
|
||||
size 1576
|
||||
oid sha256:17461a207a6e1d6ba3e2b050aaa83ad0fb880a29e54e42295a1d43cbdfbdc115
|
||||
size 1888
|
||||
|
|
|
|||
Loading…
Reference in a new issue