set-data-arrays-points   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm

Implementation

(bind-func set-data-arrays-points
  (lambda (cube:fluidcube* point_data:float* color_data:float* xoffset:float yoffset:float n:i64)
    (let ((densities (tref cube 5))
    (ii:i64 0)
    (jj:i64 0)
    (Vx (tref cube 6))
    (Vy (tref cube 7))
    (size (tref cube 0))
    (size-y (tref cube 10))
    (cvar:float 0.0)
    (cnt 0)
    (red (dtof 0.5)) ;(dtof 0.3))
    (blue (dtof 0.1))
    (green (dtof 0.2))) ;(dtof .2)))
      (dotimes (ii (- size 2))
  (dotimes (jj (- size-y 2))
    (let ((idx (+ (+ ii 1) (* (+ jj 1) size))))
      (pset! point_data (+ 0 (* 2 cnt)) (+ xoffset (i64tof ii)))
      (pset! point_data (+ 1 (* 2 cnt)) (+ yoffset (i64tof jj)))
      (set! cvar (dtof (* 1.0 (pref densities idx))))
      (pset! color_data (+ 0 (* 4 cnt)) (* cvar red))
      (pset! color_data (+ 1 (* 4 cnt)) (* cvar green))
      (pset! color_data (+ 2 (* 4 cnt)) (* cvar blue)) ;(* cvar (- 1.0 blue)))
      (pset! color_data (+ 3 (* 4 cnt)) 1.0)
      (set! cnt (+ cnt 1))))))
    void))


Back to Index