update_data_points   xtlang


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

Implementation

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; helpers for opengl rendering of fluidsym
(bind-func update_data_points
  (lambda () ;;cube:fluidcube* point_data:float* color_data:float*)
    (let ((vao DataVAO)
          (cube (get_fluid_cube))
          (vert_vbo (get_vbo vao 0))
          (verts (data vert_vbo))
          (vertsf (cast verts float*))
          (colour_vbo (get_vbo vao 3))
          (colours (data colour_vbo))
          (coloursf (cast colours float*))
          (densities (tref cube 5))
          (ii:i64 0)
          (jj:i64 0)
          (Vx (tref cube 6))
          (Vy (tref cube 7))
          (size_x (tref cube 0))
          (size_y (tref cube 10))
          (cvar:float 0.0)
          (cnt 0:i64)
          (idx 0)
          (red (dtof 1.0)) ;(dtof 0.3))
          (blue (dtof 0.8))
          (green (dtof 0.4))) ;(dtof .2)))
      (dotimes (ii (- size_x 2))
        (dotimes (jj (- size_y 2))
          (set! idx (+ (+ ii 1) (* (+ jj 1) size_x)))
          (pset! vertsf (+ 0 (* 4 cnt)) (- (* 2.0 (/ (i64tof ii) (i64tof CUBE_W))) 1.0))
          (pset! vertsf (+ 1 (* 4 cnt)) (- (* 2.0 (/ (i64tof jj) (i64tof CUBE_H))) 1.0))
          (pset! vertsf (+ 2 (* 4 cnt)) (* cvar 0.05))
          (pset! vertsf (+ 3 (* 4 cnt)) 1.0)
          (set! cvar (dtof (* 1.0 (pref densities idx))))
          (pset! coloursf (+ 0 (* 4 cnt)) (* cvar red))
          (pset! coloursf (+ 1 (* 4 cnt)) (* cvar green))
          (pset! coloursf (+ 2 (* 4 cnt)) (* cvar blue))
          ;; (pset! coloursf (+ 2 (* 4 cnt)) (* cvar blue)) ;(* cvar (- 1.0 blue)))
          (pset! coloursf (+ 3 (* 4 cnt)) cvar) ;1.0)
          (set! cnt (+ cnt 1))))
      (update vert_vbo)
      (update colour_vbo))
    void))


Back to Index

Similar Entries

  • AudioBuffer_data_b64    xtlang
  • AudioBuffer_data_b64_cstring    xtlang
  • AudioBuffer_set_data_b64    xtlang
  • AudioBuffer_shared_data    xtlang
  • Pm_Event_Data1    xtlang
  • Pm_Event_Data2    xtlang
  • Pm_Message_Data1    xtlang
  • Pm_Message_Data2    xtlang
  • QRcode_data    xtlang
  • Texture_bind_data    xtlang
  • Texture_bind_data    xtlang
  • VBO_data    xtlang
  • VBO_update_data    xtlang
  • aiProcess_FindInvalidData    scheme
  • aiProcess_ValidateDataStructure    scheme
  • bind-data    macro
  • bind-data-constructors    scheme
  • bind-data-deconstructors    scheme
  • bind-data-deconstructors-macros    scheme
  • bind-data-getters    scheme
  • bind-data-type    scheme
  • bind-data-type-constructor    scheme
  • bind-data-types    scheme
  • clear_sample_data_    xtlang
  • clock:update-metro    scheme
  • clock:update-metro    scheme
  • create_data    xtlang
  • create_points_shader    xtlang
  • data    xtlang
  • data    xtlang
  • dict_update    xtlang
  • dv_draw_scatter_points    xtlang
  • dv_draw_scatter_points    xtlang
  • fits-image-data-R32    xtlang
  • fits-image-data-R32    xtlang
  • fits-image-data-RGBA32    xtlang
  • fits-image-data-RGBA32    xtlang
  • fits-image-data-RGBA32-false    xtlang
  • fits-image-data-RGBA32-false    xtlang
  • get_hand_data    xtlang
  • impc:ti:check-to-update-generic-vars    scheme
  • impc:ti:compile-type-dataconstructors    scheme
  • impc:ti:update-closure-name    scheme
  • impc:ti:update-var    scheme
  • init_sample_data    xtlang
  • init_sample_data    xtlang
  • kinect_update_body    xtlang
  • load_cube_data    xtlang
  • load_data    xtlang
  • model_update    xtlang
  • ocv_dataPtr    xtlang
  • ocv_dataPtr    xtlang
  • position_update    xtlang
  • set-data-arrays-lines    xtlang
  • set-data-arrays-points    xtlang
  • set-data-particles    xtlang
  • set_sample_data_    xtlang
  • shader_update_bones    xtlang
  • shader_update_camera    xtlang
  • shader_update_envmap    xtlang
  • shader_update_light    xtlang
  • shader_update_lights    xtlang
  • shader_update_material    xtlang
  • shader_update_material    xtlang
  • shader_update_material    xtlang
  • shader_update_matrices    xtlang
  • shader_update_matrices_lv    xtlang
  • shader_update_matrices_lvs    xtlang
  • shader_update_projection_texture    xtlang
  • shader_update_uvwmatrix    xtlang
  • sys_file_datasync    xtlang
  • sys_file_datasync    xtlang
  • update    xtlang
  • update    xtlang
  • update-borders    xtlang
  • update-fluid-sym-state    xtlang
  • update_cube    xtlang
  • world_data    xtlang
  • world_data_index    xtlang
  • world_data_size    xtlang
  • xobj_database    xtlang
  • xtm_frame_data_to_tex    xtlang
  • xtm_set_vgimage_subdata    xtlang
  • xtm_update_camera    xtlang
  • xtm_update_lights    xtlang
  • xtm_update_matrices    xtlang
  • xtmtest-update-test-result    scheme
  • xtmtest-update-test-result    scheme