19 lines
654 B
Plaintext
19 lines
654 B
Plaintext
#version 450
|
|
#extension GL_GOOGLE_include_directive : require
|
|
layout(local_size_x = 64) in;
|
|
#include "common.glsl"
|
|
|
|
// The sky is visible in a window column above its first solid cell (static or powder); this finds that cell for every column (the sky buffer: words 64 ...).
|
|
layout(std430, set = 0, binding = 44) buffer Sky { uint sky[]; };
|
|
|
|
void main() {
|
|
int x = int(gl_GlobalInvocationID.x);
|
|
if (x >= pc.gw) return;
|
|
int top = pc.gh;
|
|
for (int y = 0; y < pc.gh; ++y) {
|
|
uint m = cell_mat(cells[y * pc.gw + x]);
|
|
if (m != 0u && (mflags(m) & (F_STATIC | F_SAND)) != 0u) { top = y; break; }
|
|
}
|
|
sky[64 + x] = uint(top);
|
|
}
|