generate_tri_normals   xtlang


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

Implementation

;; this assumes tris (triangles)
;; note that this does not account for winding order!
(bind-func generate_tri_normals
  (lambda (verts:float* vsize:i64 normals:float* nsize:i64)
    (if (<> (/ vsize 4) (/ nsize 3))
        (println "Error: verts must be vec4 4, and normals must be vec3")
        (let ((elts (/ vsize 4))
              (tris (/ elts 3))
              (i 0) (j 0) (k 0) (l 0)
              (p1:float* null) (p2:float* null)
              (p3:float* (alloc 4)) (p4:float* (alloc 4)))
          (dotimes (i tris)
            (set! k (* i 4 3)) ;; start of vert tri
            (set! j (* i 3 3)) ;; start of normal tri
            (set! p1 (pref-ptr verts k))  ;; vert 1
            (set! p2 (pref-ptr verts (+ k 4))) ;; vert 2
            (vvcross p1 p2 p3)
            (vnormalise p3 3 p4)
            (vcopy p4 3 (pref-ptr normals j))
            (vcopy p4 3 (pref-ptr normals (+ j 3)))
            (vcopy p4 3 (pref-ptr normals (+ j 6))))
          void))))


Back to Index

Similar Entries

  • AudioBuffer_cstring    xtlang
  • AudioBuffer_data_b64_cstring    xtlang
  • PARAM_TRI    scheme
  • PARAM_TRI    scheme
  • PaDeviceInfo_toString    xtlang
  • PaHostApiInfo_toString    xtlang
  • PaHostErrorInfo_toString    xtlang
  • PaStreamCallbackTimeInfo_toString    xtlang
  • PaStreamInfo_toString    xtlang
  • PaStreamParameters_toString    xtlang
  • String    xtlang
  • String    xtlang
  • String_free    xtlang
  • String_h    xtlang
  • String_strlen    xtlang
  • VAO_bind_attribute    xtlang
  • VAO_bind_attribute    xtlang
  • aiProcess_FindDegenerates    scheme
  • aiProcess_FixInfacingNormals    scheme
  • aiProcess_GenNormals    scheme
  • aiProcess_GenSmoothNormals    scheme
  • aiProcess_Triangulate    scheme
  • ai_matrix4_to_float    xtlang
  • analogue_get_mod_matrix    xtlang
  • analogue_set_mod_matrix    xtlang
  • anyatom->string    scheme
  • attrib_set_p    xtlang
  • attribs    xtlang
  • bind-lib-xtm-get-string    macro
  • bindfunc_with_docstring    xtlang
  • bindfunc_with_zone_size_and_docstring    xtlang
  • bltriXAnalogue_c    xtlang
  • cas-xtm-to-string    scheme
  • cef_string    xtlang
  • cef_string    xtlang
  • cef_string_clear    xtlang
  • cef_string_cmp    xtlang
  • cef_string_set    xtlang
  • cef_string_userfree_alloc    xtlang
  • cef_string_userfree_free    xtlang
  • cef_string_val    xtlang
  • cef_string_val    xtlang
  • cerberus_get_mod_matrix    xtlang
  • cerberus_matrix_cc    xtlang
  • cerberus_set_mod_matrix    xtlang
  • create_triangle_shader    xtlang
  • create_triangle_shader    xtlang
  • cstring    xtlang
  • cstring    xtlang
  • distribute_particles    xtlang
  • euclid-distribute-zeros    scheme
  • file->string    scheme
  • filename-strip-extension    scheme
  • fill_identity_matrix    xtlang
  • fill_identity_matrix    xtlang
  • fill_orthographic_matrix    xtlang
  • fill_orthographic_matrix    xtlang
  • fill_pos_scale_matrix    xtlang
  • fill_projection_matrix    xtlang
  • fill_projection_matrix    xtlang
  • fill_projection_matrix    xtlang
  • fill_view_matrix    xtlang
  • fill_view_matrix    xtlang
  • fill_view_matrix_dir    xtlang
  • fill_view_matrix_dir    xtlang
  • generate_And_Wrap_Pseudorandom_DNA_Sequence    xtlang
  • generate_random_vao    xtlang
  • generate_tri_uvws    xtlang
  • get_mod_matrix    xtlang
  • ghttp_perform_POST_string    xtlang
  • ghttp_perform_PUT_string    xtlang
  • glfw_print_version_string    xtlang
  • godot_string    xtlang
  • godot_string_ascii    xtlang
  • godot_string_destroy    xtlang
  • godot_string_new    xtlang
  • godot_string_parse_utf8    xtlang
  • godot_string_pvar    xtlang
  • godot_string_var    xtlang
  • godot_variant_as_string    xtlang
  • godot_variant_new_string    xtlang
  • gstring_alloc    xtlang
  • gstring_halloc    xtlang
  • gstring_zalloc    xtlang
  • impc:ir:compiler:math-intrinsics    scheme
  • impc:ir:genericfunc-stringify-generic-arg-strings    scheme
  • impc:ir:get-pretty-closure-arg-strings    scheme
  • impc:ir:get-pretty-tuple-arg-strings    scheme
  • impc:ir:intrinsic-substitution    scheme
  • impc:ir:make-const-string    scheme
  • impc:ir:make-string    scheme
  • impc:ir:objectsize-intrinsic    scheme
  • impc:ir:strip-space    scheme
  • impc:ti:generate-generic-type-cname    scheme
  • impc:ti:get-builtin-docstring    scheme
  • impc:ti:get-closure-docstring    scheme
  • impc:ti:get-closure-or-nativefunc-docstring    scheme
  • impc:ti:get-globalvar-docstring    scheme
  • impc:ti:get-namedtype-docstring    scheme
  • impc:ti:get-nativefunc-docstring    scheme
  • impc:ti:get-polyfunc-docstring    scheme
  • impc:ti:get-typealias-docstring    scheme
  • impc:ti:get-xtmacro-docstring    scheme
  • impc:ti:math-intrinsic-check    scheme
  • impc:ti:scm_rt_check_string    scheme
  • impc:ti:set-builtin-docstring    scheme
  • impc:ti:set-closure-docstring    scheme
  • impc:ti:set-globalvar-docstring    scheme
  • impc:ti:set-namedtype-docstring    scheme
  • impc:ti:set-nativefunc-docstring    scheme
  • impc:ti:set-typealias-docstring    scheme
  • impc:ti:set-xtmacro-docstring    scheme
  • impc:ti:string-check    scheme
  • impc:ti:strip-named-type    scheme
  • invert_matrix    xtlang
  • json_string_p    xtlang
  • list->string    scheme
  • match-string    scheme
  • match_aiString    xtlang
  • matrix_cc    xtlang
  • move_triangle    xtlang
  • number->string    scheme
  • qtrir    macro
  • repeat_And_Wrap_String    xtlang
  • reset_view_matrix    xtlang
  • return_ptr_gv_first_with_docstring    xtlang
  • return_ptr_gv_second_with_docstring    xtlang
  • rotate_matrix    xtlang
  • rotate_matrix    xtlang
  • run-petri-net    scheme
  • scale_matrix    xtlang
  • scale_matrix    xtlang
  • set_attribute    xtlang
  • set_attribute    xtlang
  • set_attribute    xtlang
  • set_attribute    xtlang
  • set_attribute    xtlang
  • set_attribute    xtlang
  • set_instance_matrices    xtlang
  • set_mod_matrix    xtlang
  • set_trigger    xtlang
  • shader_update_matrices    xtlang
  • shader_update_matrices_lv    xtlang
  • shader_update_matrices_lvs    xtlang
  • shader_update_uvwmatrix    xtlang
  • stride    xtlang
  • string    scheme
  • string->anyatom    scheme
  • string->list    scheme
  • string->number    scheme
  • string->sexpr    scheme
  • string-ci<=?    scheme
  • string-ci<?    scheme
  • string-ci=?    scheme
  • string-ci>=?    scheme
  • string-ci>?    scheme
  • string-cmp?    scheme
  • string-copy    scheme
  • string-fill!    scheme
  • string<=?    scheme
  • string<?    scheme
  • string=?    scheme
  • string>=?    scheme
  • string>?    scheme
  • string_list_from_file    xtlang
  • string_list_from_string    xtlang
  • stringify    xtlang
  • stringify    xtlang
  • stringify    xtlang
  • stringify    xtlang
  • stringify    xtlang
  • stringify    xtlang
  • substring    xtlang
  • t:cleanup-string-type    scheme
  • test_g_cstring    xtlang
  • test_g_cstring1    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString    xtlang
  • toString_help    xtlang
  • toString_help    xtlang
  • toString_help    xtlang
  • toString_return    xtlang
  • toString_space    xtlang
  • translate_matrix    xtlang
  • translate_matrix    xtlang
  • tri-wave    macro
  • triangular_window_func    xtlang
  • trim    xtlang
  • trim_brackets    xtlang
  • trir    macro
  • unset_attribute    xtlang
  • xtm_add_tri    xtlang
  • xtm_add_tri    xtlang
  • xtm_add_tri    xtlang
  • xtm_add_trid    xtlang
  • xtm_draw_tri    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_stroke    xtlang
  • xtm_draw_tri_stroke    xtlang
  • xtm_draw_tri_stroke    xtlang
  • xtm_draw_tri_stroke    xtlang
  • xtm_draw_trid    xtlang
  • xtm_update_matrices    xtlang
  • xtm_vg_reset_matrices    xtlang
  • xtmdoc-strip-arg-type-annotations    scheme