shader_update_matrices_lv   xtlang


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

Implementation

;; when working with OpenGL
;; extempore's mmul is pre mutipled (not post as in GLSL)
;; so the same matrix mul is post in GLSL and pre in XTM (i.e. here!)
(bind-func shader_update_matrices_lv
  (let ((bias:float* (alloc 16)))
    (pfill! bias
            0.5 0.0 0.0 0.0
            0.0 0.5 0.0 0.0
            0.0 0.0 0.5 0.0
            0.5 0.5 0.5 1.0)
    (lambda (shader:ShaderProgram* m:float* v p:float* lv:float*) ;; lv light view
      (let ((mlv:float* (salloc 16))
            (mlvp:float* (salloc 16))
            (mlvpb:float* (salloc 16)))
        (mmmul m lv mlv)
        (mmmul mlv p mlvp)
        (mmmul mlvp bias mlvpb)
        (glUniformMatrix4fv (glGetUniformLocation (id shader) "LightModelViewProjectionMatrix") 1 GL_FALSE mlvpb))
      (let ((mv (salloc 48))
            (mvp (pref-ptr mv 16))
            (mn (pref-ptr mv 32)))
        ;;(mmul m 4 4 v 4 4 mv) ;; final mv set
        (mmmul m v mv) ;; final mv set
        (mtrans mv 4 4 mn) ;; using mn as a temporary here!!
        (minverse mn 4 mvp) ;; using mvp as a temporary
        (mat4_to_mat3 mvp mn)  ;; final mn set
        ;;(mmul mv 4 4 p 4 4 mvp) ;; final mvp set
        (mmmul mv p mvp) ;; final mvp set
        (glUniformMatrix4fv (glGetUniformLocation (id shader) "ModelMatrix") 1 GL_FALSE m)
        (glUniformMatrix4fv (glGetUniformLocation (id shader) "ViewMatrix") 1 GL_FALSE v)
        (glUniformMatrix4fv (glGetUniformLocation (id shader) "ProjectionMatrix") 1 GL_FALSE p)
        (glUniformMatrix3fv (glGetUniformLocation (id shader) "NormalMatrix") 1 GL_FALSE mn)
        (glUniformMatrix4fv (glGetUniformLocation (id shader) "ModelViewMatrix") 1 GL_FALSE mv)
        (glUniformMatrix4fv (glGetUniformLocation (id shader) "ModelViewProjectionMatrix") 1 GL_FALSE mvp)
        void))))


Back to Index

Similar Entries

  • Shader    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • ShaderProgram    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • ShaderProgram    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • ShaderProgram    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • ShaderProgram    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • ShaderProgram_create    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • ShaderProgram_create    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • ShaderProgram_create    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • ShaderProgram_create    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • ShaderProgram_print_info_log    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • Shader_create    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • Shader_id    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • Shader_print_info_log    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • Shader_type    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • VBO_update_data    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • aiProcess_JoinIdenticalVertices    scheme    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • clock:update-metro    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • clock:update-metro    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • create_arrows_shader    xtlang    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/arrows.xtm
  • create_heatmap_shader    xtlang    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/heatmap.xtm
  • create_particles_shader    xtlang    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/particles.xtm
  • create_points_shader    xtlang    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/points.xtm
  • create_post_process_shader    xtlang    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/framebuffer.xtm
  • create_raymarcher_shader    xtlang    /digego/extempore/tree/v0.8.9/examples/external/raymarcher.xtm
  • create_shader    xtlang    /digego/extempore/tree/v0.8.9/libs/external/opengl.xtm
  • create_shader_xtm    xtlang    /digego/extempore/tree/v0.8.9/libs/external/opengl.xtm
  • create_shadertoy_shader    xtlang    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/shadertoy.xtm
  • create_texture_shader    xtlang    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/texture.xtm
  • create_triangle_shader    xtlang    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/simple-triangle.xtm
  • create_triangle_shader    xtlang    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/framebuffer.xtm
  • desolve    macro    /digego/extempore/tree/v0.8.9/libs/contrib/cas.xtm
  • dict_update    xtlang    /digego/extempore/tree/v0.8.9/libs/core/adt.xtm
  • fluid-lin-solve    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-lin-solve    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluid_dynamics.xtm
  • fluid_lin_solve    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluids_2d.xtm
  • fragshader    scheme    /digego/extempore/tree/v0.8.9/examples/external/raymarcher.xtm
  • get-llvm-path    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:aot:insert-ext-globalvar-binding-details    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:aot:insert-globalvar-binding-details    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:compiler:print-could-not-resolve-generic-type-error    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:compiler:print-could-not-resolve-type-error    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:compiler:print-could-not-resolve-types    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:compiler:print-could-not-resolve-types_find-expr    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ir:compiler:llvm_varargs    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ti:check-to-update-generic-vars    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:find-unresolved-simple-types    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:get-globalvar-docstring    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:get-globalvar-type    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:globalvar-exists?    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:print-globalvar-cache    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:register-new-globalvar    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:reset-globalvar-cache    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:set-globalvar-docstring    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:try-to-resolve-named-types    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:update-closure-name    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:update-var    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • init_lv2_amp    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/lv2.xtm
  • kinect_update_body    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/kinect2.xtm
  • lilv_activate    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/lilv.xtm
  • lilv_init_world    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/lilv.xtm
  • lilv_load_plugin    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/lilv.xtm
  • lilv_print_all_lv2_plugins    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/lilv.xtm
  • lilv_print_all_plugin_ports    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/lilv.xtm
  • linsolve    macro    /digego/extempore/tree/v0.8.9/libs/contrib/cas.xtm
  • llvm:asm    macro    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • llvm:compile-ir    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • llvm:compile-ir-and-print    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • llvm:get-closure-setter    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • llvm:get-native-closure    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • llvm:get-native-function    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • llvm:ir    macro    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • model_update    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/horde3d_knight.xtm
  • position_update    xtlang    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/particles.xtm
  • print_shader_info_log    xtlang    /digego/extempore/tree/v0.8.9/libs/external/opengl.xtm
  • set_instance_matrices    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_prepare_draw    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_prepare_draw    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_prepare_draw    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_prepare_draw    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_prepare_draw    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_set_grid_offsets    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_setup_convolution_filter    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_bones    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_camera    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_envmap    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_light    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_lights    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_material    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_material    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_material    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_matrices    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_matrices_lvs    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_projection_texture    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shader_update_uvwmatrix    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • shadertoy-loop    scheme    /digego/extempore/tree/v0.8.9/examples/external/shader-tutorials/shadertoy.xtm
  • solve    macro    /digego/extempore/tree/v0.8.9/libs/contrib/cas.xtm
  • update    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • update    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • update-borders    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • update-fluid-sym-state    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • update_cube    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • update_data_points    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluids_2d.xtm
  • vertshader    scheme    /digego/extempore/tree/v0.8.9/examples/external/raymarcher.xtm
  • xtm_render_init_dof_shader    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_render_init_light_shader    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_render_init_quad_shader    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_render_init_simple_bone_shader    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_render_init_simple_shader    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_render_init_skybox_shader    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_update_camera    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_update_lights    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_update_matrices    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_vg_reset_matrices    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtmdoc-globalvar-handler    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • xtmtest-update-test-result    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • xtmtest-update-test-result    scheme    /digego/extempore/tree/v0.8.9/libs/core/test.xtm