generate_random_vao   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/external/xtmrender4.xtm

Implementation

(bind-func generate_random_vao
  (lambda (tris)
    (let ((num (* 3 tris))
          (verts:float* (alloc (* 4 num)))
          (normals:float* (alloc (* 3 num)))
          (uvws:float* (alloc (* 3 num)))
          (colours:float* (alloc (* 4 num)))
          (vbo_verts (VBO verts (* 4 num)))
          (vbo_normals (VBO normals (* 3 num)))
          (vbo_uvws (VBO uvws (* 3 num)))
          (vbo_colours (VBO colours (* 4 num)))
          (i 0) (j 0) (k 0))
      ;; random verts
      (dotimes (i num)
        (set! j (* i 4))
        (set! k (* i 3))
        (pset! verts (+ j 0) (- (* (random) 4.0) 2.0))
        (pset! verts (+ j 1) (- (* (random) 4.0) 2.0))
        (pset! verts (+ j 2) (- (* (random) 2.0) 1.0))
        (pset! verts (+ j 3) 1.0))
      ;; generate normals
      (generate_tri_normals verts (* 4 num) normals (* 3 num))
      ;; generate uvws
      (generate_tri_uvws uvws (* 3 num))
      ;; white colour
      (dotimes (i (* 4 num)) (pset! colours i 1.0))
      (set_attribute testVAO vbo_verts 0 4)
      (set_attribute testVAO vbo_normals 1 3)
      (set_attribute testVAO vbo_uvws 2 3)
      (set_attribute testVAO vbo_colours 3 4)
      (update vbo_verts)
      (update vbo_normals)
      (update vbo_uvws)
      (update vbo_colours)
      void)))


Back to Index

Similar Entries

  • PARAM_RANDOM    scheme
  • PARAM_RANDOM    scheme
  • VAO    xtlang
  • VAO_bind_and_draw_arrays    xtlang
  • VAO_bind_attribute    xtlang
  • VAO_bind_attribute    xtlang
  • VAO_create    xtlang
  • VAO_create_ss_quad    xtlang
  • VAO_delete    xtlang
  • VAO_id    xtlang
  • aiProcess_FindDegenerates    scheme
  • generate_And_Wrap_Pseudorandom_DNA_Sequence    xtlang
  • generate_tri_normals    xtlang
  • generate_tri_uvws    xtlang
  • get_LCG_Pseudorandom_Number    xtlang
  • impc:ti:generate-generic-type-cname    scheme
  • init_vao    xtlang
  • pc:random    scheme
  • random    scheme
  • random    xtlang
  • random-next    scheme
  • xt_pcg32_random    xtlang
  • xt_pcg32_random_r    xtlang
  • xt_pcg32_srandom    xtlang
  • xt_pcg32_srandom_r    xtlang
  • xtm_draw_vao    xtlang
  • xtm_draw_vao    xtlang