koffi 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog.md +6 -0
- package/build/qemu/2.1.2/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/2.1.2/koffi_win32_x64.tar.gz +0 -0
- package/doc/templates/badges.html +3 -0
- package/package.json +2 -2
- package/src/abi_arm64.cc +35 -1
- package/src/abi_x64_win.cc +2 -8
- package/src/abi_x86.cc +1 -7
- package/src/ffi.hh +1 -1
- package/src/util.hh +6 -0
- package/test/raylib.js +37 -5
- package/vendor/libcc/libcc.cc +430 -196
- package/vendor/libcc/libcc.hh +1417 -1283
- package/vendor/raylib/BINDINGS.md +87 -70
- package/vendor/raylib/CHANGELOG +263 -50
- package/vendor/raylib/CMakeLists.txt +12 -0
- package/vendor/raylib/CMakeOptions.txt +8 -1
- package/vendor/raylib/CONVENTIONS.md +2 -3
- package/vendor/raylib/FAQ.md +137 -0
- package/vendor/raylib/HISTORY.md +62 -29
- package/vendor/raylib/LICENSE +1 -1
- package/vendor/raylib/README.md +22 -17
- package/vendor/raylib/ROADMAP.md +8 -7
- package/vendor/raylib/cmake/CompileDefinitions.cmake +19 -15
- package/vendor/raylib/cmake/GlfwImport.cmake +2 -0
- package/vendor/raylib/cmake/LibraryConfigurations.cmake +22 -16
- package/vendor/raylib/cmake/raylib-config.cmake +52 -49
- package/vendor/raylib/examples/CMakeLists.txt +14 -9
- package/vendor/raylib/examples/Makefile +112 -125
- package/vendor/raylib/examples/Makefile.Android +1 -1
- package/vendor/raylib/examples/Makefile.Web +145 -158
- package/vendor/raylib/examples/README.md +141 -141
- package/vendor/raylib/examples/audio/audio_module_playing.c +9 -4
- package/vendor/raylib/examples/audio/audio_multichannel_sound.c +8 -3
- package/vendor/raylib/examples/audio/audio_music_stream.c +16 -11
- package/vendor/raylib/examples/audio/audio_raw_stream.c +57 -9
- package/vendor/raylib/examples/audio/audio_sound_loading.c +8 -3
- package/vendor/raylib/examples/audio/audio_stream_effects.c +179 -0
- package/vendor/raylib/examples/audio/audio_stream_effects.png +0 -0
- package/vendor/raylib/examples/build.zig +17 -6
- package/vendor/raylib/examples/core/core_2d_camera.c +8 -4
- package/vendor/raylib/examples/core/core_2d_camera_mouse_zoom.c +105 -0
- package/vendor/raylib/examples/core/core_2d_camera_mouse_zoom.png +0 -0
- package/vendor/raylib/examples/core/core_2d_camera_platformer.c +11 -6
- package/vendor/raylib/examples/core/core_3d_camera_first_person.c +9 -4
- package/vendor/raylib/examples/core/core_3d_camera_free.c +9 -4
- package/vendor/raylib/examples/core/core_3d_camera_mode.c +8 -3
- package/vendor/raylib/examples/core/core_3d_picking.c +9 -4
- package/vendor/raylib/examples/core/core_basic_screen_manager.c +9 -7
- package/vendor/raylib/examples/core/core_basic_window.c +8 -3
- package/vendor/raylib/examples/core/core_basic_window_web.c +13 -11
- package/vendor/raylib/examples/core/core_custom_frame_control.c +9 -4
- package/vendor/raylib/examples/core/core_custom_logging.c +12 -8
- package/vendor/raylib/examples/core/core_drop_files.c +20 -12
- package/vendor/raylib/examples/core/core_input_gamepad.c +20 -15
- package/vendor/raylib/examples/core/core_input_gestures.c +19 -15
- package/vendor/raylib/examples/core/core_input_keys.c +8 -3
- package/vendor/raylib/examples/core/core_input_mouse.c +8 -3
- package/vendor/raylib/examples/core/core_input_mouse_wheel.c +8 -3
- package/vendor/raylib/examples/core/core_input_multitouch.c +8 -3
- package/vendor/raylib/examples/core/core_loading_thread.c +10 -6
- package/vendor/raylib/examples/core/core_random_values.c +8 -3
- package/vendor/raylib/examples/core/core_scissor_test.c +8 -3
- package/vendor/raylib/examples/core/core_smooth_pixelperfect.c +9 -4
- package/vendor/raylib/examples/core/core_split_screen.c +8 -3
- package/vendor/raylib/examples/core/core_storage_values.c +109 -3
- package/vendor/raylib/examples/core/core_vr_simulator.c +15 -7
- package/vendor/raylib/examples/core/core_window_flags.c +8 -3
- package/vendor/raylib/examples/core/core_window_letterbox.c +13 -18
- package/vendor/raylib/examples/core/core_window_should_close.c +77 -0
- package/vendor/raylib/examples/core/core_window_should_close.png +0 -0
- package/vendor/raylib/examples/core/core_world_screen.c +9 -4
- package/vendor/raylib/examples/examples_template.c +8 -3
- package/vendor/raylib/examples/models/models_animation.c +11 -7
- package/vendor/raylib/examples/models/models_billboard.c +9 -4
- package/vendor/raylib/examples/models/models_box_collisions.c +8 -3
- package/vendor/raylib/examples/models/models_cubicmap.c +9 -4
- package/vendor/raylib/examples/models/models_first_person_maze.c +9 -4
- package/vendor/raylib/examples/models/models_geometric_shapes.c +8 -3
- package/vendor/raylib/examples/models/models_heightmap.c +9 -4
- package/vendor/raylib/examples/models/models_loading.c +21 -17
- package/vendor/raylib/examples/models/models_loading_gltf.c +15 -41
- package/vendor/raylib/examples/models/models_loading_vox.c +9 -4
- package/vendor/raylib/examples/models/models_mesh_generation.c +71 -58
- package/vendor/raylib/examples/models/models_mesh_picking.c +25 -7
- package/vendor/raylib/examples/models/models_orthographic_projection.c +8 -5
- package/vendor/raylib/examples/models/models_rlgl_solar_system.c +6 -4
- package/vendor/raylib/examples/models/models_skybox.c +16 -12
- package/vendor/raylib/examples/models/models_waving_cubes.c +9 -4
- package/vendor/raylib/examples/models/models_yaw_pitch_roll.c +12 -7
- package/vendor/raylib/examples/models/resources/LICENSE.md +9 -10
- package/vendor/raylib/examples/models/resources/models/gltf/LICENSE +2 -23
- package/vendor/raylib/examples/models/resources/models/gltf/{raylib_32x32.glb → raylib_logo_3d.glb} +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/robot.blend +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/robot.glb +0 -0
- package/vendor/raylib/examples/others/easings_testbed.c +10 -8
- package/vendor/raylib/examples/others/easings_testbed.png +0 -0
- package/vendor/raylib/examples/others/embedded_files_loading.c +10 -5
- package/vendor/raylib/examples/others/embedded_files_loading.png +0 -0
- package/vendor/raylib/examples/others/raylib_opengl_interop.c +10 -6
- package/vendor/raylib/{src/extras/easings.h → examples/others/reasings.h} +38 -38
- package/vendor/raylib/examples/others/rlgl_compute_shader.c +21 -20
- package/vendor/raylib/examples/others/rlgl_compute_shader.png +0 -0
- package/vendor/raylib/examples/others/rlgl_standalone.c +4 -4
- package/vendor/raylib/examples/others/rlgl_standalone.png +0 -0
- package/vendor/raylib/examples/raylib_compile_execute.bat +2 -2
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/lighting.fs +1 -1
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/{base_lighting_instanced.vs → lighting_instancing.vs} +2 -2
- package/vendor/raylib/examples/shaders/rlights.h +14 -27
- package/vendor/raylib/examples/shaders/shaders_basic_lighting.c +24 -26
- package/vendor/raylib/examples/shaders/shaders_custom_uniform.c +10 -5
- package/vendor/raylib/examples/shaders/shaders_eratosthenes.c +13 -8
- package/vendor/raylib/examples/shaders/shaders_fog.c +8 -12
- package/vendor/raylib/examples/shaders/shaders_hot_reloading.c +10 -5
- package/vendor/raylib/examples/shaders/shaders_julia_set.c +9 -4
- package/vendor/raylib/examples/shaders/shaders_mesh_instancing.c +45 -119
- package/vendor/raylib/examples/shaders/shaders_model_shader.c +10 -5
- package/vendor/raylib/examples/shaders/shaders_multi_sample2d.c +8 -3
- package/vendor/raylib/examples/shaders/shaders_palette_switch.c +8 -3
- package/vendor/raylib/examples/shaders/shaders_postprocessing.c +9 -4
- package/vendor/raylib/examples/shaders/shaders_raymarching.c +14 -11
- package/vendor/raylib/examples/shaders/shaders_shapes_textures.c +8 -3
- package/vendor/raylib/examples/shaders/shaders_simple_mask.c +10 -5
- package/vendor/raylib/examples/shaders/shaders_spotlight.c +10 -6
- package/vendor/raylib/examples/shaders/shaders_texture_drawing.c +9 -4
- package/vendor/raylib/examples/shaders/shaders_texture_outline.c +8 -3
- package/vendor/raylib/examples/shaders/shaders_texture_waves.c +8 -3
- package/vendor/raylib/{src/extras → examples/shapes}/raygui.h +1290 -1141
- package/vendor/raylib/examples/{others/easings.h → shapes/reasings.h} +40 -40
- package/vendor/raylib/examples/shapes/shapes_basic_shapes.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_bouncing_ball.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_collision_area.c +10 -4
- package/vendor/raylib/examples/shapes/shapes_colors_palette.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_draw_circle_sector.c +9 -4
- package/vendor/raylib/examples/shapes/shapes_draw_rectangle_rounded.c +9 -4
- package/vendor/raylib/examples/shapes/shapes_draw_ring.c +10 -6
- package/vendor/raylib/examples/shapes/shapes_easings_ball_anim.c +9 -4
- package/vendor/raylib/examples/shapes/shapes_easings_box_anim.c +9 -4
- package/vendor/raylib/examples/shapes/shapes_easings_rectangle_array.c +9 -4
- package/vendor/raylib/examples/shapes/shapes_following_eyes.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_lines_bezier.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_logo_raylib.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_logo_raylib_anim.c +8 -3
- package/vendor/raylib/examples/shapes/shapes_rectangle_scaling.c +14 -5
- package/vendor/raylib/examples/shapes/shapes_top_down_lights.c +355 -0
- package/vendor/raylib/examples/shapes/shapes_top_down_lights.png +0 -0
- package/vendor/raylib/examples/text/resources/DotGothic16-Regular.ttf +0 -0
- package/vendor/raylib/examples/text/resources/DotGothic16-Regular_OFL.txt +93 -0
- package/vendor/raylib/examples/text/resources/LICENSE.md +1 -1
- package/vendor/raylib/examples/text/text_codepoints_loading.c +138 -0
- package/vendor/raylib/examples/text/text_codepoints_loading.png +0 -0
- package/vendor/raylib/examples/text/text_draw_3d.c +42 -33
- package/vendor/raylib/examples/text/text_font_filters.c +14 -11
- package/vendor/raylib/examples/text/text_font_loading.c +9 -4
- package/vendor/raylib/examples/text/text_font_sdf.c +9 -4
- package/vendor/raylib/examples/text/text_font_spritefont.c +12 -6
- package/vendor/raylib/examples/text/text_format_text.c +8 -3
- package/vendor/raylib/examples/text/text_input_box.c +8 -3
- package/vendor/raylib/examples/text/text_raylib_fonts.c +9 -4
- package/vendor/raylib/examples/text/text_rectangle_bounds.c +9 -5
- package/vendor/raylib/examples/text/text_unicode.c +9 -7
- package/vendor/raylib/examples/text/text_writing_anim.c +8 -3
- package/vendor/raylib/examples/textures/resources/scarfy_run.gif +0 -0
- package/vendor/raylib/examples/textures/textures_background_scrolling.c +8 -3
- package/vendor/raylib/examples/textures/textures_blend_modes.c +8 -3
- package/vendor/raylib/examples/textures/textures_bunnymark.c +8 -3
- package/vendor/raylib/examples/textures/textures_draw_tiled.c +14 -10
- package/vendor/raylib/examples/textures/textures_fog_of_war.c +154 -0
- package/vendor/raylib/examples/textures/textures_fog_of_war.png +0 -0
- package/vendor/raylib/examples/textures/textures_gif_player.c +121 -0
- package/vendor/raylib/examples/textures/textures_gif_player.png +0 -0
- package/vendor/raylib/examples/textures/textures_image_drawing.c +8 -3
- package/vendor/raylib/examples/textures/textures_image_generation.c +8 -3
- package/vendor/raylib/examples/textures/textures_image_loading.c +8 -3
- package/vendor/raylib/examples/textures/textures_image_processing.c +8 -3
- package/vendor/raylib/examples/textures/textures_image_text.c +8 -3
- package/vendor/raylib/examples/textures/textures_logo_raylib.c +8 -3
- package/vendor/raylib/examples/textures/textures_mouse_painting.c +9 -4
- package/vendor/raylib/examples/textures/textures_npatch_drawing.c +8 -3
- package/vendor/raylib/examples/textures/textures_particles_blending.c +8 -3
- package/vendor/raylib/examples/textures/textures_polygon.c +9 -5
- package/vendor/raylib/examples/textures/textures_raw_data.c +8 -3
- package/vendor/raylib/examples/textures/{textures_rectangle.c → textures_sprite_anim.c} +11 -5
- package/vendor/raylib/examples/textures/{textures_rectangle.png → textures_sprite_anim.png} +0 -0
- package/vendor/raylib/examples/textures/textures_sprite_button.c +8 -3
- package/vendor/raylib/examples/textures/textures_sprite_explosion.c +8 -3
- package/vendor/raylib/examples/textures/textures_srcrec_dstrec.c +8 -3
- package/vendor/raylib/examples/textures/textures_to_image.c +8 -3
- package/vendor/raylib/parser/LICENSE +1 -1
- package/vendor/raylib/parser/Makefile +28 -0
- package/vendor/raylib/parser/README.md +49 -5
- package/vendor/raylib/parser/output/raylib_api.json +10717 -0
- package/vendor/raylib/parser/output/raylib_api.lua +7435 -0
- package/vendor/raylib/parser/{raylib_api.txt → output/raylib_api.txt} +1371 -824
- package/vendor/raylib/parser/{raylib_api.xml → output/raylib_api.xml} +827 -595
- package/vendor/raylib/parser/raylib_parser.c +1174 -196
- package/vendor/raylib/projects/4coder/Makefile +2 -4
- package/vendor/raylib/projects/4coder/main.c +0 -1
- package/vendor/raylib/projects/CMake/CMakeLists.txt +13 -16
- package/vendor/raylib/projects/CMake/README.md +27 -0
- package/vendor/raylib/projects/CMake/core_basic_window.c +52 -31
- package/vendor/raylib/projects/CodeBlocks/README.md +4 -4
- package/vendor/raylib/projects/Geany/core_basic_window.c +1 -1
- package/vendor/raylib/projects/Notepad++/c_raylib.xml +168 -128
- package/vendor/raylib/projects/Notepad++/npes_saved_tcc.txt +0 -0
- package/vendor/raylib/projects/Notepad++/npes_saved_w64devkit.txt +0 -0
- package/vendor/raylib/projects/Notepad++/npes_saved_zig.txt +0 -0
- package/vendor/raylib/projects/Notepad++/raylib_npp_parser/raylib_npp.xml +168 -84
- package/vendor/raylib/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h +67 -51
- package/vendor/raylib/projects/README.md +1 -1
- package/vendor/raylib/projects/VSCode/.vscode/c_cpp_properties.json +1 -1
- package/vendor/raylib/projects/VSCode/Makefile +8 -11
- package/vendor/raylib/projects/VSCode/main.c +53 -26
- package/vendor/raylib/projects/VSCode/resources/LICENSE +1 -0
- package/vendor/raylib/projects/scripts/build-linux.sh +6 -6
- package/vendor/raylib/projects/scripts/build-osx.sh +6 -6
- package/vendor/raylib/projects/scripts/build-rpi.sh +6 -6
- package/vendor/raylib/projects/scripts/build-windows.bat +2 -2
- package/vendor/raylib/src/CMakeLists.txt +6 -7
- package/vendor/raylib/src/Makefile +209 -103
- package/vendor/raylib/src/build.zig +56 -20
- package/vendor/raylib/src/config.h +32 -27
- package/vendor/raylib/src/external/cgltf.h +342 -104
- package/vendor/raylib/src/external/dr_wav.h +487 -225
- package/vendor/raylib/src/external/glfw/src/posix_time.c +1 -3
- package/vendor/raylib/src/external/glfw/src/wl_init.c +1 -3
- package/vendor/raylib/src/external/jar_xm.h +2 -1
- package/vendor/raylib/src/external/miniaudio.h +62251 -42061
- package/vendor/raylib/src/external/qoi.h +671 -0
- package/vendor/raylib/src/external/stb_vorbis.h +1 -1
- package/vendor/raylib/src/external/vox_loader.h +30 -25
- package/vendor/raylib/src/minshell.html +82 -0
- package/vendor/raylib/src/raudio.c +359 -201
- package/vendor/raylib/src/raylib.dll.rc +5 -5
- package/vendor/raylib/src/raylib.dll.rc.data +0 -0
- package/vendor/raylib/src/raylib.h +95 -63
- package/vendor/raylib/src/raylib.rc +5 -5
- package/vendor/raylib/src/raylib.rc.data +0 -0
- package/vendor/raylib/src/raymath.h +391 -133
- package/vendor/raylib/src/rcamera.h +32 -41
- package/vendor/raylib/src/rcore.c +775 -471
- package/vendor/raylib/src/rgestures.h +5 -5
- package/vendor/raylib/src/rglfw.c +3 -3
- package/vendor/raylib/src/rlgl.h +184 -144
- package/vendor/raylib/src/rmodels.c +207 -144
- package/vendor/raylib/src/rshapes.c +105 -47
- package/vendor/raylib/src/rtext.c +255 -38
- package/vendor/raylib/src/rtextures.c +167 -71
- package/vendor/raylib/src/shell.html +63 -63
- package/vendor/raylib/src/utils.c +49 -3
- package/vendor/raylib/src/utils.h +3 -3
- package/build/qemu/2.1.1/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/2.1.1/koffi_win32_x64.tar.gz +0 -0
- package/vendor/raylib/CONTRIBUTORS.md +0 -63
- package/vendor/raylib/SPONSORS.md +0 -68
- package/vendor/raylib/examples/core/core_quat_conversion.c +0 -132
- package/vendor/raylib/examples/core/core_quat_conversion.png +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/AnimatedMorphCube.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/AnimatedTriangle.gltf +0 -118
- package/vendor/raylib/examples/models/resources/models/gltf/BoxAnimated.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/girl.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/rigged_figure.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/vertex_colored_object.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/iqm/vertex_colored_object.iqm +0 -0
- package/vendor/raylib/examples/models/rlights.h +0 -183
- package/vendor/raylib/examples/others/raudio_standalone.c +0 -152
- package/vendor/raylib/examples/others/resources/audio/country.mp3 +0 -0
- package/vendor/raylib/examples/others/resources/audio/target.ogg +0 -0
- package/vendor/raylib/examples/others/resources/audio/weird.wav +0 -0
- package/vendor/raylib/examples/physics/physics_demo.c +0 -128
- package/vendor/raylib/examples/physics/physics_demo.png +0 -0
- package/vendor/raylib/examples/physics/physics_friction.c +0 -142
- package/vendor/raylib/examples/physics/physics_friction.png +0 -0
- package/vendor/raylib/examples/physics/physics_movement.c +0 -128
- package/vendor/raylib/examples/physics/physics_movement.png +0 -0
- package/vendor/raylib/examples/physics/physics_restitution.c +0 -129
- package/vendor/raylib/examples/physics/physics_restitution.png +0 -0
- package/vendor/raylib/examples/physics/physics_shatter.c +0 -111
- package/vendor/raylib/examples/physics/physics_shatter.png +0 -0
- package/vendor/raylib/parser/raylib_api.json +0 -6668
- package/vendor/raylib/projects/VS2019/raylib/raylib.rc +0 -0
- package/vendor/raylib/projects/VS2019/raylib/resource.h +0 -14
- package/vendor/raylib/src/extras/physac.h +0 -1977
- package/vendor/raylib/src/extras/rmem.h +0 -751
- package/vendor/raylib/src/raudio.h +0 -198
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
*
|
|
3
3
|
* raylib [models] example - first person maze
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
5
|
+
* Example originally created with raylib 2.5, last time updated with raylib 3.5
|
|
7
6
|
*
|
|
8
|
-
*
|
|
7
|
+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
8
|
+
* BSD-like license that allows static linking with closed source software
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2019-2022 Ramon Santamaria (@raysan5)
|
|
9
11
|
*
|
|
10
12
|
********************************************************************************************/
|
|
11
13
|
|
|
@@ -13,6 +15,9 @@
|
|
|
13
15
|
|
|
14
16
|
#include <stdlib.h> // Required for: free()
|
|
15
17
|
|
|
18
|
+
//------------------------------------------------------------------------------------
|
|
19
|
+
// Program main entry point
|
|
20
|
+
//------------------------------------------------------------------------------------
|
|
16
21
|
int main(void)
|
|
17
22
|
{
|
|
18
23
|
// Initialization
|
|
@@ -52,7 +57,7 @@ int main(void)
|
|
|
52
57
|
//----------------------------------------------------------------------------------
|
|
53
58
|
Vector3 oldCamPos = camera.position; // Store old camera position
|
|
54
59
|
|
|
55
|
-
UpdateCamera(&camera);
|
|
60
|
+
UpdateCamera(&camera);
|
|
56
61
|
|
|
57
62
|
// Check player collision (we simplify to 2D collision detection)
|
|
58
63
|
Vector2 playerPos = { camera.position.x, camera.position.z };
|
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
*
|
|
3
3
|
* raylib [models] example - Draw some basic geometric shapes (cube, sphere, cylinder...)
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
5
|
+
* Example originally created with raylib 1.0, last time updated with raylib 3.5
|
|
7
6
|
*
|
|
8
|
-
*
|
|
7
|
+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
8
|
+
* BSD-like license that allows static linking with closed source software
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5)
|
|
9
11
|
*
|
|
10
12
|
********************************************************************************************/
|
|
11
13
|
|
|
12
14
|
#include "raylib.h"
|
|
13
15
|
|
|
16
|
+
//------------------------------------------------------------------------------------
|
|
17
|
+
// Program main entry point
|
|
18
|
+
//------------------------------------------------------------------------------------
|
|
14
19
|
int main(void)
|
|
15
20
|
{
|
|
16
21
|
// Initialization
|
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
*
|
|
3
3
|
* raylib [models] example - Heightmap loading and drawing
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
5
|
+
* Example originally created with raylib 1.8, last time updated with raylib 3.5
|
|
7
6
|
*
|
|
8
|
-
*
|
|
7
|
+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
8
|
+
* BSD-like license that allows static linking with closed source software
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5)
|
|
9
11
|
*
|
|
10
12
|
********************************************************************************************/
|
|
11
13
|
|
|
12
14
|
#include "raylib.h"
|
|
13
15
|
|
|
16
|
+
//------------------------------------------------------------------------------------
|
|
17
|
+
// Program main entry point
|
|
18
|
+
//------------------------------------------------------------------------------------
|
|
14
19
|
int main(void)
|
|
15
20
|
{
|
|
16
21
|
// Initialization
|
|
@@ -44,7 +49,7 @@ int main(void)
|
|
|
44
49
|
{
|
|
45
50
|
// Update
|
|
46
51
|
//----------------------------------------------------------------------------------
|
|
47
|
-
UpdateCamera(&camera);
|
|
52
|
+
UpdateCamera(&camera);
|
|
48
53
|
//----------------------------------------------------------------------------------
|
|
49
54
|
|
|
50
55
|
// Draw
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
*
|
|
3
3
|
* raylib [models] example - Models loading
|
|
4
4
|
*
|
|
5
|
-
* raylib supports multiple models file formats:
|
|
5
|
+
* NOTE: raylib supports multiple models file formats:
|
|
6
6
|
*
|
|
7
7
|
* - OBJ > Text file format. Must include vertex position-texcoords-normals information,
|
|
8
8
|
* if files references some .mtl materials file, it will be loaded (or try to).
|
|
@@ -13,15 +13,20 @@
|
|
|
13
13
|
* - VOX > Binary file format. MagikaVoxel mesh format:
|
|
14
14
|
* https://github.com/ephtracy/voxel-model/blob/master/MagicaVoxel-file-format-vox.txt
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
16
|
+
* Example originally created with raylib 2.0, last time updated with raylib 4.2
|
|
18
17
|
*
|
|
19
|
-
*
|
|
18
|
+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
19
|
+
* BSD-like license that allows static linking with closed source software
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5)
|
|
20
22
|
*
|
|
21
23
|
********************************************************************************************/
|
|
22
24
|
|
|
23
25
|
#include "raylib.h"
|
|
24
26
|
|
|
27
|
+
//------------------------------------------------------------------------------------
|
|
28
|
+
// Program main entry point
|
|
29
|
+
//------------------------------------------------------------------------------------
|
|
25
30
|
int main(void)
|
|
26
31
|
{
|
|
27
32
|
// Initialization
|
|
@@ -67,35 +72,34 @@ int main(void)
|
|
|
67
72
|
// Load new models/textures on drag&drop
|
|
68
73
|
if (IsFileDropped())
|
|
69
74
|
{
|
|
70
|
-
|
|
71
|
-
char **droppedFiles = GetDroppedFiles(&count);
|
|
75
|
+
FilePathList droppedFiles = LoadDroppedFiles();
|
|
72
76
|
|
|
73
|
-
if (count == 1) // Only support one file dropped
|
|
77
|
+
if (droppedFiles.count == 1) // Only support one file dropped
|
|
74
78
|
{
|
|
75
|
-
if (IsFileExtension(droppedFiles[0], ".obj") ||
|
|
76
|
-
IsFileExtension(droppedFiles[0], ".gltf") ||
|
|
77
|
-
IsFileExtension(droppedFiles[0], ".glb") ||
|
|
78
|
-
IsFileExtension(droppedFiles[0], ".vox") ||
|
|
79
|
-
IsFileExtension(droppedFiles[0], ".iqm")) // Model file formats supported
|
|
79
|
+
if (IsFileExtension(droppedFiles.paths[0], ".obj") ||
|
|
80
|
+
IsFileExtension(droppedFiles.paths[0], ".gltf") ||
|
|
81
|
+
IsFileExtension(droppedFiles.paths[0], ".glb") ||
|
|
82
|
+
IsFileExtension(droppedFiles.paths[0], ".vox") ||
|
|
83
|
+
IsFileExtension(droppedFiles.paths[0], ".iqm")) // Model file formats supported
|
|
80
84
|
{
|
|
81
|
-
UnloadModel(model);
|
|
82
|
-
model = LoadModel(droppedFiles[0]);
|
|
85
|
+
UnloadModel(model); // Unload previous model
|
|
86
|
+
model = LoadModel(droppedFiles.paths[0]); // Load new model
|
|
83
87
|
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set current map diffuse texture
|
|
84
88
|
|
|
85
89
|
bounds = GetMeshBoundingBox(model.meshes[0]);
|
|
86
90
|
|
|
87
91
|
// TODO: Move camera position from target enough distance to visualize model properly
|
|
88
92
|
}
|
|
89
|
-
else if (IsFileExtension(droppedFiles[0], ".png")) // Texture file formats supported
|
|
93
|
+
else if (IsFileExtension(droppedFiles.paths[0], ".png")) // Texture file formats supported
|
|
90
94
|
{
|
|
91
95
|
// Unload current model texture and load new one
|
|
92
96
|
UnloadTexture(texture);
|
|
93
|
-
texture = LoadTexture(droppedFiles[0]);
|
|
97
|
+
texture = LoadTexture(droppedFiles.paths[0]);
|
|
94
98
|
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
|
|
95
99
|
}
|
|
96
100
|
}
|
|
97
101
|
|
|
98
|
-
|
|
102
|
+
UnloadDroppedFiles(droppedFiles); // Unload filepaths from memory
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
// Select model on mouse click
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
/*******************************************************************************************
|
|
2
2
|
*
|
|
3
|
-
* raylib [models] example -
|
|
3
|
+
* raylib [models] example - loading gltf
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
5
|
+
* Example originally created with raylib 3.7, last time updated with raylib 4.2
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Also make sure the scale parameter of your models is set to 0.0,
|
|
11
|
-
* scaling can be applied from the export menu.
|
|
7
|
+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
8
|
+
* BSD-like license that allows static linking with closed source software
|
|
12
9
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* Copyright (c) 2021 Hristo Stamenov (@object71) and Ramon Santamaria (@raysan5)
|
|
10
|
+
* Copyright (c) 2020-2022 Ramon Santamaria (@raysan5)
|
|
16
11
|
*
|
|
17
12
|
********************************************************************************************/
|
|
18
13
|
|
|
19
14
|
#include "raylib.h"
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
//------------------------------------------------------------------------------------
|
|
17
|
+
// Program main entry point
|
|
18
|
+
//------------------------------------------------------------------------------------
|
|
23
19
|
int main(void)
|
|
24
20
|
{
|
|
25
21
|
// Initialization
|
|
@@ -27,7 +23,7 @@ int main(void)
|
|
|
27
23
|
const int screenWidth = 800;
|
|
28
24
|
const int screenHeight = 450;
|
|
29
25
|
|
|
30
|
-
InitWindow(screenWidth, screenHeight, "raylib [models] example -
|
|
26
|
+
InitWindow(screenWidth, screenHeight, "raylib [models] example - loading gltf");
|
|
31
27
|
|
|
32
28
|
// Define the camera to look into our 3d world
|
|
33
29
|
Camera camera = { 0 };
|
|
@@ -37,18 +33,8 @@ int main(void)
|
|
|
37
33
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
|
38
34
|
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
|
39
35
|
|
|
40
|
-
//
|
|
41
|
-
Model model
|
|
42
|
-
model[0] = LoadModel("resources/models/gltf/raylib_32x32.glb");
|
|
43
|
-
model[1] = LoadModel("resources/models/gltf/rigged_figure.glb");
|
|
44
|
-
model[2] = LoadModel("resources/models/gltf/GearboxAssy.glb");
|
|
45
|
-
model[3] = LoadModel("resources/models/gltf/BoxAnimated.glb");
|
|
46
|
-
model[4] = LoadModel("resources/models/gltf/AnimatedTriangle.gltf");
|
|
47
|
-
model[5] = LoadModel("resources/models/gltf/AnimatedMorphCube.glb");
|
|
48
|
-
model[6] = LoadModel("resources/models/gltf/vertex_colored_object.glb");
|
|
49
|
-
model[7] = LoadModel("resources/models/gltf/girl.glb");
|
|
50
|
-
|
|
51
|
-
int currentModel = 0;
|
|
36
|
+
// Loaf gltf model
|
|
37
|
+
Model model = LoadModel("resources/models/gltf/robot.glb");
|
|
52
38
|
|
|
53
39
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
|
54
40
|
|
|
@@ -62,19 +48,7 @@ int main(void)
|
|
|
62
48
|
{
|
|
63
49
|
// Update
|
|
64
50
|
//----------------------------------------------------------------------------------
|
|
65
|
-
UpdateCamera(&camera);
|
|
66
|
-
|
|
67
|
-
if (IsKeyReleased(KEY_RIGHT))
|
|
68
|
-
{
|
|
69
|
-
currentModel++;
|
|
70
|
-
if (currentModel == MAX_GLTF_MODELS) currentModel = 0;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (IsKeyReleased(KEY_LEFT))
|
|
74
|
-
{
|
|
75
|
-
currentModel--;
|
|
76
|
-
if (currentModel < 0) currentModel = MAX_GLTF_MODELS - 1;
|
|
77
|
-
}
|
|
51
|
+
UpdateCamera(&camera);
|
|
78
52
|
//----------------------------------------------------------------------------------
|
|
79
53
|
|
|
80
54
|
// Draw
|
|
@@ -85,7 +59,7 @@ int main(void)
|
|
|
85
59
|
|
|
86
60
|
BeginMode3D(camera);
|
|
87
61
|
|
|
88
|
-
DrawModel(model
|
|
62
|
+
DrawModel(model, position, 1.0f, WHITE);
|
|
89
63
|
DrawGrid(10, 1.0f); // Draw a grid
|
|
90
64
|
|
|
91
65
|
EndMode3D();
|
|
@@ -96,8 +70,8 @@ int main(void)
|
|
|
96
70
|
|
|
97
71
|
// De-Initialization
|
|
98
72
|
//--------------------------------------------------------------------------------------
|
|
99
|
-
|
|
100
|
-
|
|
73
|
+
UnloadModel(model); // Unload model and meshes/material
|
|
74
|
+
|
|
101
75
|
CloseWindow(); // Close window and OpenGL context
|
|
102
76
|
//--------------------------------------------------------------------------------------
|
|
103
77
|
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
*
|
|
3
3
|
* raylib [models] example - Load models vox (MagicaVoxel)
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
5
|
+
* Example originally created with raylib 4.0, last time updated with raylib 4.0
|
|
7
6
|
*
|
|
8
7
|
* Example contributed by Johann Nadalutti (@procfxgen) and reviewed by Ramon Santamaria (@raysan5)
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
10
|
+
* BSD-like license that allows static linking with closed source software
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2021-2022 Johann Nadalutti (@procfxgen) and Ramon Santamaria (@raysan5)
|
|
11
13
|
*
|
|
12
14
|
********************************************************************************************/
|
|
13
15
|
|
|
@@ -17,6 +19,9 @@
|
|
|
17
19
|
|
|
18
20
|
#define MAX_VOX_FILES 3
|
|
19
21
|
|
|
22
|
+
//------------------------------------------------------------------------------------
|
|
23
|
+
// Program main entry point
|
|
24
|
+
//------------------------------------------------------------------------------------
|
|
20
25
|
int main(void)
|
|
21
26
|
{
|
|
22
27
|
// Initialization
|
|
@@ -74,7 +79,7 @@ int main(void)
|
|
|
74
79
|
{
|
|
75
80
|
// Update
|
|
76
81
|
//----------------------------------------------------------------------------------
|
|
77
|
-
UpdateCamera(&camera);
|
|
82
|
+
UpdateCamera(&camera);
|
|
78
83
|
|
|
79
84
|
// Cycle between models on mouse click
|
|
80
85
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1)%MAX_VOX_FILES;
|
|
@@ -2,68 +2,24 @@
|
|
|
2
2
|
*
|
|
3
3
|
* raylib example - procedural mesh generation
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
5
|
+
* Example originally created with raylib 1.8, last time updated with raylib 4.0
|
|
7
6
|
*
|
|
8
|
-
*
|
|
7
|
+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
8
|
+
* BSD-like license that allows static linking with closed source software
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2017-2022 Ramon Santamaria (@raysan5)
|
|
9
11
|
*
|
|
10
12
|
********************************************************************************************/
|
|
11
13
|
|
|
12
14
|
#include "raylib.h"
|
|
13
15
|
|
|
14
|
-
#define NUM_MODELS 9
|
|
15
|
-
|
|
16
|
-
void AllocateMeshData(Mesh* mesh, int triangleCount)
|
|
17
|
-
{
|
|
18
|
-
mesh->vertexCount = triangleCount * 3;
|
|
19
|
-
mesh->triangleCount = triangleCount;
|
|
20
|
-
|
|
21
|
-
mesh->vertices = (float*)MemAlloc(mesh->vertexCount * 3 * sizeof(float));
|
|
22
|
-
mesh->texcoords = (float*)MemAlloc(mesh->vertexCount * 2 * sizeof(float));
|
|
23
|
-
mesh->normals = (float*)MemAlloc(mesh->vertexCount * 3 * sizeof(float));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// generate a simple triangle mesh from code
|
|
27
|
-
Mesh MakeMesh()
|
|
28
|
-
{
|
|
29
|
-
Mesh mesh = { 0 };
|
|
30
|
-
AllocateMeshData(&mesh, 1);
|
|
31
|
-
|
|
32
|
-
// vertex at the origin
|
|
33
|
-
mesh.vertices[0] = 0;
|
|
34
|
-
mesh.vertices[1] = 0;
|
|
35
|
-
mesh.vertices[2] = 0;
|
|
36
|
-
mesh.normals[0] = 0;
|
|
37
|
-
mesh.normals[1] = 1;
|
|
38
|
-
mesh.normals[2] = 0;
|
|
39
|
-
mesh.texcoords[0] = 0;
|
|
40
|
-
mesh.texcoords[1] = 0;
|
|
41
|
-
|
|
42
|
-
// vertex at 1,0,2
|
|
43
|
-
mesh.vertices[3] = 1;
|
|
44
|
-
mesh.vertices[4] = 0;
|
|
45
|
-
mesh.vertices[5] = 2;
|
|
46
|
-
mesh.normals[3] = 0;
|
|
47
|
-
mesh.normals[4] = 1;
|
|
48
|
-
mesh.normals[5] = 0;
|
|
49
|
-
mesh.texcoords[2] = 0.5f;
|
|
50
|
-
mesh.texcoords[3] = 1.0f;
|
|
51
|
-
|
|
52
|
-
// vertex at 2,0,0
|
|
53
|
-
mesh.vertices[6] = 2;
|
|
54
|
-
mesh.vertices[7] = 0;
|
|
55
|
-
mesh.vertices[8] = 0;
|
|
56
|
-
mesh.normals[6] = 0;
|
|
57
|
-
mesh.normals[7] = 1;
|
|
58
|
-
mesh.normals[8] = 0;
|
|
59
|
-
mesh.texcoords[4] = 1;
|
|
60
|
-
mesh.texcoords[5] =0;
|
|
16
|
+
#define NUM_MODELS 9 // Parametric 3d shapes to generate
|
|
61
17
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return mesh;
|
|
65
|
-
}
|
|
18
|
+
static Mesh GenMeshCustom(void); // Generate a simple triangle mesh from code
|
|
66
19
|
|
|
20
|
+
//------------------------------------------------------------------------------------
|
|
21
|
+
// Program main entry point
|
|
22
|
+
//------------------------------------------------------------------------------------
|
|
67
23
|
int main(void)
|
|
68
24
|
{
|
|
69
25
|
// Initialization
|
|
@@ -88,7 +44,18 @@ int main(void)
|
|
|
88
44
|
models[5] = LoadModelFromMesh(GenMeshTorus(0.25f, 4.0f, 16, 32));
|
|
89
45
|
models[6] = LoadModelFromMesh(GenMeshKnot(1.0f, 2.0f, 16, 128));
|
|
90
46
|
models[7] = LoadModelFromMesh(GenMeshPoly(5, 2.0f));
|
|
91
|
-
models[8] = LoadModelFromMesh(
|
|
47
|
+
models[8] = LoadModelFromMesh(GenMeshCustom());
|
|
48
|
+
|
|
49
|
+
// Generated meshes could be exported as .obj files
|
|
50
|
+
//ExportMesh(models[0].meshes[0], "plane.obj");
|
|
51
|
+
//ExportMesh(models[1].meshes[0], "cube.obj");
|
|
52
|
+
//ExportMesh(models[2].meshes[0], "sphere.obj");
|
|
53
|
+
//ExportMesh(models[3].meshes[0], "hemisphere.obj");
|
|
54
|
+
//ExportMesh(models[4].meshes[0], "cylinder.obj");
|
|
55
|
+
//ExportMesh(models[5].meshes[0], "torus.obj");
|
|
56
|
+
//ExportMesh(models[6].meshes[0], "knot.obj");
|
|
57
|
+
//ExportMesh(models[7].meshes[0], "poly.obj");
|
|
58
|
+
//ExportMesh(models[8].meshes[0], "custom.obj");
|
|
92
59
|
|
|
93
60
|
// Set checked texture as default diffuse component for all models material
|
|
94
61
|
for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
|
|
@@ -111,7 +78,7 @@ int main(void)
|
|
|
111
78
|
{
|
|
112
79
|
// Update
|
|
113
80
|
//----------------------------------------------------------------------------------
|
|
114
|
-
UpdateCamera(&camera);
|
|
81
|
+
UpdateCamera(&camera);
|
|
115
82
|
|
|
116
83
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
|
117
84
|
{
|
|
@@ -157,7 +124,7 @@ int main(void)
|
|
|
157
124
|
case 5: DrawText("TORUS", 680, 10, 20, DARKBLUE); break;
|
|
158
125
|
case 6: DrawText("KNOT", 680, 10, 20, DARKBLUE); break;
|
|
159
126
|
case 7: DrawText("POLY", 680, 10, 20, DARKBLUE); break;
|
|
160
|
-
case 8: DrawText("
|
|
127
|
+
case 8: DrawText("Custom (triangle)", 580, 10, 20, DARKBLUE); break;
|
|
161
128
|
default: break;
|
|
162
129
|
}
|
|
163
130
|
|
|
@@ -176,4 +143,50 @@ int main(void)
|
|
|
176
143
|
//--------------------------------------------------------------------------------------
|
|
177
144
|
|
|
178
145
|
return 0;
|
|
179
|
-
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Generate a simple triangle mesh from code
|
|
149
|
+
static Mesh GenMeshCustom(void)
|
|
150
|
+
{
|
|
151
|
+
Mesh mesh = { 0 };
|
|
152
|
+
mesh.triangleCount = 1;
|
|
153
|
+
mesh.vertexCount = mesh.triangleCount*3;
|
|
154
|
+
mesh.vertices = (float *)MemAlloc(mesh.vertexCount*3*sizeof(float)); // 3 vertices, 3 coordinates each (x, y, z)
|
|
155
|
+
mesh.texcoords = (float *)MemAlloc(mesh.vertexCount*2*sizeof(float)); // 3 vertices, 2 coordinates each (x, y)
|
|
156
|
+
mesh.normals = (float *)MemAlloc(mesh.vertexCount*3*sizeof(float)); // 3 vertices, 3 coordinates each (x, y, z)
|
|
157
|
+
|
|
158
|
+
// Vertex at (0, 0, 0)
|
|
159
|
+
mesh.vertices[0] = 0;
|
|
160
|
+
mesh.vertices[1] = 0;
|
|
161
|
+
mesh.vertices[2] = 0;
|
|
162
|
+
mesh.normals[0] = 0;
|
|
163
|
+
mesh.normals[1] = 1;
|
|
164
|
+
mesh.normals[2] = 0;
|
|
165
|
+
mesh.texcoords[0] = 0;
|
|
166
|
+
mesh.texcoords[1] = 0;
|
|
167
|
+
|
|
168
|
+
// Vertex at (1, 0, 2)
|
|
169
|
+
mesh.vertices[3] = 1;
|
|
170
|
+
mesh.vertices[4] = 0;
|
|
171
|
+
mesh.vertices[5] = 2;
|
|
172
|
+
mesh.normals[3] = 0;
|
|
173
|
+
mesh.normals[4] = 1;
|
|
174
|
+
mesh.normals[5] = 0;
|
|
175
|
+
mesh.texcoords[2] = 0.5f;
|
|
176
|
+
mesh.texcoords[3] = 1.0f;
|
|
177
|
+
|
|
178
|
+
// Vertex at (2, 0, 0)
|
|
179
|
+
mesh.vertices[6] = 2;
|
|
180
|
+
mesh.vertices[7] = 0;
|
|
181
|
+
mesh.vertices[8] = 0;
|
|
182
|
+
mesh.normals[6] = 0;
|
|
183
|
+
mesh.normals[7] = 1;
|
|
184
|
+
mesh.normals[8] = 0;
|
|
185
|
+
mesh.texcoords[4] = 1;
|
|
186
|
+
mesh.texcoords[5] =0;
|
|
187
|
+
|
|
188
|
+
// Upload mesh data from CPU (RAM) to GPU (VRAM) memory
|
|
189
|
+
UploadMesh(&mesh, false);
|
|
190
|
+
|
|
191
|
+
return mesh;
|
|
192
|
+
}
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
*
|
|
3
3
|
* raylib [models] example - Mesh picking in 3d mode, ground plane, triangle, mesh
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
5
|
+
* Example originally created with raylib 1.7, last time updated with raylib 4.0
|
|
7
6
|
*
|
|
8
7
|
* Example contributed by Joel Davis (@joeld42) and reviewed by Ramon Santamaria (@raysan5)
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
10
|
+
* BSD-like license that allows static linking with closed source software
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2017-2022 Joel Davis (@joeld42) and Ramon Santamaria (@raysan5)
|
|
11
13
|
*
|
|
12
14
|
********************************************************************************************/
|
|
13
15
|
|
|
@@ -16,6 +18,9 @@
|
|
|
16
18
|
|
|
17
19
|
#define FLT_MAX 340282346638528859811704183484516925440.0f // Maximum value of a float, from bit pattern 01111111011111111111111111111111
|
|
18
20
|
|
|
21
|
+
//------------------------------------------------------------------------------------
|
|
22
|
+
// Program main entry point
|
|
23
|
+
//------------------------------------------------------------------------------------
|
|
19
24
|
int main(void)
|
|
20
25
|
{
|
|
21
26
|
// Initialization
|
|
@@ -68,7 +73,7 @@ int main(void)
|
|
|
68
73
|
{
|
|
69
74
|
// Update
|
|
70
75
|
//----------------------------------------------------------------------------------
|
|
71
|
-
UpdateCamera(&camera);
|
|
76
|
+
UpdateCamera(&camera);
|
|
72
77
|
|
|
73
78
|
// Display information about closest hit
|
|
74
79
|
RayCollision collision = { 0 };
|
|
@@ -121,9 +126,22 @@ int main(void)
|
|
|
121
126
|
cursorColor = ORANGE;
|
|
122
127
|
hitObjectName = "Box";
|
|
123
128
|
|
|
124
|
-
// Check ray collision against model
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
// Check ray collision against model meshes
|
|
130
|
+
RayCollision meshHitInfo = { 0 };
|
|
131
|
+
for (int m = 0; m < tower.meshCount; m++)
|
|
132
|
+
{
|
|
133
|
+
// NOTE: We consider the model.transform for the collision check but
|
|
134
|
+
// it can be checked against any transform Matrix, used when checking against same
|
|
135
|
+
// model drawn multiple times with multiple transforms
|
|
136
|
+
meshHitInfo = GetRayCollisionMesh(ray, tower.meshes[m], tower.transform);
|
|
137
|
+
if (meshHitInfo.hit)
|
|
138
|
+
{
|
|
139
|
+
// Save the closest hit mesh
|
|
140
|
+
if ((!collision.hit) || (collision.distance > meshHitInfo.distance)) collision = meshHitInfo;
|
|
141
|
+
|
|
142
|
+
break; // Stop once one mesh collision is detected, the colliding mesh is m
|
|
143
|
+
}
|
|
144
|
+
}
|
|
127
145
|
|
|
128
146
|
if (meshHitInfo.hit)
|
|
129
147
|
{
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
*
|
|
3
3
|
* raylib [models] example - Show the difference between perspective and orthographic projection
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* This example has been created using raylib 2.0 (www.raylib.com)
|
|
8
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
5
|
+
* Example originally created with raylib 2.0, last time updated with raylib 3.7
|
|
9
6
|
*
|
|
10
7
|
* Example contributed by Max Danielsson (@autious) and reviewed by Ramon Santamaria (@raysan5)
|
|
11
8
|
*
|
|
12
|
-
*
|
|
9
|
+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
10
|
+
* BSD-like license that allows static linking with closed source software
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2018-2022 Max Danielsson (@autious) and Ramon Santamaria (@raysan5)
|
|
13
13
|
*
|
|
14
14
|
********************************************************************************************/
|
|
15
15
|
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
#define FOVY_PERSPECTIVE 45.0f
|
|
19
19
|
#define WIDTH_ORTHOGRAPHIC 10.0f
|
|
20
20
|
|
|
21
|
+
//------------------------------------------------------------------------------------
|
|
22
|
+
// Program main entry point
|
|
23
|
+
//------------------------------------------------------------------------------------
|
|
21
24
|
int main(void)
|
|
22
25
|
{
|
|
23
26
|
// Initialization
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
*
|
|
3
3
|
* raylib [models] example - rlgl module usage with push/pop matrix transformations
|
|
4
4
|
*
|
|
5
|
-
* This example uses [rlgl] module
|
|
5
|
+
* NOTE: This example uses [rlgl] module functionality (pseudo-OpenGL 1.1 style coding)
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
7
|
+
* Example originally created with raylib 2.5, last time updated with raylib 4.0
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
10
|
+
* BSD-like license that allows static linking with closed source software
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2018-2022 Ramon Santamaria (@raysan5)
|
|
11
13
|
*
|
|
12
14
|
********************************************************************************************/
|
|
13
15
|
|