load_cube_data   xtlang


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

Implementation

(bind-func load_cube_data
  (lambda (tex:Texture* flipped:i32 front:String* back:String* top:String* bottom:String* left:String* right:String*)
    ;; seems to need to be set
    (stbi_set_flip_vertically_on_load flipped)
    (let ((width_ptr:i32* (tref-ptr tex 2))
          (height_ptr:i32* (tref-ptr tex 3))
          (comp_ptr:i32* (salloc))
          (i:i32 0)
          (wp:i32* (salloc 6))
          (hp:i32* (salloc 6))
          (cp:i32* (salloc 6))
          (wpt:i32 0)
          (hpt:i32 0)
          (cpt:i32 0)
          (front_data (stbi_load (cstring front) (pref-ptr wp 0) (pref-ptr hp 0) (pref-ptr cp 0) 4))
          (back_data (stbi_load (cstring back) (pref-ptr wp 1) (pref-ptr hp 1) (pref-ptr cp 1) 4))
          (top_data (stbi_load (cstring top) (pref-ptr wp 2) (pref-ptr hp 2) (pref-ptr cp 2) 4))
          (bottom_data (stbi_load (cstring bottom) (pref-ptr wp 3) (pref-ptr hp 3) (pref-ptr cp 3) 4))
          (left_data (stbi_load (cstring left) (pref-ptr wp 4) (pref-ptr hp 4) (pref-ptr cp 4) 4))
          (right_data (stbi_load (cstring right) (pref-ptr wp 5) (pref-ptr hp 5) (pref-ptr cp 5) 4))
          (w:i32 (pref wp 0))
          (h:i32 (pref hp 0))
          (c:i32 (pref cp 0))
          (whc:i64 (convert (* w h 4))) ;; always 4 channels
          (data:i8* (alloc (* whc 6)))) ;; always allocate 4 channels
      ;; (println "CUBE LOAD: width:" w "height:" h "channels:" c)
      (dotimes (i 6)
        (set! wpt (+ wpt (pref wp i)))
        (set! hpt (+ hpt (pref hp i)))
        (set! cpt (+ cpt (pref cp i))))
      (if (<> (/ wpt 6) w)
          (begin (println "Bad cube map!  All 6 images must have the same width!" w)
                 (set! front_data null)))
      (if (<> (/ hpt 6) h)
          (begin (println "Bad cube map!  All 6 images must have the same height!" h)
                 (set! front_data null)))
      (if (<> (/ cpt 6) c)
          (begin (println "Bad cube map!  All 6 images must have the same number of components" c)
                 (set! front_data null)))
      (pset! width_ptr 0 w)
      (pset! height_ptr 0 h)
      (pset! comp_ptr 0 4) ;; we actually forced (stbi_load ... 4) to 4 channels
      (tset! tex 1 GL_RGBA) ;; 4 componenets
      (if (or (null? front_data)
              (null? back_data)
              (null? top_data)
              (null? bottom_data)
              (null? left_data)
              (null? right_data))
          (begin
            (println "failed to load some images" (stbi_failure_reason))
            1)
          (begin
            ;; front
            (memcpy (pref-ptr data (* whc 0)) front_data whc)
            ;; back
            (memcpy (pref-ptr data (* whc 1)) back_data whc)
            ;; top
            (memcpy (pref-ptr data (* whc 2)) top_data whc)
            ;; bottom
            (memcpy (pref-ptr data (* whc 3)) bottom_data whc)
            ;; left
            (memcpy (pref-ptr data (* whc 4)) left_data whc)
            ;; right
            (memcpy (pref-ptr data (* whc 5)) right_data whc)
            ;; back
            (tset! tex 4 data)
            1))
      void)))


Back to Index

Similar Entries

  • AudioBuffer_data_b64    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • AudioBuffer_data_b64_cstring    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • AudioBuffer_set_data_b64    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • AudioBuffer_shared_data    xtlang    /digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm
  • Pm_Event_Data1    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • Pm_Event_Data2    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • Pm_Message_Data1    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • Pm_Message_Data2    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • QRcode_data    xtlang    /digego/extempore/tree/v0.8.9/libs/external/qr-code.xtm
  • Texture_bind_data    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • Texture_bind_data    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • VBO_data    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_FindInvalidData    scheme    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • aiProcess_ValidateDataStructure    scheme    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • ai_load_ogl_texture    xtlang    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • ai_load_ogl_texture_from_buffer    xtlang    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • analogue-load-preset    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments/analogue_fileio-scm.xtm
  • analogue-load-state    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments/analogue_fileio-scm.xtm
  • assimp_load_model    xtlang    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • assimp_load_model    xtlang    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • assimp_load_model    scheme    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • bind-data    macro    /digego/extempore/tree/v0.8.9/libs/base/adt.xtm
  • bind-data-constructors    scheme    /digego/extempore/tree/v0.8.9/libs/base/adt.xtm
  • bind-data-deconstructors    scheme    /digego/extempore/tree/v0.8.9/libs/base/adt.xtm
  • bind-data-deconstructors-macros    scheme    /digego/extempore/tree/v0.8.9/libs/base/adt.xtm
  • bind-data-getters    scheme    /digego/extempore/tree/v0.8.9/libs/base/adt.xtm
  • bind-data-type    scheme    /digego/extempore/tree/v0.8.9/libs/base/adt.xtm
  • bind-data-type-constructor    scheme    /digego/extempore/tree/v0.8.9/libs/base/adt.xtm
  • bind-data-types    scheme    /digego/extempore/tree/v0.8.9/libs/base/adt.xtm
  • bind_cube    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • cerberus-load-preset    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_fileio-scm.xtm
  • cerberus-load-state    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_fileio-scm.xtm
  • clean-cube    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluid_dynamics.xtm
  • clear_sample_data_    xtlang    /digego/extempore/tree/v0.8.9/libs/external/instruments_ext.xtm
  • create_data    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • cube_whole    xtlang    /digego/extempore/tree/v0.8.9/libs/external/opengl.xtm
  • data    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • data    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • db_load    xtlang    /digego/extempore/tree/v0.8.9/examples/external/sqlite.xtm
  • dsp_load    xtlang    /digego/extempore/tree/v0.8.9/examples/sharedsystem/audiosetup.xtm
  • fits-image-data-R32    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fitslib.xtm
  • fits-image-data-R32    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fits.xtm
  • fits-image-data-RGBA32    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fitslib.xtm
  • fits-image-data-RGBA32    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fits.xtm
  • fits-image-data-RGBA32-false    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fitslib.xtm
  • fits-image-data-RGBA32-false    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fits.xtm
  • fluid-cube-add-density    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-add-density    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluid_dynamics.xtm
  • fluid-cube-add-velocity    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-add-velocity    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluid_dynamics.xtm
  • fluid-cube-create    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-create    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluid_dynamics.xtm
  • fluid-cube-get-column    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-get-first-column    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-get-first-row    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-get-last-column    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-get-last-row    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-get-row    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-set-column    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-set-first-column    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-set-first-row    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-set-last-column    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-set-last-row    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-cube-set-row    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-step-cube    xtlang    /digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm
  • fluid-step-cube    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluid_dynamics.xtm
  • fluid_cube_add_density    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluids_2d.xtm
  • fluid_cube_add_velocity    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluids_2d.xtm
  • fluid_cube_create    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluids_2d.xtm
  • fluid_step_cube    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluids_2d.xtm
  • get-fluid-cube    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluid_dynamics.xtm
  • get-fluid-cube-1    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • get-fluid-cube-2    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • get_download_handler    xtlang    /digego/extempore/tree/v0.8.9/libs/external/cef/cef.xtm
  • get_fluid_cube    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluids_2d.xtm
  • get_hand_data    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/orbbec_test.xtm
  • get_load_handler    xtlang    /digego/extempore/tree/v0.8.9/libs/external/cef/cef.xtm
  • glCube    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluid_dynamics.xtm
  • gl_load_image    xtlang    /digego/extempore/tree/v0.8.9/libs/external/soil.xtm
  • gl_load_image_rect    xtlang    /digego/extempore/tree/v0.8.9/libs/external/soil.xtm
  • gl_load_movie_textures    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/gstvideo_multi.xtm
  • gl_load_movie_textures    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/gstvideo.xtm
  • gl_load_tex    xtlang    /digego/extempore/tree/v0.8.9/libs/external/soil.xtm
  • gl_load_tex_bgr    xtlang    /digego/extempore/tree/v0.8.9/libs/external/soil.xtm
  • gl_load_tex_ext    xtlang    /digego/extempore/tree/v0.8.9/libs/external/soil.xtm
  • gl_load_tex_ext_bgr    xtlang    /digego/extempore/tree/v0.8.9/libs/external/soil.xtm
  • gl_load_tex_rect    xtlang    /digego/extempore/tree/v0.8.9/libs/external/soil.xtm
  • impc:aot:insert-load-dylib-details    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:compiler:print-dylib-loading-details-to-log    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:compile-type-dataconstructors    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • init_sample_data    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/gstvideo_multi.xtm
  • init_sample_data    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/gstvideo.xtm
  • ipc:load    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • is_loading    xtlang    /digego/extempore/tree/v0.8.9/libs/external/cef/cef.xtm
  • lilv_load_plugin    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/lilv.xtm
  • load-sample    scheme    /digego/extempore/tree/v0.8.9/libs/external/instruments_ext-scm.xtm
  • load-sampler    scheme    /digego/extempore/tree/v0.8.9/libs/external/instruments_ext-scm.xtm
  • load-tex    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/particles.xtm
  • load-tex    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • load_assim_material_texture    xtlang    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • load_blep_tables_from_blob    unknown    /digego/extempore/tree/v0.8.9/libs/core/audio_dsp.xtm
  • load_data    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • load_vg_fonts    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender5.xtm
  • nvg_load_opensans_fonts    xtlang    /digego/extempore/tree/v0.8.9/libs/external/nanovg.xtm
  • ocv_dataPtr    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • ocv_dataPtr    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/xtmcv.xtm
  • print-load    scheme    /digego/extempore/tree/v0.8.9/examples/external/convolution_reverb.xtm
  • reload    xtlang    /digego/extempore/tree/v0.8.9/libs/external/cef/cef.xtm
  • reload_ignore_cache    xtlang    /digego/extempore/tree/v0.8.9/libs/external/cef/cef.xtm
  • set-data-arrays-lines    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • set-data-arrays-points    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • set-data-particles    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • set_sample_data_    xtlang    /digego/extempore/tree/v0.8.9/libs/external/instruments_ext.xtm
  • stop_load    xtlang    /digego/extempore/tree/v0.8.9/libs/external/cef/cef.xtm
  • sys:load    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • sys:load-escape    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • sys:load-preload-check    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • sys:load-then-quit    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • sys_file_datasync    xtlang    /digego/extempore/tree/v0.8.9/libs/external/system.xtm
  • sys_file_datasync    xtlang    /digego/extempore/tree/v0.8.9/libs/external/system.xtm
  • unbind_cube    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • unbind_cube    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.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
  • world_data    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/game-of-life.xtm
  • world_data_index    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/game-of-life.xtm
  • world_data_size    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/game-of-life.xtm
  • xobj_database    xtlang    /digego/extempore/tree/v0.8.9/libs/core/xobject.xtm
  • xtm_frame_data_to_tex    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/gstvideo.xtm
  • xtm_load_vgimage    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_projection_texture_load    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_set_vgimage_subdata    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm