diff --git a/BINDINGS.md b/BINDINGS.md
index d24bf67c7..22b740588 100644
--- a/BINDINGS.md
+++ b/BINDINGS.md
@@ -36,7 +36,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| [jaylib](https://github.com/janet-lang/jaylib) | **5.0** | [Janet](https://janet-lang.org) | MIT |
| [jaylib](https://github.com/electronstudio/jaylib/) | 4.5 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE |
| [raylib-j](https://github.com/CreedVI/Raylib-J) | 4.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib |
-| [raylib.jl](https://github.com/irishgreencitrus/raylib.jl) | 4.2 | [Julia](https://julialang.org) | Zlib |
+| [Raylib.jl](https://github.com/chengchingwen/Raylib.jl) | 4.2 | [Julia](https://julialang.org) | Zlib |
| [kaylib](https://github.com/electronstudio/kaylib) | 3.7 | [Kotlin/native](https://kotlinlang.org) | **???** |
| [KaylibKit](https://codeberg.org/Kenta/KaylibKit) | 4.5 | [Kotlin/native](https://kotlinlang.org) | Zlib |
| [raylib-lua](https://github.com/TSnake41/raylib-lua) | 4.5 | [Lua](http://www.lua.org) | ISC |
diff --git a/CMakeOptions.txt b/CMakeOptions.txt
index 2c58cd5cc..b063f02a1 100644
--- a/CMakeOptions.txt
+++ b/CMakeOptions.txt
@@ -1,4 +1,4 @@
-### Config options ###
+# ## Config options ###
include(CMakeDependentOption)
include(EnumOption)
@@ -9,14 +9,14 @@ enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific
# Configuration options
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
option(CUSTOMIZE_BUILD "Show options for customizing your Raylib library build." OFF)
-option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
+option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended to run with ASAN)" OFF)
# 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(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)
+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)
enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one")
@@ -28,77 +28,9 @@ option(GLFW_BUILD_X11 "Build the bundled GLFW with X11 support" ON)
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
-# raylib modules included
-cmake_dependent_option(SUPPORT_MODULE_RSHAPES "Include module: rshapes" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_MODULE_RTEXTURES "Include module: rtextures" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_MODULE_RTEXT "Include module: rtext" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_MODULE_RMODELS "Include module: rmodels" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_MODULE_RAUDIO "Include module: raudio" ON CUSTOMIZE_BUILD ON)
+include(ParseConfigHeader)
-# rcore.c
-cmake_dependent_option(SUPPORT_CAMERA_SYSTEM "Provide camera module (rcamera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_RPRAND_GENERATOR "Include pseudo-random numbers generator (rprand.h), based on Xoshiro128** and SplitMix64" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_MOUSE_GESTURES "Mouse gestures are directly mapped like touches and processed by gestures system" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_SSH_KEYBOARD_RPI "Reconfigure standard input to receive key inputs, works with SSH connection" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_DEFAULT_FONT "Default font is loaded on window initialization to be available for the user to render simple text. If enabled, uses external module functions to load default raylib font (module: text)" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_SCREEN_CAPTURE "Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_GIF_RECORDING "Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_BUSY_WAIT_LOOP "Use busy wait loop for timing sync instead of a high-resolution timer" OFF CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_EVENTS_WAITING "Wait for events passively (sleeping while no events) instead of polling them actively every frame" OFF CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_WINMM_HIGHRES_TIMER "Setting a higher resolution can improve the accuracy of time-out intervals in wait functions" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_COMPRESSION_API "Support for compression API" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_EVENTS_AUTOMATION "Support automatic generated events, loading and recording of those events when required" OFF CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_CUSTOM_FRAME_CONTROL "Enabling this flag allows manual control of the frame processes, use at your own risk" OFF CUSTOMIZE_BUILD OFF)
-
-# rshapes.c
-cmake_dependent_option(SUPPORT_QUADS_DRAW_MODE "Use QUADS instead of TRIANGLES for drawing when possible. Some lines-based shapes could still use lines" ON CUSTOMIZE_BUILD ON)
-
-# rtextures.c
-cmake_dependent_option(SUPPORT_IMAGE_EXPORT "Support image exporting to file" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_IMAGE_GENERATION "Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_IMAGE_MANIPULATION "Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT()" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_PNG "Support loading PNG as textures" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_DDS "Support loading DDS as textures" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_HDR "Support loading HDR as textures" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_PIC "Support loading PIC as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_FILEFORMAT_PNM "Support loading PNM as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_FILEFORMAT_TGA "Support loading TGA as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_FILEFORMAT_JPG "Support loading JPG as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_QOI "Support loading QOI as textures" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-cmake_dependent_option(SUPPORT_FILEFORMAT_SVG "Support loading SVG as textures" ${OFF} CUSTOMIZE_BUILD OFF)
-
-# rtext.c
-cmake_dependent_option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_TTF "Support loading font in TTF/OTF format" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_TEXT_MANIPULATION "Support text manipulation functions" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FONT_ATLAS_WHITE_REC "Support white rec on font atlas bottom-right corner" ON CUSTOMIZE_BUILD ON)
-
-# rmodels.c
-cmake_dependent_option(SUPPORT_MESH_GENERATION "Support procedural mesh generation functions, uses external par_shapes.h library. NOTE: Some generated meshes DO NOT include generated texture coordinates" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_OBJ "Support loading OBJ file format" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_MTL "Support loading MTL file format" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_IQM "Support loading IQM file format" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_GLTF "Support loading GLTF file format" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_VOX "Support loading VOX file format" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_M3D "Support loading M3D file format" ON CUSTOMIZE_BUILD ON)
-
-# raudio.c
-cmake_dependent_option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_OGG "Support loading OGG for sound" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_XM "Support loading XM for sound" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_MOD "Support loading MOD for sound" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_MP3 "Support loading MP3 for sound" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_QOA "Support loading QOA for sound" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_FILEFORMAT_FLAC "Support loading FLAC for sound" ${OFF} CUSTOMIZE_BUILD OFF)
-
-# utils.c
-cmake_dependent_option(SUPPORT_STANDARD_FILEIO "Support standard file io library (stdio.h)" ON CUSTOMIZE_BUILD ON)
-cmake_dependent_option(SUPPORT_TRACELOG "Show TraceLog() output messages. NOTE: By default LOG_DEBUG traces not shown" ON CUSTOMIZE_BUILD ON)
+foreach(FLAG IN LISTS CONFIG_HEADER_FLAGS)
+ string(REGEX MATCH "([^=]+)=(.+)" _ ${FLAG})
+ cmake_dependent_option(${CMAKE_MATCH_1} "" ${CMAKE_MATCH_2} CUSTOMIZE_BUILD ${CMAKE_MATCH_2})
+endforeach()
diff --git a/cmake/CompileDefinitions.cmake b/cmake/CompileDefinitions.cmake
index cc8324c4b..0acbe2fa5 100644
--- a/cmake/CompileDefinitions.cmake
+++ b/cmake/CompileDefinitions.cmake
@@ -3,126 +3,22 @@ target_compile_definitions("raylib" PUBLIC "${PLATFORM_CPP}")
target_compile_definitions("raylib" PUBLIC "${GRAPHICS}")
function(define_if target variable)
- if (${${variable}})
+ if(${${variable}})
message(STATUS "${variable}=${${variable}}")
- target_compile_definitions(${target} PUBLIC "${variable}")
- endif ()
+ target_compile_definitions(${target} PRIVATE "${variable}")
+ endif()
endfunction()
-if (${CUSTOMIZE_BUILD})
- target_compile_definitions("raylib" PUBLIC EXTERNAL_CONFIG_FLAGS)
+if(${CUSTOMIZE_BUILD})
+ target_compile_definitions("raylib" PRIVATE EXTERNAL_CONFIG_FLAGS)
define_if("raylib" USE_AUDIO)
- define_if("raylib" SUPPORT_MODULE_RSHAPES)
- define_if("raylib" SUPPORT_MODULE_RTEXTURES)
- define_if("raylib" SUPPORT_MODULE_RTEXT)
- define_if("raylib" SUPPORT_MODULE_RMODELS)
- define_if("raylib" SUPPORT_MODULE_RAUDIO)
- define_if("raylib" SUPPORT_CAMERA_SYSTEM)
- define_if("raylib" SUPPORT_GESTURES_SYSTEM)
- define_if("raylib" SUPPORT_MOUSE_GESTURES)
- define_if("raylib" SUPPORT_SSH_KEYBOARD_RPI)
- define_if("raylib" SUPPORT_DEFAULT_FONT)
- define_if("raylib" SUPPORT_SCREEN_CAPTURE)
- define_if("raylib" SUPPORT_GIF_RECORDING)
- define_if("raylib" SUPPORT_BUSY_WAIT_LOOP)
- define_if("raylib" SUPPORT_EVENTS_WAITING)
- define_if("raylib" SUPPORT_WINMM_HIGHRES_TIMER)
- define_if("raylib" SUPPORT_COMPRESSION_API)
- define_if("raylib" SUPPORT_EVENTS_AUTOMATION)
- define_if("raylib" SUPPORT_CUSTOM_FRAME_CONTROL)
- define_if("raylib" SUPPORT_QUADS_DRAW_MODE)
- define_if("raylib" SUPPORT_IMAGE_EXPORT)
- define_if("raylib" SUPPORT_IMAGE_GENERATION)
- define_if("raylib" SUPPORT_IMAGE_MANIPULATION)
- define_if("raylib" SUPPORT_FILEFORMAT_PNG)
- define_if("raylib" SUPPORT_FILEFORMAT_DDS)
- define_if("raylib" SUPPORT_FILEFORMAT_HDR)
- define_if("raylib" SUPPORT_FILEFORMAT_PIC)
- define_if("raylib" SUPPORT_FILEFORMAT_PNM)
- define_if("raylib" SUPPORT_FILEFORMAT_KTX)
- define_if("raylib" SUPPORT_FILEFORMAT_ASTC)
- define_if("raylib" SUPPORT_FILEFORMAT_BMP)
- define_if("raylib" SUPPORT_FILEFORMAT_TGA)
- define_if("raylib" SUPPORT_FILEFORMAT_JPG)
- define_if("raylib" SUPPORT_FILEFORMAT_GIF)
- define_if("raylib" SUPPORT_FILEFORMAT_QOI)
- define_if("raylib" SUPPORT_FILEFORMAT_PSD)
- define_if("raylib" SUPPORT_FILEFORMAT_PKM)
- define_if("raylib" SUPPORT_FILEFORMAT_PVR)
- define_if("raylib" SUPPORT_FILEFORMAT_SVG)
- define_if("raylib" SUPPORT_FILEFORMAT_FNT)
- define_if("raylib" SUPPORT_FILEFORMAT_TTF)
- define_if("raylib" SUPPORT_TEXT_MANIPULATION)
- define_if("raylib" SUPPORT_MESH_GENERATION)
- define_if("raylib" SUPPORT_FILEFORMAT_OBJ)
- define_if("raylib" SUPPORT_FILEFORMAT_MTL)
- define_if("raylib" SUPPORT_FILEFORMAT_IQM)
- define_if("raylib" SUPPORT_FILEFORMAT_GLTF)
- define_if("raylib" SUPPORT_FILEFORMAT_VOX)
- define_if("raylib" SUPPORT_FILEFORMAT_M3D)
- define_if("raylib" SUPPORT_FILEFORMAT_WAV)
- define_if("raylib" SUPPORT_FILEFORMAT_OGG)
- define_if("raylib" SUPPORT_FILEFORMAT_XM)
- define_if("raylib" SUPPORT_FILEFORMAT_MOD)
- define_if("raylib" SUPPORT_FILEFORMAT_MP3)
- define_if("raylib" SUPPORT_FILEFORMAT_QOA)
- define_if("raylib" SUPPORT_FILEFORMAT_FLAC)
- define_if("raylib" SUPPORT_STANDARD_FILEIO)
- define_if("raylib" SUPPORT_TRACELOG)
- if (UNIX AND NOT APPLE)
- target_compile_definitions("raylib" PUBLIC "MAX_FILEPATH_LENGTH=4096")
- else ()
- target_compile_definitions("raylib" PUBLIC "MAX_FILEPATH_LENGTH=512")
- endif ()
-
- target_compile_definitions("raylib" PUBLIC "MAX_GAMEPADS=4")
- target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_AXIS=8")
- target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_BUTTONS=32")
- target_compile_definitions("raylib" PUBLIC "MAX_TOUCH_POINTS=10")
- target_compile_definitions("raylib" PUBLIC "MAX_KEY_PRESSED_QUEUE=16")
-
- target_compile_definitions("raylib" PUBLIC "STORAGE_DATA_FILE=\"storage.data\"")
- target_compile_definitions("raylib" PUBLIC "MAX_CHAR_PRESSED_QUEUE=16")
- target_compile_definitions("raylib" PUBLIC "MAX_DECOMPRESSION_SIZE=64")
-
- if (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_33" OR ${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_11")
- target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_BUFFER_ELEMENTS=8192")
- elseif (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES2")
- target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_BUFFER_ELEMENTS=2048")
- endif ()
-
- target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_DRAWCALLS=256")
- target_compile_definitions("raylib" PUBLIC "MAX_MATRIX_STACK_SIZE=32")
- target_compile_definitions("raylib" PUBLIC "MAX_SHADER_LOCATIONS=32")
- target_compile_definitions("raylib" PUBLIC "MAX_MATERIAL_MAPS=12")
- target_compile_definitions("raylib" PUBLIC "RL_CULL_DISTANCE_NEAR=0.01")
- target_compile_definitions("raylib" PUBLIC "RL_CULL_DISTANCE_FAR=1000.0")
-
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION=0")
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD=1")
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL=2")
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR=3")
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT=4")
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2=5")
-
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION=\"vertexPosition\"")
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD=\"vertexTexCoord\"")
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL=\"vertexNormal\"")
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR=\"vertexColor\"")
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT=\"vertexTangent\"")
- target_compile_definitions("raylib" PUBLIC "RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2=\"vertexTexCoord2\"")
-
- target_compile_definitions("raylib" PUBLIC "MAX_TEXT_BUFFER_LENGTH=1024")
- target_compile_definitions("raylib" PUBLIC "MAX_TEXT_UNICODE_CHARS=512")
- target_compile_definitions("raylib" PUBLIC "MAX_TEXTSPLIT_COUNT=128")
-
- target_compile_definitions("raylib" PUBLIC "AUDIO_DEVICE_FORMAT=ma_format_f32")
- target_compile_definitions("raylib" PUBLIC "AUDIO_DEVICE_CHANNELS=2")
- target_compile_definitions("raylib" PUBLIC "AUDIO_DEVICE_SAMPLE_RATE=44100")
- target_compile_definitions("raylib" PUBLIC "DEFAULT_AUDIO_BUFFER_SIZE=4096")
-
- target_compile_definitions("raylib" PUBLIC "MAX_TRACELOG_MSG_LENGTH=128")
- target_compile_definitions("raylib" PUBLIC "MAX_UWP_MESSAGES=512")
-endif ()
+ foreach(FLAG IN LISTS CONFIG_HEADER_FLAGS)
+ string(REGEX MATCH "([^=]+)=(.+)" _ ${FLAG})
+ define_if("raylib" ${CMAKE_MATCH_1})
+ endforeach()
+ foreach(VALUE IN LISTS CONFIG_HEADER_VALUES)
+ target_compile_definitions("raylib" PRIVATE ${VALUE})
+ endforeach()
+endif()
diff --git a/cmake/LibraryConfigurations.cmake b/cmake/LibraryConfigurations.cmake
index 23a7ec2f0..6d2250c71 100644
--- a/cmake/LibraryConfigurations.cmake
+++ b/cmake/LibraryConfigurations.cmake
@@ -58,8 +58,9 @@ if (${PLATFORM} MATCHES "Desktop")
elseif (${PLATFORM} MATCHES "Web")
set(PLATFORM_CPP "PLATFORM_WEB")
- set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 --profiling")
+ if(NOT GRAPHICS)
+ set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
+ endif()
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
elseif (${PLATFORM} MATCHES "Android")
diff --git a/cmake/ParseConfigHeader.cmake b/cmake/ParseConfigHeader.cmake
new file mode 100644
index 000000000..797eea3cd
--- /dev/null
+++ b/cmake/ParseConfigHeader.cmake
@@ -0,0 +1,17 @@
+file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h" CONFIG_HEADER_CONTENT)
+
+set(BLANK_OR_BACKSLASH_PATTERN "[ \t\r\n\\]")
+set(VALID_IDENTIFIER_PATTERN "[A-Za-z_]+[A-Za-z_0-9]*")
+set(VALID_VALUE_PATTERN [=["?[A-Za-z_0-9.-]+"?]=]) # not really correct but does the job since the config.h file hopefully will have been checked by a C preprocessor.
+set(MACRO_REGEX "(//${BLANK_OR_BACKSLASH_PATTERN}*)?\#define${BLANK_OR_BACKSLASH_PATTERN}+(${VALID_IDENTIFIER_PATTERN})${BLANK_OR_BACKSLASH_PATTERN}+(${VALID_VALUE_PATTERN})")
+
+string(REGEX MATCHALL ${MACRO_REGEX} MACRO_LIST ${CONFIG_HEADER_CONTENT})
+
+set(CONFIG_HEADER_FLAGS ${MACRO_LIST})
+list(FILTER CONFIG_HEADER_FLAGS INCLUDE REGEX "^.+SUPPORT_")
+list(TRANSFORM CONFIG_HEADER_FLAGS REPLACE ${MACRO_REGEX} [[\2=OFF]] REGEX "^//")
+list(TRANSFORM CONFIG_HEADER_FLAGS REPLACE ${MACRO_REGEX} [[\2=ON]])
+
+set(CONFIG_HEADER_VALUES ${MACRO_LIST})
+list(FILTER CONFIG_HEADER_VALUES EXCLUDE REGEX "(^.+SUPPORT_)|(^//)")
+list(TRANSFORM CONFIG_HEADER_VALUES REPLACE ${MACRO_REGEX} [[\2=\3]])
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 28550eaec..64b6d7604 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -96,10 +96,9 @@ if (${PLATFORM} MATCHES "Android")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_basic_lighting.c)
elseif (${PLATFORM} MATCHES "Web")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os")
# Since WASM is used, ALLOW_MEMORY_GROWTH has no extra overheads
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 --no-heap-copy")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s WASM=1 -s ASYNCIFY -s ALLOW_MEMORY_GROWTH=1 --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
diff --git a/examples/build.zig b/examples/build.zig
index 5a17382ca..df0cdf8c1 100644
--- a/examples/build.zig
+++ b/examples/build.zig
@@ -75,6 +75,7 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.Build.Reso
const install_cmd = b.addInstallArtifact(exe, .{});
const run_cmd = b.addRunArtifact(exe);
+ run_cmd.cwd = b.path(module);
run_cmd.step.dependOn(&install_cmd.step);
const run_step = b.step(name, name);
diff --git a/examples/models/models_waving_cubes.c b/examples/models/models_waving_cubes.c
index 5dc1fc4aa..521a4afd5 100644
--- a/examples/models/models_waving_cubes.c
+++ b/examples/models/models_waving_cubes.c
@@ -89,6 +89,8 @@ int main()
};
// Pick a color with a hue depending on cube position for the rainbow color effect
+ // NOTE: This function is quite costly to be done per cube and frame,
+ // pre-catching the results into a separate array could improve performance
Color cubeColor = ColorFromHSV((float)(((x + y + z)*18)%360), 0.75f, 0.9f);
// Calculate cube size
diff --git a/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs b/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs
index 6775a2eb6..3e4da1e28 100644
--- a/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs
+++ b/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs
@@ -22,15 +22,12 @@ out vec3 fragNormal;
void main()
{
- // Compute MVP for current instance
- mat4 mvpi = mvp*instanceTransform;
-
// Send vertex attributes to fragment shader
- fragPosition = vec3(mvpi*vec4(vertexPosition, 1.0));
+ fragPosition = vec3(instanceTransform*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord;
//fragColor = vertexColor;
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
- // Calculate final vertex position
- gl_Position = mvpi*vec4(vertexPosition, 1.0);
+ // Calculate final vertex position, note that we multiply mvp by instanceTransform
+ gl_Position = mvp*instanceTransform*vec4(vertexPosition, 1.0);
}
diff --git a/examples/shapes/shapes_splines_drawing.c b/examples/shapes/shapes_splines_drawing.c
index 8df5f09f4..7c099e7ef 100644
--- a/examples/shapes/shapes_splines_drawing.c
+++ b/examples/shapes/shapes_splines_drawing.c
@@ -56,6 +56,10 @@ int main(void)
{ 710.0f, 260.0f },
};
+ // Array required for spline bezier-cubic,
+ // including control points interleaved with start-end segment points
+ Vector2 pointsInterleaved[3*(MAX_SPLINE_POINTS - 1) + 1] = { 0 };
+
int pointCount = 5;
int selectedPoint = -1;
int focusedPoint = -1;
@@ -63,7 +67,7 @@ int main(void)
Vector2 *focusedControlPoint = NULL;
// Cubic Bezier control points initialization
- ControlPoint control[MAX_SPLINE_POINTS] = { 0 };
+ ControlPoint control[MAX_SPLINE_POINTS-1] = { 0 };
for (int i = 0; i < pointCount - 1; i++)
{
control[i].start = (Vector2){ points[i].x + 50, points[i].y };
@@ -88,6 +92,9 @@ int main(void)
if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON) && (pointCount < MAX_SPLINE_POINTS))
{
points[pointCount] = GetMousePosition();
+ int i = pointCount - 1;
+ control[i].start = (Vector2){ points[i].x + 50, points[i].y };
+ control[i].end = (Vector2){ points[i + 1].x - 50, points[i + 1].y };
pointCount++;
}
@@ -114,7 +121,7 @@ int main(void)
if ((splineTypeActive == SPLINE_BEZIER) && (focusedPoint == -1))
{
// Spline control point focus and selection logic
- for (int i = 0; i < pointCount; i++)
+ for (int i = 0; i < pointCount - 1; i++)
{
if (CheckCollisionPointCircle(GetMousePosition(), control[i].start, 6.0f))
{
@@ -185,13 +192,32 @@ int main(void)
}
else if (splineTypeActive == SPLINE_BEZIER)
{
+ // NOTE: Cubic-bezier spline requires the 2 control points of each segnment to be
+ // provided interleaved with the start and end point of every segment
+ for (int i = 0; i < (pointCount - 1); i++)
+ {
+ pointsInterleaved[3*i] = points[i];
+ pointsInterleaved[3*i + 1] = control[i].start;
+ pointsInterleaved[3*i + 2] = control[i].end;
+ }
+
+ pointsInterleaved[3*(pointCount - 1)] = points[pointCount - 1];
+
// Draw spline: cubic-bezier (with control points)
- for (int i = 0; i < pointCount - 1; i++)
+ DrawSplineBezierCubic(pointsInterleaved, 3*(pointCount - 1) + 1, splineThickness, RED);
+
+ /*
+ for (int i = 0; i < 3*(pointCount - 1); i += 3)
{
// Drawing individual segments, not considering thickness connection compensation
- DrawSplineSegmentBezierCubic(points[i], control[i].start, control[i].end, points[i + 1], splineThickness, RED);
+ DrawSplineSegmentBezierCubic(pointsInterleaved[i], pointsInterleaved[i + 1], pointsInterleaved[i + 2], pointsInterleaved[i + 3], splineThickness, MAROON);
+ }
+ */
- // Every cubic bezier point should have two control points
+ // Draw spline control points
+ for (int i = 0; i < pointCount - 1; i++)
+ {
+ // Every cubic bezier point have two control points
DrawCircleV(control[i].start, 6, GOLD);
DrawCircleV(control[i].end, 6, GOLD);
if (focusedControlPoint == &control[i].start) DrawCircleV(control[i].start, 8, GREEN);
@@ -244,4 +270,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
-}
\ No newline at end of file
+}
diff --git a/parser/output/raylib_api.json b/parser/output/raylib_api.json
index 961578e53..c4577e68d 100644
--- a/parser/output/raylib_api.json
+++ b/parser/output/raylib_api.json
@@ -5345,7 +5345,7 @@
"returnType": "void",
"params": [
{
- "type": "Vector2 *",
+ "type": "const Vector2 *",
"name": "points"
},
{
@@ -6022,7 +6022,7 @@
"returnType": "void",
"params": [
{
- "type": "Vector2 *",
+ "type": "const Vector2 *",
"name": "points"
},
{
@@ -6041,7 +6041,7 @@
"returnType": "void",
"params": [
{
- "type": "Vector2 *",
+ "type": "const Vector2 *",
"name": "points"
},
{
@@ -6145,7 +6145,7 @@
"returnType": "void",
"params": [
{
- "type": "Vector2 *",
+ "type": "const Vector2 *",
"name": "points"
},
{
@@ -6168,7 +6168,7 @@
"returnType": "void",
"params": [
{
- "type": "Vector2 *",
+ "type": "const Vector2 *",
"name": "points"
},
{
@@ -6191,7 +6191,7 @@
"returnType": "void",
"params": [
{
- "type": "Vector2 *",
+ "type": "const Vector2 *",
"name": "points"
},
{
@@ -6214,7 +6214,7 @@
"returnType": "void",
"params": [
{
- "type": "Vector2 *",
+ "type": "const Vector2 *",
"name": "points"
},
{
@@ -6237,7 +6237,7 @@
"returnType": "void",
"params": [
{
- "type": "Vector2 *",
+ "type": "const Vector2 *",
"name": "points"
},
{
@@ -6644,7 +6644,7 @@
"name": "point"
},
{
- "type": "Vector2 *",
+ "type": "const Vector2 *",
"name": "points"
},
{
@@ -7359,7 +7359,7 @@
"name": "image"
},
{
- "type": "float*",
+ "type": "float *",
"name": "kernel"
},
{
@@ -8013,6 +8013,141 @@
}
]
},
+ {
+ "name": "ImageDrawTriangle",
+ "description": "Draw triangle within an image",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "Image *",
+ "name": "dst"
+ },
+ {
+ "type": "Vector2",
+ "name": "v1"
+ },
+ {
+ "type": "Vector2",
+ "name": "v2"
+ },
+ {
+ "type": "Vector2",
+ "name": "v3"
+ },
+ {
+ "type": "Color",
+ "name": "color"
+ }
+ ]
+ },
+ {
+ "name": "ImageDrawTriangleEx",
+ "description": "Draw triangle with interpolated colors within an image",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "Image *",
+ "name": "dst"
+ },
+ {
+ "type": "Vector2",
+ "name": "v1"
+ },
+ {
+ "type": "Vector2",
+ "name": "v2"
+ },
+ {
+ "type": "Vector2",
+ "name": "v3"
+ },
+ {
+ "type": "Color",
+ "name": "c1"
+ },
+ {
+ "type": "Color",
+ "name": "c2"
+ },
+ {
+ "type": "Color",
+ "name": "c3"
+ }
+ ]
+ },
+ {
+ "name": "ImageDrawTriangleLines",
+ "description": "Draw triangle outline within an image",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "Image *",
+ "name": "dst"
+ },
+ {
+ "type": "Vector2",
+ "name": "v1"
+ },
+ {
+ "type": "Vector2",
+ "name": "v2"
+ },
+ {
+ "type": "Vector2",
+ "name": "v3"
+ },
+ {
+ "type": "Color",
+ "name": "color"
+ }
+ ]
+ },
+ {
+ "name": "ImageDrawTriangleFan",
+ "description": "Draw a triangle fan defined by points within an image (first vertex is the center)",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "Image *",
+ "name": "dst"
+ },
+ {
+ "type": "Vector2 *",
+ "name": "points"
+ },
+ {
+ "type": "int",
+ "name": "pointCount"
+ },
+ {
+ "type": "Color",
+ "name": "color"
+ }
+ ]
+ },
+ {
+ "name": "ImageDrawTriangleStrip",
+ "description": "Draw a triangle strip defined by points within an image",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "Image *",
+ "name": "dst"
+ },
+ {
+ "type": "Vector2 *",
+ "name": "points"
+ },
+ {
+ "type": "int",
+ "name": "pointCount"
+ },
+ {
+ "type": "Color",
+ "name": "color"
+ }
+ ]
+ },
{
"name": "ImageDraw",
"description": "Draw a source image within a destination image (tint applied to source)",
@@ -9613,7 +9748,7 @@
"returnType": "void",
"params": [
{
- "type": "Vector3 *",
+ "type": "const Vector3 *",
"name": "points"
},
{
diff --git a/parser/output/raylib_api.lua b/parser/output/raylib_api.lua
index eb88daab9..7cd1b5f20 100644
--- a/parser/output/raylib_api.lua
+++ b/parser/output/raylib_api.lua
@@ -4636,7 +4636,7 @@ return {
description = "Draw lines sequence (using gl lines)",
returnType = "void",
params = {
- {type = "Vector2 *", name = "points"},
+ {type = "const Vector2 *", name = "points"},
{type = "int", name = "pointCount"},
{type = "Color", name = "color"}
}
@@ -4947,7 +4947,7 @@ return {
description = "Draw a triangle fan defined by points (first vertex is the center)",
returnType = "void",
params = {
- {type = "Vector2 *", name = "points"},
+ {type = "const Vector2 *", name = "points"},
{type = "int", name = "pointCount"},
{type = "Color", name = "color"}
}
@@ -4957,7 +4957,7 @@ return {
description = "Draw a triangle strip defined by points",
returnType = "void",
params = {
- {type = "Vector2 *", name = "points"},
+ {type = "const Vector2 *", name = "points"},
{type = "int", name = "pointCount"},
{type = "Color", name = "color"}
}
@@ -5004,7 +5004,7 @@ return {
description = "Draw spline: Linear, minimum 2 points",
returnType = "void",
params = {
- {type = "Vector2 *", name = "points"},
+ {type = "const Vector2 *", name = "points"},
{type = "int", name = "pointCount"},
{type = "float", name = "thick"},
{type = "Color", name = "color"}
@@ -5015,7 +5015,7 @@ return {
description = "Draw spline: B-Spline, minimum 4 points",
returnType = "void",
params = {
- {type = "Vector2 *", name = "points"},
+ {type = "const Vector2 *", name = "points"},
{type = "int", name = "pointCount"},
{type = "float", name = "thick"},
{type = "Color", name = "color"}
@@ -5026,7 +5026,7 @@ return {
description = "Draw spline: Catmull-Rom, minimum 4 points",
returnType = "void",
params = {
- {type = "Vector2 *", name = "points"},
+ {type = "const Vector2 *", name = "points"},
{type = "int", name = "pointCount"},
{type = "float", name = "thick"},
{type = "Color", name = "color"}
@@ -5037,7 +5037,7 @@ return {
description = "Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]",
returnType = "void",
params = {
- {type = "Vector2 *", name = "points"},
+ {type = "const Vector2 *", name = "points"},
{type = "int", name = "pointCount"},
{type = "float", name = "thick"},
{type = "Color", name = "color"}
@@ -5048,7 +5048,7 @@ return {
description = "Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]",
returnType = "void",
params = {
- {type = "Vector2 *", name = "points"},
+ {type = "const Vector2 *", name = "points"},
{type = "int", name = "pointCount"},
{type = "float", name = "thick"},
{type = "Color", name = "color"}
@@ -5239,7 +5239,7 @@ return {
returnType = "bool",
params = {
{type = "Vector2", name = "point"},
- {type = "Vector2 *", name = "points"},
+ {type = "const Vector2 *", name = "points"},
{type = "int", name = "pointCount"}
}
},
@@ -5621,7 +5621,7 @@ return {
returnType = "void",
params = {
{type = "Image *", name = "image"},
- {type = "float*", name = "kernel"},
+ {type = "float *", name = "kernel"},
{type = "int", name = "kernelSize"}
}
},
@@ -5970,6 +5970,66 @@ return {
{type = "Color", name = "color"}
}
},
+ {
+ name = "ImageDrawTriangle",
+ description = "Draw triangle within an image",
+ returnType = "void",
+ params = {
+ {type = "Image *", name = "dst"},
+ {type = "Vector2", name = "v1"},
+ {type = "Vector2", name = "v2"},
+ {type = "Vector2", name = "v3"},
+ {type = "Color", name = "color"}
+ }
+ },
+ {
+ name = "ImageDrawTriangleEx",
+ description = "Draw triangle with interpolated colors within an image",
+ returnType = "void",
+ params = {
+ {type = "Image *", name = "dst"},
+ {type = "Vector2", name = "v1"},
+ {type = "Vector2", name = "v2"},
+ {type = "Vector2", name = "v3"},
+ {type = "Color", name = "c1"},
+ {type = "Color", name = "c2"},
+ {type = "Color", name = "c3"}
+ }
+ },
+ {
+ name = "ImageDrawTriangleLines",
+ description = "Draw triangle outline within an image",
+ returnType = "void",
+ params = {
+ {type = "Image *", name = "dst"},
+ {type = "Vector2", name = "v1"},
+ {type = "Vector2", name = "v2"},
+ {type = "Vector2", name = "v3"},
+ {type = "Color", name = "color"}
+ }
+ },
+ {
+ name = "ImageDrawTriangleFan",
+ description = "Draw a triangle fan defined by points within an image (first vertex is the center)",
+ returnType = "void",
+ params = {
+ {type = "Image *", name = "dst"},
+ {type = "Vector2 *", name = "points"},
+ {type = "int", name = "pointCount"},
+ {type = "Color", name = "color"}
+ }
+ },
+ {
+ name = "ImageDrawTriangleStrip",
+ description = "Draw a triangle strip defined by points within an image",
+ returnType = "void",
+ params = {
+ {type = "Image *", name = "dst"},
+ {type = "Vector2 *", name = "points"},
+ {type = "int", name = "pointCount"},
+ {type = "Color", name = "color"}
+ }
+ },
{
name = "ImageDraw",
description = "Draw a source image within a destination image (tint applied to source)",
@@ -6855,7 +6915,7 @@ return {
description = "Draw a triangle strip defined by points",
returnType = "void",
params = {
- {type = "Vector3 *", name = "points"},
+ {type = "const Vector3 *", name = "points"},
{type = "int", name = "pointCount"},
{type = "Color", name = "color"}
}
diff --git a/parser/output/raylib_api.txt b/parser/output/raylib_api.txt
index 66880130e..5b09bb972 100644
--- a/parser/output/raylib_api.txt
+++ b/parser/output/raylib_api.txt
@@ -984,7 +984,7 @@ Callback 006: AudioCallback() (2 input parameters)
Param[1]: bufferData (type: void *)
Param[2]: frames (type: unsigned int)
-Functions found: 566
+Functions found: 571
Function 001: InitWindow() (3 input parameters)
Name: InitWindow
@@ -2130,7 +2130,7 @@ Function 212: DrawLineStrip() (3 input parameters)
Name: DrawLineStrip
Return type: void
Description: Draw lines sequence (using gl lines)
- Param[1]: points (type: Vector2 *)
+ Param[1]: points (type: const Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: color (type: Color)
Function 213: DrawLineBezier() (4 input parameters)
@@ -2360,14 +2360,14 @@ Function 239: DrawTriangleFan() (3 input parameters)
Name: DrawTriangleFan
Return type: void
Description: Draw a triangle fan defined by points (first vertex is the center)
- Param[1]: points (type: Vector2 *)
+ Param[1]: points (type: const Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: color (type: Color)
Function 240: DrawTriangleStrip() (3 input parameters)
Name: DrawTriangleStrip
Return type: void
Description: Draw a triangle strip defined by points
- Param[1]: points (type: Vector2 *)
+ Param[1]: points (type: const Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: color (type: Color)
Function 241: DrawPoly() (5 input parameters)
@@ -2402,7 +2402,7 @@ Function 244: DrawSplineLinear() (4 input parameters)
Name: DrawSplineLinear
Return type: void
Description: Draw spline: Linear, minimum 2 points
- Param[1]: points (type: Vector2 *)
+ Param[1]: points (type: const Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: thick (type: float)
Param[4]: color (type: Color)
@@ -2410,7 +2410,7 @@ Function 245: DrawSplineBasis() (4 input parameters)
Name: DrawSplineBasis
Return type: void
Description: Draw spline: B-Spline, minimum 4 points
- Param[1]: points (type: Vector2 *)
+ Param[1]: points (type: const Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: thick (type: float)
Param[4]: color (type: Color)
@@ -2418,7 +2418,7 @@ Function 246: DrawSplineCatmullRom() (4 input parameters)
Name: DrawSplineCatmullRom
Return type: void
Description: Draw spline: Catmull-Rom, minimum 4 points
- Param[1]: points (type: Vector2 *)
+ Param[1]: points (type: const Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: thick (type: float)
Param[4]: color (type: Color)
@@ -2426,7 +2426,7 @@ Function 247: DrawSplineBezierQuadratic() (4 input parameters)
Name: DrawSplineBezierQuadratic
Return type: void
Description: Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
- Param[1]: points (type: Vector2 *)
+ Param[1]: points (type: const Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: thick (type: float)
Param[4]: color (type: Color)
@@ -2434,7 +2434,7 @@ Function 248: DrawSplineBezierCubic() (4 input parameters)
Name: DrawSplineBezierCubic
Return type: void
Description: Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
- Param[1]: points (type: Vector2 *)
+ Param[1]: points (type: const Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: thick (type: float)
Param[4]: color (type: Color)
@@ -2574,7 +2574,7 @@ Function 265: CheckCollisionPointPoly() (3 input parameters)
Return type: bool
Description: Check if point is within a polygon described by array of vertices
Param[1]: point (type: Vector2)
- Param[2]: points (type: Vector2 *)
+ Param[2]: points (type: const Vector2 *)
Param[3]: pointCount (type: int)
Function 266: CheckCollisionLines() (5 input parameters)
Name: CheckCollisionLines
@@ -2842,7 +2842,7 @@ Function 304: ImageKernelConvolution() (3 input parameters)
Return type: void
Description: Apply Custom Square image convolution kernel
Param[1]: image (type: Image *)
- Param[2]: kernel (type: float*)
+ Param[2]: kernel (type: float *)
Param[3]: kernelSize (type: int)
Function 305: ImageResize() (3 input parameters)
Name: ImageResize
@@ -3084,7 +3084,52 @@ Function 339: ImageDrawRectangleLines() (4 input parameters)
Param[2]: rec (type: Rectangle)
Param[3]: thick (type: int)
Param[4]: color (type: Color)
-Function 340: ImageDraw() (5 input parameters)
+Function 340: ImageDrawTriangle() (5 input parameters)
+ Name: ImageDrawTriangle
+ Return type: void
+ Description: Draw triangle within an image
+ Param[1]: dst (type: Image *)
+ Param[2]: v1 (type: Vector2)
+ Param[3]: v2 (type: Vector2)
+ Param[4]: v3 (type: Vector2)
+ Param[5]: color (type: Color)
+Function 341: ImageDrawTriangleEx() (7 input parameters)
+ Name: ImageDrawTriangleEx
+ Return type: void
+ Description: Draw triangle with interpolated colors within an image
+ Param[1]: dst (type: Image *)
+ Param[2]: v1 (type: Vector2)
+ Param[3]: v2 (type: Vector2)
+ Param[4]: v3 (type: Vector2)
+ Param[5]: c1 (type: Color)
+ Param[6]: c2 (type: Color)
+ Param[7]: c3 (type: Color)
+Function 342: ImageDrawTriangleLines() (5 input parameters)
+ Name: ImageDrawTriangleLines
+ Return type: void
+ Description: Draw triangle outline within an image
+ Param[1]: dst (type: Image *)
+ Param[2]: v1 (type: Vector2)
+ Param[3]: v2 (type: Vector2)
+ Param[4]: v3 (type: Vector2)
+ Param[5]: color (type: Color)
+Function 343: ImageDrawTriangleFan() (4 input parameters)
+ Name: ImageDrawTriangleFan
+ Return type: void
+ Description: Draw a triangle fan defined by points within an image (first vertex is the center)
+ Param[1]: dst (type: Image *)
+ Param[2]: points (type: Vector2 *)
+ Param[3]: pointCount (type: int)
+ Param[4]: color (type: Color)
+Function 344: ImageDrawTriangleStrip() (4 input parameters)
+ Name: ImageDrawTriangleStrip
+ Return type: void
+ Description: Draw a triangle strip defined by points within an image
+ Param[1]: dst (type: Image *)
+ Param[2]: points (type: Vector2 *)
+ Param[3]: pointCount (type: int)
+ Param[4]: color (type: Color)
+Function 345: ImageDraw() (5 input parameters)
Name: ImageDraw
Return type: void
Description: Draw a source image within a destination image (tint applied to source)
@@ -3093,7 +3138,7 @@ Function 340: ImageDraw() (5 input parameters)
Param[3]: srcRec (type: Rectangle)
Param[4]: dstRec (type: Rectangle)
Param[5]: tint (type: Color)
-Function 341: ImageDrawText() (6 input parameters)
+Function 346: ImageDrawText() (6 input parameters)
Name: ImageDrawText
Return type: void
Description: Draw text (using default font) within an image (destination)
@@ -3103,7 +3148,7 @@ Function 341: ImageDrawText() (6 input parameters)
Param[4]: posY (type: int)
Param[5]: fontSize (type: int)
Param[6]: color (type: Color)
-Function 342: ImageDrawTextEx() (7 input parameters)
+Function 347: ImageDrawTextEx() (7 input parameters)
Name: ImageDrawTextEx
Return type: void
Description: Draw text (custom sprite font) within an image (destination)
@@ -3114,79 +3159,79 @@ Function 342: ImageDrawTextEx() (7 input parameters)
Param[5]: fontSize (type: float)
Param[6]: spacing (type: float)
Param[7]: tint (type: Color)
-Function 343: LoadTexture() (1 input parameters)
+Function 348: LoadTexture() (1 input parameters)
Name: LoadTexture
Return type: Texture2D
Description: Load texture from file into GPU memory (VRAM)
Param[1]: fileName (type: const char *)
-Function 344: LoadTextureFromImage() (1 input parameters)
+Function 349: LoadTextureFromImage() (1 input parameters)
Name: LoadTextureFromImage
Return type: Texture2D
Description: Load texture from image data
Param[1]: image (type: Image)
-Function 345: LoadTextureCubemap() (2 input parameters)
+Function 350: LoadTextureCubemap() (2 input parameters)
Name: LoadTextureCubemap
Return type: TextureCubemap
Description: Load cubemap from image, multiple image cubemap layouts supported
Param[1]: image (type: Image)
Param[2]: layout (type: int)
-Function 346: LoadRenderTexture() (2 input parameters)
+Function 351: LoadRenderTexture() (2 input parameters)
Name: LoadRenderTexture
Return type: RenderTexture2D
Description: Load texture for rendering (framebuffer)
Param[1]: width (type: int)
Param[2]: height (type: int)
-Function 347: IsTextureReady() (1 input parameters)
+Function 352: IsTextureReady() (1 input parameters)
Name: IsTextureReady
Return type: bool
Description: Check if a texture is ready
Param[1]: texture (type: Texture2D)
-Function 348: UnloadTexture() (1 input parameters)
+Function 353: UnloadTexture() (1 input parameters)
Name: UnloadTexture
Return type: void
Description: Unload texture from GPU memory (VRAM)
Param[1]: texture (type: Texture2D)
-Function 349: IsRenderTextureReady() (1 input parameters)
+Function 354: IsRenderTextureReady() (1 input parameters)
Name: IsRenderTextureReady
Return type: bool
Description: Check if a render texture is ready
Param[1]: target (type: RenderTexture2D)
-Function 350: UnloadRenderTexture() (1 input parameters)
+Function 355: UnloadRenderTexture() (1 input parameters)
Name: UnloadRenderTexture
Return type: void
Description: Unload render texture from GPU memory (VRAM)
Param[1]: target (type: RenderTexture2D)
-Function 351: UpdateTexture() (2 input parameters)
+Function 356: UpdateTexture() (2 input parameters)
Name: UpdateTexture
Return type: void
Description: Update GPU texture with new data
Param[1]: texture (type: Texture2D)
Param[2]: pixels (type: const void *)
-Function 352: UpdateTextureRec() (3 input parameters)
+Function 357: UpdateTextureRec() (3 input parameters)
Name: UpdateTextureRec
Return type: void
Description: Update GPU texture rectangle with new data
Param[1]: texture (type: Texture2D)
Param[2]: rec (type: Rectangle)
Param[3]: pixels (type: const void *)
-Function 353: GenTextureMipmaps() (1 input parameters)
+Function 358: GenTextureMipmaps() (1 input parameters)
Name: GenTextureMipmaps
Return type: void
Description: Generate GPU mipmaps for a texture
Param[1]: texture (type: Texture2D *)
-Function 354: SetTextureFilter() (2 input parameters)
+Function 359: SetTextureFilter() (2 input parameters)
Name: SetTextureFilter
Return type: void
Description: Set texture scaling filter mode
Param[1]: texture (type: Texture2D)
Param[2]: filter (type: int)
-Function 355: SetTextureWrap() (2 input parameters)
+Function 360: SetTextureWrap() (2 input parameters)
Name: SetTextureWrap
Return type: void
Description: Set texture wrapping mode
Param[1]: texture (type: Texture2D)
Param[2]: wrap (type: int)
-Function 356: DrawTexture() (4 input parameters)
+Function 361: DrawTexture() (4 input parameters)
Name: DrawTexture
Return type: void
Description: Draw a Texture2D
@@ -3194,14 +3239,14 @@ Function 356: DrawTexture() (4 input parameters)
Param[2]: posX (type: int)
Param[3]: posY (type: int)
Param[4]: tint (type: Color)
-Function 357: DrawTextureV() (3 input parameters)
+Function 362: DrawTextureV() (3 input parameters)
Name: DrawTextureV
Return type: void
Description: Draw a Texture2D with position defined as Vector2
Param[1]: texture (type: Texture2D)
Param[2]: position (type: Vector2)
Param[3]: tint (type: Color)
-Function 358: DrawTextureEx() (5 input parameters)
+Function 363: DrawTextureEx() (5 input parameters)
Name: DrawTextureEx
Return type: void
Description: Draw a Texture2D with extended parameters
@@ -3210,7 +3255,7 @@ Function 358: DrawTextureEx() (5 input parameters)
Param[3]: rotation (type: float)
Param[4]: scale (type: float)
Param[5]: tint (type: Color)
-Function 359: DrawTextureRec() (4 input parameters)
+Function 364: DrawTextureRec() (4 input parameters)
Name: DrawTextureRec
Return type: void
Description: Draw a part of a texture defined by a rectangle
@@ -3218,7 +3263,7 @@ Function 359: DrawTextureRec() (4 input parameters)
Param[2]: source (type: Rectangle)
Param[3]: position (type: Vector2)
Param[4]: tint (type: Color)
-Function 360: DrawTexturePro() (6 input parameters)
+Function 365: DrawTexturePro() (6 input parameters)
Name: DrawTexturePro
Return type: void
Description: Draw a part of a texture defined by a rectangle with 'pro' parameters
@@ -3228,7 +3273,7 @@ Function 360: DrawTexturePro() (6 input parameters)
Param[4]: origin (type: Vector2)
Param[5]: rotation (type: float)
Param[6]: tint (type: Color)
-Function 361: DrawTextureNPatch() (6 input parameters)
+Function 366: DrawTextureNPatch() (6 input parameters)
Name: DrawTextureNPatch
Return type: void
Description: Draws a texture (or part of it) that stretches or shrinks nicely
@@ -3238,112 +3283,112 @@ Function 361: DrawTextureNPatch() (6 input parameters)
Param[4]: origin (type: Vector2)
Param[5]: rotation (type: float)
Param[6]: tint (type: Color)
-Function 362: ColorIsEqual() (2 input parameters)
+Function 367: ColorIsEqual() (2 input parameters)
Name: ColorIsEqual
Return type: bool
Description: Check if two colors are equal
Param[1]: col1 (type: Color)
Param[2]: col2 (type: Color)
-Function 363: Fade() (2 input parameters)
+Function 368: Fade() (2 input parameters)
Name: Fade
Return type: Color
Description: Get color with alpha applied, alpha goes from 0.0f to 1.0f
Param[1]: color (type: Color)
Param[2]: alpha (type: float)
-Function 364: ColorToInt() (1 input parameters)
+Function 369: ColorToInt() (1 input parameters)
Name: ColorToInt
Return type: int
Description: Get hexadecimal value for a Color (0xRRGGBBAA)
Param[1]: color (type: Color)
-Function 365: ColorNormalize() (1 input parameters)
+Function 370: ColorNormalize() (1 input parameters)
Name: ColorNormalize
Return type: Vector4
Description: Get Color normalized as float [0..1]
Param[1]: color (type: Color)
-Function 366: ColorFromNormalized() (1 input parameters)
+Function 371: ColorFromNormalized() (1 input parameters)
Name: ColorFromNormalized
Return type: Color
Description: Get Color from normalized values [0..1]
Param[1]: normalized (type: Vector4)
-Function 367: ColorToHSV() (1 input parameters)
+Function 372: ColorToHSV() (1 input parameters)
Name: ColorToHSV
Return type: Vector3
Description: Get HSV values for a Color, hue [0..360], saturation/value [0..1]
Param[1]: color (type: Color)
-Function 368: ColorFromHSV() (3 input parameters)
+Function 373: ColorFromHSV() (3 input parameters)
Name: ColorFromHSV
Return type: Color
Description: Get a Color from HSV values, hue [0..360], saturation/value [0..1]
Param[1]: hue (type: float)
Param[2]: saturation (type: float)
Param[3]: value (type: float)
-Function 369: ColorTint() (2 input parameters)
+Function 374: ColorTint() (2 input parameters)
Name: ColorTint
Return type: Color
Description: Get color multiplied with another color
Param[1]: color (type: Color)
Param[2]: tint (type: Color)
-Function 370: ColorBrightness() (2 input parameters)
+Function 375: ColorBrightness() (2 input parameters)
Name: ColorBrightness
Return type: Color
Description: Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
Param[1]: color (type: Color)
Param[2]: factor (type: float)
-Function 371: ColorContrast() (2 input parameters)
+Function 376: ColorContrast() (2 input parameters)
Name: ColorContrast
Return type: Color
Description: Get color with contrast correction, contrast values between -1.0f and 1.0f
Param[1]: color (type: Color)
Param[2]: contrast (type: float)
-Function 372: ColorAlpha() (2 input parameters)
+Function 377: ColorAlpha() (2 input parameters)
Name: ColorAlpha
Return type: Color
Description: Get color with alpha applied, alpha goes from 0.0f to 1.0f
Param[1]: color (type: Color)
Param[2]: alpha (type: float)
-Function 373: ColorAlphaBlend() (3 input parameters)
+Function 378: ColorAlphaBlend() (3 input parameters)
Name: ColorAlphaBlend
Return type: Color
Description: Get src alpha-blended into dst color with tint
Param[1]: dst (type: Color)
Param[2]: src (type: Color)
Param[3]: tint (type: Color)
-Function 374: GetColor() (1 input parameters)
+Function 379: GetColor() (1 input parameters)
Name: GetColor
Return type: Color
Description: Get Color structure from hexadecimal value
Param[1]: hexValue (type: unsigned int)
-Function 375: GetPixelColor() (2 input parameters)
+Function 380: GetPixelColor() (2 input parameters)
Name: GetPixelColor
Return type: Color
Description: Get Color from a source pixel pointer of certain format
Param[1]: srcPtr (type: void *)
Param[2]: format (type: int)
-Function 376: SetPixelColor() (3 input parameters)
+Function 381: SetPixelColor() (3 input parameters)
Name: SetPixelColor
Return type: void
Description: Set color formatted into destination pixel pointer
Param[1]: dstPtr (type: void *)
Param[2]: color (type: Color)
Param[3]: format (type: int)
-Function 377: GetPixelDataSize() (3 input parameters)
+Function 382: GetPixelDataSize() (3 input parameters)
Name: GetPixelDataSize
Return type: int
Description: Get pixel data size in bytes for certain format
Param[1]: width (type: int)
Param[2]: height (type: int)
Param[3]: format (type: int)
-Function 378: GetFontDefault() (0 input parameters)
+Function 383: GetFontDefault() (0 input parameters)
Name: GetFontDefault
Return type: Font
Description: Get the default Font
No input parameters
-Function 379: LoadFont() (1 input parameters)
+Function 384: LoadFont() (1 input parameters)
Name: LoadFont
Return type: Font
Description: Load font from file into GPU memory (VRAM)
Param[1]: fileName (type: const char *)
-Function 380: LoadFontEx() (4 input parameters)
+Function 385: LoadFontEx() (4 input parameters)
Name: LoadFontEx
Return type: Font
Description: Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont
@@ -3351,14 +3396,14 @@ Function 380: LoadFontEx() (4 input parameters)
Param[2]: fontSize (type: int)
Param[3]: codepoints (type: int *)
Param[4]: codepointCount (type: int)
-Function 381: LoadFontFromImage() (3 input parameters)
+Function 386: LoadFontFromImage() (3 input parameters)
Name: LoadFontFromImage
Return type: Font
Description: Load font from Image (XNA style)
Param[1]: image (type: Image)
Param[2]: key (type: Color)
Param[3]: firstChar (type: int)
-Function 382: LoadFontFromMemory() (6 input parameters)
+Function 387: LoadFontFromMemory() (6 input parameters)
Name: LoadFontFromMemory
Return type: Font
Description: Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
@@ -3368,12 +3413,12 @@ Function 382: LoadFontFromMemory() (6 input parameters)
Param[4]: fontSize (type: int)
Param[5]: codepoints (type: int *)
Param[6]: codepointCount (type: int)
-Function 383: IsFontReady() (1 input parameters)
+Function 388: IsFontReady() (1 input parameters)
Name: IsFontReady
Return type: bool
Description: Check if a font is ready
Param[1]: font (type: Font)
-Function 384: LoadFontData() (6 input parameters)
+Function 389: LoadFontData() (6 input parameters)
Name: LoadFontData
Return type: GlyphInfo *
Description: Load font data for further use
@@ -3383,7 +3428,7 @@ Function 384: LoadFontData() (6 input parameters)
Param[4]: codepoints (type: int *)
Param[5]: codepointCount (type: int)
Param[6]: type (type: int)
-Function 385: GenImageFontAtlas() (6 input parameters)
+Function 390: GenImageFontAtlas() (6 input parameters)
Name: GenImageFontAtlas
Return type: Image
Description: Generate image font atlas using chars info
@@ -3393,30 +3438,30 @@ Function 385: GenImageFontAtlas() (6 input parameters)
Param[4]: fontSize (type: int)
Param[5]: padding (type: int)
Param[6]: packMethod (type: int)
-Function 386: UnloadFontData() (2 input parameters)
+Function 391: UnloadFontData() (2 input parameters)
Name: UnloadFontData
Return type: void
Description: Unload font chars info data (RAM)
Param[1]: glyphs (type: GlyphInfo *)
Param[2]: glyphCount (type: int)
-Function 387: UnloadFont() (1 input parameters)
+Function 392: UnloadFont() (1 input parameters)
Name: UnloadFont
Return type: void
Description: Unload font from GPU memory (VRAM)
Param[1]: font (type: Font)
-Function 388: ExportFontAsCode() (2 input parameters)
+Function 393: ExportFontAsCode() (2 input parameters)
Name: ExportFontAsCode
Return type: bool
Description: Export font as code file, returns true on success
Param[1]: font (type: Font)
Param[2]: fileName (type: const char *)
-Function 389: DrawFPS() (2 input parameters)
+Function 394: DrawFPS() (2 input parameters)
Name: DrawFPS
Return type: void
Description: Draw current FPS
Param[1]: posX (type: int)
Param[2]: posY (type: int)
-Function 390: DrawText() (5 input parameters)
+Function 395: DrawText() (5 input parameters)
Name: DrawText
Return type: void
Description: Draw text (using default font)
@@ -3425,7 +3470,7 @@ Function 390: DrawText() (5 input parameters)
Param[3]: posY (type: int)
Param[4]: fontSize (type: int)
Param[5]: color (type: Color)
-Function 391: DrawTextEx() (6 input parameters)
+Function 396: DrawTextEx() (6 input parameters)
Name: DrawTextEx
Return type: void
Description: Draw text using font and additional parameters
@@ -3435,7 +3480,7 @@ Function 391: DrawTextEx() (6 input parameters)
Param[4]: fontSize (type: float)
Param[5]: spacing (type: float)
Param[6]: tint (type: Color)
-Function 392: DrawTextPro() (8 input parameters)
+Function 397: DrawTextPro() (8 input parameters)
Name: DrawTextPro
Return type: void
Description: Draw text using Font and pro parameters (rotation)
@@ -3447,7 +3492,7 @@ Function 392: DrawTextPro() (8 input parameters)
Param[6]: fontSize (type: float)
Param[7]: spacing (type: float)
Param[8]: tint (type: Color)
-Function 393: DrawTextCodepoint() (5 input parameters)
+Function 398: DrawTextCodepoint() (5 input parameters)
Name: DrawTextCodepoint
Return type: void
Description: Draw one character (codepoint)
@@ -3456,7 +3501,7 @@ Function 393: DrawTextCodepoint() (5 input parameters)
Param[3]: position (type: Vector2)
Param[4]: fontSize (type: float)
Param[5]: tint (type: Color)
-Function 394: DrawTextCodepoints() (7 input parameters)
+Function 399: DrawTextCodepoints() (7 input parameters)
Name: DrawTextCodepoints
Return type: void
Description: Draw multiple character (codepoint)
@@ -3467,18 +3512,18 @@ Function 394: DrawTextCodepoints() (7 input parameters)
Param[5]: fontSize (type: float)
Param[6]: spacing (type: float)
Param[7]: tint (type: Color)
-Function 395: SetTextLineSpacing() (1 input parameters)
+Function 400: SetTextLineSpacing() (1 input parameters)
Name: SetTextLineSpacing
Return type: void
Description: Set vertical line spacing when drawing with line-breaks
Param[1]: spacing (type: int)
-Function 396: MeasureText() (2 input parameters)
+Function 401: MeasureText() (2 input parameters)
Name: MeasureText
Return type: int
Description: Measure string width for default font
Param[1]: text (type: const char *)
Param[2]: fontSize (type: int)
-Function 397: MeasureTextEx() (4 input parameters)
+Function 402: MeasureTextEx() (4 input parameters)
Name: MeasureTextEx
Return type: Vector2
Description: Measure string size for Font
@@ -3486,195 +3531,195 @@ Function 397: MeasureTextEx() (4 input parameters)
Param[2]: text (type: const char *)
Param[3]: fontSize (type: float)
Param[4]: spacing (type: float)
-Function 398: GetGlyphIndex() (2 input parameters)
+Function 403: GetGlyphIndex() (2 input parameters)
Name: GetGlyphIndex
Return type: int
Description: Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
Param[1]: font (type: Font)
Param[2]: codepoint (type: int)
-Function 399: GetGlyphInfo() (2 input parameters)
+Function 404: GetGlyphInfo() (2 input parameters)
Name: GetGlyphInfo
Return type: GlyphInfo
Description: Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
Param[1]: font (type: Font)
Param[2]: codepoint (type: int)
-Function 400: GetGlyphAtlasRec() (2 input parameters)
+Function 405: GetGlyphAtlasRec() (2 input parameters)
Name: GetGlyphAtlasRec
Return type: Rectangle
Description: Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
Param[1]: font (type: Font)
Param[2]: codepoint (type: int)
-Function 401: LoadUTF8() (2 input parameters)
+Function 406: LoadUTF8() (2 input parameters)
Name: LoadUTF8
Return type: char *
Description: Load UTF-8 text encoded from codepoints array
Param[1]: codepoints (type: const int *)
Param[2]: length (type: int)
-Function 402: UnloadUTF8() (1 input parameters)
+Function 407: UnloadUTF8() (1 input parameters)
Name: UnloadUTF8
Return type: void
Description: Unload UTF-8 text encoded from codepoints array
Param[1]: text (type: char *)
-Function 403: LoadCodepoints() (2 input parameters)
+Function 408: LoadCodepoints() (2 input parameters)
Name: LoadCodepoints
Return type: int *
Description: Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
Param[1]: text (type: const char *)
Param[2]: count (type: int *)
-Function 404: UnloadCodepoints() (1 input parameters)
+Function 409: UnloadCodepoints() (1 input parameters)
Name: UnloadCodepoints
Return type: void
Description: Unload codepoints data from memory
Param[1]: codepoints (type: int *)
-Function 405: GetCodepointCount() (1 input parameters)
+Function 410: GetCodepointCount() (1 input parameters)
Name: GetCodepointCount
Return type: int
Description: Get total number of codepoints in a UTF-8 encoded string
Param[1]: text (type: const char *)
-Function 406: GetCodepoint() (2 input parameters)
+Function 411: GetCodepoint() (2 input parameters)
Name: GetCodepoint
Return type: int
Description: Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
Param[1]: text (type: const char *)
Param[2]: codepointSize (type: int *)
-Function 407: GetCodepointNext() (2 input parameters)
+Function 412: GetCodepointNext() (2 input parameters)
Name: GetCodepointNext
Return type: int
Description: Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
Param[1]: text (type: const char *)
Param[2]: codepointSize (type: int *)
-Function 408: GetCodepointPrevious() (2 input parameters)
+Function 413: GetCodepointPrevious() (2 input parameters)
Name: GetCodepointPrevious
Return type: int
Description: Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
Param[1]: text (type: const char *)
Param[2]: codepointSize (type: int *)
-Function 409: CodepointToUTF8() (2 input parameters)
+Function 414: CodepointToUTF8() (2 input parameters)
Name: CodepointToUTF8
Return type: const char *
Description: Encode one codepoint into UTF-8 byte array (array length returned as parameter)
Param[1]: codepoint (type: int)
Param[2]: utf8Size (type: int *)
-Function 410: TextCopy() (2 input parameters)
+Function 415: TextCopy() (2 input parameters)
Name: TextCopy
Return type: int
Description: Copy one string to another, returns bytes copied
Param[1]: dst (type: char *)
Param[2]: src (type: const char *)
-Function 411: TextIsEqual() (2 input parameters)
+Function 416: TextIsEqual() (2 input parameters)
Name: TextIsEqual
Return type: bool
Description: Check if two text string are equal
Param[1]: text1 (type: const char *)
Param[2]: text2 (type: const char *)
-Function 412: TextLength() (1 input parameters)
+Function 417: TextLength() (1 input parameters)
Name: TextLength
Return type: unsigned int
Description: Get text length, checks for '\0' ending
Param[1]: text (type: const char *)
-Function 413: TextFormat() (2 input parameters)
+Function 418: TextFormat() (2 input parameters)
Name: TextFormat
Return type: const char *
Description: Text formatting with variables (sprintf() style)
Param[1]: text (type: const char *)
Param[2]: args (type: ...)
-Function 414: TextSubtext() (3 input parameters)
+Function 419: TextSubtext() (3 input parameters)
Name: TextSubtext
Return type: const char *
Description: Get a piece of a text string
Param[1]: text (type: const char *)
Param[2]: position (type: int)
Param[3]: length (type: int)
-Function 415: TextReplace() (3 input parameters)
+Function 420: TextReplace() (3 input parameters)
Name: TextReplace
Return type: char *
Description: Replace text string (WARNING: memory must be freed!)
Param[1]: text (type: const char *)
Param[2]: replace (type: const char *)
Param[3]: by (type: const char *)
-Function 416: TextInsert() (3 input parameters)
+Function 421: TextInsert() (3 input parameters)
Name: TextInsert
Return type: char *
Description: Insert text in a position (WARNING: memory must be freed!)
Param[1]: text (type: const char *)
Param[2]: insert (type: const char *)
Param[3]: position (type: int)
-Function 417: TextJoin() (3 input parameters)
+Function 422: TextJoin() (3 input parameters)
Name: TextJoin
Return type: const char *
Description: Join text strings with delimiter
Param[1]: textList (type: const char **)
Param[2]: count (type: int)
Param[3]: delimiter (type: const char *)
-Function 418: TextSplit() (3 input parameters)
+Function 423: TextSplit() (3 input parameters)
Name: TextSplit
Return type: const char **
Description: Split text into multiple strings
Param[1]: text (type: const char *)
Param[2]: delimiter (type: char)
Param[3]: count (type: int *)
-Function 419: TextAppend() (3 input parameters)
+Function 424: TextAppend() (3 input parameters)
Name: TextAppend
Return type: void
Description: Append text at specific position and move cursor!
Param[1]: text (type: char *)
Param[2]: append (type: const char *)
Param[3]: position (type: int *)
-Function 420: TextFindIndex() (2 input parameters)
+Function 425: TextFindIndex() (2 input parameters)
Name: TextFindIndex
Return type: int
Description: Find first text occurrence within a string
Param[1]: text (type: const char *)
Param[2]: find (type: const char *)
-Function 421: TextToUpper() (1 input parameters)
+Function 426: TextToUpper() (1 input parameters)
Name: TextToUpper
Return type: const char *
Description: Get upper case version of provided string
Param[1]: text (type: const char *)
-Function 422: TextToLower() (1 input parameters)
+Function 427: TextToLower() (1 input parameters)
Name: TextToLower
Return type: const char *
Description: Get lower case version of provided string
Param[1]: text (type: const char *)
-Function 423: TextToPascal() (1 input parameters)
+Function 428: TextToPascal() (1 input parameters)
Name: TextToPascal
Return type: const char *
Description: Get Pascal case notation version of provided string
Param[1]: text (type: const char *)
-Function 424: TextToSnake() (1 input parameters)
+Function 429: TextToSnake() (1 input parameters)
Name: TextToSnake
Return type: const char *
Description: Get Snake case notation version of provided string
Param[1]: text (type: const char *)
-Function 425: TextToCamel() (1 input parameters)
+Function 430: TextToCamel() (1 input parameters)
Name: TextToCamel
Return type: const char *
Description: Get Camel case notation version of provided string
Param[1]: text (type: const char *)
-Function 426: TextToInteger() (1 input parameters)
+Function 431: TextToInteger() (1 input parameters)
Name: TextToInteger
Return type: int
Description: Get integer value from text (negative values not supported)
Param[1]: text (type: const char *)
-Function 427: TextToFloat() (1 input parameters)
+Function 432: TextToFloat() (1 input parameters)
Name: TextToFloat
Return type: float
Description: Get float value from text (negative values not supported)
Param[1]: text (type: const char *)
-Function 428: DrawLine3D() (3 input parameters)
+Function 433: DrawLine3D() (3 input parameters)
Name: DrawLine3D
Return type: void
Description: Draw a line in 3D world space
Param[1]: startPos (type: Vector3)
Param[2]: endPos (type: Vector3)
Param[3]: color (type: Color)
-Function 429: DrawPoint3D() (2 input parameters)
+Function 434: DrawPoint3D() (2 input parameters)
Name: DrawPoint3D
Return type: void
Description: Draw a point in 3D space, actually a small line
Param[1]: position (type: Vector3)
Param[2]: color (type: Color)
-Function 430: DrawCircle3D() (5 input parameters)
+Function 435: DrawCircle3D() (5 input parameters)
Name: DrawCircle3D
Return type: void
Description: Draw a circle in 3D world space
@@ -3683,7 +3728,7 @@ Function 430: DrawCircle3D() (5 input parameters)
Param[3]: rotationAxis (type: Vector3)
Param[4]: rotationAngle (type: float)
Param[5]: color (type: Color)
-Function 431: DrawTriangle3D() (4 input parameters)
+Function 436: DrawTriangle3D() (4 input parameters)
Name: DrawTriangle3D
Return type: void
Description: Draw a color-filled triangle (vertex in counter-clockwise order!)
@@ -3691,14 +3736,14 @@ Function 431: DrawTriangle3D() (4 input parameters)
Param[2]: v2 (type: Vector3)
Param[3]: v3 (type: Vector3)
Param[4]: color (type: Color)
-Function 432: DrawTriangleStrip3D() (3 input parameters)
+Function 437: DrawTriangleStrip3D() (3 input parameters)
Name: DrawTriangleStrip3D
Return type: void
Description: Draw a triangle strip defined by points
- Param[1]: points (type: Vector3 *)
+ Param[1]: points (type: const Vector3 *)
Param[2]: pointCount (type: int)
Param[3]: color (type: Color)
-Function 433: DrawCube() (5 input parameters)
+Function 438: DrawCube() (5 input parameters)
Name: DrawCube
Return type: void
Description: Draw cube
@@ -3707,14 +3752,14 @@ Function 433: DrawCube() (5 input parameters)
Param[3]: height (type: float)
Param[4]: length (type: float)
Param[5]: color (type: Color)
-Function 434: DrawCubeV() (3 input parameters)
+Function 439: DrawCubeV() (3 input parameters)
Name: DrawCubeV
Return type: void
Description: Draw cube (Vector version)
Param[1]: position (type: Vector3)
Param[2]: size (type: Vector3)
Param[3]: color (type: Color)
-Function 435: DrawCubeWires() (5 input parameters)
+Function 440: DrawCubeWires() (5 input parameters)
Name: DrawCubeWires
Return type: void
Description: Draw cube wires
@@ -3723,21 +3768,21 @@ Function 435: DrawCubeWires() (5 input parameters)
Param[3]: height (type: float)
Param[4]: length (type: float)
Param[5]: color (type: Color)
-Function 436: DrawCubeWiresV() (3 input parameters)
+Function 441: DrawCubeWiresV() (3 input parameters)
Name: DrawCubeWiresV
Return type: void
Description: Draw cube wires (Vector version)
Param[1]: position (type: Vector3)
Param[2]: size (type: Vector3)
Param[3]: color (type: Color)
-Function 437: DrawSphere() (3 input parameters)
+Function 442: DrawSphere() (3 input parameters)
Name: DrawSphere
Return type: void
Description: Draw sphere
Param[1]: centerPos (type: Vector3)
Param[2]: radius (type: float)
Param[3]: color (type: Color)
-Function 438: DrawSphereEx() (5 input parameters)
+Function 443: DrawSphereEx() (5 input parameters)
Name: DrawSphereEx
Return type: void
Description: Draw sphere with extended parameters
@@ -3746,7 +3791,7 @@ Function 438: DrawSphereEx() (5 input parameters)
Param[3]: rings (type: int)
Param[4]: slices (type: int)
Param[5]: color (type: Color)
-Function 439: DrawSphereWires() (5 input parameters)
+Function 444: DrawSphereWires() (5 input parameters)
Name: DrawSphereWires
Return type: void
Description: Draw sphere wires
@@ -3755,7 +3800,7 @@ Function 439: DrawSphereWires() (5 input parameters)
Param[3]: rings (type: int)
Param[4]: slices (type: int)
Param[5]: color (type: Color)
-Function 440: DrawCylinder() (6 input parameters)
+Function 445: DrawCylinder() (6 input parameters)
Name: DrawCylinder
Return type: void
Description: Draw a cylinder/cone
@@ -3765,7 +3810,7 @@ Function 440: DrawCylinder() (6 input parameters)
Param[4]: height (type: float)
Param[5]: slices (type: int)
Param[6]: color (type: Color)
-Function 441: DrawCylinderEx() (6 input parameters)
+Function 446: DrawCylinderEx() (6 input parameters)
Name: DrawCylinderEx
Return type: void
Description: Draw a cylinder with base at startPos and top at endPos
@@ -3775,7 +3820,7 @@ Function 441: DrawCylinderEx() (6 input parameters)
Param[4]: endRadius (type: float)
Param[5]: sides (type: int)
Param[6]: color (type: Color)
-Function 442: DrawCylinderWires() (6 input parameters)
+Function 447: DrawCylinderWires() (6 input parameters)
Name: DrawCylinderWires
Return type: void
Description: Draw a cylinder/cone wires
@@ -3785,7 +3830,7 @@ Function 442: DrawCylinderWires() (6 input parameters)
Param[4]: height (type: float)
Param[5]: slices (type: int)
Param[6]: color (type: Color)
-Function 443: DrawCylinderWiresEx() (6 input parameters)
+Function 448: DrawCylinderWiresEx() (6 input parameters)
Name: DrawCylinderWiresEx
Return type: void
Description: Draw a cylinder wires with base at startPos and top at endPos
@@ -3795,7 +3840,7 @@ Function 443: DrawCylinderWiresEx() (6 input parameters)
Param[4]: endRadius (type: float)
Param[5]: sides (type: int)
Param[6]: color (type: Color)
-Function 444: DrawCapsule() (6 input parameters)
+Function 449: DrawCapsule() (6 input parameters)
Name: DrawCapsule
Return type: void
Description: Draw a capsule with the center of its sphere caps at startPos and endPos
@@ -3805,7 +3850,7 @@ Function 444: DrawCapsule() (6 input parameters)
Param[4]: slices (type: int)
Param[5]: rings (type: int)
Param[6]: color (type: Color)
-Function 445: DrawCapsuleWires() (6 input parameters)
+Function 450: DrawCapsuleWires() (6 input parameters)
Name: DrawCapsuleWires
Return type: void
Description: Draw capsule wireframe with the center of its sphere caps at startPos and endPos
@@ -3815,51 +3860,51 @@ Function 445: DrawCapsuleWires() (6 input parameters)
Param[4]: slices (type: int)
Param[5]: rings (type: int)
Param[6]: color (type: Color)
-Function 446: DrawPlane() (3 input parameters)
+Function 451: DrawPlane() (3 input parameters)
Name: DrawPlane
Return type: void
Description: Draw a plane XZ
Param[1]: centerPos (type: Vector3)
Param[2]: size (type: Vector2)
Param[3]: color (type: Color)
-Function 447: DrawRay() (2 input parameters)
+Function 452: DrawRay() (2 input parameters)
Name: DrawRay
Return type: void
Description: Draw a ray line
Param[1]: ray (type: Ray)
Param[2]: color (type: Color)
-Function 448: DrawGrid() (2 input parameters)
+Function 453: DrawGrid() (2 input parameters)
Name: DrawGrid
Return type: void
Description: Draw a grid (centered at (0, 0, 0))
Param[1]: slices (type: int)
Param[2]: spacing (type: float)
-Function 449: LoadModel() (1 input parameters)
+Function 454: LoadModel() (1 input parameters)
Name: LoadModel
Return type: Model
Description: Load model from files (meshes and materials)
Param[1]: fileName (type: const char *)
-Function 450: LoadModelFromMesh() (1 input parameters)
+Function 455: LoadModelFromMesh() (1 input parameters)
Name: LoadModelFromMesh
Return type: Model
Description: Load model from generated mesh (default material)
Param[1]: mesh (type: Mesh)
-Function 451: IsModelReady() (1 input parameters)
+Function 456: IsModelReady() (1 input parameters)
Name: IsModelReady
Return type: bool
Description: Check if a model is ready
Param[1]: model (type: Model)
-Function 452: UnloadModel() (1 input parameters)
+Function 457: UnloadModel() (1 input parameters)
Name: UnloadModel
Return type: void
Description: Unload model (including meshes) from memory (RAM and/or VRAM)
Param[1]: model (type: Model)
-Function 453: GetModelBoundingBox() (1 input parameters)
+Function 458: GetModelBoundingBox() (1 input parameters)
Name: GetModelBoundingBox
Return type: BoundingBox
Description: Compute model bounding box limits (considers all meshes)
Param[1]: model (type: Model)
-Function 454: DrawModel() (4 input parameters)
+Function 459: DrawModel() (4 input parameters)
Name: DrawModel
Return type: void
Description: Draw a model (with texture if set)
@@ -3867,7 +3912,7 @@ Function 454: DrawModel() (4 input parameters)
Param[2]: position (type: Vector3)
Param[3]: scale (type: float)
Param[4]: tint (type: Color)
-Function 455: DrawModelEx() (6 input parameters)
+Function 460: DrawModelEx() (6 input parameters)
Name: DrawModelEx
Return type: void
Description: Draw a model with extended parameters
@@ -3877,7 +3922,7 @@ Function 455: DrawModelEx() (6 input parameters)
Param[4]: rotationAngle (type: float)
Param[5]: scale (type: Vector3)
Param[6]: tint (type: Color)
-Function 456: DrawModelWires() (4 input parameters)
+Function 461: DrawModelWires() (4 input parameters)
Name: DrawModelWires
Return type: void
Description: Draw a model wires (with texture if set)
@@ -3885,7 +3930,7 @@ Function 456: DrawModelWires() (4 input parameters)
Param[2]: position (type: Vector3)
Param[3]: scale (type: float)
Param[4]: tint (type: Color)
-Function 457: DrawModelWiresEx() (6 input parameters)
+Function 462: DrawModelWiresEx() (6 input parameters)
Name: DrawModelWiresEx
Return type: void
Description: Draw a model wires (with texture if set) with extended parameters
@@ -3895,13 +3940,13 @@ Function 457: DrawModelWiresEx() (6 input parameters)
Param[4]: rotationAngle (type: float)
Param[5]: scale (type: Vector3)
Param[6]: tint (type: Color)
-Function 458: DrawBoundingBox() (2 input parameters)
+Function 463: DrawBoundingBox() (2 input parameters)
Name: DrawBoundingBox
Return type: void
Description: Draw bounding box (wires)
Param[1]: box (type: BoundingBox)
Param[2]: color (type: Color)
-Function 459: DrawBillboard() (5 input parameters)
+Function 464: DrawBillboard() (5 input parameters)
Name: DrawBillboard
Return type: void
Description: Draw a billboard texture
@@ -3910,7 +3955,7 @@ Function 459: DrawBillboard() (5 input parameters)
Param[3]: position (type: Vector3)
Param[4]: size (type: float)
Param[5]: tint (type: Color)
-Function 460: DrawBillboardRec() (6 input parameters)
+Function 465: DrawBillboardRec() (6 input parameters)
Name: DrawBillboardRec
Return type: void
Description: Draw a billboard texture defined by source
@@ -3920,7 +3965,7 @@ Function 460: DrawBillboardRec() (6 input parameters)
Param[4]: position (type: Vector3)
Param[5]: size (type: Vector2)
Param[6]: tint (type: Color)
-Function 461: DrawBillboardPro() (9 input parameters)
+Function 466: DrawBillboardPro() (9 input parameters)
Name: DrawBillboardPro
Return type: void
Description: Draw a billboard texture defined by source and rotation
@@ -3933,13 +3978,13 @@ Function 461: DrawBillboardPro() (9 input parameters)
Param[7]: origin (type: Vector2)
Param[8]: rotation (type: float)
Param[9]: tint (type: Color)
-Function 462: UploadMesh() (2 input parameters)
+Function 467: UploadMesh() (2 input parameters)
Name: UploadMesh
Return type: void
Description: Upload mesh vertex data in GPU and provide VAO/VBO ids
Param[1]: mesh (type: Mesh *)
Param[2]: dynamic (type: bool)
-Function 463: UpdateMeshBuffer() (5 input parameters)
+Function 468: UpdateMeshBuffer() (5 input parameters)
Name: UpdateMeshBuffer
Return type: void
Description: Update mesh vertex data in GPU for a specific buffer index
@@ -3948,19 +3993,19 @@ Function 463: UpdateMeshBuffer() (5 input parameters)
Param[3]: data (type: const void *)
Param[4]: dataSize (type: int)
Param[5]: offset (type: int)
-Function 464: UnloadMesh() (1 input parameters)
+Function 469: UnloadMesh() (1 input parameters)
Name: UnloadMesh
Return type: void
Description: Unload mesh data from CPU and GPU
Param[1]: mesh (type: Mesh)
-Function 465: DrawMesh() (3 input parameters)
+Function 470: DrawMesh() (3 input parameters)
Name: DrawMesh
Return type: void
Description: Draw a 3d mesh with material and transform
Param[1]: mesh (type: Mesh)
Param[2]: material (type: Material)
Param[3]: transform (type: Matrix)
-Function 466: DrawMeshInstanced() (4 input parameters)
+Function 471: DrawMeshInstanced() (4 input parameters)
Name: DrawMeshInstanced
Return type: void
Description: Draw multiple mesh instances with material and different transforms
@@ -3968,35 +4013,35 @@ Function 466: DrawMeshInstanced() (4 input parameters)
Param[2]: material (type: Material)
Param[3]: transforms (type: const Matrix *)
Param[4]: instances (type: int)
-Function 467: GetMeshBoundingBox() (1 input parameters)
+Function 472: GetMeshBoundingBox() (1 input parameters)
Name: GetMeshBoundingBox
Return type: BoundingBox
Description: Compute mesh bounding box limits
Param[1]: mesh (type: Mesh)
-Function 468: GenMeshTangents() (1 input parameters)
+Function 473: GenMeshTangents() (1 input parameters)
Name: GenMeshTangents
Return type: void
Description: Compute mesh tangents
Param[1]: mesh (type: Mesh *)
-Function 469: ExportMesh() (2 input parameters)
+Function 474: ExportMesh() (2 input parameters)
Name: ExportMesh
Return type: bool
Description: Export mesh data to file, returns true on success
Param[1]: mesh (type: Mesh)
Param[2]: fileName (type: const char *)
-Function 470: ExportMeshAsCode() (2 input parameters)
+Function 475: ExportMeshAsCode() (2 input parameters)
Name: ExportMeshAsCode
Return type: bool
Description: Export mesh as code file (.h) defining multiple arrays of vertex attributes
Param[1]: mesh (type: Mesh)
Param[2]: fileName (type: const char *)
-Function 471: GenMeshPoly() (2 input parameters)
+Function 476: GenMeshPoly() (2 input parameters)
Name: GenMeshPoly
Return type: Mesh
Description: Generate polygonal mesh
Param[1]: sides (type: int)
Param[2]: radius (type: float)
-Function 472: GenMeshPlane() (4 input parameters)
+Function 477: GenMeshPlane() (4 input parameters)
Name: GenMeshPlane
Return type: Mesh
Description: Generate plane mesh (with subdivisions)
@@ -4004,42 +4049,42 @@ Function 472: GenMeshPlane() (4 input parameters)
Param[2]: length (type: float)
Param[3]: resX (type: int)
Param[4]: resZ (type: int)
-Function 473: GenMeshCube() (3 input parameters)
+Function 478: GenMeshCube() (3 input parameters)
Name: GenMeshCube
Return type: Mesh
Description: Generate cuboid mesh
Param[1]: width (type: float)
Param[2]: height (type: float)
Param[3]: length (type: float)
-Function 474: GenMeshSphere() (3 input parameters)
+Function 479: GenMeshSphere() (3 input parameters)
Name: GenMeshSphere
Return type: Mesh
Description: Generate sphere mesh (standard sphere)
Param[1]: radius (type: float)
Param[2]: rings (type: int)
Param[3]: slices (type: int)
-Function 475: GenMeshHemiSphere() (3 input parameters)
+Function 480: GenMeshHemiSphere() (3 input parameters)
Name: GenMeshHemiSphere
Return type: Mesh
Description: Generate half-sphere mesh (no bottom cap)
Param[1]: radius (type: float)
Param[2]: rings (type: int)
Param[3]: slices (type: int)
-Function 476: GenMeshCylinder() (3 input parameters)
+Function 481: GenMeshCylinder() (3 input parameters)
Name: GenMeshCylinder
Return type: Mesh
Description: Generate cylinder mesh
Param[1]: radius (type: float)
Param[2]: height (type: float)
Param[3]: slices (type: int)
-Function 477: GenMeshCone() (3 input parameters)
+Function 482: GenMeshCone() (3 input parameters)
Name: GenMeshCone
Return type: Mesh
Description: Generate cone/pyramid mesh
Param[1]: radius (type: float)
Param[2]: height (type: float)
Param[3]: slices (type: int)
-Function 478: GenMeshTorus() (4 input parameters)
+Function 483: GenMeshTorus() (4 input parameters)
Name: GenMeshTorus
Return type: Mesh
Description: Generate torus mesh
@@ -4047,7 +4092,7 @@ Function 478: GenMeshTorus() (4 input parameters)
Param[2]: size (type: float)
Param[3]: radSeg (type: int)
Param[4]: sides (type: int)
-Function 479: GenMeshKnot() (4 input parameters)
+Function 484: GenMeshKnot() (4 input parameters)
Name: GenMeshKnot
Return type: Mesh
Description: Generate trefoil knot mesh
@@ -4055,84 +4100,84 @@ Function 479: GenMeshKnot() (4 input parameters)
Param[2]: size (type: float)
Param[3]: radSeg (type: int)
Param[4]: sides (type: int)
-Function 480: GenMeshHeightmap() (2 input parameters)
+Function 485: GenMeshHeightmap() (2 input parameters)
Name: GenMeshHeightmap
Return type: Mesh
Description: Generate heightmap mesh from image data
Param[1]: heightmap (type: Image)
Param[2]: size (type: Vector3)
-Function 481: GenMeshCubicmap() (2 input parameters)
+Function 486: GenMeshCubicmap() (2 input parameters)
Name: GenMeshCubicmap
Return type: Mesh
Description: Generate cubes-based map mesh from image data
Param[1]: cubicmap (type: Image)
Param[2]: cubeSize (type: Vector3)
-Function 482: LoadMaterials() (2 input parameters)
+Function 487: LoadMaterials() (2 input parameters)
Name: LoadMaterials
Return type: Material *
Description: Load materials from model file
Param[1]: fileName (type: const char *)
Param[2]: materialCount (type: int *)
-Function 483: LoadMaterialDefault() (0 input parameters)
+Function 488: LoadMaterialDefault() (0 input parameters)
Name: LoadMaterialDefault
Return type: Material
Description: Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
No input parameters
-Function 484: IsMaterialReady() (1 input parameters)
+Function 489: IsMaterialReady() (1 input parameters)
Name: IsMaterialReady
Return type: bool
Description: Check if a material is ready
Param[1]: material (type: Material)
-Function 485: UnloadMaterial() (1 input parameters)
+Function 490: UnloadMaterial() (1 input parameters)
Name: UnloadMaterial
Return type: void
Description: Unload material from GPU memory (VRAM)
Param[1]: material (type: Material)
-Function 486: SetMaterialTexture() (3 input parameters)
+Function 491: SetMaterialTexture() (3 input parameters)
Name: SetMaterialTexture
Return type: void
Description: Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
Param[1]: material (type: Material *)
Param[2]: mapType (type: int)
Param[3]: texture (type: Texture2D)
-Function 487: SetModelMeshMaterial() (3 input parameters)
+Function 492: SetModelMeshMaterial() (3 input parameters)
Name: SetModelMeshMaterial
Return type: void
Description: Set material for a mesh
Param[1]: model (type: Model *)
Param[2]: meshId (type: int)
Param[3]: materialId (type: int)
-Function 488: LoadModelAnimations() (2 input parameters)
+Function 493: LoadModelAnimations() (2 input parameters)
Name: LoadModelAnimations
Return type: ModelAnimation *
Description: Load model animations from file
Param[1]: fileName (type: const char *)
Param[2]: animCount (type: int *)
-Function 489: UpdateModelAnimation() (3 input parameters)
+Function 494: UpdateModelAnimation() (3 input parameters)
Name: UpdateModelAnimation
Return type: void
Description: Update model animation pose
Param[1]: model (type: Model)
Param[2]: anim (type: ModelAnimation)
Param[3]: frame (type: int)
-Function 490: UnloadModelAnimation() (1 input parameters)
+Function 495: UnloadModelAnimation() (1 input parameters)
Name: UnloadModelAnimation
Return type: void
Description: Unload animation data
Param[1]: anim (type: ModelAnimation)
-Function 491: UnloadModelAnimations() (2 input parameters)
+Function 496: UnloadModelAnimations() (2 input parameters)
Name: UnloadModelAnimations
Return type: void
Description: Unload animation array data
Param[1]: animations (type: ModelAnimation *)
Param[2]: animCount (type: int)
-Function 492: IsModelAnimationValid() (2 input parameters)
+Function 497: IsModelAnimationValid() (2 input parameters)
Name: IsModelAnimationValid
Return type: bool
Description: Check model animation skeleton match
Param[1]: model (type: Model)
Param[2]: anim (type: ModelAnimation)
-Function 493: CheckCollisionSpheres() (4 input parameters)
+Function 498: CheckCollisionSpheres() (4 input parameters)
Name: CheckCollisionSpheres
Return type: bool
Description: Check collision between two spheres
@@ -4140,40 +4185,40 @@ Function 493: CheckCollisionSpheres() (4 input parameters)
Param[2]: radius1 (type: float)
Param[3]: center2 (type: Vector3)
Param[4]: radius2 (type: float)
-Function 494: CheckCollisionBoxes() (2 input parameters)
+Function 499: CheckCollisionBoxes() (2 input parameters)
Name: CheckCollisionBoxes
Return type: bool
Description: Check collision between two bounding boxes
Param[1]: box1 (type: BoundingBox)
Param[2]: box2 (type: BoundingBox)
-Function 495: CheckCollisionBoxSphere() (3 input parameters)
+Function 500: CheckCollisionBoxSphere() (3 input parameters)
Name: CheckCollisionBoxSphere
Return type: bool
Description: Check collision between box and sphere
Param[1]: box (type: BoundingBox)
Param[2]: center (type: Vector3)
Param[3]: radius (type: float)
-Function 496: GetRayCollisionSphere() (3 input parameters)
+Function 501: GetRayCollisionSphere() (3 input parameters)
Name: GetRayCollisionSphere
Return type: RayCollision
Description: Get collision info between ray and sphere
Param[1]: ray (type: Ray)
Param[2]: center (type: Vector3)
Param[3]: radius (type: float)
-Function 497: GetRayCollisionBox() (2 input parameters)
+Function 502: GetRayCollisionBox() (2 input parameters)
Name: GetRayCollisionBox
Return type: RayCollision
Description: Get collision info between ray and box
Param[1]: ray (type: Ray)
Param[2]: box (type: BoundingBox)
-Function 498: GetRayCollisionMesh() (3 input parameters)
+Function 503: GetRayCollisionMesh() (3 input parameters)
Name: GetRayCollisionMesh
Return type: RayCollision
Description: Get collision info between ray and mesh
Param[1]: ray (type: Ray)
Param[2]: mesh (type: Mesh)
Param[3]: transform (type: Matrix)
-Function 499: GetRayCollisionTriangle() (4 input parameters)
+Function 504: GetRayCollisionTriangle() (4 input parameters)
Name: GetRayCollisionTriangle
Return type: RayCollision
Description: Get collision info between ray and triangle
@@ -4181,7 +4226,7 @@ Function 499: GetRayCollisionTriangle() (4 input parameters)
Param[2]: p1 (type: Vector3)
Param[3]: p2 (type: Vector3)
Param[4]: p3 (type: Vector3)
-Function 500: GetRayCollisionQuad() (5 input parameters)
+Function 505: GetRayCollisionQuad() (5 input parameters)
Name: GetRayCollisionQuad
Return type: RayCollision
Description: Get collision info between ray and quad
@@ -4190,158 +4235,158 @@ Function 500: GetRayCollisionQuad() (5 input parameters)
Param[3]: p2 (type: Vector3)
Param[4]: p3 (type: Vector3)
Param[5]: p4 (type: Vector3)
-Function 501: InitAudioDevice() (0 input parameters)
+Function 506: InitAudioDevice() (0 input parameters)
Name: InitAudioDevice
Return type: void
Description: Initialize audio device and context
No input parameters
-Function 502: CloseAudioDevice() (0 input parameters)
+Function 507: CloseAudioDevice() (0 input parameters)
Name: CloseAudioDevice
Return type: void
Description: Close the audio device and context
No input parameters
-Function 503: IsAudioDeviceReady() (0 input parameters)
+Function 508: IsAudioDeviceReady() (0 input parameters)
Name: IsAudioDeviceReady
Return type: bool
Description: Check if audio device has been initialized successfully
No input parameters
-Function 504: SetMasterVolume() (1 input parameters)
+Function 509: SetMasterVolume() (1 input parameters)
Name: SetMasterVolume
Return type: void
Description: Set master volume (listener)
Param[1]: volume (type: float)
-Function 505: GetMasterVolume() (0 input parameters)
+Function 510: GetMasterVolume() (0 input parameters)
Name: GetMasterVolume
Return type: float
Description: Get master volume (listener)
No input parameters
-Function 506: LoadWave() (1 input parameters)
+Function 511: LoadWave() (1 input parameters)
Name: LoadWave
Return type: Wave
Description: Load wave data from file
Param[1]: fileName (type: const char *)
-Function 507: LoadWaveFromMemory() (3 input parameters)
+Function 512: LoadWaveFromMemory() (3 input parameters)
Name: LoadWaveFromMemory
Return type: Wave
Description: Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
Param[1]: fileType (type: const char *)
Param[2]: fileData (type: const unsigned char *)
Param[3]: dataSize (type: int)
-Function 508: IsWaveReady() (1 input parameters)
+Function 513: IsWaveReady() (1 input parameters)
Name: IsWaveReady
Return type: bool
Description: Checks if wave data is ready
Param[1]: wave (type: Wave)
-Function 509: LoadSound() (1 input parameters)
+Function 514: LoadSound() (1 input parameters)
Name: LoadSound
Return type: Sound
Description: Load sound from file
Param[1]: fileName (type: const char *)
-Function 510: LoadSoundFromWave() (1 input parameters)
+Function 515: LoadSoundFromWave() (1 input parameters)
Name: LoadSoundFromWave
Return type: Sound
Description: Load sound from wave data
Param[1]: wave (type: Wave)
-Function 511: LoadSoundAlias() (1 input parameters)
+Function 516: LoadSoundAlias() (1 input parameters)
Name: LoadSoundAlias
Return type: Sound
Description: Create a new sound that shares the same sample data as the source sound, does not own the sound data
Param[1]: source (type: Sound)
-Function 512: IsSoundReady() (1 input parameters)
+Function 517: IsSoundReady() (1 input parameters)
Name: IsSoundReady
Return type: bool
Description: Checks if a sound is ready
Param[1]: sound (type: Sound)
-Function 513: UpdateSound() (3 input parameters)
+Function 518: UpdateSound() (3 input parameters)
Name: UpdateSound
Return type: void
Description: Update sound buffer with new data
Param[1]: sound (type: Sound)
Param[2]: data (type: const void *)
Param[3]: sampleCount (type: int)
-Function 514: UnloadWave() (1 input parameters)
+Function 519: UnloadWave() (1 input parameters)
Name: UnloadWave
Return type: void
Description: Unload wave data
Param[1]: wave (type: Wave)
-Function 515: UnloadSound() (1 input parameters)
+Function 520: UnloadSound() (1 input parameters)
Name: UnloadSound
Return type: void
Description: Unload sound
Param[1]: sound (type: Sound)
-Function 516: UnloadSoundAlias() (1 input parameters)
+Function 521: UnloadSoundAlias() (1 input parameters)
Name: UnloadSoundAlias
Return type: void
Description: Unload a sound alias (does not deallocate sample data)
Param[1]: alias (type: Sound)
-Function 517: ExportWave() (2 input parameters)
+Function 522: ExportWave() (2 input parameters)
Name: ExportWave
Return type: bool
Description: Export wave data to file, returns true on success
Param[1]: wave (type: Wave)
Param[2]: fileName (type: const char *)
-Function 518: ExportWaveAsCode() (2 input parameters)
+Function 523: ExportWaveAsCode() (2 input parameters)
Name: ExportWaveAsCode
Return type: bool
Description: Export wave sample data to code (.h), returns true on success
Param[1]: wave (type: Wave)
Param[2]: fileName (type: const char *)
-Function 519: PlaySound() (1 input parameters)
+Function 524: PlaySound() (1 input parameters)
Name: PlaySound
Return type: void
Description: Play a sound
Param[1]: sound (type: Sound)
-Function 520: StopSound() (1 input parameters)
+Function 525: StopSound() (1 input parameters)
Name: StopSound
Return type: void
Description: Stop playing a sound
Param[1]: sound (type: Sound)
-Function 521: PauseSound() (1 input parameters)
+Function 526: PauseSound() (1 input parameters)
Name: PauseSound
Return type: void
Description: Pause a sound
Param[1]: sound (type: Sound)
-Function 522: ResumeSound() (1 input parameters)
+Function 527: ResumeSound() (1 input parameters)
Name: ResumeSound
Return type: void
Description: Resume a paused sound
Param[1]: sound (type: Sound)
-Function 523: IsSoundPlaying() (1 input parameters)
+Function 528: IsSoundPlaying() (1 input parameters)
Name: IsSoundPlaying
Return type: bool
Description: Check if a sound is currently playing
Param[1]: sound (type: Sound)
-Function 524: SetSoundVolume() (2 input parameters)
+Function 529: SetSoundVolume() (2 input parameters)
Name: SetSoundVolume
Return type: void
Description: Set volume for a sound (1.0 is max level)
Param[1]: sound (type: Sound)
Param[2]: volume (type: float)
-Function 525: SetSoundPitch() (2 input parameters)
+Function 530: SetSoundPitch() (2 input parameters)
Name: SetSoundPitch
Return type: void
Description: Set pitch for a sound (1.0 is base level)
Param[1]: sound (type: Sound)
Param[2]: pitch (type: float)
-Function 526: SetSoundPan() (2 input parameters)
+Function 531: SetSoundPan() (2 input parameters)
Name: SetSoundPan
Return type: void
Description: Set pan for a sound (0.5 is center)
Param[1]: sound (type: Sound)
Param[2]: pan (type: float)
-Function 527: WaveCopy() (1 input parameters)
+Function 532: WaveCopy() (1 input parameters)
Name: WaveCopy
Return type: Wave
Description: Copy a wave to a new wave
Param[1]: wave (type: Wave)
-Function 528: WaveCrop() (3 input parameters)
+Function 533: WaveCrop() (3 input parameters)
Name: WaveCrop
Return type: void
Description: Crop a wave to defined frames range
Param[1]: wave (type: Wave *)
Param[2]: initFrame (type: int)
Param[3]: finalFrame (type: int)
-Function 529: WaveFormat() (4 input parameters)
+Function 534: WaveFormat() (4 input parameters)
Name: WaveFormat
Return type: void
Description: Convert wave data to desired format
@@ -4349,203 +4394,203 @@ Function 529: WaveFormat() (4 input parameters)
Param[2]: sampleRate (type: int)
Param[3]: sampleSize (type: int)
Param[4]: channels (type: int)
-Function 530: LoadWaveSamples() (1 input parameters)
+Function 535: LoadWaveSamples() (1 input parameters)
Name: LoadWaveSamples
Return type: float *
Description: Load samples data from wave as a 32bit float data array
Param[1]: wave (type: Wave)
-Function 531: UnloadWaveSamples() (1 input parameters)
+Function 536: UnloadWaveSamples() (1 input parameters)
Name: UnloadWaveSamples
Return type: void
Description: Unload samples data loaded with LoadWaveSamples()
Param[1]: samples (type: float *)
-Function 532: LoadMusicStream() (1 input parameters)
+Function 537: LoadMusicStream() (1 input parameters)
Name: LoadMusicStream
Return type: Music
Description: Load music stream from file
Param[1]: fileName (type: const char *)
-Function 533: LoadMusicStreamFromMemory() (3 input parameters)
+Function 538: LoadMusicStreamFromMemory() (3 input parameters)
Name: LoadMusicStreamFromMemory
Return type: Music
Description: Load music stream from data
Param[1]: fileType (type: const char *)
Param[2]: data (type: const unsigned char *)
Param[3]: dataSize (type: int)
-Function 534: IsMusicReady() (1 input parameters)
+Function 539: IsMusicReady() (1 input parameters)
Name: IsMusicReady
Return type: bool
Description: Checks if a music stream is ready
Param[1]: music (type: Music)
-Function 535: UnloadMusicStream() (1 input parameters)
+Function 540: UnloadMusicStream() (1 input parameters)
Name: UnloadMusicStream
Return type: void
Description: Unload music stream
Param[1]: music (type: Music)
-Function 536: PlayMusicStream() (1 input parameters)
+Function 541: PlayMusicStream() (1 input parameters)
Name: PlayMusicStream
Return type: void
Description: Start music playing
Param[1]: music (type: Music)
-Function 537: IsMusicStreamPlaying() (1 input parameters)
+Function 542: IsMusicStreamPlaying() (1 input parameters)
Name: IsMusicStreamPlaying
Return type: bool
Description: Check if music is playing
Param[1]: music (type: Music)
-Function 538: UpdateMusicStream() (1 input parameters)
+Function 543: UpdateMusicStream() (1 input parameters)
Name: UpdateMusicStream
Return type: void
Description: Updates buffers for music streaming
Param[1]: music (type: Music)
-Function 539: StopMusicStream() (1 input parameters)
+Function 544: StopMusicStream() (1 input parameters)
Name: StopMusicStream
Return type: void
Description: Stop music playing
Param[1]: music (type: Music)
-Function 540: PauseMusicStream() (1 input parameters)
+Function 545: PauseMusicStream() (1 input parameters)
Name: PauseMusicStream
Return type: void
Description: Pause music playing
Param[1]: music (type: Music)
-Function 541: ResumeMusicStream() (1 input parameters)
+Function 546: ResumeMusicStream() (1 input parameters)
Name: ResumeMusicStream
Return type: void
Description: Resume playing paused music
Param[1]: music (type: Music)
-Function 542: SeekMusicStream() (2 input parameters)
+Function 547: SeekMusicStream() (2 input parameters)
Name: SeekMusicStream
Return type: void
Description: Seek music to a position (in seconds)
Param[1]: music (type: Music)
Param[2]: position (type: float)
-Function 543: SetMusicVolume() (2 input parameters)
+Function 548: SetMusicVolume() (2 input parameters)
Name: SetMusicVolume
Return type: void
Description: Set volume for music (1.0 is max level)
Param[1]: music (type: Music)
Param[2]: volume (type: float)
-Function 544: SetMusicPitch() (2 input parameters)
+Function 549: SetMusicPitch() (2 input parameters)
Name: SetMusicPitch
Return type: void
Description: Set pitch for a music (1.0 is base level)
Param[1]: music (type: Music)
Param[2]: pitch (type: float)
-Function 545: SetMusicPan() (2 input parameters)
+Function 550: SetMusicPan() (2 input parameters)
Name: SetMusicPan
Return type: void
Description: Set pan for a music (0.5 is center)
Param[1]: music (type: Music)
Param[2]: pan (type: float)
-Function 546: GetMusicTimeLength() (1 input parameters)
+Function 551: GetMusicTimeLength() (1 input parameters)
Name: GetMusicTimeLength
Return type: float
Description: Get music time length (in seconds)
Param[1]: music (type: Music)
-Function 547: GetMusicTimePlayed() (1 input parameters)
+Function 552: GetMusicTimePlayed() (1 input parameters)
Name: GetMusicTimePlayed
Return type: float
Description: Get current music time played (in seconds)
Param[1]: music (type: Music)
-Function 548: LoadAudioStream() (3 input parameters)
+Function 553: LoadAudioStream() (3 input parameters)
Name: LoadAudioStream
Return type: AudioStream
Description: Load audio stream (to stream raw audio pcm data)
Param[1]: sampleRate (type: unsigned int)
Param[2]: sampleSize (type: unsigned int)
Param[3]: channels (type: unsigned int)
-Function 549: IsAudioStreamReady() (1 input parameters)
+Function 554: IsAudioStreamReady() (1 input parameters)
Name: IsAudioStreamReady
Return type: bool
Description: Checks if an audio stream is ready
Param[1]: stream (type: AudioStream)
-Function 550: UnloadAudioStream() (1 input parameters)
+Function 555: UnloadAudioStream() (1 input parameters)
Name: UnloadAudioStream
Return type: void
Description: Unload audio stream and free memory
Param[1]: stream (type: AudioStream)
-Function 551: UpdateAudioStream() (3 input parameters)
+Function 556: UpdateAudioStream() (3 input parameters)
Name: UpdateAudioStream
Return type: void
Description: Update audio stream buffers with data
Param[1]: stream (type: AudioStream)
Param[2]: data (type: const void *)
Param[3]: frameCount (type: int)
-Function 552: IsAudioStreamProcessed() (1 input parameters)
+Function 557: IsAudioStreamProcessed() (1 input parameters)
Name: IsAudioStreamProcessed
Return type: bool
Description: Check if any audio stream buffers requires refill
Param[1]: stream (type: AudioStream)
-Function 553: PlayAudioStream() (1 input parameters)
+Function 558: PlayAudioStream() (1 input parameters)
Name: PlayAudioStream
Return type: void
Description: Play audio stream
Param[1]: stream (type: AudioStream)
-Function 554: PauseAudioStream() (1 input parameters)
+Function 559: PauseAudioStream() (1 input parameters)
Name: PauseAudioStream
Return type: void
Description: Pause audio stream
Param[1]: stream (type: AudioStream)
-Function 555: ResumeAudioStream() (1 input parameters)
+Function 560: ResumeAudioStream() (1 input parameters)
Name: ResumeAudioStream
Return type: void
Description: Resume audio stream
Param[1]: stream (type: AudioStream)
-Function 556: IsAudioStreamPlaying() (1 input parameters)
+Function 561: IsAudioStreamPlaying() (1 input parameters)
Name: IsAudioStreamPlaying
Return type: bool
Description: Check if audio stream is playing
Param[1]: stream (type: AudioStream)
-Function 557: StopAudioStream() (1 input parameters)
+Function 562: StopAudioStream() (1 input parameters)
Name: StopAudioStream
Return type: void
Description: Stop audio stream
Param[1]: stream (type: AudioStream)
-Function 558: SetAudioStreamVolume() (2 input parameters)
+Function 563: SetAudioStreamVolume() (2 input parameters)
Name: SetAudioStreamVolume
Return type: void
Description: Set volume for audio stream (1.0 is max level)
Param[1]: stream (type: AudioStream)
Param[2]: volume (type: float)
-Function 559: SetAudioStreamPitch() (2 input parameters)
+Function 564: SetAudioStreamPitch() (2 input parameters)
Name: SetAudioStreamPitch
Return type: void
Description: Set pitch for audio stream (1.0 is base level)
Param[1]: stream (type: AudioStream)
Param[2]: pitch (type: float)
-Function 560: SetAudioStreamPan() (2 input parameters)
+Function 565: SetAudioStreamPan() (2 input parameters)
Name: SetAudioStreamPan
Return type: void
Description: Set pan for audio stream (0.5 is centered)
Param[1]: stream (type: AudioStream)
Param[2]: pan (type: float)
-Function 561: SetAudioStreamBufferSizeDefault() (1 input parameters)
+Function 566: SetAudioStreamBufferSizeDefault() (1 input parameters)
Name: SetAudioStreamBufferSizeDefault
Return type: void
Description: Default size for new audio streams
Param[1]: size (type: int)
-Function 562: SetAudioStreamCallback() (2 input parameters)
+Function 567: SetAudioStreamCallback() (2 input parameters)
Name: SetAudioStreamCallback
Return type: void
Description: Audio thread callback to request new data
Param[1]: stream (type: AudioStream)
Param[2]: callback (type: AudioCallback)
-Function 563: AttachAudioStreamProcessor() (2 input parameters)
+Function 568: AttachAudioStreamProcessor() (2 input parameters)
Name: AttachAudioStreamProcessor
Return type: void
Description: Attach audio stream processor to stream, receives the samples as 'float'
Param[1]: stream (type: AudioStream)
Param[2]: processor (type: AudioCallback)
-Function 564: DetachAudioStreamProcessor() (2 input parameters)
+Function 569: DetachAudioStreamProcessor() (2 input parameters)
Name: DetachAudioStreamProcessor
Return type: void
Description: Detach audio stream processor from stream
Param[1]: stream (type: AudioStream)
Param[2]: processor (type: AudioCallback)
-Function 565: AttachAudioMixedProcessor() (1 input parameters)
+Function 570: AttachAudioMixedProcessor() (1 input parameters)
Name: AttachAudioMixedProcessor
Return type: void
Description: Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'
Param[1]: processor (type: AudioCallback)
-Function 566: DetachAudioMixedProcessor() (1 input parameters)
+Function 571: DetachAudioMixedProcessor() (1 input parameters)
Name: DetachAudioMixedProcessor
Return type: void
Description: Detach audio stream processor from the entire audio pipeline
diff --git a/parser/output/raylib_api.xml b/parser/output/raylib_api.xml
index 0e096d5a2..39e86c211 100644
--- a/parser/output/raylib_api.xml
+++ b/parser/output/raylib_api.xml
@@ -670,7 +670,7 @@
-
+
@@ -1317,7 +1317,7 @@
-
+
@@ -1493,12 +1493,12 @@
-
+
-
+
@@ -1525,31 +1525,31 @@
-
+
-
+
-
+
-
+
-
+
@@ -1655,7 +1655,7 @@
-
+
@@ -1844,7 +1844,7 @@
-
+
@@ -2017,6 +2017,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2440,7 +2475,7 @@
-
+
diff --git a/parser/raylib_parser.c b/parser/raylib_parser.c
index 63f957284..cfb0133c3 100644
--- a/parser/raylib_parser.c
+++ b/parser/raylib_parser.c
@@ -1100,7 +1100,7 @@ static void ShowCommandLineInfo(void)
printf(" NOTE: If not specified, defaults to: raylib_api.txt\n\n");
printf(" -f, --format : Define output format for parser data.\n");
printf(" Supported types: DEFAULT, JSON, XML, LUA, CODE\n\n");
- printf(" -d, --define : Define functions specifiers (i.e. RLAPI for raylib.h, RMDEF for raymath.h, etc.)\n");
+ printf(" -d, --define : Define functions specifiers (i.e. RLAPI for raylib.h, RMAPI for raymath.h, etc.)\n");
printf(" NOTE: If no specifier defined, defaults to: RLAPI\n\n");
printf(" -t, --truncate : Define string to truncate input after (i.e. \"RLGL IMPLEMENTATION\" for rlgl.h)\n");
printf(" NOTE: If not specified, the full input file is parsed.\n\n");
@@ -1110,7 +1110,7 @@ static void ShowCommandLineInfo(void)
printf(" Process to generate \n\n");
printf(" > raylib_parser --output raylib_data.info --format XML\n");
printf(" Process to generate as XML text data\n\n");
- printf(" > raylib_parser --input raymath.h --output raymath_data.info --format XML\n");
+ printf(" > raylib_parser --input raymath.h --output raymath_data.info --format XML --define RMAPI\n");
printf(" Process to generate as XML text data\n\n");
}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 387665705..c1360ee29 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -69,7 +69,10 @@ else()
endif()
if (${PLATFORM} MATCHES "Web")
- target_link_options(raylib PRIVATE "-sUSE_GLFW=3")
+ target_link_options(raylib PUBLIC "-sUSE_GLFW=3")
+ if(${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES3")
+ target_link_options(raylib PUBLIC "-sFULL_ES3")
+ endif()
endif()
set_target_properties(raylib PROPERTIES
diff --git a/src/Makefile b/src/Makefile
index 23742565d..19251b956 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -316,7 +316,7 @@ endif
# -D_GNU_SOURCE access to lots of nonstandard GNU/Linux extension functions
# -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers
# -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing)
-CFLAGS = -Wall -D_GNU_SOURCE -D$(PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing $(CUSTOM_CFLAGS)
+CFLAGS = -Wall -D_GNU_SOURCE -D$(PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing
ifneq ($(RAYLIB_CONFIG_FLAGS), NONE)
CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS)
@@ -449,6 +449,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif
endif
+CFLAGS += $(CUSTOM_CFLAGS)
+
# Define include paths for required headers: INCLUDE_PATHS
# NOTE: Several external required libraries (stb and others)
#------------------------------------------------------------------------------------------------
diff --git a/src/build.zig b/src/build.zig
index 35622a462..81d4a7662 100644
--- a/src/build.zig
+++ b/src/build.zig
@@ -217,6 +217,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
},
}
+ raylib.addIncludePath(b.path("src"));
raylib.root_module.addCSourceFiles(.{
.root = b.path("src"),
.files = c_source_files.items,
diff --git a/src/external/rl_gputex.h b/src/external/rl_gputex.h
index c57730552..6b26d1c8d 100644
--- a/src/external/rl_gputex.h
+++ b/src/external/rl_gputex.h
@@ -171,6 +171,10 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
*width = header->width;
*height = header->height;
+
+ if (*width % 4 != 0) LOG("WARNING: IMAGE: DDS file width must be multiple of 4. Image will not display correctly");
+ if (*height % 4 != 0) LOG("WARNING: IMAGE: DDS file height must be multiple of 4. Image will not display correctly");
+
image_pixel_size = header->width*header->height;
if (header->mipmap_count == 0) *mips = 1; // Parameter not used
diff --git a/src/platforms/rcore_desktop.c b/src/platforms/rcore_desktop.c
index 6fe054a8a..bb3fcf4f0 100644
--- a/src/platforms/rcore_desktop.c
+++ b/src/platforms/rcore_desktop.c
@@ -666,6 +666,9 @@ void SetWindowMaxSize(int width, int height)
// Set window dimensions
void SetWindowSize(int width, int height)
{
+ CORE.Window.screen.width = width;
+ CORE.Window.screen.height = height;
+
glfwSetWindowSize(platform.handle, width, height);
}
diff --git a/src/raudio.c b/src/raudio.c
index c6bd00165..623984e1d 100644
--- a/src/raudio.c
+++ b/src/raudio.c
@@ -1304,8 +1304,8 @@ float *LoadWaveSamples(Wave wave)
for (unsigned int i = 0; i < wave.frameCount*wave.channels; i++)
{
- if (wave.sampleSize == 8) samples[i] = (float)(((unsigned char *)wave.data)[i] - 127)/256.0f;
- else if (wave.sampleSize == 16) samples[i] = (float)(((short *)wave.data)[i])/32767.0f;
+ if (wave.sampleSize == 8) samples[i] = (float)(((unsigned char *)wave.data)[i] - 128)/128.0f;
+ else if (wave.sampleSize == 16) samples[i] = (float)(((short *)wave.data)[i])/32768.0f;
else if (wave.sampleSize == 32) samples[i] = ((float *)wave.data)[i];
}
@@ -1428,7 +1428,9 @@ Music LoadMusicStream(const char *fileName)
{
music.ctxType = MUSIC_AUDIO_FLAC;
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.looping = true; // Looping enabled by default
musicLoaded = true;
diff --git a/src/raylib.h b/src/raylib.h
index c61285641..7195fd55f 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -1141,7 +1141,7 @@ RLAPI unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize
// Automation events functionality
RLAPI AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
-RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
+RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
RLAPI bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file
RLAPI void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to
RLAPI void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording
@@ -1233,7 +1233,7 @@ RLAPI void DrawPixelV(Vector2 position, Color color);
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 DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
-RLAPI void DrawLineStrip(Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
+RLAPI void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
@@ -1260,18 +1260,18 @@ RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segment
RLAPI void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!)
-RLAPI void DrawTriangleFan(Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
-RLAPI void DrawTriangleStrip(Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
+RLAPI void DrawTriangleFan(const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
+RLAPI void DrawTriangleStrip(const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
RLAPI void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters
// Splines drawing functions
-RLAPI void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
-RLAPI void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
-RLAPI void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
-RLAPI void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
-RLAPI void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
+RLAPI void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
+RLAPI void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
+RLAPI void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
+RLAPI void DrawSplineBezierQuadratic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
+RLAPI void DrawSplineBezierCubic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
RLAPI void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points
RLAPI void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points
RLAPI void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points
@@ -1292,7 +1292,7 @@ RLAPI bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);
RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
-RLAPI bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
+RLAPI bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
RLAPI bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2); // Check if circle collides with a line created betweeen two points [p1] and [p2]
@@ -1342,10 +1342,10 @@ RLAPI void ImageAlphaClear(Image *image, Color color, float threshold);
RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel
RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation
-RLAPI void ImageKernelConvolution(Image *image, float* kernel, int kernelSize); // Apply Custom Square image convolution kernel
+RLAPI void ImageKernelConvolution(Image *image, float *kernel, int kernelSize); // Apply Custom Square image convolution kernel
RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm)
RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
-RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
+RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
RLAPI void ImageMipmaps(Image *image); // Compute all mipmap levels for a provided image
RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
RLAPI void ImageFlipVertical(Image *image); // Flip image vertically
@@ -1381,6 +1381,11 @@ RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int hei
RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version)
RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image
+RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
+RLAPI void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
+RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
+RLAPI void ImageDrawTriangleFan(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
+RLAPI void ImageDrawTriangleStrip(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
@@ -1436,7 +1441,7 @@ RLAPI int GetPixelDataSize(int width, int height, int format); // G
// Font loading/unloading functions
RLAPI Font GetFontDefault(void); // Get the default Font
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
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 bool IsFontReady(Font font); // Check if a font is ready
@@ -1504,7 +1509,7 @@ RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color);
RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
-RLAPI void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
+RLAPI void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
diff --git a/src/rlgl.h b/src/rlgl.h
index 2f6a03b8a..530e44efc 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -4518,7 +4518,7 @@ Matrix rlGetMatrixTransform(void)
}
// Get internal projection matrix for stereo render (selected eye)
-RLAPI Matrix rlGetMatrixProjectionStereo(int eye)
+Matrix rlGetMatrixProjectionStereo(int eye)
{
Matrix mat = rlMatrixIdentity();
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
@@ -4528,7 +4528,7 @@ RLAPI Matrix rlGetMatrixProjectionStereo(int eye)
}
// Get internal view offset matrix for stereo render (selected eye)
-RLAPI Matrix rlGetMatrixViewOffsetStereo(int eye)
+Matrix rlGetMatrixViewOffsetStereo(int eye)
{
Matrix mat = rlMatrixIdentity();
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
diff --git a/src/rmodels.c b/src/rmodels.c
index 14cfc64aa..a169ec50d 100644
--- a/src/rmodels.c
+++ b/src/rmodels.c
@@ -226,7 +226,7 @@ void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color)
}
// Draw a triangle strip defined by points
-void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color)
+void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color)
{
if (pointCount < 3) return; // Security check
@@ -3436,7 +3436,12 @@ void GenMeshTangents(Mesh *mesh)
Vector3 *tan1 = (Vector3 *)RL_MALLOC(mesh->vertexCount*sizeof(Vector3));
Vector3 *tan2 = (Vector3 *)RL_MALLOC(mesh->vertexCount*sizeof(Vector3));
- for (int i = 0; i < mesh->vertexCount - 3; i += 3)
+ if (mesh->vertexCount % 3 != 0)
+ {
+ TRACELOG(LOG_WARNING, "MESH: vertexCount expected to be a multiple of 3. Expect uninitialized values.");
+ }
+
+ for (int i = 0; i <= mesh->vertexCount - 3; i += 3)
{
// Get triangle vertices
Vector3 v1 = { mesh->vertices[(i + 0)*3 + 0], mesh->vertices[(i + 0)*3 + 1], mesh->vertices[(i + 0)*3 + 2] };
@@ -4321,6 +4326,8 @@ static Model LoadIQM(const char *fileName)
model.materials[i] = LoadMaterialDefault();
model.materials[i].maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture(TextFormat("%s/%s", basePath, material));
+ model.meshMaterial[i] = i;
+
TRACELOG(LOG_DEBUG, "MODEL: [%s] mesh name (%s), material (%s)", fileName, name, material);
model.meshes[i].vertexCount = imesh[i].num_vertexes;
@@ -4864,7 +4871,7 @@ static BoneInfo *LoadBoneInfoGLTF(cgltf_skin skin, int *boneCount)
for (unsigned int i = 0; i < skin.joints_count; i++)
{
cgltf_node node = *skin.joints[i];
- strncpy(bones[i].name, node.name, sizeof(bones[i].name));
+ if (node.name != NULL) strncpy(bones[i].name, node.name, sizeof(bones[i].name));
// Find parent bone index
unsigned int parentIndex = -1;
@@ -4890,6 +4897,7 @@ static Model LoadGLTF(const char *fileName)
/*********************************************************************************************
Function implemented by Wilhem Barbier(@wbrbr), with modifications by Tyler Bezera(@gamerfiend)
+ Transform handling implemented by Paul Melis (@paulmelis).
Reviewed by Ramon Santamaria (@raysan5)
FEATURES:
@@ -4899,6 +4907,10 @@ static Model LoadGLTF(const char *fileName)
PBR specular/glossiness flow and extended texture flows not supported
- Supports multiple meshes per model (every primitives is loaded as a separate mesh)
- Supports basic animations
+ - Transforms, including parent-child relations, are applied on the mesh data, but the
+ hierarchy is not kept (as it can't be represented).
+ - Mesh instances in the glTF file (i.e. same mesh linked from multiple nodes)
+ are turned into separate raylib Meshes.
RESTRICTIONS:
- Only triangle meshes supported
@@ -4908,7 +4920,8 @@ static Model LoadGLTF(const char *fileName)
> Texcoords: vec2: float
> Colors: vec4: u8, u16, f32 (normalized)
> Indices: u16, u32 (truncated to u16)
- - Node hierarchies or transforms not supported
+ - Scenes defined in the glTF file are ignored. All nodes in the file
+ are used.
***********************************************************************************************/
@@ -4960,8 +4973,22 @@ static Model LoadGLTF(const char *fileName)
if (result != cgltf_result_success) TRACELOG(LOG_INFO, "MODEL: [%s] Failed to load mesh/material buffers", fileName);
int primitivesCount = 0;
- // NOTE: We will load every primitive in the glTF as a separate raylib mesh
- for (unsigned int i = 0; i < data->meshes_count; i++) primitivesCount += (int)data->meshes[i].primitives_count;
+ // NOTE: We will load every primitive in the glTF as a separate raylib Mesh.
+ // Determine total number of meshes needed from the node hierarchy.
+ for (unsigned int i = 0; i < data->nodes_count; i++)
+ {
+ cgltf_node *node = &(data->nodes[i]);
+ cgltf_mesh *mesh = node->mesh;
+ if (!mesh)
+ continue;
+
+ for (unsigned int p = 0; p < mesh->primitives_count; p++)
+ {
+ if (mesh->primitives[p].type == cgltf_primitive_type_triangles)
+ primitivesCount++;
+ }
+ }
+ TRACELOG(LOG_DEBUG, " > Primitives (triangles only) count based on hierarchy : %i", primitivesCount);
// Load our model data: meshes and materials
model.meshCount = primitivesCount;
@@ -5064,27 +5091,51 @@ static Model LoadGLTF(const char *fileName)
// has_clearcoat, has_transmission, has_volume, has_ior, has specular, has_sheen
}
- // Load meshes data
+ // Visit each node in the hierarchy and process any mesh linked from it.
+ // Each primitive within a glTF node becomes a Raylib Mesh.
+ // The local-to-world transform of each node is used to transform the
+ // points/normals/tangents of the created Mesh(es).
+ // Any glTF mesh linked from more than one Node (i.e. instancing)
+ // is turned into multiple Mesh's, as each Node will have its own
+ // transform applied.
+ // Note: the code below disregards the scenes defined in the file, all nodes are used.
//----------------------------------------------------------------------------------------------------
- for (unsigned int i = 0, meshIndex = 0; i < data->meshes_count; i++)
+ int meshIndex = 0;
+ for (unsigned int i = 0; i < data->nodes_count; i++)
{
- // NOTE: meshIndex accumulates primitives
+ cgltf_node *node = &(data->nodes[i]);
- for (unsigned int p = 0; p < data->meshes[i].primitives_count; p++)
+ cgltf_mesh *mesh = node->mesh;
+ if (!mesh)
+ continue;
+
+ cgltf_float worldTransform[16];
+ cgltf_node_transform_world(node, worldTransform);
+
+ Matrix worldMatrix = {
+ worldTransform[0], worldTransform[4], worldTransform[8], worldTransform[12],
+ worldTransform[1], worldTransform[5], worldTransform[9], worldTransform[13],
+ worldTransform[2], worldTransform[6], worldTransform[10], worldTransform[14],
+ worldTransform[3], worldTransform[7], worldTransform[11], worldTransform[15]
+ };
+
+ Matrix worldMatrixNormals = MatrixTranspose(MatrixInvert(worldMatrix));
+
+ for (unsigned int p = 0; p < mesh->primitives_count; p++)
{
// NOTE: We only support primitives defined by triangles
// Other alternatives: points, lines, line_strip, triangle_strip
- if (data->meshes[i].primitives[p].type != cgltf_primitive_type_triangles) continue;
+ if (mesh->primitives[p].type != cgltf_primitive_type_triangles) continue;
// NOTE: Attributes data could be provided in several data formats (8, 8u, 16u, 32...),
// Only some formats for each attribute type are supported, read info at the top of this function!
- for (unsigned int j = 0; j < data->meshes[i].primitives[p].attributes_count; j++)
+ for (unsigned int j = 0; j < mesh->primitives[p].attributes_count; j++)
{
// Check the different attributes for every primitive
- if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_position) // POSITION, vec3, float
+ if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_position) // POSITION, vec3, float
{
- cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
+ cgltf_accessor *attribute = mesh->primitives[p].attributes[j].data;
// WARNING: SPECS: POSITION accessor MUST have its min and max properties defined
@@ -5096,12 +5147,22 @@ static Model LoadGLTF(const char *fileName)
// Load 3 components of float data type into mesh.vertices
LOAD_ATTRIBUTE(attribute, 3, float, model.meshes[meshIndex].vertices)
+
+ // Transform the vertices
+ float *vertices = model.meshes[meshIndex].vertices;
+ for (int k = 0; k < attribute->count; k++)
+ {
+ Vector3 vt = Vector3Transform((Vector3){ vertices[3*k], vertices[3*k+1], vertices[3*k+2] }, worldMatrix);
+ vertices[3*k] = vt.x;
+ vertices[3*k+1] = vt.y;
+ vertices[3*k+2] = vt.z;
+ }
}
else TRACELOG(LOG_WARNING, "MODEL: [%s] Vertices attribute data format not supported, use vec3 float", fileName);
}
- else if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_normal) // NORMAL, vec3, float
+ else if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_normal) // NORMAL, vec3, float
{
- cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
+ cgltf_accessor *attribute = mesh->primitives[p].attributes[j].data;
if ((attribute->type == cgltf_type_vec3) && (attribute->component_type == cgltf_component_type_r_32f))
{
@@ -5110,12 +5171,22 @@ static Model LoadGLTF(const char *fileName)
// Load 3 components of float data type into mesh.normals
LOAD_ATTRIBUTE(attribute, 3, float, model.meshes[meshIndex].normals)
+
+ // Transform the normals
+ float *normals = model.meshes[meshIndex].normals;
+ for (int k = 0; k < attribute->count; k++)
+ {
+ Vector3 nt = Vector3Transform((Vector3){ normals[3*k], normals[3*k+1], normals[3*k+2] }, worldMatrixNormals);
+ normals[3*k] = nt.x;
+ normals[3*k+1] = nt.y;
+ normals[3*k+2] = nt.z;
+ }
}
else TRACELOG(LOG_WARNING, "MODEL: [%s] Normal attribute data format not supported, use vec3 float", fileName);
}
- else if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_tangent) // TANGENT, vec3, float
+ else if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_tangent) // TANGENT, vec3, float
{
- cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
+ cgltf_accessor *attribute = mesh->primitives[p].attributes[j].data;
if ((attribute->type == cgltf_type_vec4) && (attribute->component_type == cgltf_component_type_r_32f))
{
@@ -5124,15 +5195,25 @@ static Model LoadGLTF(const char *fileName)
// Load 4 components of float data type into mesh.tangents
LOAD_ATTRIBUTE(attribute, 4, float, model.meshes[meshIndex].tangents)
+
+ // Transform the tangents
+ float *tangents = model.meshes[meshIndex].tangents;
+ for (int k = 0; k < attribute->count; k++)
+ {
+ Vector3 tt = Vector3Transform((Vector3){ tangents[3*k], tangents[3*k+1], tangents[3*k+2] }, worldMatrix);
+ tangents[3*k] = tt.x;
+ tangents[3*k+1] = tt.y;
+ tangents[3*k+2] = tt.z;
+ }
}
else TRACELOG(LOG_WARNING, "MODEL: [%s] Tangent attribute data format not supported, use vec4 float", fileName);
}
- else if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_texcoord) // TEXCOORD_n, vec2, float/u8n/u16n
+ else if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_texcoord) // TEXCOORD_n, vec2, float/u8n/u16n
{
// Support up to 2 texture coordinates attributes
float *texcoordPtr = NULL;
- cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
+ cgltf_accessor *attribute = mesh->primitives[p].attributes[j].data;
if (attribute->type == cgltf_type_vec2)
{
@@ -5176,7 +5257,7 @@ static Model LoadGLTF(const char *fileName)
}
else TRACELOG(LOG_WARNING, "MODEL: [%s] Texcoords attribute data format not supported, use vec2 float", fileName);
- int index = data->meshes[i].primitives[p].attributes[j].index;
+ int index = mesh->primitives[p].attributes[j].index;
if (index == 0) model.meshes[meshIndex].texcoords = texcoordPtr;
else if (index == 1) model.meshes[meshIndex].texcoords2 = texcoordPtr;
else
@@ -5185,9 +5266,9 @@ static Model LoadGLTF(const char *fileName)
if (texcoordPtr != NULL) RL_FREE(texcoordPtr);
}
}
- else if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_color) // COLOR_n, vec3/vec4, float/u8n/u16n
+ else if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_color) // COLOR_n, vec3/vec4, float/u8n/u16n
{
- cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
+ cgltf_accessor *attribute = mesh->primitives[p].attributes[j].data;
// WARNING: SPECS: All components of each COLOR_n accessor element MUST be clamped to [0.0, 1.0] range
@@ -5304,9 +5385,9 @@ static Model LoadGLTF(const char *fileName)
}
// Load primitive indices data (if provided)
- if (data->meshes[i].primitives[p].indices != NULL)
+ if (mesh->primitives[p].indices != NULL)
{
- cgltf_accessor *attribute = data->meshes[i].primitives[p].indices;
+ cgltf_accessor *attribute = mesh->primitives[p].indices;
model.meshes[meshIndex].triangleCount = (int)attribute->count/3;
@@ -5346,7 +5427,7 @@ static Model LoadGLTF(const char *fileName)
// raylib instead assigns to the mesh the by its index, as loaded in model.materials array
// To get the index, we check if material pointers match, and we assign the corresponding index,
// skipping index 0, the default material
- if (&data->materials[m] == data->meshes[i].primitives[p].material)
+ if (&data->materials[m] == mesh->primitives[p].material)
{
model.meshMaterial[meshIndex] = m + 1;
break;
@@ -5396,20 +5477,27 @@ static Model LoadGLTF(const char *fileName)
TRACELOG(LOG_ERROR, "MODEL: [%s] can only load one skin (armature) per model, but gltf skins_count == %i", fileName, data->skins_count);
}
- for (unsigned int i = 0, meshIndex = 0; i < data->meshes_count; i++)
+ meshIndex = 0;
+ for (unsigned int i = 0; i < data->nodes_count; i++)
{
- for (unsigned int p = 0; p < data->meshes[i].primitives_count; p++)
+ cgltf_node *node = &(data->nodes[i]);
+
+ cgltf_mesh *mesh = node->mesh;
+ if (!mesh)
+ continue;
+
+ for (unsigned int p = 0; p < mesh->primitives_count; p++)
{
// NOTE: We only support primitives defined by triangles
- if (data->meshes[i].primitives[p].type != cgltf_primitive_type_triangles) continue;
+ if (mesh->primitives[p].type != cgltf_primitive_type_triangles) continue;
- for (unsigned int j = 0; j < data->meshes[i].primitives[p].attributes_count; j++)
+ for (unsigned int j = 0; j < mesh->primitives[p].attributes_count; j++)
{
// NOTE: JOINTS_1 + WEIGHT_1 will be used for +4 joints influencing a vertex -> Not supported by raylib
- if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_joints) // JOINTS_n (vec4: 4 bones max per vertex / u8, u16)
+ if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_joints) // JOINTS_n (vec4: 4 bones max per vertex / u8, u16)
{
- cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
+ cgltf_accessor *attribute = mesh->primitives[p].attributes[j].data;
// NOTE: JOINTS_n can only be vec4 and u8/u16
// SPECS: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes-overview
@@ -5457,9 +5545,9 @@ static Model LoadGLTF(const char *fileName)
}
else TRACELOG(LOG_WARNING, "MODEL: [%s] Joint attribute data format not supported", fileName);
}
- else if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_weights) // WEIGHTS_n (vec4, u8n/u16n/f32)
+ else if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_weights) // WEIGHTS_n (vec4, u8n/u16n/f32)
{
- cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
+ cgltf_accessor *attribute = mesh->primitives[p].attributes[j].data;
if (attribute->type == cgltf_type_vec4)
{
diff --git a/src/rshapes.c b/src/rshapes.c
index cb85c1c54..95c54770e 100644
--- a/src/rshapes.c
+++ b/src/rshapes.c
@@ -196,7 +196,7 @@ void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
}
// Draw lines sequuence (using gl lines)
-void DrawLineStrip(Vector2 *points, int pointCount, Color color)
+void DrawLineStrip(const Vector2 *points, int pointCount, Color color)
{
if (pointCount < 2) return; // Security check
@@ -1385,7 +1385,7 @@ void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
// Draw a triangle fan defined by points
// NOTE: First vertex provided is the center, shared by all triangles
// By default, following vertex should be provided in counter-clockwise order
-void DrawTriangleFan(Vector2 *points, int pointCount, Color color)
+void DrawTriangleFan(const Vector2 *points, int pointCount, Color color)
{
if (pointCount >= 3)
{
@@ -1416,7 +1416,7 @@ void DrawTriangleFan(Vector2 *points, int pointCount, Color color)
// Draw a triangle strip defined by points
// NOTE: Every new vertex connects with previous two
-void DrawTriangleStrip(Vector2 *points, int pointCount, Color color)
+void DrawTriangleStrip(const Vector2 *points, int pointCount, Color color)
{
if (pointCount >= 3)
{
@@ -1570,7 +1570,7 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl
//----------------------------------------------------------------------------------
// Draw spline: linear, minimum 2 points
-void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color)
+void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color)
{
if (pointCount < 2) return;
@@ -1687,7 +1687,7 @@ void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color)
}
// Draw spline: B-Spline, minimum 4 points
-void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color)
+void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color)
{
if (pointCount < 4) return;
@@ -1759,11 +1759,12 @@ void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color)
DrawTriangleStrip(vertices, 2*SPLINE_SEGMENT_DIVISIONS + 2, color);
}
- DrawCircleV(currentPoint, thick/2.0f, color); // Draw end line circle-cap
+ // Cap circle drawing at the end of every segment
+ DrawCircleV(currentPoint, thick/2.0f, color);
}
// Draw spline: Catmull-Rom, minimum 4 points
-void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color)
+void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color)
{
if (pointCount < 4) return;
@@ -1825,28 +1826,31 @@ void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color co
DrawTriangleStrip(vertices, 2*SPLINE_SEGMENT_DIVISIONS + 2, color);
}
- DrawCircleV(currentPoint, thick/2.0f, color); // Draw end line circle-cap
+ // Cap circle drawing at the end of every segment
+ DrawCircleV(currentPoint, thick/2.0f, color);
}
// Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
-void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color)
+void DrawSplineBezierQuadratic(const Vector2 *points, int pointCount, float thick, Color color)
{
- if (pointCount < 3) return;
-
- for (int i = 0; i < pointCount - 2; i++)
+ if (pointCount >= 3)
{
- DrawSplineSegmentBezierQuadratic(points[i], points[i + 1], points[i + 2], thick, color);
+ for (int i = 0; i < pointCount - 2; i += 2) DrawSplineSegmentBezierQuadratic(points[i], points[i + 1], points[i + 2], thick, color);
+
+ // Cap circle drawing at the end of every segment
+ //for (int i = 2; i < pointCount - 2; i += 2) DrawCircleV(points[i], thick/2.0f, color);
}
}
// Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
-void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color)
+void DrawSplineBezierCubic(const Vector2 *points, int pointCount, float thick, Color color)
{
- if (pointCount < 4) return;
-
- for (int i = 0; i < pointCount - 3; i++)
+ if (pointCount >= 4)
{
- DrawSplineSegmentBezierCubic(points[i], points[i + 1], points[i + 2], points[i + 3], thick, color);
+ for (int i = 0; i < pointCount - 3; i += 3) DrawSplineSegmentBezierCubic(points[i], points[i + 1], points[i + 2], points[i + 3], thick, color);
+
+ // Cap circle drawing at the end of every segment
+ //for (int i = 3; i < pointCount - 3; i += 3) DrawCircleV(points[i], thick/2.0f, color);
}
}
@@ -2195,7 +2199,7 @@ bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2
// Check if point is within a polygon described by array of vertices
// NOTE: Based on http://jeffreythompson.org/collision-detection/poly-point.php
-bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount)
+bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount)
{
bool inside = false;
@@ -2233,9 +2237,10 @@ bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, floa
float dx = center2.x - center1.x; // X distance between centers
float dy = center2.y - center1.y; // Y distance between centers
- float distance = sqrtf(dx*dx + dy*dy); // Distance between centers
+ float distanceSquared = dx * dx + dy * dy; // Distance between centers squared
+ float radiusSum = radius1 + radius2;
- if (distance <= (radius1 + radius2)) collision = true;
+ collision = (distanceSquared <= (radiusSum * radiusSum));
return collision;
}
diff --git a/src/rtext.c b/src/rtext.c
index 6ad0f90a0..62d786eac 100644
--- a/src/rtext.c
+++ b/src/rtext.c
@@ -1892,8 +1892,7 @@ int *LoadCodepoints(const char *text, int *count)
}
// Re-allocate buffer to the actual number of codepoints loaded
- int *temp = (int *)RL_REALLOC(codepoints, codepointCount*sizeof(int));
- if (temp != NULL) codepoints = temp;
+ codepoints = (int *)RL_REALLOC(codepoints, codepointCount*sizeof(int));
*count = codepointCount;
diff --git a/src/rtextures.c b/src/rtextures.c
index 2f02afece..39c0f78f2 100644
--- a/src/rtextures.c
+++ b/src/rtextures.c
@@ -3627,6 +3627,194 @@ void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color)
ImageDrawRectangle(dst, (int)rec.x, (int)(rec.y + rec.height - thick), (int)rec.width, thick, color);
}
+// Draw triangle within an image
+void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color)
+{
+ // Calculate the 2D bounding box of the triangle
+ // Determine the minimum and maximum x and y coordinates of the triangle vertices
+ int xMin = (v1.x < v2.x)? ((v1.x < v3.x)? v1.x : v3.x) : ((v2.x < v3.x)? v2.x : v3.x);
+ int yMin = (v1.y < v2.y)? ((v1.y < v3.y)? v1.y : v3.y) : ((v2.y < v3.y)? v2.y : v3.y);
+ int xMax = (v1.x > v2.x)? ((v1.x > v3.x)? v1.x : v3.x) : ((v2.x > v3.x)? v2.x : v3.x);
+ int yMax = (v1.y > v2.y)? ((v1.y > v3.y)? v1.y : v3.y) : ((v2.y > v3.y)? v2.y : v3.y);
+
+ // Clamp the bounding box to the image dimensions
+ if (xMin < 0) xMin = 0;
+ if (yMin < 0) yMin = 0;
+ if (xMax > dst->width) xMax = dst->width;
+ if (yMax > dst->height) yMax = dst->height;
+
+ // Check the order of the vertices to determine if it's a front or back face
+ // NOTE: if signedArea is equal to 0, the face is degenerate
+ float signedArea = (v2.x - v1.x)*(v3.y - v1.y) - (v3.x - v1.x)*(v2.y - v1.y);
+ bool isBackFace = (signedArea > 0);
+
+ // Barycentric interpolation setup
+ // Calculate the step increments for the barycentric coordinates
+ int w1XStep = v3.y - v2.y, w1YStep = v2.x - v3.x;
+ int w2XStep = v1.y - v3.y, w2YStep = v3.x - v1.x;
+ int w3XStep = v2.y - v1.y, w3YStep = v1.x - v2.x;
+
+ // If the triangle is a back face, invert the steps
+ if (isBackFace)
+ {
+ w1XStep = -w1XStep, w1YStep = -w1YStep;
+ w2XStep = -w2XStep, w2YStep = -w2YStep;
+ w3XStep = -w3XStep, w3YStep = -w3YStep;
+ }
+
+ // Calculate the initial barycentric coordinates for the top-left point of the bounding box
+ int w1Row = (xMin - v2.x)*w1XStep + w1YStep*(yMin - v2.y);
+ int w2Row = (xMin - v3.x)*w2XStep + w2YStep*(yMin - v3.y);
+ int w3Row = (xMin - v1.x)*w3XStep + w3YStep*(yMin - v1.y);
+
+ // Rasterization loop
+ // Iterate through each pixel in the bounding box
+ for (int y = yMin; y <= yMax; y++)
+ {
+ int w1 = w1Row;
+ int w2 = w2Row;
+ int w3 = w3Row;
+
+ for (int x = xMin; x <= xMax; x++)
+ {
+ // Check if the pixel is inside the triangle using barycentric coordinates
+ // If it is then we can draw the pixel with the given color
+ if ((w1 | w2 | w3) >= 0) ImageDrawPixel(dst, x, y, color);
+
+ // Increment the barycentric coordinates for the next pixel
+ w1 += w1XStep;
+ w2 += w2XStep;
+ w3 += w3XStep;
+ }
+
+ // Move to the next row in the bounding box
+ w1Row += w1YStep;
+ w2Row += w2YStep;
+ w3Row += w3YStep;
+ }
+}
+
+// Draw triangle with interpolated colors within an image
+void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3)
+{
+ // Calculate the 2D bounding box of the triangle
+ // Determine the minimum and maximum x and y coordinates of the triangle vertices
+ int xMin = (v1.x < v2.x)? ((v1.x < v3.x)? v1.x : v3.x) : ((v2.x < v3.x)? v2.x : v3.x);
+ int yMin = (v1.y < v2.y)? ((v1.y < v3.y)? v1.y : v3.y) : ((v2.y < v3.y)? v2.y : v3.y);
+ int xMax = (v1.x > v2.x)? ((v1.x > v3.x)? v1.x : v3.x) : ((v2.x > v3.x)? v2.x : v3.x);
+ int yMax = (v1.y > v2.y)? ((v1.y > v3.y)? v1.y : v3.y) : ((v2.y > v3.y)? v2.y : v3.y);
+
+ // Clamp the bounding box to the image dimensions
+ if (xMin < 0) xMin = 0;
+ if (yMin < 0) yMin = 0;
+ if (xMax > dst->width) xMax = dst->width;
+ if (yMax > dst->height) yMax = dst->height;
+
+ // Check the order of the vertices to determine if it's a front or back face
+ // NOTE: if signedArea is equal to 0, the face is degenerate
+ float signedArea = (v2.x - v1.x)*(v3.y - v1.y) - (v3.x - v1.x)*(v2.y - v1.y);
+ bool isBackFace = (signedArea > 0);
+
+ // Barycentric interpolation setup
+ // Calculate the step increments for the barycentric coordinates
+ int w1XStep = v3.y - v2.y, w1YStep = v2.x - v3.x;
+ int w2XStep = v1.y - v3.y, w2YStep = v3.x - v1.x;
+ int w3XStep = v2.y - v1.y, w3YStep = v1.x - v2.x;
+
+ // If the triangle is a back face, invert the steps
+ if (isBackFace)
+ {
+ w1XStep = -w1XStep, w1YStep = -w1YStep;
+ w2XStep = -w2XStep, w2YStep = -w2YStep;
+ w3XStep = -w3XStep, w3YStep = -w3YStep;
+ }
+
+ // Calculate the initial barycentric coordinates for the top-left point of the bounding box
+ int w1Row = (xMin - v2.x)*w1XStep + w1YStep*(yMin - v2.y);
+ int w2Row = (xMin - v3.x)*w2XStep + w2YStep*(yMin - v3.y);
+ int w3Row = (xMin - v1.x)*w3XStep + w3YStep*(yMin - v1.y);
+
+ // Calculate the inverse of the sum of the barycentric coordinates for normalization
+ // NOTE 1: Here, we act as if we multiply by 255 the reciprocal, which avoids additional
+ // calculations in the loop. This is acceptable because we are only interpolating colors.
+ // NOTE 2: This sum remains constant throughout the triangle
+ float wInvSum = 255.0f/(w1Row + w2Row + w3Row);
+
+ // Rasterization loop
+ // Iterate through each pixel in the bounding box
+ for (int y = yMin; y <= yMax; y++)
+ {
+ int w1 = w1Row;
+ int w2 = w2Row;
+ int w3 = w3Row;
+
+ for (int x = xMin; x <= xMax; x++)
+ {
+ // Check if the pixel is inside the triangle using barycentric coordinates
+ if ((w1 | w2 | w3) >= 0)
+ {
+ // Compute the normalized barycentric coordinates
+ unsigned char aW1 = (unsigned char)((float)w1*wInvSum);
+ unsigned char aW2 = (unsigned char)((float)w2*wInvSum);
+ unsigned char aW3 = (unsigned char)((float)w3*wInvSum);
+
+ // Interpolate the color using the barycentric coordinates
+ Color finalColor = { 0 };
+ finalColor.r = (c1.r*aW1 + c2.r*aW2 + c3.r*aW3)/255;
+ finalColor.g = (c1.g*aW1 + c2.g*aW2 + c3.g*aW3)/255;
+ finalColor.b = (c1.b*aW1 + c2.b*aW2 + c3.b*aW3)/255;
+ finalColor.a = (c1.a*aW1 + c2.a*aW2 + c3.a*aW3)/255;
+
+ // Draw the pixel with the interpolated color
+ ImageDrawPixel(dst, x, y, finalColor);
+ }
+
+ // Increment the barycentric coordinates for the next pixel
+ w1 += w1XStep;
+ w2 += w2XStep;
+ w3 += w3XStep;
+ }
+
+ // Move to the next row in the bounding box
+ w1Row += w1YStep;
+ w2Row += w2YStep;
+ w3Row += w3YStep;
+ }
+}
+
+// Draw triangle outline within an image
+void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color)
+{
+ ImageDrawLine(dst, v1.x, v1.y, v2.x, v2.y, color);
+ ImageDrawLine(dst, v2.x, v2.y, v3.x, v3.y, color);
+ ImageDrawLine(dst, v3.x, v3.y, v1.x, v1.y, color);
+}
+
+// Draw a triangle fan defined by points within an image (first vertex is the center)
+void ImageDrawTriangleFan(Image *dst, Vector2 *points, int pointCount, Color color)
+{
+ if (pointCount >= 3)
+ {
+ for (int i = 1; i < pointCount - 1; i++)
+ {
+ ImageDrawTriangle(dst, points[0], points[i], points[i + 1], color);
+ }
+ }
+}
+
+// Draw a triangle strip defined by points within an image
+void ImageDrawTriangleStrip(Image *dst, Vector2 *points, int pointCount, Color color)
+{
+ if (pointCount >= 3)
+ {
+ for (int i = 2; i < pointCount; i++)
+ {
+ if ((i%2) == 0) ImageDrawTriangle(dst, points[i], points[i - 2], points[i - 1], color);
+ else ImageDrawTriangle(dst, points[i], points[i - 1], points[i - 2], color);
+ }
+ }
+}
+
// Draw an image (source) within an image (destination)
// NOTE: Color tint is applied to source image
void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint)