init
This commit is contained in:
commit
87bff164f1
416 files changed
+279512
No files matched your search
@@ -0,0 +1,21 @@
|
||||
#version 450
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
layout(local_size_x = 8, local_size_y = 8) in;
|
||||
#include "common.glsl"
|
||||
|
||||
void main() {
|
||||
ivec2 p = ivec2(gl_GlobalInvocationID.xy);
|
||||
if (p.x >= pc.gw || p.y >= pc.gh || pc.brush_mat < 0) return;
|
||||
ivec2 d = p - ivec2(pc.brush_x, pc.brush_y);
|
||||
if (d.x * d.x + d.y * d.y > pc.brush_r * pc.brush_r) return;
|
||||
uint h = hash3(uint(p.x), uint(p.y), uint(pc.frame + pc.seed) + uint(pc.pass_) * 131u);
|
||||
int i = p.y * pc.gw + p.x;
|
||||
if (pc.brush_mat == 0) { cells[i] = 0u; ext[i] = vec2(0.0); return; }
|
||||
// only place into empty space, and thin out fluids so they pour
|
||||
if (cell_mat(cells[i]) != 0u) return;
|
||||
if ((mflags(uint(pc.brush_mat)) & F_STATIC) == 0u && (h & 3u) != 0u) return;
|
||||
// bits 16-23: colour variation, bit 26: initial horizontal direction of gases
|
||||
cells[i] = uint(pc.brush_mat) | (((h >> 8) & 0xFFu) << 16) | (((h >> 20) & 1u) << 26);
|
||||
ext[i] = vec2(0.0);
|
||||
birth[i] = birth_frame();
|
||||
}
|
||||
Reference in new issue
Block a user