(bind-func burners
(let ((rnds:double* (alloc 10000)) (k 0))
(dotimes (k 10000) (pset! rnds k (random)))
(lambda (time:double)
(let ((i 0) (j 0) (k 0) (tup (tuple 0:i64 0:i64))
(offx 100) (offy 0))
(dotimes (k NumBurners)
(set! tup (aref BurnerPositions k))
(set! i (clamp (tref tup 0) 2 (- CUBE_W 2)))
(set! j (clamp (tref tup 1) 2 (- CUBE_H 2)))
(add_density (+ offx (* i 1)) (+ offy (* j 1)) (* 2.0 (random)))
(if (= k (% (dtoi64 time) NumBurners)) ; (> (random) 0.99:double)
(add_velocity (+ offx (* i 1)) (+ offy (* j 1))
(* 5.1 (cos (* time (convert i) (pref rnds k) .01 .0027)))
(* 5.1 (sin (* time (convert j) (pref rnds k) .01 .0013)))))
void)
;; (add_velocity 200 (- CUBE_H 20)
;; (* 1.5 (cos (* time .001)))
;; (* 1.5 (sin (* time .0001))))
;; (add_velocity 200 20
;; (* 0.5 (cos (* time .0027)))
;; (* 0.5 (sin (* time .013))))
void))))