Merge branch 'master' of github.com:JeffM2501/raylib
This commit is contained in:
commit
8c45d899ac
|
|
@ -9,7 +9,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
||||||
| [raylib](https://github.com/raysan5/raylib) | **5.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
|
| [raylib](https://github.com/raysan5/raylib) | **5.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
|
||||||
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.0** | [Beef](https://www.beeflang.org) | MIT |
|
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.0** | [Beef](https://www.beeflang.org) | MIT |
|
||||||
| [raylib-boo](https://github.com/Rabios/raylib-boo) | 3.7 | [Boo](http://boo-language.github.io) | MIT |
|
| [raylib-boo](https://github.com/Rabios/raylib-boo) | 3.7 | [Boo](http://boo-language.github.io) | MIT |
|
||||||
| [raybit](https://github.com/Alex-Velez/raybit) | 3.7 | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
|
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
|
||||||
| [Raylib-cs](https://github.com/ChrisDill/Raylib-cs) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
|
| [Raylib-cs](https://github.com/ChrisDill/Raylib-cs) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
|
||||||
| [Raylib-CsLo](https://github.com/NotNotTech/Raylib-CsLo) | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
| [Raylib-CsLo](https://github.com/NotNotTech/Raylib-CsLo) | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
||||||
| [Raylib-CSharp-Vinculum](https://github.com/ZeroElectric/Raylib-CSharp-Vinculum) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
| [Raylib-CSharp-Vinculum](https://github.com/ZeroElectric/Raylib-CSharp-Vinculum) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
||||||
|
|
@ -78,10 +78,10 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
||||||
| [raylib-zig-bindings](https://github.com/L-Briand/raylib-zig-bindings) | **5.0** | [Zig](https://ziglang.org) | Zlib |
|
| [raylib-zig-bindings](https://github.com/L-Briand/raylib-zig-bindings) | **5.0** | [Zig](https://ziglang.org) | Zlib |
|
||||||
| [hare-raylib](https://git.sr.ht/~evantj/hare-raylib) | **auto** | [Hare](https://harelang.org) | Zlib |
|
| [hare-raylib](https://git.sr.ht/~evantj/hare-raylib) | **auto** | [Hare](https://harelang.org) | Zlib |
|
||||||
| [raylib-sunder](https://github.com/ashn-dot-dev/raylib-sunder) | **auto** | [Sunder](https://github.com/ashn-dot-dev/sunder) | 0BSD |
|
| [raylib-sunder](https://github.com/ashn-dot-dev/raylib-sunder) | **auto** | [Sunder](https://github.com/ashn-dot-dev/sunder) | 0BSD |
|
||||||
| [rayed-bqn](https://github.com/Brian-ED/rayed-bqn) | **auto** | [BQN](https://mlochbaum.github.io/BQN) | MIT |
|
| [raylib-bqn](https://github.com/Brian-ED/raylib-bqn) | **5.0** | [BQN](https://mlochbaum.github.io/BQN) | MIT |
|
||||||
| [rayjs](https://github.com/mode777/rayjs) | 4.6-dev | [QuickJS](https://bellard.org/quickjs) | MIT |
|
| [rayjs](https://github.com/mode777/rayjs) | 4.6-dev | [QuickJS](https://bellard.org/quickjs) | MIT |
|
||||||
| [raylib-raku](https://github.com/vushu/raylib-raku) | **auto** | [Raku](https://www.raku.org) | Artistic License 2.0 |
|
| [raylib-raku](https://github.com/vushu/raylib-raku) | **auto** | [Raku](https://www.raku.org) | Artistic License 2.0 |
|
||||||
| [Raylib.lean](https://github.com/KislyjKisel/Raylib.lean) | 4.5 | [Lean4](https://lean-lang.org) | BSD-3-Clause |
|
| [Raylib.lean](https://github.com/KislyjKisel/Raylib.lean) | **5.5-dev** | [Lean4](https://lean-lang.org) | BSD-3-Clause |
|
||||||
| [raylib-cobol](https://codeberg.org/glowiak/raylib-cobol) | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain |
|
| [raylib-cobol](https://codeberg.org/glowiak/raylib-cobol) | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain |
|
||||||
| [raylib-apl](https://github.com/Brian-ED/raylib-apl) | **5.0** | [Dyalog APL](https://www.dyalog.com/) | MIT |
|
| [raylib-apl](https://github.com/Brian-ED/raylib-apl) | **5.0** | [Dyalog APL](https://www.dyalog.com/) | MIT |
|
||||||
|
|
||||||
|
|
@ -92,6 +92,7 @@ These are utility wrappers for specific languages, they are not required to use
|
||||||
| ---------------------------------------------------- | :------------: | :------------------------------------------: | :-----: |
|
| ---------------------------------------------------- | :------------: | :------------------------------------------: | :-----: |
|
||||||
| [raylib-cpp](https://github.com/robloach/raylib-cpp) | **5.0** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib |
|
| [raylib-cpp](https://github.com/robloach/raylib-cpp) | **5.0** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib |
|
||||||
| [claylib](https://github.com/defun-games/claylib) | 4.5 | [Common Lisp](https://common-lisp.net) | Zlib |
|
| [claylib](https://github.com/defun-games/claylib) | 4.5 | [Common Lisp](https://common-lisp.net) | Zlib |
|
||||||
|
| [rayed-bqn](https://github.com/Brian-ED/rayed-bqn) | **5.0** | [BQN](https://mlochbaum.github.io/BQN) | MIT |
|
||||||
|
|
||||||
### Older or Unmaintained Language Bindings
|
### Older or Unmaintained Language Bindings
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,6 @@ include(CompilerFlags)
|
||||||
# Registers build options that are exposed to cmake
|
# Registers build options that are exposed to cmake
|
||||||
include(CMakeOptions.txt)
|
include(CMakeOptions.txt)
|
||||||
|
|
||||||
# Enforces a few environment and compiler configurations
|
|
||||||
include(BuildOptions)
|
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
|
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
|
||||||
MESSAGE(FATAL_ERROR "Cannot disable both Wayland and X11")
|
MESSAGE(FATAL_ERROR "Cannot disable both Wayland and X11")
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended
|
||||||
# Shared library is always PIC. Static library should be PIC too if linked into a shared library
|
# Shared library is always PIC. Static library should be PIC too if linked into a shared library
|
||||||
option(WITH_PIC "Compile static library as position-independent code" OFF)
|
option(WITH_PIC "Compile static library as position-independent code" OFF)
|
||||||
option(BUILD_SHARED_LIBS "Build raylib as a shared library" OFF)
|
option(BUILD_SHARED_LIBS "Build raylib as a shared library" OFF)
|
||||||
option(MACOS_FATLIB "Build fat library for both i386 and x86_64 on macOS" OFF)
|
|
||||||
cmake_dependent_option(USE_AUDIO "Build raylib with audio module" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(USE_AUDIO "Build raylib with audio module" ON CUSTOMIZE_BUILD ON)
|
||||||
|
|
||||||
enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one")
|
enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one")
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
if(${PLATFORM} MATCHES "Desktop" AND APPLE)
|
|
||||||
if(MACOS_FATLIB)
|
|
||||||
if (CMAKE_OSX_ARCHITECTURES)
|
|
||||||
message(FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides -DMACOS_FATLIB=ON")
|
|
||||||
else()
|
|
||||||
set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# This helps support the case where emsdk toolchain file is used
|
|
||||||
# either by setting it with -DCMAKE_TOOLCHAIN_FILE=<path_to_emsdk>/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
|
|
||||||
# or by using "emcmake cmake -B build -S ." as described in https://emscripten.org/docs/compiling/Building-Projects.html
|
|
||||||
if(EMSCRIPTEN)
|
|
||||||
SET(PLATFORM Web CACHE STRING "Forcing PLATFORM_WEB because EMSCRIPTEN was detected")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# vim: ft=cmake
|
|
||||||
|
|
@ -70,8 +70,9 @@ RAYLIB_SRC_PATH ?= ../src
|
||||||
|
|
||||||
# Locations of raylib.h and libraylib.a/libraylib.so
|
# Locations of raylib.h and libraylib.a/libraylib.so
|
||||||
# NOTE: Those variables are only used for PLATFORM_OS: LINUX, BSD
|
# NOTE: Those variables are only used for PLATFORM_OS: LINUX, BSD
|
||||||
RAYLIB_INCLUDE_PATH ?= /usr/local/include
|
DESTDIR ?= /usr/local
|
||||||
RAYLIB_LIB_PATH ?= /usr/local/lib
|
RAYLIB_INCLUDE_PATH ?= $(DESTDIR)/include
|
||||||
|
RAYLIB_LIB_PATH ?= $(DESTDIR)/lib
|
||||||
|
|
||||||
# Library type compilation: STATIC (.a) or SHARED (.so/.dll)
|
# Library type compilation: STATIC (.a) or SHARED (.so/.dll)
|
||||||
RAYLIB_LIBTYPE ?= STATIC
|
RAYLIB_LIBTYPE ?= STATIC
|
||||||
|
|
@ -582,10 +583,12 @@ MODELS = \
|
||||||
models/models_mesh_generation \
|
models/models_mesh_generation \
|
||||||
models/models_mesh_picking \
|
models/models_mesh_picking \
|
||||||
models/models_orthographic_projection \
|
models/models_orthographic_projection \
|
||||||
|
models/models_point_rendering \
|
||||||
models/models_rlgl_solar_system \
|
models/models_rlgl_solar_system \
|
||||||
models/models_skybox \
|
models/models_skybox \
|
||||||
models/models_waving_cubes \
|
models/models_waving_cubes \
|
||||||
models/models_yaw_pitch_roll
|
models/models_yaw_pitch_roll \
|
||||||
|
models/models_gpu_skinning
|
||||||
|
|
||||||
SHADERS = \
|
SHADERS = \
|
||||||
shaders/shaders_basic_lighting \
|
shaders/shaders_basic_lighting \
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,9 @@ RAYLIB_PATH ?= ..
|
||||||
|
|
||||||
# Locations of raylib.h and libraylib.a/libraylib.so
|
# Locations of raylib.h and libraylib.a/libraylib.so
|
||||||
# NOTE: Those variables are only used for PLATFORM_OS: LINUX, BSD
|
# NOTE: Those variables are only used for PLATFORM_OS: LINUX, BSD
|
||||||
RAYLIB_INCLUDE_PATH ?= /usr/local/include
|
DESTDIR ?= /usr/local
|
||||||
RAYLIB_LIB_PATH ?= /usr/local/lib
|
RAYLIB_INCLUDE_PATH ?= $(DESTDIR)/include
|
||||||
|
RAYLIB_LIB_PATH ?= $(DESTDIR)/lib
|
||||||
|
|
||||||
# Library type compilation: STATIC (.a) or SHARED (.so/.dll)
|
# Library type compilation: STATIC (.a) or SHARED (.so/.dll)
|
||||||
RAYLIB_LIBTYPE ?= STATIC
|
RAYLIB_LIBTYPE ?= STATIC
|
||||||
|
|
@ -447,6 +448,7 @@ MODELS = \
|
||||||
models/models_mesh_generation \
|
models/models_mesh_generation \
|
||||||
models/models_mesh_picking \
|
models/models_mesh_picking \
|
||||||
models/models_orthographic_projection \
|
models/models_orthographic_projection \
|
||||||
|
models/models_point_rendering \
|
||||||
models/models_rlgl_solar_system \
|
models/models_rlgl_solar_system \
|
||||||
models/models_skybox \
|
models/models_skybox \
|
||||||
models/models_waving_cubes \
|
models/models_waving_cubes \
|
||||||
|
|
|
||||||
|
|
@ -147,11 +147,12 @@ Examples using raylib models functionality, including models loading/generation
|
||||||
| 91 | [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) |
|
| 91 | [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) |
|
||||||
| 92 | [models_loading_m3d](models/models_loading_m3d.c) | <img src="models/models_loading_m3d.png" alt="models_loading_m3d" width="80"> | ⭐️☆☆☆ | **4.2** | **4.2** | [bzt](https://bztsrc.gitlab.io/model3d) |
|
| 92 | [models_loading_m3d](models/models_loading_m3d.c) | <img src="models/models_loading_m3d.png" alt="models_loading_m3d" width="80"> | ⭐️☆☆☆ | **4.2** | **4.2** | [bzt](https://bztsrc.gitlab.io/model3d) |
|
||||||
| 93 | [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) |
|
| 93 | [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) |
|
||||||
| 94 | [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) |
|
| 94 | [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) |
|
||||||
| 95 | [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) |
|
| 95 | [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) |
|
||||||
| 96 | [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) |
|
| 96 | [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) |
|
||||||
| 97 | [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) |
|
| 97 | [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) |
|
||||||
| 98 | [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) |
|
| 98 | [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) |
|
||||||
|
| 99 | [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) |
|
||||||
|
|
||||||
### category: shaders
|
### category: shaders
|
||||||
|
|
||||||
|
|
@ -159,26 +160,25 @@ 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 |
|
||||||
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
|
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
|
||||||
| 99 | [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/codifies) |
|
| 100 | [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/codifies) |
|
||||||
| 100 | [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) |
|
| 101 | [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) |
|
||||||
| 101 | [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) |
|
| 102 | [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) |
|
||||||
| 102 | [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) |
|
| 103 | [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) |
|
||||||
| 103 | [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) |
|
| 104 | [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) |
|
||||||
| 104 | [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) |
|
| 105 | [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) |
|
||||||
| 105 | [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) |
|
| 106 | [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) |
|
||||||
| 106 | [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/) |
|
| 107 | [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/) |
|
||||||
| 107 | [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) |
|
| 108 | [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) |
|
||||||
| 108 | [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) |
|
| 109 | [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) |
|
||||||
| 109 | [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** | [eggmund](https://github.com/eggmund) |
|
| 110 | [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** | [eggmund](https://github.com/eggmund) |
|
||||||
| 110 | [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) |
|
| 111 | [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) |
|
||||||
| 111 | [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/codifies) |
|
| 112 | [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/codifies) |
|
||||||
| 112 | [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/codifies) |
|
| 113 | [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/codifies) |
|
||||||
| 113 | [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) |
|
| 114 | [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) |
|
||||||
| 114 | [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) |
|
| 115 | [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) |
|
||||||
| 115 | [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) |
|
| 116 | [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) |
|
||||||
| 116 | [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/codifies) |
|
| 117 | [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/codifies) |
|
||||||
| 117 | [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) |
|
| 118 | [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) |
|
||||||
| 118 | [shaders_vertex_displacement](shaders/shaders_vertex_displacement.c) | <img src="shaders/shaders_vertex_displacement.png" alt="shaders_deferred_render" width="80"> | ⭐️☆☆☆ | 1.5 | 1.5 | [Alex ZH](https://github.com/ZzzhHe) |
|
|
||||||
|
|
||||||
### category: audio
|
### category: audio
|
||||||
|
|
||||||
|
|
|
||||||
119
examples/models/models_gpu_skinning.c
Normal file
119
examples/models/models_gpu_skinning.c
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Doing skinning on the gpu using a vertex shader
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 4.5, last time updated with raylib 4.5
|
||||||
|
*
|
||||||
|
* Example contributed by Daniel Holden (@orangeduck) 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) 2024 Daniel Holden (@orangeduck)
|
||||||
|
*
|
||||||
|
* Note: Due to limitations in the Apple OpenGL driver, this feature does not work on MacOS
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include "raymath.h"
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - GPU skinning");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera = { 0 };
|
||||||
|
camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; // Camera position
|
||||||
|
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
|
||||||
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||||
|
|
||||||
|
// Load gltf model
|
||||||
|
Model characterModel = LoadModel("resources/models/gltf/greenman.glb"); // Load character model
|
||||||
|
|
||||||
|
// Load skinning shader
|
||||||
|
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
|
||||||
|
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
|
||||||
|
|
||||||
|
characterModel.materials[1].shader = skinningShader;
|
||||||
|
|
||||||
|
// Load gltf model animations
|
||||||
|
int animsCount = 0;
|
||||||
|
unsigned int animIndex = 0;
|
||||||
|
unsigned int animCurrentFrame = 0;
|
||||||
|
ModelAnimation *modelAnimations = LoadModelAnimations("resources/models/gltf/greenman.glb", &animsCount);
|
||||||
|
|
||||||
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||||
|
|
||||||
|
DisableCursor(); // Limit cursor to relative movement inside the window
|
||||||
|
|
||||||
|
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
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
|
||||||
|
|
||||||
|
// Select current animation
|
||||||
|
if (IsKeyPressed(KEY_T)) animIndex = (animIndex + 1)%animsCount;
|
||||||
|
else if (IsKeyPressed(KEY_G)) animIndex = (animIndex + animsCount - 1)%animsCount;
|
||||||
|
|
||||||
|
// Update model animation
|
||||||
|
ModelAnimation anim = modelAnimations[animIndex];
|
||||||
|
animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
|
||||||
|
UpdateModelAnimationBoneMatrices(characterModel, anim, animCurrentFrame);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode3D(camera);
|
||||||
|
|
||||||
|
// Draw character
|
||||||
|
characterModel.transform = MatrixTranslate(position.x, position.y, position.z);
|
||||||
|
UpdateModelAnimationBoneMatrices(characterModel, anim, animCurrentFrame);
|
||||||
|
DrawMesh(characterModel.meshes[0], characterModel.materials[1], characterModel.transform);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
DrawText("Use the T/G to switch animation", 10, 10, 20, GRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadModelAnimations(modelAnimations, animsCount);
|
||||||
|
UnloadModel(characterModel); // Unload character model and meshes/material
|
||||||
|
UnloadShader(skinningShader);
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
182
examples/models/models_point_rendering.c
Normal file
182
examples/models/models_point_rendering.c
Normal file
|
|
@ -0,0 +1,182 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib example - point rendering
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.0, last time updated with raylib 5.0
|
||||||
|
*
|
||||||
|
* Example contributed by Reese Gallagher (@satchelfrost) 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) 2024 Reese Gallagher (@satchelfrost)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include <stdlib.h> // Required for: rand()
|
||||||
|
#include <math.h> // Required for: cos(), sin()
|
||||||
|
|
||||||
|
#define MAX_POINTS 10000000 // 10 million
|
||||||
|
#define MIN_POINTS 1000 // 1 thousand
|
||||||
|
|
||||||
|
// Generate mesh using points
|
||||||
|
Mesh GenMeshPoints(int numPoints);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - point rendering");
|
||||||
|
|
||||||
|
Camera camera = {
|
||||||
|
.position = { 3.0f, 3.0f, 3.0f },
|
||||||
|
.target = { 0.0f, 0.0f, 0.0f },
|
||||||
|
.up = { 0.0f, 1.0f, 0.0f },
|
||||||
|
.fovy = 45.0f,
|
||||||
|
.projection = CAMERA_PERSPECTIVE
|
||||||
|
};
|
||||||
|
|
||||||
|
Vector3 position = { 0.0f, 0.0f, 0.0f };
|
||||||
|
bool useDrawModelPoints = true;
|
||||||
|
bool numPointsChanged = false;
|
||||||
|
int numPoints = 1000;
|
||||||
|
|
||||||
|
Mesh mesh = GenMeshPoints(numPoints);
|
||||||
|
Model model = LoadModelFromMesh(mesh);
|
||||||
|
|
||||||
|
//SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while(!WindowShouldClose())
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCamera(&camera, CAMERA_ORBITAL);
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_SPACE)) useDrawModelPoints = !useDrawModelPoints;
|
||||||
|
if (IsKeyPressed(KEY_UP))
|
||||||
|
{
|
||||||
|
numPoints = (numPoints*10 > MAX_POINTS)? MAX_POINTS : numPoints*10;
|
||||||
|
numPointsChanged = true;
|
||||||
|
}
|
||||||
|
if (IsKeyPressed(KEY_DOWN))
|
||||||
|
{
|
||||||
|
numPoints = (numPoints/10 < MIN_POINTS)? MIN_POINTS : numPoints/10;
|
||||||
|
numPointsChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upload a different point cloud size
|
||||||
|
if (numPointsChanged)
|
||||||
|
{
|
||||||
|
UnloadModel(model);
|
||||||
|
mesh = GenMeshPoints(numPoints);
|
||||||
|
model = LoadModelFromMesh(mesh);
|
||||||
|
numPointsChanged = false;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(BLACK);
|
||||||
|
|
||||||
|
BeginMode3D(camera);
|
||||||
|
|
||||||
|
// The new method only uploads the points once to the GPU
|
||||||
|
if (useDrawModelPoints)
|
||||||
|
{
|
||||||
|
DrawModelPoints(model, position, 1.0f, WHITE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The old method must continually draw the "points" (lines)
|
||||||
|
for (int i = 0; i < numPoints; i++)
|
||||||
|
{
|
||||||
|
Vector3 pos = {
|
||||||
|
.x = mesh.vertices[i*3 + 0],
|
||||||
|
.y = mesh.vertices[i*3 + 1],
|
||||||
|
.z = mesh.vertices[i*3 + 2],
|
||||||
|
};
|
||||||
|
Color color = {
|
||||||
|
.r = mesh.colors[i*4 + 0],
|
||||||
|
.g = mesh.colors[i*4 + 1],
|
||||||
|
.b = mesh.colors[i*4 + 2],
|
||||||
|
.a = mesh.colors[i*4 + 3],
|
||||||
|
};
|
||||||
|
|
||||||
|
DrawPoint3D(pos, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw a unit sphere for reference
|
||||||
|
DrawSphereWires(position, 1.0f, 10, 10, YELLOW);
|
||||||
|
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
// Draw UI text
|
||||||
|
DrawText(TextFormat("Point Count: %d", numPoints), 20, screenHeight - 50, 40, WHITE);
|
||||||
|
DrawText("Up - increase points", 20, 70, 20, WHITE);
|
||||||
|
DrawText("Down - decrease points", 20, 100, 20, WHITE);
|
||||||
|
DrawText("Space - drawing function", 20, 130, 20, WHITE);
|
||||||
|
|
||||||
|
if (useDrawModelPoints) DrawText("Using: DrawModelPoints()", 20, 160, 20, GREEN);
|
||||||
|
else DrawText("Using: DrawPoint3D()", 20, 160, 20, RED);
|
||||||
|
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadModel(model);
|
||||||
|
|
||||||
|
CloseWindow();
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate a spherical point cloud
|
||||||
|
Mesh GenMeshPoints(int numPoints)
|
||||||
|
{
|
||||||
|
Mesh mesh = {
|
||||||
|
.triangleCount = 1,
|
||||||
|
.vertexCount = numPoints,
|
||||||
|
.vertices = (float *)MemAlloc(numPoints*3*sizeof(float)),
|
||||||
|
.colors = (unsigned char*)MemAlloc(numPoints*4*sizeof(unsigned char)),
|
||||||
|
};
|
||||||
|
|
||||||
|
// https://en.wikipedia.org/wiki/Spherical_coordinate_system
|
||||||
|
for (int i = 0; i < numPoints; i++)
|
||||||
|
{
|
||||||
|
float theta = PI*rand()/RAND_MAX;
|
||||||
|
float phi = 2.0f*PI*rand()/RAND_MAX;
|
||||||
|
float r = 10.0f*rand()/RAND_MAX;
|
||||||
|
|
||||||
|
mesh.vertices[i*3 + 0] = r*sin(theta)*cos(phi);
|
||||||
|
mesh.vertices[i*3 + 1] = r*sin(theta)*sin(phi);
|
||||||
|
mesh.vertices[i*3 + 2] = r*cos(theta);
|
||||||
|
|
||||||
|
Color color = ColorFromHSV(r*360.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
|
mesh.colors[i*4 + 0] = color.r;
|
||||||
|
mesh.colors[i*4 + 1] = color.g;
|
||||||
|
mesh.colors[i*4 + 2] = color.b;
|
||||||
|
mesh.colors[i*4 + 3] = color.a;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upload mesh data from CPU (RAM) to GPU (VRAM) memory
|
||||||
|
UploadMesh(&mesh, false);
|
||||||
|
|
||||||
|
return mesh;
|
||||||
|
}
|
||||||
BIN
examples/models/models_point_rendering.png
Normal file
BIN
examples/models/models_point_rendering.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 127 KiB |
17
examples/models/resources/shaders/glsl100/skinning.fs
Normal file
17
examples/models/resources/shaders/glsl100/skinning.fs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#version 100
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
|
// Output fragment color
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 texelColor = texture(texture0, fragTexCoord);
|
||||||
|
finalColor = texelColor*colDiffuse*fragColor;
|
||||||
|
}
|
||||||
34
examples/models/resources/shaders/glsl100/skinning.vs
Normal file
34
examples/models/resources/shaders/glsl100/skinning.vs
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#version 100
|
||||||
|
|
||||||
|
in vec3 vertexPosition;
|
||||||
|
in vec2 vertexTexCoord;
|
||||||
|
in vec4 vertexColor;
|
||||||
|
in vec4 vertexBoneIds;
|
||||||
|
in vec4 vertexBoneWeights;
|
||||||
|
|
||||||
|
#define MAX_BONE_NUM 128
|
||||||
|
uniform mat4 boneMatrices[MAX_BONE_NUM];
|
||||||
|
|
||||||
|
uniform mat4 mvp;
|
||||||
|
|
||||||
|
out vec2 fragTexCoord;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
int boneIndex0 = int(vertexBoneIds.x);
|
||||||
|
int boneIndex1 = int(vertexBoneIds.y);
|
||||||
|
int boneIndex2 = int(vertexBoneIds.z);
|
||||||
|
int boneIndex3 = int(vertexBoneIds.w);
|
||||||
|
|
||||||
|
vec4 skinnedPosition =
|
||||||
|
vertexBoneWeights.x * (boneMatrices[boneIndex0] * vec4(vertexPosition, 1.0f)) +
|
||||||
|
vertexBoneWeights.y * (boneMatrices[boneIndex1] * vec4(vertexPosition, 1.0f)) +
|
||||||
|
vertexBoneWeights.z * (boneMatrices[boneIndex2] * vec4(vertexPosition, 1.0f)) +
|
||||||
|
vertexBoneWeights.w * (boneMatrices[boneIndex3] * vec4(vertexPosition, 1.0f));
|
||||||
|
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
fragColor = vertexColor;
|
||||||
|
|
||||||
|
gl_Position = mvp * skinnedPosition;
|
||||||
|
}
|
||||||
17
examples/models/resources/shaders/glsl330/skinning.fs
Normal file
17
examples/models/resources/shaders/glsl330/skinning.fs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
|
// Output fragment color
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 texelColor = texture(texture0, fragTexCoord);
|
||||||
|
finalColor = texelColor*colDiffuse*fragColor;
|
||||||
|
}
|
||||||
34
examples/models/resources/shaders/glsl330/skinning.vs
Normal file
34
examples/models/resources/shaders/glsl330/skinning.vs
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
in vec3 vertexPosition;
|
||||||
|
in vec2 vertexTexCoord;
|
||||||
|
in vec4 vertexColor;
|
||||||
|
in vec4 vertexBoneIds;
|
||||||
|
in vec4 vertexBoneWeights;
|
||||||
|
|
||||||
|
#define MAX_BONE_NUM 128
|
||||||
|
uniform mat4 boneMatrices[MAX_BONE_NUM];
|
||||||
|
|
||||||
|
uniform mat4 mvp;
|
||||||
|
|
||||||
|
out vec2 fragTexCoord;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
int boneIndex0 = int(vertexBoneIds.x);
|
||||||
|
int boneIndex1 = int(vertexBoneIds.y);
|
||||||
|
int boneIndex2 = int(vertexBoneIds.z);
|
||||||
|
int boneIndex3 = int(vertexBoneIds.w);
|
||||||
|
|
||||||
|
vec4 skinnedPosition =
|
||||||
|
vertexBoneWeights.x * (boneMatrices[boneIndex0] * vec4(vertexPosition, 1.0f)) +
|
||||||
|
vertexBoneWeights.y * (boneMatrices[boneIndex1] * vec4(vertexPosition, 1.0f)) +
|
||||||
|
vertexBoneWeights.z * (boneMatrices[boneIndex2] * vec4(vertexPosition, 1.0f)) +
|
||||||
|
vertexBoneWeights.w * (boneMatrices[boneIndex3] * vec4(vertexPosition, 1.0f));
|
||||||
|
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
fragColor = vertexColor;
|
||||||
|
|
||||||
|
gl_Position = mvp * skinnedPosition;
|
||||||
|
}
|
||||||
|
|
@ -41,7 +41,7 @@ OPTIONS:
|
||||||
-f, --format <type> : Define output format for parser data.
|
-f, --format <type> : Define output format for parser data.
|
||||||
Supported types: DEFAULT, JSON, XML, LUA
|
Supported types: DEFAULT, JSON, XML, LUA
|
||||||
|
|
||||||
-d, --define <DEF> : Define functions specifiers (i.e. RLAPI for raylib.h, RMDEF for raymath.h, etc.)
|
-d, --define <DEF> : Define functions specifiers (i.e. RLAPI for raylib.h, RMAPI for raymath.h, etc.)
|
||||||
NOTE: If no specifier defined, defaults to: RLAPI
|
NOTE: If no specifier defined, defaults to: RLAPI
|
||||||
|
|
||||||
-t, --truncate <after> : Define string to truncate input after (i.e. "RLGL IMPLEMENTATION" for rlgl.h)
|
-t, --truncate <after> : Define string to truncate input after (i.e. "RLGL IMPLEMENTATION" for rlgl.h)
|
||||||
|
|
@ -56,7 +56,7 @@ EXAMPLES:
|
||||||
> raylib_parser --output raylib_data.info --format XML
|
> raylib_parser --output raylib_data.info --format XML
|
||||||
Process <raylib.h> to generate <raylib_data.info> as XML text data
|
Process <raylib.h> to generate <raylib_data.info> as XML text data
|
||||||
|
|
||||||
> raylib_parser --input raymath.h --output raymath_data.info --format XML
|
> raylib_parser --input raymath.h --output raymath_data.info --format XML --define RMAPI
|
||||||
Process <raymath.h> to generate <raymath_data.info> as XML text data
|
Process <raymath.h> to generate <raymath_data.info> as XML text data
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -850,12 +850,22 @@
|
||||||
{
|
{
|
||||||
"type": "unsigned char *",
|
"type": "unsigned char *",
|
||||||
"name": "boneIds",
|
"name": "boneIds",
|
||||||
"description": "Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning)"
|
"description": "Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) (shader-location = 6)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "float *",
|
"type": "float *",
|
||||||
"name": "boneWeights",
|
"name": "boneWeights",
|
||||||
"description": "Vertex bone weight, up to 4 bones influence by vertex (skinning)"
|
"description": "Vertex bone weight, up to 4 bones influence by vertex (skinning) (shader-location = 7)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Matrix *",
|
||||||
|
"name": "boneMatrices",
|
||||||
|
"description": "Bones animated transformation matrices"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "boneCount",
|
||||||
|
"description": "Number of bones"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "unsigned int",
|
"type": "unsigned int",
|
||||||
|
|
@ -2518,6 +2528,21 @@
|
||||||
"name": "SHADER_LOC_MAP_BRDF",
|
"name": "SHADER_LOC_MAP_BRDF",
|
||||||
"value": 25,
|
"value": 25,
|
||||||
"description": "Shader location: sampler2d texture: brdf"
|
"description": "Shader location: sampler2d texture: brdf"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SHADER_LOC_VERTEX_BONEIDS",
|
||||||
|
"value": 26,
|
||||||
|
"description": "Shader location: vertex attribute: boneIds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SHADER_LOC_VERTEX_BONEWEIGHTS",
|
||||||
|
"value": 27,
|
||||||
|
"description": "Shader location: vertex attribute: boneWeights"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SHADER_LOC_BONE_MATRICES",
|
||||||
|
"value": 28,
|
||||||
|
"description": "Shader location: array of matrices uniform: boneMatrices"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -3215,12 +3240,12 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ToggleFullscreen",
|
"name": "ToggleFullscreen",
|
||||||
"description": "Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)",
|
"description": "Toggle window state: fullscreen/windowed [resizes monitor to match window resolution] (only PLATFORM_DESKTOP)",
|
||||||
"returnType": "void"
|
"returnType": "void"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ToggleBorderlessWindowed",
|
"name": "ToggleBorderlessWindowed",
|
||||||
"description": "Toggle window state: borderless windowed (only PLATFORM_DESKTOP)",
|
"description": "Toggle window state: borderless windowed [resizes window to match monitor resolution] (only PLATFORM_DESKTOP)",
|
||||||
"returnType": "void"
|
"returnType": "void"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -4477,6 +4502,17 @@
|
||||||
"description": "Get the directory of the running application (uses static string)",
|
"description": "Get the directory of the running application (uses static string)",
|
||||||
"returnType": "const char *"
|
"returnType": "const char *"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "MakeDirectory",
|
||||||
|
"description": "Create directories (including full path requested), returns 0 on success",
|
||||||
|
"returnType": "int",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "const char *",
|
||||||
|
"name": "dirPath"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "ChangeDirectory",
|
"name": "ChangeDirectory",
|
||||||
"description": "Change working directory, return true on success",
|
"description": "Change working directory, return true on success",
|
||||||
|
|
@ -4523,7 +4559,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "LoadDirectoryFilesEx",
|
"name": "LoadDirectoryFilesEx",
|
||||||
"description": "Load directory filepaths with extension filtering and recursive directory scan",
|
"description": "Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result",
|
||||||
"returnType": "FilePathList",
|
"returnType": "FilePathList",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
|
|
@ -5238,7 +5274,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "DrawPixel",
|
"name": "DrawPixel",
|
||||||
"description": "Draw a pixel",
|
"description": "Draw a pixel using geometry [Can be slow, use with care]",
|
||||||
"returnType": "void",
|
"returnType": "void",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
|
|
@ -5257,7 +5293,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "DrawPixelV",
|
"name": "DrawPixelV",
|
||||||
"description": "Draw a pixel (Vector version)",
|
"description": "Draw a pixel using geometry (Vector version) [Can be slow, use with care]",
|
||||||
"returnType": "void",
|
"returnType": "void",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
|
|
@ -8780,6 +8816,25 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "ColorLerp",
|
||||||
|
"description": "Get color lerp interpolation between two colors, factor [0.0f..1.0f]",
|
||||||
|
"returnType": "Color",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Color",
|
||||||
|
"name": "color1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Color",
|
||||||
|
"name": "color2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "factor"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "GetColor",
|
"name": "GetColor",
|
||||||
"description": "Get Color structure from hexadecimal value",
|
"description": "Get Color structure from hexadecimal value",
|
||||||
|
|
@ -8862,7 +8917,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "LoadFontEx",
|
"name": "LoadFontEx",
|
||||||
"description": "Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont",
|
"description": "Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height",
|
||||||
"returnType": "Font",
|
"returnType": "Font",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
|
|
@ -10366,6 +10421,60 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "DrawModelPoints",
|
||||||
|
"description": "Draw a model as points",
|
||||||
|
"returnType": "void",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Model",
|
||||||
|
"name": "model"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Vector3",
|
||||||
|
"name": "position"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "scale"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Color",
|
||||||
|
"name": "tint"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DrawModelPointsEx",
|
||||||
|
"description": "Draw a model as points with extended parameters",
|
||||||
|
"returnType": "void",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Model",
|
||||||
|
"name": "model"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Vector3",
|
||||||
|
"name": "position"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Vector3",
|
||||||
|
"name": "rotationAxis"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "rotationAngle"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Vector3",
|
||||||
|
"name": "scale"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Color",
|
||||||
|
"name": "tint"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "DrawBoundingBox",
|
"name": "DrawBoundingBox",
|
||||||
"description": "Draw bounding box (wires)",
|
"description": "Draw bounding box (wires)",
|
||||||
|
|
@ -10993,6 +11102,25 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "UpdateModelAnimationBoneMatrices",
|
||||||
|
"description": "Update model animation mesh bone matrices (Note GPU skinning does not work on Mac)",
|
||||||
|
"returnType": "void",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Model",
|
||||||
|
"name": "model"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ModelAnimation",
|
||||||
|
"name": "anim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "frame"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "CheckCollisionSpheres",
|
"name": "CheckCollisionSpheres",
|
||||||
"description": "Check collision between two spheres",
|
"description": "Check collision between two spheres",
|
||||||
|
|
|
||||||
|
|
@ -850,12 +850,22 @@ return {
|
||||||
{
|
{
|
||||||
type = "unsigned char *",
|
type = "unsigned char *",
|
||||||
name = "boneIds",
|
name = "boneIds",
|
||||||
description = "Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning)"
|
description = "Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) (shader-location = 6)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "float *",
|
type = "float *",
|
||||||
name = "boneWeights",
|
name = "boneWeights",
|
||||||
description = "Vertex bone weight, up to 4 bones influence by vertex (skinning)"
|
description = "Vertex bone weight, up to 4 bones influence by vertex (skinning) (shader-location = 7)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "Matrix *",
|
||||||
|
name = "boneMatrices",
|
||||||
|
description = "Bones animated transformation matrices"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "int",
|
||||||
|
name = "boneCount",
|
||||||
|
description = "Number of bones"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "unsigned int",
|
type = "unsigned int",
|
||||||
|
|
@ -2518,6 +2528,21 @@ return {
|
||||||
name = "SHADER_LOC_MAP_BRDF",
|
name = "SHADER_LOC_MAP_BRDF",
|
||||||
value = 25,
|
value = 25,
|
||||||
description = "Shader location: sampler2d texture: brdf"
|
description = "Shader location: sampler2d texture: brdf"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "SHADER_LOC_VERTEX_BONEIDS",
|
||||||
|
value = 26,
|
||||||
|
description = "Shader location: vertex attribute: boneIds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "SHADER_LOC_VERTEX_BONEWEIGHTS",
|
||||||
|
value = 27,
|
||||||
|
description = "Shader location: vertex attribute: boneWeights"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "SHADER_LOC_BONE_MATRICES",
|
||||||
|
value = 28,
|
||||||
|
description = "Shader location: array of matrices uniform: boneMatrices"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -3158,12 +3183,12 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "ToggleFullscreen",
|
name = "ToggleFullscreen",
|
||||||
description = "Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)",
|
description = "Toggle window state: fullscreen/windowed [resizes monitor to match window resolution] (only PLATFORM_DESKTOP)",
|
||||||
returnType = "void"
|
returnType = "void"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "ToggleBorderlessWindowed",
|
name = "ToggleBorderlessWindowed",
|
||||||
description = "Toggle window state: borderless windowed (only PLATFORM_DESKTOP)",
|
description = "Toggle window state: borderless windowed [resizes window to match monitor resolution] (only PLATFORM_DESKTOP)",
|
||||||
returnType = "void"
|
returnType = "void"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -4042,6 +4067,14 @@ return {
|
||||||
description = "Get the directory of the running application (uses static string)",
|
description = "Get the directory of the running application (uses static string)",
|
||||||
returnType = "const char *"
|
returnType = "const char *"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "MakeDirectory",
|
||||||
|
description = "Create directories (including full path requested), returns 0 on success",
|
||||||
|
returnType = "int",
|
||||||
|
params = {
|
||||||
|
{type = "const char *", name = "dirPath"}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name = "ChangeDirectory",
|
name = "ChangeDirectory",
|
||||||
description = "Change working directory, return true on success",
|
description = "Change working directory, return true on success",
|
||||||
|
|
@ -4076,7 +4109,7 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "LoadDirectoryFilesEx",
|
name = "LoadDirectoryFilesEx",
|
||||||
description = "Load directory filepaths with extension filtering and recursive directory scan",
|
description = "Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result",
|
||||||
returnType = "FilePathList",
|
returnType = "FilePathList",
|
||||||
params = {
|
params = {
|
||||||
{type = "const char *", name = "basePath"},
|
{type = "const char *", name = "basePath"},
|
||||||
|
|
@ -4581,7 +4614,7 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "DrawPixel",
|
name = "DrawPixel",
|
||||||
description = "Draw a pixel",
|
description = "Draw a pixel using geometry [Can be slow, use with care]",
|
||||||
returnType = "void",
|
returnType = "void",
|
||||||
params = {
|
params = {
|
||||||
{type = "int", name = "posX"},
|
{type = "int", name = "posX"},
|
||||||
|
|
@ -4591,7 +4624,7 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "DrawPixelV",
|
name = "DrawPixelV",
|
||||||
description = "Draw a pixel (Vector version)",
|
description = "Draw a pixel using geometry (Vector version) [Can be slow, use with care]",
|
||||||
returnType = "void",
|
returnType = "void",
|
||||||
params = {
|
params = {
|
||||||
{type = "Vector2", name = "position"},
|
{type = "Vector2", name = "position"},
|
||||||
|
|
@ -6377,6 +6410,16 @@ return {
|
||||||
{type = "Color", name = "tint"}
|
{type = "Color", name = "tint"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "ColorLerp",
|
||||||
|
description = "Get color lerp interpolation between two colors, factor [0.0f..1.0f]",
|
||||||
|
returnType = "Color",
|
||||||
|
params = {
|
||||||
|
{type = "Color", name = "color1"},
|
||||||
|
{type = "Color", name = "color2"},
|
||||||
|
{type = "float", name = "factor"}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name = "GetColor",
|
name = "GetColor",
|
||||||
description = "Get Color structure from hexadecimal value",
|
description = "Get Color structure from hexadecimal value",
|
||||||
|
|
@ -6429,7 +6472,7 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "LoadFontEx",
|
name = "LoadFontEx",
|
||||||
description = "Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont",
|
description = "Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height",
|
||||||
returnType = "Font",
|
returnType = "Font",
|
||||||
params = {
|
params = {
|
||||||
{type = "const char *", name = "fileName"},
|
{type = "const char *", name = "fileName"},
|
||||||
|
|
@ -7213,6 +7256,30 @@ return {
|
||||||
{type = "Color", name = "tint"}
|
{type = "Color", name = "tint"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "DrawModelPoints",
|
||||||
|
description = "Draw a model as points",
|
||||||
|
returnType = "void",
|
||||||
|
params = {
|
||||||
|
{type = "Model", name = "model"},
|
||||||
|
{type = "Vector3", name = "position"},
|
||||||
|
{type = "float", name = "scale"},
|
||||||
|
{type = "Color", name = "tint"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "DrawModelPointsEx",
|
||||||
|
description = "Draw a model as points with extended parameters",
|
||||||
|
returnType = "void",
|
||||||
|
params = {
|
||||||
|
{type = "Model", name = "model"},
|
||||||
|
{type = "Vector3", name = "position"},
|
||||||
|
{type = "Vector3", name = "rotationAxis"},
|
||||||
|
{type = "float", name = "rotationAngle"},
|
||||||
|
{type = "Vector3", name = "scale"},
|
||||||
|
{type = "Color", name = "tint"}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name = "DrawBoundingBox",
|
name = "DrawBoundingBox",
|
||||||
description = "Draw bounding box (wires)",
|
description = "Draw bounding box (wires)",
|
||||||
|
|
@ -7552,6 +7619,16 @@ return {
|
||||||
{type = "ModelAnimation", name = "anim"}
|
{type = "ModelAnimation", name = "anim"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "UpdateModelAnimationBoneMatrices",
|
||||||
|
description = "Update model animation mesh bone matrices (Note GPU skinning does not work on Mac)",
|
||||||
|
returnType = "void",
|
||||||
|
params = {
|
||||||
|
{type = "Model", name = "model"},
|
||||||
|
{type = "ModelAnimation", name = "anim"},
|
||||||
|
{type = "int", name = "frame"}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name = "CheckCollisionSpheres",
|
name = "CheckCollisionSpheres",
|
||||||
description = "Check collision between two spheres",
|
description = "Check collision between two spheres",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -160,7 +160,7 @@
|
||||||
<Field type="float" name="rotation" desc="Camera rotation in degrees" />
|
<Field type="float" name="rotation" desc="Camera rotation in degrees" />
|
||||||
<Field type="float" name="zoom" desc="Camera zoom (scaling), should be 1.0f by default" />
|
<Field type="float" name="zoom" desc="Camera zoom (scaling), should be 1.0f by default" />
|
||||||
</Struct>
|
</Struct>
|
||||||
<Struct name="Mesh" fieldCount="15" desc="Mesh, vertex data and vao/vbo">
|
<Struct name="Mesh" fieldCount="17" desc="Mesh, vertex data and vao/vbo">
|
||||||
<Field type="int" name="vertexCount" desc="Number of vertices stored in arrays" />
|
<Field type="int" name="vertexCount" desc="Number of vertices stored in arrays" />
|
||||||
<Field type="int" name="triangleCount" desc="Number of triangles stored (indexed or not)" />
|
<Field type="int" name="triangleCount" desc="Number of triangles stored (indexed or not)" />
|
||||||
<Field type="float *" name="vertices" desc="Vertex position (XYZ - 3 components per vertex) (shader-location = 0)" />
|
<Field type="float *" name="vertices" desc="Vertex position (XYZ - 3 components per vertex) (shader-location = 0)" />
|
||||||
|
|
@ -172,8 +172,10 @@
|
||||||
<Field type="unsigned short *" name="indices" desc="Vertex indices (in case vertex data comes indexed)" />
|
<Field type="unsigned short *" name="indices" desc="Vertex indices (in case vertex data comes indexed)" />
|
||||||
<Field type="float *" name="animVertices" desc="Animated vertex positions (after bones transformations)" />
|
<Field type="float *" name="animVertices" desc="Animated vertex positions (after bones transformations)" />
|
||||||
<Field type="float *" name="animNormals" desc="Animated normals (after bones transformations)" />
|
<Field type="float *" name="animNormals" desc="Animated normals (after bones transformations)" />
|
||||||
<Field type="unsigned char *" name="boneIds" desc="Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning)" />
|
<Field type="unsigned char *" name="boneIds" desc="Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) (shader-location = 6)" />
|
||||||
<Field type="float *" name="boneWeights" desc="Vertex bone weight, up to 4 bones influence by vertex (skinning)" />
|
<Field type="float *" name="boneWeights" desc="Vertex bone weight, up to 4 bones influence by vertex (skinning) (shader-location = 7)" />
|
||||||
|
<Field type="Matrix *" name="boneMatrices" desc="Bones animated transformation matrices" />
|
||||||
|
<Field type="int" name="boneCount" desc="Number of bones" />
|
||||||
<Field type="unsigned int" name="vaoId" desc="OpenGL Vertex Array Object id" />
|
<Field type="unsigned int" name="vaoId" desc="OpenGL Vertex Array Object id" />
|
||||||
<Field type="unsigned int *" name="vboId" desc="OpenGL Vertex Buffer Objects id (default vertex data)" />
|
<Field type="unsigned int *" name="vboId" desc="OpenGL Vertex Buffer Objects id (default vertex data)" />
|
||||||
</Struct>
|
</Struct>
|
||||||
|
|
@ -505,7 +507,7 @@
|
||||||
<Value name="MATERIAL_MAP_PREFILTER" integer="9" desc="Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" />
|
<Value name="MATERIAL_MAP_PREFILTER" integer="9" desc="Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" />
|
||||||
<Value name="MATERIAL_MAP_BRDF" integer="10" desc="Brdf material" />
|
<Value name="MATERIAL_MAP_BRDF" integer="10" desc="Brdf material" />
|
||||||
</Enum>
|
</Enum>
|
||||||
<Enum name="ShaderLocationIndex" valueCount="26" desc="Shader location index">
|
<Enum name="ShaderLocationIndex" valueCount="29" desc="Shader location index">
|
||||||
<Value name="SHADER_LOC_VERTEX_POSITION" integer="0" desc="Shader location: vertex attribute: position" />
|
<Value name="SHADER_LOC_VERTEX_POSITION" integer="0" desc="Shader location: vertex attribute: position" />
|
||||||
<Value name="SHADER_LOC_VERTEX_TEXCOORD01" integer="1" desc="Shader location: vertex attribute: texcoord01" />
|
<Value name="SHADER_LOC_VERTEX_TEXCOORD01" integer="1" desc="Shader location: vertex attribute: texcoord01" />
|
||||||
<Value name="SHADER_LOC_VERTEX_TEXCOORD02" integer="2" desc="Shader location: vertex attribute: texcoord02" />
|
<Value name="SHADER_LOC_VERTEX_TEXCOORD02" integer="2" desc="Shader location: vertex attribute: texcoord02" />
|
||||||
|
|
@ -532,6 +534,9 @@
|
||||||
<Value name="SHADER_LOC_MAP_IRRADIANCE" integer="23" desc="Shader location: samplerCube texture: irradiance" />
|
<Value name="SHADER_LOC_MAP_IRRADIANCE" integer="23" desc="Shader location: samplerCube texture: irradiance" />
|
||||||
<Value name="SHADER_LOC_MAP_PREFILTER" integer="24" desc="Shader location: samplerCube texture: prefilter" />
|
<Value name="SHADER_LOC_MAP_PREFILTER" integer="24" desc="Shader location: samplerCube texture: prefilter" />
|
||||||
<Value name="SHADER_LOC_MAP_BRDF" integer="25" desc="Shader location: sampler2d texture: brdf" />
|
<Value name="SHADER_LOC_MAP_BRDF" integer="25" desc="Shader location: sampler2d texture: brdf" />
|
||||||
|
<Value name="SHADER_LOC_VERTEX_BONEIDS" integer="26" desc="Shader location: vertex attribute: boneIds" />
|
||||||
|
<Value name="SHADER_LOC_VERTEX_BONEWEIGHTS" integer="27" desc="Shader location: vertex attribute: boneWeights" />
|
||||||
|
<Value name="SHADER_LOC_BONE_MATRICES" integer="28" desc="Shader location: array of matrices uniform: boneMatrices" />
|
||||||
</Enum>
|
</Enum>
|
||||||
<Enum name="ShaderUniformDataType" valueCount="9" desc="Shader uniform data type">
|
<Enum name="ShaderUniformDataType" valueCount="9" desc="Shader uniform data type">
|
||||||
<Value name="SHADER_UNIFORM_FLOAT" integer="0" desc="Shader uniform type: float" />
|
<Value name="SHADER_UNIFORM_FLOAT" integer="0" desc="Shader uniform type: float" />
|
||||||
|
|
@ -670,7 +675,7 @@
|
||||||
<Param type="unsigned int" name="frames" desc="" />
|
<Param type="unsigned int" name="frames" desc="" />
|
||||||
</Callback>
|
</Callback>
|
||||||
</Callbacks>
|
</Callbacks>
|
||||||
<Functions count="573">
|
<Functions count="578">
|
||||||
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
||||||
<Param type="int" name="width" desc="" />
|
<Param type="int" name="width" desc="" />
|
||||||
<Param type="int" name="height" desc="" />
|
<Param type="int" name="height" desc="" />
|
||||||
|
|
@ -703,9 +708,9 @@
|
||||||
<Function name="ClearWindowState" retType="void" paramCount="1" desc="Clear window configuration state flags">
|
<Function name="ClearWindowState" retType="void" paramCount="1" desc="Clear window configuration state flags">
|
||||||
<Param type="unsigned int" name="flags" desc="" />
|
<Param type="unsigned int" name="flags" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="ToggleFullscreen" retType="void" paramCount="0" desc="Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)">
|
<Function name="ToggleFullscreen" retType="void" paramCount="0" desc="Toggle window state: fullscreen/windowed [resizes monitor to match window resolution] (only PLATFORM_DESKTOP)">
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="ToggleBorderlessWindowed" retType="void" paramCount="0" desc="Toggle window state: borderless windowed (only PLATFORM_DESKTOP)">
|
<Function name="ToggleBorderlessWindowed" retType="void" paramCount="0" desc="Toggle window state: borderless windowed [resizes window to match monitor resolution] (only PLATFORM_DESKTOP)">
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="MaximizeWindow" retType="void" paramCount="0" desc="Set window state: maximized, if resizable (only PLATFORM_DESKTOP)">
|
<Function name="MaximizeWindow" retType="void" paramCount="0" desc="Set window state: maximized, if resizable (only PLATFORM_DESKTOP)">
|
||||||
</Function>
|
</Function>
|
||||||
|
|
@ -1069,6 +1074,9 @@
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="GetApplicationDirectory" retType="const char *" paramCount="0" desc="Get the directory of the running application (uses static string)">
|
<Function name="GetApplicationDirectory" retType="const char *" paramCount="0" desc="Get the directory of the running application (uses static string)">
|
||||||
</Function>
|
</Function>
|
||||||
|
<Function name="MakeDirectory" retType="int" paramCount="1" desc="Create directories (including full path requested), returns 0 on success">
|
||||||
|
<Param type="const char *" name="dirPath" desc="" />
|
||||||
|
</Function>
|
||||||
<Function name="ChangeDirectory" retType="bool" paramCount="1" desc="Change working directory, return true on success">
|
<Function name="ChangeDirectory" retType="bool" paramCount="1" desc="Change working directory, return true on success">
|
||||||
<Param type="const char *" name="dir" desc="" />
|
<Param type="const char *" name="dir" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
|
@ -1081,7 +1089,7 @@
|
||||||
<Function name="LoadDirectoryFiles" retType="FilePathList" paramCount="1" desc="Load directory filepaths">
|
<Function name="LoadDirectoryFiles" retType="FilePathList" paramCount="1" desc="Load directory filepaths">
|
||||||
<Param type="const char *" name="dirPath" desc="" />
|
<Param type="const char *" name="dirPath" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="LoadDirectoryFilesEx" retType="FilePathList" paramCount="3" desc="Load directory filepaths with extension filtering and recursive directory scan">
|
<Function name="LoadDirectoryFilesEx" retType="FilePathList" paramCount="3" desc="Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result">
|
||||||
<Param type="const char *" name="basePath" desc="" />
|
<Param type="const char *" name="basePath" desc="" />
|
||||||
<Param type="const char *" name="filter" desc="" />
|
<Param type="const char *" name="filter" desc="" />
|
||||||
<Param type="bool" name="scanSubdirs" desc="" />
|
<Param type="bool" name="scanSubdirs" desc="" />
|
||||||
|
|
@ -1289,12 +1297,12 @@
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="GetShapesTextureRectangle" retType="Rectangle" paramCount="0" desc="Get texture source rectangle that is used for shapes drawing">
|
<Function name="GetShapesTextureRectangle" retType="Rectangle" paramCount="0" desc="Get texture source rectangle that is used for shapes drawing">
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="DrawPixel" retType="void" paramCount="3" desc="Draw a pixel">
|
<Function name="DrawPixel" retType="void" paramCount="3" desc="Draw a pixel using geometry [Can be slow, use with care]">
|
||||||
<Param type="int" name="posX" desc="" />
|
<Param type="int" name="posX" desc="" />
|
||||||
<Param type="int" name="posY" desc="" />
|
<Param type="int" name="posY" desc="" />
|
||||||
<Param type="Color" name="color" desc="" />
|
<Param type="Color" name="color" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="DrawPixelV" retType="void" paramCount="2" desc="Draw a pixel (Vector version)">
|
<Function name="DrawPixelV" retType="void" paramCount="2" desc="Draw a pixel using geometry (Vector version) [Can be slow, use with care]">
|
||||||
<Param type="Vector2" name="position" desc="" />
|
<Param type="Vector2" name="position" desc="" />
|
||||||
<Param type="Color" name="color" desc="" />
|
<Param type="Color" name="color" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
|
@ -2219,6 +2227,11 @@
|
||||||
<Param type="Color" name="src" desc="" />
|
<Param type="Color" name="src" desc="" />
|
||||||
<Param type="Color" name="tint" desc="" />
|
<Param type="Color" name="tint" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
<Function name="ColorLerp" retType="Color" paramCount="3" desc="Get color lerp interpolation between two colors, factor [0.0f..1.0f]">
|
||||||
|
<Param type="Color" name="color1" desc="" />
|
||||||
|
<Param type="Color" name="color2" desc="" />
|
||||||
|
<Param type="float" name="factor" desc="" />
|
||||||
|
</Function>
|
||||||
<Function name="GetColor" retType="Color" paramCount="1" desc="Get Color structure from hexadecimal value">
|
<Function name="GetColor" retType="Color" paramCount="1" desc="Get Color structure from hexadecimal value">
|
||||||
<Param type="unsigned int" name="hexValue" desc="" />
|
<Param type="unsigned int" name="hexValue" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
|
@ -2241,7 +2254,7 @@
|
||||||
<Function name="LoadFont" retType="Font" paramCount="1" desc="Load font from file into GPU memory (VRAM)">
|
<Function name="LoadFont" retType="Font" paramCount="1" desc="Load font from file into GPU memory (VRAM)">
|
||||||
<Param type="const char *" name="fileName" desc="" />
|
<Param type="const char *" name="fileName" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="LoadFontEx" retType="Font" paramCount="4" desc="Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont">
|
<Function name="LoadFontEx" retType="Font" paramCount="4" desc="Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height">
|
||||||
<Param type="const char *" name="fileName" desc="" />
|
<Param type="const char *" name="fileName" desc="" />
|
||||||
<Param type="int" name="fontSize" desc="" />
|
<Param type="int" name="fontSize" desc="" />
|
||||||
<Param type="int *" name="codepoints" desc="" />
|
<Param type="int *" name="codepoints" desc="" />
|
||||||
|
|
@ -2637,6 +2650,20 @@
|
||||||
<Param type="Vector3" name="scale" desc="" />
|
<Param type="Vector3" name="scale" desc="" />
|
||||||
<Param type="Color" name="tint" desc="" />
|
<Param type="Color" name="tint" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
<Function name="DrawModelPoints" retType="void" paramCount="4" desc="Draw a model as points">
|
||||||
|
<Param type="Model" name="model" desc="" />
|
||||||
|
<Param type="Vector3" name="position" desc="" />
|
||||||
|
<Param type="float" name="scale" desc="" />
|
||||||
|
<Param type="Color" name="tint" desc="" />
|
||||||
|
</Function>
|
||||||
|
<Function name="DrawModelPointsEx" retType="void" paramCount="6" desc="Draw a model as points with extended parameters">
|
||||||
|
<Param type="Model" name="model" desc="" />
|
||||||
|
<Param type="Vector3" name="position" desc="" />
|
||||||
|
<Param type="Vector3" name="rotationAxis" desc="" />
|
||||||
|
<Param type="float" name="rotationAngle" desc="" />
|
||||||
|
<Param type="Vector3" name="scale" desc="" />
|
||||||
|
<Param type="Color" name="tint" desc="" />
|
||||||
|
</Function>
|
||||||
<Function name="DrawBoundingBox" retType="void" paramCount="2" desc="Draw bounding box (wires)">
|
<Function name="DrawBoundingBox" retType="void" paramCount="2" desc="Draw bounding box (wires)">
|
||||||
<Param type="BoundingBox" name="box" desc="" />
|
<Param type="BoundingBox" name="box" desc="" />
|
||||||
<Param type="Color" name="color" desc="" />
|
<Param type="Color" name="color" desc="" />
|
||||||
|
|
@ -2803,6 +2830,11 @@
|
||||||
<Param type="Model" name="model" desc="" />
|
<Param type="Model" name="model" desc="" />
|
||||||
<Param type="ModelAnimation" name="anim" desc="" />
|
<Param type="ModelAnimation" name="anim" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
<Function name="UpdateModelAnimationBoneMatrices" retType="void" paramCount="3" desc="Update model animation mesh bone matrices (Note GPU skinning does not work on Mac)">
|
||||||
|
<Param type="Model" name="model" desc="" />
|
||||||
|
<Param type="ModelAnimation" name="anim" desc="" />
|
||||||
|
<Param type="int" name="frame" desc="" />
|
||||||
|
</Function>
|
||||||
<Function name="CheckCollisionSpheres" retType="bool" paramCount="4" desc="Check collision between two spheres">
|
<Function name="CheckCollisionSpheres" retType="bool" paramCount="4" desc="Check collision between two spheres">
|
||||||
<Param type="Vector3" name="center1" desc="" />
|
<Param type="Vector3" name="center1" desc="" />
|
||||||
<Param type="float" name="radius1" desc="" />
|
<Param type="float" name="radius1" desc="" />
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
#define MAX_CALLBACKS_TO_PARSE 64 // Maximum number of callbacks to parse
|
#define MAX_CALLBACKS_TO_PARSE 64 // Maximum number of callbacks to parse
|
||||||
#define MAX_FUNCS_TO_PARSE 1024 // Maximum number of functions to parse
|
#define MAX_FUNCS_TO_PARSE 1024 // Maximum number of functions to parse
|
||||||
|
|
||||||
#define MAX_LINE_LENGTH 512 // Maximum length of one line (including comments)
|
#define MAX_LINE_LENGTH 1024 // Maximum length of one line (including comments)
|
||||||
|
|
||||||
#define MAX_STRUCT_FIELDS 64 // Maximum number of struct fields
|
#define MAX_STRUCT_FIELDS 64 // Maximum number of struct fields
|
||||||
#define MAX_ENUM_VALUES 512 // Maximum number of enum values
|
#define MAX_ENUM_VALUES 512 // Maximum number of enum values
|
||||||
|
|
@ -139,7 +139,7 @@ typedef struct EnumInfo {
|
||||||
// Function info data
|
// Function info data
|
||||||
typedef struct FunctionInfo {
|
typedef struct FunctionInfo {
|
||||||
char name[64]; // Function name
|
char name[64]; // Function name
|
||||||
char desc[128]; // Function description (comment at the end)
|
char desc[512]; // Function description (comment at the end)
|
||||||
char retType[32]; // Return value type
|
char retType[32]; // Return value type
|
||||||
int paramCount; // Number of function parameters
|
int paramCount; // Number of function parameters
|
||||||
char paramType[MAX_FUNCTION_PARAMETERS][32]; // Parameters type
|
char paramType[MAX_FUNCTION_PARAMETERS][32]; // Parameters type
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ if (NOT raylib_FOUND) # If there's none, fetch and build raylib
|
||||||
FetchContent_GetProperties(raylib)
|
FetchContent_GetProperties(raylib)
|
||||||
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
|
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
|
||||||
set(FETCHCONTENT_QUIET NO)
|
set(FETCHCONTENT_QUIET NO)
|
||||||
FetchContent_Populate(raylib)
|
FetchContent_MakeAvailable(raylib)
|
||||||
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
|
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
|
||||||
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
@ -31,8 +30,8 @@ target_link_libraries(${PROJECT_NAME} raylib)
|
||||||
|
|
||||||
# Web Configurations
|
# Web Configurations
|
||||||
if (${PLATFORM} STREQUAL "Web")
|
if (${PLATFORM} STREQUAL "Web")
|
||||||
# Tell Emscripten to build an example.html file.
|
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html") # Tell Emscripten to build an example.html file.
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY -s GL_ENABLE_GET_PROC_ADDRESS=1")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Checks if OSX and links appropriate frameworks (Only required on MacOS)
|
# Checks if OSX and links appropriate frameworks (Only required on MacOS)
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,6 @@ Compiling for the web requires the [Emscripten SDK](https://emscripten.org/docs/
|
||||||
``` bash
|
``` bash
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
emcmake cmake .. -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-s USE_GLFW=3" -DCMAKE_EXECUTABLE_SUFFIX=".html"
|
emcmake cmake .. -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXECUTABLE_SUFFIX=".html"
|
||||||
emmake make
|
emmake make
|
||||||
```
|
```
|
||||||
|
|
|
||||||
387
projects/VS2022/examples/models_gpu_skinning.vcxproj
Normal file
387
projects/VS2022/examples/models_gpu_skinning.vcxproj
Normal file
|
|
@ -0,0 +1,387 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug.DLL|Win32">
|
||||||
|
<Configuration>Debug.DLL</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug.DLL|x64">
|
||||||
|
<Configuration>Debug.DLL</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release.DLL|Win32">
|
||||||
|
<Configuration>Release.DLL</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release.DLL|x64">
|
||||||
|
<Configuration>Release.DLL</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{8245DAD9-D402-4D5C-8F45-32229CD3B263}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>models_loading</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
<ProjectName>models_gpu_skinning</ProjectName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\models</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\models</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\models</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\models</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\models</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\models</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\models</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\models</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalOptions>/FS %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
<Message>Copy Debug DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
<Message>Copy Debug DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Message>Copy Release DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Message>Copy Release DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\examples\models\models_gpu_skinning.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\raylib\raylib.vcxproj">
|
||||||
|
<Project>{e89d61ac-55de-4482-afd4-df7242ebc859}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -299,6 +299,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_splines_drawing", "e
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_top_down_lights", "examples\shapes_top_down_lights.vcxproj", "{703BE7BA-5B99-4F70-806D-3A259F6A991E}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_top_down_lights", "examples\shapes_top_down_lights.vcxproj", "{703BE7BA-5B99-4F70-806D-3A259F6A991E}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_gpu_skinning", "examples\models_gpu_skinning.vcxproj", "{8245DAD9-D402-4D5C-8F45-32229CD3B263}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug.DLL|x64 = Debug.DLL|x64
|
Debug.DLL|x64 = Debug.DLL|x64
|
||||||
|
|
@ -2531,6 +2533,22 @@ Global
|
||||||
{703BE7BA-5B99-4F70-806D-3A259F6A991E}.Release|x64.Build.0 = Release|x64
|
{703BE7BA-5B99-4F70-806D-3A259F6A991E}.Release|x64.Build.0 = Release|x64
|
||||||
{703BE7BA-5B99-4F70-806D-3A259F6A991E}.Release|x86.ActiveCfg = Release|Win32
|
{703BE7BA-5B99-4F70-806D-3A259F6A991E}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{703BE7BA-5B99-4F70-806D-3A259F6A991E}.Release|x86.Build.0 = Release|Win32
|
{703BE7BA-5B99-4F70-806D-3A259F6A991E}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Debug.DLL|x64.Build.0 = Debug.DLL|x64
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Release.DLL|x64.ActiveCfg = Release.DLL|x64
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Release.DLL|x64.Build.0 = Release.DLL|x64
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Release.DLL|x86.Build.0 = Release.DLL|Win32
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Release|x64.Build.0 = Release|x64
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -2682,6 +2700,7 @@ Global
|
||||||
{D8026C60-CCBC-45DF-9085-BF21569EB414} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE}
|
{D8026C60-CCBC-45DF-9085-BF21569EB414} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE}
|
||||||
{DF25E545-00FF-4E64-844C-7DF98991F901} = {278D8859-20B1-428F-8448-064F46E1F021}
|
{DF25E545-00FF-4E64-844C-7DF98991F901} = {278D8859-20B1-428F-8448-064F46E1F021}
|
||||||
{703BE7BA-5B99-4F70-806D-3A259F6A991E} = {278D8859-20B1-428F-8448-064F46E1F021}
|
{703BE7BA-5B99-4F70-806D-3A259F6A991E} = {278D8859-20B1-428F-8448-064F46E1F021}
|
||||||
|
{8245DAD9-D402-4D5C-8F45-32229CD3B263} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {E926C768-6307-4423-A1EC-57E95B1FAB29}
|
SolutionGuid = {E926C768-6307-4423-A1EC-57E95B1FAB29}
|
||||||
|
|
|
||||||
26
src/config.h
26
src/config.h
|
|
@ -113,12 +113,24 @@
|
||||||
#define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance
|
#define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance
|
||||||
|
|
||||||
// Default shader vertex attribute locations
|
// Default shader vertex attribute locations
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
|
||||||
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
|
||||||
|
|
||||||
|
// The mac OpenGL drivers do not support more than 8 VBOs, so we can't support GPU animations
|
||||||
|
#ifndef __APPLE__
|
||||||
|
#define RL_SUPPORT_MESH_ANIMATION_VBO
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
||||||
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS 7
|
||||||
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Default shader vertex attribute names to set location points
|
// Default shader vertex attribute names to set location points
|
||||||
// NOTE: When a new shader is loaded, the following locations are tried to be set for convenience
|
// NOTE: When a new shader is loaded, the following locations are tried to be set for convenience
|
||||||
|
|
@ -225,7 +237,7 @@
|
||||||
// rmodels: Configuration values
|
// rmodels: Configuration values
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
#define MAX_MATERIAL_MAPS 12 // Maximum number of shader maps supported
|
#define MAX_MATERIAL_MAPS 12 // Maximum number of shader maps supported
|
||||||
#define MAX_MESH_VERTEX_BUFFERS 7 // Maximum vertex buffers (VBO) per mesh
|
#define MAX_MESH_VERTEX_BUFFERS 9 // Maximum vertex buffers (VBO) per mesh
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Module: raudio - Configuration Flags
|
// Module: raudio - Configuration Flags
|
||||||
|
|
|
||||||
4
src/external/RGFW.h
vendored
4
src/external/RGFW.h
vendored
|
|
@ -4999,7 +4999,9 @@ static const struct wl_callback_listener wl_surface_frame_listener = {
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define OEMRESOURCE
|
#define OEMRESOURCE
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
__declspec(dllimport) int __stdcall WideCharToMultiByte( UINT CodePage, DWORD dwFlags, const WCHAR* lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCCH lpDefaultChar, LPBOOL lpUsedDefaultChar);
|
||||||
|
|
||||||
#include <processthreadsapi.h>
|
#include <processthreadsapi.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
|
||||||
1
src/external/glfw/src/mappings.h
vendored
1
src/external/glfw/src/mappings.h
vendored
|
|
@ -996,6 +996,7 @@ const char* _glfwDefaultMappings[] =
|
||||||
"03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,",
|
"03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,",
|
||||||
"03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,",
|
"03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,",
|
||||||
"03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,",
|
"03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,",
|
||||||
|
"03000000af1e00002400000010010000,Clockwork Pi DevTerm,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,start:b9,x:b3,y:b0,platform:Linux,",
|
||||||
#endif // GLFW_BUILD_LINUX_JOYSTICK
|
#endif // GLFW_BUILD_LINUX_JOYSTICK
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
2
src/external/par_shapes.h
vendored
2
src/external/par_shapes.h
vendored
|
|
@ -1130,7 +1130,7 @@ static par_shapes__rule* par_shapes__pick_rule(const char* name,
|
||||||
total += rule->weight;
|
total += rule->weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float r = (float) rand() / RAND_MAX;
|
float r = (float) rand() / (float) RAND_MAX;
|
||||||
float t = 0;
|
float t = 0;
|
||||||
for (int i = 0; i < nrules; i++) {
|
for (int i = 0; i < nrules; i++) {
|
||||||
rule = rules + i;
|
rule = rules + i;
|
||||||
|
|
|
||||||
1657
src/external/stb_image_resize2.h
vendored
1657
src/external/stb_image_resize2.h
vendored
File diff suppressed because it is too large
Load Diff
|
|
@ -74,7 +74,7 @@ typedef struct {
|
||||||
// Global Variables Definition
|
// Global Variables Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
extern CoreData CORE; // Global CORE state context
|
extern CoreData CORE; // Global CORE state context
|
||||||
|
extern bool isGpuReady; // Flag to note GPU has been initialized successfully
|
||||||
static PlatformData platform = { 0 }; // Platform specific data
|
static PlatformData platform = { 0 }; // Platform specific data
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -281,14 +281,15 @@ void android_main(struct android_app *app)
|
||||||
// Request to end the native activity
|
// Request to end the native activity
|
||||||
ANativeActivity_finish(app->activity);
|
ANativeActivity_finish(app->activity);
|
||||||
|
|
||||||
// Android ALooper_pollAll() variables
|
// Android ALooper_pollOnce() variables
|
||||||
int pollResult = 0;
|
int pollResult = 0;
|
||||||
int pollEvents = 0;
|
int pollEvents = 0;
|
||||||
|
|
||||||
// Waiting for application events before complete finishing
|
// Waiting for application events before complete finishing
|
||||||
while (!app->destroyRequested)
|
while (!app->destroyRequested)
|
||||||
{
|
{
|
||||||
while ((pollResult = ALooper_pollAll(0, NULL, &pollEvents, (void **)&platform.source)) >= 0)
|
// Poll all events until we reach return value TIMEOUT, meaning no events left to process
|
||||||
|
while ((pollResult = ALooper_pollOnce(0, NULL, &pollEvents, (void **)&platform.source)) > ALOOPER_POLL_TIMEOUT)
|
||||||
{
|
{
|
||||||
if (platform.source != NULL) platform.source->process(app, platform.source);
|
if (platform.source != NULL) platform.source->process(app, platform.source);
|
||||||
}
|
}
|
||||||
|
|
@ -682,22 +683,23 @@ void PollInputEvents(void)
|
||||||
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Android ALooper_pollAll() variables
|
// Android ALooper_pollOnce() variables
|
||||||
int pollResult = 0;
|
int pollResult = 0;
|
||||||
int pollEvents = 0;
|
int pollEvents = 0;
|
||||||
|
|
||||||
// Poll Events (registered events)
|
// Poll Events (registered events) until we reach TIMEOUT which indicates there are no events left to poll
|
||||||
// NOTE: Activity is paused if not enabled (platform.appEnabled)
|
// NOTE: Activity is paused if not enabled (platform.appEnabled)
|
||||||
while ((pollResult = ALooper_pollAll(platform.appEnabled? 0 : -1, NULL, &pollEvents, (void**)&platform.source)) >= 0)
|
while ((pollResult = ALooper_pollOnce(platform.appEnabled? 0 : -1, NULL, &pollEvents, (void**)&platform.source)) > ALOOPER_POLL_TIMEOUT)
|
||||||
{
|
{
|
||||||
// Process this event
|
// Process this event
|
||||||
if (platform.source != NULL) platform.source->process(platform.app, platform.source);
|
if (platform.source != NULL) platform.source->process(platform.app, platform.source);
|
||||||
|
|
||||||
// NOTE: Never close window, native activity is controlled by the system!
|
// NOTE: Allow closing the window in case a configuration change happened.
|
||||||
|
// The android_main function should be allowed to return to its caller in order for the
|
||||||
|
// Android OS to relaunch the activity.
|
||||||
if (platform.app->destroyRequested != 0)
|
if (platform.app->destroyRequested != 0)
|
||||||
{
|
{
|
||||||
//CORE.Window.shouldClose = true;
|
CORE.Window.shouldClose = true;
|
||||||
//ANativeActivity_finish(platform.app->activity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -767,20 +769,20 @@ int InitPlatform(void)
|
||||||
|
|
||||||
TRACELOG(LOG_INFO, "PLATFORM: ANDROID: Initialized successfully");
|
TRACELOG(LOG_INFO, "PLATFORM: ANDROID: Initialized successfully");
|
||||||
|
|
||||||
// Android ALooper_pollAll() variables
|
// Android ALooper_pollOnce() variables
|
||||||
int pollResult = 0;
|
int pollResult = 0;
|
||||||
int pollEvents = 0;
|
int pollEvents = 0;
|
||||||
|
|
||||||
// Wait for window to be initialized (display and context)
|
// Wait for window to be initialized (display and context)
|
||||||
while (!CORE.Window.ready)
|
while (!CORE.Window.ready)
|
||||||
{
|
{
|
||||||
// Process events loop
|
// Process events until we reach TIMEOUT, which indicates no more events queued.
|
||||||
while ((pollResult = ALooper_pollAll(0, NULL, &pollEvents, (void**)&platform.source)) >= 0)
|
while ((pollResult = ALooper_pollOnce(0, NULL, &pollEvents, (void**)&platform.source)) > ALOOPER_POLL_TIMEOUT)
|
||||||
{
|
{
|
||||||
// Process this event
|
// Process this event
|
||||||
if (platform.source != NULL) platform.source->process(platform.app, platform.source);
|
if (platform.source != NULL) platform.source->process(platform.app, platform.source);
|
||||||
|
|
||||||
// NOTE: Never close window, native activity is controlled by the system!
|
// NOTE: It's highly likely destroyRequested will never be non-zero at the start of the activity lifecycle.
|
||||||
//if (platform.app->destroyRequested != 0) CORE.Window.shouldClose = true;
|
//if (platform.app->destroyRequested != 0) CORE.Window.shouldClose = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -811,6 +813,12 @@ void ClosePlatform(void)
|
||||||
eglTerminate(platform.device);
|
eglTerminate(platform.device);
|
||||||
platform.device = EGL_NO_DISPLAY;
|
platform.device = EGL_NO_DISPLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: Reset global state in case the activity is being relaunched.
|
||||||
|
if (platform.app->destroyRequested != 0) {
|
||||||
|
CORE = (CoreData){0};
|
||||||
|
platform = (PlatformData){0};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize display device and framebuffer
|
// Initialize display device and framebuffer
|
||||||
|
|
@ -981,6 +989,7 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
|
||||||
// Initialize OpenGL context (states and resources)
|
// Initialize OpenGL context (states and resources)
|
||||||
// NOTE: CORE.Window.currentFbo.width and CORE.Window.currentFbo.height not used, just stored as globals in rlgl
|
// NOTE: CORE.Window.currentFbo.width and CORE.Window.currentFbo.height not used, just stored as globals in rlgl
|
||||||
rlglInit(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
|
rlglInit(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
|
||||||
|
isGpuReady = true;
|
||||||
|
|
||||||
// Setup default viewport
|
// Setup default viewport
|
||||||
// NOTE: It updated CORE.Window.render.width and CORE.Window.render.height
|
// NOTE: It updated CORE.Window.render.width and CORE.Window.render.height
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ static void ErrorCallback(int error, const char *description);
|
||||||
|
|
||||||
// Window callbacks events
|
// Window callbacks events
|
||||||
static void WindowSizeCallback(GLFWwindow *window, int width, int height); // GLFW3 WindowSize Callback, runs when window is resized
|
static void WindowSizeCallback(GLFWwindow *window, int width, int height); // GLFW3 WindowSize Callback, runs when window is resized
|
||||||
|
static void WindowPosCallback(GLFWwindow* window, int x, int y); // GLFW3 WindowPos Callback, runs when window is moved
|
||||||
static void WindowIconifyCallback(GLFWwindow *window, int iconified); // GLFW3 WindowIconify Callback, runs when window is minimized/restored
|
static void WindowIconifyCallback(GLFWwindow *window, int iconified); // GLFW3 WindowIconify Callback, runs when window is minimized/restored
|
||||||
static void WindowMaximizeCallback(GLFWwindow* window, int maximized); // GLFW3 Window Maximize Callback, runs when window is maximized
|
static void WindowMaximizeCallback(GLFWwindow* window, int maximized); // GLFW3 Window Maximize Callback, runs when window is maximized
|
||||||
static void WindowFocusCallback(GLFWwindow *window, int focused); // GLFW3 WindowFocus Callback, runs when window get/lose focus
|
static void WindowFocusCallback(GLFWwindow *window, int focused); // GLFW3 WindowFocus Callback, runs when window get/lose focus
|
||||||
|
|
@ -147,8 +148,8 @@ void ToggleFullscreen(void)
|
||||||
if (!CORE.Window.fullscreen)
|
if (!CORE.Window.fullscreen)
|
||||||
{
|
{
|
||||||
// Store previous window position (in case we exit fullscreen)
|
// Store previous window position (in case we exit fullscreen)
|
||||||
glfwGetWindowPos(platform.handle, &CORE.Window.position.x, &CORE.Window.position.y);
|
CORE.Window.previousPosition = CORE.Window.position;
|
||||||
|
|
||||||
int monitorCount = 0;
|
int monitorCount = 0;
|
||||||
int monitorIndex = GetCurrentMonitor();
|
int monitorIndex = GetCurrentMonitor();
|
||||||
GLFWmonitor **monitors = glfwGetMonitors(&monitorCount);
|
GLFWmonitor **monitors = glfwGetMonitors(&monitorCount);
|
||||||
|
|
@ -179,7 +180,11 @@ void ToggleFullscreen(void)
|
||||||
CORE.Window.fullscreen = false;
|
CORE.Window.fullscreen = false;
|
||||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
||||||
|
|
||||||
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.position.x, CORE.Window.position.y, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.previousPosition.x, CORE.Window.previousPosition.y, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
||||||
|
|
||||||
|
// we update the window position right away
|
||||||
|
CORE.Window.position.x = CORE.Window.previousPosition.x;
|
||||||
|
CORE.Window.position.y = CORE.Window.previousPosition.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS)
|
// Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS)
|
||||||
|
|
@ -190,11 +195,11 @@ void ToggleFullscreen(void)
|
||||||
// Toggle borderless windowed mode
|
// Toggle borderless windowed mode
|
||||||
void ToggleBorderlessWindowed(void)
|
void ToggleBorderlessWindowed(void)
|
||||||
{
|
{
|
||||||
// Leave fullscreen before attempting to set borderless windowed mode and get screen position from it
|
// Leave fullscreen before attempting to set borderless windowed mode
|
||||||
bool wasOnFullscreen = false;
|
bool wasOnFullscreen = false;
|
||||||
if (CORE.Window.fullscreen)
|
if (CORE.Window.fullscreen)
|
||||||
{
|
{
|
||||||
CORE.Window.previousPosition = CORE.Window.position;
|
// fullscreen already saves the previous position so it does not need to be set here again
|
||||||
ToggleFullscreen();
|
ToggleFullscreen();
|
||||||
wasOnFullscreen = true;
|
wasOnFullscreen = true;
|
||||||
}
|
}
|
||||||
|
|
@ -213,7 +218,7 @@ void ToggleBorderlessWindowed(void)
|
||||||
{
|
{
|
||||||
// Store screen position and size
|
// Store screen position and size
|
||||||
// NOTE: If it was on fullscreen, screen position was already stored, so skip setting it here
|
// NOTE: If it was on fullscreen, screen position was already stored, so skip setting it here
|
||||||
if (!wasOnFullscreen) glfwGetWindowPos(platform.handle, &CORE.Window.previousPosition.x, &CORE.Window.previousPosition.y);
|
if (!wasOnFullscreen) CORE.Window.previousPosition = CORE.Window.position;
|
||||||
CORE.Window.previousScreen = CORE.Window.screen;
|
CORE.Window.previousScreen = CORE.Window.screen;
|
||||||
|
|
||||||
// Set undecorated and topmost modes and flags
|
// Set undecorated and topmost modes and flags
|
||||||
|
|
@ -255,6 +260,9 @@ void ToggleBorderlessWindowed(void)
|
||||||
glfwFocusWindow(platform.handle);
|
glfwFocusWindow(platform.handle);
|
||||||
|
|
||||||
CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE;
|
CORE.Window.flags &= ~FLAG_BORDERLESS_WINDOWED_MODE;
|
||||||
|
|
||||||
|
CORE.Window.position.x = CORE.Window.previousPosition.x;
|
||||||
|
CORE.Window.position.y = CORE.Window.previousPosition.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else TRACELOG(LOG_WARNING, "GLFW: Failed to find video mode for selected monitor");
|
else TRACELOG(LOG_WARNING, "GLFW: Failed to find video mode for selected monitor");
|
||||||
|
|
@ -592,6 +600,9 @@ void SetWindowTitle(const char *title)
|
||||||
// Set window position on screen (windowed mode)
|
// Set window position on screen (windowed mode)
|
||||||
void SetWindowPosition(int x, int y)
|
void SetWindowPosition(int x, int y)
|
||||||
{
|
{
|
||||||
|
// Update CORE.Window.position as well
|
||||||
|
CORE.Window.position.x = x;
|
||||||
|
CORE.Window.position.y = y;
|
||||||
glfwSetWindowPos(platform.handle, x, y);
|
glfwSetWindowPos(platform.handle, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -614,8 +625,9 @@ void SetWindowMonitor(int monitor)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_INFO, "GLFW: Selected monitor: [%i] %s", monitor, glfwGetMonitorName(monitors[monitor]));
|
TRACELOG(LOG_INFO, "GLFW: Selected monitor: [%i] %s", monitor, glfwGetMonitorName(monitors[monitor]));
|
||||||
|
|
||||||
const int screenWidth = CORE.Window.screen.width;
|
// Here the render width has to be used again in case high dpi flag is enabled
|
||||||
const int screenHeight = CORE.Window.screen.height;
|
const int screenWidth = CORE.Window.render.width;
|
||||||
|
const int screenHeight = CORE.Window.render.height;
|
||||||
int monitorWorkareaX = 0;
|
int monitorWorkareaX = 0;
|
||||||
int monitorWorkareaY = 0;
|
int monitorWorkareaY = 0;
|
||||||
int monitorWorkareaWidth = 0;
|
int monitorWorkareaWidth = 0;
|
||||||
|
|
@ -1568,12 +1580,17 @@ int InitPlatform(void)
|
||||||
int monitorWidth = 0;
|
int monitorWidth = 0;
|
||||||
int monitorHeight = 0;
|
int monitorHeight = 0;
|
||||||
glfwGetMonitorWorkarea(monitor, &monitorX, &monitorY, &monitorWidth, &monitorHeight);
|
glfwGetMonitorWorkarea(monitor, &monitorX, &monitorY, &monitorWidth, &monitorHeight);
|
||||||
|
|
||||||
int posX = monitorX + (monitorWidth - (int)CORE.Window.screen.width)/2;
|
// Here CORE.Window.render.width/height should be used instead of CORE.Window.screen.width/height to center the window correctly when the high dpi flag is enabled.
|
||||||
int posY = monitorY + (monitorHeight - (int)CORE.Window.screen.height)/2;
|
int posX = monitorX + (monitorWidth - (int)CORE.Window.render.width)/2;
|
||||||
|
int posY = monitorY + (monitorHeight - (int)CORE.Window.render.height)/2;
|
||||||
if (posX < monitorX) posX = monitorX;
|
if (posX < monitorX) posX = monitorX;
|
||||||
if (posY < monitorY) posY = monitorY;
|
if (posY < monitorY) posY = monitorY;
|
||||||
SetWindowPosition(posX, posY);
|
SetWindowPosition(posX, posY);
|
||||||
|
|
||||||
|
// Update CORE.Window.position here so it is correct from the start
|
||||||
|
CORE.Window.position.x = posX;
|
||||||
|
CORE.Window.position.y = posY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load OpenGL extensions
|
// Load OpenGL extensions
|
||||||
|
|
@ -1585,6 +1602,7 @@ int InitPlatform(void)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Set window callback events
|
// Set window callback events
|
||||||
glfwSetWindowSizeCallback(platform.handle, WindowSizeCallback); // NOTE: Resizing not allowed by default!
|
glfwSetWindowSizeCallback(platform.handle, WindowSizeCallback); // NOTE: Resizing not allowed by default!
|
||||||
|
glfwSetWindowPosCallback(platform.handle, WindowPosCallback);
|
||||||
glfwSetWindowMaximizeCallback(platform.handle, WindowMaximizeCallback);
|
glfwSetWindowMaximizeCallback(platform.handle, WindowMaximizeCallback);
|
||||||
glfwSetWindowIconifyCallback(platform.handle, WindowIconifyCallback);
|
glfwSetWindowIconifyCallback(platform.handle, WindowIconifyCallback);
|
||||||
glfwSetWindowFocusCallback(platform.handle, WindowFocusCallback);
|
glfwSetWindowFocusCallback(platform.handle, WindowFocusCallback);
|
||||||
|
|
@ -1681,7 +1699,12 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
|
||||||
|
|
||||||
// NOTE: Postprocessing texture is not scaled to new size
|
// NOTE: Postprocessing texture is not scaled to new size
|
||||||
}
|
}
|
||||||
|
static void WindowPosCallback(GLFWwindow* window, int x, int y)
|
||||||
|
{
|
||||||
|
// Set current window position
|
||||||
|
CORE.Window.position.x = x;
|
||||||
|
CORE.Window.position.y = y;
|
||||||
|
}
|
||||||
static void WindowContentScaleCallback(GLFWwindow *window, float scalex, float scaley)
|
static void WindowContentScaleCallback(GLFWwindow *window, float scalex, float scaley)
|
||||||
{
|
{
|
||||||
CORE.Window.screenScale = MatrixScale(scalex, scaley, 1.0f);
|
CORE.Window.screenScale = MatrixScale(scalex, scaley, 1.0f);
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,7 @@ void CloseWindow(void);
|
||||||
#define Size NSSIZE
|
#define Size NSSIZE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
__declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int CodePage, unsigned long dwFlags, const char *lpMultiByteStr, int cbMultiByte, wchar_t *lpWideCharStr, int cchWideChar);
|
__declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int CodePage, unsigned long dwFlags, const char *lpMultiByteStr, int cbMultiByte, wchar_t *lpWideCharStr, int cchWideChar);
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../external/RGFW.h"
|
#include "../external/RGFW.h"
|
||||||
|
|
||||||
|
|
@ -538,10 +536,8 @@ void *GetWindowHandle(void)
|
||||||
{
|
{
|
||||||
#ifdef RGFW_WEBASM
|
#ifdef RGFW_WEBASM
|
||||||
return (void*)platform.window->src.ctx;
|
return (void*)platform.window->src.ctx;
|
||||||
#elif !defined(RGFW_WINDOWS)
|
|
||||||
return (void *)platform.window->src.window;
|
|
||||||
#else
|
#else
|
||||||
return platform.window->src.hwnd;
|
return (void*)platform.window->src.window;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -944,7 +940,7 @@ void PollInputEvents(void)
|
||||||
SetupViewport(platform.window->r.w, platform.window->r.h);
|
SetupViewport(platform.window->r.w, platform.window->r.h);
|
||||||
CORE.Window.screen.width = platform.window->r.w;
|
CORE.Window.screen.width = platform.window->r.w;
|
||||||
CORE.Window.screen.height = platform.window->r.h;
|
CORE.Window.screen.height = platform.window->r.h;
|
||||||
CORE.Window.currentFbo.width = platform.window->r.w;;
|
CORE.Window.currentFbo.width = platform.window->r.w;
|
||||||
CORE.Window.currentFbo.height = platform.window->r.h;
|
CORE.Window.currentFbo.height = platform.window->r.h;
|
||||||
CORE.Window.resizedLastFrame = true;
|
CORE.Window.resizedLastFrame = true;
|
||||||
} break;
|
} break;
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ static const short linuxToRaylibMap[KEYMAP_SIZE] = {
|
||||||
[BTN_TL] = GAMEPAD_BUTTON_LEFT_TRIGGER_1,
|
[BTN_TL] = GAMEPAD_BUTTON_LEFT_TRIGGER_1,
|
||||||
[BTN_TL2] = GAMEPAD_BUTTON_LEFT_TRIGGER_2,
|
[BTN_TL2] = GAMEPAD_BUTTON_LEFT_TRIGGER_2,
|
||||||
[BTN_TR] = GAMEPAD_BUTTON_RIGHT_TRIGGER_1,
|
[BTN_TR] = GAMEPAD_BUTTON_RIGHT_TRIGGER_1,
|
||||||
[BTN_TR2] GAMEPAD_BUTTON_RIGHT_TRIGGER_2,
|
[BTN_TR2] = GAMEPAD_BUTTON_RIGHT_TRIGGER_2,
|
||||||
[BTN_SELECT] = GAMEPAD_BUTTON_MIDDLE_LEFT,
|
[BTN_SELECT] = GAMEPAD_BUTTON_MIDDLE_LEFT,
|
||||||
[BTN_MODE] = GAMEPAD_BUTTON_MIDDLE,
|
[BTN_MODE] = GAMEPAD_BUTTON_MIDDLE,
|
||||||
[BTN_START] = GAMEPAD_BUTTON_MIDDLE_RIGHT,
|
[BTN_START] = GAMEPAD_BUTTON_MIDDLE_RIGHT,
|
||||||
|
|
@ -763,8 +763,10 @@ int InitPlatform(void)
|
||||||
|
|
||||||
drmModeConnector *con = drmModeGetConnector(platform.fd, res->connectors[i]);
|
drmModeConnector *con = drmModeGetConnector(platform.fd, res->connectors[i]);
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: Connector modes detected: %i", con->count_modes);
|
TRACELOG(LOG_TRACE, "DISPLAY: Connector modes detected: %i", con->count_modes);
|
||||||
|
|
||||||
if ((con->connection == DRM_MODE_CONNECTED) && (con->encoder_id))
|
// In certain cases the status of the conneciton is reported as UKNOWN, but it is still connected.
|
||||||
|
// This might be a hardware or software limitation like on Raspberry Pi Zero with composite output.
|
||||||
|
if (((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION)) && (con->encoder_id))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected");
|
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected");
|
||||||
platform.connector = con;
|
platform.connector = con;
|
||||||
|
|
|
||||||
|
|
@ -1626,7 +1626,9 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
||||||
{
|
{
|
||||||
music.ctxType = MUSIC_AUDIO_FLAC;
|
music.ctxType = MUSIC_AUDIO_FLAC;
|
||||||
music.ctxData = ctxFlac;
|
music.ctxData = ctxFlac;
|
||||||
music.stream = LoadAudioStream(ctxFlac->sampleRate, ctxFlac->bitsPerSample, ctxFlac->channels);
|
int sampleSize = ctxFlac->bitsPerSample;
|
||||||
|
if (ctxFlac->bitsPerSample == 24) sampleSize = 16; // Forcing conversion to s16 on UpdateMusicStream()
|
||||||
|
music.stream = LoadAudioStream(ctxFlac->sampleRate, sampleSize, ctxFlac->channels);
|
||||||
music.frameCount = (unsigned int)ctxFlac->totalPCMFrameCount;
|
music.frameCount = (unsigned int)ctxFlac->totalPCMFrameCount;
|
||||||
music.looping = true; // Looping enabled by default
|
music.looping = true; // Looping enabled by default
|
||||||
musicLoaded = true;
|
musicLoaded = true;
|
||||||
|
|
|
||||||
28
src/raylib.h
28
src/raylib.h
|
|
@ -352,8 +352,10 @@ typedef struct Mesh {
|
||||||
// Animation vertex data
|
// Animation vertex data
|
||||||
float *animVertices; // Animated vertex positions (after bones transformations)
|
float *animVertices; // Animated vertex positions (after bones transformations)
|
||||||
float *animNormals; // Animated normals (after bones transformations)
|
float *animNormals; // Animated normals (after bones transformations)
|
||||||
unsigned char *boneIds; // Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning)
|
unsigned char *boneIds; // Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) (shader-location = 6)
|
||||||
float *boneWeights; // Vertex bone weight, up to 4 bones influence by vertex (skinning)
|
float *boneWeights; // Vertex bone weight, up to 4 bones influence by vertex (skinning) (shader-location = 7)
|
||||||
|
Matrix *boneMatrices; // Bones animated transformation matrices
|
||||||
|
int boneCount; // Number of bones
|
||||||
|
|
||||||
// OpenGL identifiers
|
// OpenGL identifiers
|
||||||
unsigned int vaoId; // OpenGL Vertex Array Object id
|
unsigned int vaoId; // OpenGL Vertex Array Object id
|
||||||
|
|
@ -790,7 +792,10 @@ typedef enum {
|
||||||
SHADER_LOC_MAP_CUBEMAP, // Shader location: samplerCube texture: cubemap
|
SHADER_LOC_MAP_CUBEMAP, // Shader location: samplerCube texture: cubemap
|
||||||
SHADER_LOC_MAP_IRRADIANCE, // Shader location: samplerCube texture: irradiance
|
SHADER_LOC_MAP_IRRADIANCE, // Shader location: samplerCube texture: irradiance
|
||||||
SHADER_LOC_MAP_PREFILTER, // Shader location: samplerCube texture: prefilter
|
SHADER_LOC_MAP_PREFILTER, // Shader location: samplerCube texture: prefilter
|
||||||
SHADER_LOC_MAP_BRDF // Shader location: sampler2d texture: brdf
|
SHADER_LOC_MAP_BRDF, // Shader location: sampler2d texture: brdf
|
||||||
|
SHADER_LOC_VERTEX_BONEIDS, // Shader location: vertex attribute: boneIds
|
||||||
|
SHADER_LOC_VERTEX_BONEWEIGHTS, // Shader location: vertex attribute: boneWeights
|
||||||
|
SHADER_LOC_BONE_MATRICES // Shader location: array of matrices uniform: boneMatrices
|
||||||
} ShaderLocationIndex;
|
} ShaderLocationIndex;
|
||||||
|
|
||||||
#define SHADER_LOC_MAP_DIFFUSE SHADER_LOC_MAP_ALBEDO
|
#define SHADER_LOC_MAP_DIFFUSE SHADER_LOC_MAP_ALBEDO
|
||||||
|
|
@ -968,8 +973,8 @@ RLAPI bool IsWindowResized(void); // Check if wi
|
||||||
RLAPI bool IsWindowState(unsigned int flag); // Check if one specific window flag is enabled
|
RLAPI bool IsWindowState(unsigned int flag); // Check if one specific window flag is enabled
|
||||||
RLAPI void SetWindowState(unsigned int flags); // Set window configuration state using flags (only PLATFORM_DESKTOP)
|
RLAPI void SetWindowState(unsigned int flags); // Set window configuration state using flags (only PLATFORM_DESKTOP)
|
||||||
RLAPI void ClearWindowState(unsigned int flags); // Clear window configuration state flags
|
RLAPI void ClearWindowState(unsigned int flags); // Clear window configuration state flags
|
||||||
RLAPI void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
|
RLAPI void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed [resizes monitor to match window resolution] (only PLATFORM_DESKTOP)
|
||||||
RLAPI void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed (only PLATFORM_DESKTOP)
|
RLAPI void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed [resizes window to match monitor resolution] (only PLATFORM_DESKTOP)
|
||||||
RLAPI void MaximizeWindow(void); // Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
|
RLAPI void MaximizeWindow(void); // Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
|
||||||
RLAPI void MinimizeWindow(void); // Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
|
RLAPI void MinimizeWindow(void); // Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
|
||||||
RLAPI void RestoreWindow(void); // Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
|
RLAPI void RestoreWindow(void); // Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
|
||||||
|
|
@ -1122,11 +1127,12 @@ RLAPI const char *GetDirectoryPath(const char *filePath); // Get full pa
|
||||||
RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string)
|
RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string)
|
||||||
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
|
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
|
||||||
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
||||||
|
RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
|
||||||
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, return true on success
|
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, return true on success
|
||||||
RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory
|
RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory
|
||||||
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
||||||
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths
|
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths
|
||||||
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and recursive directory scan
|
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result
|
||||||
RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
|
RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
|
||||||
RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
|
RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
|
||||||
RLAPI FilePathList LoadDroppedFiles(void); // Load dropped filepaths
|
RLAPI FilePathList LoadDroppedFiles(void); // Load dropped filepaths
|
||||||
|
|
@ -1228,8 +1234,8 @@ RLAPI Texture2D GetShapesTexture(void); // Get t
|
||||||
RLAPI Rectangle GetShapesTextureRectangle(void); // Get texture source rectangle that is used for shapes drawing
|
RLAPI Rectangle GetShapesTextureRectangle(void); // Get texture source rectangle that is used for shapes drawing
|
||||||
|
|
||||||
// Basic shapes drawing functions
|
// Basic shapes drawing functions
|
||||||
RLAPI void DrawPixel(int posX, int posY, Color color); // Draw a pixel
|
RLAPI void DrawPixel(int posX, int posY, Color color); // Draw a pixel using geometry [Can be slow, use with care]
|
||||||
RLAPI void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version)
|
RLAPI void DrawPixelV(Vector2 position, Color color); // Draw a pixel using geometry (Vector version) [Can be slow, use with care]
|
||||||
RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
|
RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
|
||||||
RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
|
RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
|
||||||
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
|
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
|
||||||
|
|
@ -1431,6 +1437,7 @@ RLAPI Color ColorBrightness(Color color, float factor); // G
|
||||||
RLAPI Color ColorContrast(Color color, float contrast); // Get color with contrast correction, contrast values between -1.0f and 1.0f
|
RLAPI Color ColorContrast(Color color, float contrast); // Get color with contrast correction, contrast values between -1.0f and 1.0f
|
||||||
RLAPI Color ColorAlpha(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
|
RLAPI Color ColorAlpha(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
|
||||||
RLAPI Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint
|
RLAPI Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint
|
||||||
|
RLAPI Color ColorLerp(Color color1, Color color2, float factor); // Get color lerp interpolation between two colors, factor [0.0f..1.0f]
|
||||||
RLAPI Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value
|
RLAPI Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value
|
||||||
RLAPI Color GetPixelColor(void *srcPtr, int format); // Get Color from a source pixel pointer of certain format
|
RLAPI Color GetPixelColor(void *srcPtr, int format); // Get Color from a source pixel pointer of certain format
|
||||||
RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer
|
RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer
|
||||||
|
|
@ -1443,7 +1450,7 @@ RLAPI int GetPixelDataSize(int width, int height, int format); // G
|
||||||
// Font loading/unloading functions
|
// Font loading/unloading functions
|
||||||
RLAPI Font GetFontDefault(void); // Get the default Font
|
RLAPI Font GetFontDefault(void); // Get the default Font
|
||||||
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
|
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
|
||||||
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set
|
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
|
||||||
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
|
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
|
||||||
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||||
RLAPI bool IsFontReady(Font font); // Check if a font is ready
|
RLAPI bool IsFontReady(Font font); // Check if a font is ready
|
||||||
|
|
@ -1545,6 +1552,8 @@ RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint);
|
||||||
RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
|
RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
|
||||||
RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
|
RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
|
||||||
RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
|
RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
|
||||||
|
RLAPI void DrawModelPoints(Model model, Vector3 position, float scale, Color tint); // Draw a model as points
|
||||||
|
RLAPI void DrawModelPointsEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model as points with extended parameters
|
||||||
RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
|
RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
|
||||||
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint); // Draw a billboard texture
|
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint); // Draw a billboard texture
|
||||||
RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source
|
RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source
|
||||||
|
|
@ -1588,6 +1597,7 @@ RLAPI void UpdateModelAnimation(Model model, ModelAnimation anim, int frame);
|
||||||
RLAPI void UnloadModelAnimation(ModelAnimation anim); // Unload animation data
|
RLAPI void UnloadModelAnimation(ModelAnimation anim); // Unload animation data
|
||||||
RLAPI void UnloadModelAnimations(ModelAnimation *animations, int animCount); // Unload animation array data
|
RLAPI void UnloadModelAnimations(ModelAnimation *animations, int animCount); // Unload animation array data
|
||||||
RLAPI bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match
|
RLAPI bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match
|
||||||
|
RLAPI void UpdateModelAnimationBoneMatrices(Model model, ModelAnimation anim, int frame); // Update model animation mesh bone matrices (Note GPU skinning does not work on Mac)
|
||||||
|
|
||||||
// Collision detection functions
|
// Collision detection functions
|
||||||
RLAPI bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Check collision between two spheres
|
RLAPI bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Check collision between two spheres
|
||||||
|
|
|
||||||
159
src/rcore.c
159
src/rcore.c
|
|
@ -165,6 +165,10 @@ unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod);
|
||||||
unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
|
unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#include <unistd.h>
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <sys/syslimits.h>
|
#include <sys/syslimits.h>
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
|
|
@ -187,14 +191,16 @@ unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <direct.h> // Required for: _getch(), _chdir()
|
#include <io.h> // Required for: _access() [Used in FileExists()]
|
||||||
|
#include <direct.h> // Required for: _getch(), _chdir(), _mkdir()
|
||||||
#define GETCWD _getcwd // NOTE: MSDN recommends not to use getcwd(), chdir()
|
#define GETCWD _getcwd // NOTE: MSDN recommends not to use getcwd(), chdir()
|
||||||
#define CHDIR _chdir
|
#define CHDIR _chdir
|
||||||
#include <io.h> // Required for: _access() [Used in FileExists()]
|
#define MKDIR(dir) _mkdir(dir)
|
||||||
#else
|
#else
|
||||||
#include <unistd.h> // Required for: getch(), chdir() (POSIX), access()
|
#include <unistd.h> // Required for: getch(), chdir(), mkdir(), access()
|
||||||
#define GETCWD getcwd
|
#define GETCWD getcwd
|
||||||
#define CHDIR chdir
|
#define CHDIR chdir
|
||||||
|
#define MKDIR(dir) mkdir(dir, 0777)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -247,6 +253,10 @@ unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
|
||||||
#define MAX_AUTOMATION_EVENTS 16384 // Maximum number of automation events to record
|
#define MAX_AUTOMATION_EVENTS 16384 // Maximum number of automation events to record
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DIRECTORY_FILTER_TAG
|
||||||
|
#define DIRECTORY_FILTER_TAG "DIR" // Name tag used to request directory inclusion on directory scan
|
||||||
|
#endif // NOTE: Used in ScanDirectoryFiles(), ScanDirectoryFilesRecursively() and LoadDirectoryFilesEx()
|
||||||
|
|
||||||
// Flags operation macros
|
// Flags operation macros
|
||||||
#define FLAG_SET(n, f) ((n) |= (f))
|
#define FLAG_SET(n, f) ((n) |= (f))
|
||||||
#define FLAG_CLEAR(n, f) ((n) &= ~(f))
|
#define FLAG_CLEAR(n, f) ((n) &= ~(f))
|
||||||
|
|
@ -360,10 +370,15 @@ typedef struct CoreData {
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
RLAPI const char *raylib_version = RAYLIB_VERSION; // raylib version exported symbol, required for some bindings
|
RLAPI const char *raylib_version = RAYLIB_VERSION; // raylib version exported symbol, required for some bindings
|
||||||
|
|
||||||
CoreData CORE = { 0 }; // Global CORE state context
|
CoreData CORE = { 0 }; // Global CORE state context
|
||||||
|
|
||||||
|
// Flag to note GPU acceleration is available,
|
||||||
|
// referenced from other modules to support GPU data loading
|
||||||
|
// NOTE: Useful to allow Texture, RenderTexture, Font.texture, Mesh.vaoId/vboId, Shader loading
|
||||||
|
bool isGpuReady = false;
|
||||||
|
|
||||||
#if defined(SUPPORT_SCREEN_CAPTURE)
|
#if defined(SUPPORT_SCREEN_CAPTURE)
|
||||||
static int screenshotCounter = 0; // Screenshots counter
|
static int screenshotCounter = 0; // Screenshots counter
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_GIF_RECORDING)
|
#if defined(SUPPORT_GIF_RECORDING)
|
||||||
|
|
@ -637,28 +652,31 @@ void InitWindow(int width, int height, const char *title)
|
||||||
// Initialize rlgl default data (buffers and shaders)
|
// Initialize rlgl default data (buffers and shaders)
|
||||||
// NOTE: CORE.Window.currentFbo.width and CORE.Window.currentFbo.height not used, just stored as globals in rlgl
|
// NOTE: CORE.Window.currentFbo.width and CORE.Window.currentFbo.height not used, just stored as globals in rlgl
|
||||||
rlglInit(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
|
rlglInit(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
|
||||||
|
isGpuReady = true; // Flag to note GPU has been initialized successfully
|
||||||
|
|
||||||
// Setup default viewport
|
// Setup default viewport
|
||||||
SetupViewport(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
|
SetupViewport(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
|
||||||
|
|
||||||
#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT)
|
#if defined(SUPPORT_MODULE_RTEXT)
|
||||||
// Load default font
|
#if defined(SUPPORT_DEFAULT_FONT)
|
||||||
// WARNING: External function: Module required: rtext
|
// Load default font
|
||||||
LoadFontDefault();
|
// WARNING: External function: Module required: rtext
|
||||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
LoadFontDefault();
|
||||||
// Set font white rectangle for shapes drawing, so shapes and text can be batched together
|
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||||
// WARNING: rshapes module is required, if not available, default internal white rectangle is used
|
// Set font white rectangle for shapes drawing, so shapes and text can be batched together
|
||||||
Rectangle rec = GetFontDefault().recs[95];
|
// WARNING: rshapes module is required, if not available, default internal white rectangle is used
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
Rectangle rec = GetFontDefault().recs[95];
|
||||||
{
|
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
||||||
// NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
|
{
|
||||||
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
|
// NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
|
||||||
}
|
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
// NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding
|
{
|
||||||
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 });
|
// NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding
|
||||||
}
|
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 });
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||||
|
|
@ -1287,6 +1305,8 @@ Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
||||||
// vertex color location = 3
|
// vertex color location = 3
|
||||||
// vertex tangent location = 4
|
// vertex tangent location = 4
|
||||||
// vertex texcoord2 location = 5
|
// vertex texcoord2 location = 5
|
||||||
|
// vertex boneIds location = 6
|
||||||
|
// vertex boneWeights location = 7
|
||||||
|
|
||||||
// NOTE: If any location is not found, loc point becomes -1
|
// NOTE: If any location is not found, loc point becomes -1
|
||||||
|
|
||||||
|
|
@ -1302,6 +1322,8 @@ Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
||||||
shader.locs[SHADER_LOC_VERTEX_NORMAL] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL);
|
shader.locs[SHADER_LOC_VERTEX_NORMAL] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL);
|
||||||
shader.locs[SHADER_LOC_VERTEX_TANGENT] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT);
|
shader.locs[SHADER_LOC_VERTEX_TANGENT] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT);
|
||||||
shader.locs[SHADER_LOC_VERTEX_COLOR] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR);
|
shader.locs[SHADER_LOC_VERTEX_COLOR] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR);
|
||||||
|
shader.locs[SHADER_LOC_VERTEX_BONEIDS] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS);
|
||||||
|
shader.locs[SHADER_LOC_VERTEX_BONEWEIGHTS] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS);
|
||||||
|
|
||||||
// Get handles to GLSL uniform locations (vertex shader)
|
// Get handles to GLSL uniform locations (vertex shader)
|
||||||
shader.locs[SHADER_LOC_MATRIX_MVP] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_MVP);
|
shader.locs[SHADER_LOC_MATRIX_MVP] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_MVP);
|
||||||
|
|
@ -1309,6 +1331,7 @@ Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
||||||
shader.locs[SHADER_LOC_MATRIX_PROJECTION] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION);
|
shader.locs[SHADER_LOC_MATRIX_PROJECTION] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION);
|
||||||
shader.locs[SHADER_LOC_MATRIX_MODEL] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL);
|
shader.locs[SHADER_LOC_MATRIX_MODEL] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL);
|
||||||
shader.locs[SHADER_LOC_MATRIX_NORMAL] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL);
|
shader.locs[SHADER_LOC_MATRIX_NORMAL] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL);
|
||||||
|
shader.locs[SHADER_LOC_BONE_MATRICES] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES);
|
||||||
|
|
||||||
// Get handles to GLSL uniform locations (fragment shader)
|
// Get handles to GLSL uniform locations (fragment shader)
|
||||||
shader.locs[SHADER_LOC_COLOR_DIFFUSE] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR);
|
shader.locs[SHADER_LOC_COLOR_DIFFUSE] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR);
|
||||||
|
|
@ -2153,6 +2176,28 @@ const char *GetApplicationDirectory(void)
|
||||||
appDir[0] = '.';
|
appDir[0] = '.';
|
||||||
appDir[1] = '/';
|
appDir[1] = '/';
|
||||||
}
|
}
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
size_t size = sizeof(appDir);
|
||||||
|
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
|
||||||
|
|
||||||
|
if (sysctl(mib, 4, appDir, &size, NULL, 0) == 0)
|
||||||
|
{
|
||||||
|
int len = strlen(appDir);
|
||||||
|
for (int i = len; i >= 0; --i)
|
||||||
|
{
|
||||||
|
if (appDir[i] == '/')
|
||||||
|
{
|
||||||
|
appDir[i + 1] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
appDir[0] = '.';
|
||||||
|
appDir[1] = '/';
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return appDir;
|
return appDir;
|
||||||
|
|
@ -2224,6 +2269,40 @@ void UnloadDirectoryFiles(FilePathList files)
|
||||||
RL_FREE(files.paths);
|
RL_FREE(files.paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create directories (including full path requested), returns 0 on success
|
||||||
|
int MakeDirectory(const char *dirPath)
|
||||||
|
{
|
||||||
|
if ((dirPath == NULL) || (dirPath[0] == '\0')) return 1; // Path is not valid
|
||||||
|
if (DirectoryExists(dirPath)) return 0; // Path already exists (is valid)
|
||||||
|
|
||||||
|
// Copy path string to avoid modifying original
|
||||||
|
int len = (int)strlen(dirPath) + 1;
|
||||||
|
char *pathcpy = (char *)RL_CALLOC(len, 1);
|
||||||
|
memcpy(pathcpy, dirPath, len);
|
||||||
|
|
||||||
|
// Iterate over pathcpy, create each subdirectory as needed
|
||||||
|
for (int i = 0; (i < len) && (pathcpy[i] != '\0'); i++)
|
||||||
|
{
|
||||||
|
if (pathcpy[i] == ':') i++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((pathcpy[i] == '\\') || (pathcpy[i] == '/'))
|
||||||
|
{
|
||||||
|
pathcpy[i] = '\0';
|
||||||
|
if (!DirectoryExists(pathcpy)) MKDIR(pathcpy);
|
||||||
|
pathcpy[i] = '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create final directory
|
||||||
|
if (!DirectoryExists(pathcpy)) MKDIR(pathcpy);
|
||||||
|
|
||||||
|
RL_FREE(pathcpy);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Change working directory, returns true on success
|
// Change working directory, returns true on success
|
||||||
bool ChangeDirectory(const char *dir)
|
bool ChangeDirectory(const char *dir)
|
||||||
{
|
{
|
||||||
|
|
@ -3305,10 +3384,21 @@ static void ScanDirectoryFiles(const char *basePath, FilePathList *files, const
|
||||||
|
|
||||||
if (filter != NULL)
|
if (filter != NULL)
|
||||||
{
|
{
|
||||||
if (IsFileExtension(path, filter))
|
if (IsPathFile(path))
|
||||||
{
|
{
|
||||||
strcpy(files->paths[files->count], path);
|
if (IsFileExtension(path, filter))
|
||||||
files->count++;
|
{
|
||||||
|
strcpy(files->paths[files->count], path);
|
||||||
|
files->count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (TextFindIndex(filter, DIRECTORY_FILTER_TAG) >= 0)
|
||||||
|
{
|
||||||
|
strcpy(files->paths[files->count], path);
|
||||||
|
files->count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -3368,7 +3458,22 @@ static void ScanDirectoryFilesRecursively(const char *basePath, FilePathList *fi
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else ScanDirectoryFilesRecursively(path, files, filter);
|
else
|
||||||
|
{
|
||||||
|
if ((filter != NULL) && (TextFindIndex(filter, DIRECTORY_FILTER_TAG) >= 0))
|
||||||
|
{
|
||||||
|
strcpy(files->paths[files->count], path);
|
||||||
|
files->count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (files->count >= files->capacity)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "FILEIO: Maximum filepath scan capacity reached (%i files)", files->capacity);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScanDirectoryFilesRecursively(path, files, filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
72
src/rlgl.h
72
src/rlgl.h
|
|
@ -68,12 +68,15 @@
|
||||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
|
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
|
||||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
|
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
|
||||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
|
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
|
||||||
|
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS "vertexBoneIds" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS
|
||||||
|
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS
|
||||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
||||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
|
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
|
||||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
|
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
|
||||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
|
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
|
||||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView)))
|
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView)))
|
||||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
|
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
|
||||||
|
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES "boneMatrices" // bone matrices
|
||||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
||||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
|
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
|
||||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
|
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
|
||||||
|
|
@ -324,23 +327,33 @@
|
||||||
|
|
||||||
// Default shader vertex attribute locations
|
// Default shader vertex attribute locations
|
||||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
|
||||||
#endif
|
#endif
|
||||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
|
||||||
#endif
|
#endif
|
||||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
|
||||||
#endif
|
#endif
|
||||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES
|
||||||
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
|
||||||
|
#endif
|
||||||
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS
|
||||||
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS 7
|
||||||
|
#endif
|
||||||
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS
|
||||||
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Types and Structures Definition
|
// Types and Structures Definition
|
||||||
|
|
@ -527,6 +540,10 @@ typedef enum {
|
||||||
RL_SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int)
|
RL_SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int)
|
||||||
RL_SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int)
|
RL_SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int)
|
||||||
RL_SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int)
|
RL_SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int)
|
||||||
|
RL_SHADER_UNIFORM_UINT, // Shader uniform type: unsigned int
|
||||||
|
RL_SHADER_UNIFORM_UIVEC2, // Shader uniform type: uivec2 (2 unsigned int)
|
||||||
|
RL_SHADER_UNIFORM_UIVEC3, // Shader uniform type: uivec3 (3 unsigned int)
|
||||||
|
RL_SHADER_UNIFORM_UIVEC4, // Shader uniform type: uivec4 (4 unsigned int)
|
||||||
RL_SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d
|
RL_SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d
|
||||||
} rlShaderUniformDataType;
|
} rlShaderUniformDataType;
|
||||||
|
|
||||||
|
|
@ -665,7 +682,7 @@ RLAPI void rlDisableScissorTest(void); // Disable scissor test
|
||||||
RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test
|
RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test
|
||||||
RLAPI void rlEnableWireMode(void); // Enable wire mode
|
RLAPI void rlEnableWireMode(void); // Enable wire mode
|
||||||
RLAPI void rlEnablePointMode(void); // Enable point mode
|
RLAPI void rlEnablePointMode(void); // Enable point mode
|
||||||
RLAPI void rlDisableWireMode(void); // Disable wire mode ( and point ) maybe rename
|
RLAPI void rlDisableWireMode(void); // Disable wire (and point) mode
|
||||||
RLAPI void rlSetLineWidth(float width); // Set the line drawing width
|
RLAPI void rlSetLineWidth(float width); // Set the line drawing width
|
||||||
RLAPI float rlGetLineWidth(void); // Get the line drawing width
|
RLAPI float rlGetLineWidth(void); // Get the line drawing width
|
||||||
RLAPI void rlEnableSmoothLines(void); // Enable line aliasing
|
RLAPI void rlEnableSmoothLines(void); // Enable line aliasing
|
||||||
|
|
@ -755,6 +772,7 @@ RLAPI int rlGetLocationUniform(unsigned int shaderId, const char *uniformName);
|
||||||
RLAPI int rlGetLocationAttrib(unsigned int shaderId, const char *attribName); // Get shader location attribute
|
RLAPI int rlGetLocationAttrib(unsigned int shaderId, const char *attribName); // Get shader location attribute
|
||||||
RLAPI void rlSetUniform(int locIndex, const void *value, int uniformType, int count); // Set shader value uniform
|
RLAPI void rlSetUniform(int locIndex, const void *value, int uniformType, int count); // Set shader value uniform
|
||||||
RLAPI void rlSetUniformMatrix(int locIndex, Matrix mat); // Set shader value matrix
|
RLAPI void rlSetUniformMatrix(int locIndex, Matrix mat); // Set shader value matrix
|
||||||
|
RLAPI void rlSetUniformMatrices(int locIndex, const Matrix *mat, int count); // Set shader value matrices
|
||||||
RLAPI void rlSetUniformSampler(int locIndex, unsigned int textureId); // Set shader value sampler
|
RLAPI void rlSetUniformSampler(int locIndex, unsigned int textureId); // Set shader value sampler
|
||||||
RLAPI void rlSetShader(unsigned int id, int *locs); // Set shader currently active (id and locations)
|
RLAPI void rlSetShader(unsigned int id, int *locs); // Set shader currently active (id and locations)
|
||||||
|
|
||||||
|
|
@ -973,6 +991,12 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
||||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2
|
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS
|
||||||
|
#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS "vertexBoneIds" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS
|
||||||
|
#endif
|
||||||
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS
|
||||||
|
#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MVP
|
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MVP
|
||||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
||||||
|
|
@ -992,6 +1016,9 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
||||||
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR
|
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR
|
||||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
|
#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES
|
||||||
|
#define RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES "boneMatrices" // bone matrices
|
||||||
|
#endif
|
||||||
#ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0
|
#ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0
|
||||||
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1948,6 +1975,7 @@ void rlEnableWireMode(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable point mode
|
||||||
void rlEnablePointMode(void)
|
void rlEnablePointMode(void)
|
||||||
{
|
{
|
||||||
#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33)
|
#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33)
|
||||||
|
|
@ -1956,6 +1984,7 @@ void rlEnablePointMode(void)
|
||||||
glEnable(GL_PROGRAM_POINT_SIZE);
|
glEnable(GL_PROGRAM_POINT_SIZE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable wire mode
|
// Disable wire mode
|
||||||
void rlDisableWireMode(void)
|
void rlDisableWireMode(void)
|
||||||
{
|
{
|
||||||
|
|
@ -4143,6 +4172,11 @@ unsigned int rlLoadShaderProgram(unsigned int vShaderId, unsigned int fShaderId)
|
||||||
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT, RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT);
|
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT, RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT);
|
||||||
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2);
|
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2);
|
||||||
|
|
||||||
|
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
||||||
|
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS);
|
||||||
|
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS);
|
||||||
|
#endif
|
||||||
|
|
||||||
// NOTE: If some attrib name is no found on the shader, it locations becomes -1
|
// NOTE: If some attrib name is no found on the shader, it locations becomes -1
|
||||||
|
|
||||||
glLinkProgram(program);
|
glLinkProgram(program);
|
||||||
|
|
@ -4234,8 +4268,16 @@ void rlSetUniform(int locIndex, const void *value, int uniformType, int count)
|
||||||
case RL_SHADER_UNIFORM_IVEC2: glUniform2iv(locIndex, count, (int *)value); break;
|
case RL_SHADER_UNIFORM_IVEC2: glUniform2iv(locIndex, count, (int *)value); break;
|
||||||
case RL_SHADER_UNIFORM_IVEC3: glUniform3iv(locIndex, count, (int *)value); break;
|
case RL_SHADER_UNIFORM_IVEC3: glUniform3iv(locIndex, count, (int *)value); break;
|
||||||
case RL_SHADER_UNIFORM_IVEC4: glUniform4iv(locIndex, count, (int *)value); break;
|
case RL_SHADER_UNIFORM_IVEC4: glUniform4iv(locIndex, count, (int *)value); break;
|
||||||
|
#if !defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
|
case RL_SHADER_UNIFORM_UINT: glUniform1uiv(locIndex, count, (unsigned int *)value); break;
|
||||||
|
case RL_SHADER_UNIFORM_UIVEC2: glUniform2uiv(locIndex, count, (unsigned int *)value); break;
|
||||||
|
case RL_SHADER_UNIFORM_UIVEC3: glUniform3uiv(locIndex, count, (unsigned int *)value); break;
|
||||||
|
case RL_SHADER_UNIFORM_UIVEC4: glUniform4uiv(locIndex, count, (unsigned int *)value); break;
|
||||||
|
#endif
|
||||||
case RL_SHADER_UNIFORM_SAMPLER2D: glUniform1iv(locIndex, count, (int *)value); break;
|
case RL_SHADER_UNIFORM_SAMPLER2D: glUniform1iv(locIndex, count, (int *)value); break;
|
||||||
default: TRACELOG(RL_LOG_WARNING, "SHADER: Failed to set uniform value, data type not recognized");
|
default: TRACELOG(RL_LOG_WARNING, "SHADER: Failed to set uniform value, data type not recognized");
|
||||||
|
|
||||||
|
// TODO: Support glUniform1uiv(), glUniform2uiv(), glUniform3uiv(), glUniform4uiv()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -4269,6 +4311,14 @@ void rlSetUniformMatrix(int locIndex, Matrix mat)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set shader value uniform matrix
|
||||||
|
void rlSetUniformMatrices(int locIndex, const Matrix *matrices, int count)
|
||||||
|
{
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
|
glUniformMatrix4fv(locIndex, count, true, (const float*)matrices);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Set shader value uniform sampler
|
// Set shader value uniform sampler
|
||||||
void rlSetUniformSampler(int locIndex, unsigned int textureId)
|
void rlSetUniformSampler(int locIndex, unsigned int textureId)
|
||||||
{
|
{
|
||||||
|
|
@ -4410,14 +4460,14 @@ void rlUpdateShaderBuffer(unsigned int id, const void *data, unsigned int dataSi
|
||||||
// Get SSBO buffer size
|
// Get SSBO buffer size
|
||||||
unsigned int rlGetShaderBufferSize(unsigned int id)
|
unsigned int rlGetShaderBufferSize(unsigned int id)
|
||||||
{
|
{
|
||||||
GLint64 size = 0;
|
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_43)
|
#if defined(GRAPHICS_API_OPENGL_43)
|
||||||
|
GLint64 size = 0;
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, id);
|
glBindBuffer(GL_SHADER_STORAGE_BUFFER, id);
|
||||||
glGetBufferParameteri64v(GL_SHADER_STORAGE_BUFFER, GL_BUFFER_SIZE, &size);
|
glGetBufferParameteri64v(GL_SHADER_STORAGE_BUFFER, GL_BUFFER_SIZE, &size);
|
||||||
#endif
|
|
||||||
|
|
||||||
return (size > 0)? (unsigned int)size : 0;
|
return (size > 0)? (unsigned int)size : 0;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read SSBO buffer data (GPU->CPU)
|
// Read SSBO buffer data (GPU->CPU)
|
||||||
|
|
|
||||||
548
src/rmodels.c
548
src/rmodels.c
|
|
@ -130,7 +130,7 @@
|
||||||
#define MAX_MATERIAL_MAPS 12 // Maximum number of maps supported
|
#define MAX_MATERIAL_MAPS 12 // Maximum number of maps supported
|
||||||
#endif
|
#endif
|
||||||
#ifndef MAX_MESH_VERTEX_BUFFERS
|
#ifndef MAX_MESH_VERTEX_BUFFERS
|
||||||
#define MAX_MESH_VERTEX_BUFFERS 7 // Maximum vertex buffers (VBO) per mesh
|
#define MAX_MESH_VERTEX_BUFFERS 9 // Maximum vertex buffers (VBO) per mesh
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -1246,13 +1246,16 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
mesh->vboId = (unsigned int *)RL_CALLOC(MAX_MESH_VERTEX_BUFFERS, sizeof(unsigned int));
|
mesh->vboId = (unsigned int *)RL_CALLOC(MAX_MESH_VERTEX_BUFFERS, sizeof(unsigned int));
|
||||||
|
|
||||||
mesh->vaoId = 0; // Vertex Array Object
|
mesh->vaoId = 0; // Vertex Array Object
|
||||||
mesh->vboId[0] = 0; // Vertex buffer: positions
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION] = 0; // Vertex buffer: positions
|
||||||
mesh->vboId[1] = 0; // Vertex buffer: texcoords
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD] = 0; // Vertex buffer: texcoords
|
||||||
mesh->vboId[2] = 0; // Vertex buffer: normals
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL] = 0; // Vertex buffer: normals
|
||||||
mesh->vboId[3] = 0; // Vertex buffer: colors
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR] = 0; // Vertex buffer: colors
|
||||||
mesh->vboId[4] = 0; // Vertex buffer: tangents
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT] = 0; // Vertex buffer: tangents
|
||||||
mesh->vboId[5] = 0; // Vertex buffer: texcoords2
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2] = 0; // Vertex buffer: texcoords2
|
||||||
mesh->vboId[6] = 0; // Vertex buffer: indices
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES] = 0; // Vertex buffer: indices
|
||||||
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS] = 0; // Vertex buffer: boneIds
|
||||||
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS] = 0; // Vertex buffer: boneWeights
|
||||||
|
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
mesh->vaoId = rlLoadVertexArray();
|
mesh->vaoId = rlLoadVertexArray();
|
||||||
|
|
@ -1262,12 +1265,12 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
|
|
||||||
// Enable vertex attributes: position (shader-location = 0)
|
// Enable vertex attributes: position (shader-location = 0)
|
||||||
void *vertices = (mesh->animVertices != NULL)? mesh->animVertices : mesh->vertices;
|
void *vertices = (mesh->animVertices != NULL)? mesh->animVertices : mesh->vertices;
|
||||||
mesh->vboId[0] = rlLoadVertexBuffer(vertices, mesh->vertexCount*3*sizeof(float), dynamic);
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION] = rlLoadVertexBuffer(vertices, mesh->vertexCount*3*sizeof(float), dynamic);
|
||||||
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION, 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION, 3, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION);
|
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION);
|
||||||
|
|
||||||
// Enable vertex attributes: texcoords (shader-location = 1)
|
// Enable vertex attributes: texcoords (shader-location = 1)
|
||||||
mesh->vboId[1] = rlLoadVertexBuffer(mesh->texcoords, mesh->vertexCount*2*sizeof(float), dynamic);
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD] = rlLoadVertexBuffer(mesh->texcoords, mesh->vertexCount*2*sizeof(float), dynamic);
|
||||||
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, 2, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, 2, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD);
|
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD);
|
||||||
|
|
||||||
|
|
@ -1278,7 +1281,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
{
|
{
|
||||||
// Enable vertex attributes: normals (shader-location = 2)
|
// Enable vertex attributes: normals (shader-location = 2)
|
||||||
void *normals = (mesh->animNormals != NULL)? mesh->animNormals : mesh->normals;
|
void *normals = (mesh->animNormals != NULL)? mesh->animNormals : mesh->normals;
|
||||||
mesh->vboId[2] = rlLoadVertexBuffer(normals, mesh->vertexCount*3*sizeof(float), dynamic);
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL] = rlLoadVertexBuffer(normals, mesh->vertexCount*3*sizeof(float), dynamic);
|
||||||
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL, 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL, 3, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL);
|
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
@ -1294,7 +1297,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
if (mesh->colors != NULL)
|
if (mesh->colors != NULL)
|
||||||
{
|
{
|
||||||
// Enable vertex attribute: color (shader-location = 3)
|
// Enable vertex attribute: color (shader-location = 3)
|
||||||
mesh->vboId[3] = rlLoadVertexBuffer(mesh->colors, mesh->vertexCount*4*sizeof(unsigned char), dynamic);
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR] = rlLoadVertexBuffer(mesh->colors, mesh->vertexCount*4*sizeof(unsigned char), dynamic);
|
||||||
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR, 4, RL_UNSIGNED_BYTE, 1, 0, 0);
|
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR, 4, RL_UNSIGNED_BYTE, 1, 0, 0);
|
||||||
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR);
|
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR);
|
||||||
}
|
}
|
||||||
|
|
@ -1310,7 +1313,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
if (mesh->tangents != NULL)
|
if (mesh->tangents != NULL)
|
||||||
{
|
{
|
||||||
// Enable vertex attribute: tangent (shader-location = 4)
|
// Enable vertex attribute: tangent (shader-location = 4)
|
||||||
mesh->vboId[4] = rlLoadVertexBuffer(mesh->tangents, mesh->vertexCount*4*sizeof(float), dynamic);
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT] = rlLoadVertexBuffer(mesh->tangents, mesh->vertexCount*4*sizeof(float), dynamic);
|
||||||
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT, 4, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT, 4, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT);
|
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT);
|
||||||
}
|
}
|
||||||
|
|
@ -1326,7 +1329,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
if (mesh->texcoords2 != NULL)
|
if (mesh->texcoords2 != NULL)
|
||||||
{
|
{
|
||||||
// Enable vertex attribute: texcoord2 (shader-location = 5)
|
// Enable vertex attribute: texcoord2 (shader-location = 5)
|
||||||
mesh->vboId[5] = rlLoadVertexBuffer(mesh->texcoords2, mesh->vertexCount*2*sizeof(float), dynamic);
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2] = rlLoadVertexBuffer(mesh->texcoords2, mesh->vertexCount*2*sizeof(float), dynamic);
|
||||||
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2, 2, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2, 2, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2);
|
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2);
|
||||||
}
|
}
|
||||||
|
|
@ -1339,9 +1342,43 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2);
|
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
||||||
|
if (mesh->boneIds != NULL)
|
||||||
|
{
|
||||||
|
// Enable vertex attribute: boneIds (shader-location = 6)
|
||||||
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS] = rlLoadVertexBuffer(mesh->boneIds, mesh->vertexCount*4*sizeof(unsigned char), dynamic);
|
||||||
|
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS, 4, RL_UNSIGNED_BYTE, 0, 0, 0);
|
||||||
|
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Default vertex attribute: boneIds
|
||||||
|
// WARNING: Default value provided to shader if location available
|
||||||
|
float value[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
|
rlSetVertexAttributeDefault(RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS, value, SHADER_ATTRIB_VEC4, 4);
|
||||||
|
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mesh->boneWeights != NULL)
|
||||||
|
{
|
||||||
|
// Enable vertex attribute: boneWeights (shader-location = 7)
|
||||||
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS] = rlLoadVertexBuffer(mesh->boneWeights, mesh->vertexCount*4*sizeof(float), dynamic);
|
||||||
|
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS, 4, RL_FLOAT, 0, 0, 0);
|
||||||
|
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Default vertex attribute: boneWeights
|
||||||
|
// WARNING: Default value provided to shader if location available
|
||||||
|
float value[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
|
rlSetVertexAttributeDefault(RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS, value, SHADER_ATTRIB_VEC4, 2);
|
||||||
|
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mesh->indices != NULL)
|
if (mesh->indices != NULL)
|
||||||
{
|
{
|
||||||
mesh->vboId[6] = rlLoadVertexBufferElement(mesh->indices, mesh->triangleCount*3*sizeof(unsigned short), dynamic);
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES] = rlLoadVertexBufferElement(mesh->indices, mesh->triangleCount*3*sizeof(unsigned short), dynamic);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mesh->vaoId > 0) TRACELOG(LOG_INFO, "VAO: [ID %i] Mesh uploaded successfully to VRAM (GPU)", mesh->vaoId);
|
if (mesh->vaoId > 0) TRACELOG(LOG_INFO, "VAO: [ID %i] Mesh uploaded successfully to VRAM (GPU)", mesh->vaoId);
|
||||||
|
|
@ -1451,6 +1488,14 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
|
|
||||||
// Upload model normal matrix (if locations available)
|
// Upload model normal matrix (if locations available)
|
||||||
if (material.shader.locs[SHADER_LOC_MATRIX_NORMAL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_NORMAL], MatrixTranspose(MatrixInvert(matModel)));
|
if (material.shader.locs[SHADER_LOC_MATRIX_NORMAL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_NORMAL], MatrixTranspose(MatrixInvert(matModel)));
|
||||||
|
|
||||||
|
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
||||||
|
// Upload Bone Transforms
|
||||||
|
if (material.shader.locs[SHADER_LOC_BONE_MATRICES] != -1 && mesh.boneMatrices)
|
||||||
|
{
|
||||||
|
rlSetUniformMatrices(material.shader.locs[SHADER_LOC_BONE_MATRICES], mesh.boneMatrices, mesh.boneCount);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
// Bind active texture maps (if available)
|
// Bind active texture maps (if available)
|
||||||
|
|
@ -1478,19 +1523,19 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
if (!rlEnableVertexArray(mesh.vaoId))
|
if (!rlEnableVertexArray(mesh.vaoId))
|
||||||
{
|
{
|
||||||
// Bind mesh VBO data: vertex position (shader-location = 0)
|
// Bind mesh VBO data: vertex position (shader-location = 0)
|
||||||
rlEnableVertexBuffer(mesh.vboId[0]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION], 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION], 3, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION]);
|
||||||
|
|
||||||
// Bind mesh VBO data: vertex texcoords (shader-location = 1)
|
// Bind mesh VBO data: vertex texcoords (shader-location = 1)
|
||||||
rlEnableVertexBuffer(mesh.vboId[1]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD01], 2, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD01], 2, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD01]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD01]);
|
||||||
|
|
||||||
if (material.shader.locs[SHADER_LOC_VERTEX_NORMAL] != -1)
|
if (material.shader.locs[SHADER_LOC_VERTEX_NORMAL] != -1)
|
||||||
{
|
{
|
||||||
// Bind mesh VBO data: vertex normals (shader-location = 2)
|
// Bind mesh VBO data: vertex normals (shader-location = 2)
|
||||||
rlEnableVertexBuffer(mesh.vboId[2]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_NORMAL], 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_NORMAL], 3, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_NORMAL]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_NORMAL]);
|
||||||
}
|
}
|
||||||
|
|
@ -1498,9 +1543,9 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
// Bind mesh VBO data: vertex colors (shader-location = 3, if available)
|
// Bind mesh VBO data: vertex colors (shader-location = 3, if available)
|
||||||
if (material.shader.locs[SHADER_LOC_VERTEX_COLOR] != -1)
|
if (material.shader.locs[SHADER_LOC_VERTEX_COLOR] != -1)
|
||||||
{
|
{
|
||||||
if (mesh.vboId[3] != 0)
|
if (mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR] != 0)
|
||||||
{
|
{
|
||||||
rlEnableVertexBuffer(mesh.vboId[3]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_COLOR], 4, RL_UNSIGNED_BYTE, 1, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_COLOR], 4, RL_UNSIGNED_BYTE, 1, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_COLOR]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_COLOR]);
|
||||||
}
|
}
|
||||||
|
|
@ -1517,7 +1562,7 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
// Bind mesh VBO data: vertex tangents (shader-location = 4, if available)
|
// Bind mesh VBO data: vertex tangents (shader-location = 4, if available)
|
||||||
if (material.shader.locs[SHADER_LOC_VERTEX_TANGENT] != -1)
|
if (material.shader.locs[SHADER_LOC_VERTEX_TANGENT] != -1)
|
||||||
{
|
{
|
||||||
rlEnableVertexBuffer(mesh.vboId[4]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TANGENT], 4, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TANGENT], 4, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TANGENT]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TANGENT]);
|
||||||
}
|
}
|
||||||
|
|
@ -1525,12 +1570,30 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
// Bind mesh VBO data: vertex texcoords2 (shader-location = 5, if available)
|
// Bind mesh VBO data: vertex texcoords2 (shader-location = 5, if available)
|
||||||
if (material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02] != -1)
|
if (material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02] != -1)
|
||||||
{
|
{
|
||||||
rlEnableVertexBuffer(mesh.vboId[5]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02], 2, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02], 2, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mesh.indices != NULL) rlEnableVertexBufferElement(mesh.vboId[6]);
|
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
||||||
|
// Bind mesh VBO data: vertex bone ids (shader-location = 6, if available)
|
||||||
|
if (material.shader.locs[SHADER_LOC_VERTEX_BONEIDS] != -1)
|
||||||
|
{
|
||||||
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS]);
|
||||||
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_BONEIDS], 4, RL_UNSIGNED_BYTE, 0, 0, 0);
|
||||||
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_BONEIDS]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind mesh VBO data: vertex bone weights (shader-location = 7, if available)
|
||||||
|
if (material.shader.locs[SHADER_LOC_VERTEX_BONEWEIGHTS] != -1)
|
||||||
|
{
|
||||||
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS]);
|
||||||
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_BONEWEIGHTS], 4, RL_FLOAT, 0, 0, 0);
|
||||||
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_BONEWEIGHTS]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (mesh.indices != NULL) rlEnableVertexBufferElement(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int eyeCount = 1;
|
int eyeCount = 1;
|
||||||
|
|
@ -1671,6 +1734,15 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||||
|
|
||||||
// Upload model normal matrix (if locations available)
|
// Upload model normal matrix (if locations available)
|
||||||
if (material.shader.locs[SHADER_LOC_MATRIX_NORMAL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_NORMAL], MatrixTranspose(MatrixInvert(matModel)));
|
if (material.shader.locs[SHADER_LOC_MATRIX_NORMAL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_NORMAL], MatrixTranspose(MatrixInvert(matModel)));
|
||||||
|
|
||||||
|
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
||||||
|
// Upload Bone Transforms
|
||||||
|
if (material.shader.locs[SHADER_LOC_BONE_MATRICES] != -1 && mesh.boneMatrices)
|
||||||
|
{
|
||||||
|
rlSetUniformMatrices(material.shader.locs[SHADER_LOC_BONE_MATRICES], mesh.boneMatrices, mesh.boneCount);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
// Bind active texture maps (if available)
|
// Bind active texture maps (if available)
|
||||||
|
|
@ -1696,19 +1768,19 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||||
if (!rlEnableVertexArray(mesh.vaoId))
|
if (!rlEnableVertexArray(mesh.vaoId))
|
||||||
{
|
{
|
||||||
// Bind mesh VBO data: vertex position (shader-location = 0)
|
// Bind mesh VBO data: vertex position (shader-location = 0)
|
||||||
rlEnableVertexBuffer(mesh.vboId[0]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION], 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION], 3, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION]);
|
||||||
|
|
||||||
// Bind mesh VBO data: vertex texcoords (shader-location = 1)
|
// Bind mesh VBO data: vertex texcoords (shader-location = 1)
|
||||||
rlEnableVertexBuffer(mesh.vboId[1]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD01], 2, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD01], 2, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD01]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD01]);
|
||||||
|
|
||||||
if (material.shader.locs[SHADER_LOC_VERTEX_NORMAL] != -1)
|
if (material.shader.locs[SHADER_LOC_VERTEX_NORMAL] != -1)
|
||||||
{
|
{
|
||||||
// Bind mesh VBO data: vertex normals (shader-location = 2)
|
// Bind mesh VBO data: vertex normals (shader-location = 2)
|
||||||
rlEnableVertexBuffer(mesh.vboId[2]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_NORMAL], 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_NORMAL], 3, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_NORMAL]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_NORMAL]);
|
||||||
}
|
}
|
||||||
|
|
@ -1716,9 +1788,9 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||||
// Bind mesh VBO data: vertex colors (shader-location = 3, if available)
|
// Bind mesh VBO data: vertex colors (shader-location = 3, if available)
|
||||||
if (material.shader.locs[SHADER_LOC_VERTEX_COLOR] != -1)
|
if (material.shader.locs[SHADER_LOC_VERTEX_COLOR] != -1)
|
||||||
{
|
{
|
||||||
if (mesh.vboId[3] != 0)
|
if (mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR] != 0)
|
||||||
{
|
{
|
||||||
rlEnableVertexBuffer(mesh.vboId[3]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_COLOR], 4, RL_UNSIGNED_BYTE, 1, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_COLOR], 4, RL_UNSIGNED_BYTE, 1, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_COLOR]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_COLOR]);
|
||||||
}
|
}
|
||||||
|
|
@ -1735,7 +1807,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||||
// Bind mesh VBO data: vertex tangents (shader-location = 4, if available)
|
// Bind mesh VBO data: vertex tangents (shader-location = 4, if available)
|
||||||
if (material.shader.locs[SHADER_LOC_VERTEX_TANGENT] != -1)
|
if (material.shader.locs[SHADER_LOC_VERTEX_TANGENT] != -1)
|
||||||
{
|
{
|
||||||
rlEnableVertexBuffer(mesh.vboId[4]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TANGENT], 4, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TANGENT], 4, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TANGENT]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TANGENT]);
|
||||||
}
|
}
|
||||||
|
|
@ -1743,12 +1815,28 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||||
// Bind mesh VBO data: vertex texcoords2 (shader-location = 5, if available)
|
// Bind mesh VBO data: vertex texcoords2 (shader-location = 5, if available)
|
||||||
if (material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02] != -1)
|
if (material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02] != -1)
|
||||||
{
|
{
|
||||||
rlEnableVertexBuffer(mesh.vboId[5]);
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02], 2, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02], 2, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bind mesh VBO data: vertex bone ids (shader-location = 6, if available)
|
||||||
|
if (material.shader.locs[SHADER_LOC_VERTEX_BONEIDS] != -1)
|
||||||
|
{
|
||||||
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS]);
|
||||||
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_BONEIDS], 4, RL_UNSIGNED_BYTE, 0, 0, 0);
|
||||||
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_BONEIDS]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind mesh VBO data: vertex bone weights (shader-location = 7, if available)
|
||||||
|
if (material.shader.locs[SHADER_LOC_VERTEX_BONEWEIGHTS] != -1)
|
||||||
|
{
|
||||||
|
rlEnableVertexBuffer(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS]);
|
||||||
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_BONEWEIGHTS], 4, RL_FLOAT, 0, 0, 0);
|
||||||
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_BONEWEIGHTS]);
|
||||||
|
}
|
||||||
|
|
||||||
if (mesh.indices != NULL) rlEnableVertexBufferElement(mesh.vboId[6]);
|
if (mesh.indices != NULL) rlEnableVertexBufferElement(mesh.vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int eyeCount = 1;
|
int eyeCount = 1;
|
||||||
|
|
@ -1825,6 +1913,7 @@ void UnloadMesh(Mesh mesh)
|
||||||
RL_FREE(mesh.animNormals);
|
RL_FREE(mesh.animNormals);
|
||||||
RL_FREE(mesh.boneWeights);
|
RL_FREE(mesh.boneWeights);
|
||||||
RL_FREE(mesh.boneIds);
|
RL_FREE(mesh.boneIds);
|
||||||
|
RL_FREE(mesh.boneMatrices);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export mesh data to file
|
// Export mesh data to file
|
||||||
|
|
@ -2016,6 +2105,8 @@ static void ProcessMaterialsOBJ(Material *materials, tinyobj_material_t *mats, i
|
||||||
// NOTE: Uses default shader, which only supports MATERIAL_MAP_DIFFUSE
|
// NOTE: Uses default shader, which only supports MATERIAL_MAP_DIFFUSE
|
||||||
materials[m] = LoadMaterialDefault();
|
materials[m] = LoadMaterialDefault();
|
||||||
|
|
||||||
|
if (mats == NULL) continue;
|
||||||
|
|
||||||
// Get default texture, in case no texture is defined
|
// Get default texture, in case no texture is defined
|
||||||
// NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8
|
// NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8
|
||||||
materials[m].maps[MATERIAL_MAP_DIFFUSE].texture = (Texture2D){ rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
|
materials[m].maps[MATERIAL_MAP_DIFFUSE].texture = (Texture2D){ rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
|
||||||
|
|
@ -2253,6 +2344,50 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateModelAnimationBoneMatrices(Model model, ModelAnimation anim, int frame)
|
||||||
|
{
|
||||||
|
if ((anim.frameCount > 0) && (anim.bones != NULL) && (anim.framePoses != NULL))
|
||||||
|
{
|
||||||
|
if (frame >= anim.frameCount) frame = frame%anim.frameCount;
|
||||||
|
|
||||||
|
for (int i = 0; i < model.meshCount; i++)
|
||||||
|
{
|
||||||
|
if (model.meshes[i].boneMatrices)
|
||||||
|
{
|
||||||
|
assert(model.meshes[i].boneCount == anim.boneCount);
|
||||||
|
|
||||||
|
for (int boneId = 0; boneId < model.meshes[i].boneCount; boneId++)
|
||||||
|
{
|
||||||
|
Vector3 inTranslation = model.bindPose[boneId].translation;
|
||||||
|
Quaternion inRotation = model.bindPose[boneId].rotation;
|
||||||
|
Vector3 inScale = model.bindPose[boneId].scale;
|
||||||
|
|
||||||
|
Vector3 outTranslation = anim.framePoses[frame][boneId].translation;
|
||||||
|
Quaternion outRotation = anim.framePoses[frame][boneId].rotation;
|
||||||
|
Vector3 outScale = anim.framePoses[frame][boneId].scale;
|
||||||
|
|
||||||
|
Vector3 invTranslation = Vector3RotateByQuaternion(Vector3Negate(inTranslation), QuaternionInvert(inRotation));
|
||||||
|
Quaternion invRotation = QuaternionInvert(inRotation);
|
||||||
|
Vector3 invScale = Vector3Divide((Vector3){ 1.0f, 1.0f, 1.0f }, inScale);
|
||||||
|
|
||||||
|
Vector3 boneTranslation = Vector3Add(
|
||||||
|
Vector3RotateByQuaternion(Vector3Multiply(outScale, invTranslation),
|
||||||
|
outRotation), outTranslation);
|
||||||
|
Quaternion boneRotation = QuaternionMultiply(outRotation, invRotation);
|
||||||
|
Vector3 boneScale = Vector3Multiply(outScale, invScale);
|
||||||
|
|
||||||
|
Matrix boneMatrix = MatrixMultiply(MatrixMultiply(
|
||||||
|
QuaternionToMatrix(boneRotation),
|
||||||
|
MatrixTranslate(boneTranslation.x, boneTranslation.y, boneTranslation.z)),
|
||||||
|
MatrixScale(boneScale.x, boneScale.y, boneScale.z));
|
||||||
|
|
||||||
|
model.meshes[i].boneMatrices[boneId] = boneMatrix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Unload animation array data
|
// Unload animation array data
|
||||||
void UnloadModelAnimations(ModelAnimation *animations, int animCount)
|
void UnloadModelAnimations(ModelAnimation *animations, int animCount)
|
||||||
{
|
{
|
||||||
|
|
@ -3631,6 +3766,30 @@ void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float
|
||||||
rlDisableWireMode();
|
rlDisableWireMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw a model points
|
||||||
|
void DrawModelPoints(Model model, Vector3 position, float scale, Color tint)
|
||||||
|
{
|
||||||
|
rlEnablePointMode();
|
||||||
|
rlDisableBackfaceCulling();
|
||||||
|
|
||||||
|
DrawModel(model, position, scale, tint);
|
||||||
|
|
||||||
|
rlEnableBackfaceCulling();
|
||||||
|
rlDisableWireMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw a model points
|
||||||
|
void DrawModelPointsEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint)
|
||||||
|
{
|
||||||
|
rlEnablePointMode();
|
||||||
|
rlDisableBackfaceCulling();
|
||||||
|
|
||||||
|
DrawModelEx(model, position, rotationAxis, rotationAngle, scale, tint);
|
||||||
|
|
||||||
|
rlEnableBackfaceCulling();
|
||||||
|
rlDisableWireMode();
|
||||||
|
}
|
||||||
|
|
||||||
// Draw a billboard
|
// Draw a billboard
|
||||||
void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint)
|
void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint)
|
||||||
{
|
{
|
||||||
|
|
@ -4049,124 +4208,236 @@ static void BuildPoseFromParentJoints(BoneInfo *bones, int boneCount, Transform
|
||||||
// - the mesh is automatically triangulated by tinyobj
|
// - the mesh is automatically triangulated by tinyobj
|
||||||
static Model LoadOBJ(const char *fileName)
|
static Model LoadOBJ(const char *fileName)
|
||||||
{
|
{
|
||||||
|
tinyobj_attrib_t objAttributes = { 0 };
|
||||||
|
tinyobj_shape_t* objShapes = NULL;
|
||||||
|
unsigned int objShapeCount = 0;
|
||||||
|
|
||||||
|
tinyobj_material_t* objMaterials = NULL;
|
||||||
|
unsigned int objMaterialCount = 0;
|
||||||
|
|
||||||
Model model = { 0 };
|
Model model = { 0 };
|
||||||
|
model.transform = MatrixIdentity();
|
||||||
|
|
||||||
tinyobj_attrib_t attrib = { 0 };
|
char* fileText = LoadFileText(fileName);
|
||||||
tinyobj_shape_t *meshes = NULL;
|
|
||||||
unsigned int meshCount = 0;
|
|
||||||
|
|
||||||
tinyobj_material_t *materials = NULL;
|
if (fileText == NULL)
|
||||||
unsigned int materialCount = 0;
|
|
||||||
|
|
||||||
char *fileText = LoadFileText(fileName);
|
|
||||||
|
|
||||||
if (fileText != NULL)
|
|
||||||
{
|
{
|
||||||
unsigned int dataSize = (unsigned int)strlen(fileText);
|
TRACELOG(LOG_ERROR, "MODEL Unable to read obj file %s", fileName);
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
char currentDir[1024] = { 0 };
|
char currentDir[1024] = { 0 };
|
||||||
strcpy(currentDir, GetWorkingDirectory()); // Save current working directory
|
strcpy(currentDir, GetWorkingDirectory()); // Save current working directory
|
||||||
const char *workingDir = GetDirectoryPath(fileName); // Switch to OBJ directory for material path correctness
|
const char* workingDir = GetDirectoryPath(fileName); // Switch to OBJ directory for material path correctness
|
||||||
if (CHDIR(workingDir) != 0)
|
if (CHDIR(workingDir) != 0)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to change working directory", workingDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int dataSize = (unsigned int)strlen(fileText);
|
||||||
|
|
||||||
|
unsigned int flags = TINYOBJ_FLAG_TRIANGULATE;
|
||||||
|
int ret = tinyobj_parse_obj(&objAttributes, &objShapes, &objShapeCount, &objMaterials, &objMaterialCount, fileText, dataSize, flags);
|
||||||
|
|
||||||
|
if (ret != TINYOBJ_SUCCESS)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_ERROR, "MODEL Unable to read obj data %s", fileName);
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnloadFileText(fileText);
|
||||||
|
|
||||||
|
unsigned int faceVertIndex = 0;
|
||||||
|
unsigned int nextShape = 1;
|
||||||
|
int lastMaterial = -1;
|
||||||
|
unsigned int meshIndex = 0;
|
||||||
|
|
||||||
|
// count meshes
|
||||||
|
unsigned int nextShapeEnd = objAttributes.num_face_num_verts;
|
||||||
|
|
||||||
|
// see how many verts till the next shape
|
||||||
|
|
||||||
|
if (objShapeCount > 1) nextShapeEnd = objShapes[nextShape].face_offset;
|
||||||
|
|
||||||
|
// walk all the faces
|
||||||
|
for (unsigned int faceId = 0; faceId < objAttributes.num_faces; faceId++)
|
||||||
|
{
|
||||||
|
if (faceVertIndex >= nextShapeEnd)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to change working directory", workingDir);
|
// try to find the last vert in the next shape
|
||||||
|
nextShape++;
|
||||||
|
if (nextShape < objShapeCount) nextShapeEnd = objShapes[nextShape].face_offset;
|
||||||
|
else nextShapeEnd = objAttributes.num_face_num_verts; // this is actually the total number of face verts in the file, not faces
|
||||||
|
meshIndex++;
|
||||||
|
}
|
||||||
|
else if (lastMaterial != -1 && objAttributes.material_ids[faceId] != lastMaterial)
|
||||||
|
{
|
||||||
|
meshIndex++;// if this is a new material, we need to allocate a new mesh
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int flags = TINYOBJ_FLAG_TRIANGULATE;
|
lastMaterial = objAttributes.material_ids[faceId];
|
||||||
int ret = tinyobj_parse_obj(&attrib, &meshes, &meshCount, &materials, &materialCount, fileText, dataSize, flags);
|
faceVertIndex += objAttributes.face_num_verts[faceId];
|
||||||
|
}
|
||||||
|
|
||||||
if (ret != TINYOBJ_SUCCESS) TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to load OBJ data", fileName);
|
// allocate the base meshes and materials
|
||||||
else TRACELOG(LOG_INFO, "MODEL: [%s] OBJ data loaded successfully: %i meshes/%i materials", fileName, meshCount, materialCount);
|
model.meshCount = meshIndex + 1;
|
||||||
|
model.meshes = (Mesh*)MemAlloc(sizeof(Mesh) * model.meshCount);
|
||||||
|
|
||||||
// WARNING: We are not splitting meshes by materials (previous implementation)
|
if (objMaterialCount > 0)
|
||||||
// Depending on the provided OBJ that was not the best option and it just crashed
|
{
|
||||||
// so, implementation was simplified to prioritize parsed meshes
|
model.materialCount = objMaterialCount;
|
||||||
model.meshCount = meshCount;
|
model.materials = (Material*)MemAlloc(sizeof(Material) * objMaterialCount);
|
||||||
|
}
|
||||||
|
else // we must allocate at least one material
|
||||||
|
{
|
||||||
|
model.materialCount = 1;
|
||||||
|
model.materials = (Material*)MemAlloc(sizeof(Material) * 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Set number of materials available
|
model.meshMaterial = (int*)MemAlloc(sizeof(int) * model.meshCount);
|
||||||
// NOTE: There could be more materials available than meshes but it will be resolved at
|
|
||||||
// model.meshMaterial, just assigning the right material to corresponding mesh
|
// see how many verts are in each mesh
|
||||||
model.materialCount = materialCount;
|
unsigned int* localMeshVertexCounts = (unsigned int*)MemAlloc(sizeof(unsigned int) * model.meshCount);
|
||||||
if (model.materialCount == 0)
|
|
||||||
|
faceVertIndex = 0;
|
||||||
|
nextShapeEnd = objAttributes.num_face_num_verts;
|
||||||
|
lastMaterial = -1;
|
||||||
|
meshIndex = 0;
|
||||||
|
unsigned int localMeshVertexCount = 0;
|
||||||
|
|
||||||
|
nextShape = 1;
|
||||||
|
if (objShapeCount > 1)
|
||||||
|
nextShapeEnd = objShapes[nextShape].face_offset;
|
||||||
|
|
||||||
|
// walk all the faces
|
||||||
|
for (unsigned int faceId = 0; faceId < objAttributes.num_faces; faceId++)
|
||||||
|
{
|
||||||
|
bool newMesh = false; // do we need a new mesh?
|
||||||
|
if (faceVertIndex >= nextShapeEnd)
|
||||||
{
|
{
|
||||||
model.materialCount = 1;
|
// try to find the last vert in the next shape
|
||||||
TRACELOG(LOG_INFO, "MODEL: No materials provided, setting one default material for all meshes");
|
nextShape++;
|
||||||
|
if (nextShape < objShapeCount) nextShapeEnd = objShapes[nextShape].face_offset;
|
||||||
|
else nextShapeEnd = objAttributes.num_face_num_verts; // this is actually the total number of face verts in the file, not faces
|
||||||
|
|
||||||
|
newMesh = true;
|
||||||
|
}
|
||||||
|
else if (lastMaterial != -1 && objAttributes.material_ids[faceId] != lastMaterial)
|
||||||
|
{
|
||||||
|
newMesh = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init model meshes and materials
|
lastMaterial = objAttributes.material_ids[faceId];
|
||||||
model.meshes = (Mesh *)RL_CALLOC(model.meshCount, sizeof(Mesh));
|
|
||||||
model.meshMaterial = (int *)RL_CALLOC(model.meshCount, sizeof(int)); // Material index assigned to each mesh
|
|
||||||
model.materials = (Material *)RL_CALLOC(model.materialCount, sizeof(Material));
|
|
||||||
|
|
||||||
// Process each provided mesh
|
if (newMesh)
|
||||||
for (int i = 0; i < model.meshCount; i++)
|
|
||||||
{
|
{
|
||||||
// WARNING: We need to calculate the mesh triangles manually using meshes[i].face_offset
|
localMeshVertexCounts[meshIndex] = localMeshVertexCount;
|
||||||
// because in case of triangulated quads, meshes[i].length actually report quads,
|
|
||||||
// despite the triangulation that is efectively considered on attrib.num_faces
|
|
||||||
unsigned int tris = 0;
|
|
||||||
if (i == model.meshCount - 1) tris = attrib.num_faces - meshes[i].face_offset;
|
|
||||||
else tris = meshes[i + 1].face_offset;
|
|
||||||
|
|
||||||
model.meshes[i].vertexCount = tris*3;
|
localMeshVertexCount = 0;
|
||||||
model.meshes[i].triangleCount = tris; // Face count (triangulated)
|
meshIndex++;
|
||||||
model.meshes[i].vertices = (float *)RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float));
|
|
||||||
model.meshes[i].texcoords = (float *)RL_CALLOC(model.meshes[i].vertexCount*2, sizeof(float));
|
|
||||||
model.meshes[i].normals = (float *)RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float));
|
|
||||||
model.meshMaterial[i] = 0; // By default, assign material 0 to each mesh
|
|
||||||
|
|
||||||
// Process all mesh faces
|
|
||||||
for (unsigned int face = 0, f = meshes[i].face_offset, v = 0, vt = 0, vn = 0; face < tris; face++, f++, v += 3, vt += 3, vn += 3)
|
|
||||||
{
|
|
||||||
// Get indices for the face
|
|
||||||
tinyobj_vertex_index_t idx0 = attrib.faces[f*3 + 0];
|
|
||||||
tinyobj_vertex_index_t idx1 = attrib.faces[f*3 + 1];
|
|
||||||
tinyobj_vertex_index_t idx2 = attrib.faces[f*3 + 2];
|
|
||||||
|
|
||||||
// Fill vertices buffer (float) using vertex index of the face
|
|
||||||
for (int n = 0; n < 3; n++) { model.meshes[i].vertices[v*3 + n] = attrib.vertices[idx0.v_idx*3 + n]; }
|
|
||||||
for (int n = 0; n < 3; n++) { model.meshes[i].vertices[(v + 1)*3 + n] = attrib.vertices[idx1.v_idx*3 + n]; }
|
|
||||||
for (int n = 0; n < 3; n++) { model.meshes[i].vertices[(v + 2)*3 + n] = attrib.vertices[idx2.v_idx*3 + n]; }
|
|
||||||
|
|
||||||
if (attrib.num_texcoords > 0)
|
|
||||||
{
|
|
||||||
// Fill texcoords buffer (float) using vertex index of the face
|
|
||||||
// NOTE: Y-coordinate must be flipped upside-down
|
|
||||||
model.meshes[i].texcoords[vt*2 + 0] = attrib.texcoords[idx0.vt_idx*2 + 0];
|
|
||||||
model.meshes[i].texcoords[vt*2 + 1] = 1.0f - attrib.texcoords[idx0.vt_idx*2 + 1];
|
|
||||||
|
|
||||||
model.meshes[i].texcoords[(vt + 1)*2 + 0] = attrib.texcoords[idx1.vt_idx*2 + 0];
|
|
||||||
model.meshes[i].texcoords[(vt + 1)*2 + 1] = 1.0f - attrib.texcoords[idx1.vt_idx*2 + 1];
|
|
||||||
|
|
||||||
model.meshes[i].texcoords[(vt + 2)*2 + 0] = attrib.texcoords[idx2.vt_idx*2 + 0];
|
|
||||||
model.meshes[i].texcoords[(vt + 2)*2 + 1] = 1.0f - attrib.texcoords[idx2.vt_idx*2 + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attrib.num_normals > 0)
|
|
||||||
{
|
|
||||||
// Fill normals buffer (float) using vertex index of the face
|
|
||||||
for (int n = 0; n < 3; n++) { model.meshes[i].normals[vn*3 + n] = attrib.normals[idx0.vn_idx*3 + n]; }
|
|
||||||
for (int n = 0; n < 3; n++) { model.meshes[i].normals[(vn + 1)*3 + n] = attrib.normals[idx1.vn_idx*3 + n]; }
|
|
||||||
for (int n = 0; n < 3; n++) { model.meshes[i].normals[(vn + 2)*3 + n] = attrib.normals[idx2.vn_idx*3 + n]; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init model materials
|
faceVertIndex += objAttributes.face_num_verts[faceId];
|
||||||
if (materialCount > 0) ProcessMaterialsOBJ(model.materials, materials, materialCount);
|
localMeshVertexCount += objAttributes.face_num_verts[faceId];
|
||||||
else model.materials[0] = LoadMaterialDefault(); // Set default material for the mesh
|
}
|
||||||
|
localMeshVertexCounts[meshIndex] = localMeshVertexCount;
|
||||||
|
|
||||||
tinyobj_attrib_free(&attrib);
|
for (int i = 0; i < model.meshCount; i++)
|
||||||
tinyobj_shapes_free(meshes, model.meshCount);
|
{
|
||||||
tinyobj_materials_free(materials, materialCount);
|
// allocate the buffers for each mesh
|
||||||
|
unsigned int vertexCount = localMeshVertexCounts[i];
|
||||||
|
|
||||||
UnloadFileText(fileText);
|
model.meshes[i].vertexCount = vertexCount;
|
||||||
|
model.meshes[i].triangleCount = vertexCount / 3;
|
||||||
|
|
||||||
// Restore current working directory
|
model.meshes[i].vertices = (float*)MemAlloc(sizeof(float) * vertexCount * 3);
|
||||||
if (CHDIR(currentDir) != 0)
|
model.meshes[i].normals = (float*)MemAlloc(sizeof(float) * vertexCount * 3);
|
||||||
|
model.meshes[i].texcoords = (float*)MemAlloc(sizeof(float) * vertexCount * 2);
|
||||||
|
model.meshes[i].colors = (unsigned char*)MemAlloc(sizeof(unsigned char) * vertexCount * 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
MemFree(localMeshVertexCounts);
|
||||||
|
localMeshVertexCounts = NULL;
|
||||||
|
|
||||||
|
// fill meshes
|
||||||
|
faceVertIndex = 0;
|
||||||
|
|
||||||
|
nextShapeEnd = objAttributes.num_face_num_verts;
|
||||||
|
|
||||||
|
// see how many verts till the next shape
|
||||||
|
nextShape = 1;
|
||||||
|
if (objShapeCount > 1) nextShapeEnd = objShapes[nextShape].face_offset;
|
||||||
|
lastMaterial = -1;
|
||||||
|
meshIndex = 0;
|
||||||
|
localMeshVertexCount = 0;
|
||||||
|
|
||||||
|
// walk all the faces
|
||||||
|
for (unsigned int faceId = 0; faceId < objAttributes.num_faces; faceId++)
|
||||||
|
{
|
||||||
|
bool newMesh = false; // do we need a new mesh?
|
||||||
|
if (faceVertIndex >= nextShapeEnd)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to change working directory", currentDir);
|
// try to find the last vert in the next shape
|
||||||
|
nextShape++;
|
||||||
|
if (nextShape < objShapeCount) nextShapeEnd = objShapes[nextShape].face_offset;
|
||||||
|
else nextShapeEnd = objAttributes.num_face_num_verts; // this is actually the total number of face verts in the file, not faces
|
||||||
|
newMesh = true;
|
||||||
}
|
}
|
||||||
|
// if this is a new material, we need to allocate a new mesh
|
||||||
|
if (lastMaterial != -1 && objAttributes.material_ids[faceId] != lastMaterial) newMesh = true;
|
||||||
|
lastMaterial = objAttributes.material_ids[faceId];
|
||||||
|
|
||||||
|
if (newMesh)
|
||||||
|
{
|
||||||
|
localMeshVertexCount = 0;
|
||||||
|
meshIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int matId = 0;
|
||||||
|
if (lastMaterial >= 0 && lastMaterial < (int)objMaterialCount)
|
||||||
|
matId = lastMaterial;
|
||||||
|
|
||||||
|
model.meshMaterial[meshIndex] = matId;
|
||||||
|
|
||||||
|
for (int f = 0; f < objAttributes.face_num_verts[faceId]; f++)
|
||||||
|
{
|
||||||
|
int vertIndex = objAttributes.faces[faceVertIndex].v_idx;
|
||||||
|
int normalIndex = objAttributes.faces[faceVertIndex].vn_idx;
|
||||||
|
int texcordIndex = objAttributes.faces[faceVertIndex].vt_idx;
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
model.meshes[meshIndex].vertices[localMeshVertexCount * 3 + i] = objAttributes.vertices[vertIndex * 3 + i];
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
model.meshes[meshIndex].normals[localMeshVertexCount * 3 + i] = objAttributes.normals[normalIndex * 3 + i];
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
model.meshes[meshIndex].texcoords[localMeshVertexCount * 2 + i] = objAttributes.texcoords[texcordIndex * 2 + i];
|
||||||
|
|
||||||
|
model.meshes[meshIndex].texcoords[localMeshVertexCount * 2 + 1] = 1.0f - model.meshes[meshIndex].texcoords[localMeshVertexCount * 2 + 1];
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
model.meshes[meshIndex].colors[localMeshVertexCount * 4 + i] = 255;
|
||||||
|
|
||||||
|
faceVertIndex++;
|
||||||
|
localMeshVertexCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (objMaterialCount > 0) ProcessMaterialsOBJ(model.materials, objMaterials, objMaterialCount);
|
||||||
|
else model.materials[0] = LoadMaterialDefault(); // Set default material for the mesh
|
||||||
|
|
||||||
|
tinyobj_attrib_free(&objAttributes);
|
||||||
|
tinyobj_shapes_free(objShapes, objShapeCount);
|
||||||
|
tinyobj_materials_free(objMaterials, objMaterialCount);
|
||||||
|
|
||||||
|
for (int i = 0; i < model.meshCount; i++)
|
||||||
|
UploadMesh(model.meshes + i, true);
|
||||||
|
|
||||||
|
// Restore current working directory
|
||||||
|
if (CHDIR(currentDir) != 0)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to change working directory", currentDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
|
|
@ -4533,6 +4804,17 @@ static Model LoadIQM(const char *fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildPoseFromParentJoints(model.bones, model.boneCount, model.bindPose);
|
BuildPoseFromParentJoints(model.bones, model.boneCount, model.bindPose);
|
||||||
|
|
||||||
|
for (int i = 0; i < model.meshCount; i++)
|
||||||
|
{
|
||||||
|
model.meshes[i].boneCount = model.boneCount;
|
||||||
|
model.meshes[i].boneMatrices = RL_CALLOC(model.meshes[i].boneCount, sizeof(Matrix));
|
||||||
|
|
||||||
|
for (int j = 0; j < model.meshes[i].boneCount; j++)
|
||||||
|
{
|
||||||
|
model.meshes[i].boneMatrices[j] = MatrixIdentity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UnloadFileData(fileData);
|
UnloadFileData(fileData);
|
||||||
|
|
||||||
|
|
@ -5616,6 +5898,15 @@ static Model LoadGLTF(const char *fileName)
|
||||||
{
|
{
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bone Transform Matrices
|
||||||
|
model.meshes[meshIndex].boneCount = model.boneCount;
|
||||||
|
model.meshes[meshIndex].boneMatrices = RL_CALLOC(model.meshes[meshIndex].boneCount, sizeof(Matrix));
|
||||||
|
|
||||||
|
for (int j = 0; j < model.meshes[meshIndex].boneCount; j++)
|
||||||
|
{
|
||||||
|
model.meshes[meshIndex].boneMatrices[j] = MatrixIdentity();
|
||||||
|
}
|
||||||
|
|
||||||
meshIndex++; // Move to next mesh
|
meshIndex++; // Move to next mesh
|
||||||
}
|
}
|
||||||
|
|
@ -6384,6 +6675,13 @@ static Model LoadM3D(const char *fileName)
|
||||||
{
|
{
|
||||||
memcpy(model.meshes[i].animVertices, model.meshes[i].vertices, model.meshes[i].vertexCount*3*sizeof(float));
|
memcpy(model.meshes[i].animVertices, model.meshes[i].vertices, model.meshes[i].vertexCount*3*sizeof(float));
|
||||||
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].boneMatrices = RL_CALLOC(model.meshes[i].boneCount, sizeof(Matrix));
|
||||||
|
for (j = 0; j < model.meshes[i].boneCount; j++)
|
||||||
|
{
|
||||||
|
model.meshes[i].boneMatrices[j] = MatrixIdentity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
43
src/rtext.c
43
src/rtext.c
|
|
@ -124,6 +124,7 @@
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Global variables
|
// Global variables
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
extern bool isGpuReady;
|
||||||
#if defined(SUPPORT_DEFAULT_FONT)
|
#if defined(SUPPORT_DEFAULT_FONT)
|
||||||
// Default font provided by raylib
|
// Default font provided by raylib
|
||||||
// NOTE: Default font is loaded on InitWindow() and disposed on CloseWindow() [module: core]
|
// NOTE: Default font is loaded on InitWindow() and disposed on CloseWindow() [module: core]
|
||||||
|
|
@ -252,15 +253,15 @@ extern void LoadFontDefault(void)
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultFont.texture = LoadTextureFromImage(imFont);
|
if (isGpuReady) defaultFont.texture = LoadTextureFromImage(imFont);
|
||||||
|
|
||||||
// Reconstruct charSet using charsWidth[], charsHeight, charsDivisor, glyphCount
|
// Reconstruct charSet using charsWidth[], charsHeight, charsDivisor, glyphCount
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Allocate space for our characters info data
|
// Allocate space for our characters info data
|
||||||
// NOTE: This memory must be freed at end! --> Done by CloseWindow()
|
// NOTE: This memory must be freed at end! --> Done by CloseWindow()
|
||||||
defaultFont.glyphs = (GlyphInfo *)RL_MALLOC(defaultFont.glyphCount*sizeof(GlyphInfo));
|
defaultFont.glyphs = (GlyphInfo *)RL_CALLOC(defaultFont.glyphCount, sizeof(GlyphInfo));
|
||||||
defaultFont.recs = (Rectangle *)RL_MALLOC(defaultFont.glyphCount*sizeof(Rectangle));
|
defaultFont.recs = (Rectangle *)RL_CALLOC(defaultFont.glyphCount, sizeof(Rectangle));
|
||||||
|
|
||||||
int currentLine = 0;
|
int currentLine = 0;
|
||||||
int currentPosX = charsDivisor;
|
int currentPosX = charsDivisor;
|
||||||
|
|
@ -308,7 +309,7 @@ extern void LoadFontDefault(void)
|
||||||
extern void UnloadFontDefault(void)
|
extern void UnloadFontDefault(void)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < defaultFont.glyphCount; i++) UnloadImage(defaultFont.glyphs[i].image);
|
for (int i = 0; i < defaultFont.glyphCount; i++) UnloadImage(defaultFont.glyphs[i].image);
|
||||||
UnloadTexture(defaultFont.texture);
|
if (isGpuReady) UnloadTexture(defaultFont.texture);
|
||||||
RL_FREE(defaultFont.glyphs);
|
RL_FREE(defaultFont.glyphs);
|
||||||
RL_FREE(defaultFont.recs);
|
RL_FREE(defaultFont.recs);
|
||||||
}
|
}
|
||||||
|
|
@ -362,11 +363,14 @@ Font LoadFont(const char *fileName)
|
||||||
UnloadImage(image);
|
UnloadImage(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font.texture.id == 0) TRACELOG(LOG_WARNING, "FONT: [%s] Failed to load font texture -> Using default font", fileName);
|
if (isGpuReady)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
SetTextureFilter(font.texture, TEXTURE_FILTER_POINT); // By default, we set point filter (the best performance)
|
if (font.texture.id == 0) TRACELOG(LOG_WARNING, "FONT: [%s] Failed to load font texture -> Using default font", fileName);
|
||||||
TRACELOG(LOG_INFO, "FONT: Data loaded successfully (%i pixel size | %i glyphs)", FONT_TTF_DEFAULT_SIZE, FONT_TTF_DEFAULT_NUMCHARS);
|
else
|
||||||
|
{
|
||||||
|
SetTextureFilter(font.texture, TEXTURE_FILTER_POINT); // By default, we set point filter (the best performance)
|
||||||
|
TRACELOG(LOG_INFO, "FONT: Data loaded successfully (%i pixel size | %i glyphs)", FONT_TTF_DEFAULT_SIZE, FONT_TTF_DEFAULT_NUMCHARS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
|
|
@ -487,7 +491,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set font with all data parsed from image
|
// Set font with all data parsed from image
|
||||||
font.texture = LoadTextureFromImage(fontClear); // Convert processed image to OpenGL texture
|
if (isGpuReady) font.texture = LoadTextureFromImage(fontClear); // Convert processed image to OpenGL texture
|
||||||
font.glyphCount = index;
|
font.glyphCount = index;
|
||||||
font.glyphPadding = 0;
|
font.glyphPadding = 0;
|
||||||
|
|
||||||
|
|
@ -556,7 +560,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
|
||||||
font.glyphPadding = FONT_TTF_DEFAULT_CHARS_PADDING;
|
font.glyphPadding = FONT_TTF_DEFAULT_CHARS_PADDING;
|
||||||
|
|
||||||
Image atlas = GenImageFontAtlas(font.glyphs, &font.recs, font.glyphCount, font.baseSize, font.glyphPadding, 0);
|
Image atlas = GenImageFontAtlas(font.glyphs, &font.recs, font.glyphCount, font.baseSize, font.glyphPadding, 0);
|
||||||
font.texture = LoadTextureFromImage(atlas);
|
if (isGpuReady) font.texture = LoadTextureFromImage(atlas);
|
||||||
|
|
||||||
// Update glyphs[i].image to use alpha, required to be used on ImageDrawText()
|
// Update glyphs[i].image to use alpha, required to be used on ImageDrawText()
|
||||||
for (int i = 0; i < font.glyphCount; i++)
|
for (int i = 0; i < font.glyphCount; i++)
|
||||||
|
|
@ -580,7 +584,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
|
||||||
// Check if a font is ready
|
// Check if a font is ready
|
||||||
bool IsFontReady(Font font)
|
bool IsFontReady(Font font)
|
||||||
{
|
{
|
||||||
return ((font.texture.id > 0) && // Validate OpenGL id fot font texture atlas
|
return ((font.texture.id > 0) && // Validate OpenGL id for font texture atlas
|
||||||
(font.baseSize > 0) && // Validate font size
|
(font.baseSize > 0) && // Validate font size
|
||||||
(font.glyphCount > 0) && // Validate font contains some glyph
|
(font.glyphCount > 0) && // Validate font contains some glyph
|
||||||
(font.recs != NULL) && // Validate font recs defining glyphs on texture atlas
|
(font.recs != NULL) && // Validate font recs defining glyphs on texture atlas
|
||||||
|
|
@ -673,6 +677,8 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
|
||||||
{
|
{
|
||||||
stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL);
|
stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL);
|
||||||
chars[i].advanceX = (int)((float)chars[i].advanceX*scaleFactor);
|
chars[i].advanceX = (int)((float)chars[i].advanceX*scaleFactor);
|
||||||
|
|
||||||
|
if (chh > fontSize) TRACELOG(LOG_WARNING, "FONT: Character [0x%08x] size is bigger than expected font size", ch);
|
||||||
|
|
||||||
// Load characters images
|
// Load characters images
|
||||||
chars[i].image.width = chw;
|
chars[i].image.width = chw;
|
||||||
|
|
@ -946,7 +952,7 @@ void UnloadFont(Font font)
|
||||||
if (font.texture.id != GetFontDefault().texture.id)
|
if (font.texture.id != GetFontDefault().texture.id)
|
||||||
{
|
{
|
||||||
UnloadFontData(font.glyphs, font.glyphCount);
|
UnloadFontData(font.glyphs, font.glyphCount);
|
||||||
UnloadTexture(font.texture);
|
if (isGpuReady) UnloadTexture(font.texture);
|
||||||
RL_FREE(font.recs);
|
RL_FREE(font.recs);
|
||||||
|
|
||||||
TRACELOGD("FONT: Unloaded font data from RAM and VRAM");
|
TRACELOGD("FONT: Unloaded font data from RAM and VRAM");
|
||||||
|
|
@ -1066,7 +1072,7 @@ bool ExportFontAsCode(Font font, const char *fileName)
|
||||||
byteCount += sprintf(txtData + byteCount, " Image imFont = { fontImageData_%s, %i, %i, 1, %i };\n\n", styleName, image.width, image.height, image.format);
|
byteCount += sprintf(txtData + byteCount, " Image imFont = { fontImageData_%s, %i, %i, 1, %i };\n\n", styleName, image.width, image.height, image.format);
|
||||||
#endif
|
#endif
|
||||||
byteCount += sprintf(txtData + byteCount, " // Load texture from image\n");
|
byteCount += sprintf(txtData + byteCount, " // Load texture from image\n");
|
||||||
byteCount += sprintf(txtData + byteCount, " font.texture = LoadTextureFromImage(imFont);\n");
|
byteCount += sprintf(txtData + byteCount, " if (isGpuReady) font.texture = LoadTextureFromImage(imFont);\n");
|
||||||
#if defined(SUPPORT_COMPRESSED_FONT_ATLAS)
|
#if defined(SUPPORT_COMPRESSED_FONT_ATLAS)
|
||||||
byteCount += sprintf(txtData + byteCount, " UnloadImage(imFont); // Uncompressed data can be unloaded from memory\n\n");
|
byteCount += sprintf(txtData + byteCount, " UnloadImage(imFont); // Uncompressed data can be unloaded from memory\n\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1277,7 +1283,7 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
|
||||||
{
|
{
|
||||||
Vector2 textSize = { 0 };
|
Vector2 textSize = { 0 };
|
||||||
|
|
||||||
if ((font.texture.id == 0) || (text == NULL)) return textSize; // Security check
|
if ((isGpuReady && (font.texture.id == 0)) || (text == NULL)) return textSize; // Security check
|
||||||
|
|
||||||
int size = TextLength(text); // Get size in bytes of text
|
int size = TextLength(text); // Get size in bytes of text
|
||||||
int tempByteCounter = 0; // Used to count longer text line num chars
|
int tempByteCounter = 0; // Used to count longer text line num chars
|
||||||
|
|
@ -1467,8 +1473,7 @@ float TextToFloat(const char *text)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
|
for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
|
||||||
|
|
||||||
if (text[i++] != '.') value *= sign;
|
if (text[i++] == '.')
|
||||||
else
|
|
||||||
{
|
{
|
||||||
float divisor = 10.0f;
|
float divisor = 10.0f;
|
||||||
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
|
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
|
||||||
|
|
@ -1478,7 +1483,7 @@ float TextToFloat(const char *text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value*sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SUPPORT_TEXT_MANIPULATION)
|
#if defined(SUPPORT_TEXT_MANIPULATION)
|
||||||
|
|
@ -2258,7 +2263,7 @@ static Font LoadBMFont(const char *fileName)
|
||||||
|
|
||||||
RL_FREE(imFonts);
|
RL_FREE(imFonts);
|
||||||
|
|
||||||
font.texture = LoadTextureFromImage(fullFont);
|
if (isGpuReady) font.texture = LoadTextureFromImage(fullFont);
|
||||||
|
|
||||||
// Fill font characters info data
|
// Fill font characters info data
|
||||||
font.baseSize = fontSize;
|
font.baseSize = fontSize;
|
||||||
|
|
@ -2300,7 +2305,7 @@ static Font LoadBMFont(const char *fileName)
|
||||||
UnloadImage(fullFont);
|
UnloadImage(fullFont);
|
||||||
UnloadFileText(fileText);
|
UnloadFileText(fileText);
|
||||||
|
|
||||||
if (font.texture.id == 0)
|
if (isGpuReady && (font.texture.id == 0))
|
||||||
{
|
{
|
||||||
UnloadFont(font);
|
UnloadFont(font);
|
||||||
font = GetFontDefault();
|
font = GetFontDefault();
|
||||||
|
|
|
||||||
|
|
@ -1112,6 +1112,7 @@ Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float
|
||||||
{
|
{
|
||||||
Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
|
Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
|
||||||
|
|
||||||
|
float aspectRatio = (float)width / (float)height;
|
||||||
for (int y = 0; y < height; y++)
|
for (int y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
|
|
@ -1119,6 +1120,10 @@ Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float
|
||||||
float nx = (float)(x + offsetX)*(scale/(float)width);
|
float nx = (float)(x + offsetX)*(scale/(float)width);
|
||||||
float ny = (float)(y + offsetY)*(scale/(float)height);
|
float ny = (float)(y + offsetY)*(scale/(float)height);
|
||||||
|
|
||||||
|
// Apply aspect ratio compensation to wider side
|
||||||
|
if (width > height) nx *= aspectRatio;
|
||||||
|
else ny /= aspectRatio;
|
||||||
|
|
||||||
// Basic perlin noise implementation (not used)
|
// Basic perlin noise implementation (not used)
|
||||||
//float p = (stb_perlin_noise3(nx, ny, 0.0f, 0, 0, 0);
|
//float p = (stb_perlin_noise3(nx, ny, 0.0f, 0, 0, 0);
|
||||||
|
|
||||||
|
|
@ -4560,6 +4565,9 @@ void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2
|
||||||
|
|
||||||
if (source.width < 0) { flipX = true; source.width *= -1; }
|
if (source.width < 0) { flipX = true; source.width *= -1; }
|
||||||
if (source.height < 0) source.y -= source.height;
|
if (source.height < 0) source.y -= source.height;
|
||||||
|
|
||||||
|
if (dest.width < 0) dest.width *= -1;
|
||||||
|
if (dest.height < 0) dest.height *= -1;
|
||||||
|
|
||||||
Vector2 topLeft = { 0 };
|
Vector2 topLeft = { 0 };
|
||||||
Vector2 topRight = { 0 };
|
Vector2 topRight = { 0 };
|
||||||
|
|
@ -4980,6 +4988,8 @@ Vector3 ColorToHSV(Color color)
|
||||||
return hsv;
|
return hsv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Get a Color from HSV values
|
// Get a Color from HSV values
|
||||||
// Implementation reference: https://en.wikipedia.org/wiki/HSL_and_HSV#Alternative_HSV_conversion
|
// Implementation reference: https://en.wikipedia.org/wiki/HSL_and_HSV#Alternative_HSV_conversion
|
||||||
// NOTE: Color->HSV->Color conversion will not yield exactly the same color due to rounding errors
|
// NOTE: Color->HSV->Color conversion will not yield exactly the same color due to rounding errors
|
||||||
|
|
@ -5178,6 +5188,22 @@ Color ColorAlphaBlend(Color dst, Color src, Color tint)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get color lerp interpolation between two colors, factor [0.0f..1.0f]
|
||||||
|
Color ColorLerp(Color color1, Color color2, float factor)
|
||||||
|
{
|
||||||
|
Color color = { 0 };
|
||||||
|
|
||||||
|
if (factor < 0.0f) factor = 0.0f;
|
||||||
|
else if (factor > 1.0f) factor = 1.0f;
|
||||||
|
|
||||||
|
color.r = (unsigned char)((1.0f - factor)*color1.r + factor*color2.r);
|
||||||
|
color.g = (unsigned char)((1.0f - factor)*color1.g + factor*color2.g);
|
||||||
|
color.b = (unsigned char)((1.0f - factor)*color1.b + factor*color2.b);
|
||||||
|
color.a = (unsigned char)((1.0f - factor)*color1.a + factor*color2.a);
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
// Get a Color struct from hexadecimal value
|
// Get a Color struct from hexadecimal value
|
||||||
Color GetColor(unsigned int hexValue)
|
Color GetColor(unsigned int hexValue)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user