fill_view_matrix_dir   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm

Implementation

;; this is similar to gl_look_at
;; but returns a suitable VIEW matrix
;;
;; same as fill_view_matrix but
;; instead of a target:position
;; we provide a    dir:vector
(bind-func fill_view_matrix_dir
  (let ((orientation_matrix:float* (alloc 16))
        (translation_matrix:float* (alloc 16))
        (vz:float* (alloc 3)) ;; vector z axes
        (vy:float* (alloc 3)) ;; vector y axes
        (vx:float* (alloc 3)) ;; vector x axes
        (vtmp:float* (alloc 3)))
    (lambda (matrix:float* vEye:float* vDir vUp)
      (let ((i 0))
        (vnormalise vDir 3 vz)
        (vnormalise vUp 3 vtmp)
        (vvcross vtmp vz vy) ;; use vy as a tmp here
        (vnormalise vy 3 vx)
        (vvcross vz vx vy)
        ;; (pfill! mat
        ;;         (pref vx 0) (pref vx 1) (pref vx 2) 0.0
        ;;         (pref vy 0) (pref vy 1) (pref vy 2) 0.0
        ;;         (pref vz 0) (pref vz 1) (pref vz 2) 0.0
        ;;         (pref vEye 0) (pref vEye 1) (pref vEye 2) 1.0)
        ;; (minverse mat 4 matrix)
        (pfill! orientation_matrix
                (pref vx 0) (pref vy 0) (pref vz 0) 0.0
                (pref vx 1) (pref vy 1) (pref vz 1) 0.0
                (pref vx 2) (pref vy 2) (pref vz 2) 0.0
                0.0 0.0 0.0 1.0)
        (pfill! translation_matrix
                1.0 0.0 0.0 0.0
                0.0 1.0 0.0 0.0
                0.0 0.0 1.0 0.0
                (* -1.0 (pref vEye 0)) (* -1.0 (pref vEye 1)) (* -1.0 (pref vEye 2)) 1.0)
        ;; (minverse mat 4 matrix)
        (mmmul translation_matrix orientation_matrix matrix)
        void))))


Back to Index

Similar Entries

  • Vfill    xtlang
  • Windows-add-libdir-to-PATH    scheme
  • ai_matrix4_to_float    xtlang
  • analogue_get_mod_matrix    xtlang
  • analogue_set_mod_matrix    xtlang
  • cerberus_get_mod_matrix    xtlang
  • cerberus_matrix_cc    xtlang
  • cerberus_set_mod_matrix    xtlang
  • fill_buffer_with_file    xtlang
  • fill_direction_vector    xtlang
  • fill_direction_vector    xtlang
  • 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
  • get_mod_matrix    xtlang
  • gl_set_view    xtlang
  • impc:ti:afill!    scheme
  • impc:ti:pfill!    scheme
  • impc:ti:tfill!    scheme
  • impc:ti:vfill!    scheme
  • invert_matrix    xtlang
  • matrix_cc    xtlang
  • reset_view_matrix    xtlang
  • rotate_matrix    xtlang
  • rotate_matrix    xtlang
  • scale_matrix    xtlang
  • scale_matrix    xtlang
  • set_mod_matrix    xtlang
  • shader_update_uvwmatrix    xtlang
  • string-fill!    scheme
  • sys_dir_make    xtlang
  • sys_dir_make_recursive    xtlang
  • sys_dir_remove    xtlang
  • sys_g_chdir    xtlang
  • sys_g_get_current_dir    xtlang
  • sys_g_get_home_dir    xtlang
  • sys_g_mkdir    xtlang
  • sys_temp_dir_get    xtlang
  • translate_matrix    xtlang
  • translate_matrix    xtlang
  • vector-fill!    scheme
  • win32_list_dir    xtlang
  • xtm_camera_view    xtlang
  • xtm_camera_view_centred    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_arc_fill    xtlang
  • xtm_draw_bezier_fill    xtlang
  • xtm_draw_bezier_fill    xtlang
  • xtm_draw_bezier_fill    xtlang
  • xtm_draw_bezier_fill    xtlang
  • xtm_draw_circle_fill    xtlang
  • xtm_draw_circle_fill    xtlang
  • xtm_draw_circle_fill    xtlang
  • xtm_draw_circle_fill    xtlang
  • xtm_draw_ellipse_fill    xtlang
  • xtm_draw_ellipse_fill    xtlang
  • xtm_draw_ellipse_fill    xtlang
  • xtm_draw_ellipse_fill    xtlang
  • xtm_draw_quad_fill    xtlang
  • xtm_draw_quad_fill    xtlang
  • xtm_draw_quad_fill    xtlang
  • xtm_draw_quad_fill    xtlang
  • xtm_draw_rect_fill    xtlang
  • xtm_draw_rect_fill    xtlang
  • xtm_draw_rect_fill    xtlang
  • xtm_draw_rect_fill    xtlang
  • xtm_draw_rounded_rect_fill    xtlang
  • xtm_draw_rounded_rect_fill    xtlang
  • xtm_draw_rounded_rect_fill    xtlang
  • xtm_draw_rounded_rect_fill    xtlang
  • xtm_draw_rounded_rect_varying_fill    xtlang
  • xtm_draw_rounded_rect_varying_fill    xtlang
  • xtm_draw_rounded_rect_varying_fill    xtlang
  • xtm_draw_rounded_rect_varying_fill    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_draw_tri_fill    xtlang
  • xtm_fill    xtlang
  • xtm_fill    xtlang
  • xtm_fill_path    xtlang
  • xtm_fill_path_keep    xtlang
  • xtm_light_view    xtlang
  • xtm_paint_set_fill    xtlang