

int a = 4;



uniform bool reset;
uniform int source_tex;

//#define PART_CNT 80000
#define PART_CNT 30000






struct VPTParticle{
	vec2 pos;
	bool alive;
	float acc_x;
	float acc_y;
	float w;
	float acc_luma;
	float cum_lum;
	int lifetime;
};

layout(std430, binding = 12) coherent buffer gggasdgasdgasdgg {
//    Tree tree_buffer;
//	int[500] cell_particle_counts;
	VPTParticle[PART_CNT] vpt_particles;

	uint vpt_free_particles_cnt;
	uint[PART_CNT] vpt_free_particles;

	uint particles_to_spawn_cnt;
	vec2[PART_CNT] particles_to_spawn;

	uint particles_to_kill_cnt;
	uint[PART_CNT] particles_to_kill;
};


void kill_particle(uint id){
	particles_to_kill[
		atomicAdd(particles_to_kill_cnt, 1)
	] = id;
}
void spawn_particle(vec2 pos){
	uint id = atomicAdd(particles_to_spawn_cnt, 1);
	particles_to_spawn[id] = pos;
}
