Merge branch 'raysan5:master' into master
This commit is contained in:
commit
e7f9addad2
|
|
@ -23,5 +23,6 @@
|
||||||
"build.zig.zon",
|
"build.zig.zon",
|
||||||
"src",
|
"src",
|
||||||
"examples",
|
"examples",
|
||||||
|
"LICENSE",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -547,7 +547,8 @@ SHAPES = \
|
||||||
shapes/shapes_rectangle_advanced \
|
shapes/shapes_rectangle_advanced \
|
||||||
shapes/shapes_rectangle_scaling \
|
shapes/shapes_rectangle_scaling \
|
||||||
shapes/shapes_splines_drawing \
|
shapes/shapes_splines_drawing \
|
||||||
shapes/shapes_top_down_lights
|
shapes/shapes_top_down_lights \
|
||||||
|
shapes/shapes_digital_clock
|
||||||
|
|
||||||
TEXTURES = \
|
TEXTURES = \
|
||||||
textures/textures_background_scrolling \
|
textures/textures_background_scrolling \
|
||||||
|
|
|
||||||
|
|
@ -429,7 +429,8 @@ SHAPES = \
|
||||||
shapes/shapes_rectangle_advanced \
|
shapes/shapes_rectangle_advanced \
|
||||||
shapes/shapes_rectangle_scaling \
|
shapes/shapes_rectangle_scaling \
|
||||||
shapes/shapes_splines_drawing \
|
shapes/shapes_splines_drawing \
|
||||||
shapes/shapes_top_down_lights
|
shapes/shapes_top_down_lights \
|
||||||
|
shapes/shapes_digital_clock
|
||||||
|
|
||||||
TEXTURES = \
|
TEXTURES = \
|
||||||
textures/textures_background_scrolling \
|
textures/textures_background_scrolling \
|
||||||
|
|
|
||||||
|
|
@ -85,39 +85,39 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes](
|
||||||
| 51 | [shapes_top_down_lights](shapes/shapes_top_down_lights.c) | <img src="shapes/shapes_top_down_lights.png" alt="shapes_top_down_lights" width="80"> | ⭐️⭐️⭐️⭐️ | 4.2 | 4.2 | [Jeffery Myers](https://github.com/JeffM2501) |
|
| 51 | [shapes_top_down_lights](shapes/shapes_top_down_lights.c) | <img src="shapes/shapes_top_down_lights.png" alt="shapes_top_down_lights" width="80"> | ⭐️⭐️⭐️⭐️ | 4.2 | 4.2 | [Jeffery Myers](https://github.com/JeffM2501) |
|
||||||
| 52 | [shapes_rectangle_advanced](shapes/shapes_rectangle_advanced.c) | <img src="shapes/shapes_rectangle_advanced.png" alt="shapes_rectangle_advanced" width="80"> | ⭐️⭐️⭐️⭐️ | 5.5 | 5.5 | [Everton Jr.](https://github.com/evertonse) |
|
| 52 | [shapes_rectangle_advanced](shapes/shapes_rectangle_advanced.c) | <img src="shapes/shapes_rectangle_advanced.png" alt="shapes_rectangle_advanced" width="80"> | ⭐️⭐️⭐️⭐️ | 5.5 | 5.5 | [Everton Jr.](https://github.com/evertonse) |
|
||||||
| 53 | [shapes_splines_drawing](shapes/shapes_splines_drawing.c) | <img src="shapes/shapes_splines_drawing.png" alt="shapes_splines_drawing" width="80"> | ⭐️⭐️⭐️☆ | 5.0 | 5.0 | [Ray](https://github.com/raysan5) |
|
| 53 | [shapes_splines_drawing](shapes/shapes_splines_drawing.c) | <img src="shapes/shapes_splines_drawing.png" alt="shapes_splines_drawing" width="80"> | ⭐️⭐️⭐️☆ | 5.0 | 5.0 | [Ray](https://github.com/raysan5) |
|
||||||
|
| 54 | [shapes_digital_clock](shapes/shapes_digital_clock.c) | <img src="shapes/shapes_digital_clock.png" alt="shapes_digital_clock" width="80"> | ⭐️⭐️☆☆ | 5.5 | 5.5 | [Hamza RAHAL](https://github.com/rhmz-rhl) |
|
||||||
### category: textures
|
### category: textures
|
||||||
|
|
||||||
Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib [textures](../src/textures.c) modul
|
Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib [textures](../src/textures.c) modul
|
||||||
|
|
||||||
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| 54 | [textures_logo_raylib](textures/textures_logo_raylib.c) | <img src="textures/textures_logo_raylib.png" alt="textures_logo_raylib" width="80"> | ⭐️☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
|
| 55 | [textures_logo_raylib](textures/textures_logo_raylib.c) | <img src="textures/textures_logo_raylib.png" alt="textures_logo_raylib" width="80"> | ⭐️☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 55 | [textures_srcrec_dstrec](textures/textures_srcrec_dstrec.c) | <img src="textures/textures_srcrec_dstrec.png" alt="textures_srcrec_dstrec" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
|
| 56 | [textures_srcrec_dstrec](textures/textures_srcrec_dstrec.c) | <img src="textures/textures_srcrec_dstrec.png" alt="textures_srcrec_dstrec" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
|
||||||
| 56 | [textures_image_drawing](textures/textures_image_drawing.c) | <img src="textures/textures_image_drawing.png" alt="textures_image_drawing" width="80"> | ⭐️⭐️☆☆ | 1.4 | 1.4 | [Ray](https://github.com/raysan5) |
|
| 57 | [textures_image_drawing](textures/textures_image_drawing.c) | <img src="textures/textures_image_drawing.png" alt="textures_image_drawing" width="80"> | ⭐️⭐️☆☆ | 1.4 | 1.4 | [Ray](https://github.com/raysan5) |
|
||||||
| 57 | [textures_image_generation](textures/textures_image_generation.c) | <img src="textures/textures_image_generation.png" alt="textures_image_generation" width="80"> | ⭐️⭐️☆☆ | 1.8 | 1.8 | [Wilhem Barbier](https://github.com/nounoursheureux) |
|
| 58 | [textures_image_generation](textures/textures_image_generation.c) | <img src="textures/textures_image_generation.png" alt="textures_image_generation" width="80"> | ⭐️⭐️☆☆ | 1.8 | 1.8 | [Wilhem Barbier](https://github.com/nounoursheureux) |
|
||||||
| 58 | [textures_image_loading](textures/textures_image_loading.c) | <img src="textures/textures_image_loading.png" alt="textures_image_loading" width="80"> | ⭐️☆☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
|
| 59 | [textures_image_loading](textures/textures_image_loading.c) | <img src="textures/textures_image_loading.png" alt="textures_image_loading" width="80"> | ⭐️☆☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
|
||||||
| 59 | [textures_image_processing](textures/textures_image_processing.c) | <img src="textures/textures_image_processing.png" alt="textures_image_processing" width="80"> | ⭐️⭐️⭐️☆ | 1.4 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 60 | [textures_image_processing](textures/textures_image_processing.c) | <img src="textures/textures_image_processing.png" alt="textures_image_processing" width="80"> | ⭐️⭐️⭐️☆ | 1.4 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 60 | [textures_image_text](textures/textures_image_text.c) | <img src="textures/textures_image_text.png" alt="textures_image_text" width="80"> | ⭐️⭐️☆☆ | 1.8 | 4.0 | [Ray](https://github.com/raysan5) |
|
| 61 | [textures_image_text](textures/textures_image_text.c) | <img src="textures/textures_image_text.png" alt="textures_image_text" width="80"> | ⭐️⭐️☆☆ | 1.8 | 4.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 61 | [textures_to_image](textures/textures_to_image.c) | <img src="textures/textures_to_image.png" alt="textures_to_image" width="80"> | ⭐️☆☆☆ | 1.3 | 4.0 | [Ray](https://github.com/raysan5) |
|
| 62 | [textures_to_image](textures/textures_to_image.c) | <img src="textures/textures_to_image.png" alt="textures_to_image" width="80"> | ⭐️☆☆☆ | 1.3 | 4.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 62 | [textures_raw_data](textures/textures_raw_data.c) | <img src="textures/textures_raw_data.png" alt="textures_raw_data" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 63 | [textures_raw_data](textures/textures_raw_data.c) | <img src="textures/textures_raw_data.png" alt="textures_raw_data" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 63 | [textures_particles_blending](textures/textures_particles_blending.c) | <img src="textures/textures_particles_blending.png" alt="textures_particles_blending" width="80"> | ⭐️☆☆☆ | 1.7 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 64 | [textures_particles_blending](textures/textures_particles_blending.c) | <img src="textures/textures_particles_blending.png" alt="textures_particles_blending" width="80"> | ⭐️☆☆☆ | 1.7 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 64 | [textures_npatch_drawing](textures/textures_npatch_drawing.c) | <img src="textures/textures_npatch_drawing.png" alt="textures_npatch_drawing" width="80"> | ⭐️⭐️⭐️☆ | 2.0 | 2.5 | [Jorge A. Gomes](https://github.com/overdev) |
|
| 65 | [textures_npatch_drawing](textures/textures_npatch_drawing.c) | <img src="textures/textures_npatch_drawing.png" alt="textures_npatch_drawing" width="80"> | ⭐️⭐️⭐️☆ | 2.0 | 2.5 | [Jorge A. Gomes](https://github.com/overdev) |
|
||||||
| 65 | [textures_background_scrolling](textures/textures_background_scrolling.c) | <img src="textures/textures_background_scrolling.png" alt="textures_background_scrolling" width="80"> | ⭐️☆☆☆ | 2.0 | 2.5 | [Ray](https://github.com/raysan5) |
|
| 66 | [textures_background_scrolling](textures/textures_background_scrolling.c) | <img src="textures/textures_background_scrolling.png" alt="textures_background_scrolling" width="80"> | ⭐️☆☆☆ | 2.0 | 2.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 66 | [textures_sprite_anim](textures/textures_sprite_anim.c) | <img src="textures/textures_sprite_anim.png" alt="textures_sprite_anim" width="80"> | ⭐️⭐️☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
|
| 67 | [textures_sprite_anim](textures/textures_sprite_anim.c) | <img src="textures/textures_sprite_anim.png" alt="textures_sprite_anim" width="80"> | ⭐️⭐️☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
|
||||||
| 67 | [textures_sprite_button](textures/textures_sprite_button.c) | <img src="textures/textures_sprite_button.png" alt="textures_sprite_button" width="80"> | ⭐️⭐️☆☆ | 2.5 | 2.5 | [Ray](https://github.com/raysan5) |
|
| 68 | [textures_sprite_button](textures/textures_sprite_button.c) | <img src="textures/textures_sprite_button.png" alt="textures_sprite_button" width="80"> | ⭐️⭐️☆☆ | 2.5 | 2.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 68 | [textures_sprite_explosion](textures/textures_sprite_explosion.c) | <img src="textures/textures_sprite_explosion.png" alt="textures_sprite_explosion" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 69 | [textures_sprite_explosion](textures/textures_sprite_explosion.c) | <img src="textures/textures_sprite_explosion.png" alt="textures_sprite_explosion" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 69 | [textures_bunnymark](textures/textures_bunnymark.c) | <img src="textures/textures_bunnymark.png" alt="textures_bunnymark" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | 2.5 | [Ray](https://github.com/raysan5) |
|
| 70 | [textures_bunnymark](textures/textures_bunnymark.c) | <img src="textures/textures_bunnymark.png" alt="textures_bunnymark" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | 2.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 70 | [textures_mouse_painting](textures/textures_mouse_painting.c) | <img src="textures/textures_mouse_painting.png" alt="textures_mouse_painting" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.0 | [Chris Dill](https://github.com/MysteriousSpace) |
|
| 71 | [textures_mouse_painting](textures/textures_mouse_painting.c) | <img src="textures/textures_mouse_painting.png" alt="textures_mouse_painting" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.0 | [Chris Dill](https://github.com/MysteriousSpace) |
|
||||||
| 71 | [textures_blend_modes](textures/textures_blend_modes.c) | <img src="textures/textures_blend_modes.png" alt="textures_blend_modes" width="80"> | ⭐️☆☆☆ | 3.5 | 3.5 | [Karlo Licudine](https://github.com/accidentalrebel) |
|
| 72 | [textures_blend_modes](textures/textures_blend_modes.c) | <img src="textures/textures_blend_modes.png" alt="textures_blend_modes" width="80"> | ⭐️☆☆☆ | 3.5 | 3.5 | [Karlo Licudine](https://github.com/accidentalrebel) |
|
||||||
| 72 | [textures_draw_tiled](textures/textures_draw_tiled.c) | <img src="textures/textures_draw_tiled.png" alt="textures_draw_tiled" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 4.2 | [Vlad Adrian](https://github.com/demizdor) |
|
| 73 | [textures_draw_tiled](textures/textures_draw_tiled.c) | <img src="textures/textures_draw_tiled.png" alt="textures_draw_tiled" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 4.2 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| 73 | [textures_polygon](textures/textures_polygon.c) | <img src="textures/textures_polygon.png" alt="textures_polygon" width="80"> | ⭐️☆☆☆ | 3.7 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
| 74 | [textures_polygon](textures/textures_polygon.c) | <img src="textures/textures_polygon.png" alt="textures_polygon" width="80"> | ⭐️☆☆☆ | 3.7 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
||||||
| 74 | [textures_fog_of_war](textures/textures_fog_of_war.c) | <img src="textures/textures_fog_of_war.png" alt="textures_fog_of_war" width="80"> | ⭐️⭐️⭐️☆ | 4.2 | 4.2 | [Ray](https://github.com/raysan5) |
|
| 75 | [textures_fog_of_war](textures/textures_fog_of_war.c) | <img src="textures/textures_fog_of_war.png" alt="textures_fog_of_war" width="80"> | ⭐️⭐️⭐️☆ | 4.2 | 4.2 | [Ray](https://github.com/raysan5) |
|
||||||
| 75 | [textures_gif_player](textures/textures_gif_player.c) | <img src="textures/textures_gif_player.png" alt="textures_gif_player" width="80"> | ⭐️⭐️⭐️☆ | 4.2 | 4.2 | [Ray](https://github.com/raysan5) |
|
| 76 | [textures_gif_player](textures/textures_gif_player.c) | <img src="textures/textures_gif_player.png" alt="textures_gif_player" width="80"> | ⭐️⭐️⭐️☆ | 4.2 | 4.2 | [Ray](https://github.com/raysan5) |
|
||||||
| 76 | [textures_image_kernel](textures/textures_image_kernel.c) | <img src="textures/textures_image_kernel.png" alt="textures_image_kernel" width="80"> | ⭐️⭐️⭐️⭐️ | 1.3 | 1.3 | [Karim Salem](https://github.com/kimo-s) |
|
| 77 | [textures_image_kernel](textures/textures_image_kernel.c) | <img src="textures/textures_image_kernel.png" alt="textures_image_kernel" width="80"> | ⭐️⭐️⭐️⭐️ | 1.3 | 1.3 | [Karim Salem](https://github.com/kimo-s) |
|
||||||
| 77 | [textures_image_channel](textures/textures_image_channel.c) | <img src="textures/textures_image_channel.png" alt="textures_image_channel" width="80"> | ⭐️⭐️☆☆ | 5.1-dev | 5.1-dev | [Bruno Cabral](https://github.com/brccabral) |
|
| 78 | [textures_image_channel](textures/textures_image_channel.c) | <img src="textures/textures_image_channel.png" alt="textures_image_channel" width="80"> | ⭐️⭐️☆☆ | 5.1-dev | 5.1-dev | [Bruno Cabral](https://github.com/brccabral) |
|
||||||
| 78 | [textures_image_rotate](textures/textures_image_rotate.c) | <img src="textures/textures_image_rotate.png" alt="textures_image_rotate" width="80"> | ⭐️⭐️☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
|
| 79 | [textures_image_rotate](textures/textures_image_rotate.c) | <img src="textures/textures_image_rotate.png" alt="textures_image_rotate" width="80"> | ⭐️⭐️☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 79 | [textures_textured_curve](textures/textures_textured_curve.c) | <img src="textures/textures_textured_curve.png" alt="textures_textured_curve" width="80"> | ⭐️⭐️⭐️☆ | 4.5 | 4.5 | [Jeffery Myers](https://github.com/JeffM2501) |
|
| 80 | [textures_textured_curve](textures/textures_textured_curve.c) | <img src="textures/textures_textured_curve.png" alt="textures_textured_curve" width="80"> | ⭐️⭐️⭐️☆ | 4.5 | 4.5 | [Jeffery Myers](https://github.com/JeffM2501) |
|
||||||
|
|
||||||
### category: text
|
### category: text
|
||||||
|
|
||||||
|
|
@ -125,18 +125,18 @@ Examples using raylib text functionality, including sprite fonts loading/generat
|
||||||
|
|
||||||
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| 80 | [text_raylib_fonts](text/text_raylib_fonts.c) | <img src="text/text_raylib_fonts.png" alt="text_raylib_fonts" width="80"> | ⭐️☆☆☆ | 1.7 | 3.7 | [Ray](https://github.com/raysan5) |
|
| 81 | [text_raylib_fonts](text/text_raylib_fonts.c) | <img src="text/text_raylib_fonts.png" alt="text_raylib_fonts" width="80"> | ⭐️☆☆☆ | 1.7 | 3.7 | [Ray](https://github.com/raysan5) |
|
||||||
| 81 | [text_font_spritefont](text/text_font_spritefont.c) | <img src="text/text_font_spritefont.png" alt="text_font_spritefont" width="80"> | ⭐️☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
|
| 82 | [text_font_spritefont](text/text_font_spritefont.c) | <img src="text/text_font_spritefont.png" alt="text_font_spritefont" width="80"> | ⭐️☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 82 | [text_font_filters](text/text_font_filters.c) | <img src="text/text_font_filters.png" alt="text_font_filters" width="80"> | ⭐️⭐️☆☆ | 1.3 | 4.2 | [Ray](https://github.com/raysan5) |
|
| 83 | [text_font_filters](text/text_font_filters.c) | <img src="text/text_font_filters.png" alt="text_font_filters" width="80"> | ⭐️⭐️☆☆ | 1.3 | 4.2 | [Ray](https://github.com/raysan5) |
|
||||||
| 83 | [text_font_loading](text/text_font_loading.c) | <img src="text/text_font_loading.png" alt="text_font_loading" width="80"> | ⭐️☆☆☆ | 1.4 | 3.0 | [Ray](https://github.com/raysan5) |
|
| 84 | [text_font_loading](text/text_font_loading.c) | <img src="text/text_font_loading.png" alt="text_font_loading" width="80"> | ⭐️☆☆☆ | 1.4 | 3.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 84 | [text_font_sdf](text/text_font_sdf.c) | <img src="text/text_font_sdf.png" alt="text_font_sdf" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 4.0 | [Ray](https://github.com/raysan5) |
|
| 85 | [text_font_sdf](text/text_font_sdf.c) | <img src="text/text_font_sdf.png" alt="text_font_sdf" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 4.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 85 | [text_format_text](text/text_format_text.c) | <img src="text/text_format_text.png" alt="text_format_text" width="80"> | ⭐️☆☆☆ | 1.1 | 3.0 | [Ray](https://github.com/raysan5) |
|
| 86 | [text_format_text](text/text_format_text.c) | <img src="text/text_format_text.png" alt="text_format_text" width="80"> | ⭐️☆☆☆ | 1.1 | 3.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 86 | [text_input_box](text/text_input_box.c) | <img src="text/text_input_box.png" alt="text_input_box" width="80"> | ⭐️⭐️☆☆ | 1.7 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 87 | [text_input_box](text/text_input_box.c) | <img src="text/text_input_box.png" alt="text_input_box" width="80"> | ⭐️⭐️☆☆ | 1.7 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 87 | [text_writing_anim](text/text_writing_anim.c) | <img src="text/text_writing_anim.png" alt="text_writing_anim" width="80"> | ⭐️⭐️☆☆ | 1.4 | 1.4 | [Ray](https://github.com/raysan5) |
|
| 88 | [text_writing_anim](text/text_writing_anim.c) | <img src="text/text_writing_anim.png" alt="text_writing_anim" width="80"> | ⭐️⭐️☆☆ | 1.4 | 1.4 | [Ray](https://github.com/raysan5) |
|
||||||
| 88 | [text_rectangle_bounds](text/text_rectangle_bounds.c) | <img src="text/text_rectangle_bounds.png" alt="text_rectangle_bounds" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
| 89 | [text_rectangle_bounds](text/text_rectangle_bounds.c) | <img src="text/text_rectangle_bounds.png" alt="text_rectangle_bounds" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| 89 | [text_unicode](text/text_unicode.c) | <img src="text/text_unicode.png" alt="text_unicode" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
| 90 | [text_unicode](text/text_unicode.c) | <img src="text/text_unicode.png" alt="text_unicode" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| 90 | [text_draw_3d](text/text_draw_3d.c) | <img src="text/text_draw_3d.png" alt="text_draw_3d" width="80"> | ⭐️⭐️⭐️⭐️ | 3.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
| 91 | [text_draw_3d](text/text_draw_3d.c) | <img src="text/text_draw_3d.png" alt="text_draw_3d" width="80"> | ⭐️⭐️⭐️⭐️ | 3.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| 91 | [text_codepoints_loading](text/text_codepoints_loading.c) | <img src="text/text_codepoints_loading.png" alt="text_codepoints_loading" width="80"> | ⭐️⭐️⭐️☆ | 4.2 | 4.2 | [Ray](https://github.com/raysan5) |
|
| 92 | [text_codepoints_loading](text/text_codepoints_loading.c) | <img src="text/text_codepoints_loading.png" alt="text_codepoints_loading" width="80"> | ⭐️⭐️⭐️☆ | 4.2 | 4.2 | [Ray](https://github.com/raysan5) |
|
||||||
|
|
||||||
### category: models
|
### category: models
|
||||||
|
|
||||||
|
|
@ -144,29 +144,29 @@ Examples using raylib models functionality, including models loading/generation
|
||||||
|
|
||||||
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| 92 | [models_animation](models/models_animation.c) | <img src="models/models_animation.png" alt="models_animation" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.5 | [Culacant](https://github.com/culacant) |
|
| 93 | [models_animation](models/models_animation.c) | <img src="models/models_animation.png" alt="models_animation" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.5 | [Culacant](https://github.com/culacant) |
|
||||||
| 93 | [models_billboard](models/models_billboard.c) | <img src="models/models_billboard.png" alt="models_billboard" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 94 | [models_billboard](models/models_billboard.c) | <img src="models/models_billboard.png" alt="models_billboard" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 94 | [models_box_collisions](models/models_box_collisions.c) | <img src="models/models_box_collisions.png" alt="models_box_collisions" width="80"> | ⭐️☆☆☆ | 1.3 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 95 | [models_box_collisions](models/models_box_collisions.c) | <img src="models/models_box_collisions.png" alt="models_box_collisions" width="80"> | ⭐️☆☆☆ | 1.3 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 95 | [models_cubicmap](models/models_cubicmap.c) | <img src="models/models_cubicmap.png" alt="models_cubicmap" width="80"> | ⭐️⭐️☆☆ | 1.8 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 96 | [models_cubicmap](models/models_cubicmap.c) | <img src="models/models_cubicmap.png" alt="models_cubicmap" width="80"> | ⭐️⭐️☆☆ | 1.8 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 96 | [models_first_person_maze](models/models_first_person_maze.c) | <img src="models/models_first_person_maze.png" alt="models_first_person_maze" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 97 | [models_first_person_maze](models/models_first_person_maze.c) | <img src="models/models_first_person_maze.png" alt="models_first_person_maze" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 97 | [models_geometric_shapes](models/models_geometric_shapes.c) | <img src="models/models_geometric_shapes.png" alt="models_geometric_shapes" width="80"> | ⭐️☆☆☆ | 1.0 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 98 | [models_geometric_shapes](models/models_geometric_shapes.c) | <img src="models/models_geometric_shapes.png" alt="models_geometric_shapes" width="80"> | ⭐️☆☆☆ | 1.0 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 98 | [models_mesh_generation](models/models_mesh_generation.c) | <img src="models/models_mesh_generation.png" alt="models_mesh_generation" width="80"> | ⭐️⭐️☆☆ | 1.8 | 4.0 | [Ray](https://github.com/raysan5) |
|
| 99 | [models_mesh_generation](models/models_mesh_generation.c) | <img src="models/models_mesh_generation.png" alt="models_mesh_generation" width="80"> | ⭐️⭐️☆☆ | 1.8 | 4.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 99 | [models_mesh_picking](models/models_mesh_picking.c) | <img src="models/models_mesh_picking.png" alt="models_mesh_picking" width="80"> | ⭐️⭐️⭐️☆ | 1.7 | 4.0 | [Joel Davis](https://github.com/joeld42) |
|
| 100 | [models_mesh_picking](models/models_mesh_picking.c) | <img src="models/models_mesh_picking.png" alt="models_mesh_picking" width="80"> | ⭐️⭐️⭐️☆ | 1.7 | 4.0 | [Joel Davis](https://github.com/joeld42) |
|
||||||
| 100 | [models_loading](models/models_loading.c) | <img src="models/models_loading.png" alt="models_loading" width="80"> | ⭐️☆☆☆ | 2.0 | 4.2 | [Ray](https://github.com/raysan5) |
|
| 101 | [models_loading](models/models_loading.c) | <img src="models/models_loading.png" alt="models_loading" width="80"> | ⭐️☆☆☆ | 2.0 | 4.2 | [Ray](https://github.com/raysan5) |
|
||||||
| 101 | [models_loading_gltf](models/models_loading_gltf.c) | <img src="models/models_loading_gltf.png" alt="models_loading_gltf" width="80"> | ⭐️☆☆☆ | 3.7 | 4.2 | [Ray](https://github.com/raysan5) |
|
| 102 | [models_loading_gltf](models/models_loading_gltf.c) | <img src="models/models_loading_gltf.png" alt="models_loading_gltf" width="80"> | ⭐️☆☆☆ | 3.7 | 4.2 | [Ray](https://github.com/raysan5) |
|
||||||
| 102 | [models_loading_vox](models/models_loading_vox.c) | <img src="models/models_loading_vox.png" alt="models_loading_vox" width="80"> | ⭐️☆☆☆ | 4.0 | 4.0 | [Johann Nadalutti](https://github.com/procfxgen) |
|
| 103 | [models_loading_vox](models/models_loading_vox.c) | <img src="models/models_loading_vox.png" alt="models_loading_vox" width="80"> | ⭐️☆☆☆ | 4.0 | 4.0 | [Johann Nadalutti](https://github.com/procfxgen) |
|
||||||
| 103 | [models_loading_m3d](models/models_loading_m3d.c) | <img src="models/models_loading_m3d.png" alt="models_loading_m3d" width="80"> | ⭐️⭐️☆☆ | 4.5 | 4.5 | [bzt](https://bztsrc.gitlab.io/model3d) |
|
| 104 | [models_loading_m3d](models/models_loading_m3d.c) | <img src="models/models_loading_m3d.png" alt="models_loading_m3d" width="80"> | ⭐️⭐️☆☆ | 4.5 | 4.5 | [bzt](https://bztsrc.gitlab.io/model3d) |
|
||||||
| 104 | [models_orthographic_projection](models/models_orthographic_projection.c) | <img src="models/models_orthographic_projection.png" alt="models_orthographic_projection" width="80"> | ⭐️☆☆☆ | 2.0 | 3.7 | [Max Danielsson](https://github.com/autious) |
|
| 105 | [models_orthographic_projection](models/models_orthographic_projection.c) | <img src="models/models_orthographic_projection.png" alt="models_orthographic_projection" width="80"> | ⭐️☆☆☆ | 2.0 | 3.7 | [Max Danielsson](https://github.com/autious) |
|
||||||
| 105 | [models_point_rendering](models/models_point_rendering.c) | <img src="models/models_point_rendering.png" alt="models_point_rendering" width="80"> | ⭐️⭐️⭐️☆ | 5.0 | 5.0 | [Reese Gallagher](https://github.com/satchelfrost) |
|
| 106 | [models_point_rendering](models/models_point_rendering.c) | <img src="models/models_point_rendering.png" alt="models_point_rendering" width="80"> | ⭐️⭐️⭐️☆ | 5.0 | 5.0 | [Reese Gallagher](https://github.com/satchelfrost) |
|
||||||
| 106 | [models_rlgl_solar_system](models/models_rlgl_solar_system.c) | <img src="models/models_rlgl_solar_system.png" alt="models_rlgl_solar_system" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | 4.0 | [Ray](https://github.com/raysan5) |
|
| 107 | [models_rlgl_solar_system](models/models_rlgl_solar_system.c) | <img src="models/models_rlgl_solar_system.png" alt="models_rlgl_solar_system" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | 4.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 107 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) | <img src="models/models_yaw_pitch_roll.png" alt="models_yaw_pitch_roll" width="80"> | ⭐️⭐️☆☆ | 1.8 | 4.0 | [Berni](https://github.com/Berni8k) |
|
| 108 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) | <img src="models/models_yaw_pitch_roll.png" alt="models_yaw_pitch_roll" width="80"> | ⭐️⭐️☆☆ | 1.8 | 4.0 | [Berni](https://github.com/Berni8k) |
|
||||||
| 108 | [models_waving_cubes](models/models_waving_cubes.c) | <img src="models/models_waving_cubes.png" alt="models_waving_cubes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Codecat](https://github.com/codecat) |
|
| 109 | [models_waving_cubes](models/models_waving_cubes.c) | <img src="models/models_waving_cubes.png" alt="models_waving_cubes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Codecat](https://github.com/codecat) |
|
||||||
| 109 | [models_heightmap](models/models_heightmap.c) | <img src="models/models_heightmap.png" alt="models_heightmap" width="80"> | ⭐️☆☆☆ | 1.8 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 110 | [models_heightmap](models/models_heightmap.c) | <img src="models/models_heightmap.png" alt="models_heightmap" width="80"> | ⭐️☆☆☆ | 1.8 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 110 | [models_skybox](models/models_skybox.c) | <img src="models/models_skybox.png" alt="models_skybox" width="80"> | ⭐️⭐️☆☆ | 1.8 | 4.0 | [Ray](https://github.com/raysan5) |
|
| 111 | [models_skybox](models/models_skybox.c) | <img src="models/models_skybox.png" alt="models_skybox" width="80"> | ⭐️⭐️☆☆ | 1.8 | 4.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 111 | [models_draw_cube_texture](models/models_draw_cube_texture.c) | <img src="models/models_draw_cube_texture.png" alt="models_draw_cube_texture" width="80"> | ⭐️⭐️☆☆ | 4.5 | 4.5 | [Ray](https://github.com/raysan5) |
|
| 112 | [models_draw_cube_texture](models/models_draw_cube_texture.c) | <img src="models/models_draw_cube_texture.png" alt="models_draw_cube_texture" width="80"> | ⭐️⭐️☆☆ | 4.5 | 4.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 112 | [models_gpu_skinning](models/models_gpu_skinning.c) | <img src="models/models_gpu_skinning.png" alt="models_gpu_skinning" width="80"> | ⭐️⭐️⭐️☆ | 4.5 | 4.5 | [Daniel Holden](https://github.com/orangeduck) |
|
| 113 | [models_gpu_skinning](models/models_gpu_skinning.c) | <img src="models/models_gpu_skinning.png" alt="models_gpu_skinning" width="80"> | ⭐️⭐️⭐️☆ | 4.5 | 4.5 | [Daniel Holden](https://github.com/orangeduck) |
|
||||||
| 113 | [models_bone_socket](models/models_bone_socket.c) | <img src="models/models_bone_socket.png" alt="models_bone_socket" width="80"> | ⭐️⭐️⭐️⭐️ | 4.5 | 4.5 | [iP](https://github.com/ipzaur) |
|
| 114 | [models_bone_socket](models/models_bone_socket.c) | <img src="models/models_bone_socket.png" alt="models_bone_socket" width="80"> | ⭐️⭐️⭐️⭐️ | 4.5 | 4.5 | [iP](https://github.com/ipzaur) |
|
||||||
| 114 | [models_tesseract_view](models/models_tesseract_view.c) | <img src="models/models_tesseract_view.png" alt="models_tesseract_view" width="80"> | ⭐️⭐️☆☆ | 5.6-dev | 5.6-dev | [Timothy van der Valk](https://github.com/arceryz) |
|
| 115 | [models_tesseract_view](models/models_tesseract_view.c) | <img src="models/models_tesseract_view.png" alt="models_tesseract_view" width="80"> | ⭐️⭐️☆☆ | 5.6-dev | 5.6-dev | [Timothy van der Valk](https://github.com/arceryz) |
|
||||||
|
|
||||||
### category: shaders
|
### category: shaders
|
||||||
|
|
||||||
|
|
@ -174,34 +174,34 @@ Examples using raylib shaders functionality, including shaders loading, paramete
|
||||||
|
|
||||||
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| 115 | [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="80"> | ⭐️⭐️⭐️⭐️ | 3.0 | 4.2 | [Chris Camacho](https://github.com/chriscamacho) |
|
| 116 | [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="80"> | ⭐️⭐️⭐️⭐️ | 3.0 | 4.2 | [Chris Camacho](https://github.com/chriscamacho) |
|
||||||
| 116 | [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="80"> | ⭐️⭐️☆☆ | 1.3 | 3.7 | [Ray](https://github.com/raysan5) |
|
| 117 | [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="80"> | ⭐️⭐️☆☆ | 1.3 | 3.7 | [Ray](https://github.com/raysan5) |
|
||||||
| 117 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="80"> | ⭐️⭐️☆☆ | 1.7 | 3.7 | [Ray](https://github.com/raysan5) |
|
| 118 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="80"> | ⭐️⭐️☆☆ | 1.7 | 3.7 | [Ray](https://github.com/raysan5) |
|
||||||
| 118 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) | <img src="shaders/shaders_custom_uniform.png" alt="shaders_custom_uniform" width="80"> | ⭐️⭐️☆☆ | 1.3 | 4.0 | [Ray](https://github.com/raysan5) |
|
| 119 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) | <img src="shaders/shaders_custom_uniform.png" alt="shaders_custom_uniform" width="80"> | ⭐️⭐️☆☆ | 1.3 | 4.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 119 | [shaders_postprocessing](shaders/shaders_postprocessing.c) | <img src="shaders/shaders_postprocessing.png" alt="shaders_postprocessing" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 4.0 | [Ray](https://github.com/raysan5) |
|
| 120 | [shaders_postprocessing](shaders/shaders_postprocessing.c) | <img src="shaders/shaders_postprocessing.png" alt="shaders_postprocessing" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 4.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 120 | [shaders_palette_switch](shaders/shaders_palette_switch.c) | <img src="shaders/shaders_palette_switch.png" alt="shaders_palette_switch" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Marco Lizza](https://github.com/MarcoLizza) |
|
| 121 | [shaders_palette_switch](shaders/shaders_palette_switch.c) | <img src="shaders/shaders_palette_switch.png" alt="shaders_palette_switch" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Marco Lizza](https://github.com/MarcoLizza) |
|
||||||
| 121 | [shaders_raymarching](shaders/shaders_raymarching.c) | <img src="shaders/shaders_raymarching.png" alt="shaders_raymarching" width="80"> | ⭐️⭐️⭐️⭐️ | 2.0 | 4.2 | [Ray](https://github.com/raysan5) |
|
| 122 | [shaders_raymarching](shaders/shaders_raymarching.c) | <img src="shaders/shaders_raymarching.png" alt="shaders_raymarching" width="80"> | ⭐️⭐️⭐️⭐️ | 2.0 | 4.2 | [Ray](https://github.com/raysan5) |
|
||||||
| 122 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) | <img src="shaders/shaders_texture_drawing.png" alt="shaders_texture_drawing" width="80"> | ⭐️⭐️☆☆ | 2.0 | 3.7 | [Michał Ciesielski](https://github.com/ciessielski) |
|
| 123 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) | <img src="shaders/shaders_texture_drawing.png" alt="shaders_texture_drawing" width="80"> | ⭐️⭐️☆☆ | 2.0 | 3.7 | [Michał Ciesielski](https://github.com/ciessielski) |
|
||||||
| 123 | [shaders_texture_outline](shaders/shaders_texture_outline.c) | <img src="shaders/shaders_texture_outline.png" alt="shaders_texture_outline" width="80"> | ⭐️⭐️⭐️☆ | 4.0 | 4.0 | [Samuel Skiff](https://github.com/GoldenThumbs) |
|
| 124 | [shaders_texture_outline](shaders/shaders_texture_outline.c) | <img src="shaders/shaders_texture_outline.png" alt="shaders_texture_outline" width="80"> | ⭐️⭐️⭐️☆ | 4.0 | 4.0 | [Samuel Skiff](https://github.com/GoldenThumbs) |
|
||||||
| 124 | [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Anata](https://github.com/anatagawa) |
|
| 125 | [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Anata](https://github.com/anatagawa) |
|
||||||
| 125 | [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 4.0 | [Josh Colclough](https://github.com/joshcol9232) |
|
| 126 | [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 4.0 | [Josh Colclough](https://github.com/joshcol9232) |
|
||||||
| 126 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) | <img src="shaders/shaders_eratosthenes.png" alt="shaders_eratosthenes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 4.0 | [ProfJski](https://github.com/ProfJski) |
|
| 127 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) | <img src="shaders/shaders_eratosthenes.png" alt="shaders_eratosthenes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 4.0 | [ProfJski](https://github.com/ProfJski) |
|
||||||
| 127 | [shaders_fog](shaders/shaders_fog.c) | <img src="shaders/shaders_fog.png" alt="shaders_fog" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
| 128 | [shaders_fog](shaders/shaders_fog.c) | <img src="shaders/shaders_fog.png" alt="shaders_fog" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
||||||
| 128 | [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
| 129 | [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
||||||
| 129 | [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 130 | [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 130 | [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | 4.2 | [seanpringle](https://github.com/seanpringle) |
|
| 131 | [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | 4.2 | [seanpringle](https://github.com/seanpringle) |
|
||||||
| 131 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 132 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 132 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
| 133 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
||||||
| 133 | [shaders_deferred_render](shaders/shaders_deferred_render.c) | <img src="shaders/shaders_deferred_render.png" alt="shaders_deferred_render" width="80"> | ⭐️⭐️⭐️⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) |
|
| 134 | [shaders_deferred_render](shaders/shaders_deferred_render.c) | <img src="shaders/shaders_deferred_render.png" alt="shaders_deferred_render" width="80"> | ⭐️⭐️⭐️⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) |
|
||||||
| 134 | [shaders_hybrid_render](shaders/shaders_hybrid_render.c) | <img src="shaders/shaders_hybrid_render.png" alt="shaders_hybrid_render" width="80"> | ⭐️⭐️⭐️⭐️ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) |
|
| 135 | [shaders_hybrid_render](shaders/shaders_hybrid_render.c) | <img src="shaders/shaders_hybrid_render.png" alt="shaders_hybrid_render" width="80"> | ⭐️⭐️⭐️⭐️ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) |
|
||||||
| 135 | [shaders_texture_tiling](shaders/shaders_texture_tiling.c) | <img src="shaders/shaders_texture_tiling.png" alt="shaders_texture_tiling" width="80"> | ⭐️⭐️☆☆ | 4.5 | 4.5 | [Luis Almeida](https://github.com/luis605) |
|
| 136 | [shaders_texture_tiling](shaders/shaders_texture_tiling.c) | <img src="shaders/shaders_texture_tiling.png" alt="shaders_texture_tiling" width="80"> | ⭐️⭐️☆☆ | 4.5 | 4.5 | [Luis Almeida](https://github.com/luis605) |
|
||||||
| 136 | [shaders_shadowmap](shaders/shaders_shadowmap.c) | <img src="shaders/shaders_shadowmap.png" alt="shaders_shadowmap" width="80"> | ⭐️⭐️⭐️⭐️ | 5.0 | 5.0 | [TheManTheMythTheGameDev](https://github.com/TheManTheMythTheGameDev) |
|
| 137 | [shaders_shadowmap](shaders/shaders_shadowmap.c) | <img src="shaders/shaders_shadowmap.png" alt="shaders_shadowmap" width="80"> | ⭐️⭐️⭐️⭐️ | 5.0 | 5.0 | [TheManTheMythTheGameDev](https://github.com/TheManTheMythTheGameDev) |
|
||||||
| 137 | [shaders_vertex_displacement](shaders/shaders_vertex_displacement.c) | <img src="shaders/shaders_vertex_displacement.png" alt="shaders_vertex_displacement" width="80"> | ⭐️⭐️⭐️☆ | 5.0 | 4.5 | [Alex ZH](https://github.com/ZzzhHe) |
|
| 138 | [shaders_vertex_displacement](shaders/shaders_vertex_displacement.c) | <img src="shaders/shaders_vertex_displacement.png" alt="shaders_vertex_displacement" width="80"> | ⭐️⭐️⭐️☆ | 5.0 | 4.5 | [Alex ZH](https://github.com/ZzzhHe) |
|
||||||
| 138 | [shaders_write_depth](shaders/shaders_write_depth.c) | <img src="shaders/shaders_write_depth.png" alt="shaders_write_depth" width="80"> | ⭐️⭐️☆☆ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) |
|
| 139 | [shaders_write_depth](shaders/shaders_write_depth.c) | <img src="shaders/shaders_write_depth.png" alt="shaders_write_depth" width="80"> | ⭐️⭐️☆☆ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) |
|
||||||
| 139 | [shaders_basic_pbr](shaders/shaders_basic_pbr.c) | <img src="shaders/shaders_basic_pbr.png" alt="shaders_basic_pbr" width="80"> | ⭐️⭐️⭐️⭐️ | 5.0 | 5.1-dev | [Afan OLOVCIC](https://github.com/_DevDad) |
|
| 140 | [shaders_basic_pbr](shaders/shaders_basic_pbr.c) | <img src="shaders/shaders_basic_pbr.png" alt="shaders_basic_pbr" width="80"> | ⭐️⭐️⭐️⭐️ | 5.0 | 5.1-dev | [Afan OLOVCIC](https://github.com/_DevDad) |
|
||||||
| 140 | [shaders_lightmap](shaders/shaders_lightmap.c) | <img src="shaders/shaders_lightmap.png" alt="shaders_lightmap" width="80"> | ⭐️⭐️⭐️☆ | 4.5 | 4.5 | [Jussi Viitala](https://github.com/nullstare) |
|
| 141 | [shaders_lightmap](shaders/shaders_lightmap.c) | <img src="shaders/shaders_lightmap.png" alt="shaders_lightmap" width="80"> | ⭐️⭐️⭐️☆ | 4.5 | 4.5 | [Jussi Viitala](https://github.com/nullstare) |
|
||||||
| 141 | [shaders_rounded_rectangle](shaders/shaders_rounded_rectangle.c) | <img src="shaders/shaders_rounded_rectangle.png" alt="shaders_rounded_rectangle" width=80> | ⭐️⭐️⭐️☆ | 5.5 | 5.5 | [Anstro Pleuton](https://github.com/anstropleuton) |
|
| 142 | [shaders_rounded_rectangle](shaders/shaders_rounded_rectangle.c) | <img src="shaders/shaders_rounded_rectangle.png" alt="shaders_rounded_rectangle" width=80> | ⭐️⭐️⭐️☆ | 5.5 | 5.5 | [Anstro Pleuton](https://github.com/anstropleuton) |
|
||||||
| 142 | [shaders_view_depth](shaders/shaders_view_depth.c) | <img src="shaders/shaders_view_depth.png" alt="shaders_view_depth" width="80"> | ⭐️⭐️⭐️☆ | 5.6-dev | 5.6-dev | [Luís Almeida](https://github.com/luis605) |
|
| 143 | [shaders_view_depth](shaders/shaders_view_depth.c) | <img src="shaders/shaders_view_depth.png" alt="shaders_view_depth" width="80"> | ⭐️⭐️⭐️☆ | 5.6-dev | 5.6-dev | [Luís Almeida](https://github.com/luis605) |
|
||||||
|
|
||||||
### category: audio
|
### category: audio
|
||||||
|
|
||||||
|
|
@ -209,26 +209,26 @@ Examples using raylib audio functionality, including sound/music loading and pla
|
||||||
|
|
||||||
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| 142 | [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 144 | [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 143 | [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐️☆☆☆ | 1.3 | 4.2 | [Ray](https://github.com/raysan5) |
|
| 145 | [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐️☆☆☆ | 1.3 | 4.2 | [Ray](https://github.com/raysan5) |
|
||||||
| 144 | [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | 4.2 | [Ray](https://github.com/raysan5) |
|
| 146 | [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | 4.2 | [Ray](https://github.com/raysan5) |
|
||||||
| 145 | [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 147 | [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 146 | [audio_mixed_processor](audio/audio_mixed_processor.c) | <img src="audio/audio_mixed_processor.png" alt="audio_mixed_processor" width="80"> | ⭐️⭐️⭐️⭐️ | 4.2 | 4.2 | [hkc](https://github.com/hatkidchan) |
|
| 148 | [audio_mixed_processor](audio/audio_mixed_processor.c) | <img src="audio/audio_mixed_processor.png" alt="audio_mixed_processor" width="80"> | ⭐️⭐️⭐️⭐️ | 4.2 | 4.2 | [hkc](https://github.com/hatkidchan) |
|
||||||
| 147 | [audio_stream_effects](audio/audio_stream_effects.c) | <img src="audio/audio_stream_effects.png" alt="audio_stream_effects" width="80"> | ⭐️⭐️⭐️⭐️ | 4.2 | 5.0 | [Ray](https://github.com/raysan5) |
|
| 149 | [audio_stream_effects](audio/audio_stream_effects.c) | <img src="audio/audio_stream_effects.png" alt="audio_stream_effects" width="80"> | ⭐️⭐️⭐️⭐️ | 4.2 | 5.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 148 | [audio_sound_multi](audio/audio_sound_multi.c) | <img src="audio/audio_sound_multi.png" alt="audio_sound_multi" width="80"> | ⭐️⭐️☆☆ | 4.6 | 4.6 | [Jeffery Myers](https://github.com/JeffM2501) |
|
| 150 [audio_sound_multi](audio/audio_sound_multi.c) | <img src="audio/audio_sound_multi.png" alt="audio_sound_multi" width="80"> | ⭐️⭐️☆☆ | 4.6 | 4.6 | [Jeffery Myers](https://github.com/JeffM2501) |
|
||||||
| 149 | [audio_sound_positioning](audio/audio_sound_positioning.c) | <img src="audio/audio_sound_positioning.png" alt="audio_sound_positioning" width="80"> | ⭐️⭐️☆☆ | 5.5 | 5.5 | [Le Juez Victor](https://github.com/Bigfoot71) |
|
| 151 | [audio_sound_positioning](audio/audio_sound_positioning.c) | <img src="audio/audio_sound_positioning.png" alt="audio_sound_positioning" width="80"> | ⭐️⭐️☆☆ | 5.5 | 5.5 | [Le Juez Victor](https://github.com/Bigfoot71) |
|
||||||
|
|
||||||
### category: others
|
### category: others
|
||||||
|
|
||||||
Examples showing raylib misc functionality that does not fit in other categories, like standalone modules usage or examples integrating external libraries.
|
Ex150amples showing raylib misc functionality that does not fit in other categories, like standalone modules usage or examples integrating external libraries.
|
||||||
|
|
||||||
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| 150 | [rlgl_standalone](others/rlgl_standalone.c) | <img src="others/rlgl_standalone.png" alt="rlgl_standalone" width="80"> | ⭐️⭐️⭐️⭐️ | 1.6 | 4.0 | [Ray](https://github.com/raysan5) |
|
| 152 | [rlgl_standalone](others/rlgl_standalone.c) | <img src="others/rlgl_standalone.png" alt="rlgl_standalone" width="80"> | ⭐️⭐️⭐️⭐️ | 1.6 | 4.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 151 | [rlgl_compute_shader](others/rlgl_compute_shader.c) | <img src="others/rlgl_compute_shader.png" alt="rlgl_compute_shader" width="80"> | ⭐️⭐️⭐️⭐️ | 4.0 | 4.0 | [Teddy Astie](https://github.com/tsnake41) |
|
| 153 | [rlgl_compute_shader](others/rlgl_compute_shader.c) | <img src="others/rlgl_compute_shader.png" alt="rlgl_compute_shader" width="80"> | ⭐️⭐️⭐️⭐️ | 4.0 | 4.0 | [Teddy Astie](https://github.com/tsnake41) |
|
||||||
| 152 | [easings_testbed](others/easings_testbed.c) | <img src="others/easings_testbed.png" alt="easings_testbed" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) |
|
| 154 | [easings_testbed](others/easings_testbed.c) | <img src="others/easings_testbed.png" alt="easings_testbed" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) |
|
||||||
| 153 | [raylib_opengl_interop](others/raylib_opengl_interop.c) | <img src="others/raylib_opengl_interop.png" alt="raylib_opengl_interop" width="80"> | ⭐️⭐️⭐️⭐️ | 3.8 | 4.0 | [Stephan Soller](https://github.com/arkanis) |
|
| 155 | [raylib_opengl_interop](others/raylib_opengl_interop.c) | <img src="others/raylib_opengl_interop.png" alt="raylib_opengl_interop" width="80"> | ⭐️⭐️⭐️⭐️ | 3.8 | 4.0 | [Stephan Soller](https://github.com/arkanis) |
|
||||||
| 154 | [embedded_files_loading](others/embedded_files_loading.c) | <img src="others/embedded_files_loading.png" alt="embedded_files_loading" width="80"> | ⭐️⭐️☆☆ | 3.0 | 3.5 | [Kristian Holmgren](https://github.com/defutura) |
|
| 156 | [embedded_files_loading](others/embedded_files_loading.c) | <img src="others/embedded_files_loading.png" alt="embedded_files_loading" width="80"> | ⭐️⭐️☆☆ | 3.0 | 3.5 | [Kristian Holmgren](https://github.com/defutura) |
|
||||||
| 155 | [raymath_vector_angle](others/raymath_vector_angle.c) | <img src="others/raymath_vector_angle.png" alt="raymath_vector_angle" width="80"> | ⭐️⭐️☆☆ | 1.0 | 4.6 | [Ray](https://github.com/raysan5) |
|
| 157 | [raymath_vector_angle](others/raymath_vector_angle.c) | <img src="others/raymath_vector_angle.png" alt="raymath_vector_angle" width="80"> | ⭐️⭐️☆☆ | 1.0 | 4.6 | [Ray](https://github.com/raysan5) |
|
||||||
|
|
||||||
As always contributions are welcome, feel free to send new examples! Here is an [examples template](examples_template.c) to start with!
|
As always contributions are welcome, feel free to send new examples! Here is an [examples template](examples_template.c) to start with!
|
||||||
|
|
|
||||||
185
examples/shapes/shapes_digital_clock.c
Normal file
185
examples/shapes/shapes_digital_clock.c
Normal file
|
|
@ -0,0 +1,185 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [shapes] example - fancy clock using basic shapes
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.5
|
||||||
|
*
|
||||||
|
* Example contributed by Hamza RAHAL (@hmz-rhl) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Hamza RAHAL (@hmz-rhl)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include <math.h> // Required for: cosf(), sinf()
|
||||||
|
#include <time.h> // Required for: time(), localtime()
|
||||||
|
|
||||||
|
#define DIGIT_SIZE 30
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
typedef enum {
|
||||||
|
MODE_NORMAL = 0,
|
||||||
|
MODE_HANDS_FREE,
|
||||||
|
} ClockMode;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int value;
|
||||||
|
Vector2 origin;
|
||||||
|
float angle;
|
||||||
|
int length;
|
||||||
|
int thickness;
|
||||||
|
Color color;
|
||||||
|
} ClockHand;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ClockMode mode;
|
||||||
|
ClockHand second;
|
||||||
|
ClockHand minute;
|
||||||
|
ClockHand hour;
|
||||||
|
} Clock;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
static void UpdateClock(Clock *clock); // Update clock time
|
||||||
|
static void DrawClock(Clock clock, Vector2 centerPos); // Draw clock at desired position
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - digital clock");
|
||||||
|
|
||||||
|
// Initialize clock
|
||||||
|
Clock myClock = {
|
||||||
|
.mode = MODE_NORMAL,
|
||||||
|
|
||||||
|
.second.angle = 45,
|
||||||
|
.second.length = 140,
|
||||||
|
.second.thickness = 3,
|
||||||
|
.second.color = BEIGE,
|
||||||
|
|
||||||
|
.minute.angle = 10,
|
||||||
|
.minute.length = 130,
|
||||||
|
.minute.thickness = 7,
|
||||||
|
.minute.color = DARKGRAY,
|
||||||
|
|
||||||
|
.hour.angle = 0,
|
||||||
|
.hour.length = 100,
|
||||||
|
.hour.thickness = 7,
|
||||||
|
.hour.color = BLACK,
|
||||||
|
};
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsKeyPressed(KEY_SPACE))
|
||||||
|
{
|
||||||
|
if (myClock.mode == MODE_HANDS_FREE) myClock.mode = MODE_NORMAL;
|
||||||
|
else if (myClock.mode == MODE_NORMAL) myClock.mode = MODE_HANDS_FREE;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateClock(&myClock);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawCircle(400, 225, 5, BLACK); // Clock center dot
|
||||||
|
|
||||||
|
DrawClock(myClock, (Vector2){ 400, 225 }); // Clock in selected mode
|
||||||
|
|
||||||
|
DrawText("Press [SPACE] to switch clock mode", 10, 10, 20, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Update clock time
|
||||||
|
static void UpdateClock(Clock *clock)
|
||||||
|
{
|
||||||
|
time_t rawtime;
|
||||||
|
struct tm * timeinfo;
|
||||||
|
|
||||||
|
time(&rawtime);
|
||||||
|
timeinfo = localtime(&rawtime);
|
||||||
|
|
||||||
|
// Updating time data
|
||||||
|
clock->second.value = timeinfo->tm_sec;
|
||||||
|
clock->minute.value = timeinfo->tm_min;
|
||||||
|
clock->hour.value = timeinfo->tm_hour;
|
||||||
|
|
||||||
|
clock->hour.angle = (timeinfo->tm_hour%12)*180.0/6.0f;
|
||||||
|
clock->hour.angle += (timeinfo->tm_min%60)*30/60.0f;
|
||||||
|
clock->hour.angle -= 90;
|
||||||
|
|
||||||
|
clock->minute.angle = (timeinfo->tm_min%60)*6.0f;
|
||||||
|
clock->minute.angle += (timeinfo->tm_sec%60)*6/60.0f;
|
||||||
|
clock->minute.angle -= 90;
|
||||||
|
|
||||||
|
clock->second.angle = (timeinfo->tm_sec%60)*6.0f;
|
||||||
|
clock->second.angle -= 90;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw clock
|
||||||
|
static void DrawClock(Clock clock, Vector2 centerPosition)
|
||||||
|
{
|
||||||
|
if (clock.mode == MODE_HANDS_FREE)
|
||||||
|
{
|
||||||
|
DrawCircleLinesV(centerPosition, clock.minute.length, LIGHTGRAY);
|
||||||
|
|
||||||
|
DrawText(TextFormat("%i", clock.second.value), centerPosition.x + (clock.second.length - 10)*cosf(clock.second.angle*(float)(PI/180)) - DIGIT_SIZE/2, centerPosition.y + clock.second.length*sinf(clock.second.angle*(float)(PI/180)) - DIGIT_SIZE/2, DIGIT_SIZE, GRAY);
|
||||||
|
|
||||||
|
DrawText(TextFormat("%i", clock.minute.value), clock.minute.origin.x + clock.minute.length*cosf(clock.minute.angle*(float)(PI/180)) - DIGIT_SIZE/2, centerPosition.y + clock.minute.length*sinf(clock.minute.angle*(float)(PI/180)) - DIGIT_SIZE/2, DIGIT_SIZE, RED);
|
||||||
|
|
||||||
|
DrawText(TextFormat("%i", clock.hour.value), centerPosition.x + clock.hour.length*cosf(clock.hour.angle*(float)(PI/180)) - DIGIT_SIZE/2, centerPosition.y + clock.hour.length*sinf(clock.hour.angle*(float)(PI/180)) - DIGIT_SIZE/2, DIGIT_SIZE, GOLD);
|
||||||
|
}
|
||||||
|
else if (clock.mode == MODE_NORMAL)
|
||||||
|
{
|
||||||
|
// Draw hand seconds
|
||||||
|
DrawRectanglePro((Rectangle){ centerPosition.x, centerPosition.y, clock.second.length, clock.second.thickness },
|
||||||
|
(Vector2){ 0.0f, clock.second.thickness/2.0f }, clock.second.angle, clock.second.color);
|
||||||
|
|
||||||
|
// Draw hand minutes
|
||||||
|
DrawRectanglePro((Rectangle){ centerPosition.x, centerPosition.y, clock.minute.length, clock.minute.thickness },
|
||||||
|
(Vector2){ 0.0f, clock.minute.thickness/2.0f }, clock.minute.angle, clock.minute.color);
|
||||||
|
|
||||||
|
// Draw hand hours
|
||||||
|
DrawRectanglePro((Rectangle){ centerPosition.x, centerPosition.y, clock.hour.length, clock.hour.thickness },
|
||||||
|
(Vector2){ 0.0f, clock.hour.thickness/2.0f }, clock.hour.angle, clock.hour.color);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
examples/shapes/shapes_digital_clock.png
Normal file
BIN
examples/shapes/shapes_digital_clock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
|
|
@ -6010,11 +6010,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Color",
|
"type": "Color",
|
||||||
"name": "topRight"
|
"name": "bottomRight"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Color",
|
"type": "Color",
|
||||||
"name": "bottomRight"
|
"name": "topRight"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -8302,7 +8302,7 @@
|
||||||
"name": "dst"
|
"name": "dst"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Vector2 *",
|
"type": "const Vector2 *",
|
||||||
"name": "points"
|
"name": "points"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -8325,7 +8325,7 @@
|
||||||
"name": "dst"
|
"name": "dst"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Vector2 *",
|
"type": "const Vector2 *",
|
||||||
"name": "points"
|
"name": "points"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4976,8 +4976,8 @@ return {
|
||||||
{type = "Rectangle", name = "rec"},
|
{type = "Rectangle", name = "rec"},
|
||||||
{type = "Color", name = "topLeft"},
|
{type = "Color", name = "topLeft"},
|
||||||
{type = "Color", name = "bottomLeft"},
|
{type = "Color", name = "bottomLeft"},
|
||||||
{type = "Color", name = "topRight"},
|
{type = "Color", name = "bottomRight"},
|
||||||
{type = "Color", name = "bottomRight"}
|
{type = "Color", name = "topRight"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -6141,7 +6141,7 @@ return {
|
||||||
returnType = "void",
|
returnType = "void",
|
||||||
params = {
|
params = {
|
||||||
{type = "Image *", name = "dst"},
|
{type = "Image *", name = "dst"},
|
||||||
{type = "Vector2 *", name = "points"},
|
{type = "const Vector2 *", name = "points"},
|
||||||
{type = "int", name = "pointCount"},
|
{type = "int", name = "pointCount"},
|
||||||
{type = "Color", name = "color"}
|
{type = "Color", name = "color"}
|
||||||
}
|
}
|
||||||
|
|
@ -6152,7 +6152,7 @@ return {
|
||||||
returnType = "void",
|
returnType = "void",
|
||||||
params = {
|
params = {
|
||||||
{type = "Image *", name = "dst"},
|
{type = "Image *", name = "dst"},
|
||||||
{type = "Vector2 *", name = "points"},
|
{type = "const Vector2 *", name = "points"},
|
||||||
{type = "int", name = "pointCount"},
|
{type = "int", name = "pointCount"},
|
||||||
{type = "Color", name = "color"}
|
{type = "Color", name = "color"}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2356,8 +2356,8 @@ Function 239: DrawRectangleGradientEx() (5 input parameters)
|
||||||
Param[1]: rec (type: Rectangle)
|
Param[1]: rec (type: Rectangle)
|
||||||
Param[2]: topLeft (type: Color)
|
Param[2]: topLeft (type: Color)
|
||||||
Param[3]: bottomLeft (type: Color)
|
Param[3]: bottomLeft (type: Color)
|
||||||
Param[4]: topRight (type: Color)
|
Param[4]: bottomRight (type: Color)
|
||||||
Param[5]: bottomRight (type: Color)
|
Param[5]: topRight (type: Color)
|
||||||
Function 240: DrawRectangleLines() (5 input parameters)
|
Function 240: DrawRectangleLines() (5 input parameters)
|
||||||
Name: DrawRectangleLines
|
Name: DrawRectangleLines
|
||||||
Return type: void
|
Return type: void
|
||||||
|
|
@ -3185,7 +3185,7 @@ Function 352: ImageDrawTriangleFan() (4 input parameters)
|
||||||
Return type: void
|
Return type: void
|
||||||
Description: Draw a triangle fan defined by points within an image (first vertex is the center)
|
Description: Draw a triangle fan defined by points within an image (first vertex is the center)
|
||||||
Param[1]: dst (type: Image *)
|
Param[1]: dst (type: Image *)
|
||||||
Param[2]: points (type: Vector2 *)
|
Param[2]: points (type: const Vector2 *)
|
||||||
Param[3]: pointCount (type: int)
|
Param[3]: pointCount (type: int)
|
||||||
Param[4]: color (type: Color)
|
Param[4]: color (type: Color)
|
||||||
Function 353: ImageDrawTriangleStrip() (4 input parameters)
|
Function 353: ImageDrawTriangleStrip() (4 input parameters)
|
||||||
|
|
@ -3193,7 +3193,7 @@ Function 353: ImageDrawTriangleStrip() (4 input parameters)
|
||||||
Return type: void
|
Return type: void
|
||||||
Description: Draw a triangle strip defined by points within an image
|
Description: Draw a triangle strip defined by points within an image
|
||||||
Param[1]: dst (type: Image *)
|
Param[1]: dst (type: Image *)
|
||||||
Param[2]: points (type: Vector2 *)
|
Param[2]: points (type: const Vector2 *)
|
||||||
Param[3]: pointCount (type: int)
|
Param[3]: pointCount (type: int)
|
||||||
Param[4]: color (type: Color)
|
Param[4]: color (type: Color)
|
||||||
Function 354: ImageDraw() (5 input parameters)
|
Function 354: ImageDraw() (5 input parameters)
|
||||||
|
|
|
||||||
|
|
@ -1488,8 +1488,8 @@
|
||||||
<Param type="Rectangle" name="rec" desc="" />
|
<Param type="Rectangle" name="rec" desc="" />
|
||||||
<Param type="Color" name="topLeft" desc="" />
|
<Param type="Color" name="topLeft" desc="" />
|
||||||
<Param type="Color" name="bottomLeft" desc="" />
|
<Param type="Color" name="bottomLeft" desc="" />
|
||||||
<Param type="Color" name="topRight" desc="" />
|
|
||||||
<Param type="Color" name="bottomRight" desc="" />
|
<Param type="Color" name="bottomRight" desc="" />
|
||||||
|
<Param type="Color" name="topRight" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="DrawRectangleLines" retType="void" paramCount="5" desc="Draw rectangle outline">
|
<Function name="DrawRectangleLines" retType="void" paramCount="5" desc="Draw rectangle outline">
|
||||||
<Param type="int" name="posX" desc="" />
|
<Param type="int" name="posX" desc="" />
|
||||||
|
|
@ -2090,13 +2090,13 @@
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="ImageDrawTriangleFan" retType="void" paramCount="4" desc="Draw a triangle fan defined by points within an image (first vertex is the center)">
|
<Function name="ImageDrawTriangleFan" retType="void" paramCount="4" desc="Draw a triangle fan defined by points within an image (first vertex is the center)">
|
||||||
<Param type="Image *" name="dst" desc="" />
|
<Param type="Image *" name="dst" desc="" />
|
||||||
<Param type="Vector2 *" name="points" desc="" />
|
<Param type="const Vector2 *" name="points" desc="" />
|
||||||
<Param type="int" name="pointCount" desc="" />
|
<Param type="int" name="pointCount" desc="" />
|
||||||
<Param type="Color" name="color" desc="" />
|
<Param type="Color" name="color" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="ImageDrawTriangleStrip" retType="void" paramCount="4" desc="Draw a triangle strip defined by points within an image">
|
<Function name="ImageDrawTriangleStrip" retType="void" paramCount="4" desc="Draw a triangle strip defined by points within an image">
|
||||||
<Param type="Image *" name="dst" desc="" />
|
<Param type="Image *" name="dst" desc="" />
|
||||||
<Param type="Vector2 *" name="points" desc="" />
|
<Param type="const Vector2 *" name="points" desc="" />
|
||||||
<Param type="int" name="pointCount" desc="" />
|
<Param type="int" name="pointCount" desc="" />
|
||||||
<Param type="Color" name="color" desc="" />
|
<Param type="Color" name="color" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
|
|
||||||
|
|
@ -440,8 +440,8 @@ RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color c
|
||||||
RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
|
RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
|
||||||
RLAPI void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
|
RLAPI void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
|
||||||
RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
|
RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
|
||||||
RLAPI void ImageDrawTriangleFan(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
|
RLAPI void ImageDrawTriangleFan(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
|
||||||
RLAPI void ImageDrawTriangleStrip(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
|
RLAPI void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
|
||||||
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
|
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
|
||||||
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
|
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
|
||||||
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
|
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
|
||||||
|
|
|
||||||
1661
src/external/miniaudio.h
vendored
1661
src/external/miniaudio.h
vendored
File diff suppressed because it is too large
Load Diff
|
|
@ -130,9 +130,9 @@ static void CursorEnterCallback(GLFWwindow *window, int enter);
|
||||||
static void JoystickCallback(int jid, int event); // GLFW3 Joystick Connected/Disconnected Callback
|
static void JoystickCallback(int jid, int event); // GLFW3 Joystick Connected/Disconnected Callback
|
||||||
|
|
||||||
// Wrappers used by glfwInitAllocator
|
// Wrappers used by glfwInitAllocator
|
||||||
static void* AllocateWrapper(size_t size, void* user); // GLFW3 GLFWallocatefun, wrapps around RL_MALLOC macro
|
static void *AllocateWrapper(size_t size, void *user); // GLFW3 GLFWallocatefun, wrapps around RL_MALLOC macro
|
||||||
static void* ReallocateWrapper(void* block, size_t size, void* user); // GLFW3 GLFWreallocatefun, wrapps around RL_MALLOC macro
|
static void *ReallocateWrapper(void *block, size_t size, void *user); // GLFW3 GLFWreallocatefun, wrapps around RL_MALLOC macro
|
||||||
static void DeallocateWrapper(void* block, void* user); // GLFW3 GLFWdeallocatefun, wraps around RL_FREE macro
|
static void DeallocateWrapper(void *block, void *user); // GLFW3 GLFWdeallocatefun, wraps around RL_FREE macro
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
|
|
@ -576,7 +576,7 @@ void SetWindowIcons(Image *images, int count)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int valid = 0;
|
int valid = 0;
|
||||||
GLFWimage *icons = RL_CALLOC(count, sizeof(GLFWimage));
|
GLFWimage *icons = (GLFWimage *)RL_CALLOC(count, sizeof(GLFWimage));
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -1300,17 +1300,17 @@ static void SetDimensionsFromMonitor(GLFWmonitor *monitor)
|
||||||
// We need to provide these because GLFWallocator expects function pointers with specific signatures.
|
// We need to provide these because GLFWallocator expects function pointers with specific signatures.
|
||||||
// Similar wrappers exist in utils.c but we cannot reuse them here due to declaration mismatch.
|
// Similar wrappers exist in utils.c but we cannot reuse them here due to declaration mismatch.
|
||||||
// https://www.glfw.org/docs/latest/intro_guide.html#init_allocator
|
// https://www.glfw.org/docs/latest/intro_guide.html#init_allocator
|
||||||
static void* AllocateWrapper(size_t size, void* user)
|
static void *AllocateWrapper(size_t size, void *user)
|
||||||
{
|
{
|
||||||
(void)user;
|
(void)user;
|
||||||
return RL_MALLOC(size);
|
return RL_MALLOC(size);
|
||||||
}
|
}
|
||||||
static void* ReallocateWrapper(void* block, size_t size, void* user)
|
static void *ReallocateWrapper(void *block, size_t size, void *user)
|
||||||
{
|
{
|
||||||
(void)user;
|
(void)user;
|
||||||
return RL_REALLOC(block, size);
|
return RL_REALLOC(block, size);
|
||||||
}
|
}
|
||||||
static void DeallocateWrapper(void* block, void* user)
|
static void DeallocateWrapper(void *block, void *user)
|
||||||
{
|
{
|
||||||
(void)user;
|
(void)user;
|
||||||
RL_FREE(block);
|
RL_FREE(block);
|
||||||
|
|
@ -1327,6 +1327,7 @@ int InitPlatform(void)
|
||||||
.reallocate = ReallocateWrapper,
|
.reallocate = ReallocateWrapper,
|
||||||
.user = NULL, // RL_*ALLOC macros are not capable of handling user-provided data
|
.user = NULL, // RL_*ALLOC macros are not capable of handling user-provided data
|
||||||
};
|
};
|
||||||
|
|
||||||
glfwInitAllocator(&allocator);
|
glfwInitAllocator(&allocator);
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
|
@ -1696,6 +1697,8 @@ int InitPlatform(void)
|
||||||
// Retrieve gamepad names
|
// Retrieve gamepad names
|
||||||
for (int i = 0; i < MAX_GAMEPADS; i++)
|
for (int i = 0; i < MAX_GAMEPADS; i++)
|
||||||
{
|
{
|
||||||
|
// WARNING: If glfwGetJoystickName() is longer than MAX_GAMEPAD_NAME_LENGTH,
|
||||||
|
// we can get a not-NULL terminated string, so, we only copy up to (MAX_GAMEPAD_NAME_LENGTH - 1)
|
||||||
if (glfwJoystickPresent(i)) strncpy(CORE.Input.Gamepad.name[i], glfwGetJoystickName(i), MAX_GAMEPAD_NAME_LENGTH - 1);
|
if (glfwJoystickPresent(i)) strncpy(CORE.Input.Gamepad.name[i], glfwGetJoystickName(i), MAX_GAMEPAD_NAME_LENGTH - 1);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
@ -1973,6 +1976,9 @@ static void JoystickCallback(int jid, int event)
|
||||||
{
|
{
|
||||||
if (event == GLFW_CONNECTED)
|
if (event == GLFW_CONNECTED)
|
||||||
{
|
{
|
||||||
|
// WARNING: If glfwGetJoystickName() is longer than MAX_GAMEPAD_NAME_LENGTH,
|
||||||
|
// we can get a not-NULL terminated string, so, we clean destination and only copy up to -1
|
||||||
|
memset(CORE.Input.Gamepad.name[jid], 0, MAX_GAMEPAD_NAME_LENGTH);
|
||||||
strncpy(CORE.Input.Gamepad.name[jid], glfwGetJoystickName(jid), MAX_GAMEPAD_NAME_LENGTH - 1);
|
strncpy(CORE.Input.Gamepad.name[jid], glfwGetJoystickName(jid), MAX_GAMEPAD_NAME_LENGTH - 1);
|
||||||
}
|
}
|
||||||
else if (event == GLFW_DISCONNECTED)
|
else if (event == GLFW_DISCONNECTED)
|
||||||
|
|
|
||||||
|
|
@ -989,7 +989,7 @@ void PollInputEvents(void)
|
||||||
|
|
||||||
if ((CORE.Window.eventWaiting) || (IsWindowState(FLAG_WINDOW_MINIMIZED) && !IsWindowState(FLAG_WINDOW_ALWAYS_RUN)))
|
if ((CORE.Window.eventWaiting) || (IsWindowState(FLAG_WINDOW_MINIMIZED) && !IsWindowState(FLAG_WINDOW_ALWAYS_RUN)))
|
||||||
{
|
{
|
||||||
RGFW_window_eventWait(platform.window, 0); // Wait for input events: keyboard/mouse/window events (callbacks) -> Update keys state
|
RGFW_window_eventWait(platform.window, -1); // Wait for input events: keyboard/mouse/window events (callbacks) -> Update keys state
|
||||||
CORE.Time.previous = GetTime();
|
CORE.Time.previous = GetTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1697,8 +1697,8 @@ void PollInputEvents(void)
|
||||||
CORE.Input.Gamepad.axisCount[jid] = SDL_JoystickNumAxes(SDL_GameControllerGetJoystick(platform.gamepad[jid]));
|
CORE.Input.Gamepad.axisCount[jid] = SDL_JoystickNumAxes(SDL_GameControllerGetJoystick(platform.gamepad[jid]));
|
||||||
CORE.Input.Gamepad.axisState[jid][GAMEPAD_AXIS_LEFT_TRIGGER] = -1.0f;
|
CORE.Input.Gamepad.axisState[jid][GAMEPAD_AXIS_LEFT_TRIGGER] = -1.0f;
|
||||||
CORE.Input.Gamepad.axisState[jid][GAMEPAD_AXIS_RIGHT_TRIGGER] = -1.0f;
|
CORE.Input.Gamepad.axisState[jid][GAMEPAD_AXIS_RIGHT_TRIGGER] = -1.0f;
|
||||||
|
memset(CORE.Input.Gamepad.name[jid], 0, MAX_GAMEPAD_NAME_LENGTH);
|
||||||
strncpy(CORE.Input.Gamepad.name[jid], SDL_GameControllerNameForIndex(jid), MAX_GAMEPAD_NAME_LENGTH - 1);
|
strncpy(CORE.Input.Gamepad.name[jid], SDL_GameControllerNameForIndex(jid), MAX_GAMEPAD_NAME_LENGTH - 1);
|
||||||
CORE.Input.Gamepad.name[jid][MAX_GAMEPAD_NAME_LENGTH - 1] = '\0';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -948,7 +948,7 @@ int InitPlatform(void)
|
||||||
|
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: EGL configs available: %d", numConfigs);
|
TRACELOG(LOG_TRACE, "DISPLAY: EGL configs available: %d", numConfigs);
|
||||||
|
|
||||||
EGLConfig *configs = RL_CALLOC(numConfigs, sizeof(*configs));
|
EGLConfig *configs = (EGLConfig *)RL_CALLOC(numConfigs, sizeof(*configs));
|
||||||
if (!configs)
|
if (!configs)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get memory for EGL configs");
|
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get memory for EGL configs");
|
||||||
|
|
@ -1374,7 +1374,7 @@ static void InitEvdevInput(void)
|
||||||
if ((strncmp("event", entity->d_name, strlen("event")) == 0) || // Search for devices named "event*"
|
if ((strncmp("event", entity->d_name, strlen("event")) == 0) || // Search for devices named "event*"
|
||||||
(strncmp("mouse", entity->d_name, strlen("mouse")) == 0)) // Search for devices named "mouse*"
|
(strncmp("mouse", entity->d_name, strlen("mouse")) == 0)) // Search for devices named "mouse*"
|
||||||
{
|
{
|
||||||
sprintf(path, "%s%s", DEFAULT_EVDEV_PATH, entity->d_name);
|
snprintf(path, MAX_FILEPATH_LENGTH, "%s%s", DEFAULT_EVDEV_PATH, entity->d_name);
|
||||||
ConfigureEvdevDevice(path); // Configure the device if appropriate
|
ConfigureEvdevDevice(path); // Configure the device if appropriate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1746,7 +1746,7 @@ static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadE
|
||||||
if (gamepadEvent->connected && (gamepadEvent->index < MAX_GAMEPADS))
|
if (gamepadEvent->connected && (gamepadEvent->index < MAX_GAMEPADS))
|
||||||
{
|
{
|
||||||
CORE.Input.Gamepad.ready[gamepadEvent->index] = true;
|
CORE.Input.Gamepad.ready[gamepadEvent->index] = true;
|
||||||
sprintf(CORE.Input.Gamepad.name[gamepadEvent->index], "%s", gamepadEvent->id);
|
snprintf(CORE.Input.Gamepad.name[gamepadEvent->index], MAX_GAMEPAD_NAME_LENGTH, "%s", gamepadEvent->id);
|
||||||
}
|
}
|
||||||
else CORE.Input.Gamepad.ready[gamepadEvent->index] = false;
|
else CORE.Input.Gamepad.ready[gamepadEvent->index] = false;
|
||||||
|
|
||||||
|
|
|
||||||
10
src/raudio.c
10
src/raudio.c
|
|
@ -1337,7 +1337,7 @@ Music LoadMusicStream(const char *fileName)
|
||||||
#if defined(SUPPORT_FILEFORMAT_WAV)
|
#if defined(SUPPORT_FILEFORMAT_WAV)
|
||||||
else if (IsFileExtension(fileName, ".wav"))
|
else if (IsFileExtension(fileName, ".wav"))
|
||||||
{
|
{
|
||||||
drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
|
drwav *ctxWav = (drwav *)RL_CALLOC(1, sizeof(drwav));
|
||||||
bool success = drwav_init_file(ctxWav, fileName, NULL);
|
bool success = drwav_init_file(ctxWav, fileName, NULL);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
|
|
@ -1387,7 +1387,7 @@ Music LoadMusicStream(const char *fileName)
|
||||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||||
else if (IsFileExtension(fileName, ".mp3"))
|
else if (IsFileExtension(fileName, ".mp3"))
|
||||||
{
|
{
|
||||||
drmp3 *ctxMp3 = RL_CALLOC(1, sizeof(drmp3));
|
drmp3 *ctxMp3 = (drmp3 *)RL_CALLOC(1, sizeof(drmp3));
|
||||||
int result = drmp3_init_file(ctxMp3, fileName, NULL);
|
int result = drmp3_init_file(ctxMp3, fileName, NULL);
|
||||||
|
|
||||||
if (result > 0)
|
if (result > 0)
|
||||||
|
|
@ -1478,7 +1478,7 @@ Music LoadMusicStream(const char *fileName)
|
||||||
#if defined(SUPPORT_FILEFORMAT_MOD)
|
#if defined(SUPPORT_FILEFORMAT_MOD)
|
||||||
else if (IsFileExtension(fileName, ".mod"))
|
else if (IsFileExtension(fileName, ".mod"))
|
||||||
{
|
{
|
||||||
jar_mod_context_t *ctxMod = RL_CALLOC(1, sizeof(jar_mod_context_t));
|
jar_mod_context_t *ctxMod = (jar_mod_context_t *)RL_CALLOC(1, sizeof(jar_mod_context_t));
|
||||||
jar_mod_init(ctxMod);
|
jar_mod_init(ctxMod);
|
||||||
int result = jar_mod_load_file(ctxMod, fileName);
|
int result = jar_mod_load_file(ctxMod, fileName);
|
||||||
|
|
||||||
|
|
@ -1529,7 +1529,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
||||||
#if defined(SUPPORT_FILEFORMAT_WAV)
|
#if defined(SUPPORT_FILEFORMAT_WAV)
|
||||||
else if ((strcmp(fileType, ".wav") == 0) || (strcmp(fileType, ".WAV") == 0))
|
else if ((strcmp(fileType, ".wav") == 0) || (strcmp(fileType, ".WAV") == 0))
|
||||||
{
|
{
|
||||||
drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
|
drwav *ctxWav = (drwav *)RL_CALLOC(1, sizeof(drwav));
|
||||||
|
|
||||||
bool success = drwav_init_memory(ctxWav, (const void *)data, dataSize, NULL);
|
bool success = drwav_init_memory(ctxWav, (const void *)data, dataSize, NULL);
|
||||||
|
|
||||||
|
|
@ -1580,7 +1580,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
||||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||||
else if ((strcmp(fileType, ".mp3") == 0) || (strcmp(fileType, ".MP3") == 0))
|
else if ((strcmp(fileType, ".mp3") == 0) || (strcmp(fileType, ".MP3") == 0))
|
||||||
{
|
{
|
||||||
drmp3 *ctxMp3 = RL_CALLOC(1, sizeof(drmp3));
|
drmp3 *ctxMp3 = (drmp3 *)RL_CALLOC(1, sizeof(drmp3));
|
||||||
int success = drmp3_init_memory(ctxMp3, (const void*)data, dataSize, NULL);
|
int success = drmp3_init_memory(ctxMp3, (const void*)data, dataSize, NULL);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
|
|
|
||||||
|
|
@ -1275,7 +1275,7 @@ RLAPI void DrawRectangleRec(Rectangle rec, Color color);
|
||||||
RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
|
RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
|
||||||
RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); // Draw a vertical-gradient-filled rectangle
|
RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); // Draw a vertical-gradient-filled rectangle
|
||||||
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); // Draw a horizontal-gradient-filled rectangle
|
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); // Draw a horizontal-gradient-filled rectangle
|
||||||
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color topRight, Color bottomRight); // Draw a gradient-filled rectangle with custom vertex colors
|
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color bottomRight, Color topRight); // Draw a gradient-filled rectangle with custom vertex colors
|
||||||
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
|
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
|
||||||
RLAPI void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters
|
RLAPI void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters
|
||||||
RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
|
RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
|
||||||
|
|
@ -1408,8 +1408,8 @@ RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color c
|
||||||
RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
|
RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
|
||||||
RLAPI void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
|
RLAPI void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
|
||||||
RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
|
RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
|
||||||
RLAPI void ImageDrawTriangleFan(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
|
RLAPI void ImageDrawTriangleFan(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
|
||||||
RLAPI void ImageDrawTriangleStrip(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
|
RLAPI void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
|
||||||
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
|
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
|
||||||
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
|
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
|
||||||
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
|
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
|
||||||
|
|
|
||||||
|
|
@ -2500,7 +2500,7 @@ unsigned char *CompressData(const unsigned char *data, int dataSize, int *compDa
|
||||||
|
|
||||||
#if defined(SUPPORT_COMPRESSION_API)
|
#if defined(SUPPORT_COMPRESSION_API)
|
||||||
// Compress data and generate a valid DEFLATE stream
|
// Compress data and generate a valid DEFLATE stream
|
||||||
struct sdefl *sdefl = RL_CALLOC(1, sizeof(struct sdefl)); // WARNING: Possible stack overflow, struct sdefl is almost 1MB
|
struct sdefl *sdefl = (struct sdefl *)RL_CALLOC(1, sizeof(struct sdefl)); // WARNING: Possible stack overflow, struct sdefl is almost 1MB
|
||||||
int bounds = sdefl_bound(dataSize);
|
int bounds = sdefl_bound(dataSize);
|
||||||
compData = (unsigned char *)RL_CALLOC(bounds, 1);
|
compData = (unsigned char *)RL_CALLOC(bounds, 1);
|
||||||
|
|
||||||
|
|
@ -2747,7 +2747,7 @@ unsigned int *ComputeMD5(unsigned char *data, int dataSize)
|
||||||
|
|
||||||
int newDataSize = ((((dataSize + 8)/64) + 1)*64) - 8;
|
int newDataSize = ((((dataSize + 8)/64) + 1)*64) - 8;
|
||||||
|
|
||||||
unsigned char *msg = RL_CALLOC(newDataSize + 64, 1); // Initialize with '0' bits, allocating 64 extra bytes
|
unsigned char *msg = (unsigned char *)RL_CALLOC(newDataSize + 64, 1); // Initialize with '0' bits, allocating 64 extra bytes
|
||||||
memcpy(msg, data, dataSize);
|
memcpy(msg, data, dataSize);
|
||||||
msg[dataSize] = 128; // Write the '1' bit
|
msg[dataSize] = 128; // Write the '1' bit
|
||||||
|
|
||||||
|
|
@ -2837,7 +2837,7 @@ unsigned int *ComputeSHA1(unsigned char *data, int dataSize)
|
||||||
|
|
||||||
int newDataSize = ((((dataSize + 8)/64) + 1)*64);
|
int newDataSize = ((((dataSize + 8)/64) + 1)*64);
|
||||||
|
|
||||||
unsigned char *msg = RL_CALLOC(newDataSize, 1); // Initialize with '0' bits
|
unsigned char *msg = (unsigned char *)RL_CALLOC(newDataSize, 1); // Initialize with '0' bits
|
||||||
memcpy(msg, data, dataSize);
|
memcpy(msg, data, dataSize);
|
||||||
msg[dataSize] = 128; // Write the '1' bit
|
msg[dataSize] = 128; // Write the '1' bit
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2425,7 +2425,7 @@ void rlLoadExtensions(void *loader)
|
||||||
|
|
||||||
// Get supported extensions list
|
// Get supported extensions list
|
||||||
GLint numExt = 0;
|
GLint numExt = 0;
|
||||||
const char **extList = RL_MALLOC(512*sizeof(const char *)); // Allocate 512 strings pointers (2 KB)
|
const char **extList = (char **)RL_MALLOC(512*sizeof(const char *)); // Allocate 512 strings pointers (2 KB)
|
||||||
const char *extensions = (const char *)glGetString(GL_EXTENSIONS); // One big const string
|
const char *extensions = (const char *)glGetString(GL_EXTENSIONS); // One big const string
|
||||||
|
|
||||||
// NOTE: We have to duplicate string because glGetString() returns a const string
|
// NOTE: We have to duplicate string because glGetString() returns a const string
|
||||||
|
|
|
||||||
181
src/rmodels.c
181
src/rmodels.c
|
|
@ -2174,7 +2174,7 @@ Material *LoadMaterials(const char *fileName, int *materialCount)
|
||||||
int result = tinyobj_parse_mtl_file(&mats, &count, fileName);
|
int result = tinyobj_parse_mtl_file(&mats, &count, fileName);
|
||||||
if (result != TINYOBJ_SUCCESS) TRACELOG(LOG_WARNING, "MATERIAL: [%s] Failed to parse materials file", fileName);
|
if (result != TINYOBJ_SUCCESS) TRACELOG(LOG_WARNING, "MATERIAL: [%s] Failed to parse materials file", fileName);
|
||||||
|
|
||||||
materials = RL_MALLOC(count*sizeof(Material));
|
materials = (Material *)RL_MALLOC(count*sizeof(Material));
|
||||||
ProcessMaterialsOBJ(materials, mats, count);
|
ProcessMaterialsOBJ(materials, mats, count);
|
||||||
|
|
||||||
tinyobj_materials_free(mats, count);
|
tinyobj_materials_free(mats, count);
|
||||||
|
|
@ -4642,13 +4642,13 @@ static Model LoadIQM(const char *fileName)
|
||||||
//fileDataPtr += sizeof(IQMHeader); // Move file data pointer
|
//fileDataPtr += sizeof(IQMHeader); // Move file data pointer
|
||||||
|
|
||||||
// Meshes data processing
|
// Meshes data processing
|
||||||
imesh = RL_MALLOC(iqmHeader->num_meshes*sizeof(IQMMesh));
|
imesh = (IQMMesh *)RL_MALLOC(iqmHeader->num_meshes*sizeof(IQMMesh));
|
||||||
//fseek(iqmFile, iqmHeader->ofs_meshes, SEEK_SET);
|
//fseek(iqmFile, iqmHeader->ofs_meshes, SEEK_SET);
|
||||||
//fread(imesh, sizeof(IQMMesh)*iqmHeader->num_meshes, 1, iqmFile);
|
//fread(imesh, sizeof(IQMMesh)*iqmHeader->num_meshes, 1, iqmFile);
|
||||||
memcpy(imesh, fileDataPtr + iqmHeader->ofs_meshes, iqmHeader->num_meshes*sizeof(IQMMesh));
|
memcpy(imesh, fileDataPtr + iqmHeader->ofs_meshes, iqmHeader->num_meshes*sizeof(IQMMesh));
|
||||||
|
|
||||||
model.meshCount = iqmHeader->num_meshes;
|
model.meshCount = iqmHeader->num_meshes;
|
||||||
model.meshes = RL_CALLOC(model.meshCount, sizeof(Mesh));
|
model.meshes = (Mesh *)RL_CALLOC(model.meshCount, sizeof(Mesh));
|
||||||
|
|
||||||
model.materialCount = model.meshCount;
|
model.materialCount = model.meshCount;
|
||||||
model.materials = (Material *)RL_CALLOC(model.materialCount, sizeof(Material));
|
model.materials = (Material *)RL_CALLOC(model.materialCount, sizeof(Material));
|
||||||
|
|
@ -4676,24 +4676,24 @@ static Model LoadIQM(const char *fileName)
|
||||||
|
|
||||||
model.meshes[i].vertexCount = imesh[i].num_vertexes;
|
model.meshes[i].vertexCount = imesh[i].num_vertexes;
|
||||||
|
|
||||||
model.meshes[i].vertices = RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float)); // Default vertex positions
|
model.meshes[i].vertices = (float *)RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float)); // Default vertex positions
|
||||||
model.meshes[i].normals = RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float)); // Default vertex normals
|
model.meshes[i].normals = (float *)RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float)); // Default vertex normals
|
||||||
model.meshes[i].texcoords = RL_CALLOC(model.meshes[i].vertexCount*2, sizeof(float)); // Default vertex texcoords
|
model.meshes[i].texcoords = (float *)RL_CALLOC(model.meshes[i].vertexCount*2, sizeof(float)); // Default vertex texcoords
|
||||||
|
|
||||||
model.meshes[i].boneIds = RL_CALLOC(model.meshes[i].vertexCount*4, sizeof(unsigned char)); // Up-to 4 bones supported!
|
model.meshes[i].boneIds = (unsigned char *)RL_CALLOC(model.meshes[i].vertexCount*4, sizeof(unsigned char)); // Up-to 4 bones supported!
|
||||||
model.meshes[i].boneWeights = RL_CALLOC(model.meshes[i].vertexCount*4, sizeof(float)); // Up-to 4 bones supported!
|
model.meshes[i].boneWeights = (float *)RL_CALLOC(model.meshes[i].vertexCount*4, sizeof(float)); // Up-to 4 bones supported!
|
||||||
|
|
||||||
model.meshes[i].triangleCount = imesh[i].num_triangles;
|
model.meshes[i].triangleCount = imesh[i].num_triangles;
|
||||||
model.meshes[i].indices = RL_CALLOC(model.meshes[i].triangleCount*3, sizeof(unsigned short));
|
model.meshes[i].indices = (unsigned short *)RL_CALLOC(model.meshes[i].triangleCount*3, sizeof(unsigned short));
|
||||||
|
|
||||||
// Animated vertex data, what we actually process for rendering
|
// Animated vertex data, what we actually process for rendering
|
||||||
// NOTE: Animated vertex should be re-uploaded to GPU (if not using GPU skinning)
|
// NOTE: Animated vertex should be re-uploaded to GPU (if not using GPU skinning)
|
||||||
model.meshes[i].animVertices = RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float));
|
model.meshes[i].animVertices = (float *)RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float));
|
||||||
model.meshes[i].animNormals = RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float));
|
model.meshes[i].animNormals = (float *)RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Triangles data processing
|
// Triangles data processing
|
||||||
tri = RL_MALLOC(iqmHeader->num_triangles*sizeof(IQMTriangle));
|
tri = (IQMTriangle *)RL_MALLOC(iqmHeader->num_triangles*sizeof(IQMTriangle));
|
||||||
//fseek(iqmFile, iqmHeader->ofs_triangles, SEEK_SET);
|
//fseek(iqmFile, iqmHeader->ofs_triangles, SEEK_SET);
|
||||||
//fread(tri, sizeof(IQMTriangle), iqmHeader->num_triangles, iqmFile);
|
//fread(tri, sizeof(IQMTriangle), iqmHeader->num_triangles, iqmFile);
|
||||||
memcpy(tri, fileDataPtr + iqmHeader->ofs_triangles, iqmHeader->num_triangles*sizeof(IQMTriangle));
|
memcpy(tri, fileDataPtr + iqmHeader->ofs_triangles, iqmHeader->num_triangles*sizeof(IQMTriangle));
|
||||||
|
|
@ -4715,7 +4715,7 @@ static Model LoadIQM(const char *fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vertex arrays data processing
|
// Vertex arrays data processing
|
||||||
va = RL_MALLOC(iqmHeader->num_vertexarrays*sizeof(IQMVertexArray));
|
va = (IQMVertexArray *)RL_MALLOC(iqmHeader->num_vertexarrays*sizeof(IQMVertexArray));
|
||||||
//fseek(iqmFile, iqmHeader->ofs_vertexarrays, SEEK_SET);
|
//fseek(iqmFile, iqmHeader->ofs_vertexarrays, SEEK_SET);
|
||||||
//fread(va, sizeof(IQMVertexArray), iqmHeader->num_vertexarrays, iqmFile);
|
//fread(va, sizeof(IQMVertexArray), iqmHeader->num_vertexarrays, iqmFile);
|
||||||
memcpy(va, fileDataPtr + iqmHeader->ofs_vertexarrays, iqmHeader->num_vertexarrays*sizeof(IQMVertexArray));
|
memcpy(va, fileDataPtr + iqmHeader->ofs_vertexarrays, iqmHeader->num_vertexarrays*sizeof(IQMVertexArray));
|
||||||
|
|
@ -4726,7 +4726,7 @@ static Model LoadIQM(const char *fileName)
|
||||||
{
|
{
|
||||||
case IQM_POSITION:
|
case IQM_POSITION:
|
||||||
{
|
{
|
||||||
vertex = RL_MALLOC(iqmHeader->num_vertexes*3*sizeof(float));
|
vertex = (float *)RL_MALLOC(iqmHeader->num_vertexes*3*sizeof(float));
|
||||||
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
||||||
//fread(vertex, iqmHeader->num_vertexes*3*sizeof(float), 1, iqmFile);
|
//fread(vertex, iqmHeader->num_vertexes*3*sizeof(float), 1, iqmFile);
|
||||||
memcpy(vertex, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*3*sizeof(float));
|
memcpy(vertex, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*3*sizeof(float));
|
||||||
|
|
@ -4744,7 +4744,7 @@ static Model LoadIQM(const char *fileName)
|
||||||
} break;
|
} break;
|
||||||
case IQM_NORMAL:
|
case IQM_NORMAL:
|
||||||
{
|
{
|
||||||
normal = RL_MALLOC(iqmHeader->num_vertexes*3*sizeof(float));
|
normal = (float *)RL_MALLOC(iqmHeader->num_vertexes*3*sizeof(float));
|
||||||
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
||||||
//fread(normal, iqmHeader->num_vertexes*3*sizeof(float), 1, iqmFile);
|
//fread(normal, iqmHeader->num_vertexes*3*sizeof(float), 1, iqmFile);
|
||||||
memcpy(normal, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*3*sizeof(float));
|
memcpy(normal, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*3*sizeof(float));
|
||||||
|
|
@ -4762,7 +4762,7 @@ static Model LoadIQM(const char *fileName)
|
||||||
} break;
|
} break;
|
||||||
case IQM_TEXCOORD:
|
case IQM_TEXCOORD:
|
||||||
{
|
{
|
||||||
text = RL_MALLOC(iqmHeader->num_vertexes*2*sizeof(float));
|
text = (float *)RL_MALLOC(iqmHeader->num_vertexes*2*sizeof(float));
|
||||||
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
||||||
//fread(text, iqmHeader->num_vertexes*2*sizeof(float), 1, iqmFile);
|
//fread(text, iqmHeader->num_vertexes*2*sizeof(float), 1, iqmFile);
|
||||||
memcpy(text, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*2*sizeof(float));
|
memcpy(text, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*2*sizeof(float));
|
||||||
|
|
@ -4779,7 +4779,7 @@ static Model LoadIQM(const char *fileName)
|
||||||
} break;
|
} break;
|
||||||
case IQM_BLENDINDEXES:
|
case IQM_BLENDINDEXES:
|
||||||
{
|
{
|
||||||
blendi = RL_MALLOC(iqmHeader->num_vertexes*4*sizeof(char));
|
blendi = (char *)RL_MALLOC(iqmHeader->num_vertexes*4*sizeof(char));
|
||||||
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
||||||
//fread(blendi, iqmHeader->num_vertexes*4*sizeof(char), 1, iqmFile);
|
//fread(blendi, iqmHeader->num_vertexes*4*sizeof(char), 1, iqmFile);
|
||||||
memcpy(blendi, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*4*sizeof(char));
|
memcpy(blendi, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*4*sizeof(char));
|
||||||
|
|
@ -4796,7 +4796,7 @@ static Model LoadIQM(const char *fileName)
|
||||||
} break;
|
} break;
|
||||||
case IQM_BLENDWEIGHTS:
|
case IQM_BLENDWEIGHTS:
|
||||||
{
|
{
|
||||||
blendw = RL_MALLOC(iqmHeader->num_vertexes*4*sizeof(unsigned char));
|
blendw = (unsigned char *)RL_MALLOC(iqmHeader->num_vertexes*4*sizeof(unsigned char));
|
||||||
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
||||||
//fread(blendw, iqmHeader->num_vertexes*4*sizeof(unsigned char), 1, iqmFile);
|
//fread(blendw, iqmHeader->num_vertexes*4*sizeof(unsigned char), 1, iqmFile);
|
||||||
memcpy(blendw, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*4*sizeof(unsigned char));
|
memcpy(blendw, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*4*sizeof(unsigned char));
|
||||||
|
|
@ -4813,14 +4813,14 @@ static Model LoadIQM(const char *fileName)
|
||||||
} break;
|
} break;
|
||||||
case IQM_COLOR:
|
case IQM_COLOR:
|
||||||
{
|
{
|
||||||
color = RL_MALLOC(iqmHeader->num_vertexes*4*sizeof(unsigned char));
|
color = (unsigned char *)RL_MALLOC(iqmHeader->num_vertexes*4*sizeof(unsigned char));
|
||||||
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
//fseek(iqmFile, va[i].offset, SEEK_SET);
|
||||||
//fread(blendw, iqmHeader->num_vertexes*4*sizeof(unsigned char), 1, iqmFile);
|
//fread(blendw, iqmHeader->num_vertexes*4*sizeof(unsigned char), 1, iqmFile);
|
||||||
memcpy(color, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*4*sizeof(unsigned char));
|
memcpy(color, fileDataPtr + va[i].offset, iqmHeader->num_vertexes*4*sizeof(unsigned char));
|
||||||
|
|
||||||
for (unsigned int m = 0; m < iqmHeader->num_meshes; m++)
|
for (unsigned int m = 0; m < iqmHeader->num_meshes; m++)
|
||||||
{
|
{
|
||||||
model.meshes[m].colors = RL_CALLOC(model.meshes[m].vertexCount*4, sizeof(unsigned char));
|
model.meshes[m].colors = (unsigned char *)RL_CALLOC(model.meshes[m].vertexCount*4, sizeof(unsigned char));
|
||||||
|
|
||||||
int vCounter = 0;
|
int vCounter = 0;
|
||||||
for (unsigned int i = imesh[m].first_vertex*4; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*4; i++)
|
for (unsigned int i = imesh[m].first_vertex*4; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*4; i++)
|
||||||
|
|
@ -4834,14 +4834,14 @@ static Model LoadIQM(const char *fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bones (joints) data processing
|
// Bones (joints) data processing
|
||||||
ijoint = RL_MALLOC(iqmHeader->num_joints*sizeof(IQMJoint));
|
ijoint = (IQMJoint *)RL_MALLOC(iqmHeader->num_joints*sizeof(IQMJoint));
|
||||||
//fseek(iqmFile, iqmHeader->ofs_joints, SEEK_SET);
|
//fseek(iqmFile, iqmHeader->ofs_joints, SEEK_SET);
|
||||||
//fread(ijoint, sizeof(IQMJoint), iqmHeader->num_joints, iqmFile);
|
//fread(ijoint, sizeof(IQMJoint), iqmHeader->num_joints, iqmFile);
|
||||||
memcpy(ijoint, fileDataPtr + iqmHeader->ofs_joints, iqmHeader->num_joints*sizeof(IQMJoint));
|
memcpy(ijoint, fileDataPtr + iqmHeader->ofs_joints, iqmHeader->num_joints*sizeof(IQMJoint));
|
||||||
|
|
||||||
model.boneCount = iqmHeader->num_joints;
|
model.boneCount = iqmHeader->num_joints;
|
||||||
model.bones = RL_MALLOC(iqmHeader->num_joints*sizeof(BoneInfo));
|
model.bones = (BoneInfo *)RL_MALLOC(iqmHeader->num_joints*sizeof(BoneInfo));
|
||||||
model.bindPose = RL_MALLOC(iqmHeader->num_joints*sizeof(Transform));
|
model.bindPose = (Transform *)RL_MALLOC(iqmHeader->num_joints*sizeof(Transform));
|
||||||
|
|
||||||
for (unsigned int i = 0; i < iqmHeader->num_joints; i++)
|
for (unsigned int i = 0; i < iqmHeader->num_joints; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -4871,7 +4871,7 @@ static Model LoadIQM(const char *fileName)
|
||||||
for (int i = 0; i < model.meshCount; i++)
|
for (int i = 0; i < model.meshCount; i++)
|
||||||
{
|
{
|
||||||
model.meshes[i].boneCount = model.boneCount;
|
model.meshes[i].boneCount = model.boneCount;
|
||||||
model.meshes[i].boneMatrices = RL_CALLOC(model.meshes[i].boneCount, sizeof(Matrix));
|
model.meshes[i].boneMatrices = (Matrix *)RL_CALLOC(model.meshes[i].boneCount, sizeof(Matrix));
|
||||||
|
|
||||||
for (int j = 0; j < model.meshes[i].boneCount; j++)
|
for (int j = 0; j < model.meshes[i].boneCount; j++)
|
||||||
{
|
{
|
||||||
|
|
@ -4963,36 +4963,36 @@ static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, int *animCou
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get bones data
|
// Get bones data
|
||||||
IQMPose *poses = RL_MALLOC(iqmHeader->num_poses*sizeof(IQMPose));
|
IQMPose *poses = (IQMPose *)RL_MALLOC(iqmHeader->num_poses*sizeof(IQMPose));
|
||||||
//fseek(iqmFile, iqmHeader->ofs_poses, SEEK_SET);
|
//fseek(iqmFile, iqmHeader->ofs_poses, SEEK_SET);
|
||||||
//fread(poses, sizeof(IQMPose), iqmHeader->num_poses, iqmFile);
|
//fread(poses, sizeof(IQMPose), iqmHeader->num_poses, iqmFile);
|
||||||
memcpy(poses, fileDataPtr + iqmHeader->ofs_poses, iqmHeader->num_poses*sizeof(IQMPose));
|
memcpy(poses, fileDataPtr + iqmHeader->ofs_poses, iqmHeader->num_poses*sizeof(IQMPose));
|
||||||
|
|
||||||
// Get animations data
|
// Get animations data
|
||||||
*animCount = iqmHeader->num_anims;
|
*animCount = iqmHeader->num_anims;
|
||||||
IQMAnim *anim = RL_MALLOC(iqmHeader->num_anims*sizeof(IQMAnim));
|
IQMAnim *anim = (IQMAnim *)RL_MALLOC(iqmHeader->num_anims*sizeof(IQMAnim));
|
||||||
//fseek(iqmFile, iqmHeader->ofs_anims, SEEK_SET);
|
//fseek(iqmFile, iqmHeader->ofs_anims, SEEK_SET);
|
||||||
//fread(anim, sizeof(IQMAnim), iqmHeader->num_anims, iqmFile);
|
//fread(anim, sizeof(IQMAnim), iqmHeader->num_anims, iqmFile);
|
||||||
memcpy(anim, fileDataPtr + iqmHeader->ofs_anims, iqmHeader->num_anims*sizeof(IQMAnim));
|
memcpy(anim, fileDataPtr + iqmHeader->ofs_anims, iqmHeader->num_anims*sizeof(IQMAnim));
|
||||||
|
|
||||||
ModelAnimation *animations = RL_MALLOC(iqmHeader->num_anims*sizeof(ModelAnimation));
|
ModelAnimation *animations = (ModelAnimation *)RL_MALLOC(iqmHeader->num_anims*sizeof(ModelAnimation));
|
||||||
|
|
||||||
// frameposes
|
// frameposes
|
||||||
unsigned short *framedata = RL_MALLOC(iqmHeader->num_frames*iqmHeader->num_framechannels*sizeof(unsigned short));
|
unsigned short *framedata = (unsigned short *)RL_MALLOC(iqmHeader->num_frames*iqmHeader->num_framechannels*sizeof(unsigned short));
|
||||||
//fseek(iqmFile, iqmHeader->ofs_frames, SEEK_SET);
|
//fseek(iqmFile, iqmHeader->ofs_frames, SEEK_SET);
|
||||||
//fread(framedata, sizeof(unsigned short), iqmHeader->num_frames*iqmHeader->num_framechannels, iqmFile);
|
//fread(framedata, sizeof(unsigned short), iqmHeader->num_frames*iqmHeader->num_framechannels, iqmFile);
|
||||||
memcpy(framedata, fileDataPtr + iqmHeader->ofs_frames, iqmHeader->num_frames*iqmHeader->num_framechannels*sizeof(unsigned short));
|
memcpy(framedata, fileDataPtr + iqmHeader->ofs_frames, iqmHeader->num_frames*iqmHeader->num_framechannels*sizeof(unsigned short));
|
||||||
|
|
||||||
// joints
|
// joints
|
||||||
IQMJoint *joints = RL_MALLOC(iqmHeader->num_joints*sizeof(IQMJoint));
|
IQMJoint *joints = (IQMJoint *)RL_MALLOC(iqmHeader->num_joints*sizeof(IQMJoint));
|
||||||
memcpy(joints, fileDataPtr + iqmHeader->ofs_joints, iqmHeader->num_joints*sizeof(IQMJoint));
|
memcpy(joints, fileDataPtr + iqmHeader->ofs_joints, iqmHeader->num_joints*sizeof(IQMJoint));
|
||||||
|
|
||||||
for (unsigned int a = 0; a < iqmHeader->num_anims; a++)
|
for (unsigned int a = 0; a < iqmHeader->num_anims; a++)
|
||||||
{
|
{
|
||||||
animations[a].frameCount = anim[a].num_frames;
|
animations[a].frameCount = anim[a].num_frames;
|
||||||
animations[a].boneCount = iqmHeader->num_poses;
|
animations[a].boneCount = iqmHeader->num_poses;
|
||||||
animations[a].bones = RL_MALLOC(iqmHeader->num_poses*sizeof(BoneInfo));
|
animations[a].bones = (BoneInfo *)RL_MALLOC(iqmHeader->num_poses*sizeof(BoneInfo));
|
||||||
animations[a].framePoses = RL_MALLOC(anim[a].num_frames*sizeof(Transform *));
|
animations[a].framePoses = (Transform **)RL_MALLOC(anim[a].num_frames*sizeof(Transform *));
|
||||||
memcpy(animations[a].name, fileDataPtr + iqmHeader->ofs_text + anim[a].name, 32); // I don't like this 32 here
|
memcpy(animations[a].name, fileDataPtr + iqmHeader->ofs_text + anim[a].name, 32); // I don't like this 32 here
|
||||||
TraceLog(LOG_INFO, "IQM Anim %s", animations[a].name);
|
TraceLog(LOG_INFO, "IQM Anim %s", animations[a].name);
|
||||||
// animations[a].framerate = anim.framerate; // TODO: Use animation framerate data?
|
// animations[a].framerate = anim.framerate; // TODO: Use animation framerate data?
|
||||||
|
|
@ -5007,7 +5007,7 @@ static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, int *animCou
|
||||||
animations[a].bones[j].parent = poses[j].parent;
|
animations[a].bones[j].parent = poses[j].parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int j = 0; j < anim[a].num_frames; j++) animations[a].framePoses[j] = RL_MALLOC(iqmHeader->num_poses*sizeof(Transform));
|
for (unsigned int j = 0; j < anim[a].num_frames; j++) animations[a].framePoses[j] = (Transform *)RL_MALLOC(iqmHeader->num_poses*sizeof(Transform));
|
||||||
|
|
||||||
int dcounter = anim[a].first_frame*iqmHeader->num_framechannels;
|
int dcounter = anim[a].first_frame*iqmHeader->num_framechannels;
|
||||||
|
|
||||||
|
|
@ -5198,7 +5198,7 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat
|
||||||
}
|
}
|
||||||
else if ((cgltfImage->buffer_view != NULL) && (cgltfImage->buffer_view->buffer->data != NULL)) // Check if image is provided as data buffer
|
else if ((cgltfImage->buffer_view != NULL) && (cgltfImage->buffer_view->buffer->data != NULL)) // Check if image is provided as data buffer
|
||||||
{
|
{
|
||||||
unsigned char *data = RL_MALLOC(cgltfImage->buffer_view->size);
|
unsigned char *data = (unsigned char *)RL_MALLOC(cgltfImage->buffer_view->size);
|
||||||
int offset = (int)cgltfImage->buffer_view->offset;
|
int offset = (int)cgltfImage->buffer_view->offset;
|
||||||
int stride = (int)cgltfImage->buffer_view->stride? (int)cgltfImage->buffer_view->stride : 1;
|
int stride = (int)cgltfImage->buffer_view->stride? (int)cgltfImage->buffer_view->stride : 1;
|
||||||
|
|
||||||
|
|
@ -5231,16 +5231,12 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat
|
||||||
static BoneInfo *LoadBoneInfoGLTF(cgltf_skin skin, int *boneCount)
|
static BoneInfo *LoadBoneInfoGLTF(cgltf_skin skin, int *boneCount)
|
||||||
{
|
{
|
||||||
*boneCount = (int)skin.joints_count;
|
*boneCount = (int)skin.joints_count;
|
||||||
BoneInfo *bones = RL_MALLOC(skin.joints_count*sizeof(BoneInfo));
|
BoneInfo *bones = (BoneInfo *)RL_CALLOC(skin.joints_count, sizeof(BoneInfo));
|
||||||
|
|
||||||
for (unsigned int i = 0; i < skin.joints_count; i++)
|
for (unsigned int i = 0; i < skin.joints_count; i++)
|
||||||
{
|
{
|
||||||
cgltf_node node = *skin.joints[i];
|
cgltf_node node = *skin.joints[i];
|
||||||
if (node.name != NULL)
|
if (node.name != NULL) strncpy(bones[i].name, node.name, sizeof(bones[i].name) - 1);
|
||||||
{
|
|
||||||
strncpy(bones[i].name, node.name, sizeof(bones[i].name));
|
|
||||||
bones[i].name[sizeof(bones[i].name) - 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find parent bone index
|
// Find parent bone index
|
||||||
int parentIndex = -1;
|
int parentIndex = -1;
|
||||||
|
|
@ -5362,15 +5358,15 @@ static Model LoadGLTF(const char *fileName)
|
||||||
|
|
||||||
// Load our model data: meshes and materials
|
// Load our model data: meshes and materials
|
||||||
model.meshCount = primitivesCount;
|
model.meshCount = primitivesCount;
|
||||||
model.meshes = RL_CALLOC(model.meshCount, sizeof(Mesh));
|
model.meshes = (Mesh *)RL_CALLOC(model.meshCount, sizeof(Mesh));
|
||||||
|
|
||||||
// NOTE: We keep an extra slot for default material, in case some mesh requires it
|
// NOTE: We keep an extra slot for default material, in case some mesh requires it
|
||||||
model.materialCount = (int)data->materials_count + 1;
|
model.materialCount = (int)data->materials_count + 1;
|
||||||
model.materials = RL_CALLOC(model.materialCount, sizeof(Material));
|
model.materials = (Material *)RL_CALLOC(model.materialCount, sizeof(Material));
|
||||||
model.materials[0] = LoadMaterialDefault(); // Load default material (index: 0)
|
model.materials[0] = LoadMaterialDefault(); // Load default material (index: 0)
|
||||||
|
|
||||||
// Load mesh-material indices, by default all meshes are mapped to material index: 0
|
// Load mesh-material indices, by default all meshes are mapped to material index: 0
|
||||||
model.meshMaterial = RL_CALLOC(model.meshCount, sizeof(int));
|
model.meshMaterial = (int *)RL_CALLOC(model.meshCount, sizeof(int));
|
||||||
|
|
||||||
// Load materials data
|
// Load materials data
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
|
@ -5540,7 +5536,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
{
|
{
|
||||||
// Init raylib mesh vertices to copy glTF attribute data
|
// Init raylib mesh vertices to copy glTF attribute data
|
||||||
model.meshes[meshIndex].vertexCount = (int)attribute->count;
|
model.meshes[meshIndex].vertexCount = (int)attribute->count;
|
||||||
model.meshes[meshIndex].vertices = RL_MALLOC(attribute->count*3*sizeof(float));
|
model.meshes[meshIndex].vertices = (float *)RL_MALLOC(attribute->count*3*sizeof(float));
|
||||||
|
|
||||||
// Load 3 components of float data type into mesh.vertices
|
// Load 3 components of float data type into mesh.vertices
|
||||||
LOAD_ATTRIBUTE(attribute, 3, float, model.meshes[meshIndex].vertices)
|
LOAD_ATTRIBUTE(attribute, 3, float, model.meshes[meshIndex].vertices)
|
||||||
|
|
@ -5564,7 +5560,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
if ((attribute->type == cgltf_type_vec3) && (attribute->component_type == cgltf_component_type_r_32f))
|
if ((attribute->type == cgltf_type_vec3) && (attribute->component_type == cgltf_component_type_r_32f))
|
||||||
{
|
{
|
||||||
// Init raylib mesh normals to copy glTF attribute data
|
// Init raylib mesh normals to copy glTF attribute data
|
||||||
model.meshes[meshIndex].normals = RL_MALLOC(attribute->count*3*sizeof(float));
|
model.meshes[meshIndex].normals = (float *)RL_MALLOC(attribute->count*3*sizeof(float));
|
||||||
|
|
||||||
// Load 3 components of float data type into mesh.normals
|
// Load 3 components of float data type into mesh.normals
|
||||||
LOAD_ATTRIBUTE(attribute, 3, float, model.meshes[meshIndex].normals)
|
LOAD_ATTRIBUTE(attribute, 3, float, model.meshes[meshIndex].normals)
|
||||||
|
|
@ -5588,7 +5584,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
if ((attribute->type == cgltf_type_vec4) && (attribute->component_type == cgltf_component_type_r_32f))
|
if ((attribute->type == cgltf_type_vec4) && (attribute->component_type == cgltf_component_type_r_32f))
|
||||||
{
|
{
|
||||||
// Init raylib mesh tangent to copy glTF attribute data
|
// Init raylib mesh tangent to copy glTF attribute data
|
||||||
model.meshes[meshIndex].tangents = RL_MALLOC(attribute->count*4*sizeof(float));
|
model.meshes[meshIndex].tangents = (float *)RL_MALLOC(attribute->count*4*sizeof(float));
|
||||||
|
|
||||||
// Load 4 components of float data type into mesh.tangents
|
// Load 4 components of float data type into mesh.tangents
|
||||||
LOAD_ATTRIBUTE(attribute, 4, float, model.meshes[meshIndex].tangents)
|
LOAD_ATTRIBUTE(attribute, 4, float, model.meshes[meshIndex].tangents)
|
||||||
|
|
@ -5674,10 +5670,10 @@ static Model LoadGLTF(const char *fileName)
|
||||||
if (attribute->component_type == cgltf_component_type_r_8u)
|
if (attribute->component_type == cgltf_component_type_r_8u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh color to copy glTF attribute data
|
// Init raylib mesh color to copy glTF attribute data
|
||||||
model.meshes[meshIndex].colors = RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
model.meshes[meshIndex].colors = (unsigned char *)RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
||||||
|
|
||||||
// Load data into a temp buffer to be converted to raylib data type
|
// Load data into a temp buffer to be converted to raylib data type
|
||||||
unsigned char *temp = RL_MALLOC(attribute->count*3*sizeof(unsigned char));
|
unsigned char *temp = (unsigned char *)RL_MALLOC(attribute->count*3*sizeof(unsigned char));
|
||||||
LOAD_ATTRIBUTE(attribute, 3, unsigned char, temp);
|
LOAD_ATTRIBUTE(attribute, 3, unsigned char, temp);
|
||||||
|
|
||||||
// Convert data to raylib color data type (4 bytes)
|
// Convert data to raylib color data type (4 bytes)
|
||||||
|
|
@ -5694,10 +5690,10 @@ static Model LoadGLTF(const char *fileName)
|
||||||
else if (attribute->component_type == cgltf_component_type_r_16u)
|
else if (attribute->component_type == cgltf_component_type_r_16u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh color to copy glTF attribute data
|
// Init raylib mesh color to copy glTF attribute data
|
||||||
model.meshes[meshIndex].colors = RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
model.meshes[meshIndex].colors = (unsigned char *)RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
||||||
|
|
||||||
// Load data into a temp buffer to be converted to raylib data type
|
// Load data into a temp buffer to be converted to raylib data type
|
||||||
unsigned short *temp = RL_MALLOC(attribute->count*3*sizeof(unsigned short));
|
unsigned short *temp = (unsigned short *)RL_MALLOC(attribute->count*3*sizeof(unsigned short));
|
||||||
LOAD_ATTRIBUTE(attribute, 3, unsigned short, temp);
|
LOAD_ATTRIBUTE(attribute, 3, unsigned short, temp);
|
||||||
|
|
||||||
// Convert data to raylib color data type (4 bytes)
|
// Convert data to raylib color data type (4 bytes)
|
||||||
|
|
@ -5714,10 +5710,10 @@ static Model LoadGLTF(const char *fileName)
|
||||||
else if (attribute->component_type == cgltf_component_type_r_32f)
|
else if (attribute->component_type == cgltf_component_type_r_32f)
|
||||||
{
|
{
|
||||||
// Init raylib mesh color to copy glTF attribute data
|
// Init raylib mesh color to copy glTF attribute data
|
||||||
model.meshes[meshIndex].colors = RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
model.meshes[meshIndex].colors = (unsigned char *)RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
||||||
|
|
||||||
// Load data into a temp buffer to be converted to raylib data type
|
// Load data into a temp buffer to be converted to raylib data type
|
||||||
float *temp = RL_MALLOC(attribute->count*3*sizeof(float));
|
float *temp = (float *)RL_MALLOC(attribute->count*3*sizeof(float));
|
||||||
LOAD_ATTRIBUTE(attribute, 3, float, temp);
|
LOAD_ATTRIBUTE(attribute, 3, float, temp);
|
||||||
|
|
||||||
// Convert data to raylib color data type (4 bytes)
|
// Convert data to raylib color data type (4 bytes)
|
||||||
|
|
@ -5738,7 +5734,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
if (attribute->component_type == cgltf_component_type_r_8u)
|
if (attribute->component_type == cgltf_component_type_r_8u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh color to copy glTF attribute data
|
// Init raylib mesh color to copy glTF attribute data
|
||||||
model.meshes[meshIndex].colors = RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
model.meshes[meshIndex].colors = (unsigned char *)RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
||||||
|
|
||||||
// Load 4 components of unsigned char data type into mesh.colors
|
// Load 4 components of unsigned char data type into mesh.colors
|
||||||
LOAD_ATTRIBUTE(attribute, 4, unsigned char, model.meshes[meshIndex].colors)
|
LOAD_ATTRIBUTE(attribute, 4, unsigned char, model.meshes[meshIndex].colors)
|
||||||
|
|
@ -5746,10 +5742,10 @@ static Model LoadGLTF(const char *fileName)
|
||||||
else if (attribute->component_type == cgltf_component_type_r_16u)
|
else if (attribute->component_type == cgltf_component_type_r_16u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh color to copy glTF attribute data
|
// Init raylib mesh color to copy glTF attribute data
|
||||||
model.meshes[meshIndex].colors = RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
model.meshes[meshIndex].colors = (unsigned char *)RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
||||||
|
|
||||||
// Load data into a temp buffer to be converted to raylib data type
|
// Load data into a temp buffer to be converted to raylib data type
|
||||||
unsigned short *temp = RL_MALLOC(attribute->count*4*sizeof(unsigned short));
|
unsigned short *temp = (unsigned short *)RL_MALLOC(attribute->count*4*sizeof(unsigned short));
|
||||||
LOAD_ATTRIBUTE(attribute, 4, unsigned short, temp);
|
LOAD_ATTRIBUTE(attribute, 4, unsigned short, temp);
|
||||||
|
|
||||||
// Convert data to raylib color data type (4 bytes)
|
// Convert data to raylib color data type (4 bytes)
|
||||||
|
|
@ -5760,10 +5756,10 @@ static Model LoadGLTF(const char *fileName)
|
||||||
else if (attribute->component_type == cgltf_component_type_r_32f)
|
else if (attribute->component_type == cgltf_component_type_r_32f)
|
||||||
{
|
{
|
||||||
// Init raylib mesh color to copy glTF attribute data
|
// Init raylib mesh color to copy glTF attribute data
|
||||||
model.meshes[meshIndex].colors = RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
model.meshes[meshIndex].colors = (unsigned char *)RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
||||||
|
|
||||||
// Load data into a temp buffer to be converted to raylib data type
|
// Load data into a temp buffer to be converted to raylib data type
|
||||||
float *temp = RL_MALLOC(attribute->count*4*sizeof(float));
|
float *temp = (float *)RL_MALLOC(attribute->count*4*sizeof(float));
|
||||||
LOAD_ATTRIBUTE(attribute, 4, float, temp);
|
LOAD_ATTRIBUTE(attribute, 4, float, temp);
|
||||||
|
|
||||||
// Convert data to raylib color data type (4 bytes), we expect the color data normalized
|
// Convert data to raylib color data type (4 bytes), we expect the color data normalized
|
||||||
|
|
@ -5789,7 +5785,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
if (attribute->component_type == cgltf_component_type_r_16u)
|
if (attribute->component_type == cgltf_component_type_r_16u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh indices to copy glTF attribute data
|
// Init raylib mesh indices to copy glTF attribute data
|
||||||
model.meshes[meshIndex].indices = RL_MALLOC(attribute->count*sizeof(unsigned short));
|
model.meshes[meshIndex].indices = (unsigned short *)RL_MALLOC(attribute->count*sizeof(unsigned short));
|
||||||
|
|
||||||
// Load unsigned short data type into mesh.indices
|
// Load unsigned short data type into mesh.indices
|
||||||
LOAD_ATTRIBUTE(attribute, 1, unsigned short, model.meshes[meshIndex].indices)
|
LOAD_ATTRIBUTE(attribute, 1, unsigned short, model.meshes[meshIndex].indices)
|
||||||
|
|
@ -5797,14 +5793,14 @@ static Model LoadGLTF(const char *fileName)
|
||||||
else if (attribute->component_type == cgltf_component_type_r_8u)
|
else if (attribute->component_type == cgltf_component_type_r_8u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh indices to copy glTF attribute data
|
// Init raylib mesh indices to copy glTF attribute data
|
||||||
model.meshes[meshIndex].indices = RL_MALLOC(attribute->count*sizeof(unsigned short));
|
model.meshes[meshIndex].indices = (unsigned short *)RL_MALLOC(attribute->count*sizeof(unsigned short));
|
||||||
LOAD_ATTRIBUTE_CAST(attribute, 1, unsigned char, model.meshes[meshIndex].indices, unsigned short)
|
LOAD_ATTRIBUTE_CAST(attribute, 1, unsigned char, model.meshes[meshIndex].indices, unsigned short)
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (attribute->component_type == cgltf_component_type_r_32u)
|
else if (attribute->component_type == cgltf_component_type_r_32u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh indices to copy glTF attribute data
|
// Init raylib mesh indices to copy glTF attribute data
|
||||||
model.meshes[meshIndex].indices = RL_MALLOC(attribute->count*sizeof(unsigned short));
|
model.meshes[meshIndex].indices = (unsigned short *)RL_MALLOC(attribute->count*sizeof(unsigned short));
|
||||||
LOAD_ATTRIBUTE_CAST(attribute, 1, unsigned int, model.meshes[meshIndex].indices, unsigned short);
|
LOAD_ATTRIBUTE_CAST(attribute, 1, unsigned int, model.meshes[meshIndex].indices, unsigned short);
|
||||||
|
|
||||||
TRACELOG(LOG_WARNING, "MODEL: [%s] Indices data converted from u32 to u16, possible loss of data", fileName);
|
TRACELOG(LOG_WARNING, "MODEL: [%s] Indices data converted from u32 to u16, possible loss of data", fileName);
|
||||||
|
|
@ -5848,7 +5844,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
{
|
{
|
||||||
cgltf_skin skin = data->skins[0];
|
cgltf_skin skin = data->skins[0];
|
||||||
model.bones = LoadBoneInfoGLTF(skin, &model.boneCount);
|
model.bones = LoadBoneInfoGLTF(skin, &model.boneCount);
|
||||||
model.bindPose = RL_MALLOC(model.boneCount*sizeof(Transform));
|
model.bindPose = (Transform *)RL_MALLOC(model.boneCount*sizeof(Transform));
|
||||||
|
|
||||||
for (int i = 0; i < model.boneCount; i++)
|
for (int i = 0; i < model.boneCount; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -5905,7 +5901,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
if (attribute->component_type == cgltf_component_type_r_8u)
|
if (attribute->component_type == cgltf_component_type_r_8u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh boneIds to copy glTF attribute data
|
// Init raylib mesh boneIds to copy glTF attribute data
|
||||||
model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned char));
|
model.meshes[meshIndex].boneIds = (unsigned char *)RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned char));
|
||||||
|
|
||||||
// Load attribute: vec4, u8 (unsigned char)
|
// Load attribute: vec4, u8 (unsigned char)
|
||||||
LOAD_ATTRIBUTE(attribute, 4, unsigned char, model.meshes[meshIndex].boneIds)
|
LOAD_ATTRIBUTE(attribute, 4, unsigned char, model.meshes[meshIndex].boneIds)
|
||||||
|
|
@ -5913,10 +5909,10 @@ static Model LoadGLTF(const char *fileName)
|
||||||
else if (attribute->component_type == cgltf_component_type_r_16u)
|
else if (attribute->component_type == cgltf_component_type_r_16u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh boneIds to copy glTF attribute data
|
// Init raylib mesh boneIds to copy glTF attribute data
|
||||||
model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned char));
|
model.meshes[meshIndex].boneIds = (unsigned char *)RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned char));
|
||||||
|
|
||||||
// Load data into a temp buffer to be converted to raylib data type
|
// Load data into a temp buffer to be converted to raylib data type
|
||||||
unsigned short *temp = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned short));
|
unsigned short *temp = (unsigned short *)RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned short));
|
||||||
LOAD_ATTRIBUTE(attribute, 4, unsigned short, temp);
|
LOAD_ATTRIBUTE(attribute, 4, unsigned short, temp);
|
||||||
|
|
||||||
// Convert data to raylib color data type (4 bytes)
|
// Convert data to raylib color data type (4 bytes)
|
||||||
|
|
@ -5948,10 +5944,10 @@ static Model LoadGLTF(const char *fileName)
|
||||||
if (attribute->component_type == cgltf_component_type_r_8u)
|
if (attribute->component_type == cgltf_component_type_r_8u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh bone weight to copy glTF attribute data
|
// Init raylib mesh bone weight to copy glTF attribute data
|
||||||
model.meshes[meshIndex].boneWeights = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(float));
|
model.meshes[meshIndex].boneWeights = (float *)RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(float));
|
||||||
|
|
||||||
// Load data into a temp buffer to be converted to raylib data type
|
// Load data into a temp buffer to be converted to raylib data type
|
||||||
unsigned char *temp = RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
unsigned char *temp = (unsigned char *)RL_MALLOC(attribute->count*4*sizeof(unsigned char));
|
||||||
LOAD_ATTRIBUTE(attribute, 4, unsigned char, temp);
|
LOAD_ATTRIBUTE(attribute, 4, unsigned char, temp);
|
||||||
|
|
||||||
// Convert data to raylib bone weight data type (4 bytes)
|
// Convert data to raylib bone weight data type (4 bytes)
|
||||||
|
|
@ -5962,10 +5958,10 @@ static Model LoadGLTF(const char *fileName)
|
||||||
else if (attribute->component_type == cgltf_component_type_r_16u)
|
else if (attribute->component_type == cgltf_component_type_r_16u)
|
||||||
{
|
{
|
||||||
// Init raylib mesh bone weight to copy glTF attribute data
|
// Init raylib mesh bone weight to copy glTF attribute data
|
||||||
model.meshes[meshIndex].boneWeights = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(float));
|
model.meshes[meshIndex].boneWeights = (float *)RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(float));
|
||||||
|
|
||||||
// Load data into a temp buffer to be converted to raylib data type
|
// Load data into a temp buffer to be converted to raylib data type
|
||||||
unsigned short *temp = RL_MALLOC(attribute->count*4*sizeof(unsigned short));
|
unsigned short *temp = (unsigned short *)RL_MALLOC(attribute->count*4*sizeof(unsigned short));
|
||||||
LOAD_ATTRIBUTE(attribute, 4, unsigned short, temp);
|
LOAD_ATTRIBUTE(attribute, 4, unsigned short, temp);
|
||||||
|
|
||||||
// Convert data to raylib bone weight data type
|
// Convert data to raylib bone weight data type
|
||||||
|
|
@ -5976,7 +5972,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
else if (attribute->component_type == cgltf_component_type_r_32f)
|
else if (attribute->component_type == cgltf_component_type_r_32f)
|
||||||
{
|
{
|
||||||
// Init raylib mesh bone weight to copy glTF attribute data
|
// Init raylib mesh bone weight to copy glTF attribute data
|
||||||
model.meshes[meshIndex].boneWeights = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(float));
|
model.meshes[meshIndex].boneWeights = (float *)RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(float));
|
||||||
|
|
||||||
// Load 4 components of float data type into mesh.boneWeights
|
// Load 4 components of float data type into mesh.boneWeights
|
||||||
// for cgltf_attribute_type_weights we have:
|
// for cgltf_attribute_type_weights we have:
|
||||||
|
|
@ -6007,8 +6003,8 @@ static Model LoadGLTF(const char *fileName)
|
||||||
|
|
||||||
if (parentBoneId >= 0)
|
if (parentBoneId >= 0)
|
||||||
{
|
{
|
||||||
model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned char));
|
model.meshes[meshIndex].boneIds = (unsigned char *)RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned char));
|
||||||
model.meshes[meshIndex].boneWeights = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(float));
|
model.meshes[meshIndex].boneWeights = (float *)RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(float));
|
||||||
|
|
||||||
for (int vertexIndex = 0; vertexIndex < model.meshes[meshIndex].vertexCount*4; vertexIndex += 4)
|
for (int vertexIndex = 0; vertexIndex < model.meshes[meshIndex].vertexCount*4; vertexIndex += 4)
|
||||||
{
|
{
|
||||||
|
|
@ -6019,9 +6015,9 @@ static Model LoadGLTF(const char *fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animated vertex data
|
// Animated vertex data
|
||||||
model.meshes[meshIndex].animVertices = RL_CALLOC(model.meshes[meshIndex].vertexCount*3, sizeof(float));
|
model.meshes[meshIndex].animVertices = (float *)RL_CALLOC(model.meshes[meshIndex].vertexCount*3, sizeof(float));
|
||||||
memcpy(model.meshes[meshIndex].animVertices, model.meshes[meshIndex].vertices, model.meshes[meshIndex].vertexCount*3*sizeof(float));
|
memcpy(model.meshes[meshIndex].animVertices, model.meshes[meshIndex].vertices, model.meshes[meshIndex].vertexCount*3*sizeof(float));
|
||||||
model.meshes[meshIndex].animNormals = RL_CALLOC(model.meshes[meshIndex].vertexCount*3, sizeof(float));
|
model.meshes[meshIndex].animNormals = (float *)RL_CALLOC(model.meshes[meshIndex].vertexCount*3, sizeof(float));
|
||||||
if (model.meshes[meshIndex].normals != NULL)
|
if (model.meshes[meshIndex].normals != NULL)
|
||||||
{
|
{
|
||||||
memcpy(model.meshes[meshIndex].animNormals, model.meshes[meshIndex].normals, model.meshes[meshIndex].vertexCount*3*sizeof(float));
|
memcpy(model.meshes[meshIndex].animNormals, model.meshes[meshIndex].normals, model.meshes[meshIndex].vertexCount*3*sizeof(float));
|
||||||
|
|
@ -6029,7 +6025,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
|
|
||||||
// Bone Transform Matrices
|
// Bone Transform Matrices
|
||||||
model.meshes[meshIndex].boneCount = model.boneCount;
|
model.meshes[meshIndex].boneCount = model.boneCount;
|
||||||
model.meshes[meshIndex].boneMatrices = RL_CALLOC(model.meshes[meshIndex].boneCount, sizeof(Matrix));
|
model.meshes[meshIndex].boneMatrices = (Matrix *)RL_CALLOC(model.meshes[meshIndex].boneCount, sizeof(Matrix));
|
||||||
|
|
||||||
for (int j = 0; j < model.meshes[meshIndex].boneCount; j++)
|
for (int j = 0; j < model.meshes[meshIndex].boneCount; j++)
|
||||||
{
|
{
|
||||||
|
|
@ -6219,7 +6215,7 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
|
||||||
{
|
{
|
||||||
cgltf_skin skin = data->skins[0];
|
cgltf_skin skin = data->skins[0];
|
||||||
*animCount = (int)data->animations_count;
|
*animCount = (int)data->animations_count;
|
||||||
animations = RL_MALLOC(data->animations_count*sizeof(ModelAnimation));
|
animations = (ModelAnimation *)RL_CALLOC(data->animations_count, sizeof(ModelAnimation));
|
||||||
|
|
||||||
for (unsigned int i = 0; i < data->animations_count; i++)
|
for (unsigned int i = 0; i < data->animations_count; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -6234,7 +6230,7 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
|
||||||
cgltf_interpolation_type interpolationType;
|
cgltf_interpolation_type interpolationType;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Channels *boneChannels = RL_CALLOC(animations[i].boneCount, sizeof(struct Channels));
|
struct Channels *boneChannels = (struct Channels *)RL_CALLOC(animations[i].boneCount, sizeof(struct Channels));
|
||||||
float animDuration = 0.0f;
|
float animDuration = 0.0f;
|
||||||
|
|
||||||
for (unsigned int j = 0; j < animData.channels_count; j++)
|
for (unsigned int j = 0; j < animData.channels_count; j++)
|
||||||
|
|
@ -6292,18 +6288,14 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
|
||||||
animDuration = (t > animDuration)? t : animDuration;
|
animDuration = (t > animDuration)? t : animDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animData.name != NULL)
|
if (animData.name != NULL) strncpy(animations[i].name, animData.name, sizeof(animations[i].name) - 1);
|
||||||
{
|
|
||||||
strncpy(animations[i].name, animData.name, sizeof(animations[i].name));
|
|
||||||
animations[i].name[sizeof(animations[i].name) - 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
animations[i].frameCount = (int)(animDuration*1000.0f/GLTF_ANIMDELAY) + 1;
|
animations[i].frameCount = (int)(animDuration*1000.0f/GLTF_ANIMDELAY) + 1;
|
||||||
animations[i].framePoses = RL_MALLOC(animations[i].frameCount*sizeof(Transform *));
|
animations[i].framePoses = (Transform **)RL_MALLOC(animations[i].frameCount*sizeof(Transform *));
|
||||||
|
|
||||||
for (int j = 0; j < animations[i].frameCount; j++)
|
for (int j = 0; j < animations[i].frameCount; j++)
|
||||||
{
|
{
|
||||||
animations[i].framePoses[j] = RL_MALLOC(animations[i].boneCount*sizeof(Transform));
|
animations[i].framePoses[j] = (Transform *)RL_MALLOC(animations[i].boneCount*sizeof(Transform));
|
||||||
float time = ((float) j*GLTF_ANIMDELAY)/1000.0f;
|
float time = ((float) j*GLTF_ANIMDELAY)/1000.0f;
|
||||||
|
|
||||||
for (int k = 0; k < animations[i].boneCount; k++)
|
for (int k = 0; k < animations[i].boneCount; k++)
|
||||||
|
|
@ -6453,7 +6445,7 @@ static Model LoadVOX(const char *fileName)
|
||||||
|
|
||||||
// Copy colors
|
// Copy colors
|
||||||
size = pmesh->vertexCount*sizeof(Color);
|
size = pmesh->vertexCount*sizeof(Color);
|
||||||
pmesh->colors = RL_MALLOC(size);
|
pmesh->colors = (unsigned char *)RL_MALLOC(size);
|
||||||
memcpy(pmesh->colors, pcolors, size);
|
memcpy(pmesh->colors, pcolors, size);
|
||||||
|
|
||||||
// First material index
|
// First material index
|
||||||
|
|
@ -6589,7 +6581,7 @@ static Model LoadM3D(const char *fileName)
|
||||||
|
|
||||||
// If no map is provided, or we have colors defined, we allocate storage for vertex colors
|
// If no map is provided, or we have colors defined, we allocate storage for vertex colors
|
||||||
// M3D specs only consider vertex colors if no material is provided, however raylib uses both and mixes the colors
|
// M3D specs only consider vertex colors if no material is provided, however raylib uses both and mixes the colors
|
||||||
if ((mi == M3D_UNDEF) || vcolor) model.meshes[k].colors = RL_CALLOC(model.meshes[k].vertexCount*4, sizeof(unsigned char));
|
if ((mi == M3D_UNDEF) || vcolor) model.meshes[k].colors = (unsigned char *)RL_CALLOC(model.meshes[k].vertexCount*4, sizeof(unsigned char));
|
||||||
|
|
||||||
// If no map is provided and we allocated vertex colors, set them to white
|
// If no map is provided and we allocated vertex colors, set them to white
|
||||||
if ((mi == M3D_UNDEF) && (model.meshes[k].colors != NULL))
|
if ((mi == M3D_UNDEF) && (model.meshes[k].colors != NULL))
|
||||||
|
|
@ -6756,13 +6748,13 @@ static Model LoadM3D(const char *fileName)
|
||||||
if (m3d->numbone)
|
if (m3d->numbone)
|
||||||
{
|
{
|
||||||
model.boneCount = m3d->numbone + 1;
|
model.boneCount = m3d->numbone + 1;
|
||||||
model.bones = RL_CALLOC(model.boneCount, sizeof(BoneInfo));
|
model.bones = (BoneInfo *)RL_CALLOC(model.boneCount, sizeof(BoneInfo));
|
||||||
model.bindPose = RL_CALLOC(model.boneCount, sizeof(Transform));
|
model.bindPose = (Transform *)RL_CALLOC(model.boneCount, sizeof(Transform));
|
||||||
|
|
||||||
for (i = 0; i < (int)m3d->numbone; i++)
|
for (i = 0; i < (int)m3d->numbone; i++)
|
||||||
{
|
{
|
||||||
model.bones[i].parent = m3d->bone[i].parent;
|
model.bones[i].parent = m3d->bone[i].parent;
|
||||||
strncpy(model.bones[i].name, m3d->bone[i].name, sizeof(model.bones[i].name));
|
strncpy(model.bones[i].name, m3d->bone[i].name, sizeof(model.bones[i].name) - 1);
|
||||||
model.bindPose[i].translation.x = m3d->vertex[m3d->bone[i].pos].x*m3d->scale;
|
model.bindPose[i].translation.x = m3d->vertex[m3d->bone[i].pos].x*m3d->scale;
|
||||||
model.bindPose[i].translation.y = m3d->vertex[m3d->bone[i].pos].y*m3d->scale;
|
model.bindPose[i].translation.y = m3d->vertex[m3d->bone[i].pos].y*m3d->scale;
|
||||||
model.bindPose[i].translation.z = m3d->vertex[m3d->bone[i].pos].z*m3d->scale;
|
model.bindPose[i].translation.z = m3d->vertex[m3d->bone[i].pos].z*m3d->scale;
|
||||||
|
|
@ -6808,7 +6800,7 @@ static Model LoadM3D(const char *fileName)
|
||||||
memcpy(model.meshes[i].animNormals, model.meshes[i].normals, model.meshes[i].vertexCount*3*sizeof(float));
|
memcpy(model.meshes[i].animNormals, model.meshes[i].normals, model.meshes[i].vertexCount*3*sizeof(float));
|
||||||
|
|
||||||
model.meshes[i].boneCount = model.boneCount;
|
model.meshes[i].boneCount = model.boneCount;
|
||||||
model.meshes[i].boneMatrices = RL_CALLOC(model.meshes[i].boneCount, sizeof(Matrix));
|
model.meshes[i].boneMatrices = (Matrix *)RL_CALLOC(model.meshes[i].boneCount, sizeof(Matrix));
|
||||||
for (j = 0; j < model.meshes[i].boneCount; j++)
|
for (j = 0; j < model.meshes[i].boneCount; j++)
|
||||||
{
|
{
|
||||||
model.meshes[i].boneMatrices[j] = MatrixIdentity();
|
model.meshes[i].boneMatrices[j] = MatrixIdentity();
|
||||||
|
|
@ -6858,24 +6850,23 @@ static ModelAnimation *LoadModelAnimationsM3D(const char *fileName, int *animCou
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
animations = RL_MALLOC(m3d->numaction*sizeof(ModelAnimation));
|
animations = (ModelAnimation *)RL_CALLOC(m3d->numaction, sizeof(ModelAnimation));
|
||||||
*animCount = m3d->numaction;
|
*animCount = m3d->numaction;
|
||||||
|
|
||||||
for (unsigned int a = 0; a < m3d->numaction; a++)
|
for (unsigned int a = 0; a < m3d->numaction; a++)
|
||||||
{
|
{
|
||||||
animations[a].frameCount = m3d->action[a].durationmsec/M3D_ANIMDELAY;
|
animations[a].frameCount = m3d->action[a].durationmsec/M3D_ANIMDELAY;
|
||||||
animations[a].boneCount = m3d->numbone + 1;
|
animations[a].boneCount = m3d->numbone + 1;
|
||||||
animations[a].bones = RL_MALLOC((m3d->numbone + 1)*sizeof(BoneInfo));
|
animations[a].bones = (BoneInfo *)RL_MALLOC((m3d->numbone + 1)*sizeof(BoneInfo));
|
||||||
animations[a].framePoses = RL_MALLOC(animations[a].frameCount*sizeof(Transform *));
|
animations[a].framePoses = (Transform **)RL_MALLOC(animations[a].frameCount*sizeof(Transform *));
|
||||||
strncpy(animations[a].name, m3d->action[a].name, sizeof(animations[a].name));
|
strncpy(animations[a].name, m3d->action[a].name, sizeof(animations[a].name) - 1);
|
||||||
animations[a].name[sizeof(animations[a].name) - 1] = '\0';
|
|
||||||
|
|
||||||
TRACELOG(LOG_INFO, "MODEL: [%s] animation #%i: %i msec, %i frames", fileName, a, m3d->action[a].durationmsec, animations[a].frameCount);
|
TRACELOG(LOG_INFO, "MODEL: [%s] animation #%i: %i msec, %i frames", fileName, a, m3d->action[a].durationmsec, animations[a].frameCount);
|
||||||
|
|
||||||
for (i = 0; i < (int)m3d->numbone; i++)
|
for (i = 0; i < (int)m3d->numbone; i++)
|
||||||
{
|
{
|
||||||
animations[a].bones[i].parent = m3d->bone[i].parent;
|
animations[a].bones[i].parent = m3d->bone[i].parent;
|
||||||
strncpy(animations[a].bones[i].name, m3d->bone[i].name, sizeof(animations[a].bones[i].name));
|
strncpy(animations[a].bones[i].name, m3d->bone[i].name, sizeof(animations[a].bones[i].name) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// A special, never transformed "no bone" bone, used for boneless vertices
|
// A special, never transformed "no bone" bone, used for boneless vertices
|
||||||
|
|
@ -6886,7 +6877,7 @@ static ModelAnimation *LoadModelAnimationsM3D(const char *fileName, int *animCou
|
||||||
// regular intervals, so let the M3D SDK do the heavy lifting and calculate interpolated bones
|
// regular intervals, so let the M3D SDK do the heavy lifting and calculate interpolated bones
|
||||||
for (i = 0; i < animations[a].frameCount; i++)
|
for (i = 0; i < animations[a].frameCount; i++)
|
||||||
{
|
{
|
||||||
animations[a].framePoses[i] = RL_MALLOC((m3d->numbone + 1)*sizeof(Transform));
|
animations[a].framePoses[i] = (Transform *)RL_MALLOC((m3d->numbone + 1)*sizeof(Transform));
|
||||||
|
|
||||||
m3db_t *pose = m3d_pose(m3d, a, i*M3D_ANIMDELAY);
|
m3db_t *pose = m3d_pose(m3d, a, i*M3D_ANIMDELAY);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -786,7 +786,7 @@ void DrawRectangleGradientH(int posX, int posY, int width, int height, Color lef
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a gradient-filled rectangle
|
// Draw a gradient-filled rectangle
|
||||||
void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color topRight, Color bottomRight)
|
void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color bottomRight, Color topRight)
|
||||||
{
|
{
|
||||||
rlSetTexture(GetShapesTexture().id);
|
rlSetTexture(GetShapesTexture().id);
|
||||||
Rectangle shapeRect = GetShapesTextureRectangle();
|
Rectangle shapeRect = GetShapesTextureRectangle();
|
||||||
|
|
@ -803,11 +803,11 @@ void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Col
|
||||||
rlTexCoord2f(shapeRect.x/texShapes.width, (shapeRect.y + shapeRect.height)/texShapes.height);
|
rlTexCoord2f(shapeRect.x/texShapes.width, (shapeRect.y + shapeRect.height)/texShapes.height);
|
||||||
rlVertex2f(rec.x, rec.y + rec.height);
|
rlVertex2f(rec.x, rec.y + rec.height);
|
||||||
|
|
||||||
rlColor4ub(topRight.r, topRight.g, topRight.b, topRight.a);
|
rlColor4ub(bottomRight.r, bottomRight.g, bottomRight.b, bottomRight.a);
|
||||||
rlTexCoord2f((shapeRect.x + shapeRect.width)/texShapes.width, (shapeRect.y + shapeRect.height)/texShapes.height);
|
rlTexCoord2f((shapeRect.x + shapeRect.width)/texShapes.width, (shapeRect.y + shapeRect.height)/texShapes.height);
|
||||||
rlVertex2f(rec.x + rec.width, rec.y + rec.height);
|
rlVertex2f(rec.x + rec.width, rec.y + rec.height);
|
||||||
|
|
||||||
rlColor4ub(bottomRight.r, bottomRight.g, bottomRight.b, bottomRight.a);
|
rlColor4ub(topRight.r, topRight.g, topRight.b, topRight.a);
|
||||||
rlTexCoord2f((shapeRect.x + shapeRect.width)/texShapes.width, shapeRect.y/texShapes.height);
|
rlTexCoord2f((shapeRect.x + shapeRect.width)/texShapes.width, shapeRect.y/texShapes.height);
|
||||||
rlVertex2f(rec.x + rec.width, rec.y);
|
rlVertex2f(rec.x + rec.width, rec.y);
|
||||||
rlEnd();
|
rlEnd();
|
||||||
|
|
|
||||||
|
|
@ -2102,8 +2102,8 @@ void ImageBlurGaussian(Image *image, int blurSize)
|
||||||
Color *pixels = LoadImageColors(*image);
|
Color *pixels = LoadImageColors(*image);
|
||||||
|
|
||||||
// Loop switches between pixelsCopy1 and pixelsCopy2
|
// Loop switches between pixelsCopy1 and pixelsCopy2
|
||||||
Vector4 *pixelsCopy1 = RL_MALLOC((image->height)*(image->width)*sizeof(Vector4));
|
Vector4 *pixelsCopy1 = (Vector4 *)RL_MALLOC((image->height)*(image->width)*sizeof(Vector4));
|
||||||
Vector4 *pixelsCopy2 = RL_MALLOC((image->height)*(image->width)*sizeof(Vector4));
|
Vector4 *pixelsCopy2 = (Vector4 *)RL_MALLOC((image->height)*(image->width)*sizeof(Vector4));
|
||||||
|
|
||||||
for (int i = 0; i < (image->height*image->width); i++)
|
for (int i = 0; i < (image->height*image->width); i++)
|
||||||
{
|
{
|
||||||
|
|
@ -2251,8 +2251,8 @@ void ImageKernelConvolution(Image *image, const float *kernel, int kernelSize)
|
||||||
|
|
||||||
Color *pixels = LoadImageColors(*image);
|
Color *pixels = LoadImageColors(*image);
|
||||||
|
|
||||||
Vector4 *imageCopy2 = RL_MALLOC((image->height)*(image->width)*sizeof(Vector4));
|
Vector4 *imageCopy2 = (Vector4 *)RL_MALLOC((image->height)*(image->width)*sizeof(Vector4));
|
||||||
Vector4 *temp = RL_MALLOC(kernelSize*sizeof(Vector4));
|
Vector4 *temp = (Vector4 *)RL_MALLOC(kernelSize*sizeof(Vector4));
|
||||||
|
|
||||||
for (int i = 0; i < kernelSize; i++)
|
for (int i = 0; i < kernelSize; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -3891,7 +3891,7 @@ void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Colo
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a triangle fan defined by points within an image (first vertex is the center)
|
// Draw a triangle fan defined by points within an image (first vertex is the center)
|
||||||
void ImageDrawTriangleFan(Image *dst, Vector2 *points, int pointCount, Color color)
|
void ImageDrawTriangleFan(Image *dst, const Vector2 *points, int pointCount, Color color)
|
||||||
{
|
{
|
||||||
if (pointCount >= 3)
|
if (pointCount >= 3)
|
||||||
{
|
{
|
||||||
|
|
@ -3903,7 +3903,7 @@ void ImageDrawTriangleFan(Image *dst, Vector2 *points, int pointCount, Color col
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a triangle strip defined by points within an image
|
// Draw a triangle strip defined by points within an image
|
||||||
void ImageDrawTriangleStrip(Image *dst, Vector2 *points, int pointCount, Color color)
|
void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCount, Color color)
|
||||||
{
|
{
|
||||||
if (pointCount >= 3)
|
if (pointCount >= 3)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user