raylib 6 bindings for c3
c3 raylib graphics bindings
0

Configure Feed

Select the types of activity you want to include in your feed.

first commit.

ellie nil (Jul 14, 2026, 4:47 AM EDT) c5c918de

+14626
+1
.gitignore
··· 1 + /build/
LICENSE

This is a binary file and will not be displayed.

+14
README.md
··· 1 + # Raylib6 bindings for C3 2 + 3 + I'm doing this as a little exercise in both learning to write bindings and learning raylib. These bindings aren't guaranteed to be perfect, but they work. 4 + 5 + ## Using the library 6 + 7 + To be honest, C3's build system fucking sucks. If you know how to do this that way, then you know. I don't lol. Here's how i'd do it: 8 + 9 + 1. Clone the repo to wherever you're putting your libraries. 10 + 2. Be sure you have the static raylib 6.0 library. 11 + 3. `import raylib6::rl` at the top of your program. 12 + 4. When compiling, be sure to include the `raylib.c3i` file in your lib dir, as well as to `-l /path/to/raylib.a` AND `-l X11`. for example: `$ c3c compile src/main.c3 lib/raylib.c3l/raylib.c3i -l ./lib/raylib/raylib.a -l X11 -o build/main`. 13 + 14 + ## I'm not very good at these things.
linked-libs/.gitkeep

This is a binary file and will not be displayed.

+3403
linked-libs/raylib-6.0_linux_amd64/CHANGELOG
··· 1 + changelog 2 + --------- 3 + 4 + Current Release: raylib 6.0 (23 April 2026) 5 + 6 + ------------------------------------------------------------------------- 7 + Release: raylib 6.0 (23 April 2026) 8 + ------------------------------------------------------------------------- 9 + KEY CHANGES: 10 + - New Software Renderer backend [rlsw] 11 + - New platform backend: Memory (memory buffer) 12 + - New platform backend: Win32 (experimental) 13 + - New platform backend: Emscripten (experimental) 14 + - Redesigned fullscreen modes and high-dpi content scaling 15 + - Redesigned Skeletal Animation System 16 + - Redesigned Build Config System [config.h] 17 + - New File System API 18 + - New Text Management API 19 + - New tool: [rexm] raylib examples manager 20 + - Added +70 new examples to learn from 21 + 22 + Detailed changes: 23 + 24 + [rcore] ADDED: `FileRename()`, by @raysan5 25 + [rcore] ADDED: `FileRemove()`, by @raysan5 26 + [rcore] ADDED: `FileCopy()`, by @raysan5 27 + [rcore] ADDED: `FileMove()`, by @raysan5 28 + [rcore] ADDED: `FileTextReplace()`, by @raysan5 29 + [rcore] ADDED: `FileTextFindIndex()`, by @raysan5 30 + [rcore] ADDED: `ComputeSHA256()` (#5264) by @iamahuman1395 31 + [rcore] ADDED: `GetKeyName()` (#4544) by @lecongsebastien 32 + [rcore] ADDED: Logging and file-system functionality from `utils` (#4551) by @raysan5 -WARNING- 33 + [rcore] ADDED: Flags set/clear macros: FLAG_SET, FLAG_CLEAR, FLAG_IS_SET (#5169) by @raysan5 34 + [rcore] ADDED: Warnings in case of no platform backend defined by @raysan5 35 + [rcore] REMOVED: GIF recording option, added example by @raysan5 -WARNING- 36 + [rcore] REMOVED: `CORE.Window.fullscreen` variable, using available flag instead by @raysan5 37 + [rcore] REMOVED: `SetupFramebuffer()`, most platforms do not need it any more by @raysan5 38 + [rcore] REMOVED: `TRACELOGD()` macro, hardly ever used by @raysan5 39 + [rcore] RENAMED: Shader location SHADER_LOC_VERTEX_INSTANCETRANSFORMS (#5592) by @CrackedPixel 40 + [rcore] REVIEWED: Gamepads database on latest `SDL2 2.32.8` and `SDL3 3.3.6` #5403 by @raysan5 41 + [rcore] REVIEWED: Alt-Tab not working in borderless fullscreen (#3865, #4655) by @veins1 42 + [rcore] REVIEWED: Automation system, saving to memory buffer and binary file (#5476) by @belan2470 43 + [rcore] REVIEWED: Check if `shader.locs` is not NULL before try to access (#5622) by @maiconpintoabreu 44 + [rcore] REVIEWED: Content scaling on macOS (#5186) by @mchcopl 45 + [rcore] REVIEWED: `GetRandomValue()`, fix modulo bias (#5392) by @Marcos-D -WARNING- 46 + [rcore] REVIEWED: Controller not available after window init (#5358) by @sergii 47 + [rcore] REVIEWED: Cursor lock/unlock inconsistent behaviour (#5323) by @tacf 48 + [rcore] REVIEWED: Description of `RestoreWindow()` by @johnnymarler 49 + [rcore] REVIEWED: Touch position register on automation event handling (#5470) by @belan2470 50 + [rcore] REVIEWED: FLAG_IS_SET to check if all bits in the flag are set in the value (#5441) by @vushu 51 + [rcore] REVIEWED: Fix for BI_ALPHABITFIELDS for clipbaord image narrow support (#5586) by @crisserpl2 52 + [rcore] REVIEWED: Flags checks, fixes #5597 by @raysan5 53 + [rcore] REVIEWED: Fullscreen request #5601 by @raysan5 54 + [rcore] REVIEWED: HighDPI content scaling on changing monitors with different DPI #5335 #5356 by @raysan5 55 + [rcore] REVIEWED: HighDPI content scaling on macOS by @raysan5 56 + [rcore] REVIEWED: Implement `FLAG_WINDOW_ALWAYS_RUN` on Android (#5414) by @caszuu 57 + [rcore] REVIEWED: Init main framebuffer using render size (should be same as currentFbo) by @raysan5 58 + [rcore] REVIEWED: Platform code formatting and organization by @raysan5 59 + [rcore] REVIEWED: Replace #pragma message with TRACELOG inside the clipboard image function (#5596) by @maiconpintoabreu 60 + [rcore] REVIEWED: Requested window flags application after window initialization by @raysan5 61 + [rcore] REVIEWED: Setting some flags disabled fullscreen (#4618, 4619) by @veins1 62 + [rcore] REVIEWED: Some flags for window/context creation attributes by @raysan5 63 + [rcore] REVIEWED: Support window flags with initialization issues (#4837) by @Andersama 64 + [rcore] REVIEWED: Swap `TraceLog()` to `TRACELOG` macro (#5226) by @iamahuman1395 65 + [rcore] REVIEWED: Swap local variable `isCursorHidden` to use new method `IsCursorHidden()` by @maiconpintoabreu 66 + [rcore] REVIEWED: Touch `pointCount` reduction (#4661) by @maiconpintoabreu 67 + [rcore] REVIEWED: Unscale the window size on resize if we are doing automatic HighDPI scaling by @Jeffm2501 68 + [rcore] REVIEWED: Use `FLAG_*` macros where possible (#5169) by @iamahuman1395 69 + [rcore] REVIEWED: Wayland checks, using compilation flags when possible #5564 by @raysan5 70 + [rcore] REVIEWED: `InitWindow()`, issues due to unchecked result of `InitPlatform()` (#4803) by @sleeptightAnsiC 71 + [rcore] REVIEWED: `InitWindow()`, fixed issue when using an empty window title (#5526) by @CrackedPixel 72 + [rcore] REVIEWED: `GetRenderWidth()`, and `GetRenderHeight()`, return the FBO size if one is active by @Jeffm2501 73 + [rcore] REVIEWED: `GetWindowPosition()`, return internal value by @raysan5 74 + [rcore] REVIEWED: `ToggleBorderlessFullscreen()`, not hiding taskbar (#5383) by @xenomustache 75 + [rcore] REVIEWED: `IsMouseButton*()`, random key codes return unexpected results (#5516) by @jasoncnm 76 + [rcore] REVIEWED: `IsGamepadButton*()`, for consistency with key and mouse equivalents by @raysan5 77 + [rcore] REVIEWED: `SetGamepadVibration()`, TRACELOG message (#4615) by @Asdqwe 78 + [rcore] REVIEWED: `MAX_GAMEPAD_AXES` for consistency #4960 by @raysan5 79 + [rcore] REVIEWED: `MAX_GAMEPAD_NAME_LENGTH` #4695 by @raysan5 80 + [rcore] REVIEWED: `LoadRandomSequence()`, using `GetRandomValue()` #5393 by @raysan5 81 + [rcore] REVIEWED: `LoadShaderFromMemory()`, use default locations for default shader #4641 by @raysan5 82 + [rcore] REVIEWED: `ComputeSHA1()`, computation on messages longer than 31 bytes (#5397) by @me 83 + [rcore] REVIEWED: `ComputeSHA256()` by @raysan5 84 + [rcore] REVIEWED: `DecodeDataBase64()`, decoding error when input string is invalid (#5170) by @zet23t 85 + [rcore] REVIEWED: `DecodeDataBase64()`, follow convention: by @raysan5 86 + [rcore] REVIEWED: `DecompressData()`, fixed buffer copying by @raysan5 87 + [rcore] REVIEWED: `GetClipboardImage()`, make symbol available on all platforms by @raysan5 88 + [rcore] REVIEWED: `GetRandomValue()`, explained the new approach to get more uniform random values range by @raysan5 89 + [rcore] REVIEWED: `FileExists()`, using macro by @raysan5 90 + [rcore] REVIEWED: `IsFileExtension()`, to avoid other modules dependency #5071 by @raysan5 91 + [rcore] REVIEWED: `LoadDirectoryFilesEx()`, count files if not recursive (#5496) by @katanya04 92 + [rcore] REVIEWED: `LoadDirectoryFilesEx()`, minor tweak #5569 by @raysan5 93 + [rcore] REVIEWED: `UnloadDirectoryFiles`, added NULL check by @Bigfoot71 94 + [rcore] REVIEWED: `ScanDirectoryFiles*()`, #4833 by @raysan5 95 + [rcore] REVIEWED: `ScanDirectoryFilesRecursively()`, fix issues by @mlorenc 96 + [rcore] REVIEWED: `ScanDirectoryFilesRecursively()`, makes `path` static by @Bigfoot71 97 + [rcore] REVIEWED: `SaveFileText()`, const input text by @raysan5 98 + [rcore] REVIEWED: `TakeScreenshot()`, avoid path filtering by @raysan5 99 + [rcore] REVIEWED: `TakeScreenshot()`, only scale the screenshot by the DPI scale if required by @Jeffm2501 100 + [rcore] REDESIGNED: Fullscreen modes, use current display resolution by @raysan5 -WARNING- 101 + [rcore] REDESIGNED: `EncodeDataBase64()`/`DecodeDataBase64()`, use NULL terminated strings by @raysan5 -WARNING- 102 + [rcore][GLFW] ADDED: Clipboard image support for linux (#5603) by @maiconpintoabreu 103 + [rcore][GLFW] REVIEWED: Fix `IsWindowFocused()` inverted logic (#5333) by @iamahuman1395 104 + [rcore][GLFW] REVIEWED: Fullscreen modes on Linux (X11 over XWayland) by @raysan5 105 + [rcore][GLFW] REVIEWED: Make sure that GLFW uses RL_*ALLOC macros (#4777) by @sleeptightAnsiC 106 + [rcore][GLFW] REVIEWED: Set correct default axes for gamepads that are not connected (#5444) by @LeapersEdge 107 + [rcore][GLFW] REVIEWED: Window initialization on HighDPI monitor (Windows) #5549 by @raysan5 108 + [rcore][GLFW] REVIEWED: Window scaling on Wayland with GLFW 3.4+ (#5564) by @0xPD33 109 + [rcore][GLFW] REVIEWED: Window scaling with HighDPI on macOS #5059 by @raysan5 110 + [rcore][GLFW] REVIEWED: `InitPlatform()`, crash caused by `glfwCreateWindow()` (#4804) by @sleeptightAnsiC 111 + [rcore][GLFW] REVIEWED: `InitPlatform()`, code simplification by @raysan5 112 + [rcore][GLFW] REVIEWED: `GetWindowHandle()`, return correct handle under Linux X11 by @Didas72 113 + [rcore][GLFW] REVIEWED: `WindowSizeCallback()` by @raysan5 114 + [rcore][GLFW] REVIEWED: `CORE.Window.eventWaiting` and `FLAG_WINDOW_ALWAYS_RUN` handling (#4642) by @Asdqwe 115 + [rcore][GLFW] REVIEWED: `GetGamepadButtonPressed()`, return GAMEPAD_BUTTON_*_TRIGGER_2 if pressed (#4742) by @whaleymar 116 + [rcore][GLFW] REVIEWED: Update `mappings.h` using `GenerateMappings.cmake` by @sleeptightAnsiC 117 + [rcore][RGFW] ADDED: New backend option: `PLATFORM_WEB_RGFW` and update RGFW (#4480) by @colleagueRiley 118 + [rcore][RGFW] ADDED: Support for software rendering (#5773) by @CrackedPixel 119 + [rcore][RGFW] REVIEWED: Added missing Right Control key by @M374LX 120 + [rcore][RGFW] REVIEWED: Changed `RGFW_window_eventWait` timeout to -1 by @doggymangc 121 + [rcore][RGFW] REVIEWED: Duplicate entries removed from `keyMappingRGFW` (#5242) by @iamahuman1395 122 + [rcore][RGFW] REVIEWED: Fix Escape always closing the window by @M374LX 123 + [rcore][RGFW] REVIEWED: Forward declare the windows stuff, prevents failures in GCC (#5269) by @Jeffm2501 124 + [rcore][RGFW] REVIEWED: Requires RGBA8 images as window icons (#5431) by @crisserpl2 125 + [rcore][RGFW] REVIEWED: Window width calculation by adding wOffset (#5457) by @qubitxr 126 + [rcore][RGFW] REVIEWED: `SetGamepadVibration()` implementation (#4612) by @JupiterRider 127 + [rcore][SDL] REVIEWED: `FLAG_WINDOW_ALWAYS_RUN` implementation (#4598) by @Asdqwe 128 + [rcore][SDL] REVIEWED: First touch position is overwritten with mouse position by @zet23t 129 + [rcore][SDL] REVIEWED: Avoid `rtext` module dependency #4959 by @raysan5 130 + [rcore][SDL] REVIEWED: Fix crash when `strncpy()` tries to copy using NULL pointer (#5359) by @MikiZX1 131 + [rcore][SDL] REVIEWED: Fix gamepad detection (#5176) by @brccabral 132 + [rcore][SDL] REVIEWED: Fix maximizing, minimizing and restoring windows for SDL2 (#4607) by @Asdqwe 133 + [rcore][SDL] REVIEWED: Fix show, hide, focus and unfocus window/flags states for SDL2 (#4610) by @Asdqwe 134 + [rcore][SDL] REVIEWED: Fix text input (characters) (#5574) by @TheKodeToad 135 + [rcore][SDL] REVIEWED: Gamepad event handling by adding joystick instance id tracking (#4724) by @Asdqwe 136 + [rcore][SDL] REVIEWED: RGB order on SDL3 #3568 by @raysan5 137 + [rcore][SDL] REVIEWED: `SetGamepadMappings()` (#5548) by @arleyuti 138 + [rcore][SDL] REVIEWED: Handle monitor ID correctly on SDL3 (#5290) by @sleeptightAnsiC 139 + [rcore][Web] ADDED: Clipboard image implementation for web (#5614) by @maiconpintoabreu 140 + [rcore][Web] ADDED: `GetWindowScaleDPI()`, implementation for PLATFORM_WEB (#4526) by @Asdqwe 141 + [rcore][Web] ADDED: `IsWindowHidden()` (#4789) by @marionauta 142 + [rcore][Web] REVIEWED: Fix reversed window blur/focus logic for web (#5590) by @aceiii 143 + [rcore][Web] REVIEWED: Fix undeclared canvas variable error (#5507) by @vdemcak 144 + [rcore][Web] REVIEWED: Replaced hardcoded canvas id references with module variable (#4735) by @zet23t 145 + [rcore][Web] REVIEWED: Store canvas name id at platform initialization by @raysan5 146 + [rcore][Web] REVIEWED: Support software renderer on Web, blitting framebuffer data directly to a 2d canvas by @raysan5 147 + [rcore][Web] REVIEWED: Using `Module` provided canvas id for event binding (#4690) by @zet23t 148 + [rcore][Web] REVIEWED: Using `EmscriptenKeyboardCallback()` to consume key events by @moros1138 149 + [rcore][Web] REVIEWED: `IsWindowFocused()` (#4640) by @marionauta 150 + [rcore][Web] REVIEWED: `GetApplicationDirectory()` for Wasm, returning root VFS (#5495) by @git 151 + [rcore][Win32] ADDED: `rcore_desktop_win32`, new native Win32 platform backend (#4869) by @johnnymarler 152 + [rcore][Win32] REDESIGNED: New native Win32 platform backend, simplification and formating by @raysan5 153 + [rcore][Win32] REVIEWED: New Win32 platform backend to accomodate `rlsw` Software Renderer by @raysan5 154 + [rcore][Win32] REVIEWED: Fix window width calculation by adding wOffset (#5480) by @crisserpl2 155 + [rcore][Win32] REVIEWED: Implemented `SetWindowMaxSize()`, `SetWindowMinSize()` and `SetWindowSize()` (#5536) by @mikeemm 156 + [rcore][Win32] REVIEWED: Remove `-fno-stack-protector` and add `requestFullscreen` on exported methods by @emilhakimov415 157 + [rcore][Win32] REVIEWED: VSync flag not being applied (#5521) by @mikeemm 158 + [rcore][Win32] REVIEWED: Window minimizing/maximizing functionality (#5524) by @mikeemm 159 + [rcore][Android] REVIEWED: Content scaling functionality for HighDPI (#4769) by @Bigfoot71 160 + [rcore][Android] REVIEWED: `SetWindowState()` (#5424) by @caszuu 161 + [rcore][Android] REVIEWED: `GetCurrentMonitor()` implementation (#5204) by @guntzjonas 162 + [rcore][Android] REVIEWED: `android_fopen()` mechanims, after removing `utils` module dependency by @raysan5 163 + [rcore][Android] REVIEWED: `fopen()` wrapping mechanism, to use --wrap=fopen on build systems (#5624) by @ghera 164 + [rcore][Android] REVIEWED: `LoadMusicStream()` due to missing fopen redirect (#5589) by @ghera 165 + [rcore][Android] REVIEWED: Fallback on dirent filename when all route fails (#5484) by @lucas150670 166 + [rcore][Android] REVIEWED: Gesture system not reporting GESTURE_NONE (#5452) by @padmadevd 167 + [rcore][Android] REVIEWED: Keyboard input detected as gamepad on some devices (#5439) by @decruz 168 + [rcore][Android] REVIEWED: Replaced `android_fopen()` with linker `--wrap=fopen` (#5605) by @ghera 169 + [rcore][DRM] ADDED: Support asynchronous page-flipping and framebuffer caching by @rob-bits -WARNING- 170 + [rcore][DRM] REVIEWED: Compiler flag SUPPORT_DRM_CACHE, to enable triple buffered DRM caching by @rob-bits 171 + [rcore][DRM] REVIEWED: Backspace key in RPI SSH keyboard by @matthijs 172 + [rcore][DRM] REVIEWED: Check if video mode is valid and rename to match with other methods (#5235) by @maiconpintoabreu 173 + [rcore][DRM] REVIEWED: Disable touch position simulation from mouse movement for touchscreen devices (#5279) by @MULTidll 174 + [rcore][DRM] REVIEWED: Fix resources memory leak (#5494) by @matthewkennedy 175 + [rcore][DRM] REVIEWED: Platform initialization messages by @raysan5 176 + [rcore][DRM] REVIEWED: Use `eglGetPlatformDisplayEXT()` for Mali compatibility (#5446) by @decruz 177 + [rcore][DRM] REVIEWED: `FindNearestConnectorMode()`, prefer mode with smallest number of unused pixels (#5158) by @maiphi 178 + [rcore][DRM] REVIEWED: `eglGetPlatformDisplay()` usage by @raysan5 179 + [rcore][DRM] REVIEWED: Improved touch input handling and multitouch support (#5447) by @MULTidll 180 + [rcore][DRM] REVIEWED: DRM cache buffers support #4988 by @raysan5 181 + [rlgl] ADDED: Software Rendering Support (#4832) by @Bigfoot71 182 + [rlgl] ADDED: `rlGetProcAddress()` (#5062) by @danilwhale 183 + [rlgl] ADDED: `rlUnloadShader()` (#5631) by @raysan5 184 + [rlgl] REMOVED: `RLGL_RENDER_TEXTURES_HINT`, enabled by default and no complaints of anyone having issues #5479 by @raysan5 185 + [rlgl] REVIEWED: Allow tint colors in GL_LINE (wires) and GL_POINT (points) draw modes on OpenGL 1.1 clean (#5207) by @lanur622 186 + [rlgl] REVIEWED: Attribute name and location, for consistency by @raysan5 187 + [rlgl] REVIEWED: Behavior for texture in OpenGL 1.1 draw states (#5328) by @lanur622 188 + [rlgl] REVIEWED: Better default values for normals and tangents (VBOs) (#4763) by @Bigfoot71 189 + [rlgl] REVIEWED: Clean up Matrix handling and rl* functions to follow convention (#5505) by @nathanmburg 190 + [rlgl] REVIEWED: Delete shader object in case compilation fails by @raysan5 191 + [rlgl] REVIEWED: Fixed shader tangents to be vec4 by @Sir-Irk 192 + [rlgl] REVIEWED: Increased depth size and clip distances to avoid z-fighting issues by @raysan5 193 + [rlgl] REVIEWED: Issues compiling for OpenGL 1.1 #5088 by @raysan5 194 + [rlgl] REVIEWED: Make sure ShaderUniformDataType matches rlShaderUniformDataType (#4577) by @RicoP 195 + [rlgl] REVIEWED: Potential issue with animated normals on OpenGL 1.1 by @raysan5 196 + [rlgl] REVIEWED: Using define for buffers size by @raysan5 197 + [rlgl] REVIEWED: Warning log macro (#5043) by @vinnyhorgan 198 + [rlgl] REVIEWED: Preserve texture on mode switching (#4364) by @Destructor17 199 + [rlgl] REVIEWED: Proposed fix for default near/far clipping range (#4906) by @Bigfoot71 200 + [rlgl] REVIEWED: `rlLoadTexture()`, max mipmap levels to use #5400 by @raysan5 201 + [rlgl] REVIEWED: `rlLoadTexture()`, uncomplete texture do to issue on mipmap loading #5416 by @raysan5 202 + [rlgl] REVIEWED: `rlLoadTextureDepth()`, address inconsistencies with WebGL 2.0 for sized depth formats #5500 by @raysan5 203 + [rlgl] REVIEWED: `rlReadScreenPixels()`, optimizations (#4667) by @pope 204 + [rlgl] REVIEWED: `rlSetTexture()` not overriding default mode (#5200) by @maiconpintoabreu 205 + [rlgl] REVIEWED: `rlActiveDrawBuffers`, fix for OpenGL ES 3.0 (#4605) by @Bigfoot71 206 + [rlgl] REVIEWED: `rlGetPixelDataSize()`, correct compressed data size calculation per blocks #5416 by @raysan5 207 + [rlgl] REVIEWED: `instranceTransform` shader location index #4538 (#4579) by @meadiode 208 + [rlgl] REVIEWED: `SetShaderValueTexture()`, update comments (#4703) by @pejorativefox 209 + [rlgl] REDESIGNED: Avoid program crash if GPU data is tried to be loaded before `InitWindow()` #4751 by @raysan5 -WARNING- 210 + [rlgl] REDESIGNED: Shader loading API function names for more consistency #5631 by @raysan5 -WARNING- 211 + [rlsw] ADDED: `swGetColorBuffer()` for convenience by @raysan5 212 + [rlsw] REVIEWED: Completeness of `glDraw*()` functions (#5304) by @Bigfoot71 213 + [rlsw] REVIEWED: Fix axis aligned quad detection (#5314) by @Bigfoot71 214 + [rlsw] REVIEWED: Fix clipping issue on software render (#5342) by @Bigfoot71 215 + [rlsw] REVIEWED: Make sure SSE is being used when compiling with MSVC by @raysan5 216 + [rlsw] REVIEWED: SIMD instrinsics must be explicitly enabled by developer, only SSE supported at the moment #5316 by @raysan5 217 + [rlsw] REVIEWED: Segmentation fault when trying to render a model (#5622) by @maiconpintoabreu 218 + [rlsw] REVIEWED: Simplify framebuffer logic and add blit/copy fast path (#5312) by @Bigfoot71 219 + [rlsw] REVIEWED: Review depth formats and fix depth writing (#5317) by @Bigfoot71 220 + [rlsw] REVIEWED: Smarter texture management (#5296) by @Bigfoot71 221 + [rlsw] REVIEWED: Subpixel correction (#5300) by @Bigfoot71 222 + [rlsw] REVIEWED: C++ support (#5291) by @alexgb0 223 + [rshapes] ADDED: `DrawLineDashed()` (#5222) by @luis605 224 + [rshapes] ADDED: `DrawEllipseV()` and `DrawEllipseLinesV()` (#4963) by @meowstr 225 + [rshapes] REDESIGNED: `DrawCircleGradient()` to use Vector2 as center parameter by @raysan5 -WARNING- 226 + [rshapes] REVIEWED: `DrawLine()`, fix pixel offset issue on drawing (#4666) by @Bigfoot71 227 + [rshapes] REVIEWED: `DrawRectangleGradientEx()`, incorrect parameter names (#4980) by @vincent 228 + [rshapes] REVIEWED: `DrawRectangleLines`, fix pixel offset issue (#4669) by @Bigfoot71 229 + [rshapes] REVIEWED: `DrawRectangleRounded()`, allow to draw rectangles with a size < 1 (#4683) by @tea 230 + [rshapes] REVIEWED: `CheckCollisionLines()`, formating and follow raylib conventions by @raysan5 231 + [rshapes] REVIEWED: `DrawCircleSector*()`, optimization to prevent division by zero (#4843) by @theundergroundsorcerer 232 + [rshapes] REVIEWED: `CheckCollisionLines()`, properly detect collision if one line is almost vertical (#5510, #5531) by @bielern 233 + [rtextures] REVIEWED: Cubemap mipmap loading improvements (#4721) by @Not-Nik 234 + [rtextures] REVIEWED: Setting mipmaps MAX_LEVEL based on actual mipcount input (#4622) by @JettMonstersGoBoom 235 + [rtextures] REVIEWED: TCC compilation due to `emmintrin.h` not found (#4707) by @sleeptightAnsiC 236 + [rtextures] REVIEWED: `Image`, initialization align to avoid issues with some platforms (#5214) by @psxdev 237 + [rtextures] REVIEWED: `LoadImageDataNormalized()`, missing increments of k (#4745) by @henrikglass 238 + [rtextures] REVIEWED: `LoadImageFromScreen()`, use the render size instead of screen size (#5192) by @JeffM2501 239 + [rtextures] REVIEWED: `GenImageFontAtlas()`, fix memory corruption in reallocation (#5602) by @creeperblin 240 + [rtextures] REVIEWED: `GenImageFontAtlas()`, no need for the conservative approach flag by @raysan5 241 + [rtextures] REVIEWED: `GenImageFontAtlas()`, scale image to fit all characters, in case it fails size estimation #5542 by @raysan5 242 + [rtextures] REVIEWED: `GetImageColor()` (#5560) by @raysan5 243 + [rtextures] REVIEWED: `ExportImage()` by @raysan5 244 + [rtextures] REVIEWED: `HalfToFloat()` and `FloatToHalf()` dereferencing issues with an union (#4729) by @Asdqwe 245 + [rtextures] REVIEWED: `ImageClearBackground()` and `ImageDrawRectangleRec()` optimizations (#5363) by @ChocolateChipKookie 246 + [rtextures] REVIEWED: `ImageColorReplace()`, alpha issue replacement (#5047) by @RomainPlmg 247 + [rtextures] REVIEWED: `ImageDrawLineEx(), to be able to draw even numbered thicknesses (#5042) by @Sir-Irk 248 + [rtextures] REVIEWED: `ImageBlurGaussian()`, fix integer overflow in cast (#5037) by @garrisonhh 249 + [rtext] ADDED: `LoadTextLines()`/`UnloadTextLines()` by @raysan5 250 + [rtext] ADDED: `TextInsertAlloc()`, returns memory allocated string by @raysan5 251 + [rtext] ADDED: `TextReplace()`, using static buffer by @raysan5 252 + [rtext] ADDED: `TextReplaceAlloc()`, returns memory allocated string by @raysan5 253 + [rtext] ADDED: `TextReplaceBetween()`, using static buffer by @raysan5 254 + [rtext] ADDED: `TextReplaceBetweenAlloc()`, returns memory allocated string by @raysan5 255 + [rtext] ADDED: `GetTextBetween()`, using static buffer by @raysan5 256 + [rtext] ADDED: `TextRemoveSpaces()`, using static buffer by @raysan5 257 + [rtext] ADDED: `MeasureTextCodepoints()` for direct measurement of codepoints (#5623) by @creeperblin 258 + [rtext] RENAMED: Variable names for consistency, `textLength` (length in bytes) vs `textSize` (measure in pixels) by @raysan5 259 + [rtext] REVIEWED: Support default font loading with no GPU enabled, to be used with Image API 260 + [rtext] REVIEWED: Default font alpha on Big Endian systems (#4624) by @Fancy2209 261 + [rtext] REVIEWED: Font atlas image generation, added some comments #5141 by @raysan5 262 + [rtext] REVIEWED: Multiply security checks to avoid crashes on wrongly provided string data (#4751) by @raysan5 263 + [rtext] REVIEWED: Potential security concerns while copying unbounded text data between strings by @raysan5 264 + [rtext] REVIEWED: Properly clean up the default font on unload, it may be reused if the window is created again by @Jeffm2501 265 + [rtext] REVIEWED: Remove some `const` from text buffer return values by @raysan5 266 + [rtext] REVIEWED: Some security vulnerabilities in font loading (#5433, #5434, #5436, #5450) by @oneafter 267 + [rtext] REVIEWED: Use `const` for codepoints arrays passed to function #5159 by @raysan5 268 + [rtext] REVIEWED: Use `strstr()` instead of `TextFindIndex()` (#4764) by @brabissimoooooo 269 + [rtext] REVIEWED: `LoadFont()`, improve load message (#5050) by @katanya04 270 + [rtext] REVIEWED: `LoadFont*()`, provide more detailed info on glyphs failing to pack (#5141) by @raysan5 271 + [rtext] REVIEWED: `LoadCodepoints()`, local variable shadowing `codepoints` (#5430) by @KiviTK 272 + [rtext] REVIEWED: `LoadCodepoints()`, comment explaining functionality (#4787) by @loftafi 273 + [rtext] REVIEWED: `LoadFontFromImage()`, limit pixel scanning to image dimensions (#5626) by @joe 274 + [rtext] REVIEWED: `LoadFontDataBDF()` #5346 by @raysan5 275 + [rtext] REVIEWED: `LoadTextLines()` by @raysan5 276 + [rtext] REVIEWED: `ExportFontAsCode()` #5497 by @raysan5 277 + [rtext] REVIEWED: `ExportFontAsCode()` not checking `isGpuReady` #4894 by @raysan5 278 + [rtext] REVIEWED: `GetCodepointCount()`, misuse of cast (#4741) by @sleeptightAnsiC 279 + [rtext] REVIEWED: `GenImageFontAtlas()`, memory corruption and invalid size calculation (#5602) by @konakona418 280 + [rtext] REVIEWED: `TextInsert()`, fix bug on insertion (#5644) by @CrackedPixel 281 + [rtext] REVIEWED: `TextInsert()`, use static buffer, easier to use by @raysan5 -WARNING- 282 + [rtext] REVIEWED: `TextJoin()`, convert `const char **` to `char**` by @raysan5 283 + [rtext] REVIEWED: `TextReplace()`, improvements (#5511) by @belan2470 284 + [rtext] REVIEWED: `TextReplace()` and `TextLength()`, avoid using `strcpy()` by @raysan5 285 + [rtext] REVIEWED: `TextSubtext(), fixes (#4759) by @veins1 286 + [rtext] REVIEWED: `TextToPascal()`, fix issue by @raysan5 287 + [rtext] REVIEWED: `TextToFloat()`, remove removed inaccurate comment (#4596) by @hexmaster111 288 + [rtext] REDESIGNED: `LoadFontData()`, added input parameter by @raysan5 -WARNING- 289 + [rmodels] ADDED: Support CPU animation in OpenGL 1.1 (#4925) by @JeffM2501 290 + [rmodels] REMOVED: `DrawModelPoints()` and `DrawModelPointsEx()`, moved to an example (#5697) by @maiconpintoabreu -WARNING- 291 + [rmodels] RENAMED: Skinning shader variables (new default naming) by @raysan5 292 + [rmodels] REVIEWED: glTF animation framerate calculation (#4472, #5445) by @TheLazyIndianTechie 293 + [rmodels] REVIEWED: Assign meshes without bone weights to the bone they are attached to so they animate by @Jeffm2501 294 + [rmodels] REVIEWED: Out of bound memory read in `Material.maps` (#5534) by @Sumethh 295 + [rmodels] REVIEWED: Segfaults with animation system (#4635) by @JettMonstersGoBoom 296 + [rmodels] REVIEWED: Transform the vertex normals by the animated matrix (#4646) by @Jeffm2501 297 + [rmodels] REVIEWED: Use the animated verts and normals in OpenGL 1.1 if they exist by @Jeffm2501 298 + [rmodels] REVIEWED: GLTF bone weight assignments for meshes parented to armature (#4923) by @JeffM2501 299 + [rmodels] REVIEWED: `LoadOBJ()`, avoid fatal errors on OBJ model loading by @raysan5 300 + [rmodels] REVIEWED: `LoadOBJ()`, don't upload meshes, `LoadModel()` will upload them (#5083) by @JeffM2501 301 + [rmodels] REVIEWED: `LoadOBJ()`, loading crash when there are no normals present (#5079) by @zet23t 302 + [rmodels] REVIEWED: `LoadGLFT()`, avoid loading attributes already loaded (#4996) by @raysan5 303 + [rmodels] REVIEWED: `LoadGLTF()`, anim correctly inherits world transform (#5206) by @ArmanOmmid 304 + [rmodels] REVIEWED: `LoadGLTF()`, fix memory leak when model has no bones (#5629) by @vberdugo 305 + [rmodels] REVIEWED: `LoadGLTF()`, fixing offset for processing tangents (#5015) by @Sir-Irk 306 + [rmodels] REVIEWED: `LoadGLTF()`, log warning about draco compression not supported #5567 by @raysan5 307 + [rmodels] REVIEWED: `LoadGLTF()`, separate roughness and metallic channels on load (#4739) by @Not-Nik 308 + [rmodels] REVIEWED: `LoadGLTF()`, support 16 bit vec3 values (#5388) by @Jeffm2501 309 + [rmodels] REVIEWED: `LoadGLTF()`, fixed NULL pointer dereference (#4564) by @CalebHeydon 310 + [rmodels] REVIEWED: `LoadIQM()` and `LoadModelAnimationsIQM()`, fix memory leaks (#4649) by @peter15914 311 + [rmodels] REVIEWED: `LoadM3D()`, don't require a M3d animation only file to have a mesh (#5475) by @Jeffm2501 312 + [rmodels] REVIEWED: `LoadImageFromCgltfImage()`, fix crash when NULL is passed (#4563) by @CalebHeydon 313 + [rmodels] REVIEWED: `LoadImageFromCgltfImage()`, fix NULL pointer dereference (#4557) by @CalebHeydon 314 + [rmodels] REVIEWED: `LoadModelAnimationsGLTF()`, properly load 1 frame animations (#5561) by @arlez80 315 + [rmodels] REVIEWED: `LoadModelAnimationsGLTF()`, anim correctly inherits world transform (#5206) by @ArmanOmmid 316 + [rmodels] REVIEWED: `UploadMesh()`, improve default normal and tangent values (#4763) by @Bigfoot71 317 + [rmodels] REVIEWED: `UplaodMesh()`, fix for devices without VAO support (#5692) by @psxdev 318 + [rmodels] REVIEWED: `GenMeshTangents()`, improvements (#4937) by @Bigfoot71 319 + [rmodels] REVIEWED: `UpdateModelAnimation()` optimization (#5244) by @Arrangemonk 320 + [rmodels] REVIEWED: `UpdateModelAnimationBones()`, break on first mesh found and formating by @raysan5 321 + [rmodels] REVIEWED: `UpdateModelAnimationBones()`, fix normal transform (#4634) by @Bigfoot71 322 + [rmodels] REVIEWED: `UpdateModelAnimationBones()`, optimizations (#4602) by @Kirandeep-Singh-Khehra 323 + [rmodels] REVIEWED: `UpdateModelAnimationBones()`, bones animation scale (#4896) by @mUnicorn 324 + [rmodels] REVIEWED: `DrawBillboardPro()`, flipped texture source rectangle draw correctly (#5276) by @aixiansheng 325 + [rmodels] REVIEWED: `DrawMesh()`, OpenGL11 fixes added texture consistency check (#5328) by @meisei4 326 + [rmodels] REVIEWED: `DrawMeshInstanced()`, breaking if instanceTransform was unused (#5469) by @al13n321 327 + [rmodels] REVIEWED: `DrawSphereEx()`, normals support (#4926) by @karl-zylinski 328 + [rmodels] REVIEWED: `ExportMesh()`, improve OBJ vertex data precision and lower memory usage (#4496) by @mikeemm 329 + [rmodels] REVIEWED: `CheckCollisionSpheres()`, simplified using `Vector3DistanceSqr()` (#5695) by @Bigfoot71 330 + [rmodels] REVIEWED: `CheckCollisionBoxSphere()`, improved performance and consistency (#5776) by @maiconpintoabreu 331 + [raudio] REVIEWED: Fix a glitch at the end of a sound (#5578) by @mackron 332 + [raudio] REVIEWED: Improvements to device configuration (#5577) by @mackron 333 + [raudio] REVIEWED: Initialize sound alias properties as if it was a new sound (#5123) by @JeffM2501 334 + [raudio] REVIEWED: Music stopping some frames too early by @veins1 335 + [raudio] REVIEWED: Remove usage of `ma_data_converter_get_required_input_frame_count()` (#5568) by @mackron 336 + [raudio] REVIEWED: Better computation of the default audio stream buffer size (#4898) by @JeffM2501 337 + [raudio] REVIEWED: Documentation for audio stream processor, number of channels (#4753) by @goto40 338 + [raudio] REVIEWED: `LoadWAV()`, fixed buffer overflow when loading WAV files (#4539) by @CalebHeydon 339 + [raudio] REVIEWED: `LoadMusicStream()`, issues in Android due to missing fopen redirect (#5589) by @ghera 340 + [raudio] REVIEWED: `LoadMusicStreamFromMemory()` for QOA, reduced the number of allocs and memcpy (#5108) by @lassade 341 + [raudio] REVIEWED: `UnloadMusicStream()`, properly close FLAC (#5133) by @rossberg 342 + [raudio] REVIEWED: `UpdateMusicStream()`, prevent to run without music playing (#5046) by @maiconpintoabreu 343 + [raudio] REVIEWED: `WaveFormat()`, fixed memory leak on early-return (#4779) by @deckarep 344 + [raudio] REVIEWED: `WaveFormat()`, freeing memory issue (#5481) by @MarcosTypeAP 345 + [raudio] REVIEWED: `GetMusicTimePlayed()`, fix music shorter than buffer size (#5048) by @veins1 346 + [raudio] REVIEWED: `GetMusicTimePlayed()`, returns incorrect time after restart (#4914) by @Servall4 347 + [raudio] REDESIGNED: `SetSoundPan()` and `SetMusicPan()` ranges from [-1.0..1.0] (#5350) by @raysan5 -WARNING- 348 + [raymath] ADDED: `MatrixUnit()` and `MatrixMultiplyValue()` (#5613) by @lamweilun 349 + [raymath] ADDED: `MatrixCompose()` (#5324) by @EDBCREPO 350 + [raymath] ADDED: `Vector2CrossProduct()` (#4520) by @uwiwiow 351 + [raymath] REVIEWED: Fix C++ operator overloads (#4535) by @ListeriaM 352 + [raymath] REVIEWED: Vector2Angle(), detailed documentation (#4556) by @mrjonjonjon 353 + [raymath] REVIEWED: Wrap float3 and float16 for consistency with other types (#5540) by @n-s-kiselev 354 + [raymath] REVIEWED: `HalfToFloat()`, fix mantissa hex value by @backspaceoverload 355 + [raymath] REVIEWED: `MatrixCompose()` by @raysan5 356 + [raymath] REVIEWED: `MatrixDeterminant()` #4780 by @raysan5 357 + [raymath] REVIEWED: `MatrixDecompose()` removes shear (#5201) by @ArmanOmmid 358 + [raymath] REVIEWED: `MatrixMultiply()` intrinsics support: SSE (#5427) by @mcdubhghlas 359 + [raymath] REVIEWED: `QuaternionFromVector3ToVector3()` (#5508) by @The4codeblocks 360 + [rcamera] REVIEWED: `Camera3D.fovy` description (#5164) by @0stamina 361 + [rcamera] REVIEWED: Camera move up and right work with Z up cameras (#5458) by @Jeffm2501 362 + [rcamera] REVIEWED: Camera pan speed (#5554) by @CrackedPixel 363 + [rcamera] REVIEWED: Fix camera initial position (#4657) by @Asdqwe 364 + [rcamera] REVIEWED: Clamp camera pitch (#5137) by @feive7 365 + 366 + [build][CI] ADDED: ARM64 with Visual Studio (#4781) by @Peter0x44 367 + [build][CI] ADDED: `update_examples.yml` by @raysan5 368 + [build][CI] RENAMED: GitHub Actions files, clearer naming by @raysan5 369 + [build][CI] REVIEWED: Linux workflow to run on `ubuntu-latest` by @raysan5 370 + [build][CI] REVIEWED: Remove double zip and misleading zip type (#5512) by @maiconpintoabreu 371 + [build][CI] REVIEWED: `update_examples.yml` workflow (#5130) by @iamahuman1395 372 + [build][Script] REVIEWED: `build_example_web.bat` by @raysan5 373 + [build][Make] ADDED: ARM64 support to Linux builds by @quaylynrimer11 374 + [build][Make] REVIEWED: Use `libraylib.web.a` naming on PLATFORM_WEB by @raysan5 -WARNING- 375 + [build][Make] REVIEWED: Only include rglfw.c for glfw platform by @johnnymarler 376 + [build][Make] REVIEWED: Fix template to support `libraylib.web.a` (#5620) by @skazu0611 377 + [build][Make] REVIEWED: Avoid using != assignment (#5464) by @sleeptightAnsiC 378 + [build][Make] REVIEWED: Improve support for `PLATFORM_DESKTOP_WIN32` (#5311) by @GithubPrankster 379 + [build][Make] REVIEWED: Latest NDK version compiling errors on Android (#5389) by @Sethbones 380 + [build][Make] REVIEWED: Makefile to support software renderer by @raysan5 381 + [build][Make] REVIEWED: Properly detect if ABI is Android by @lumenkeyes 382 + [build][Make] REVIEWED: Remove path override/change for linux (#5641) by @CrackedPixel 383 + [build][Make] REVIEWED: Renamed `PLATFORM_DESKTOP_SDL3` to `USING_VERSION_SDL3` #5175 by @raysan5 384 + [build][Make] REVIEWED: Tag to locate examples list: `#EXAMPLES_LIST_*` by @raysan5 385 + [build][Make] REVIEWED: Undefine _GNU_SOURCE for rglfw building (#4732) by @Peter0x44 386 + [build][Make] REVIEWED: `-sASSERTIONS` usage by linker #4717 by @raysan5 387 + [build][Make] REVIEWED: `Makefile.Web` per-example target generation including used resources by @raysan5 388 + [build][Make] REVIEWED: android-libc.txt generation by @lumenkeyes 389 + [build][Make] REVIEWED: examples Makefile PLATFORM define (#4582) by @Asdqwe 390 + [build][VS2022] ADDED: Filters and platform files in MSVC for ease of editing (#4644) by @Jeffm2501 391 + [build][VS2022] REVIEWED: Default raylib resource file .rc for projects by @raysan5 392 + [build][VS2022] REVIEWED: Fix MSVC warnings (#5619) by @Jeffm2501 393 + [build][VS2022] REVIEWED: MSVC warnings (#5595) by @Jeffm2501 394 + [build][VS2022] REVIEWED: Fixed VS2022 broken build by @alexander_nichols 395 + [build][VSCode] REVIEWED: Makefile for `PLATFORM_WEB` (#5620) by @takenoko-pm 396 + [build][CMake] ADDED: Support for SDL3, reviewed SDL2 package cheking by @kariem2k 397 + [build][CMake] ADDED: emscripten build options (#5180) by @brccabral 398 + [build][CMake] ADDED: QNX EGL 2.0 library configuration (#5499) by @jscaffidi 399 + [build][CMake] REVIEWED: Android configuration issues (#4671) by @Bigfoot71 400 + [build][CMake] REVIEWED: Definition to use SDL3 (#5175) by @brccabral 401 + [build][CMake] REVIEWED: X11 libraries as glfw make private (#5625) by @maiconpintoabreu 402 + [build][CMake] REVIEWED: Don't build examples using audio if audio is disabled (#4652) by @Peter0x44 403 + [build][CMake] REVIEWED: Export automatically raylib definitions and compile/link options (#5179) by @brccabral 404 + [build][CMake] REVIEWED: Expose RGFW platform backend (#5386) by @Sethbones 405 + [build][CMake] REVIEWED: Set PLATFORM to Web by default when configuring web builds with emcmake (#4748) by @gilzoide 406 + [build][CMake] REVIEWED: Set correct description for verbose option by @brccabral 407 + [build][CMake] REVIEWED: Set version to 3.12 (#4547) by @zyperpl 408 + [build][CMake] REVIEWED: Update `LibraryConfigurations.cmake (#5617) by @m0391n 409 + [build][CMake] REVIEWED: Use STATIC lib ON by default (#4799) by @brccabral 410 + [build][CMake] REVIEWED: Using addCMacro instead of defineCMacro (#4620) by @Joonsey 411 + [build][CMake] REVIEWED: Web compilation system (#5181) by @brccabral 412 + [build][CMake] REVIEWED: Set `libm` as public so it can be linked by consumer (#5193) by @brccabral 413 + [build][Cmake] REVIEWED: Expose PLATFORM_WEB_RGFW (#5579) by @crisserpl2 414 + [build][Zig] ADDED: Android target to build by @lumenkeyes 415 + [build][Zig] REDESIGNED: Complete refactor of build.zig to support Zig 0.16.0 (#5764) by @HaxSam 416 + [build][Zig] REVIEWED: Link EGL for Android by @lumenkeyes 417 + [build][Zig] REVIEWED: Approach to build for web with zig-build (#5157) by @haxsam 418 + [build][Zig] REVIEWED: Fix build accessing env vars (#5490) by @iisakki 419 + [build][Zig] REVIEWED: Fix emscripten building by @johnnymarler 420 + [build][Zig] REVIEWED: Move examples/build.zig into main build.zig by @johnnymarler 421 + [build][Zig] REVIEWED: Fix raygui inclusion in windows crosscompilation (#4489) by @kimierik 422 + [build][Zig] REVIEWED: Issue on emscripten run if the user has not installed emsdk by @emilhakimov415 423 + [build][Zig] REVIEWED: Make X11 the default display backend instead of choosing at runtime (#5168) by @Not-Nik 424 + [build][Zig] REVIEWED: Using `addLibrary()` and set root modules manually by @myQwil 425 + [build][Zig] REVIEWED: `build.zig.zon`, use the new zig v0.14 version (#4819) by @zewenn 426 + [build][Zig] REVIEWED: `build.zig.zon`, update hashes (#4826) by @david 427 + [build][Zig] REVIEWED: Improve build system (#4531) by @haxsam 428 + [build][Zig] REVIEWED: Properly generate Android triple by @lumenkeyes 429 + [build][Zig] REVIEWED: XCode-frameworks dependency for latest zig (#4675) by @mobiuscog 430 + 431 + [examples] ADDED: Missing examples VS2022 projects by @raysan5 432 + [examples] ADDED: Missing glsl120 shaders by @raysan5 433 + [examples] ADDED: Missing resources on some examples by @raysan5 434 + [examples] ADDED: `core_3d_fps_controller` by @agnis16 435 + [examples] ADDED: `core_clipboard_text` (#5231) by @robinsaviary 436 + [examples] ADDED: `core_delta_time` (#5216) by @robinsaviary 437 + [examples] ADDED: `core_directory_files` (#5230) by @hugo 438 + [examples] ADDED: `core_highdpi_testbed` by @raysan5 439 + [examples] ADDED: `core_highdpi_demo` example by @johnnymarler 440 + [examples] ADDED: `core_input_actions` (#5211) by @JettMonstersGoBoom 441 + [examples] ADDED: `core_keyboard_testbed` by @raysan5 442 + [examples] ADDED: `core_monitor_change` (#5215) by @maiconpintoabreu 443 + [examples] ADDED: `core_render_texture` by @raysan5 444 + [examples] ADDED: `core_text_file_loading` (#5278) by @NimComPoo-04 445 + [examples] ADDED: `core_undo_redo` by @raysan5 446 + [examples] ADDED: `core_viewport_scaling` (#5313) by @agnis16 447 + [examples] ADDED: `core_compute_hash` by @raysan5 448 + [examples] ADDED: `shapes_ball_physics` (#5372) by @davidbuzatto 449 + [examples] ADDED: `shapes_bullet_hell` (#5218) by @zerohorsepower 450 + [examples] ADDED: `shapes_clock_of_clocks` (#5263) by @themushroompirates 451 + [examples] ADDED: `shapes_clock_of_clocks` by @hmz-rhl 452 + [examples] ADDED: `shapes_dashed_line` (#5222) by @luis605 453 + [examples] ADDED: `shapes_double_pendulum` by @joecheong2006 454 + [examples] ADDED: `shapes_hilbert_curve` (#5454) by @hmz-rhl 455 + [examples] ADDED: `shapes_kaleidoscope` (#5233) by @hugo 456 + [examples] ADDED: `shapes_lines_drawing` (#5283) by @robinsaviary 457 + [examples] ADDED: `shapes_math_angle_rotation` (#5236) by @krispysnacc 458 + [examples] ADDED: `shapes_math_sine_cosine` (#5257) by @Jopestpe 459 + [examples] ADDED: `shapes_mouse_trail` (#5246) by @balamurugan 460 + [examples] ADDED: `shapes_particles` (#5260) by @JordSant 461 + [examples] ADDED: `shapes_penrose_tile` (#5376) by @davidbuzatto 462 + [examples] ADDED: `shapes_pie_chart` (#5227) by @GideonSerf 463 + [examples] ADDED: `shapes_recursive_tree` (#5229) by @Jopestpe 464 + [examples] ADDED: `shapes_rlgl_color_wheel` example (#5355) by @robinsaviary 465 + [examples] ADDED: `shapes_rlgl_triangle` example (#5353) by @robinsaviary 466 + [examples] ADDED: `shapes_starfield` (#5255) by @themushroompirates 467 + [examples] ADDED: `shapes_triangle_strip` (#5240) by @Jopestpe 468 + [examples] ADDED: `shapes_collision_ellipses` (#5722) by @Monjaris 469 + [examples] ADDED: `text_inline_styling` by @raysan5 470 + [examples] ADDED: `text_strings_management` (#5379) by @davidbuzatto 471 + [examples] ADDED: `text_words_alignment` (#5254) by @themushroompirates 472 + [examples] ADDED: `textured_clipboard_image` (#5604) by @maiconpintoabreu 473 + [examples] ADDED: `textures_cellular_automata` (#5395) by @JordSant 474 + [examples] ADDED: `textures_frame_buffer_rendering` (#5468) by @jackboakes 475 + [examples] ADDED: `textures_magnifying_glass` (#5587) by @dgamebillda 476 + [examples] ADDED: `textures_screen_buffer` (#5357) by @agnis16 477 + [examples] ADDED: `textures_sprite_stacking` example (#5345) by @robinsaviary 478 + [examples] ADDED: `models_animation_timing` by @raysan5 479 + [examples] ADDED: `models_directional_billboard` (#5351) by @robinsaviary 480 + [examples] ADDED: `models_animation_bone_blending` (#5543) by @dmitrii-brand 481 + [examples] ADDED: `models_basic_voxel` (#5212) by @timlittle88 482 + [examples] ADDED: `models_decals` (#5298) by @themushroompirates 483 + [examples] ADDED: `models_geometry_textures_cube` (#5221) by @Jopestpe 484 + [examples] ADDED: `models_tesseract` by @raysan5 485 + [examples] ADDED: `shaders_render_depth_texture` by @luis605 486 + [examples] ADDED: `shaders_ascii_rendering` (#5213) by @maiconpintoabreu 487 + [examples] ADDED: `shaders_color_correction` (#5307) by @JordSant 488 + [examples] ADDED: `shaders_game_of_life` (#5394) by @JordSant 489 + [examples] ADDED: `shaders_mandelbrot_set` (#5282) by @JordSant 490 + [examples] ADDED: `shaders_normalmap` by @Sir-Irk 491 + [examples] ADDED: `shaders_rounded_rectangle` (#4719) by @anstropleuton 492 + [examples] ADDED: `shaders_view_depth` (luis605) 493 + [examples] ADDED: `audio_sound_positionning` by @Bigfoot71 494 + [examples] REMOVED: `core_gamepad_info` by @raysan5 495 + [examples] REMOVED: `core_loading_thread` by @raysan5 496 + [examples] RENAMED: Sprite fonts resource directory by @raysan5 497 + [examples] RENAMED: `core_3d_fps_controller` to `core_3d_camera_fps` by @raysan5 498 + [examples] RENAMED: `core_high_dpi` to `core_highdpi_demo` by @raysan5 499 + [examples] RENAMED: `core_input_gestures_web` to `core_input_gestures_testbed` by @raysan5 500 + [examples] RENAMED: `shapes_draw_circle_sector` to `shapes_circle_sector_drawing` by @raysan5 501 + [examples] RENAMED: `shapes_draw_rectangle_rounded` to `shapes_rounded_rectangle_drawing` by @raysan5 502 + [examples] RENAMED: `shapes_draw_ring` to `shapes_ring_drawing` by @raysan5 503 + [examples] RENAMED: `shapes_easings_ball_anim` to `shapes_easings_ball` by @raysan5 504 + [examples] RENAMED: `shapes_easings_box_anim` to `shapes_easings_box` by @raysan5 505 + [examples] RENAMED: `shapes_easings_rectangle_array` to `shapes_easings_rectangles` by @raysan5 506 + [examples] RENAMED: `text_draw_3d` to `text_3d_drawing` by @raysan5 507 + [examples] RENAMED: `text_raylib_fonts` -> `text_sprite_fonts` by @raysan5 508 + [examples] RENAMED: `text_unicode` to `text_unicode_emojis` by @raysan5 509 + [examples] RENAMED: `textures_draw_tiled` to `textures_tiled_drawing` by @raysan5 510 + [examples] RENAMED: `textures_polygon` to `textures_polygon_drawing` by @raysan5 511 + [examples] RENAMED: `textures_sprite_anim` to `textures_sprite_animation` by @raysan5 512 + [examples] RENAMED: `models_animation` to `models_animation_playing` by @raysan5 513 + [examples] RENAMED: `models_billboard` to `models_billboard_rendering` by @raysan5 514 + [examples] RENAMED: `models_cubicmap` to `models_cubicmap_rendering` by @raysan5 515 + [examples] RENAMED: `models_draw_cube_texture` to `models_textured_cube` by @raysan5 516 + [examples] RENAMED: `models_geometry_textures_cube` to `models_rotating_cube` by @raysan5 517 + [examples] RENAMED: `models_gpu_skinning` to `models_animation_gpu_skinning` by @raysan5 518 + [examples] RENAMED: `models_heightmap` to `models_heightmap_rendering` by @raysan5 519 + [examples] RENAMED: `models_skybox` to `models_skybox_rendering` by @raysan5 520 + [examples] RENAMED: `shaders_deferred_render` to `shaders_deferred_rendering` by @raysan5 521 + [examples] RENAMED: `shaders_eratosthenes` to `shaders_eratosthenes_sieve` by @raysan5 522 + [examples] RENAMED: `shaders_fog` to `shaders_fog_rendering` by @raysan5 523 + [examples] RENAMED: `shaders_hybrid_render` to `shaders_hybrid_rendering` by @raysan5 524 + [examples] RENAMED: `shaders_lightmap` to `shaders_lightmap_rendering` by @raysan5 525 + [examples] RENAMED: `shaders_normal_map` to `shaders_normalmap_rendering` by @raysan5 526 + [examples] RENAMED: `shaders_raymarching` to `shaders_raymarching_rendering` by @raysan5 527 + [examples] RENAMED: `shaders_shadowmap` to `shaders_shadowmap_rendering` by @raysan5 528 + [examples] RENAMED: `shaders_spotlight` to `shaders_spotlight_rendering` by @raysan5 529 + [examples] RENAMED: `shaders_texture_drawing` to `shaders_texture_rendering` by @raysan5 530 + [examples] RENAMED: `shaders_view_depth` to `shaders_depth_rendering` by @raysan5 531 + [examples] RENAMED: `shaders_write_depth` to `shaders_depth_writing` by @raysan5 532 + [examples] RENAMED: `shaders_normalmap` to `shaders_normal_map` by @raysan5 533 + [examples] RENAMED: `audio_fft_spectrum_visualizer` to `audio_spectrum_visualizer` by @raysan5 534 + [examples] REVIEWED: All examples header section comments, for better organization and consistency by @raysan5 535 + [examples] REVIEWED: All examples MSVC warnings and non-working examples by @Jeffm2501 536 + [examples] REVIEWED: Moved some examples out of `others` category, removing category by @raysan5 537 + [examples] REVIEWED: Shaders formating to follow raylib code conventions by @raysan5 538 + [examples] REVIEWED: `examples_template`, adding info about new rexm tool by @raysan5 539 + [examples] REVIEWED: `core_2d_camera_mouse_zoom` by @raysan5 540 + [examples] REVIEWED: `core_3d_camera_fps` by @raysan5 541 + [examples] REVIEWED: `core_3d_fps_controller` by @agnis16 542 + [examples] REVIEWED: `core_3d_fps_controller` by @raysan5 543 + [examples] REVIEWED: `core_clipboard_text` by @raysan5 544 + [examples] REVIEWED: `core_custom_frame_control`, to work properly on web by @PanicTitan 545 + [examples] REVIEWED: `core_custom_frame_control`, avoid divide by 0 by @johnnymarler 546 + [examples] REVIEWED: `core_delta_time` by @raysan5 547 + [examples] REVIEWED: `core_directory_files` by @raysan5 548 + [examples] REVIEWED: `core_highdpi_testbed` by @raysan5 549 + [examples] REVIEWED: `core_input_actions` by @raysan5 550 + [examples] REVIEWED: `core_input_gamepad, fix hardcoded gamepad 0 by @lepasona 551 + [examples] REVIEWED: `core_input_gamepad` by @raysan5 552 + [examples] REVIEWED: `core_input_gestures_testbed` by @raysan5 553 + [examples] REVIEWED: `core_monitor_detector` by @raysan5 554 + [examples] REVIEWED: `core_random_sequence` by @raysan5 555 + [examples] REVIEWED: `core_render_texture` by @raysan5 556 + [examples] REVIEWED: `core_text_file_loading` (#5339) by @cs24b016 557 + [examples] REVIEWED: `core_undo_redo` by @raysan5 558 + [examples] REVIEWED: `core_viewport_scaling` by @raysan5 559 + [examples] REVIEWED: `core_window_flags` by @raysan5 560 + [examples] REVIEWED: `core_window_flags`, add borderless windowed toggle by @johnnymarler 561 + [examples] REVIEWED: `core_window_flags`, prevent immediate window restore from minimize by @johnnymarler 562 + [examples] REVIEWED: `core_window_letterbox` by @raysan5 563 + [examples] REVIEWED: `core_input_gamepad`, vibration test button (#5362) by @sergii 564 + [examples] REVIEWED: `core_directory_files` (#5343) by @hugo 565 + [examples] REVIEWED: `core_input_virtual_controls` (#4584) by @danilwhale 566 + [examples] REVIEWED: `shapes_bouncing_ball`, added gravity (#5217) by @Jopestpe 567 + [examples] REVIEWED: `shapes_kaleidoscope` rewind, forward and reset buttons (#5369) by @hugo 568 + [examples] REVIEWED: `shapes_digital_clock` by @raysan5 569 + [examples] REVIEWED: `shapes_bullet_hell` by @raysan5 570 + [examples] REVIEWED: `shapes_double_pendulum` by @raysan5 571 + [examples] REVIEWED: `shapes_easings_testbed` by @raysan5 572 + [examples] REVIEWED: `shapes_hilbert_curve` #5454 by @raysan5 573 + [examples] REVIEWED: `shapes_hilbert_curve` by @raysan5 574 + [examples] REVIEWED: `shapes_lines_drawing` by @raysan5 575 + [examples] REVIEWED: `shapes_penrose_tile` by @raysan5 576 + [examples] REVIEWED: `shapes_penrose_tile` formating by @raysan5 577 + [examples] REVIEWED: `shapes_pie_chart` by @raysan5 578 + [examples] REVIEWED: `shapes_rlgl_triangle` by @raysan5 579 + [examples] REVIEWED: `shapes_triangle_strip`, fix array size and simplify loop (#5280) by @Jopestpe 580 + [examples] REVIEWED: `text_draw_3d` by @zeankey 581 + [examples] REVIEWED: `text_font_sdf` by @raysan5 582 + [examples] REVIEWED: `text_inline_styling` by @raysan5 583 + [examples] REVIEWED: `text_raylib_fonts` by @raysan5 584 + [examples] REVIEWED: `text_unicode_ranges` by @raysan5 585 + [examples] REVIEWED: `text_words_alignment` (#5411) by @lucarandrianirina2507 586 + [examples] REVIEWED: `text_draw_3d`, fix text size by @zeankey 587 + [examples] REVIEWED: `textures_bunnymark`, replaced bunny image #5344 by @raysan5 588 + [examples] REVIEWED: `textures_clipboard_image` by @raysan5 589 + [examples] REVIEWED: `textures_framebuffer_rendering` by @raysan5 590 + [examples] REVIEWED: `textures_image_kernel` by @raysan5 591 + [examples] REVIEWED: `textures_screen_buffer` by @raysan5 592 + [examples] REVIEWED: `textures_sprite_stacking` by @raysan5 593 + [examples] REVIEWED: `textures_textured_curve` (#5463) by @Jeffm2501 594 + [examples] REVIEWED: `textures_bunnymark` by @raysan5 595 + [examples] REVIEWED: `models_first_person_maze` (#5478) by @pauldahacker 596 + [examples] REVIEWED: `models_decals`, fixed unload crash, added buttons (#5306) by @themushroompirates 597 + [examples] REVIEWED: `models_animation_bone_blending` by @raysan5 598 + [examples] REVIEWED: `models_basic_voxel` by @raysan5 599 + [examples] REVIEWED: `models_basic_voxel`, fix raycasting logic (#5643) by @SardineMilk 600 + [examples] REVIEWED: `models_basic_voxel`, replaced `GetRenderWidth()` by `GetScreenWidth()` (#5635) by @SardineMilk 601 + [examples] REVIEWED: `models_decals` by @raysan5 602 + [examples] REVIEWED: `models_first_person_maze` by @raysan5 603 + [examples] REVIEWED: `models_loading_vox` by @raysan5 604 + [examples] REVIEWED: `models_mesh_picking` by @raysan5 605 + [examples] REVIEWED: `models_point_rendering` by @raysan5 606 + [examples] REVIEWED: `models_rlgl_solar_system` by @raysan5 607 + [examples] REVIEWED: `models_skybox_rendering` by @raysan5 608 + [examples] REVIEWED: `models_textures_tiling` shaders by @raysan5 609 + [examples] REVIEWED: `models_animation_blending` by @raysan5 610 + [examples] REVIEWED: `shaders_ascii_rendering` (#5219) by @maiconpintoabreu 611 + [examples] REVIEWED: `shaders_ascii_rendering` by @raysan5 612 + [examples] REVIEWED: `shaders_basic_pbr`, to work on web (#4516) by @afanolovcic 613 + [examples] REVIEWED: `shaders_color_correction` by @raysan5 614 + [examples] REVIEWED: `shaders_defered_render` for OpenGL ES 3.0 (#4617) by @Bigfoot71 615 + [examples] REVIEWED: `shaders_deferred_render` (#4676) by @veins1 616 + [examples] REVIEWED: `shaders_deferred_render` by @raysan5 617 + [examples] REVIEWED: `shaders_deferred_rendering` by @raysan5 618 + [examples] REVIEWED: `shaders_game_of_life` by @raysan5 619 + [examples] REVIEWED: `shaders_game_of_life` for web (#5399) by @JordSant 620 + [examples] REVIEWED: `shaders_hybrid_rendering`, shaders issues by @raysan5 621 + [examples] REVIEWED: `shaders_julia_set` by @raysan5 622 + [examples] REVIEWED: `shaders_mandelbrot_set` (#5310) by @JordSant 623 + [examples] REVIEWED: `shaders_mandelbrot_set` for WebGL (#5286) by @JordSant 624 + [examples] REVIEWED: `shaders_mesh_instancing` by @raysan5 625 + [examples] REVIEWED: `shaders_multi_sample2d` by @raysan5 626 + [examples] REVIEWED: `shaders_normal_map` by @raysan5 627 + [examples] REVIEWED: `shaders_normalmap_rendering` by @raysan5 628 + [examples] REVIEWED: `shaders_normalmap` #5032 by @raysan5 629 + [examples] REVIEWED: `shaders_normalmap` by @raysan5 630 + [examples] REVIEWED: `shaders_rounded_rectangle` by @raysan5 631 + [examples] REVIEWED: `shaders_shadowmap_rendering` by @raysan5 632 + [examples] REVIEWED: `shaders_shadowmap_rendering` example by @raysan5 633 + [examples] REVIEWED: `shaders_spotlight` by @raysan5 634 + [examples] REVIEWED: `shaders_texture_drawing` by @raysan5 635 + [examples] REVIEWED: `shaders_cel_shading` by @raysan5 636 + [examples] REVIEWED: `shaders_cel_shading`, cel-shading and outline using inverted hull (#5615) by @galexeev 637 + [examples] REVIEWED: `audio_fft_spectrum_visualizer`, not working on web by @raysan5 638 + [examples] REVIEWED: `audio_music_stream` by @raysan5 639 + [examples] REVIEWED: `audio_sound_multi` by @raysan5 640 + [examples] REVIEWED: `audio_sound_positioning` by @dabbott 641 + [examples] REVIEWED: `rlgl_compute_shader` by @raysan5 642 + [examples] REVIEWED: `raylib_opengl_interop`, remove unnecessary defines (#5618) by @m0391n 643 + [examples] REVIEWED: `raylib_opengl_interop` single header library not having it's implementation loaded (#5498) by @jscaffidi 644 + [examples] REVIEWED: Example shader `depth_render.fs` by @raysan5 645 + [examples] REVIEWED: Example shader `depth_write.fs` by @raysan5 646 + [examples] REVIEWED: Example shader `normalmap.fs` by @raysan5 647 + [examples] REVIEWED: Example shader `palette_switch.fs` (#5205) by @benjaminsmallarz 648 + [examples] REVIEWED: Example shader `write_depth.fs` for glsl120 by @maiconpintoabreu 649 + [examples] REDESIGNED: `core_clipboard_text`, based on #5248 by @raysan5 650 + [examples] REDESIGNED: `shapes_digital_clock` by @raysan5 651 + [examples] REDESIGNED: `shapes_kaleidoscope`, store lines #5361 by @raysan5 652 + [examples] REDESIGNED: `text_unicode_ranges` by @raysan5 653 + [examples] REDESIGNED: `models_animation_blending` by @raysan5 654 + [examples] REDESIGNED: `audio_raw_stream`, remove callback usage (#5637) by @dan-hoang 655 + 656 + [bindings] ADDED: Common Lisp binding by @colin 657 + [bindings] ADDED: D Object Oriented wrapper (#4550) by @RealDoigt 658 + [bindings] ADDED: Dart binding (#5585) by @FinnDemonCat 659 + [bindings] ADDED: Deno binding for 5.5 (#5462) by @JJLDonley 660 + [bindings] ADDED: Jai binding (#4565) by @ahmedqarmout2 661 + [bindings] ADDED: Raylib-cs.BleedingEdge (#4999) by @danilwhale 662 + [bindings] ADDED: SwiftForth language binding (#5319) by @dave 663 + [bindings] ADDED: Wave language (#5539) by @youngjae681 664 + [bindings] ADDED: c3-lang for raylib 5.5 (#4555) by @afanolovcic 665 + [bindings] ADDED: chicken scheme (#5449) by @meowstr 666 + [bindings] ADDED: elle bindings (#5370) by @acquitefx 667 + [bindings] ADDED: raylib-ada (#5150) by @artem.v.ageev 668 + [bindings] ADDED: uiua bindings (#4993) by @marcosgrzesiak 669 + [bindings] ADDED: Ring language (#5421) by @SabeDoesThings 670 + [bindings] ADDED: ReiLua, Lua binding (#4589) by @legendaryredfox 671 + [bindings] ADDED: Matte bindings (#4586) by @legendaryredfox 672 + [bindings] UPDATED: Nim wrapper version (#4638) by @planetis-m 673 + [bindings] UPDATED: Raylib.nelua version (#4698) by @AuzFox 674 + [bindings] UPDATED: Fennel binding (#4585) by @0riginaln0 675 + [bindings] UPDATED: Jaylib to 5.5 (#4546) by @glowiak 676 + [bindings] UPDATED: Ruby binding (#4639) by @BotRandomness 677 + [bindings] UPDATED: V language binding (#4691) by @mobiuscog 678 + [bindings] UPDATED: `racket-raylib` version by @eutro 679 + [bindings] UPDATED: fortran-raylib to 5.5 (#4518) by @interkosmos 680 + [bindings] UPDATED: raylib-beef (#4514) by @Jannis.v.hagen 681 + [bindings] UPDATED: raylib-cpp to 5.5 (#4511) by @RobLoach 682 + [bindings] UPDATED: raylib-cs binding link (#4746) by @Rgebee 683 + [bindings] UPDATED: raylib-d to 5.5 (#4506) by @schveiguy 684 + [bindings] UPDATED: raylib-lua (#4567) by @legendaryredfox 685 + [bindings] UPDATED: raylib-py to 5.5 (#4519) by @jorgegomes83 686 + [bindings] UPDATED: raylib-python-cffi to 5.0 (#4512) by @villares 687 + [bindings] UPDATED: raylib-python-cffi to 5.5 (#4517) by @villares 688 + [bindings] UPDATED: raylib-zig by @Not-Nik 689 + [bindings] UPDATED: Multiple bindings (#4504, #4559, #4633, #4920, #5538, #5546) 690 + [bindings] REMOVED: Broken repo links from bindings (#4572) by @legendaryredfox 691 + [bindings] UPDATED: Factor bindings to 5.5 (#5648) by @ArnautDaniel 692 + [bindings] UPDATED: Raylib-cs to 5.5 (#4628) by @JupiterRider 693 + [bindings] UPDATED: raylib-go to 5.5 (#4566) by @JupiterRider 694 + [bindings] UPDATED: racket-raylib (#4884) by @eutro 695 + [bindings] UPDATED: raylib-odin binding license (#5647) by @jtorrestx 696 + [bindings] UPDATED: raylib-zig (#5103) by @Not-Nik 697 + [bindings] UPDATED: keybindings versions (#4570) by @legendaryredfox 698 + [bindings] UPDATED: Common Lisp binding (#5014) by @fosskers 699 + [bindings] REMOVED: raylib-v7 binding (#5090) by @Auios 700 + 701 + [rlparser] RENAMED: `raylib_parser` to `rlparser` by @raysan5 702 + [rlparser] REVIEWED: Command-line info by @raysan5 703 + [rexm] ADDED: Automated-testing system by @raysan5 704 + [rexm] ADDED: Build check warnings logs by @raysan5 705 + [rexm] ADDED: Command `update` to validate and update required files by @raysan5 706 + [rexm] ADDED: Example automated-testing by @raysan5 707 + [rexm] ADDED: Examples validation by @raysan5 708 + [rexm] ADDED: Implemented examples commands for automatic testing by @raysan5 709 + [rexm] ADDED: Implemented file rename requirements by @raysan5 710 + [rexm] ADDED: More detailed log info by @raysan5 711 + [rexm] ADDED: Read examples years created/reviewed info by @raysan5 712 + [rexm] ADDED: Resources scanning from examples for automated copying by @raysan5 713 + [rexm] ADDED: Security checks to verify examples categories provided by @raysan5 714 + [rexm] ADDED: Support example removal by @raysan5 715 + [rexm] ADDED: TestLog option for logs processing (without rebuilding) by @raysan5 716 + [rexm] ADDED: Web metadata validation and update by @raysan5 717 + [rexm] ADDED: Web platform logs automated reports by @raysan5 718 + [rexm] ADDED: `LoadExamplesData()` to support filtering and sorting by @raysan5 719 + [rexm] ADDED: `RemoveVSProjectFromSolution()` by @raysan5 720 + [rexm] ADDED: `AddVSProjectToSolution()` by @raysan5 721 + [rexm] ADDED: Examples buildind command by @raysan5 722 + [rexm] ADDED: Legend info on report generation by @raysan5 723 + [rexm] ADDED: `UpdateSourceMetadata()` by @raysan5 724 + [rexm] ADDED: Allow building web examples locally on Windows platform by @raysan5 725 + [rexm] ADDED: Generate second report with examples with issues by @raysan5 726 + [rexm] ADDED: Automatic validation and update of examples by @raysan5 727 + [rexm] ADDED: Automatically fix not found VS2022 project / solution by @raysan5 728 + [rexm] ADDED: Check example exists (compilation worked) before trying to run it by @raysan5 729 + [rexm] ADDED: Copy examples web-build files to `raylib.com` by @raysan5 730 + [rexm] ADDED: Remove duplicate entries on examples list on `update` process by @raysan5 731 + [rexm] ADDED: Automatic validation and update by @raysan5 732 + [rexm] ADDED: Example building, using default examples `Makefile`/`Makefile.Web` by @raysan5 733 + [rexm] ADDED: Rebuild to support full categories by @raysan5 734 + [rexm] ADDED: Support building full example collection and categories by @raysan5 735 + [rexm] ADDED: Support examples data `validation` and **report generation** by @raysan5 736 + [rexm] ADDED: Support paths customization with environment variables by @raysan5 737 + [rexm] ADDED: Support testing running on `PLATFORM_DRM` by @raysan5 738 + [rexm] REVIEWED: Fixed some issues, improved `make` call defining base path by @raysan5 739 + [rexm] REVIEWED: Avoid external tool for UUIDv4 generation, implement custom function by @raysan5 740 + [rexm] REVIEWED: Avoid updating metadata from `others` examples by @raysan5 741 + [rexm] REVIEWED: Allow external path definition for VS solution file by @raysan5 742 + [rexm] REVIEWED: Reports moved to reports directory by @raysan5 743 + [rexm] REVIEWED: Automated testing for Web by @raysan5 744 + [rexm] REVIEWED: Examples header info inconsistencies by @raysan5 745 + [rexm] REVIEWED: Get example info from example header when added, to be added to collection by @raysan5 746 + [rexm] REVIEWED: Makefile and default paths (#5224) by @Teeto44 747 + [rexm] REVIEWED: Testing report generation by @raysan5 748 + [rexm] REVIEWED: Update `nextCatIndex` (#5616) by @CrackedPixel 749 + [rexm] REVIEWED: Added variable assignment to rename option (#5077) by @lpow100 750 + [rexm] REVIEWED: Ran examples testing for macos (#5366) by @MaeBrooks 751 + [remx] REVIEWED: Add check for category on new name (#5093) by @maiconpintoabreu 752 + [remx] REVIEWED: Add warning for missing new name (#5092) by @maiconpintoabreu 753 + [rexm] REVIEWED: Add compiled rexm to gitignore (#5086) by @maiconpintoabreu 754 + [rexm] REVIEWED: Update examples status report when examples Updated by @raysan5 755 + [rexm] REVIEWED: `ScanExampleResources()` avoid resources to be saved by the program by @raysan5 756 + [rexm] REVIEWED: `UpdateSourceMetadata()` and `TextReplaceBetween()` by @raysan5 757 + [rexm] REVIEWED: `examples.js` example addition working by @raysan5 758 + [rexm] REVIEWED: `add` command logic for existing example addition by @raysan5 759 + [rexm] REVIEWED: Replace example name on project file by @raysan5 760 + [rexm] REVIEWED: Report issues if logs can not be loaded by @raysan5 761 + [rexm] REVIEWED: VS project adding to solution by @raysan5 762 + [rexm] REVIEWED: `UpdateSourceMetadata()` by @raysan5 763 + [rexm] REVIEWED: Example renaming on `examples.js` by @raysan5 764 + [rexm] REVIEWED: Examples source code headers metadata by @raysan5 765 + [rexm] REVIEWED: `README.md` generation improvements by @raysan5 766 + [rexm] REVIEWED: Store example resource paths by @raysan5 767 + [rexm] REVIEWED: `Makefile.Web` before trying to rebuild new example for web by @raysan5 768 + [rexm] REVIEWED: Using `Makefile.Web` for specific web versions generation by @raysan5 769 + 770 + [external] ADDED: `cgltf_write` 1.15, to support glTF models export in the future, by @raysan5 771 + [external] RENAMED: `rl_gputex.h` to `rltexgpu.h`, compressed textures loading 772 + [external] REVIEWED: `rltexgpu.h`, make it usable standalone by @raysan5 773 + [external] REVIEWED: `rltexgpu.h, fix the swizzling in `rl_load_dds_from_memory()` (#5422) by @msmith-codes 774 + [external]`REVIEWED: `rltexgpu.h, decouple logging and memory allocation from raylib by @sleeptightAnsiC 775 + [external] REVIEWED: `jar_mod.h`, buffer overflow on memcpy by @LoneAuios 776 + [external] REVIEWED: `sdefl` and `sinfl` issues (#5367) by @raysan5 777 + [external] REVIEWED: `sinfl_bsr()`, improvements by @RicoP 778 + [external] REVIEWED: `stb_truetype`, fix composite glyph scaling logic (#4811) by @ashishbhattarai 779 + [external] UPDATED: `raygui` to 5.0-dev for examples by @raysan5 780 + [external] UPDATED: dr_libs (#5020) by @Emil2010 781 + [external] UPDATED: `miniaudio` to v0.11.22 (#4983) by @M374LX 782 + [external] UPDATED: `miniaudio` to v0.11.23 (#5234) by @pyrokn8 783 + [external] UPDATED: `miniaudio` to v0.11.24 (#5506) by @vdemcak 784 + [external] UPDATED: `RGFW` to 1.5 (#4688) by @ColleagueRiley 785 + [external] UPDATED: `RGFW` to 1.6 (#4795) by @colleagueRiley 786 + [external] UPDATED: `RGFW` to 1.7 (#4965) by @M374LX 787 + [external] UPDATED: `RGFW` to 1.7.5-dev (#4976) by @M374LX 788 + [external] UPDATED: `RGFW` to 2.0.0 (#5582) by @CrackedPixel 789 + [external] UPDATED: `cgltf` 1.14 to 1.15 by @raysan5 790 + [external] UPDATED: `dr_flac` v0.13.0 to v0.13.3 by @raysan5 791 + [external] UPDATED: `dr_mp3` v0.7.0 to v0.7.4 by @raysan5 792 + [external] UPDATED: `m3d` to latest master by @raysan5 793 + [external] UPDATED: `qoi` to latest master by @raysan5 794 + [external] UPDATED: `qoa` to latest master by @raysan5 795 + [external] UPDATED: `stb_image_resize2` v2.12 to v2.18 by @raysan5 796 + 797 + [misc] ADDED: SECURITY.md for security reporting policies by @raysan5 798 + [misc] ADDED: `examples/examples_list`, to be used by `rexm` or other tools by @raysan5 799 + [misc] ADDED: `fix_win32_compatibility.h`, utility header to avoid `windows.h` inclusion conflicts by @Jeffm2501 800 + [misc] RENAMED: Move and rename `raylib_parser` to `tools/rlparser` by @raysan5 -WARNING- 801 + [misc] REVIEWED: Avoid `realloc()` usage, security improvement by @raysan5 802 + [misc] REVIEWED: Prioritize `calloc()` calls than `malloc()` on some cases by @raysan5 803 + [misc] REVIEWED: Code comments using imperative format by @raysan5 804 + [misc] REVIEWED: Webpage reference comments start with `REF:`, more consistent with `TODO:` and `NOTE:` comments by @raysan5 805 + [misc] REVIEWED: CONVENTIONS.md, added additional conventions by @raysan5 806 + [misc] REVIEWED: ROADMAP.md with potential future improvements by @raysan5 807 + [misc] REVIEWED: Comments formating, using imperative mode by @raysan5 808 + [misc] REVIEWED: Multiple examples inconsistencies on heeaders and overall structure to follow template by @raysan5 809 + [misc] REVIEWED: Code gardening: cleaning, reviewed comments, warnings, variables names... by @raysan5, @JeffM2501, @maiconpintoabreu, @CrackedPixel 810 + 811 + ------------------------------------------------------------------------- 812 + Release: raylib 5.5 (18 November 2024) 813 + ------------------------------------------------------------------------- 814 + KEY CHANGES: 815 + - New tool: raylib project creator [rpc] 816 + - New platform backends: RGFW 817 + - New platform backends: SDL3 (along SDL2) 818 + - New platforms supported: Dreamcast, N64, PSP, PSVita, PS4 819 + - Added GPU Skinning support (all platforms and GL versions) 820 + - Added raymath C++ operators 821 + 822 + Detailed changes: 823 + 824 + [rcore] ADDED: Working directory info at initialization by @raysan5 825 + [rcore] ADDED: `GetClipboardImage()`, supported by multiple backends (#4459) by @evertonse 826 + [rcore] ADDED: `MakeDirectory()`, supporting recursive directory creation by @raysan5 827 + [rcore] ADDED: `ComputeSHA1()` (#4390) by @Anthony Carbajal 828 + [rcore] ADDED: `ComputeCRC32()` and `ComputeMD5()` by @raysan5 829 + [rcore] ADDED: `GetKeyName()` (#4161) by @MrScautHD 830 + [rcore] ADDED: `IsFileNameValid()` by @raysan5 831 + [rcore] ADDED: `GetViewRay()`, viewport independent raycast (#3709) by @luis605 832 + [rcore] RENAMED: `GetMouseRay()` to `GetScreenToWorldRay()` (#3830) by @raysan5 833 + [rcore] RENAMED: `GetViewRay()` to `GetScreenToWorldRayEx()` (#3830) by @raysan5 834 + [rcore] REVIEWED: `GetApplicationDirectory()` for FreeBSD (#4318) by @git 835 + [rcore] REVIEWED: `LoadDirectoryFilesEx()`/`ScanDirectoryFiles()`, support directory on filter (#4302) by @foxblock 836 + [rcore] REVIEWED: Update comments on fullscreen and boderless window to describe what they do (#4280) by @Jeffm2501 837 + [rcore] REVIEWED: Correct processing of mouse wheel on Automation events #4263 by @raysan5 838 + [rcore] REVIEWED: Fix gamepad axis movement and its automation event recording (#4184) by @maxmutant 839 + [rcore] REVIEWED: Do not set RL_TEXTURE_FILTER_LINEAR when high dpi flag is enabled (#4189) by @Dave Green 840 + [rcore] REVIEWED: `GetScreenWidth()`/`GetScreenHeight()` (#4074) by @Anthony Carbajal 841 + [rcore] REVIEWED: Initial window dimensions checks (#3950) by @Christian Haas 842 + [rcore] REVIEWED: Set default init values for random #3954 by @raysan5 843 + [rcore] REVIEWED: Window positioning, avoid out-of-screen window-bar by @raysan5 844 + [rcore] REVIEWED: Fix framerate recording for .gif (#3894) by @RobLoach 845 + [rcore] REVIEWED: Screen space related functions consistency (#3830) by @aiafrasinei 846 + [rcore] REVIEWED: `GetFileNameWithoutExt()` (#3771) by @oblerion 847 + [rcore] REVIEWED: `GetWindowScaleDPI()`, simplified (#3701) by @karl 848 + [rcore] REVIEWED: `UnloadAutomationEventList()` (#3658) by @planetis-m 849 + [rcore] REVIEWED: Flip VR screens (#3633) by @Matthew Oros 850 + [rcore] REVIEWED: Remove unused vScreenCenter (#3632) by @Matthew Oros 851 + [rcore] REVIEWED: `LoadRandomSequence()`, issue in sequence generation #3612 by @raysan5 852 + [rcore] REVIEWED: `IsMouseButtonUp()` (#3609) by @Kenneth M 853 + [rcore] REVIEWED: Fix typos in src/platforms/rcore_*.c (#3581) by @RadsammyT 854 + [rcore] REVIEWED: `ExportDataAsCode()`, change sanitization check (#3837) by @Laurentino Luna 855 + [rcore] REVIEWED: `ExportDataAsCode()`, add little sanitization to indentifier names (#3832) by @4rk 856 + [rcore] REVIEWED: `GetScreenWidth()`/`GetScreenHeight()` align with all platforms (#4451) by @Arche Washi 857 + [rcore] REVIEWED: `SetGamepadVibration()`, added duration parameter (#4410) by @Asdqwe -WARNING- 858 + [rcore] REVIEWED: `GetGamepadAxisMovement()`, fix #4405 (#4420) by @Asdqwe 859 + [rcore] REVIEWED: `GetGestureHoldDuration()` comments by @raysan5 860 + [rcore][rlgl] REVIEWED: Fix scale issues when ending a view mode (#3746) by @Jeffm2501 861 + [rcore][GLFW] REVIEWED: Keep CORE.Window.position properly in sync with glfw window position (#4190) by @Dave Green 862 + [rcore][GLFW] REVIEWED: Set AUTO_ICONIFY flag to false per default (#4188) by @Dave Green 863 + [rcore][GLFW] REVIEWED: `InitPlatform()`, add workaround for NetBSD (#4139) by @NishiOwO 864 + [rcore][GLFW] REVIEWED: Fix window not initializing on primary monitor (#3923) by @Rafael Bordoni 865 + [rcore][GLFW] REVIEWED: Set relative mouse mode when the cursor is disabled (#3874) by @Jeffm2501 866 + [rcore][GLFW] REVIEWED: Remove GLFW mouse passthrough hack and increase GLFW version in CMake (#3852) by @M374LX 867 + [rcore][GLFW] REVIEWED: Updated GLFW to 3.4 (#3827) by @M374LX 868 + [rcore][GLFW] REVIEWED: Feature test macros before include (#3737) by @John 869 + [rcore][GLFW] REVIEWED: Fix inconsistent dll linkage warning on windows (#4447) by @Jeffm2501 870 + [rcore][Web] ADDED: `SetWindowOpacity()` implementation (#4403) by @Asdqwe 871 + [rcore][Web] ADDED: `MaximizeWindow()` and `RestoreWindow()` implementations (#4397) by @Asdqwe 872 + [rcore][Web] ADDED: `ToggleFullscreen()` implementation (#3634) by @ubkp 873 + [rcore][Web] ADDED: `GetWindowPosition()` implementation (#3637) by @ubkp 874 + [rcore][Web] ADDED: `ToggleBorderlessWindowed()` implementation (#3622) by @ubkp 875 + [rcore][Web] ADDED: `GetMonitorWidth()` and `GetMonitorHeight()` implementations (#3636) by @ubkp 876 + [rcore][Web] REVIEWED: Update `SetWindowState()` and `ClearWindowState()` to handle `FLAG_WINDOW_MAXIMIZED` (#4402) by @Asdqwe 877 + [rcore][Web] REVIEWED: `WindowSizeCallback()`, do not try to handle DPI, already managed by GLFW (#4143) by @SuperUserNameMan 878 + [rcore][Web] REVIEWED: Relative mouse mode issues (#3940) by @Cemal Gönültaş 879 + [rcore][Web] REVIEWED: `ShowCursor()`, `HideCursor()` and `SetMouseCursor()` (#3647) by @ubkp 880 + [rcore][Web] REVIEWED: Fix CORE.Input.Mouse.cursorHidden with callbacks (#3644) by @ubkp 881 + [rcore][Web] REVIEWED: Fix `IsMouseButtonUp()` (#3611) by @ubkp 882 + [rcore][Web] REVIEWED: HighDPI support #3372 by @raysan5 883 + [rcore][Web] REVIEWED: `SetWindowSize()` (#4452) by @Asdqwe 884 + [rcore][Web] REVIEWED: `EmscriptenResizeCallback()`, simplified (#4415) by @Asdqwe 885 + [rcore][SDL] ADDED: `IsCursorOnScreen()` (#3862) by @Peter0x44 886 + [rcore][SDL] ADDED: Gamepad rumble/vibration support (#3819) by @gdserf.gs 887 + [rcore][SDL] REVIEWED: Gamepad support (#3776) by @A 888 + [rcore][SDL] REVIEWED: `GetWorkingDirectory()`, return correct path (#4392) by @Asdqwe 889 + [rcore][SDL] REVIEWED: `GetClipboardText()`, fix memory leak (#4354) by @Asdqwe 890 + [rcore][SDL] REVIEWED: Change SDL_Joystick to SDL_GameController (#4129) by @Frank Kartheuser 891 + [rcore][SDL] REVIEWED: Update storage base path, use provided SDL base path by @raysan5 892 + [rcore][SDL] REVIEWED: Call SDL_GL_SetSwapInterval() after GL context creation (#3997) by @JupiterRider 893 + [rcore][SDL] REVIEWED: `GetKeyPressed()` (#3869) by @Arthur 894 + [rcore][SDL] REVIEWED: Fix SDL multitouch tracking (#3810) by @mooff 895 + [rcore][SDL] REVIEWED: Fix `SUPPORT_WINMM_HIGHRES_TIMER` (#3679) by @ubkp 896 + [rcore][SDL] REVIEWED: SDL text input to Unicode codepoints #3650 by @raysan5 897 + [rcore][SDL] REVIEWED: `IsMouseButtonUp()` and add touch events (#3610) by @ubkp 898 + [rcore][SDL] REVIEWED: Fix real touch gestures (#3614) by @ubkp 899 + [rcore][SDL] REVIEWED: `IsKeyPressedRepeat()` (#3605) by @ubkp 900 + [rcore][SDL] REVIEWED: `GetKeyPressed()` and `GetCharPressed()` for SDL (#3604) by @ubkp 901 + [rcore][SDL] REVIEWED: `SetMousePosition()` for SDL (#3580) by @ubkp 902 + [rcore][SDL] REVIEWED: `SetWindowIcon()` for SDL (#3578) by @ubkp 903 + [rcore][SDL][rlgl] REVIEWED: Fix for running gles2 with SDL on desktop (#3542) by @_Tradam 904 + [rcore][Android] REVIEWED: Issue with isGpuReady flag (#4340) by @Menno van der Graaf 905 + [rcore][Android] REVIEWED: Allow main() to return it its caller on configuration changes (#4288) by @Hesham Abourgheba 906 + [rcore][Android] REVIEWED: Replace deprecated Android function ALooper_pollAll with ALooper_pollOnce (#4275) by @Menno van der Graaf 907 + [rcore][Android] REVIEWED: `PollInputEvents()`, register previous gamepad events (#3910) by @Aria 908 + [rcore][Android] REVIEWED: Fix Android keycode translation and duplicate key constants (#3733) by @M374LX 909 + [rcore][DRM] ADDED: uConsole keys mapping (#4297) by @carverdamien 910 + [rcore][DRM] ADDED: `GetMonitorWidth/Height()` (#3956) by @gabriel-marques 911 + [rcore][DRM] REVIEWED: `IsMouseButtonUp()` (#3611) by @ubkp 912 + [rcore][DRM] REVIEWED: Optimize gesture handling (#3616) by @ubkp 913 + [rcore][DRM] REVIEWED: `IsKeyPressedRepeat()` for PLATFORM_DRM direct input (#3583) by @ubkp 914 + [rcore][DRM] REVIEWED: Fix gamepad buttons not working in drm backend (#3888) by @MrMugame 915 + [rcore][DRM] REVIEWED: DRM backend to only use one api to allow for more devices (#3879) by @MrMugame 916 + [rcore][DRM] REVIEWED: Avoid separate thread when polling for gamepad events (#3641) by @Cinghy Creations 917 + [rcore][DRM] REVIEWED: Connector status reported as UNKNOWN but should be considered as CONNECTED (#4305) by @Michał Jaskólski 918 + [rcore][RGFW] ADDED: RGFW, new rcore backend platform (#3941) by @colleagueRiley 919 + [rcore][RGFW] REVIEWED: RGFW 1.0 (#4144) by @colleagueRiley 920 + [rcore][RGFW] REVIEWED: Fix errors when compiling with mingw (#4282) by @colleagueRiley 921 + [rcore][RGFW] REVIEWED: Replace long switch with a lookup table (#4108) by @colleagueRiley 922 + [rcore][RGFW] REVIEWED: Fix MSVC build errors (#4441) by @colleagueRiley 923 + [rlgl] ADDED: More uniform data type options #4137 by @raysan5 924 + [rlgl] ADDED: Vertex normals for RLGL immediate drawing mode (#3866) by @bohonghuang -WARNING- 925 + [rlgl] ADDED: `rlCullDistance*()` variables and getters (#3912) by @KotzaBoss 926 + [rlgl] ADDED: `rlSetClipPlanes()` function (#3912) by @KotzaBoss 927 + [rlgl] ADDED: `isGpuReady` flag, allow font loading with no GPU acceleration by @raysan5 -WARNING- 928 + [rlgl] REVIEWED: Changed RLGL_VERSION from 4.5 to 5.0 (#3914) by @rsteinke1111 929 + [rlgl] REVIEWED: Shader load failing returns 0, instead of fallback by @raysan5 -WARNING- 930 + [rlgl] REVIEWED: Standalone mode default flags (#4334) by @Asdqwe 931 + [rlgl] REVIEWED: Fix hardcoded index values in vboID array (#4312) by @JettMonstersGoBoom 932 + [rlgl] REVIEWED: GLint64 did not exist before OpenGL 3.2 (#4284) by @Tchan0 933 + [rlgl] REVIEWED: Extra warnings in case OpenGL 4.3 is not enabled (#4202) by @Maxim Knyazkin 934 + [rlgl] REVIEWED: Using GLint64 for glGetBufferParameteri64v() (#4197) by @Randy Palamar 935 + [rlgl] REVIEWED: Replace `glGetInteger64v()` with `glGetBufferParameteri64v()` (#4154) by @Kai Kitagawa-Jones 936 + [rlgl] REVIEWED: `rlMultMatrixf()`, fix matrix multiplication order (#3935) by @bohonghuang 937 + [rlgl] REVIEWED: `rlSetVertexAttribute()`, define last parameter as offset #3800 by @raysan5 938 + [rlgl] REVIEWED: `rlDisableVertexAttribute()`, remove redundat calls for SHADER_LOC_VERTEX_COLOR (#3871) by @zyperpl 939 + [rlgl] REVIEWED: `rlLoadTextureCubemap()`, load mipmaps for cubemaps (#4429) by @Not-Nik 940 + [rlgl] REVIEWED: `rlLoadFramebuffer()`, parameters not required by @raysan5 941 + [rlgl] REVIEWED: `rlSetUniformSampler()` (#3759) by @veins1 942 + [rlgl] REVIEWED: Renamed near/far variables (#4039) by @jgabaut 943 + [rlgl] REVIEWED: Expose OpenGL symbols (#3588) by @Peter0x44 944 + [rlgl] REVIEWED: Fix OpenGL 1.1 build issues (#3876) by @raysan5 945 + [rlgl] REVIEWED: Fixed compilation for OpenGL ES (#4243) by @Maxim Knyazkin 946 + [rlgl] REVIEWED: rlgl function description and comments by @raysan5 947 + [rlgl] REVIEWED: Expose glad functions when building raylib as a shared lib (#3572) by @Peter0x44 948 + [rlgl] REVIEWED: Fix version info in rlgl.h (#3558) by @schveiguy 949 + [rlgl] REVIEWED: Use the vertex color to the base shader in GLSL330 (#4431) by @Jeffm2501 950 + [rcamera] REVIEWED: Make camera movement independant of framerate (#4247) by @hanaxars -WARNING- 951 + [rcamera] REVIEWED: Updated camera speeds with GetFrameTime() (#4362) by @Anthony Carbajal 952 + [rcamera] REVIEWED: `UpdateCamera()`, added CAMERA_CUSTOM check (#3938) by @Tomas Fabrizio Orsi 953 + [rcamera] REVIEWED: Support mouse/keyboard and gamepad coexistence for input (#3579) by @ubkp 954 + [rcamera] REVIEWED: Cleaned away unused macros(#3762) by @Brian-ED 955 + [rcamera] REVIEWED: Fix for free camera mode (#3603) by @lesleyrs 956 + [rcamera] REVIEWED: `GetCameraRight()` (#3784) by @Danil 957 + [raymath] ADDED: C++ operator overloads for common math function (#4385) by @Jeffery Myers -WARNING- 958 + [raymath] ADDED: Vector4 math functions and Vector2 variants of some Vector3 functions (#3828) by @Bowserinator 959 + [raymath] REVIEWED: Fix MSVC warnings/errors in C++ (#4125) by @Jeffm2501 960 + [raymath] REVIEWED: Add extern "C" to raymath header for C++ (#3978) by @Jeffm2501 961 + [raymath] REVIEWED: `QuaternionFromAxisAngle()`, remove redundant axis length calculation (#3900) by @jtainer 962 + [raymath] REVIEWED: `Vector3Perpendicular()`, avoid implicit conversion from float to double (#3799) by @João Foscarini 963 + [raymath] REVIEWED: `MatrixDecompose()`, incorrect output for certain scale and rotations (#4461) by @waveydave 964 + [raymath] REVIEWED: Small code refactor (#3753) by @Idir Carlos Aliane 965 + [rshapes] ADDED: `CheckCollisionCircleLine()` (#4018) by @kai-z99 966 + [rshapes] REVIEWED: Multisegment Bezier splines (#3744) by @Santiago Pelufo 967 + [rshapes] REVIEWED: Expose shapes drawing texture and rectangle (#3677) by @Jeffm2501 968 + [rshapes] REVIEWED: `DrawLine()` #4075 by @raysan5 969 + [rshapes] REVIEWED: `DrawPixel()` drawing by @raysan5 970 + [rshapes] REVIEWED: `DrawLine()` to avoid pixel rounding issues #3931 by @raysan5 971 + [rshapes] REVIEWED: `DrawRectangleLines()`, considering view matrix for lines "alignment" by @raysan5 972 + [rshapes] REVIEWED: `DrawRectangleLines()`, pixel offset (#4261) by @RadsammyT 973 + [rshapes] REVIEWED: `DrawRectangleLines()`, pixel offset when scaling (#3884) by @raysan5 974 + [rshapes] REVIEWED: `DrawRectangleLinesEx()`, make sure accounts for square tiles (#4382) by @Jojaby 975 + [rshapes] REVIEWED: `Draw*Gradient()` color parameter names (#4270) by @Paperdomo101 976 + [rshapes] REVIEWED: `DrawGrid()`, remove duplicate color calls (#4148) by @Jeffm2501 977 + [rshapes] REVIEWED: `DrawSplineLinear()` to `SUPPORT_SPLINE_MITERS` by @raysan5 978 + [rshapes] REVIEWED: `DrawSplineLinear()`, implement miters (#3585) by @Toctave 979 + [rshapes] REVIEWED: `CheckCollisionPointRec()` by @raysan5 980 + [rshapes] REVIEWED: `CheckCollisionPointCircle()`, new implementation (#4135) by @kai-z99 981 + [rshapes] REVIEWED: `CheckCollisionCircles()`, optimized (#4065) by @kai-z99 982 + [rshapes] REVIEWED: `CheckCollisionPointPoly()` (#3750) by @Antonio Raúl 983 + [rshapes] REVIEWED: `CheckCollisionCircleRec()` (#3584) by @ubkp 984 + [rshapes] REVIEWED: Add more detail to function comment (#4344) by @Jeffm2501 985 + [rshapes] REVIEWED: Functions that draw point arrays take them as const (#4051) by @Jeffm2501 986 + [rtextures] ADDED: `ColorIsEqual()` by @raysan5 987 + [rtextures] ADDED: `ColorLerp()`, to mix 2 colors together (#4310) by @SusgUY446 988 + [rtextures] ADDED: `LoadImageAnimFromMemory()` (#3681) by @IoIxD 989 + [rtextures] ADDED: `ImageKernelConvolution()` (#3528) by @Karim 990 + [rtextures] ADDED: `ImageFromChannel()` (#4105) by @brccabral 991 + [rtextures] ADDED: `ImageDrawLineEx()` (#4097) by @Bigfoot71 992 + [rtextures] ADDED: `ImageDrawTriangle()` (#4094) by @Bigfoot71 993 + [rtextures] REMOVED: SVG files loading and drawing, moving it to raylib-extras by @raysan5 -WARNING- 994 + [rtextures] REVIEWED: `LoadImage()`, added support for 3-channel QOI images (#4384) by @R-YaTian 995 + [rtextures] REVIEWED: `LoadImageRaw()` #3926 by @raysan5 996 + [rtextures] REVIEWED: `LoadImageColors()`, advance k in loop (#4120) by @brccabral 997 + [rtextures] REVIEWED: `LoadTextureCubemap()`, added `mipmaps` #3665 by @raysan5 998 + [rtextures] REVIEWED: `LoadTextureCubemap()`, assign format to cubemap (#3823) by @Gary M 999 + [rtextures] REVIEWED: `LoadTextureCubemap()`, load mipmaps for cubemaps (#4429) by @Not-Nik 1000 + [rtextures] REVIEWED: `LoadTextureCubemap()`, avoid dangling re-allocated pointers (#4439) by @Not-Nik 1001 + [rtextures] REVIEWED: `LoadImageFromScreen()`, fix scaling (#3881) by @proberge-dev 1002 + [rtextures] REVIEWED: `LoadImageFromMemory()`, warnings on invalid image data (#4179) by @Jutastre 1003 + [rtextures] REVIEWED: `LoadImageAnimFromMemory()`, added security checks (#3924) by @raysan5 1004 + [rtextures] REVIEWED: `ImageColorTint()` and `ColorTint()`, optimized (#4015) by @Bigfoot71 1005 + [rtextures] REVIEWED: `ImageKernelConvolution()`, formating and warnings by @raysan5 1006 + [rtextures] REVIEWED: `ImageDrawRectangleRec`, fix bounds check (#3732) by @Blockguy24 1007 + [rtextures] REVIEWED: `ImageResizeCanvas()`, implemented fill color (#3720) by @Lieven Petersen 1008 + [rtextures] REVIEWED: `ImageDrawRectangleRec()` (#3721) by @Bigfoot71 1009 + [rtextures] REVIEWED: `ImageDraw()`, don't try to blend images without alpha (#4395) by @Not-Nik 1010 + [rtextures] REVIEWED: `GenImagePerlinNoise()` being stretched (#4276) by @Bugsia 1011 + [rtextures] REVIEWED: `GenImageGradientLinear()`, fix some angles (#4462) by @decromo 1012 + [rtextures] REVIEWED: `DrawTexturePro()` to avoid negative dest rec #4316 by @raysan5 1013 + [rtextures] REVIEWED: `ColorToInt()`, fix undefined behaviour (#3996) by @OetkenPurveyorOfCode 1014 + [rtextures] REVIEWED: Remove panorama cubemap layout option (#4425) by @Jeffm2501 1015 + [rtextures] REVIEWED: Removed unneeded module check, `rtextures` should not depend on `rtext` by @raysan5 1016 + [rtextures] REVIEWED: Simplified for loop for some image manipulation functions (#3712) by @Alice Nyaa 1017 + [rtext] ADDED: BDF fonts support (#3735) by @Stanley Fuller -WARNING- 1018 + [rtext] ADDED: `TextToCamel()` (#4033) by @IoIxD 1019 + [rtext] ADDED: `TextToSnake()` (#4033) by @IoIxD 1020 + [rtext] ADDED: `TextToFloat()` (#3627) by @Benjamin Schmid Ties 1021 + [rtext] REDESIGNED: `SetTextLineSpacing()` by @raysan5 -WARNING- 1022 + [rtext] REVIEWED: `LoadFontDataBDF()` name and formating by @raysan5 1023 + [rtext] REVIEWED: `LoadFontDefault()`, initialize glyphs and recs to zero #4319 by @raysan5 1024 + [rtext] REVIEWED: `LoadFontEx()`, avoid default font fallback (#4077) by @Peter0x44 -WARNING- 1025 + [rtext] REVIEWED: `LoadBMFont()`, extended functionality (#3536) by @Dongkun Lee 1026 + [rtext] REVIEWED: `LoadBMFont()`, issue on not glyph data initialized by @raysan5 1027 + [rtext] REVIEWED: `LoadFontFromMemory()`, use strncpy() to fix buffer overflow (#3795) by @Mingjie Shen 1028 + [rtext] REVIEWED: `LoadCodepoints()` returning a freed ptr when count is 0 (#4089) by @Alice Nyaa 1029 + [rtext] REVIEWED: `LoadFontData()` avoid fallback glyphs by @raysan5 -WARNING- 1030 + [rtext] REVIEWED: `LoadFontData()`, load image only if glyph has been found in font by @raysan5 1031 + [rtext] REVIEWED: `ExportFontAsCode()`, fix C++ compiler errors (#4013) by @DarkAssassin23 1032 + [rtext] REVIEWED: `MeasureTextEx()` height calculation (#3770) by @Marrony Neris 1033 + [rtext] REVIEWED: `MeasureTextEx()`, additional check for empty input string (#4448) by @mpv-enjoyer 1034 + [rtext] REVIEWED: `CodepointToUTF8()`, clean static buffer #4379 by @raysan5 1035 + [rtext] REVIEWED: `TextToFloat()`, always multiply by sign (#4273) by @ListeriaM 1036 + [rtext] REVIEWED: `TextReplace()` const correctness (#3678) by @maverikou 1037 + [rtext] REVIEWED: `TextToFloat()`, coding style (#3627) by @Benjamin Schmid Ties 1038 + [rtext] REVIEWED: Some comments to align to style (#3756) by @Idir Carlos Aliane 1039 + [rtext] REVIEWED: Adjust font atlas area calculation so padding area is not underestimated at small font sizes (#3719) by @Tim Romero 1040 + [rmodels] ADDED: GPU skinning support for models animations (#4321) by @Daniel Holden -WARNING- 1041 + [rmodels] ADDED: Support 16-bit unsigned short vec4 format for gltf joint loading (#3821) by @Gary M 1042 + [rmodels] ADDED: Support animation names for the m3d model format (#3714) by @kolunmi 1043 + [rmodels] ADDED: `DrawModelPoints()`, more performant point cloud rendering (#4203) by @Reese Gallagher 1044 + [rmodels] ADDED: `ExportMeshAsCode()` by @raysan5 1045 + [rmodels] REVIEWED: Multiple updates to gltf loading, improved macro (#4373) by @Harald Scheirich 1046 + [rmodels] REVIEWED: `LoadOBJ()`, correctly split obj meshes by material (#4285) by @Jeffm2501 1047 + [rmodels] REVIEWED: `LoadOBJ()`, add warning when loading an OBJ with multiple materials (#4271) by @Jeffm2501 1048 + [rmodels] REVIEWED: `LoadOBJ()`, fix bug that fragmented the loaded meshes (#4494) by @zet23t 1049 + [rmodels] REVIEWED: `LoadIQM()`, set model.meshMaterial[] (#4092) by @SuperUserNameMan 1050 + [rmodels] REVIEWED: `LoadIQM()`, attempt to load texture from IQM at loadtime (#4029) by @JettMonstersGoBoom 1051 + [rmodels] REVIEWED: `LoadM3D(), fix vertex colors for m3d files (#3859) by @Jeffm2501 1052 + [rmodels] REVIEWED: `LoadGLTF()`, supporting additional vertex data formats (#3546) by @MrScautHD 1053 + [rmodels] REVIEWED: `LoadGLTF()`, correctly handle the node hierarchy in a glTF file (#4037) by @Paul Melis 1054 + [rmodels] REVIEWED: `LoadGLTF()`, replaced SQUAD quat interpolation with cubic hermite (gltf 2.0 specs) (#3920) by @Benji 1055 + [rmodels] REVIEWED: `LoadGLTF()`, support 2nd texture coordinates loading by @raysan5 1056 + [rmodels] REVIEWED: `LoadGLTF()`, support additional vertex attributes data formats #3890 by @raysan5 1057 + [rmodels] REVIEWED: `LoadGLTF()`, set cgltf callbacks to use `LoadFileData()` and `UnloadFileData()` (#3652) by @kolunmi 1058 + [rmodels] REVIEWED: `LoadGLTF()`, JOINTS loading #3836 by @raysan5 1059 + [rmodels] REVIEWED: `LoadImageFromCgltfImage()`, fix base64 padding support (#4112) by @SuperUserNameMan 1060 + [rmodels] REVIEWED: `LoadModelAnimationsIQM()`, fix corrupted animation names (#4026) by @JettMonstersGoBoom 1061 + [rmodels] REVIEWED: `LoadModelAnimationsGLTF()`, load animations with 1 frame (#3804) by @Nikita Blizniuk 1062 + [rmodels] REVIEWED: `LoadModelAnimationsGLTF()`, added missing interpolation types (#3919) by @Benji 1063 + [rmodels] REVIEWED: `LoadModelAnimationsGLTF()` (#4107) by @VitoTringolo 1064 + [rmodels] REVIEWED: `LoadBoneInfoGLTF()`, add check for animation name being NULL (#4053) by @VitoTringolo 1065 + [rmodels] REVIEWED: `GenMeshSphere()`, fix artifacts (#4460) by @MikiZX1 1066 + [rmodels] REVIEWED: `GenMeshTangents()`, read uninitialized values, fix bounding case (#4066) by @kai-z99 1067 + [rmodels] REVIEWED: `GenMeshTangents()`, fixed out of bounds error (#3990) by @Salvador Galindo 1068 + [rmodels] REVIEWED: `UpdateModelAnimation()`, performance speedup (#4470) by @JettMonstersGoBoom 1069 + [rmodels] REVIEWED: `DrawCylinder()`, fix drawing due to imprecise angle (#4034) by @Paul Melis 1070 + [rmodels] REVIEWED: `DrawCylinder()`, fix drawing of cap (#4478) by @JeffM2501 1071 + [rmodels] REVIEWED: `DrawMesh()`, send full matModel to shader in DrawMesh (#4005) (#4022) by @David Holland 1072 + [rmodels] REVIEWED: `DrawMesh()`, fix material specular map retrieval (#3758) by @Victor Gallet 1073 + [rmodels] REVIEWED: `DrawModelEx()`, simplified multiplication of colors (#4002) by @Bigfoot71 1074 + [rmodels] REVIEWED: `DrawBillboardPro()`, to be consistend with `DrawTexturePro()` (#4132) by @bohonghuang 1075 + [rmodels] REVIEWED: `DrawSphereEx()` optimization (#4106) by @smalltimewizard 1076 + [raudio] REVIEWED: `LoadMusicStreamFromMemory()`, support 24-bit FLACs (#4279) by @konstruktor227 1077 + [raudio] REVIEWED: `LoadWaveSamples()`, fix mapping of wave data (#4062) by @ListeriaM 1078 + [raudio] REVIEWED: `LoadMusicStream()`, remove drwav_uninit() (#3986) by @FishingHacks 1079 + [raudio] REVIEWED: `LoadMusicStream()` qoa and wav loading (#3966) by @veins1 1080 + [raudio] REVIEWED: `ExportWaveAsCode()`, segfault (#3769) by @IoIxD 1081 + [raudio] REVIEWED: `WaveCrop()`, fix issues and use frames instead of samples (#3994) by @ListeriaM 1082 + [raudio] REVIEWED: Crash from multithreading issues (#3907) by @Christian Haas 1083 + [raudio] REVIEWED: Reset music.ctxType if loading wasn't succesful (#3917) by @veins1 1084 + [raudio] REVIEWED: Added missing functions in "standalone" mode (#3760) by @Alessandro Nikolaev 1085 + [raudio] REVIEWED: Disable unused miniaudio features (#3544) by @M374LX 1086 + [raudio] REVIEWED: Fix crash when switching playback device at runtime (#4102) by @jkaup 1087 + [raudio] REVIEWED: Support 24 bits samples for FLAC format (#4058) by @Alexey Kutepov 1088 + [examples] ADDED: `core_random_sequence` (#3846) by @Dalton Overmyer 1089 + [examples] ADDED: `core_input_virtual_controls` (#4342) by @oblerion 1090 + [examples] ADDED: `shapes_rectangle_advanced `, implementing `DrawRectangleRoundedGradientH()` (#4435) by @Everton Jr. 1091 + [examples] ADDED: `models_bone_socket` (#3833) by @iP 1092 + [examples] ADDED: `shaders_vertex_displacement` (#4186) by @Alex ZH 1093 + [examples] ADDED: `shaders_shadowmap` (#3653) by @TheManTheMythTheGameDev 1094 + [examples] REVIEWED: `core_2d_camera_platformer` by @raysan5 1095 + [examples] REVIEWED: `core_2d_camera_mouse_zoom`, use logarithmic scaling for a 2d zoom functionality (#3977) by @myQwil 1096 + [examples] REVIEWED: `core_input_gamepad_info`, all buttons displayed within the window (#4241) by @Asdqwe 1097 + [examples] REVIEWED: `core_input_gamepad_info`, show ps3 controller (#4040) by @Konrad Gutvik Grande 1098 + [examples] REVIEWED: `core_input_gamepad`, add drawing for generic gamepad (#4424) by @Asdqwe 1099 + [examples] REVIEWED: `core_input_gamepad`, add deadzone handling (#4422) by @Asdqwe 1100 + [examples] REVIEWED: `shapes_bouncing_ball` (#4226) by @Anthony Carbajal 1101 + [examples] REVIEWED: `shapes_following_eyes` (#3710) by @Hongyu Ouyang 1102 + [examples] REVIEWED: `shapes_draw_rectangle_rounded` by @raysan5 1103 + [examples] REVIEWED: `shapes_draw_ring`, fix other examples (#4211) by @kai-z99 1104 + [examples] REVIEWED: `shapes_lines_bezier` by @raysan5 1105 + [examples] REVIEWED: `textures_image_kernel` #3556 by @raysan5 1106 + [examples] REVIEWED: `text_input_box` (#4229) by @Anthony Carbajal 1107 + [examples] REVIEWED: `text_writing_anim` (#4230) by @Anthony Carbajal 1108 + [examples] REVIEWED: `models_billboard` by @raysan5 1109 + [examples] REVIEWED: `models_cubicmap` by @raysan5 1110 + [examples] REVIEWED: `models_point_rendering` by @raysan5 1111 + [examples] REVIEWED: `models_box_collisions` (#4224) by @Anthony Carbajal 1112 + [examples] REVIEWED: `models_skybox`, do not use HDR by default (#4115) by @Jeffm2501 1113 + [examples] REVIEWED: `shaders_basic_pbr` (#4225) by @Anthony Carbajal 1114 + [examples] REVIEWED: `shaders_palette_switch` by @raysan5 1115 + [examples] REVIEWED: `shaders_hybrid_render` (#3908) by @Yousif 1116 + [examples] REVIEWED: `shaders_lighting_instancing`, fix vertex shader (#4056) by @karl 1117 + [examples] REVIEWED: `shaders_raymarching`, add `raymarching.fs` for GLSL120 (#4183) by @CDM15y 1118 + [examples] REVIEWED: `shaders_shadowmap`, fix shaders for GLSL 1.20 (#4167) by @CDM15y 1119 + [examples] REVIEWED: `shaders_deferred_render` (#3655) by @JettMonstersGoBoom 1120 + [examples] REVIEWED: `shaders_basic_pbr` (#3621) by @afanolovcic 1121 + [examples] REVIEWED: `shaders_basic_pbr`, remove dependencies (#3649) by @TheManTheMythTheGameDev 1122 + [examples] REVIEWED: `shaders_basic_pbr`, added more comments by @raysan5 1123 + [examples] REVIEWED: `shaders_gpu_skinning`, to work with OpenGL ES 2.0 #4412 by @raysan5 1124 + [examples] REVIEWED: `shaders_model_shader`, use free camera (#4428) by @IcyLeave6109 1125 + [examples] REVIEWED: `audio_stream_effects` (#3618) by @lipx 1126 + [examples] REVIEWED: `audio_raw_stream` (#3624) by @riadbettole 1127 + [examples] REVIEWED: `audio_mixed_processor` (#4214) by @Anthony Carbajal 1128 + [examples] REVIEWED: `raylib_opengl_interop`, fix building on PLATFORM_DESKTOP_SDL (#3826) by @Peter0x44 1129 + [examples] REVIEWED: Update examples missing UnloadTexture() calls (#4234) by @Anthony Carbajal 1130 + [examples] REVIEWED: Added GLSL 100 and 120 shaders to lightmap example (#3543) by @Jussi Viitala 1131 + [examples] REVIEWED: Set FPS to always 60 in all exampels (#4235) by @Anthony Carbajal 1132 + [build] REVIEWED: Makefile by @raysan5 1133 + [build] REVIEWED: Makefile, fix wrong flag #3593 by @raysan5 1134 + [build] REVIEWED: Makefile, disable wayland by default (#4369) by @Anthony Carbajal 1135 + [build] REVIEWED: Makefile, VSCode, fix to support multiple .c files (#4391) by @Alan Arrecis 1136 + [build] REVIEWED: Makefile, fix -Wstringop-truncation warning (#4096) by @Peter0x44 1137 + [build] REVIEWED: Makefile, fix issues for RGFW on Linux/macOS (#3969) by @colleagueRiley 1138 + [build] REVIEWED: Makefile, update RAYLIB_VERSION (#3901) by @Belllg 1139 + [build] REVIEWED: Makefile, use mingw32-make for Windows (#4436) by @Asdqwe 1140 + [build] REVIEWED: Makefile, move CUSTOM_CFLAGS for better visibility (#4054) by @Lázaro Albuquerque 1141 + [build] REVIEWED: Makefile, update emsdk paths to latest versions by @raysan5 1142 + [build] REVIEWED: Makefile examples, align /usr/local with /src Makefile (#4286) by @Tchan0 1143 + [build] REVIEWED: Makefile examples, added `textures_image_kernel` (#3555) by @Sergey Zapunidi 1144 + [build] REVIEWED: Makefile examples (#4209) by @Anthony Carbajal 1145 + [build] REVIEWED: Makefile examples, to work on NetBSD (#4438) by @NishiOwO 1146 + [build] REVIEWED: Makefile examples, WebGL2 (OpenGL ES 3.0) backend flags #4330 by @raysan5 1147 + [build] REVIEWED: Makefile examples, web building (#4434) by @Asdqwe 1148 + [build] REVIEWED: build.zig, fix various issues around `-Dconfig` (#4398) by @Sage Hane 1149 + [build] REVIEWED: build.zig, fix type mismatch (#4383) by @yuval_dev 1150 + [build] REVIEWED: build.zig, minor fixes (#4381) by @Sage Hane 1151 + [build] REVIEWED: build.zig, fix @src logic and a few things (#4380) by @Sage Hane 1152 + [build] REVIEWED: build.zig, improve logic (#4375) by @Sage Hane 1153 + [build] REVIEWED: build.zig, issues (#4374) by @William Culver 1154 + [build] REVIEWED: build.zig, issues (#4366) by @Visen 1155 + [build] REVIEWED: build.zig, support desktop backend change (#4358) by @Not-Nik 1156 + [build] REVIEWED: build.zig, use zig fmt (#4242) by @freakmangd 1157 + [build] REVIEWED: build.zig, check if wayland-scanner is installed (#4217) by @lnc3l0t 1158 + [build] REVIEWED: build.zig, override config.h definitions (#4193) by @lnc3l0t 1159 + [build] REVIEWED: build.zig, support GLFW platform detection (#4150) by @InventorXtreme 1160 + [build] REVIEWED: build.zig, make emscripten build compatible with Zig 0.13.0 (#4121) by @myQwil 1161 + [build] REVIEWED: build.zig, pass the real build.zig file (#4113) by @InKryption 1162 + [build] REVIEWED: build.zig, leverage `dependencyFromBuildZig` (#4109) by @InKryption 1163 + [build] REVIEWED: build.zig, run examples from their directories (#4063) by @myQwil 1164 + [build] REVIEWED: build.zig, fix raygui build when using addRaygui externally (#4027) by @Viktor Pocedulić 1165 + [build] REVIEWED: build.zig, fix emscripten build (#4012) by @Dylan 1166 + [build] REVIEWED: build.zig, update to zig 0.12.0dev while keeping 0.11.0 compatibility (#3715) by @freakmangd 1167 + [build] REVIEWED: build.zig, drop support for 0.11.0 and use more idiomatic build script code (#3927) by @freakmangd 1168 + [build] REVIEWED: build.zig, sdd shared library build option and update to zig 0.12.0-dev.2139 (#3727) by @Andrew Lee 1169 + [build] REVIEWED: build.zig, add `opengl_version` option (#3979) by @Alexei Mozaidze 1170 + [build] REVIEWED: build.zig, fix local dependency break (#3913) by @freakmangd 1171 + [build] REVIEWED: build.zig, fix breaking builds for Zig v0.11.0 (#3896) by @iarkn 1172 + [build] REVIEWED: build.zig, update to latest version and simplify (#3905) by @freakmangd 1173 + [build] REVIEWED: build.zig, remove all uses of deps/mingw (#3805) by @Peter0x44 1174 + [build] REVIEWED: build.zig, fixed illegal instruction crash (#3682) by @WisonYe 1175 + [build] REVIEWED: build.zig, fix broken build on #3863 (#3891) by @Nikolas Mauropoulos 1176 + [build] REVIEWED: build.zig, improve cross-compilation (#4468) by @deathbeam 1177 + [build] REVIEWED: CMake, update to raylib 5.0 (#3623) by @Peter0x44 1178 + [build] REVIEWED: CMake, added PLATFORM option for Desktop SDL (#3809) by @mooff 1179 + [build] REVIEWED: CMake, fix GRAPHICS_* check (#4359) by @zyperpl 1180 + [build] REVIEWED: CMake, examples projects (#4332) by @Ridge3Dproductions 1181 + [build] REVIEWED: CMake, fix warnings in projects/CMake/CMakeLists.txt (#4278) by @Peter0x44 1182 + [build] REVIEWED: CMake, delete BuildOptions.cmake (#4277) by @Peter0x44 1183 + [build] REVIEWED: CMake, update version to 5.0 so libraries are correctly versioned (#3615) by @David Williams 1184 + [build] REVIEWED: CMake, improved linkage flags to save 28KB on the final bundle (#4177) by @Lázaro Albuquerque 1185 + [build] REVIEWED: CMake, support OpenGL ES3 in `LibraryConfigurations.cmake` (#4079) by @manuel5975p 1186 + [build] REVIEWED: CMake, `config.h` fully available to users (#4044) by @Lázaro Albuquerque 1187 + [build] REVIEWED: CMake, pass -sFULL_ES3 instead of -sFULL_ES3=1 (#4090) by @manuel5975p 1188 + [build] REVIEWED: CMake, SDL build link the glfw dependency (#3860) by @RobLoach 1189 + [build] REVIEWED: CMake, infer CMAKE_MODULE_PATH in super-build (#4042) by @fruzitent 1190 + [build] REVIEWED: CMake, remove USE_WAYLAND option (#3851) by @M374LX 1191 + [build] REVIEWED: CMake, disable SDL rlgl_standalone example (#3861) by @RobLoach 1192 + [build] REVIEWED: CMake, bump version required to avoid deprecated #3639 by @raysan5 1193 + [build] REVIEWED: CMake, fix examples linking -DPLATFORM=SDL (#3825) by @Peter0x44 1194 + [build] REVIEWED: CMake, don't build for wayland by default (#4432) by @Peter0x44 1195 + [build] REVIEWED: VS2022, misc improvements by @raysan5 1196 + [build] REVIEWED: VS2022, fix build warnings (#4095) by @Jeffm2501 1197 + [build] REVIEWED: VS2022, added new examples (#4492) by @Jeffm2501 1198 + [build] REVIEWED: Fix fix-build-paths (#3849) by @Caleb Barger 1199 + [build] REVIEWED: Fix build paths (#3835) by @Steve Biedermann 1200 + [build] REVIEWED: Fix VSCode sample project for macOS (#3666) by @Tim Romero 1201 + [build] REVIEWED: Fix some warnings on web builds and remove some redundant flags (#4069) by @Lázaro Albuquerque 1202 + [build] REVIEWED: Fix examples not building with gestures system disabled (#4020) by @Sprix 1203 + [build] REVIEWED: Fix GLFW runtime platform detection (#3863) by @M374LX 1204 + [build] REVIEWED: Fix DRM cross-compile without sysroot (#3839) by @Christian W. Zuckschwerdt 1205 + [build] REVIEWED: Fix cmake-built libraylib.a to properly include GLFW's object files (#3598) by @Peter0x44 1206 + [build] REVIEWED: Hide unneeded internal symbols when building raylib as an so or dylib (#3573) by @Peter0x44 1207 + [build] REVIEWED: Corrected the path of android ndk toolchains for OSX platforms (#3574) by @Emmanuel Méra 1208 + [build][CI] ADDED: Automatic update for raylib_api.* (#3692) by @seiren 1209 + [build][CI] REVIEWED: Update workflows to use latest actions/upload-artifact by @raysan5 1210 + [build][CI] REVIEWED: CodeQL minor tweaks to avoid some warnings by @raysan5 1211 + [build][CI] REVIEWED: Update linux_examples.yml by @raysan5 1212 + [build][CI] REVIEWED: Update linux.yml by @raysan5 1213 + [build][CI] REVIEWED: Update webassembly.yml by @raysan5 1214 + [build][CI] REVIEWED: Update cmake.yml by @raysan5 1215 + [build][CI] REVIEWED: Update codeql.yml, exclude src/external files by @raysan5 1216 + [bindings] ADDED: raylib-APL (#4253) by @Brian-ED 1217 + [bindings] ADDED: raylib-bqn, moved rayed-bqn (#4331) by @Brian-ED 1218 + [bindings] ADDED: brainfuck binding (#4169) by @_Tradam 1219 + [bindings] ADDED: raylib-zig-bindings (#4004) by @Lionel Briand 1220 + [bindings] ADDED: Raylib-CSharp wrapper (#3963) by @MrScautHD 1221 + [bindings] ADDED: COBOL binding (#3661) by @glowiak 1222 + [bindings] ADDED: raylib-beef binding (#3640) by @Braedon Lewis 1223 + [bindings] ADDED: Raylib-CSharp-Vinculum (#3571) by @Danil 1224 + [bindings] REVIEWED: Remove broken-link bindings #3899 by @raysan5 1225 + [bindings] REVIEWED: Updated some versions on BINDINGS.md by @raysan5 1226 + [bindings] REVIEWED: Removed umaintained repos (#3999) by @planetis-m 1227 + [bindings] REDESIGNED: Add binding link to name, instead of separate column (#3995) by @Carmine Pietroluongo 1228 + [bindings] UPDATED: h-raylib (#4378) by @Anand Swaroop 1229 + [bindings] UPDATED: Raylib.lean, to master version (#4337) by @Daniil Kisel 1230 + [bindings] UPDATED: raybit, to latest master (#4311) by @Alex 1231 + [bindings] UPDATED: dray binding (#4163) by @red thing 1232 + [bindings] UPDATED: Julia (#4068) by @ShalokShalom 1233 + [bindings] UPDATED: nim to latest master (#3999) by @planetis-m 1234 + [bindings] UPDATED: raylib-rs (#3991) by @IoIxD 1235 + [bindings] UPDATED: raylib-zig version (#3902) by @Not-Nik 1236 + [bindings] UPDATED: raylib-odin (#3868) by @joyousblunder 1237 + [bindings] UPDATED: Raylib VAPI (#3829) by @Alex Macafee 1238 + [bindings] UPDATED: Raylib-cs (#3774) by @Brandon Baker 1239 + [bindings] UPDATED: h-raylib (#3739) by @Anand Swaroop 1240 + [bindings] UPDATED: OCaml bindings version (#3730) by @Tobias Mock 1241 + [bindings] UPDATED: Raylib.c3 (#3689) by @Kenta 1242 + [bindings] UPDATED: ray-cyber to 5.0 (#3654) by @fubark 1243 + [bindings] UPDATED: raylib-freebasic binding (#3591) by @WIITD 1244 + [bindings] UPDATED: SmallBASIC (#3562) by @Chris Warren-Smith 1245 + [bindings] UPDATED: Python raylib-py v5.0.0beta1 (#3557) by @jorgegomes83 1246 + [bindings] UPDATED: raylib-d binding (#3561) by @schveiguy 1247 + [bindings] UPDATED: Janet (#3553) by @Dmitry Matveyev 1248 + [bindings] UPDATED: Raylib.nelua (#3552) by @AuzFox 1249 + [bindings] UPDATED: raylib-cpp to 5.0 (#3551) by @RobLoach 1250 + [bindings] UPDATED: Pascal binding (#3548) by @Gunko Vadim 1251 + [external] UPDATED: stb_truetype.h to latest version by @raysan5 1252 + [external] UPDATED: stb_image_resize2.h to latest version by @raysan5 1253 + [external] UPDATED: stb_image.h to latest version by @raysan5 1254 + [external] UPDATED: qoa.h to latest version by @raysan5 1255 + [external] UPDATED: dr_wav.h to latest version by @raysan5 1256 + [external] UPDATED: dr_mp3.h to latest version by @raysan5 1257 + [external] UPDATED: cgltf.h to latest version by @raysan5 1258 + [external] REVIEWED: rl_gputex, correctly load mipmaps from DDS files (#4399) by @Not-Nik 1259 + [external] REVIEWED: stb_image_resize2, dix vld1q_f16 undeclared in arm (#4309) by @masnm 1260 + [external] REVIEWED: miniaudio, fix library and Makefile for NetBSD (#4212) by @NishiOwO 1261 + [external] REVIEWED: raygui, update to latest version 4.5-dev (#4238) by @Anthony Carbajal 1262 + [external] REVIEWED: jar_xml, replace unicode characters by ascii characters to avoid warning in MSVC (#4196) by @RicoP 1263 + [external] REVIEWED: vox_loader, normals and new voxels shader (#3843) by @johann nadalutti 1264 + [parser] REVIEWED: README.md, to mirror fixed help text (#4336) by @Daniil Kisel 1265 + [parser] REVIEWED: Fix seg fault with long comment lines (#4306) by @Chris Warren-Smith 1266 + [parser] REVIEWED: Don't crash for files that don't end in newlines (#3981) by @Peter0x44 1267 + [parser] REVIEWED: Issues in usage example help text (#4084) by @Peter0x44 1268 + [parser] REVIEWED: Fix parsing of empty parentheses (#3974) by @Filyus 1269 + [parser] REVIEWED: Address parsing issue when generating XML #3893 by @raysan5 1270 + [parser] REVIEWED: `MemoryCopy()`, prevent buffer overflow by replacing hard-coded arguments (#4011) by @avx0 1271 + [misc] ADDED: Create logo/raylib.icns by @raysan5 1272 + [misc] ADDED: Create logo/raylib_1024x1024.png by @raysan5 1273 + [misc] ADDED: Default vertex/fragment shader for OpenGL ES 3.0 (#4178) by @Lázaro Albuquerque 1274 + [misc] REVIEWED: README.md, fix Reddit badge (#4136) by @Ninad Sachania 1275 + [misc] REVIEWED: .gitignore, ignore compiled dll binaries (#3628) by @2Bear 1276 + [misc] REVIEWED: Fix undesired scrollbars on web shell files (#4104) by @jspast 1277 + [misc] REVIEWED: Made comments on raylib.h match comments in rcamera.h (#3942) by @Tomas Fabrizio Orsi 1278 + [misc] REVIEWED: Make raylib/raygui work better on touchscreen (#3728) by @Hongyu Ouyang 1279 + [misc] REVIEWED: Update config.h by @raysan5 1280 + 1281 + ------------------------------------------------------------------------- 1282 + Release: raylib 5.0 - 10th Anniversary Edition (18 November 2023) 1283 + ------------------------------------------------------------------------- 1284 + KEY CHANGES: 1285 + - REDESIGNED: rcore module platform-split, by @ubkp, @michaelfiber, @Bigfoot71, @raysan5 1286 + - ADDED: New platform backend supported: SDL 1287 + - ADDED: New platform backend supported: Nintendo Switch (closed source) 1288 + - ADDED: New Splines drawing and evaluation API 1289 + - ADDED: New pseudo-random numbers generator: rprand 1290 + - ADDED: Automation Events System API 1291 + - UPDATED: raygui 4.0: New version of this immediate-mode gui system for tools development with raylib 1292 + 1293 + Detailed changes: 1294 + [rcore] ADDED: RAYLIB_VERSION_* values to raylib.h (#2856) by @RobLoach 1295 + [rcore] ADDED: IsKeyPressedRepeat() on PLATFORM_DESKTOP (#3245) by @actondev 1296 + [rcore] ADDED: SetWindowTitle() for PLATFORM_WEB (#3222) by @VitusVeit 1297 + [rcore] ADDED: FLAG_WINDOW_RESIZABLE for web (#3305) by @Peter0x44 1298 + [rcore] ADDED: SetWindowMaxSize() for desktop and web (#3309) by @ubkp 1299 + [rcore] ADDED: SetMouseCursor() for PLATFORM_WEB (#3414) by @BeardedBread 1300 + [rcore] ADDED: LoadRandomSequence()/UnloadRandomSequence() by @raysan5 1301 + [rcore] REMOVED: PLATFORM_RPI (#3232) by @michaelfiber 1302 + [rcore] REVIEWED: GetFileLength(), added comment (#3262) by @raysan5 1303 + [rcore] REVIEWED: Default shaders precission issue on PLATFORM_WEB (#3261) by @branc116 1304 + [rcore] REVIEWED: IsKey*() key validation checks (#3256) by @n77y 1305 + [rcore] REVIEWED: SetClipboardText() for PLATFORM_WEB (#3257) by @ubkp 1306 + [rcore] REVIEWED: Check if Ctrl modifier is among the currently set modifiers (#3230) by @mohad12211 1307 + [rcore] REVIEWED: Android app black screen when reopening by @Bigfoot71 1308 + [rcore] REVIEWED: Warnings when casting int to floats (#3218) by @JeffM2501 1309 + [rcore] REVIEWED: GetCurrentMonitor() detection inconsistency issue (#3215) by @ubkp 1310 + [rcore] REVIEWED: SetWindowMonitor() to no longer force fullscreen (#3209) by @ubkp 1311 + [rcore] REVIEWED: Fix mouse wheel not working in PLATFORM_RPI or PLATFORM_DRM (#3193) by @ubkp 1312 + [rcore] REVIEWED: GetMonitorName() description (#3184) (#3189) by @danilwhale 1313 + [rcore] REVIEWED: BeginScissorMode(), identify rendering to texture (#3510) by @gulrak 1314 + [rcore] REVIEWED: Window flags order (#3114) by @lesleyrs 1315 + [rcore] REVIEWED: Full movement for right analog stick (#3095) by @PixelPhobicGames 1316 + [rcore] REVIEWED: Fix Android app freeze after calling CloseWindow() (#3067) by @Bigfoot71 1317 + [rcore] REVIEWED: Lazy loading of default font used on image drawing (no InitWindow) by @raysan5 1318 + [rcore] REVIEWED: Minor tweaks to raylib events automation system @raysan5 1319 + [rcore] REVIEWED: GetCurrentMonitor() bugfix (#3058) by @hamyyy 1320 + [rcore] REVIEWED: Update CORE.Input.Touch.pointCount (#3024) by @raysan5 1321 + [rcore] REVIEWED: Mouse offset and scaling must be considered also on web! 1322 + [rcore] REVIEWED: CompressData(), possible stack overflow 1323 + [rcore] REVIEWED: GetWorldToScreenEx() (#3351) by @Brian-ED 1324 + [rcore] REVIEWED: Fix GetMouseDelta() issue for Android (#3404) by @Bigfoot71 1325 + [rcore] REVIEWED: GetFPS(), reset FPS averages when window is inited (#3445) by @JeffM2501 1326 + [rcore] REVIEWED: GetCurrentMonitor(), check window center position by @M374LX 1327 + [rcore] REVIEWED: GetRender*() issue on macOS highDPI (#3367) by @raysan5 1328 + [rcore] REVIEWED: ScanDirectoryFiles*(), paths building slashes sides (#3507) 1329 + [rlgl] ADDED: Experimental support for OpenGL ES 3.0 by @raysan5 1330 + [rlgl] ADDED: Support 16-Bit HDR textures (#3220) by @Not-Nik 1331 + [rlgl] ADDED: rlEnablePointMode() (#3490) by @JettMonstersGoBoom 1332 + [rlgl] ADDED: rlBlitFramebuffer(), required for deferred render 1333 + [rlgl] REVIEWED: LoadModel(), removed cube fallback mechanism (#3459) 1334 + [rlgl] REVIEWED: Improved support for ES3/WebGL2 (#3107) by @chemaguerra 1335 + [rlgl] REVIEWED: OpenGL 2.1 half floats support as part of an extension by @Not-Nik 1336 + [rlgl] REVIEWED: Avoid shader attribute not found log by @raysan5 1337 + [rlgl] REVIEWED: Avoid tracelog about not found uniforms (#3003) by @raysan5 1338 + [rlgl] REVIEWED: rLoadTexture() UBSAN complaints #1891 (#3321) by @Codom 1339 + [rlgl] REVIEWED: glInternalFormat as unsigned int 1340 + [rlgl] REVIEWED: OpenGL ES 3.0 support 1341 + [rshapes] ADDED: Spline drawing functions by @raysan5 1342 + [rshapes] ADDED: GetSplinePoint*() functions for spline evaluation by @raysan5 1343 + [rshapes] ADDED: DrawCircleLinesV() for consistency (#3452) by @Peter0x44 1344 + [rshapes] REVIEWED: DrawSplineCatmullRom() by @raysan5 1345 + [rshapes] REVIEWED: Minor fix in DrawLineBezier* (#3006) by @eternalStudent 1346 + [rshapes] REVIEWED: GetCollisionRec(), more performant (#3052) by @manuel5975p 1347 + [rshapes] REVIEWED: Fix off-by-one error in CheckCollisionPointRec() (#3022) by @dbechrd 1348 + [rtextures] ADDED: Basic SVG loading support (#2738) by @bXi 1349 + [rtextures] ADDED: Support 16-Bit HDR textures (#3220) by @Not-Nik 1350 + [rtextures] ADDED: ExportImageToMemory() by @raysan5 1351 + [rtextures] ADDED: ImageRotate() (#3078) by @danemadsen 1352 + [rtextures] ADDED: GenImageGradientSquare() (#3077) by @danemadsen 1353 + [rtextures] ADDED: GenImageLinearGradient() by @danemadsen 1354 + [rtextures] REMOVED: GenImageGradientH() and GenImageGradientV() by @danemadsen 1355 + [rtextures] REVIEWED: LoadImageSvg() by @raysan5 1356 + [rtextures] REVIEWED: Uninitialized thread-locals in stbi (#3282) (#3283) by @jbarthelmes 1357 + [rtextures] REVIEWED: ImageDrawRectangleRec(), validate drawing inside bounds by @JeffM2501 1358 + [rtextures] REVIEWED: LoadTextureCubemap() for manual layouts (#3204) by @Not-Nik 1359 + [rtextures] REVIEWED: Optimization of ImageDrawRectangleRec() (#3185) by @smalltimewizard 1360 + [rtextures] REVIEWED: ImageRotate() formatting by @raysan5 1361 + [rtextures] REVIEWED: GenImagePerlinNoise(), clamp values (#3071) by @raysan5 1362 + [rtextures] REVIEWED: Packing logic error in GenImageFontAtlas() (#2979) by @hanaxar 1363 + [rtextures] REVIEWED: Calculate exact image size in GenImageFontAtlas() (#2963) by @hanaxar 1364 + [rtextures] REVIEWED: ImageDrawRectangleRec() (#3027) by @raysan5 1365 + [rtextures] REVIEWED: ImageDraw() source clipping when drawing beyond top left (#3306) by @RobLoach 1366 + [rtextures] REVIEWED: UnloadRenderTexture(), additional checks 1367 + [rtextures] REVIEWED: Fixed compressed DDS texture loading issues (#3483) by @JaanDev 1368 + [rtext] ADDED: Font altas white rectangle and flag SUPPORT_FONT_ATLAS_WHITE_REC by @raysan5 1369 + [rtext] ADDED: SetTextLineSpacing() to define line breaks text drawing spacing by @raysan5 1370 + [rtext] RENAMED: LoadFont*() parameter names for consistency and coherence by @raysan5 1371 + [rtext] REVIEWED: GetCodepointCount(), ignore unused return value of GetCodepointNext by @ashn-dot-dev 1372 + [rtext] REVIEWED: TextFormat() warn user if buffer overflow occurred (#3399) by @Murlocohol 1373 + [rtext] REVIEWED: TextFormat(), added "..." for truncation (#3366) by @raysan5 1374 + [rtext] REVIEWED: GetGlyphIndex() (#3000) by @raysan5 1375 + [rtext] REVIEWED: GetCodepointNext() to return default value by @chocolate42 1376 + [rtext] REVIEWED: TextToPascal() issue when first char is uppercase 1377 + [rmodels] ADDED: ModelAnimation.name field, initially with GLTF animation names by @alfredbaudisch 1378 + [rmodels] REDESIGNED: LoadOBJ(), avoid mesh splitting by materials, fix (#3398) by @raysan5 1379 + [rmodels] REVIEWED: Support .vox model files version 200 (#3097) by @Bigfoot71 1380 + [rmodels] REVIEWED: Materials loading (#3126) @raysan5 1381 + [rmodels] REVIEWED: DrawBillboardPro() to allow source of negative size (#3197) by @bohonghuang 1382 + [rmodels] REVIEWED: glTF loading segfault in animNormals memcpy by @charles-l 1383 + [rmodels] REVIEWED: LoadModelAnimationsGLTF(), free fileData after use (#3065) by @crynux 1384 + [rmodels] REVIEWED: GenMeshCubicmap(), correction of values (#3032) by @Bigfoot71 1385 + [rmodels] REVIEWED: DrawMesh() to avoid UBSAN complaining (#1891) 1386 + [rmodels] REVIEWED: GenMeshPlane() when resX != resZ (#3425) by @neyrox, @s-yablonskiy 1387 + [rmodels] REVIEWED: GetModelBoundingBox() (#3485) 1388 + [raudio] ADDED: LoadSoundAlias() by @JeffM2501 1389 + [raudio] ADDED: Missing structure on standalone mode (#3160) by @raysan5 1390 + [raudio] ADDED: GetMasterVolume() (#3434) by @rexim 1391 + [raudio] REVIEWED: Comments about sample format to AttachAudioStreamProcessor() (#3188) by @AlbertoGP 1392 + [raudio] REVIEWED: Documented buffer format for audio processors (#3186) by @AlbertoGP 1393 + [raudio] REVIEWED: ExportWaveAsCode() file saving by @RadsammyT 1394 + [raudio] REVIEWED: Fix warning on discarded const qualifier (#2967) by @RobLoach 1395 + [raudio] REVIEWED: Move mutex initialization before ma_device_start() (#3325) by @Bigfoot71 1396 + [raudio] REVIEWED: Fix UpdateSound() parameter name (#3405) by @KislyjKisel 1397 + [raudio] REVIEWED: Fix QOA seeking (#3494) by @veins1 1398 + [rcamera] REVIEWED: File-macros for consistency (#3161) by @raysan5 1399 + [rcamera] REVIEWED: Support analog stick camera controls (#3066) by @PixelPhobicGames 1400 + [rcamera] REVIEWED: CameraMoveToTarget(), ensure distance is greater than 0 (#3031) by @kolunmi 1401 + [rcamera] REVIEWED: Exposing rcamera functions to the dll (#3355) by @JeffM2501 1402 + [raymath] ADDED: Vector3Projection() and Vector3Rejection() (#3263) by @Dial0 1403 + [raymath] ADDED: EPSILON macro to each function requiring it (#3330) by @Brian-ED 1404 + [raymath] REVIEWED: Usage of 'sinf()' and 'cosf()' to be correct (#3181) by @RokasPuzonas 1405 + [raymath] REVIEWED: Slightly optimized Vector3Normalize() (#2982) by @RicoP 1406 + [raymath] REVIEWED: Comment to clarify raymath semantics by @raysan5 1407 + [raymath] REVIEWED: Comment about Matrix conventions by @raysan5 1408 + [raymath] REVIEWED: Vector2Angle() and Vector2LineAngle() (#3396) by @Murlocohol 1409 + [rgestures] REVIEWED: Optimize and simplify the gesture system (#3190) by @ubkp 1410 + [rgestures] REVIEWED: GESTURE_DRAG and GESTURE_SWIPE_* issues (mostly) for web (#3183) by @ubkp 1411 + [rgestures] REVIEWED: Touch pointCount for web (#3163) by @ubkp 1412 + [rgestures] REVIEWED: IsGestureDetected() parameter type 1413 + [utils] ADDED: Security checks to file reading (memory allocations) by @raysan5 1414 + [utils] REVIEWED: LoadFileData() potential issues with dataSize 1415 + [examples] ADDED: shaders_lightmap (#3043) by @nullstare 1416 + [examples] ADDED: core_2d_camera_split_screen (#3298) by @gabrielssanches 1417 + [examples] ADDED: LoadSoundAlias() usage example (#3223) by @JeffM2501 1418 + [examples] ADDED: textures_tiling (#3353) by @luis605 1419 + [examples] ADDED: shader_deferred_render (#3496) by @27justin 1420 + [examples] RENAMED: 2d_camera examples for consistency 1421 + [examples] REVIEWED: Text examples SetTextLineSpacing() to multiline examples by @raysan5 1422 + [examples] REVIEWED: examples/shapes/shapes_collision_area.c help instructions (#3279) by @asdqwe 1423 + [examples] REVIEWED: examples/shaders/shaders_texture_outline.c help instructions (#3278) by @asdqwe 1424 + [examples] REVIEWED: examples/others/easings_testbed.c help instructions and small twe… by @asdqwe 1425 + [examples] REVIEWED: example/audio/audio_module_player.c help instructions and small b… by @asdqwe 1426 + [examples] REVIEWED: example/models/models_loading_m3d.c controls (#3269) by @asdqwe 1427 + [examples] REVIEWED: example/models/models_loading_gltf.c controls (#3268) by @asdqwe 1428 + [examples] REVIEWED: text_unicode.c example crashing (#3250) by @ubkp 1429 + [examples] REVIEWED: rlgl_standalone.c compilation issue (#3242) by @ubkp 1430 + [examples] REVIEWED: core_input_gestures for Web (#3172) by @ubkp 1431 + [examples] REVIEWED: core_input_gamepad (#3110) by @iacore 1432 + [examples] REVIEWED: examples using raygui to raygui 4.0 by @raysan5 1433 + [examples] REVIEWED: Julia set shader example (#3467) by @joshcol9232 1434 + [build] ADDED: CMake option for SUPPORT_CUSTOM_FRAME_CONTROL (#3221) by @ubkp 1435 + [build] ADDED: New BORDERLESS_WINDOWED_MODE for PLATFORM_DESKTOP (#3216) by @ubkp 1436 + [build] ADDED: New examples to VS2022 solution by @raysan5 1437 + [build] REVIEWED: Updated Makefile and Makefile.Web, include new examples 1438 + [build] REVIEWED: Fix CMake extraneous -lglfw (#3266) by @iacore 1439 + [build] REVIEWED: Add missing cmake options (#3267) by @asdqwe 1440 + [build] REVIEWED: Match CMakeOptions.txt options default values (#3258) by @asdqwe 1441 + [build] REVIEWED: Add build.zig options for individual modules (#3254) by @actondev 1442 + [build] REVIEWED: build.zig to work with cross-compiling (#3225) by @yujiri8 1443 + [build] REVIEWED: Makefile build on PLATFORM_ANDROID, soname (#3211) by @ndytts 1444 + [build] REVIEWED: src/Makefile, fix misleading indentation (#3202) by @ashn-dot-dev 1445 + [build] REVIEWED: build.zig: Support for building with PLAFORM_DRM (#3191) by @jakubvf 1446 + [build] REVIEWED: Update CMakeOptions.txt by @raysan5 1447 + [build] REVIEWED: fix: cmake option "OPENGL_VERSION" doesn't work (#3170) by @royqh1979 1448 + [build] REVIEWED: Add error if raylib.h is included in a C++98 program (#3093) by @Peter0x44 1449 + [build] REVIEWED: Cross compilation for PLATFORM_DRM (#3091) by @TheLastBilly 1450 + [build] REVIEWED: build.zigm fixed cross-compiling from Linux (#3090)by @yujiri8 1451 + [build] REVIEWED: Enhanced cmake part for OpenBSD (#3086) by @rayit 1452 + [build] REVIEWED: Fixed compile on OpenBSD (#3085)by @rayit 1453 + [build] REVIEWED: CMake project example: fix a couple of typos (#3014) by @benjamin-thomas 1454 + [build] REVIEWED: Fix warnings in raylib for MSVC (#3004) by @JeffM2501 1455 + [build] REVIEWED: Update cmake example project (#3062) by @lesleyrs 1456 + [build] REVIEWED: Update build.zig be be able to build with current zig master (#3064) by @ryupold 1457 + [build] REVIEWED: VSCode project template (#3048) by @Shoozza 1458 + [build] REVIEWED: Fixed broken build.zig files. Now works with latest stable compiler (… by @Gamer-Kold 1459 + [build] REVIEWED: Fix missing symbol when rglfw.c on BSD platforms (#2968) by @Koromix 1460 + [build] REVIEWED: Update Makefile comment to indicate arm64 as a supported Linux deskto… @ashn-dot-dev 1461 + [build] REVIEWED: Update Makefile : clean raygui.c & physac.c (#3296) by @SuperUserNameMan 1462 + [build] REVIEWED: Update webassembly.yml and linux.yml 1463 + [build] REVIEWED: Update zig build system to zig version 0.11.0 (#3393) by @purple4pur 1464 + [build] REVIEWED: Fix for latest zig master (#3037) by @star-tek-mb 1465 + [build] REVIEWED: Examples Makefile to use Makefile.Web when building for web (#3449) by @keithstellyes 1466 + [build] REVIEWED: build.zig updates for 0.11.0 release. (#3501) by @cabarger 1467 + [build] REVIEWED: Support OpenGL ES 3.0 building on Web platform 1468 + [build] REVIEWED: Fix warnings in Visual Studio (#3512) by @JeffM2501 1469 + [build] REVIEWED: OpenGL ES 3.0 flags on CMakeOptions (#3514) by @awfulcooking 1470 + [bindings] ADDED: fortran-raylib 1471 + [bindings] ADDED: raylib-raku to bindings (#3299) by @vushu 1472 + [bindings] ADDED: claw-raylib to BINDINGS.md (#3310) by @bohonghuang 1473 + [bindings] ADDED: vaiorabbit/raylib-bindings (#3318) by @wilsonsilva 1474 + [bindings] ADDED: TurboRaylib (#3317) by @turborium 1475 + [bindings] ADDED: raylib-ffi to bindings list (#3164) by @ewpratten 1476 + [bindings] ADDED: raylib-pkpy-bindings (#3361) by @blueloveTH 1477 + [bindings] ADDED: Raylib.lean to BINDINGS.md (#3409) by @KislyjKisel 1478 + [bindings] UPDATED: BINDINGS.md (#3217) by @joseph-montanez 1479 + [bindings] UPDATED: BINDINGS.md to include rayjs (#3212) by @mode777 1480 + [bindings] UPDATED: latest h-raylib version (#3166) by @Anut-py 1481 + [bindings] UPDATED: bindbd-raylib3 to raylib 4.5 (#3157) by @o3o 1482 + [bindings] UPDATED: Janet bindings supported version update (#3083)by @archydragon 1483 + [bindings] UPDATED: BINDINGS.md (raylib-py -> 4.5) (#2992) by @overdev 1484 + [bindings] UPDATED: BINDINGS.md (raylib-lua -> 4.5) (#2989) by @TSnake41 1485 + [bindings] UPDATED: raylib-d binding version to 4.5 (#2988) by @schveiguy 1486 + [bindings] UPDATED: raylib-freebasic to 4.5 (#2986) by @WIITD 1487 + [bindings] UPDATED: BINDINGS.md (#2983) by @jarroddavis68 1488 + [bindings] UPDATED: BINDINGS.md for raylib Odin 4.5 (#2981) by @gingerBill 1489 + [bindings] UPDATED: BINDINGS.md (#2980) by @GuvaCode 1490 + [bindings] UPDATED: BINDINGS.md (#3002) by @fubark 1491 + [bindings] UPDATED: BINDINGS.md (#3053) by @JupiterRider 1492 + [bindings] UPDATED: BINDINGS.md (#3050) by @Its-Kenta 1493 + [bindings] UPDATED: CL bindings version (#3049) by @shelvick 1494 + [bindings] UPDATED: BINDINGS.md (#3026) by @ChrisDill 1495 + [bindings] UPDATED: BINDINGS.md (#3023) by @sDos280 1496 + [bindings] UPDATED: BINDINGS.md (#3017) by @Soutaisei 1497 + [bindings] UPDATED: Various versions to 4.5 (#2974) by @RobLoach 1498 + [bindings] UPDATED: raylib.zig version to 4.5 (#2971) by @ryupold 1499 + [bindings] UPDATED: h-raylib version (#2970) by @Anut-py 1500 + [bindings] UPDATED: Factor's raylib binding to v4.5 (#3350) by @WraithGlade 1501 + [bindings] UPDATED: raylib-ocaml bindings to 4.5 version (#3322) by @tjammer 1502 + [bindings] UPDATED: Jaylib binding (#3508) by @glowiak 1503 + [external] UPDATED: sdefl and sinfl DEFLATE compression libraries by @raysan5 1504 + [external] UPDATED: miniaudio v0.11.12 --> v0.11.19 by @raysan5 1505 + [external] UPDATED: rl_gputex.h compressed images loading library by @raysan5 1506 + [external] UPDATED: Replaced stb_image_resize.c by stb_image_resize2.h (#3403) by @BabakSamimi 1507 + [external] UPDATED: qoi and qoa libraries 1508 + [external] UPDATED: stb libraries (required ones) 1509 + [external] UPDATED: cgltf and m3d libraries 1510 + [external] REVIEWED: msf_gif.h, some warnings 1511 + [external] REVIEWED: sinfl external library to avoid ASAN complaints (#3349) by @raysan5 1512 + [misc] ADDED: New task point to issue template about checking the wiki (#3169) by @ubkp 1513 + [misc] ADDED: CodeQL for static code analysis (#3476) by @b4yuan 1514 + [misc] REVIEWED: Update FAQ.md by @raysan5 1515 + [misc] REVIEWED: Potential code issues reported by CodeQL (#3476) 1516 + [misc] REVIEWED: Fix a link in the FAQ (#3082)by @jasonliang-dev 1517 + [misc] REVIEWED: New file formats to FAQ (#3079) by @Luramoth 1518 + [misc] REVIEWED: Make assets loading extension case insensitive #3008 by @raysan5 1519 + [misc] REVIEWED: Updated web shells open-graph info by @raysan5 1520 + 1521 + ------------------------------------------------------------------------- 1522 + Release: raylib 4.5 (18 March 2023) 1523 + ------------------------------------------------------------------------- 1524 + KEY CHANGES: 1525 + - ADDED: Improved ANGLE support on Desktop platforms 1526 + - ADDED: rcamera module, simpler and more extendable 1527 + - ADDED: Support for M3D models and M3D/GLTF animations 1528 + - ADDED: Support QOA audio format (import/export) 1529 + - ADDED: rl_gputex module for compressed textures loading 1530 + - REDESIGNED: rlgl module for automatic render-batch limits checking 1531 + - REDESIGNED: rshapes module to minimize the rlgl dependency 1532 + 1533 + Detailed changes: 1534 + [core] ADDED: RAYLIB_VERSION_* values to raylib.h (#2856) by @RobLoach 1535 + [core] ADDED: Basic gamepad support for Android (#2709) by @deniska 1536 + [core] ADDED: Support CAPS/NUM lock keys registering if locked 1537 + [core] ADDED: _GNU_SOURCE define on Linux (#2729) 1538 + [core] ADDED: SetWindowIcons() to set multiple icon image sizes 1539 + [core] `WARNING`: RENAMED: Exported raylib version symbol to raylib_version #2671 1540 + [core] REMOVED: Touch points on touch up events on Android (#2711) by @deniska 1541 + [core] REVIEWED: Window position setup on InitWindow() (#2732) by @RandomErrorMessage 1542 + [core] REVIEWED: Touchscreen input related functions on Android (#2702) by @deniska 1543 + [core] REVIEWED: Viewport scaling on Android after context rebind (#2703) by @deniska 1544 + [core] REVIEWED: ScanDirectoryFilesRecursively() (#2704) 1545 + [core] REVIEWED: Gamepad mappings with latest gamecontrollerdb (#2725) 1546 + [core] REVIEWED: Monitor order check on app initialization 1547 + [core] REVIEWED: Application monitor when opening (#2728, #2731) by @RandomErrorMessage 1548 + [core] REVIEWED: Gestures module to use GetTime() if available (#2733) by @RobLoach 1549 + [core] REVIEWED: Resolve GLFW3 some symbols re-definition of windows.h in glfw3native (#2643) by @daipom 1550 + [core] REVIEWED: OpenURL(), string buffer too short sometimes 1551 + [core] REVIEWED: GetRandomValue() range limit warning (#2800) by @Pere001 1552 + [core] REVIEWED: UnloadDirectoryFiles() 1553 + [core] REVIEWED: GetKeyPressed(), out of range issue (#2814) by @daipom 1554 + [core] REVIEWED: GetTime(), renamed variable 'time' to 'nanoSeconds' (#2816) by @jtainer 1555 + [core] REVIEWED: LoadShaderFromMemory(), issue with shader linkage 1556 + [core] REVIEWED: Avoid possible gamepad index as -1 (#2839) 1557 + [core] REVIEWED: SetShaderValue*(), avoid setup uniforms for invalid locations 1558 + [core] REVIEWED: GetClipboardText() on PLATFORM_WEB, permissions issues 1559 + [core] REVIEWED: Initial window position for display-sized fullscreen (#2742) by @daipom 1560 + [core] REVIEWED: Sticky touches input (#2857) by @ImazighenGhost 1561 + [core] REVIEWED: Enable GetWindowHandle() on macOS (#2915) by @Not-Nik 1562 + [core] REVIEWED: Window position always inits centered in current monitor 1563 + [core] REVIEWED: IsWindowFocused() to consider Android App state (#2935) 1564 + [core] REVIEWED: GetMonitorWidth() and GetMonitorHeight() (#2934) 1565 + [core] REVIEWED: GetWindowHandle() to return Linux window (#2938) 1566 + [core] REVIEWED: WindowDropCallback(), additional security check (#2943) 1567 + [core] REVIEWED: Security checks for emscripten_run_script() (#2954) 1568 + [utils] REVIEWED: TraceLog() message size limit overflow 1569 + [rcamera] REDESIGNED: New implementation from scratch (#2563) by @Crydsch 1570 + [rcamera] REVIEWED: Make orbital camera work as expected (#2926) by @JeffM2501 1571 + [rcamera] REVIEWED: Multiple reviews on the new implementation 1572 + [rcamera] ADDED: UpdateCameraPro(), supporting custom user inputs 1573 + [rlgl] ADDED: OpenGL ES 2.0 support on PLATFORM_DESKTOP (#2840) by @wtnbgo 1574 + [rlgl] ADDED: Separate blending modes for color and alpha, BLEND_CUSTOM_SEPARATE (#2741) 1575 + [rlgl] ADDED: rlSetBlendFactorsSeparate and custom blend mode modification checks (#2741) by @pure01fx 1576 + [rlgl] ADDED: RL_TEXTURE_MIPMAP_BIAS_RATIO support to `rlTextureParameters()` for OpenGL 3.3 #2674 1577 + [rlgl] ADDED: rlCubemapParameters() (#2862) by @GithubPrankster 1578 + [rlgl] ADDED: rlSetCullFace() (#2797) by @jtainer 1579 + [rlgl] REMOVED: Mipmaps software generation for OpenGL 1.1 1580 + [rlgl] REVIEWED: Check for extensions before enabling them (#2706) by @Not-Nik 1581 + [rlgl] REVIEWED: SSBO usage to avoid long long data types 1582 + [rlgl] REVIEWED: Enable DXT compression on __APPLE__ targets (#2694) by @Not-Nik 1583 + [rlgl] REVIEWED: enums exposed and description comments 1584 + [rlgl] REVIEWED: rlBindImageTexture(), correct data types (#2808) by @planetis-m 1585 + [rlgl] REVIEWED: rlMultMatrixf(), use const pointer (#2807) by @planetis-m 1586 + [rlgl] REVIEWED: Expose OpenGL blending mode factors and functions/equations 1587 + [rlgl] REVIEWED: rLoadTextureDepth(), issue with depth textures on WebGL (#2824) 1588 + [rlgl] REVIEWED: rlUnloadFramebuffer() (#2937) 1589 + [raymath] ADDED: Vector2LineAngle() (#2887) 1590 + [raymath] REVIEWED: Vector2Angle() (#2829, #2832) by @AlxHnr, @planetis-m 1591 + [shapes] ADDED: CheckCollisionPointPoly() (#2685) by @acejacek 1592 + [shapes] REVIEWED: DrawPixel*(), use RL_QUADS/RL_TRIANGLES (#2750) by @hatkidchan 1593 + [shapes] REVIEWED: DrawLineBezier*(), fix bezier line breaking (#2735, #2767) by @nobytesgiven 1594 + [textures] ADDED: ColorBrightness() 1595 + [textures] ADDED: ColorTint() 1596 + [textures] ADDED: ColorContrast() 1597 + [textures] ADDED: Support for PNM images (.ppm, .pgm) 1598 + [textures] ADDED: GenImagePerlinNoise() 1599 + [textures] ADDED: GenImageText(), generate grayscale image from text byte data 1600 + [textures] ADDED: ImageDrawCircleLines(), ImageDrawCircleLinesV() (#2713) by @RobLoach 1601 + [textures] ADDED: ImageBlurGaussian() (#2770) by @nobytesgiven 1602 + [textures] REVIEWED: Image fileformat support: PIC, PNM 1603 + [textures] REVIEWED: ImageTextEx() and ImageDrawTextEx() scaling (#2756) by @hatkidchan 1604 + [textures] `WARNING`: REMOVED: DrawTextureQuad() 1605 + [textures] `WARNING`: REMOVED: DrawTexturePoly(), function moved to example: `textures_polygon` 1606 + [textures] `WARNING`: REMOVED: DrawTextureTiled(),function implementation moved to the textures_tiled.c 1607 + [text] ADDED: GetCodepointPrevious() 1608 + [text] ADDED: UnloadUTF8(), aligned with LoadUTF8() 1609 + [text] `WARNING`: RENAMED: TextCodepointsToUTF8() to LoadUTF8() 1610 + [text] `WARNING`: RENAMED: GetCodepoint() -> GetCodepointNext() 1611 + [text] REDESIGNED: GetCodepointNext() 1612 + [text] REVIEWED: MeasureTextEx(), avoid crash on bad data 1613 + [text] REVIEWED: UnloadFontData(), avoid crash on invalid font data 1614 + [models] ADDED: Support M3D model file format (meshes and materials) (#2648) by @bztsrc 1615 + [models] ADDED: Support for M3D animations (#2648) by @bztsrc 1616 + [models] ADDED: GLTF animation support (#2844) by @charles-l 1617 + [models] ADDED: DrawCapsule() and DrawCapsuleWires() (#2761) by @IanBand 1618 + [models] ADDED: LoadMaterials(), MTL files loading, same code as OBJ loader (#2872) by @JeffM2501 1619 + [models] `WARNING`: REMOVED: UnloadModelKeepMeshes() 1620 + [models] `WARNING`: REMOVED: DrawCubeTexture(), DrawCubeTextureRec(), functions moved to new example: `models_draw_cube_texture` 1621 + [models] REVIEWED: DrawMesh(), using SHADER_LOC_COLOR_SPECULAR as a material map (#2908) by @haved 1622 + [models] REVIEWED: LoadM3D() vertex color support (#2878) by @GithubPrankster, @bztsrc 1623 + [models] REVIEWED: GenMeshHeightmap() (#2716) 1624 + [models] REVIEWED: LoadIQM() (#2676) 1625 + [models] REVIEWED: Simplify .vox signature check (#2752) by @CrezyDud 1626 + [models] REVIEWED: LoadIQM(), support bone names loading if available (#2882) by @PencilAmazing 1627 + [models] REVIEWED: GenMeshTangents(), avoid crash on missing texcoords data (#2927) 1628 + [audio] ADDED: Full support for QOA audio file format 1629 + [audio] ADDED: Mixed audio processor (#2929) by @hatkidchan 1630 + [audio] ADDED: IsWaveReady()`, IsSoundReady(), IsMusicReady() (#2892) by @RobLoach 1631 + [audio] `WARNING`: REMOVED: Multichannel audio API: PlaySoundMulti(), StopSoundMulti() 1632 + [audio] REVIEWED: Clear PCM buffer state when closing audio device (#2736) by @veins1 1633 + [audio] REVIEWED: Android backend selected (#2118, #2875) by @planetis-m 1634 + [audio] REVIEWED: Change default threading model for COM objects in miniaudio 1635 + [multi] ADDED: IsShaderReady(), IsImageReady(), IsFontReady() (#2892) by @RobLoach 1636 + [multi] ADDED: IsModelReady(), IsMaterialReady(), IsTextureReady(), IsRenderTextureReady() (#2895) by @RobLoach 1637 + [multi] REVIEWED: Multiple code/comment typos by @sDos280 1638 + [multi] REVIEWED: Grammar mistakes and typos (#2914) by @stickM4N 1639 + [multi] REVIEWED: Use TRACELOG() macro instead of TraceLog() in internal modules (#2881) by @RobLoach 1640 + [examples] ADDED: textures_textured_curve (#2821) by @JeffM2501 1641 + [examples] ADDED: models_draw_cube_texture 1642 + [examples] ADDED: models_loading_m3d (#2648) by @bztsrc 1643 + [examples] ADDED: shaders_write_depth (#2836) by @BugraAlptekinSari 1644 + [examples] ADDED: shaders_hybrid_render (#2919) by @BugraAlptekinSari 1645 + [examples] REMOVED: audio_multichannel_sound 1646 + [examples] RENAMED: Several shaders for naming consistency (#2707) 1647 + [examples] RENAMED: lighting_instanced.fs to lighting_instancing.fs (glsl100) (#2805) by @gtrxAC 1648 + [examples] REVIEWED: core_custom_logging.c (#2692) by @hartmannathan 1649 + [examples] REVIEWED: core_camera_2d_platformer (#2687) by @skylar779 1650 + [examples] REVIEWED: core_input_gamepad.c (#2903) by @planetis-m 1651 + [examples] REVIEWED: core_custom_frame_control 1652 + [examples] REVIEWED: core_drop_files (#2943) 1653 + [examples] REVIEWED: text_rectangle_bounds (#2746) by @SzieberthAdam 1654 + [examples] REVIEWED: textures_image_processing, added gaussian blurring (#2775) by @nobytesgiven 1655 + [examples] REVIEWED: models_billboard, highlighting rotation and draw order (#2779) by @nobytesgiven 1656 + [examples] REVIEWED: core_loading_thread, join thread on completion (#2845) by @planetis-m 1657 + [examples] REVIEWED: models_loading_gltf 1658 + [examples] REVIEWED: Shader lighting.fs for GLSL120 (#2651) 1659 + [examples] REVIEWED: text_codepoints_loading.c 1660 + [parser] REVIEWED: raylib-parser Makefile (#2765) by @Peter0x44 1661 + [build] ADDED: Packaging for distros with deb-based and rpm-based packages (#2877) by @KOLANICH 1662 + [build] ADDED: Linkage library -latomic on Linux (only required for ARM32) 1663 + [build] ADDED: Required frameworks on macOS (#2793) by @SpexGuy 1664 + [build] ADDED: WASM support for Zig build (#2901) by @Not-Nik 1665 + [build] ADDED: New raylib examples as VS2022 project (to raylib solution) 1666 + [build] REVIEWED: config.h format and inconsistencies 1667 + [build] REVIEWED: Zig build to latest master, avoid deprecated functions (#2910) by @star-tek-mb 1668 + [build] REVIEWED: CMake project template to easily target raylib version (#2700) by @RobLoach 1669 + [build] REVIEWED: PATH for PLATFORM_WEB target (#2647) by @futureapricot 1670 + [build] REVIEWED: build.zig to let user decide how to set build mode and linker fixes by @InKryption 1671 + [build] REVIEWED: Deprecation error on Android API higher than 23 (#2778) by @anggape 1672 + [build] REVIEWED: Android x86 Architecture name (#2783) by @IsaacTCB 1673 + [build] REVIEWED: examples/build.zig for the latest Zig version (#2786) by @RomanAkberov 1674 + [utils] REVIEWED: ExportDataAsCode() data types (#2787) by @RGDTAB 1675 + [build] REVIEWED: Makefile emscripten path (#2785) by @Julianiolo 1676 + [build] REVIEWED: Several compilation warnings (for strict rules) 1677 + [build] REVIEWED: All github workflows using deprecated actions 1678 + [build] REVIEWED: CMake when compiling for web (#2820) by @object71 1679 + [build] REVIEWED: DLL build on Windows (#2951) by @Skaytacium 1680 + [build] REVIEWED: Avoid MSVC warnings in raylib project (#2871) by @JeffM2501 1681 + [build] REVIEWED: Paths in .bat files to build examples (#2870) by @masoudd 1682 + [build] REVIEWED: CMake, use GLVND for old cmake versions (#2826) by @simendsjo 1683 + [build] REVIEWED: Makefile, multiple tweaks 1684 + [build] REVIEWED: CI action: linux_examples.yml 1685 + [build] REVIEWED: CI action: cmake.yml 1686 + [bindings] ADDED: h-raylib (Haskell) by @Anut-py 1687 + [bindings] ADDED: raylib-c3 (C3) by @Its-Kenta 1688 + [bindings] ADDED: raylib-umka (Umka) by @RobLoach 1689 + [bindings] ADDED: chez-raylib (Chez Scheme) by @Yunoinsky 1690 + [bindings] ADDED: raylib-python-ctypes (Python) by @sDos280 1691 + [bindings] ADDED: claylib (Common Lisp) by @shelvick 1692 + [bindings] ADDED: raylib-vapi (Vala) by @lxmcf 1693 + [bindings] ADDED: TurboRaylib (Object Pascal) by @turborium 1694 + [bindings] ADDED: Kaylib (Kotlin/Native) by @Its-Kenta 1695 + [bindings] ADDED: Raylib-Nelua (Nelua) by @Its-Kenta 1696 + [bindings] ADDED: Cyber (Cyber) by @fubark 1697 + [bindings] ADDED: raylib-sunder (Sunder) by @ashn-dot-dev 1698 + [bindings] ADDED: raylib BQN (#2962) by @Brian-ED 1699 + [misc] REVIEWED: Update external libraries to latest versions 1700 + 1701 + ------------------------------------------------------------------------- 1702 + Release: raylib 4.2 (11 August 2022) 1703 + ------------------------------------------------------------------------- 1704 + KEY CHANGES: 1705 + - REMOVED: extras libraries (raygui, physac, rrem, reasings, raudio.h) moved to independent separate repos 1706 + - UPDATED: examples: Added creation and update raylib versions and assigned **DIFFICULTY LEVELS**! 1707 + - rres 1.0: A custom resource-processing and packaging file format, including tooling and raylib integration examples 1708 + - raygui 3.2: New version of the immediate-mode gui system for tools development with raylib 1709 + - raylib_parser: Multiple improvements of the raylib parser to automatize bindings generation 1710 + - ADDED: New file system API: Reviewed to be more aligned with raylib conventions and one advance function added 1711 + - ADDED: New audio stream processors API (_experimental_): Allowing to add custom audio stream data processors using callbacks 1712 + 1713 + Detailed changes: 1714 + [multi] ADDED: Frequently Asked Questions (FAQ.md) 1715 + [multi] REVIEWED: Multiple trace log messages 1716 + [multi] REVIEWED: Avoid some float to double promotions 1717 + [multi] REVIEWED: Some functions input parametes that should be const 1718 + [multi] REVIEWED: Variables initialization, all variables are initialized on declaration 1719 + [multi] REVIEWED: Static array buffers are always re-initialized with memset() 1720 + [multi] `WARNING`: RENAMED: Some function input parameters from "length" to "size" 1721 + [core] ADDED: GetApplicatonDirectory() (#2256, #2285, #2290) by @JeffM2501 1722 + [core] ADDED: raylibVersion symbol, it could be required by some bindings (#2190) 1723 + [core] ADDED: SetWindowOpacity() (#2254) by @tusharsingh09 1724 + [core] ADDED: GetRenderWidth() and GetRenderHeight() by @ArnaudValensi 1725 + [core] ADDED: EnableEventWaiting() and DisableEventWaiting() 1726 + [core] ADDED: GetFileLength() 1727 + [core] ADDED: Modules info at initialization 1728 + [core] ADDED: Support clipboard copy/paste on web 1729 + [core] ADDED: Support OpenURL() on Android platform (#2396) by @futureapricot 1730 + [core] ADDED: Support MOUSE_PASSTHROUGH (#2516) 1731 + [core] ADDED: GetMouseWheelMoveV() (#2517) by @schveiguy 1732 + [core] `WARNING`: REMOVED: LoadStorageValue() / SaveStorageValue(), moved to example 1733 + [core] `WARNING`: RENAMED: GetDirectoryFiles() to LoadDirectoryFiles() 1734 + [core] `WARNING`: RENAMED: `ClearDroppedFiles()` to `UnloadDroppedFiles()` 1735 + [core] `WARNING`: RENAMED: GetDroppedFiles() to LoadDroppedFiles() 1736 + [core] `WARNING`: RENAMED: `ClearDirectoryFiles()` to `UnloadDirectoryFiles()` 1737 + [core] `WARNING`: REDESIGNED: WaitTime() argument from milliseconds to seconds (#2506) by @flashback-fx 1738 + [core] REVIEWED: GetMonitorWidth()/GetMonitorHeight() by @gulrak 1739 + [core] REVIEWED: GetDirectoryFiles(), maximum files allocation (#2126) by @ampers0x26 1740 + [core] REVIEWED: Expose MAX_KEYBOARD_KEYS and MAX_MOUSE_BUTTONS (#2127) 1741 + [core] REVIEWED: ExportMesh() (#2138) 1742 + [core] REVIEWED: Fullscreen switch on PLATFORM_WEB 1743 + [core] REVIEWED: GetMouseWheelMove(), fixed bug 1744 + [core] REVIEWED: GetApplicationDirectory() on macOS (#2304) 1745 + [core] REVIEWED: ToggleFullscreen() 1746 + [core] REVIEWED: Initialize/reset CORE.inputs global state (#2360) 1747 + [core] REVIEWED: MouseScrollCallback() (#2371) 1748 + [core] REVIEWED: SwapScreenBuffers() for PLATFORM_DRM 1749 + [core] REVIEWED: WaitTime(), fix regression causing video stuttering (#2503) by @flashback-fx 1750 + [core] REVIEWED: Mouse device support on PLATFORM_DRM (#2381) 1751 + [core] REVIEWED: Support OpenBSD timming functions 1752 + [core] REVIEWED: Improved boolean definitions (#2485) by @noodlecollie 1753 + [core] REVIEWED: TakeScreenshot(), use GetWindowScaleDPI() to calculate size in screenshot/recording (#2446) by @gulrak 1754 + [core] REVIEWED: Remove fps requirement for drm connector selection (#2468) by @Crydsch 1755 + [core] REVIEWED: IsFileExtension() (#2530) 1756 + [camera] REVIEWED: Some camera improvements (#2563) 1757 + [rlgl] ADDED: Premultiplied alpha blend mode (#2342) by @megagrump 1758 + [rlgl] REVIEWED: VR rendering not taking render target size into account (#2424) by @FireFlyForLife 1759 + [rlgl] REVIEWED: Set rlgl internal framebuffer (#2420) 1760 + [rlgl] REVIEWED: rlGetCompressedFormatName() 1761 + [rlgl] REVIEWED: Display OpenGL 4.3 capabilities with a compile flag (#2124) by @GithubPrankster 1762 + [rlgl] REVIEWED: rlUpdateTexture() 1763 + [rlgl] REVIEWED: Minimize buffer overflow probability 1764 + [rlgl] REVIEWED: Fix scissor mode on macOS (#2170) by @ArnaudValensi 1765 + [rlgl] REVIEWED: Clear SSBO buffers on loading (#2185) 1766 + [rlgl] REVIEWED: rlLoadShaderCode(), improved shader loading code 1767 + [rlgl] REVIEWED: Comment notes about custom blend modes (#2260) by @glorantq 1768 + [rlgl] REVIEWED: rlGenTextureMipmaps() 1769 + [rlgl] REVIEWED: rlTextureParameters() 1770 + [raymath] ADDED: Wrap() (#2522) by @Tekkitslime 1771 + [raymath] ADDED: Vector2Transform() 1772 + [raymath] ADDED: Vector2DistanceSqr() (#2376) by @AnilBK 1773 + [raymath] ADDED: Vector3DistanceSqr() (#2376) by @AnilBK 1774 + [raymath] ADDED: Vector2ClampValue(), Vector3ClampValue() (#2428) by @saccharineboi 1775 + [raymath] ADDED: Vector3RotateByAxisAngle() (#2590) by @Crydsch 1776 + [raymath] `WARNING`: REDESIGNED: Vector2Angle() returns radians instead of degrees (#2193) by @schveiguy 1777 + [raymath] `WARNING`: REMOVED: MatrixNormalize() (#2412) 1778 + [raymath] REVIEWED: Fix inverse length in Vector2Normalize() (#2189) by @HarriP 1779 + [raymath] REVIEWED: Vector2Angle() not working as expected (#2196) by @jdeokkim 1780 + [raymath] REVIEWED: Vector2Angle() and Vector3Angle() (#2203) by @trikko 1781 + [raymath] REVIEWED: QuaternionInvert(), code simplified (#2324) by @megagrump 1782 + [raymath] REVIEWED: QuaternionScale() (#2419) by @tana 1783 + [raymath] REVIEWED: Vector2Rotate(), optimized (#2340) by @jdeokkim 1784 + [raymath] REVIEWED: QuaternionFromMatrix(), QuaternionEquals() (#2591) by @kirigirihitomi 1785 + [raymath] REVIEWED: MatrixRotate*() (#2595, #2599) by @GoodNike 1786 + [shapes] REVIEWED: CheckCollision*() consistency 1787 + [shapes] REVIEWED: DrawRectanglePro(), support TRIANGLES drawing 1788 + [textures] ADDED: Support for QOI image format 1789 + [textures] REVIEWED: ImageColorTint(), GetImageColor(), ImageDrawRectangleRec(), optimized functions (#2429) by @AnilBK 1790 + [textures] REVIEWED: LoadTextureFromImage(), allow texture loading with no data transfer 1791 + [textures] REVIEWED: ImageDraw(), comment to note that f32bit is not supported (#2222) 1792 + [textures] REVIEWED: DrawTextureNPatch(), avoid batch overflow (#2401) by @JeffM2501 1793 + [textures] REVIEWED: DrawTextureTiled() (#2173) 1794 + [textures] REVIEWED: GenImageCellular() (#2178) 1795 + [textures] REVIEWED: LoadTextureCubemap() (#2223, #2224) 1796 + [textures] REVIEWED: Export format for float 32bit 1797 + [textures] REVIEWED: ExportImage(), support export ".jpeg" files 1798 + [textures] REVIEWED: ColorAlphaBlend() (#2524) by @royqh1979 1799 + [textures] REVIEWED: ImageResize() (#2572) 1800 + [textures] REVIEWED: ImageFromImage() (#2594) by @wiertek 1801 + [text] ADDED: ExportFontAsCode() 1802 + [text] ADDED: DrawTextCodepoints() (#2308) by @siddharthroy12 1803 + [text] REVIEWED: TextIsEqual(), protect from NULLs (#2121) by @lukekras 1804 + [text] REVIEWED: LoadFontEx(), comment to specify how to get the default character set (#2221) by @JeffM2501 1805 + [text] REVIEWED: GenImageFontAtlas(), increase atlas size guesstimate by @megagrump 1806 + [text] REVIEWED: GetCodepoint() (#2201) 1807 + [text] REVIEWED: GenImageFontAtlas() (#2556) 1808 + [text] REVIEWED: ExportFontAsCode() to use given font padding (#2525) by @TheTophatDemon 1809 + [models] ADDED: Reference code to load bones id and weight data for animations 1810 + [models] `WARNING`: REMOVED: GetRayCollisionModel() (#2405) 1811 + [models] REMOVED: GenMeshBinormals() 1812 + [models] REVIEWED: External library: vox_loader.h, 64bit issue (#2186) 1813 + [models] REVIEWED: Material color loading when no texture material is available (#2298) by @royqh1979 1814 + [models] REVIEWED: Fix Undefined Symbol _ftelli64 in cgltf (#2319) by @audinue 1815 + [models] REVIEWED: LoadGLTF(), fix memory leak (#2441, #2442) by @leomonta 1816 + [models] REVIEWED: DrawTriangle3D() batch limits check (#2489) 1817 + [models] REVIEWED: DrawBillboardPro() (#2494) 1818 + [models] REVIEWED: DrawMesh*() issue (#2211) 1819 + [models] REVIEWED: ExportMesh() (#2220) 1820 + [models] REVIEWED: GenMeshCylinder() (#2225) 1821 + [audio] `WARNING`: ADDED: rAudioProcessor pointer to AudioStream struct (used by Sound and Music structs) 1822 + [audio] ADDED: SetSoundPan(), SetMusicPan(), SetAudioStreamPan(), panning support (#2205) by ptarabbia 1823 + [audio] ADDED: Audio stream input callback (#2212) by ptarabbia 1824 + [audio] ADDED: Audio stream processors support (#2212) by ptarabbia 1825 + [audio] REVIEWED: GetMusicTimePlayed(), incorrect value after the stream restarted for XM audio (#2092 #2215) by @ptarabbia 1826 + [audio] REVIEWED: Turn on interpolation for XM playback (#2216) by @ptarabbia 1827 + [audio] REVIEWED: Fix crash with delay example (#2472) by @ptarabbia 1828 + [audio] REVIEWED: PlaySoundMulti() (#2231) 1829 + [audio] REVIEWED: ExportWaveAsCode() 1830 + [audio] REVIEWED: UpdateMusicStream(), reduce dynamic allocations (#2532) by @dbechrd 1831 + [audio] REVIEWED: UpdateMusicStream() to support proper stream looping (#2579) by @veins1 1832 + [utils] ADDED: ExportDataAsCode() 1833 + [utils] REVIEWED: Force flush stdout after trace messages (#2465) by @nagy 1834 + [easings] ADDED: Function descriptions (#2471) by @RobLoach 1835 + [camera] REVIEWED: Fix free camera panning in the wrong direction (#2347) by @DavidLyhedDanielsson 1836 + [examples] ADDED: core_window_should_close 1837 + [examples] ADDED: core_2d_camera_mouse_zoom (#2583) by @JeffM2501 1838 + [examples] ADDED: shapes_top_down_lights (#2199) by @JeffM2501 1839 + [examples] ADDED: textures_fog_of_war 1840 + [examples] ADDED: textures_gif_player 1841 + [examples] ADDED: text_codepoints_loading 1842 + [examples] ADDED: audio_stream_effects 1843 + [examples] REMOVED: core_quat_conversion, not working properly 1844 + [examples] REMOVED: raudio_standalone, moved to raudio repo 1845 + [examples] RENAMED: textures_rectangle -> textures_sprite_anim 1846 + [examples] REVIEWED: core_input_gamepad, improve joystick visualisation (#2390) by @kristianlm 1847 + [examples] REVIEWED: textures_draw_tiled 1848 + [examples] REVIEWED: shaders_mesh_instancing, free allocated matrices (#2425) by @AnilBK 1849 + [examples] REVIEWED: shaders_raymarching 1850 + [examples] REVIEWED: audio_raw_stream (#2205) by ptarabbia 1851 + [examples] REVIEWED: audio_music_stream 1852 + [examples] REVIEWED: shaders_mesh_instancing, simplified 1853 + [examples] REVIEWED: shaders_basic_lighting, rlights.h simplified 1854 + [examples] REVIEWED: All examples descriptions, included creation/update raylib versions 1855 + [parser] ADDED: Defines to parser (#2269) by @iskolbin 1856 + [parser] ADDED: Aliases to parser (#2444) by @lazaray 1857 + [parser] ADDED: Parse struct descriptions (#2214) by @eutro 1858 + [parser] ADDED: Parse enum descriptions and value descriptions (#2208) by @eutro 1859 + [parser] ADDED: Lua output format for parser by @iskolbin 1860 + [parser] ADDED: Makefile for raylib_parser by @iskolbin 1861 + [parser] ADDED: Support for truncating parser input (#2464) by @lazaray 1862 + [parser] ADDED: Support for calculated defines to parser (#2463) by @lazaray 1863 + [parser] REVIEWED: Update parser files (#2125) by @catmanl 1864 + [parser] REVIEWED: Fix memory leak in parser (#2136) by @ronnieholm 1865 + [parser] REVIEWED: EscapeBackslashes() 1866 + [parser] REVIEWED: Parser improvements (#2461 #2462) by @lazaray 1867 + [bindings] ADDED: License details for BINDINGS 1868 + [bindings] ADDED: dart-raylib (#2149) by @wolfenrain 1869 + [bindings] ADDED: raylib-cslo (#2169) by @jasonswearingen 1870 + [bindings] ADDED: raylib-d (#2194) by @schveiguy 1871 + [bindings] ADDED: raylib-guile (#2202) by @petelliott 1872 + [bindings] ADDED: raylib-scopes (#2238) by @salotz 1873 + [bindings] ADDED: naylib (Nim) (#2386) by @planetis-m 1874 + [bindings] ADDED: raylib.jl (Julia) (#2403) by @irishgreencitrus 1875 + [bindings] ADDED: raylib.zig (#2449) by @ryupold 1876 + [bindings] ADDED: racket-raylib (#2454) by @eutro 1877 + [bindings] ADDED: raylibr (#2611) by @ramiromagno 1878 + [bindings] ADDED: Raylib.4.0.Pascal (#2617) by @sysrpl 1879 + [bindings] REVIEWED: Multiple bindings updated to raylib 4.0 1880 + [build] ADDED: VS2022 project 1881 + [build] ADDED: Support macOS by zig build system (#2175) 1882 + [build] ADDED: Support custom modules selection on compilation 1883 + [build] ADDED: Minimal web shell for WebAssembly compilation 1884 + [build] ADDED: BSD support for zig builds (#2332) by @zigster64 1885 + [build] ADDED: Repology badge (#2367) by @jubalh 1886 + [build] ADDED: Support DLL compilation with TCC compiler (#2569) by @audinue 1887 + [build] ADDED: Missing examples to VS2022 examples solution 1888 + [build] REMOVED: VS2019 project (unmaintained) 1889 + [build] REMOVED: SUPPORT_MOUSE_CURSOR_POINT config option 1890 + [build] REVIEWED: Fixed RPi make install (#2217) by @wereii 1891 + [build] REVIEWED: Fix build results path on Linux and RPi (#2218) by @wereii 1892 + [build] REVIEWED: Makefiles debug flag 1893 + [build] REVIEWED: Fixed cross-compilation from x86-64 to RPi (#2233) by @pitpit 1894 + [build] REVIEWED: All Makefiles, simplified 1895 + [build] REVIEWED: All Makefiles, improve organization 1896 + [build] REVIEWED: All Makefiles, support CUSTOM_CFLAGS 1897 + [build] REVIEWED: Fixed compiling for Android using CMake (#2270) by @hero2002 1898 + [build] REVIEWED: Make zig build functionality available to zig programs (#2271) by @Not-Nik 1899 + [build] REVIEWED: Update CMake project template with docs and web (#2274) by @RobLoach 1900 + [build] REVIEWED: Update VSCode project to work with latest makefile and web (#2296) by @phil-shenk 1901 + [build] REVIEWED: Support audio examples compilation with external glfw (#2329) by @locriacyber 1902 + [build] REVIEWED: Fix "make clean" target failing when shell is not cmd (#2338) by @Peter0x44 1903 + [build] REVIEWED: Makefile linkage -latomic, required by miniaudio on ARM 32bit #2452 1904 + [build] REVIEWED: Update raylib-config.cmake (#2374) by @marcogmaia 1905 + [build] REVIEWED: Simplify build.zig to not require user to specify raylib path (#2383) by @Hejsil 1906 + [build] REVIEWED: Fix OpenGL 4.3 graphics option in CMake (#2427) by @GoldenThumbs 1907 + [extras] `WARNING`: REMOVED: physac from raylib sources/examples, use github.com/raysan5/physac 1908 + [extras] `WARNING`: REMOVED: raygui from raylib/src/extras, use github.com/raysan5/raygui 1909 + [extras] `WARNING`: REMOVED: rmem from raylib/src/extras, moved to github.com/raylib-extras/rmem 1910 + [extras] `WARNING`: REMOVED: easings from raylib/src/extras, moved to github.com/raylib-extras/reasings 1911 + [extras] `WARNING`: REMOVED: raudio.h from raylib/src, moved to github.com/raysan5/raudio 1912 + [misc] REVIEWED: Update some external libraries to latest versions 1913 + 1914 + ------------------------------------------------------------------------- 1915 + Release: raylib 4.0 - 8th Anniversary Edition (05 November 2021) 1916 + ------------------------------------------------------------------------- 1917 + KEY CHANGES: 1918 + - Naming consistency and coherency: Complete review of the library: syntax, naming, comments, decriptions, logs... 1919 + - Event Automation System: Support for input events recording and automatic re-playing, useful for automated testing and more! 1920 + - Custom game-loop control: Intended for advanced users that want to control the events polling and the timming mechanisms 1921 + - rlgl 4.0: Completely decoupling from platform layer and raylib, intended for standalone usage as single-file header-only 1922 + - raymath 1.5: Complete review following new conventions, to make it more portable and self-contained 1923 + - raygui 3.0: Complete review and official new release, more portable and self-contained, intended for tools development 1924 + - raylib_parser: New tool to parse raylib.h and extract all required info into custom output formats (TXT, XML, JSON...) 1925 + - Zig and Odin official support 1926 + 1927 + Detailed changes: 1928 + [core] ADDED: Support canvas resizing on web (#1840) by @skylersaleh 1929 + [core] ADDED: GetMouseDelta() (#1832) by @adricoin2010 1930 + [core] ADDED: Support additional mouse buttons (#1753) by @lambertwang 1931 + [core] ADDED: SetRandomSeed() (#1994) by @TommiSinivuo 1932 + [core] ADDED: GetTouchPointId() #1972 1933 + [core] ADDED: EncodeDataBase64() and DecodeDataBase64() 1934 + [core] REMOVED: PLATFORM_UWP, difficult to maintain 1935 + [core] REMOVED: IsGamepadName() 1936 + [core] RENAMED: SwapBuffers() to SwapScreenBuffer() 1937 + [core] RENAMED: Wait() to WaitTime() 1938 + [core] RENAMED: RayHitInfo to RayCollision (#1781) 1939 + [core] RENAMED: GetRayCollisionGround() to GetRayCollisionQuad() (#1781) 1940 + [core] REVIEWED: Support mouse wheel on x-axis (#1948) 1941 + [core] REVIEWED: DisableCursor() on web by registering an empty mouse click event function in emscripten (#1900) by @grenappels 1942 + [core] REVIEWED: LoadShader() and default locations and descriptions 1943 + [core] REVIEWED: LoadShaderFromMemory() (#1851) by @Ruminant 1944 + [core] REVIEWED: WaitTime(), avoid global variables dependency to make the function is self-contained (#1841) 1945 + [core] REVIEWED: SetWindowSize() to work on web (#1847) by @nikki93 1946 + [core] REVIEWED: Raspberry RPI/DRM keyboard blocking render loop (#1879) @luizpestana 1947 + [core] REVIEWED: Android multi-touch (#1869) by @humbe 1948 + [core] REVIEWED: Implemented GetGamepadName() for emscripten by @nbarkhina 1949 + [core] REVIEWED: HighDPI support (#1987) by @ArnaudValensi 1950 + [core] REVIEWED: KeyCallback(), register keys independently of the actions 1951 + [rlgl] ADDED: GRAPHIC_API_OPENGL_43 1952 + [rlgl] ADDED: rlUpdateVertexBufferElements() (#1915) 1953 + [rlgl] ADDED: rlActiveDrawBuffers() (#1911) 1954 + [rlgl] ADDED: rlEnableColorBlend()/rlDisableColorBlend() 1955 + [rlgl] ADDED: rlGetPixelFormatName() 1956 + [rlgl] REVIEWED: rlUpdateVertexBuffer (#1914) by @630Studios 1957 + [rlgl] REVIEWED: rlDrawVertexArrayElements() (#1891) 1958 + [rlgl] REVIEWED: Wrong normal matrix calculation (#1870) 1959 + [raymath] ADDED: Vector3Angle() 1960 + [raymath] REVIEWED: QuaternionFromAxisAngle() (#1892) 1961 + [raymath] REVIEWED: QuaternionToMatrix() returning transposed result. (#1793) by @object71 1962 + [shapes] ADDED: RenderPolyLinesEx() (#1758) by @lambertwang 1963 + [shapes] ADDED: DrawSplineBezierCubic() (#2021) by @SAOMDVN 1964 + [textures] ADDED: GetImageColor() #2024 1965 + [textures] REMOVED: GenImagePerlinNoise() 1966 + [textures] RENAMED: GetTextureData() to LoadImageFromTexture() 1967 + [textures] RENAMED: GetScreenData() to LoadImageFromScreen() 1968 + [textures] REVIEWED: ExportImage() to use SaveFileData() (#1779) 1969 + [textures] REVIEWED: LoadImageAnim() #2005 1970 + [text] ADDED: Security check in case of not valid font 1971 + [text] ADDED: `GetGlyphInfo()` to get glyph info for a specific codepoint 1972 + [text] ADDED: `GetGlyphAtlasRec()` to get glyph rectangle within the generated font atlas 1973 + [text] ADDED: DrawTextPro() with text rotation support, WARNING: DrawTextPro() requires including `rlgl.h`, before it was only dependant on `textures` module. 1974 + [text] ADDED: UnloadCodepoints() to safely free loaded codepoints 1975 + [text] REMOVED: DrawTextRec() and DrawTextRecEx(), moved to example, those functions could be very specific depending on user needs so it's better to give the user the full source in case of special requirements instead of allowing a function with +10 input parameters. 1976 + [text] RENAMED: struct `CharInfo` to `GlyphInfo`, actually that's the correct naming for the data contained. It contains the character glyph metrics and the glyph image; in the past it also contained rectangle within the font atlas but that data has been moved to `Font` struct directly, so, `GlyphInfo` is a more correct name. 1977 + [text] RENAMED: `CodepointToUtf8()` to `CodepointToUTF8()`, capitalization of UTF-8 is the correct form, it would also require de hyphen but it can be omitted in this case. 1978 + [text] RENAMED: `TextToUtf8()` to `TextCodepointsToUTF8` for consistency and more detail on the functionality. 1979 + [text] RENAMED: GetCodepoints() to LoadCodepoints(), now codepoint array data is loaded dynamically instead of reusing a limited static buffer. 1980 + [text] RENAMED: GetNextCodepoint() to GetCodepoint() 1981 + [models] ADDED: MagikaVoxel VOX models loading 1982 + [models] ADDED: GenMeshCone() (#1903) 1983 + [models] ADDED: GetModelBoundingBox() 1984 + [models] ADDED: DrawBillboardPro() (#1759) by @nobytesgiven 1985 + [models] ADDED: DrawCubeTextureRec() (#2001) by @tdgroot 1986 + [models] ADDED: DrawCylinderEx() and DrawCylinderWiresEx() (#2049) by @Horrowind 1987 + [models] REMOVED: DrawBillboardEx() 1988 + [models] RENAMED: MeshBoundingBox() to GetMeshBoundingBox() 1989 + [models] RENAMED: MeshTangents() to GenMeshTangents() 1990 + [models] RENAMED: MeshBinormals() to GenMeshBinormals() 1991 + [models] REVIEWED: GenMeshTangents() (#1877) by @630Studios 1992 + [models] REVIEWED: CheckCollisionBoxSphere() by @Crydsch 1993 + [models] REVIEWED: GetRayCollisionQuad() by @Crydsch 1994 + [models] REVIEWED: LoadGLTF(), fixed missing transformations and nonroot skinning by @MrDiver 1995 + [models] REVIEWED: LoadGLTF(), rewriten from scratch, removed animations support (broken) 1996 + [models] REVIEWED: Decouple DrawMesh() and DrawMeshInstanced() (#1958) 1997 + [models] REVIEWED: Support vertex color attribute for GLTF and IQM (#1790) by @object71 1998 + [models] REVIEWED: DrawBillboardPro() (#1941) by @GithubPrankster 1999 + [models] REDESIGNED: Major review of glTF loading functionality (#1849) by @object71 2000 + [audio] ADDED: SeekMusicStream() (#2006) by @GithubPrankster 2001 + [audio] REMOVED: GetAudioStreamBufferSizeDefault() 2002 + [audio] RENAMED: InitAudioStream() to LoadAudioStream() 2003 + [audio] RENAMED: CloseAudioStream() to UnloadAudioStream() 2004 + [audio] RENAMED: IsMusicPlaying() to IsMusicStreamPlaying() 2005 + [audio] REVIEWED: ExportWaveAsCode() 2006 + [audio] REDESIGNED: Use frameCount on audio instead of sampleCount 2007 + [utils] REVIEWED: exit() on LOG_FATAL instead of LOG_ERROR (#1796) 2008 + [examples] ADDED: core_custom_frame_control 2009 + [examples] ADDED: core_basic_screen_manager 2010 + [examples] ADDED: core_split_screen (#1806) by @JeffM2501 2011 + [examples] ADDED: core_smooth_pixelperfect (#1771) by @NotManyIdeasDev 2012 + [examples] ADDED: shaders_texture_outline (#1883) by @GoldenThumbs 2013 + [examples] ADDED: models_loading_vox (#1940) by @procfxgen 2014 + [examples] ADDED: rlgl_compute_shader by @TSnake41 (#2088) 2015 + [examples] REMOVED: models_material_pbr 2016 + [examples] REMOVED: models_gltf_animation 2017 + [examples] REVIEWED: core_3d_picking 2018 + [examples] REVIEWED: core_input_mouse 2019 + [examples] REVIEWED: core_vr_simulator, RenderTexture usage 2020 + [examples] REVIEWED: core_window_letterbox, RenderTexture usage 2021 + [examples] REVIEWED: shapes_basic_shapes 2022 + [examples] REVIEWED: shapes_logo_raylib_anim 2023 + [examples] REVIEWED: textures_to_image 2024 + [examples] REVIEWED: text_rectangle_bounds 2025 + [examples] REVIEWED: text_unicode 2026 + [examples] REVIEWED: text_draw_3d 2027 + [examples] REVIEWED: models_loading 2028 + [examples] REVIEWED: models_skybox (#1792) (#1778) 2029 + [examples] REVIEWED: models_mesh_picking 2030 + [examples] REVIEWED: models_yaw_pitch_roll 2031 + [examples] REVIEWED: models_rlgl_solar_system 2032 + [examples] REVIEWED: shaders_custom_uniform, RenderTexture usage 2033 + [examples] REVIEWED: shaders_eratosthenes, RenderTexture usage 2034 + [examples] REVIEWED: shaders_julia_set, RenderTexture usage 2035 + [examples] REVIEWED: shaders_postprocessing, RenderTexture usage 2036 + [examples] REVIEWED: shaders_basic_lighting, simplified (#1865) 2037 + [examples] REVIEWED: audio_raw_stream.c 2038 + [examples] REVIEWED: raudio_standalone 2039 + [examples] REVIEWED: raylib_opengl_interop 2040 + [examples] REVIEWED: rlgl_standalone.c 2041 + [examples] REVIEWED: Resources licenses 2042 + [examples] REVIEWED: models resources reorganization 2043 + [templates] REMOVED: Moved to a separate repo: https://github.com/raysan5/raylib-game-template 2044 + [build] ADDED: Zig build file (#2014) by @TommiSinivuo 2045 + [build] ADDED: Android VS2019 solution (#2013) by @Kronka 2046 + [build] REMOVED: VS2017 project, outdated 2047 + [build] RENAMED: All raylib modules prefixed with 'r' (core -> rcore) 2048 + [build] RENAMED: SUPPORT_MOUSE_CURSOR_NATIVE to SUPPORT_MOUSE_CURSOR_POINT 2049 + [build] REVIEWED: examples/examples_template.c 2050 + [build] REVIEWED: Makefile to latest Emscripten SDK r23 2051 + [build] REVIEWED: Makefile for latest Android NDK r32 LTS 2052 + [build] REVIEWED: raylib resource files 2053 + [build] Moved some extra raylib libraries to /extras/ directory 2054 + [*] UPDATED: Multiple bindings to latest version 2055 + [*] UPDATED: Most external libraries to latest versions (except GLFW) 2056 + [*] Multiple code improvements and fixes by multiple contributors! 2057 + 2058 + ------------------------------------------------------------------------- 2059 + Release: raylib 3.7 (26 April 2021) 2060 + ------------------------------------------------------------------------- 2061 + KEY CHANGES: 2062 + - [rlgl] REDESIGNED: Greater abstraction level, some functionality moved to core module 2063 + - [rlgl] REVIEWED: Instancing and stereo rendering 2064 + - [core] REDESIGNED: VR simulator, fbo/shader exposed to user 2065 + - [utils] ADDED: File access callbacks system 2066 + - [models] ADDED: glTF animations support (#1551) by @object71 2067 + - [audio] ADDED: Music streaming support from memory (#1606) by @nezvers 2068 + - [*] RENAMED: enum types and enum values for consistency 2069 + 2070 + Detailed changes: 2071 + [core] ADDED: LoadVrStereoConfig() 2072 + [core] ADDED: UnloadVrStereoConfig() 2073 + [core] ADDED: BeginVrStereoMode() 2074 + [core] ADDED: EndVrStereoMode() 2075 + [core] ADDED: GetCurrentMonitor() (#1485) by @object71 2076 + [core] ADDED: SetGamepadMappings() (#1506) 2077 + [core] RENAMED: struct Camera: camera.type to camera.projection 2078 + [core] RENAMED: LoadShaderCode() to LoadShaderFromMemory() (#1690) 2079 + [core] RENAMED: SetMatrixProjection() to rlSetMatrixProjection() 2080 + [core] RENAMED: SetMatrixModelview() to rlSetMatrixModelview() 2081 + [core] RENAMED: GetMatrixModelview() to rlGetMatrixModelview() 2082 + [core] RENAMED: GetMatrixProjection() to rlGetMatrixProjection() 2083 + [core] RENAMED: GetShaderDefault() to rlGetShaderDefault() 2084 + [core] RENAMED: GetTextureDefault() to rlGetTextureDefault() 2085 + [core] REMOVED: GetShapesTexture() 2086 + [core] REMOVED: GetShapesTextureRec() 2087 + [core] REMOVED: GetMouseCursor() 2088 + [core] REMOVED: SetTraceLogExit() 2089 + [core] REVIEWED: GetFileName() and GetDirectoryPath() (#1534) by @gilzoide 2090 + [core] REVIEWED: Wait() to support FreeBSD (#1618) 2091 + [core] REVIEWED: HighDPI support on macOS retina (#1510) 2092 + [core] REDESIGNED: GetFileExtension(), includes the .dot 2093 + [core] REDESIGNED: IsFileExtension(), includes the .dot 2094 + [core] REDESIGNED: Compresion API to use sdefl/sinfl libs 2095 + [rlgl] ADDED: SUPPORT_GL_DETAILS_INFO config flag 2096 + [rlgl] REMOVED: GenTexture*() functions (#721) 2097 + [rlgl] REVIEWED: rlLoadShaderDefault() 2098 + [rlgl] REDESIGNED: rlLoadExtensions(), more details exposed 2099 + [raymath] REVIEWED: QuaternionFromEuler() (#1651) 2100 + [raymath] REVIEWED: MatrixRotateZYX() (#1642) 2101 + [shapes] ADDED: DrawSplineBezierQuad() (#1468) by @epsilon-phase 2102 + [shapes] ADDED: CheckCollisionLines() 2103 + [shapes] ADDED: CheckCollisionPointLine() by @mkupiec1 2104 + [shapes] REVIEWED: CheckCollisionPointTriangle() by @mkupiec1 2105 + [shapes] REDESIGNED: SetShapesTexture() 2106 + [shapes] REDESIGNED: DrawCircleSector(), to use float params 2107 + [shapes] REDESIGNED: DrawCircleSectorLines(), to use float params 2108 + [shapes] REDESIGNED: DrawRing(), to use float params 2109 + [shapes] REDESIGNED: DrawRingLines(), to use float params 2110 + [textures] ADDED: DrawTexturePoly() and example (#1677) by @chriscamacho 2111 + [textures] ADDED: UnloadImageColors() for allocs consistency 2112 + [textures] RENAMED: GetImageData() to LoadImageColors() 2113 + [textures] REVIEWED: ImageClearBackground() and ImageDrawRectangleRec() (#1487) by @JeffM2501 2114 + [textures] REVIEWED: DrawTexturePro() and DrawRectanglePro() transformations (#1632) by @ChrisDill 2115 + [text] REDESIGNED: DrawFPS() 2116 + [models] ADDED: UploadMesh() (#1529) 2117 + [models] ADDED: UpdateMeshBuffer() 2118 + [models] ADDED: DrawMesh() 2119 + [models] ADDED: DrawMeshInstanced() 2120 + [models] ADDED: UnloadModelAnimations() (#1648) by @object71 2121 + [models] REMOVED: DrawGizmo() 2122 + [models] REMOVED: LoadMeshes() 2123 + [models] REMOVED: MeshNormalsSmooth() 2124 + [models] REVIEWED: DrawLine3D() (#1643) 2125 + [audio] REVIEWED: Multichannel sound system (#1548) 2126 + [audio] REVIEWED: jar_xm library (#1701) by @jmorel33 2127 + [utils] ADDED: SetLoadFileDataCallback() 2128 + [utils] ADDED: SetSaveFileDataCallback() 2129 + [utils] ADDED: SetLoadFileTextCallback() 2130 + [utils] ADDED: SetSaveFileTextCallback() 2131 + [examples] ADDED: text_draw_3d (#1689) by @Demizdor 2132 + [examples] ADDED: textures_poly (#1677) by @chriscamacho 2133 + [examples] ADDED: models_gltf_model (#1551) by @object71 2134 + [examples] RENAMED: shaders_rlgl_mesh_instanced to shaders_mesh_intancing 2135 + [examples] REDESIGNED: shaders_rlgl_mesh_instanced by @moliad 2136 + [examples] REDESIGNED: core_vr_simulator 2137 + [examples] REDESIGNED: models_yaw_pitch_roll 2138 + [build] ADDED: Config flag: SUPPORT_STANDARD_FILEIO 2139 + [build] ADDED: Config flag: SUPPORT_WINMM_HIGHRES_TIMER (#1641) 2140 + [build] ADDED: Config flag: SUPPORT_GL_DETAILS_INFO 2141 + [build] ADDED: Examples projects to VS2019 solution 2142 + [build] REVIEWED: Makefile to support PLATFORM_RPI (#1580) 2143 + [build] REVIEWED: Multiple typecast warnings by @JeffM2501 2144 + [build] REDESIGNED: VS2019 project build paths 2145 + [build] REDESIGNED: CMake build system by @object71 2146 + [*] RENAMED: Several functions parameters for consistency 2147 + [*] UPDATED: Multiple bindings to latest version 2148 + [*] UPDATED: All external libraries to latest versions 2149 + [*] Multiple code improvements and fixes by multiple contributors! 2150 + 2151 + ------------------------------------------------------------------------- 2152 + Release: raylib 3.5 - 7th Anniversary Edition (25 December 2020) 2153 + ------------------------------------------------------------------------- 2154 + KEY CHANGES: 2155 + - [core] ADDED: PLATFORM_DRM to support RPI4 and other devices (#1388) by @kernelkinetic 2156 + - [core] REDESIGNED: Window states management system through FLAGS 2157 + - [rlgl] ADDED: RenderBatch type and related functions to allow custom batching (internal only) 2158 + - [rlgl] REDESIGNED: Framebuffers API to support multiple attachment types (#721) 2159 + - [textures] REDESIGNED: Image*() functions, big performance improvements (software rendering) 2160 + - [*] REVIEWED: Multiple functions to replace file accesses by memory accesses 2161 + - [*] ADDED: GitHub Actions CI to support multiple raylib build configurations 2162 + 2163 + Detailed changes: 2164 + [core] ADDED: SetWindowState() / ClearWindowState() -> New flags added! 2165 + [core] ADDED: IsWindowFocused() 2166 + [core] ADDED: GetWindowScaleDPI() 2167 + [core] ADDED: GetMonitorRefreshRate() (#1289) by @Shylie 2168 + [core] ADDED: IsCursorOnScreen() (#1262) by @ChrisDill 2169 + [core] ADDED: SetMouseCursor() and GetMouseCursor() for standard Desktop cursors (#1407) by @chances 2170 + [core] REMOVED: struct RenderTexture2D: depthTexture variable 2171 + [core] REMOVED: HideWindow() / UnhideWindow() -> Use SetWindowState() 2172 + [core] REMOVED: DecorateWindow() / UndecorateWindow() -> Use SetWindowState() 2173 + [core] RENAMED: GetExtension() to GetFileExtension() 2174 + [core] REVIEWED: Several structs to reduce size and padding 2175 + [core] REVIEWED: struct Texture maps to Texture2D and TextureCubemap 2176 + [core] REVIEWED: ToggleFullscreen() (#1287) 2177 + [core] REVIEWED: InitWindow(), support empty title for window (#1323) 2178 + [core] REVIEWED: RPI: Mouse movements are bound to the screen resolution (#1392) (#1410) by @kernelkinetic 2179 + [core] REVIEWED: GetPrevDirectoryPath() fixes on Unix-like systems (#1246) by @ivan-cx 2180 + [core] REPLACED: rgif.h by msf_gif.h for automatic gif recording 2181 + [core] REDESIGNED: GetMouseWheelMove() to return float movement for precise scrolling (#1397) by @Doy-lee 2182 + [core] REDESIGNED: GetKeyPressed(), and added GetCharPressed() (#1336) 2183 + [core] UWP rework with improvements (#1231) by @Rover656 2184 + [core] Gamepad axis bug fixes and improvement (#1228) by @mmalecot 2185 + [core] Updated joystick mappings with latest version of gamecontrollerdb (#1381) by @coderoth 2186 + [rlgl] Corrected issue with OpenGL 1.1 support 2187 + [rlgl] ADDED: rlDrawMeshInstanced() (#1318) by @seanpringle 2188 + [rlgl] ADDED: rlCheckErrors (#1321) by @seanpringle 2189 + [rlgl] ADDED: BLEND_SET blending mode (#1251) by @RandomErrorMessage 2190 + [rlgl] ADDED: rlSetLineWidth(), rlGetLineWidth(), rlEnableSmoothLines(), rlDisableSmoothLines() (#1457) by @JeffM2501 2191 + [rlgl] RENAMED: rlUnproject() to Vector3Unproject() [raymath] 2192 + [rlgl] REVIEWED: Replace rlglDraw() calls by DrawRenderBatch() internal calls 2193 + [rlgl] REVIEWED: GenTextureCubemap(), use rlgl functionality only 2194 + [rlgl] REVIEWED: rlFramebufferAttach() to support texture layers 2195 + [rlgl] REVIEWED: GenDrawCube() and GenDrawQuad() 2196 + [rlgl] REVIEWED: Issues with vertex batch overflow (#1223) 2197 + [rlgl] REVIEWED: rlUpdateTexture(), issue with offsets 2198 + [rlgl] REDESIGNED: GenTexture*() to use the new fbo API (#721) 2199 + [raymath] ADDED: Normalize() and Remap() functions (#1247) by @NoorWachid 2200 + [raymath] ADDED: Vector2Reflect() (#1400) by @daniel-junior-dube 2201 + [raymath] ADDED: Vector2LengthSqr() and Vector3LengthSqr() (#1248) by @ThePituLegend 2202 + [raymath] ADDED: Vector2MoveTowards() function (#1233) by @anatagawa 2203 + [raymath] REVIEWED: Some functions consistency (#1197) by @Not-Nik 2204 + [raymath] REVIEWED: QuaternionFromVector3ToVector3() (#1263) by @jvocaturo 2205 + [raymath] REVIEWED: MatrixLookAt(), optimized (#1442) by @RandomErrorMessage 2206 + [shapes] ADDED: CheckCollisionLines(), by @Elkantor 2207 + [text] Avoid [textures] functions dependencies 2208 + [text] ADDED: Config flag: SUPPORT_TEXT_MANIPULATION 2209 + [text] ADDED: LoadFontFromMemory() (TTF only) (#1327) 2210 + [text] ADDED: UnloadFontData() 2211 + [text] RENAMED: FormatText() -> TextFormat() 2212 + [text] REVIEWED: Font struct, added charsPadding (#1432) 2213 + [text] REVIEWED: TextJoin() 2214 + [text] REVIEWED: TextReplace() (#1172) 2215 + [text] REVIEWED: LoadBMFont() to load data from memory (#1232) 2216 + [text] REVIEWED: GenImageFontAtlas(), fixed offset (#1171) 2217 + [text] REDESIGNED: LoadFontData(), reviewed input parameters 2218 + [text] REDESIGNED: LoadFontDefault(), some code simplifications 2219 + [text] REDESIGNED: LoadFontFromImage(), avoid LoadImageEx() 2220 + [text] REDESIGNED: LoadFontData(), avoid GenImageColor(), ImageFormat() 2221 + [text] REDESIGNED: LoadBMFont(), avoid ImageCopy(), ImageFormat(), ImageAlphaMask() 2222 + [textures] Move Color functions from [core] to [textures] module 2223 + [textures] ADDED: ColorAlphaBlend() 2224 + [textures] ADDED: GetPixelColor() 2225 + [textures] ADDED: SetPixelColor() 2226 + [textures] ADDED: LoadImageFromMemory() (#1327) 2227 + [textures] ADDED: LoadImageAnim() to load animated sequence of images 2228 + [textures] ADDED: DrawTextureTiled() (#1291) - @Demizdor 2229 + [textures] ADDED: UpdateTextureRec() 2230 + [textures] ADDED: UnloadImageColors(), UnloadImagePalette(), UnloadWaveSamples() 2231 + [textures] REMOVED: Config flag: SUPPORT_IMAGE_DRAWING 2232 + [textures] REMOVED: LoadImageEx() 2233 + [textures] REMOVED: LoadImagePro() 2234 + [textures] REMOVED: GetImageDataNormalized(), not exposed in the API 2235 + [textures] RENAMED: ImageExtractPalette() to GetImagePalette() 2236 + [textures] RENAMED: Fade() to ColorAlpha(), added #define for compatibility 2237 + [textures] RENAMED: GetImageData() -> LoadImageColors() 2238 + [textures] RENAMED: GetImagePalette() -> LoadImagePalette() 2239 + [textures] RENAMED: GetWaveData() -> LoadWaveSamples() 2240 + [textures] REVIEWED: GetPixelDataSize() to consider compressed data properly 2241 + [textures] REVIEWED: GetTextureData(), allow retrieving 32bit float data 2242 + [textures] REVIEWED: ImageDrawText*() params order 2243 + [textures] REVIEWED: ColorAlphaBlend(), support tint color 2244 + [textures] REVIEWED: ColorAlphaBlend(), integers-version, optimized (#1218) 2245 + [textures] REVIEWED: ImageDraw(), consider negative source offset properly (#1283) 2246 + [textures] REVIEWED: ImageDraw(), optimizations test (#1218) 2247 + [textures] REVIEWED: ImageResizeCanvas(), optimization (#1218) 2248 + [textures] REVIEWED: ExportImage(), optimized 2249 + [textures] REVIEWED: ImageAlphaPremultiply(), optimization 2250 + [textures] REVIEWED: ImageAlphaClear(), minor optimization 2251 + [textures] REVIEWED: ImageToPOT(), renamed parameter 2252 + [textures] REVIEWED: ImageCrop() (#1218) 2253 + [textures] REVIEWED: ImageToPOT() (#1218) 2254 + [textures] REVIEWED: ImageAlphaCrop() (#1218) 2255 + [textures] REVIEWED: ExportImage(), optimized (#1218) 2256 + [textures] REDESIGNED: ImageCrop(), optimized (#1218) 2257 + [textures] REDESIGNED: ImageRotateCCW(), optimized (#1218) 2258 + [textures] REDESIGNED: ImageRotateCW(), optimized (#1218) 2259 + [textures] REDESIGNED: ImageFlipHorizontal(), optimized (#1218) 2260 + [textures] REDESIGNED: ImageFlipVertical(), optimized (#1218) 2261 + [textures] REDESIGNED: ImageResizeCanvas(), optimized (#1218) 2262 + [textures] REDESIGNED: ImageDrawPixel(), optimized 2263 + [textures] REDESIGNED: ImageDrawLine(), optimized 2264 + [textures] REDESIGNED: ImageDraw(), optimized (#1218) 2265 + [textures] REDESIGNED: ImageResize(), optimized (#1218) 2266 + [textures] REDESIGNED: ImageFromImage(), optimized (#1218) 2267 + [textures] REDESIGNED: ImageDraw(), optimization (#1218) 2268 + [textures] REDESIGNED: ImageAlphaClear(), optimized (#1218) 2269 + [textures] REDESIGNED: ExportImageAsCode() to use memory buffer (#1232) 2270 + [textures] REDESIGNED: ColorFromHSV() 2271 + [models] ADDED: DrawTriangle3D() and DrawTriangleStrip3D() 2272 + [models] ADDED: UnloadModelKeepMeshes() 2273 + [models] REVIEWED: LoadModel(), avoid loading texcoords and normals from model if not existent 2274 + [models] REVIEWED: GenMeshCubicmap(), added comments and simplification 2275 + [models] REVIEWED: GenMeshCubicmap(), fixed generated normals (#1244) by @GoldenThumbs 2276 + [models] REVIEWED: GenMeshPoly(), fixed buffer overflow (#1269) by @frithrah 2277 + [models] REVIEWED: LoadOBJ(): Allow for multiple materials in obj files (#1408) by @chriscamacho and @codifies 2278 + [models] REVIEWED: LoadIQM() materials loading (#1227) by @sikor666 2279 + [models] REVIEWED: LoadGLTF() to read from memory buffer 2280 + [models] REVIEWED: UpdateMesh(), fix extra memory allocated when updating color buffer (#1271) by @4yn 2281 + [models] REVIEWED: MeshNormalsSmooth() (#1317) by @seanpringle 2282 + [models] REVIEWED: DrawGrid() (#1417) 2283 + [models] REDESIGNED: ExportMesh() to use memory buffer (#1232) 2284 + [models] REDESIGNED: LoadIQM() and LoadModelAnimations() to use memory buffers 2285 + [audio] ADDED: LoadWaveFromMemory() (#1327) 2286 + [audio] REMOVED: SetMusicLoopCount() 2287 + [audio] REVIEWED: Several functions, sampleCount vs frameCount (#1423) 2288 + [audio] REVIEWED: SaveWAV() to use memory write insted of file 2289 + [audio] REVIEWED: LoadMusicStream(), support WAV music streaming (#1198) 2290 + [audio] REVIEWED: Support multiple WAV sampleSize for MusicStream (#1340) 2291 + [audio] REVIEWED: SetAudioBufferPitch() 2292 + [audio] REDESIGNED: Audio looping system 2293 + [audio] REDESIGNED: LoadSound(): Use memory loading (WAV, OGG, MP3, FLAC) (#1312) 2294 + [audio] REDESIGNED: ExportWaveAsCode() to use memory buffers 2295 + [utils] ADDED: MemAlloc() / MemFree() (#1440) 2296 + [utils] ADDED: UnloadFileData() / UnloadFileText() 2297 + [utils] REVIEWED: android_fopen() to support SDCard access 2298 + [utils] REDESIGNED: SaveFile*() functions to expose file access results (#1420) 2299 + [rmem] REVIEWED: MemPool and other allocators optimization (#1211) by @assyrianic 2300 + [examples] ADDED: core/core_window_flags 2301 + [examples] ADDED: core/core_quat_conversion by @chriscamacho and @codifies 2302 + [examples] ADDED: textures/textures_blend_modes (#1261) by @accidentalrebel 2303 + [examples] ADDED: textures/textures_draw_tiled (#1291) by @Demizdor 2304 + [examples] ADDED: shaders/shaders_hot_reloading (#1198) 2305 + [examples] ADDED: shaders/shaders_rlgl_mesh_instanced (#1318) by @seanpringle 2306 + [examples] ADDED: shaders/shaders_multi_sampler2d 2307 + [examples] ADDED: others/embedded_files_loading 2308 + [examples] REVIEWED: textures/textures_raw_data (#1286) 2309 + [examples] REVIEWED: textures/textures_sprite_explosion, replace resources 2310 + [examples] REVIEWED: textures/textures_particles_blending, replace resources 2311 + [examples] REVIEWED: textures/textures_image_processing, support mouse 2312 + [examples] REVIEWED: models/models_skybox to work on OpenGL ES 2.0 2313 + [examples] REVIEWED: audio/resources, use open license resources 2314 + [examples] REVIEWED: others/raudio_standalone.c 2315 + [build] ADDED: New config.h configuration options exposing multiple #define values 2316 + [build] REMOVED: ANGLE VS2017 template project 2317 + [build] REVIEWED: All MSVC compile warnings 2318 + [build] Updated Makefile for web (#1332) by @rfaile313 2319 + [build] Updated build pipelines to use latest emscripten and Android NDK 2320 + [build] Updated emscriptem build script to generate .a on WebAssembly 2321 + [build] Updated Android build for Linux, supporting ANDROID_NDK at compile time by @branlix3000 2322 + [build] Updated VSCode project template tasks 2323 + [build] Updated VS2017.UWP project template by @Rover656 2324 + [build] Updated Android build pipeline 2325 + [build] REMOVED: AppVeyor and Travis CI build systems 2326 + [*] Moved raysan5/raylib/games to independent repo: raysan5/raylib-games 2327 + [*] Replaced several examples resources with more open licensed alternatives 2328 + [*] Updated BINDINGS.md with NEW bindings and added raylib version binding! 2329 + [*] Updated all external libraries to latest versions 2330 + [*] Multiple code improvements and small fixes 2331 + 2332 + ----------------------------------------------- 2333 + Release: raylib 3.0 (01 April 2020) 2334 + ----------------------------------------------- 2335 + KEY CHANGES: 2336 + - Global context states used on all modules. 2337 + - Custom memory allocators for all modules and dependencies. 2338 + - Centralized file access system and memory data loading. 2339 + - Structures reviewed to reduce size and always be used as pass-by-value. 2340 + - Tracelog messages completely reviewed and categorized. 2341 + - raudio module reviewed to accomodate new Music struct and new miniaudio. 2342 + - text module reviewed to improve fonts generation and text management functions. 2343 + - Multiple new examples added and categorized examples table. 2344 + - GitHub Actions CI implemented for Windows, Linux and macOS. 2345 + 2346 + Detailed changes: 2347 + [build] ADDED: VS2017.ANGLE project, by @msmshazan 2348 + [build] ADDED: VS2017 project support for x64 platform configuration 2349 + [build] ADDED: Makefile for Android building on macOS, by @Yunoinsky 2350 + [build] ADDED: Makefile for Android building on Linux, by @pamarcos 2351 + [build] REMOVED: VS2015 project 2352 + [build] REVIEWED: VSCode project 2353 + [build] REVIEWED: Makefile build system 2354 + [build] REVIEWED: Android building, by @NimbusFox 2355 + [build] REVIEWED: Compilation with CLion IDE, by @Rover656 2356 + [build] REVIEWED: Generation of web examples, by @pamarcos 2357 + [build] REVIEWED: Makefiles path to 'shell.html', by @niorad 2358 + [build] REVIEWED: VS2017 64bit compilation issues, by @spec-chum 2359 + [build] REVIEWED: Multiple fixes on projects building, by @ChrisDill, @JuDelCo, @electronstudio 2360 + [core] ADDED: Support touch/mouse indistinctly 2361 + [core] ADDED: FLAG_WINDOW_ALWAYS_RUN to avoid pause on minimize 2362 + [core] ADDED: Config flag SUPPORT_HALFBUSY_WAIT_LOOP 2363 + [core] ADDED: RPI mouse cursor point support on native mode 2364 + [core] ADDED: GetWorldToScreen2D()- Get screen space position for a 2d camera world space position, by @arvyy 2365 + [core] ADDED: GetScreenToWorld2D() - Get world space position for a 2d camera screen space position, by @arvyy 2366 + [core] ADDED: GetWorldToScreenEx() - Get size position for a 3d world space position 2367 + [core] ADDED: DirectoryExists() - Check if a directory path exists 2368 + [core] ADDED: GetPrevDirectoryPath() - Get previous directory path for a given path 2369 + [core] ADDED: CompressData() - Compress data (DEFLATE algorythm) 2370 + [core] ADDED: DecompressData() - Decompress data (DEFLATE algorythm) 2371 + [core] ADDED: GetWindowPosition() - Get window position XY on monitor 2372 + [core] ADDED: LoadFileData() - Load file data as byte array (read) 2373 + [core] ADDED: SaveFileData() - Save data to file from byte array (write) 2374 + [core] ADDED: LoadFileText() - Load text data from file (read), returns a '\0' terminated string 2375 + [core] ADDED: SaveFileText() - Save text data to file (write), string must be '\0' terminated 2376 + [core] REMOVED: Show raylib logo at initialization 2377 + [core] REVIEWED: GetFileName(), security checks 2378 + [core] REVIEWED: LoadStorageValue(), by @danimartin82 2379 + [core] REVIEWED: SaveStorageValue(), by @danimartin82 2380 + [core] REVIEWED: IsMouseButtonReleased(), when press/release events come too fast, by @oswjk 2381 + [core] REVIEWED: SetWindowMonitor(), by @DropsOfSerenity 2382 + [core] REVIEWED: IsFileExtension() to be case-insensitive 2383 + [core] REVIEWED: IsFileExtension() when checking no-extension files 2384 + [core] REVIEWED: Default font scale filter for HighDPI mode 2385 + [core] REVIEWED: Touch input scaling for PLATFORM_WEB 2386 + [core] REVIEWED: RPI input system, by @DarkElvenAngel 2387 + [core] REVIEWED: RPI input threads issues 2388 + [core] REVIEWED: OpenGL extensions loading and freeing 2389 + [core] REVIEWED: GetDirectoryPath() 2390 + [core] REVIEWED: Camera2D behavior, by @arvyy 2391 + [core] REVIEWED: OpenGL ES 2.0 extensions check 2392 + [rlgl] ADDED: Flags to allow frustrum culling near/far distance configuration at compile time 2393 + [rlgl] ADDED: Flags to sllow MAX_BATCH_BUFFERING config at compile time 2394 + [rlgl] ADDED: GetMatrixProjection(), by @chriscamacho 2395 + [rlgl] ADDED: rlUpdateMeshAt() - Update vertex or index data on GPU, at index, by @brankoku 2396 + [rlgl] REVIEWED: Vertex padding not zeroed for quads, by @kawa-yoiko 2397 + [rlgl] REVIEWED: Read texture data as RGBA from FBO on GLES 2.0 2398 + [rlgl] REVIEWED: LoadShaderCode() for const correctness, by @heretique 2399 + [rlgl] REVIEWED: rlLoadTexture() 2400 + [rlgl] REVIEWED: rlReadTexturePixels() 2401 + [rlgl] REVIEWED: rlUpdateMesh() to supports updating indices, by @brankoku 2402 + [rlgl] REVIEWED: GenTextureCubemap(), renamed parameters for consistency 2403 + [rlgl] REVIEWED: HDR pixels loading 2404 + [raymath] ADDED: MatrixRotateXYZ(), by @chriscamacho 2405 + [raymath] RENAMED: Vector3Multiply() to Vector3Scale() 2406 + [camera] REVIEWED: Free camera pitch, by @chriscamacho 2407 + [camera] REVIEWED: Camera not working properly at z-align, by @Ushio 2408 + [shapes] ADDED: DrawTriangleStrip() - Draw a triangle strip defined by points 2409 + [shapes] ADDED: DrawEllipse() - Draw ellipse 2410 + [shapes] ADDED: DrawEllipseLines() - Draw ellipse outline 2411 + [shapes] ADDED: DrawPolyLines() - Draw a polygon outline of n sides 2412 + [shapes] REVIEWED: DrawPoly() shape rendering, by @AlexHCC 2413 + [textures] ADDED: LoadAnimatedGIF() - Load animated GIF file 2414 + [textures] ADDED: GetImageAlphaBorder() - Get image alpha border rectangle 2415 + [textures] ADDED: ImageFromImage() - Create an image from another image piece 2416 + [textures] ADDED: ImageClearBackground(), by @iamsouravgupta 2417 + [textures] ADDED: ImageDrawPixel(), by @iamsouravgupta 2418 + [textures] ADDED: ImageDrawCircle(), by @iamsouravgupta 2419 + [textures] ADDED: ImageDrawLineEx(), by @iamsouravgupta 2420 + [textures] ADDED: ImageDrawPixelV(), by @RobLoach 2421 + [textures] ADDED: ImageDrawCircleV(), by @RobLoach 2422 + [textures] ADDED: ImageDrawLineV(), by @RobLoach 2423 + [textures] ADDED: ImageDrawRectangleV(), by @RobLoach 2424 + [textures] ADDED: ImageDrawRectangleRec(), by @RobLoach 2425 + [textures] REVIEWED: ImageDrawPixel(), by @RobLoach 2426 + [textures] REVIEWED: ImageDrawLine(), by @RobLoach 2427 + [textures] REVIEWED: ImageDrawCircle(), by @RobLoach 2428 + [textures] REVIEWED: ImageDrawRectangle(), by @RobLoach 2429 + [textures] REVIEWED: ImageDraw(), now it supports color tint parameter 2430 + [textures] REVIEWED: ImageResizeCanvas() 2431 + [textures] REVIEWED: ImageCrop() with security checks 2432 + [textures] REVIEWED: ImageAlphaMask() 2433 + [textures] REVIEWED: ImageDrawRectangleLines() 2434 + [textures] REVIEWED: GetImageData() 2435 + [text] ADDED: TextCopy() - Copy one string to another, returns bytes copied 2436 + [text] ADDED: GetCodepoints() - Get all codepoints in a string 2437 + [text] ADDED: CodepointToUtf8() - Encode codepoint into utf8 text 2438 + [text] ADDED: DrawTextCodepoint() - Draw one character (codepoint) 2439 + [text] RENAMED: LoadDefaultFont() -> LoadFontDefault() 2440 + [text] RENAMED: TextCountCodepoints() -> GetCodepointsCount() 2441 + [text] REVIEWED: TextFormat(), to support caching, by @brankoku 2442 + [text] REVIEWED: LoadFontData(), generate empty image for space character 2443 + [text] REVIEWED: TextSplit() 2444 + [text] REVIEWED: TextToInteger() 2445 + [text] REVIEWED: GetNextCodepoint(), renamed parameters for clarity 2446 + [text] REVIEWED: GenImageFontAtlas(), improved atlas size computing 2447 + [text] REDESIGNED: struct Font, character rectangles have been moved out from CharInfo to Font 2448 + [text] REDESIGNED: struct CharInfo, now includes directly an Image of the glyph 2449 + [text] REDESIGNED: GenImageFontAtlas(), additional recs parameter added 2450 + [text] REDESIGNED: ImageTextEx(), to avoid font retrieval from GPU 2451 + [models] ADDED: Support rlPushMatrix() and rlPopMatrix() on mesh drawing 2452 + [models] ADDED: DrawPoint3D() - Draw a point in 3D space, actually a small line, by @ProfJski 2453 + [models] ADDED: Multi texture support for materials in GLTF format, by @Gamerfiend, @chriscamacho 2454 + [models] REVIEWED: LoadGLTF(), fixed memory leak, by @jubalh 2455 + [models] REVIEWED: LoadIQM(), support multiple animations loading, by @culacant 2456 + [models] REVIEWED: GetCollisionRayModel(), to avoid pointers 2457 + [models] REVIEWED: CheckCollisionRay*(), parameters renamed 2458 + [models] REVIEWED: UnloadMesh(), to avoid pointers 2459 + [models] REVIEWED: LoadModel(), memory initialization 2460 + [models] REVIEWED: UpdateModelAnimation(), added security checks 2461 + [models] REVIEWED: Multiple fixes on models loading, by @jubalh 2462 + [models] REVIEWED: Normals updated when using animated meshes, by @@las3rlars 2463 + [models] REVIEWED: Compilation when the SUPPORT_MESH_GENERATION not set, by @@Elkantor 2464 + [raudio] ADDED: Multi-channel audio playing, by @chriscamacho 2465 + [raudio] REMOVED: LoadWaveEx() 2466 + [raudio] RENAMED: IsAudioBufferProcessed() to IsAudioStreamProcessed() 2467 + [raudio] REVIEWED: Ensure .xm playback starts in the right place, by @illegalinstruction 2468 + [raudio] REVIEWED: Fix short non-looping sounds, by @jbosh 2469 + [raudio] REVIEWED: Modules playing time to full length 2470 + [raudio] REDESIGNED: Replaced Music pointer by struct 2471 + [raudio] REDESIGNED: Removed sampleLeft from Music struct 2472 + [examples] ADDED: core_scissor_test, by @ChrisDill 2473 + [examples] ADDED: core_2d_camera_platformer, by @arvyy 2474 + [examples] ADDED: textures_mouse_painting, by @ChrisDill 2475 + [examples] ADDED: models_waving_cubes, by @codecat 2476 + [examples] ADDED: models_solar_system, by @aldrinmartoq 2477 + [examples] ADDED: shaders_fog, by @chriscamacho 2478 + [examples] ADDED: shaders_texture_waves, by @anatagawa 2479 + [examples] ADDED: shaders_basic_lighting, by @chriscamacho 2480 + [examples] ADDED: shaders_simple_mask, by @chriscamacho 2481 + [examples] ADDED: audio_multichannel_sound, by @chriscamacho 2482 + [examples] ADDED: shaders_spotlight, by @chriscamacho 2483 + [examples] RENAMED: text_sprite_font > text_font_spritefont 2484 + [examples] RENAMED: text_ttf_loading > text_font_filters 2485 + [examples] RENAMED: text_bmfont_ttf > text_font_loading 2486 + [examples] REMOVED: models_obj_viewer 2487 + [examples] REMOVED: models_solar_system 2488 + [examples] REVIEWED: models_obj_loading > models_loading 2489 + [examples] REVIEWED: models_materials_pbr, shader issues 2490 + [examples] REVIEWED: core_window_letterbox, detailed explanation, by @jotac0 2491 + [examples] REVIEWED: core_window_letterbox, virtual mouse, by @anatagawa 2492 + [games] ADDED: GGJ2020 game - RE-PAIR 2493 + [*] Misc fixes and tweaks, by @yaram, @oraoto, @zatherz, @piecedigital, @Shylie 2494 + [*] Update ALL supported projects (Notepad++, VS2017) 2495 + [*] Update ALL external libraries to latest versions (29.Jan.2020) 2496 + [*] Update ALL examples and games 2497 + [*] Update BINDINGS list 2498 + 2499 + ----------------------------------------------- 2500 + Release: raylib 2.5 (May 2019) 2501 + ----------------------------------------------- 2502 + KEY CHANGES: 2503 + - [core] Redesigned Gamepad mechanism, now common to all platforms and gamepads 2504 + - [core] HighDPI monitors support with automatic content scaling 2505 + - [rlgl] Complete module redesign to use one single internal buffer 2506 + - [rlgl] VR system redesign to allow custom device parameters and distortion shader 2507 + - [shapes] New drawing shapes available: CircleSector, Ring and RectangleRounded 2508 + - [text] New text management API (multiple functions) 2509 + - [text] Full Unicode support (utf8 text) 2510 + - [textures] Cubemap textures support 2511 + - [textures] Quad and N-Patch drawing 2512 + - [models] Skeletal model animation support 2513 + - [models] Support multiple meshes per model 2514 + - [models] Support glTF model loading 2515 + 2516 + Detailed changes: 2517 + [build] REVIEWED: Default raylib and examples Makefile 2518 + [build] REVIEWED: Notepad++ NppExec scripts 2519 + [build] REVIEWED: VS2015 and VS2017 projects 2520 + [build] REVIEWED: Android APK build pipeline 2521 + [core] Converted most #defined values as enum values 2522 + [core] Complete redesign of RPI input system to use evdev events 2523 + [core] ADDED: IsWindowResized() - Check if window has been resized 2524 + [core] ADDED: IsWindowHidden() - Check if window is currently hidden 2525 + [core] ADDED: UnhideWindow() - Show the window 2526 + [core] ADDED: HideWindow() - Hide the window 2527 + [core] ADDED: GetWindowHandle() - Get native window handle 2528 + [core] ADDED: GetMonitorCount() - Get number of connected monitors 2529 + [core] ADDED: GetMonitorWidth() - Get primary monitor width 2530 + [core] ADDED: GetMonitorHeight() - Get primary monitor height 2531 + [core] ADDED: GetMonitorPhysicalWidth() - Get primary monitor physical width in millimetres 2532 + [core] ADDED: GetMonitorPhysicalHeight() - Get primary monitor physical height in millimetres 2533 + [core] ADDED: GetMonitorName() - Get the human-readable, UTF-8 encoded name of the primary monitor 2534 + [core] ADDED: GetClipboardText() - Get clipboard text content 2535 + [core] ADDED: SetClipboardText() - Set clipboard text content 2536 + [core] ADDED: ColorFromHSV() - Returns a Color from HSV values 2537 + [core] ADDED: FileExists() - Check if file exists 2538 + [core] ADDED: GetFileNameWithoutExt() - Get filename string without extension (memory should be freed) 2539 + [core] ADDED: GetDirectoryFiles() - Get filenames in a directory path (memory should be freed) 2540 + [core] ADDED: ClearDirectoryFiles() - Clear directory files paths buffers (free memory) 2541 + [core] ADDED: OpenURL() - Open URL with default system browser (if available) 2542 + [core] ADDED: SetMouseOffset() - Set mouse offset 2543 + [core] ADDED: SetMouseScale() - Set mouse scaling 2544 + [core] REMOVED: ShowLogo() - Activate raylib logo at startup (can be done with flags) 2545 + [shapes] ADDED: DrawCircleSector() - Draw a piece of a circle 2546 + [shapes] ADDED: DrawCircleSectorLines() - Draw circle sector outline 2547 + [shapes] ADDED: DrawRing() - Draw ring 2548 + [shapes] ADDED: DrawRingLines() - Draw ring outline 2549 + [shapes] ADDED: DrawRectangleRounded() - Draw rectangle with rounded edges 2550 + [shapes] ADDED: DrawRectangleRoundedLines() - Draw rectangle with rounded edges outline 2551 + [shapes] ADDED: SetShapesTexture() - Define default texture used to draw shapes 2552 + [textures] REVIEWED: ExportImage() - Reorder function parameters 2553 + [textures] REVIEWED: ImageDrawRectangle() - Remove unneeded parameter 2554 + [textures] ADDED: ExportImageAsCode() - Export image as code file defining an array of bytes 2555 + [textures] ADDED: LoadTextureCubemap() - Load cubemap from image, multiple image cubemap layouts supported 2556 + [textures] ADDED: ImageExtractPalette() - Extract color palette from image to maximum size (memory should be freed) 2557 + [textures] ADDED: ImageDrawRectangleLines() - Draw rectangle lines within an image 2558 + [textures] ADDED: DrawTextureQuad() - Draw texture quad with tiling and offset parameters 2559 + [textures] ADDED: DrawTextureNPatch() - Draws a texture (or part of it) that stretches or shrinks nicely 2560 + [models] REVIEWED: LoadMesh() -> LoadMeshes() - Support multiple meshes loading 2561 + [models] REVIEWED: LoadMaterial() -> LoadMaterials() - Support multiple materials loading 2562 + [models] REVIEWED: ExportMesh() - Reorder parameters 2563 + [models] ADDED: DrawCubeWiresV() - Draw cube wires (Vector version) 2564 + [models] ADDED: GenMeshPoly() - Generate polygonal mesh 2565 + [models] ADDED: SetMaterialTexture() - Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...) 2566 + [models] ADDED: SetModelMeshMaterial() - Set material for a mesh 2567 + [models] ADDED: LoadModelAnimations() - Load model animations from file 2568 + [models] ADDED: UpdateModelAnimation() - Update model animation pose 2569 + [models] ADDED: UnloadModelAnimation() - Unload animation data 2570 + [models] ADDED: IsModelAnimationValid() - Check model animation skeleton match 2571 + [rlgl] Improved internal batching mechanism (multibuffering support, triangle texcoords...) 2572 + [rlgl] REVIEWED: rlPushMatrix()/rlPopMatrix() - Now works like OpenGL 1.1 2573 + [rlgl] REVIEWED: SetShaderValue() - More generic, now requires uniform type 2574 + [rlgl] REMOVED: SetShaderValuei() - Can be acoomplished with new SetShaderValue() 2575 + [rlgl] ADDED: SetShaderValueV() - Set shader uniform value vector 2576 + [rlgl] ADDED: SetShaderValueTexture() - Set shader uniform value for texture 2577 + [rlgl] ADDED: BeginScissorMode() - Begin scissor mode (define screen area for following drawing) 2578 + [rlgl] ADDED: EndScissorMode() - End scissor mode 2579 + [rlgl] ADDED: SetVrConfiguration() - Set stereo rendering configuration parameters 2580 + [rlgl] REVIEWED: InitVrSimulator() - No input parameter required, use SetVrConfiguration() 2581 + [text] REVIEWED: LoadFontEx() - Reorder function parameters 2582 + [text] REVIEWED: LoadFontData() - Reorder function parameters 2583 + [text] REVIEWED: GenImageFontAtlas() - Reorder function parameters 2584 + [text] RENAMED: FormatText() -> TextFormat() 2585 + [text] RENAMED: SubText() -> TextSubtext() 2586 + [text] ADDED: LoadFontFromImage() - Load font from Image (XNA style) 2587 + [text] ADDED: DrawTextRec() - Draw text using font inside rectangle limits 2588 + [text] ADDED: DrawTextRecEx() - Draw text using font inside rectangle limits with support for text selection 2589 + [text] ADDED: TextIsEqual() - Check if two text string are equal 2590 + [text] ADDED: TextLength() - Get text length, checks for '\0' ending 2591 + [text] ADDED: TextReplace() - Replace text string (memory should be freed!) 2592 + [text] ADDED: TextInsert() - Insert text in a position (memory should be freed!) 2593 + [text] ADDED: TextJoin() - Join text strings with delimiter 2594 + [text] ADDED: TextSplit() - Split text into multiple strings 2595 + [text] ADDED: TextAppend() - Append text at specific position and move cursor! 2596 + [text] ADDED: TextFindIndex() - Find first text occurrence within a string 2597 + [text] ADDED: TextToUpper() - Get upper case version of provided string 2598 + [text] ADDED: TextToLower() - Get lower case version of provided string 2599 + [text] ADDED: TextToPascal() - Get Pascal case notation version of provided string 2600 + [text] ADDED: TextToInteger() - Get integer value from text (negative values not supported) 2601 + [raudio] ADDED: ExportWave() - Export wave data to file 2602 + [raudio] ADDED: ExportWaveAsCode() - Export wave sample data to code (.h) 2603 + [raudio] ADDED: IsAudioStreamPlaying() - Check if audio stream is playing 2604 + [raudio] ADDED: SetAudioStreamVolume() - Set volume for audio stream (1.0 is max level) 2605 + [raudio] ADDED: SetAudioStreamPitch() - Set pitch for audio stream (1.0 is base level) 2606 + [examples] Complete review of full examples collection, many additions 2607 + [examples] ADDED: core_custom_logging - Custom trace log system 2608 + [examples] ADDED: core_input_multitouch - Multitouch input example 2609 + [examples] ADDED: core_window_letterbox - Window adapted to screen 2610 + [examples] ADDED: core_loading_thread - Data loading in second thread 2611 + [examples] REVIEWED: core_input_gamepad - Adapted to new gamepad system 2612 + [examples] REVIEWED: core_vr_simulator - HMD device parameters and distortion shader should be provided 2613 + [examples] ADDED: core_window_scale_letterbox - Windows resizing and letterbox content 2614 + [examples] ADDED: shapes_rectangle_scaling_mouse - Scale a rectangle with mouse 2615 + [examples] ADDED: shapes_draw_circle_sector - Circle sector drawing 2616 + [examples] ADDED: shapes_draw_ring - Ring drawing 2617 + [examples] ADDED: shapes_draw_rectangle_rounded - Rounded rectangle drawing 2618 + [examples] ADDED: shapes_bouncing_ball - Ball bouncing in the screen 2619 + [examples] ADDED: shapes_collision_area - Collision detection and drawing 2620 + [examples] ADDED: shapes_following_eyes - Some maths on eyes and mouse 2621 + [examples] ADDED: shapes_easings_ball_anim - Ball animation 2622 + [examples] ADDED: shapes_easings_box_anim - Box animation 2623 + [examples] ADDED: shapes_easings_rectangle_array - Rectangles animation 2624 + [examples] REVIEWED: shapes_colors_palette - Reviewed color selection and text displaying 2625 + [examples] ADDED: textures_background_scrolling - Scrolling and parallaz background effect 2626 + [examples] ADDED: textures_image_npatch - Drawing N-Patch based boxes 2627 + [examples] ADDED: textures_sprite_button - Sprite button with sound 2628 + [examples] ADDED: textures_sprite_explosion - Sprite explosion with sound 2629 + [examples] ADDED: textures_bunnymark - Benchmarking test 2630 + [examples] ADDED: text_draw_inside_rectangle - Drawing text inside a delimited rectangle box 2631 + [examples] ADDED: text_unicode - Multiple languages text drawing 2632 + [examples] ADDED: text_rectangle_bound - Fit text inside a rectangle 2633 + [examples] REVIEWED: text_bmfont_ttf - Simplified example 2634 + [examples] ADDED: models_animation - Animated models loading and animation playing 2635 + [examples] ADDED: models_obj_viewer - Draw and drop models viewer 2636 + [examples] ADDED: models_rlgl_solar_system - Solar system simulation using rlgl functionality 2637 + [examples] ADDED: models_first_person_maze - 3D maze fps 2638 + [examples] ADDED: shaders_palette_switch - Switching color palette on shader 2639 + [examples] ADDED: shaders_raymarching - Raymarching shader 2640 + [examples] ADDED: shaders_texture_drawing - Texture drawing on GPU 2641 + [examples] ADDED: shaders_texture_waves - Texture waves on shader 2642 + [examples] ADDED: shaders_julia_set - Julia set fractals 2643 + [examples] ADDED: shaders_eratosthenes - Prime number visualization shader 2644 + [examples] REVIEWED: audio_raw_stream - Mostly rewritten 2645 + [games] ADDED: GGJ19 game - Cat vs Roomba 2646 + [*] Updated external libraries to latest version 2647 + [*] Multiple bugs corrected (check github issues) 2648 + 2649 + ----------------------------------------------- 2650 + Release: raylib 2.0 (July 2018) 2651 + ----------------------------------------------- 2652 + KEY CHANGES: 2653 + - Removed external dependencies (GLFW3 and OpenAL) 2654 + - Complete redesign of audio module to use miniaudio library 2655 + - Support AppVeyor and Travis CI (continuous integration) building 2656 + - Reviewed raymath.h for better consistency and performance (inlining) 2657 + - Refactor all #define SUPPORT_* into a single config.h 2658 + - Support TCC compiler (32bit and 64bit) 2659 + 2660 + Detailed changes: 2661 + [build] REMOVED: GitHub develop branch 2662 + [build] REMOVED: External dependencies GLFW and OpenAL 2663 + [build] ADDED: Android 64bit ARM support 2664 + [build] ADDED: FreeBSD, OpenBSD, NetBSD, Dragon Fly OS support 2665 + [build] ADDED: Universal Windows Platform (UWP) support 2666 + [build] ADDED: Wayland Linux desktop support 2667 + [build] ADDED: AppVeyor CI for automatic Windows builds 2668 + [build] ADDED: Travis CI for automatic Linux/macOS builds 2669 + [build] ADDED: rglfw (GLFW3 module) to avoid external dependency 2670 + [build] ADDED: VS2017 UWP project 2671 + [build] ADDED: Builder project template 2672 + [build] ADDED: Compiler memory sanitizer for better debug 2673 + [build] ADDED: CMake package target and CI auto-deploy tags 2674 + [build] ADDED: DEBUG library building support 2675 + [build] ADDED: Notepad++ NppExec scripts 2676 + [build] REVIEWED: VS2015 and VS2017 projects 2677 + [build] REVIEWED: Android APK build pipeline 2678 + [core] REVIEWED: Window creation hints to support transparent windows 2679 + [core] Unified InitWindow() between platforms 2680 + [core] Export Android main entry point 2681 + [core] RENAMED: Begin3dMode() to BeginMode3D() 2682 + [core] RENAMED: End3dMode() to EndMode3D() 2683 + [core] RENAMED: Begin2dMode() to BeginMode2D() 2684 + [core] RENAMED: End2dMode() to EndMode2D() 2685 + [core] RENAMED: struct Camera to Camera3D 2686 + [core] RENAMED: struct SpriteFont to Font -> plus all required functions! 2687 + [core] RENAMED: enum TextureFormat to PixelFormat 2688 + [core] REVIEWED: Rectangle params int to float 2689 + [core] REVIEWED: timing system for macOS 2690 + [core] REMOVED: ColorToFloat() 2691 + [core] ADDED: GetCurrentTime() on macOS 2692 + [core] ADDED: GetTime() 2693 + [core] ADDED: struct Vector4 2694 + [core] ADDED: SetTraceLog() to define trace log messages type 2695 + [core] ADDED: GetFileName() to get filename from path string 2696 + [core] ADDED: ColorToHSV() 2697 + [core] ADDED: ColorNormalize() 2698 + [core] ADDED: SetWindowSize() to scale Windows in runtime 2699 + [core] ADDED: SetMouseScale() to scale mouse input 2700 + [core] ADDED: key definitions - KEY_GRAVE, KEY_SLASH, KEY_BACKSLASH 2701 + [core] RENAMED: GetHexValue() to ColorToInt() 2702 + [core] REVIEWED: Fade() 2703 + [core] REVIEWED: InitWindow() to avoid void pointer (safety) 2704 + [core] Support camera 3d orthographic projection mode 2705 + [shapes] ADDED: DrawRectangleLinesEx() 2706 + [textures] Improved pixel formats support (32bit channels) 2707 + [textures] Improved textures support for OpenGL 2.1 2708 + [textures] REMOVED: DrawRectangleT() --> Added support to DrawRectangle() 2709 + [textures] ADDED: GetPixelDataSize(); pixel data size in bytes (image or texture) 2710 + [textures] ADDED: ImageAlphaClear() --> Clear alpha channel to desired color 2711 + [textures] ADDED: ImageAlphaCrop() --> Crop image depending on alpha value 2712 + [textures] ADDED: ImageAlphaPremultiply() --> Premultiply alpha channel 2713 + [textures] ADDED: ImageDrawRectangle() 2714 + [textures] ADDED: ImageMipmaps() 2715 + [textures] ADDED: GenImageColor() 2716 + [textures] ADDED: GetPixelDataSize() 2717 + [textures] ADDED: ImageRotateCW() 2718 + [textures] ADDED: ImageRotateCCW() 2719 + [textures] ADDED: ImageResizeCanvas() 2720 + [textures] ADDED: GetImageDataNormalized() 2721 + [textures] REVIEWED: ImageFormat() to use normalized data 2722 + [textures] REVIEWED: Manual mipmap generation 2723 + [textures] REVIEWED: LoadASTC() 2724 + [textures] REVIEWED: GenImagePerlinNoise() 2725 + [textures] REVIEWED: ImageTextEx() to support UTF8 basic characters 2726 + [textures] REVIEWED: GetTextureData() for RPI - requires some work 2727 + [textures] Added new example: text drawing on image 2728 + [text] Corrected issue with ttf font y-offset 2729 + [text] Support SDF font data generation 2730 + [text] ADDED: GenImageFontAtlas() 2731 + [text] ADDED: LoadFontData() to load data from TTF file 2732 + [text] REMOVED: LoadTTF() internal function 2733 + [text] REVIEWED: DrawTextEx() - avoid rendering SPACE character! 2734 + [text] RENAMED: GetDefaultFont() to GetFontDefault() 2735 + [rlgl] ADDED: rlCheckBufferLimit() 2736 + [rlgl] ADDED: LoadShaderCode() 2737 + [rlgl] ADDED: GetMatrixModelview() 2738 + [rlgl] ADDED: SetVrDistortionShader(Shader shader) 2739 + [rlgl] REVIEWED: rlLoadTexture() - added mipmaps support, improved compressed textures loading 2740 + [rlgl] REVIEWED: rlReadTexturePixels() 2741 + [models] Support 4 components mesh.tangent data 2742 + [models] Removed tangents generation from LoadOBJ() 2743 + [models] ADDED: MeshTangents() 2744 + [models] ADDED: MeshBinormals() 2745 + [models] ADDED: ExportMesh() 2746 + [models] ADDED: GetCollisionRayModel() 2747 + [models] RENAMED: CalculateBoundingBox() to MeshBoundingBox() 2748 + [models] REMOVED: GetCollisionRayMesh() - does not consider model transform 2749 + [models] REVIEWED: LoadMesh() - fallback to default cube mesh if loading fails 2750 + [audio] ADDED: Support for MP3 fileformat 2751 + [audio] ADDED: IsAudioStreamPlaying() 2752 + [audio] ADDED: SetAudioStreamVolume() 2753 + [audio] ADDED: SetAudioStreamPitch() 2754 + [utils] Corrected issue with SaveImageAs() 2755 + [utils] RENAMED: SaveImageAs() to ExportImage() 2756 + [utils] REMOVED: rres support - moved to external library (rres.h) 2757 + [shaders] REVIEWED: GLSL 120 shaders 2758 + [raymath] ADDED: Vector3RotateByQuaternion() 2759 + [raymath] REVIEWED: math usage to reduce temp variables 2760 + [raymath] REVIEWED: Avoid pointer-based parameters for API consistency 2761 + [physac] REVIEWED: physac.h timing system 2762 + [examples] Replaced dwarf model by brand new 3d assets: 3d medieval buildings 2763 + [examples] Assets cleaning and some replacements 2764 + [games] ADDED: GGJ18 game - transmission mission 2765 + [games] REVIEWED: Light my Ritual game - improved gameplay drawing 2766 + [*] Updated external libraries to latest version 2767 + [*] Multiple bugs corrected (check github issues) 2768 + 2769 + ----------------------------------------------- 2770 + Release: raylib 1.8.0 (Oct 2017) 2771 + ----------------------------------------------- 2772 + NOTE: 2773 + In this release, multiple parts of the library have been reviewed (again) for consistency and simplification. 2774 + It exposes more than 30 new functions in comparison with previous version and it improves overall programming experience. 2775 + 2776 + BIG CHANGES: 2777 + - New Image generation functions: Gradient, Checked, Noise, Cellular... 2778 + - New Mesh generation functions: Cube, Sphere, Cylinder, Torus, Knot... 2779 + - New Shaders and Materials systems to support PBR materials 2780 + - Custom Android APK build pipeline with simple Makefile 2781 + - Complete review of rlgl layer functionality 2782 + - Complete review of raymath functionality 2783 + 2784 + detailed changes: 2785 + [rlgl] RENAMED: rlglLoadTexture() to rlLoadTexture() 2786 + [rlgl] RENAMED: rlglLoadRenderTexture() to rlLoadRenderTexture() 2787 + [rlgl] RENAMED: rlglUpdateTexture() to rlUpdateTexture() 2788 + [rlgl] RENAMED: rlglGenerateMipmaps() to rlGenerateMipmaps() 2789 + [rlgl] RENAMED: rlglReadScreenPixels() to rlReadScreenPixels() 2790 + [rlgl] RENAMED: rlglReadTexturePixels() to rlReadTexturePixels() 2791 + [rlgl] RENAMED: rlglLoadMesh() to rlLoadMesh() 2792 + [rlgl] RENAMED: rlglUpdateMesh() to rlUpdateMesh() 2793 + [rlgl] RENAMED: rlglDrawMesh() to rlDrawMesh() 2794 + [rlgl] RENAMED: rlglUnloadMesh() to rlUnloadMesh() 2795 + [rlgl] RENAMED: rlglUnproject() to rlUnproject() 2796 + [rlgl] RENAMED: LoadCompressedTexture() to LoadTextureCompressed() 2797 + [rlgl] RENAMED: GetDefaultTexture() to GetTextureDefault() 2798 + [rlgl] RENAMED: LoadDefaultShader() to LoadShaderDefault() 2799 + [rlgl] RENAMED: LoadDefaultShaderLocations() to SetShaderDefaultLocations() 2800 + [rlgl] RENAMED: UnloadDefaultShader() to UnLoadShaderDefault() 2801 + [rlgl] ADDED: rlGenMapCubemap(), Generate cubemap texture map from HDR texture 2802 + [rlgl] ADDED: rlGenMapIrradiance(), Generate irradiance texture map 2803 + [rlgl] ADDED: rlGenMapPrefilter(), Generate prefilter texture map 2804 + [rlgl] ADDED: rlGenMapBRDF(), Generate BRDF texture map 2805 + [rlgl] ADDED: GetVrDeviceInfo(), Get VR device information for some standard devices 2806 + [rlgl] REVIEWED: InitVrSimulator(), to accept device parameters as input 2807 + [core] ADDED: SetWindowTitle(), Set title for window (only PLATFORM_DESKTOP) 2808 + [core] ADDED: GetExtension(), Get file extension 2809 + [shapes] REMOVED: DrawRectangleGradient(), replaced by DrawRectangleGradientV() and DrawRectangleGradientH() 2810 + [shapes] ADDED: DrawRectangleGradientV(), Draw a vertical-gradient-filled rectangle 2811 + [shapes] ADDED: DrawRectangleGradientH(), Draw a horizontal-gradient-filled rectangle 2812 + [shapes] ADDED: DrawRectangleGradientEx(), Draw a gradient-filled rectangle with custom vertex colors 2813 + [shapes] ADDED: DrawRectangleT(), Draw rectangle using text character 2814 + [textures] ADDED: SaveImageAs(), Save image as PNG file 2815 + [textures] ADDED: GenImageGradientV(), Generate image: vertical gradient 2816 + [textures] ADDED: GenImageGradientH(), Generate image: horizontal gradient 2817 + [textures] ADDED: GenImageGradientRadial(), Generate image: radial gradient 2818 + [textures] ADDED: GenImageChecked(), Generate image: checked 2819 + [textures] ADDED: GenImageWhiteNoise(), Generate image: white noise 2820 + [textures] ADDED: GenImagePerlinNoise(), Generate image: perlin noise 2821 + [textures] ADDED: GenImageCellular(), Generate image: cellular algorithm. Bigger tileSize means bigger cells 2822 + [textures] ADDED: GenTextureCubemap(), Generate cubemap texture from HDR texture 2823 + [textures] ADDED: GenTextureIrradiance(), Generate irradiance texture using cubemap data 2824 + [textures] ADDED: GenTexturePrefilter(), Generate prefilter texture using cubemap data 2825 + [textures] ADDED: GenTextureBRDF(), Generate BRDF texture using cubemap data 2826 + [models] REMOVED: LoadMeshEx(), Mesh struct variables can be directly accessed 2827 + [models] REMOVED: UpdateMesh(), very ineficient 2828 + [models] REMOVED: LoadHeightmap(), use GenMeshHeightmap() and LoadModelFromMesh() 2829 + [models] REMOVED: LoadCubicmap(), use GenMeshCubicmap() and LoadModelFromMesh() 2830 + [models] RENAMED: LoadDefaultMaterial() to LoadMaterialDefault() 2831 + [models] ADDED: GenMeshPlane(), Generate plane mesh (with subdivisions) 2832 + [models] ADDED: GenMeshCube(), Generate cuboid mesh 2833 + [models] ADDED: GenMeshSphere(), Generate sphere mesh (standard sphere) 2834 + [models] ADDED: GenMeshHemiSphere(), Generate half-sphere mesh (no bottom cap) 2835 + [models] ADDED: GenMeshCylinder(), Generate cylinder mesh 2836 + [models] ADDED: GenMeshTorus(), Generate torus mesh 2837 + [models] ADDED: GenMeshKnot(), Generate trefoil knot mesh 2838 + [models] ADDED: GenMeshHeightmap(), Generate heightmap mesh from image data 2839 + [models] ADDED: GenMeshCubicmap(), Generate cubes-based map mesh from image data 2840 + [raymath] REVIEWED: full Matrix functionality to align with GLM in usage 2841 + [raymath] RENAMED: Vector3 functions for consistency: Vector*() renamed to Vector3*() 2842 + [build] Integrate Android APK building into examples Makefile 2843 + [build] Integrate Android APK building into templates Makefiles 2844 + [build] Improved Visual Studio 2015 project, folders, references... 2845 + [templates] Reviewed the full pack to support Android building 2846 + [examples] Reviewed full collection to adapt to raylib changes 2847 + [examples] [textures] ADDED: textures_image_generation 2848 + [examples] [models] ADDED: models_mesh_generation 2849 + [examples] [models] ADDED: models_material_pbr 2850 + [examples] [models] ADDED: models_skybox 2851 + [examples] [models] ADDED: models_yaw_pitch_roll 2852 + [examples] [others] REVIEWED: rlgl_standalone 2853 + [examples] [others] REVIEWED: audio_standalone 2854 + [github] Moved raylib webpage to own repo: github.com/raysan5/raylib.com 2855 + [games] Reviewed game: Koala Seasons 2856 + [*] Updated STB libraries to latest version 2857 + [*] Multiple bugs corrected (check github issues) 2858 + 2859 + ----------------------------------------------- 2860 + Release: raylib 1.7.0 (20 May 2017) 2861 + ----------------------------------------------- 2862 + NOTE: 2863 + In this new raylib release, multiple parts of the library have been reviewed for consistency and simplification. 2864 + It exposes almost 300 functions, around 30 new functions in comparison with previous version and, again, 2865 + it sets a stepping stone towards raylib future. 2866 + 2867 + BIG changes: 2868 + - More than 30 new functions added to the library, check list below. 2869 + - Support of configuration flags on every raylib module, to customize library build. 2870 + - Improved build system for all supported platforms with a unique Makefile to compile sources. 2871 + - Complete review of examples and sample games, added new sample material. 2872 + - Support automatic GIF recording of current window, just pressing Ctrl+F12 2873 + - Improved library consistency and organization in general. 2874 + 2875 + other changes: 2876 + [core] Added function: SetWindowIcon(), to setup icon by code 2877 + [core] Added function: SetWindowMonitor(), to set current display monitor 2878 + [core] Added function: SetWindowMinSize(), to set minimum resize size 2879 + [core] Added function: TakeScreenshot(), made public to API (also launched internally with F12) 2880 + [core] Added function: GetDirectoryPath(), get directory for a given fileName (with path) 2881 + [core] Added function: GetWorkingDirectory(), get current working directory 2882 + [core] Added function: ChangeDirectory(), change working directory 2883 + [core] Added function: TraceLog(), made public to API 2884 + [core] Improved timing system to avoid busy wait loop on frame sync: Wait() 2885 + [core] Added support for gamepad on HTML5 platform 2886 + [core] Support mouse lock, useful for camera system 2887 + [core] Review functions description comments 2888 + [rlgl] Removed function: GetStandardShader(), removed internal standard shader 2889 + [rlgl] Removed function: CreateLight(), removed internal lighting system 2890 + [rlgl] Removed function: DestroyLight(), removed internal lighting system 2891 + [rlgl] Removed function: InitVrDevice(), removed VR device render, using simulator 2892 + [rlgl] Removed function: CloseVrDevice(), removed VR device render, using simulator 2893 + [rlgl] Removed function: IsVrDeviceReady(), removed VR device render, using simulator 2894 + [rlgl] Removed function: IsVrSimulator(), removed VR device render, using simulator 2895 + [rlgl] Added function: InitVrSimulator(), init VR simulator for selected device 2896 + [rlgl] Added function: CloseVrSimulator(), close VR simulator for current device 2897 + [rlgl] Added function: IsVrSimulatorReady(), detect if VR device is ready 2898 + [rlgl] Added function: BeginVrDrawing(), begin VR simulator stereo rendering 2899 + [rlgl] Added function: EndVrDrawing(), end VR simulator stereo rendering 2900 + [rlgl] Renamed function: ReadTextFile() to LoadText() and exposed to API 2901 + [rlgl] Removed internal lighting system and standard shader, moved to example 2902 + [rlgl] Removed Oculus Rift support, moved to oculus_rift example 2903 + [rlgl] Removed VR device support and replaced by VR simulator 2904 + [shapes] Added function: DrawLineEx(), draw line with QUADS, supports custom line thick 2905 + [shapes] Added function: DrawLineBezier(), draw a line using cubic-bezier curves in-out 2906 + [shapes] Added function: DrawRectanglePro(), draw a color-filled rectangle with pro parameters 2907 + [textures] Removed function: LoadImageFromRES(), redesigning custom RRES fileformat 2908 + [textures] Removed function: LoadTextureFromRES(), redesigning custom RRES fileformat 2909 + [textures] Removed function: LoadTextureEx(), use instead Image -> LoadImagePro(), LoadImageEx() 2910 + [textures] Added function: LoadImagePro()), load image from raw data with parameters 2911 + [textures] Review TraceLog() message when image file not found 2912 + [text] Renamed function: LoadSpriteFontTTF() to LoadSpriteFontEx(), for consistency 2913 + [text] Removed rBMF fileformat support, replaced by .png 2914 + [text] Refactor SpriteFont struct (better for rres custom fileformat) 2915 + [text] Renamed some variables for consistency 2916 + [models] Added function: LoadMesh(), load mesh from file 2917 + [models] Added function: LoadMeshEx(), load mesh from vertex data 2918 + [models] Added function: UnloadMesh(), unload mesh from memory (RAM and/or VRAM) 2919 + [models] Added function: GetCollisionRayMesh(), get collision info between ray and mesh 2920 + [models] Added function: GetCollisionRayTriangle(), get collision info between ray and triangle 2921 + [models] Added function: GetCollisionRayGround(), get collision info between ray and ground plane 2922 + [models] Renamed function: LoadModelEx() to LoadModelFromMesh() 2923 + [models] Removed function: DrawLight(), removed internal lighting system 2924 + [models] Renamed function: LoadModelEx() to LoadModelFromMesh() for consistency 2925 + [models] Removed function: LoadStandardMaterial(), removed internal standard shader 2926 + [models] Removed function: LoadModelFromRES(), redesigning custom RRES fileformat 2927 + [models] Renamed multiple variables for consistency 2928 + [audio] Added function: SetMasterVolume(), define listener volume 2929 + [audio] Added function: ResumeSound(), resume a paused sound 2930 + [audio] Added function: SetMusicLoopCount(), set number of repeats for a music 2931 + [audio] Added function: LoadWaveEx(), load wave from raw audio data 2932 + [audio] Added function: WaveCrop(), crop wave audio data 2933 + [audio] Added function: WaveFormat(), format audio data 2934 + [audio] Removed function: LoadSoundFromRES(), redesigning custom RRES fileformat 2935 + [audio] Added support for 32bit audio samples 2936 + [audio] Preliminary support for multichannel, limited to mono and stereo 2937 + [audio] Make sure buffers are ready for update: UpdateMusicStream() 2938 + [utils] Replaced function: GetExtension() by IsFileExtension() and made public to API 2939 + [utils] Unified function: TraceLog() between Android and other platforms 2940 + [utils] Removed internal function: GetNextPOT(), simplified implementation 2941 + [raymath] Added function: QuaternionToEuler(), to work with Euler angles 2942 + [raymath] Added function: QuaternionFromEuler(), to work with Euler angles 2943 + [raymath] Added multiple Vector2 math functions 2944 + [build] Integrate Android source building into Makefile 2945 + [example] Added example: shapes_lines_bezier 2946 + [example] Added example: text_input_box 2947 + [github] Moved gh-pages branch to master/docs 2948 + [github] Moved rlua.h and Lua examples to own repo: raylib-lua 2949 + [games] Reviewed full games collection 2950 + [games] New game added to collection: Koala Seasons 2951 + [*] Reviewed and improved examples collection (new assets) 2952 + [*] Reorganized library functions, structs, enums 2953 + [*] Updated STB libraries to latest version 2954 + 2955 + ----------------------------------------------- 2956 + Release: raylib 1.6.0 (20 November 2016) 2957 + ----------------------------------------------- 2958 + NOTE: 2959 + This new raylib version commemorates raylib 3rd anniversary and represents another complete review of the library. 2960 + It includes some interesting new features and is a stepping stone towards raylib future. 2961 + 2962 + HUGE changes: 2963 + [rlua] Lua BINDING: Complete raylib Lua binding, ALL raylib functions ported to Lua plus the +60 code examples. 2964 + [audio] COMPLETE REDESIGN: Improved music support and also raw audio data processing and playing, +20 new functions added. 2965 + [physac] COMPLETE REWRITE: Improved performance, functionality and simplified usage, moved to own repository and added multiple examples! 2966 + 2967 + other changes: 2968 + 2969 + [core] Corrected issue on OSX with HighDPI display 2970 + [core] Added flag to allow resizable window 2971 + [core] Allow no default font loading 2972 + [core] Corrected old issue with mouse buttons on web 2973 + [core] Improved gamepad support, unified across platforms 2974 + [core] Gamepad id functionality: GetGamepadName(), IsGamepadName() 2975 + [core] Gamepad buttons/axis checking functionality: 2976 + [core] Reviewed Android key inputs system, unified with desktop 2977 + [rlgl] Redesigned lighting shader system 2978 + [rlgl] Updated standard shader for better performance 2979 + [rlgl] Support alpha on framebuffer: rlglLoadRenderTexture() 2980 + [rlgl] Reviewed UpdateVrTracking() to update camera 2981 + [rlgl] Added IsVrSimulator() to check for VR simulator 2982 + [shapes] Corrected issue on DrawPolyEx() 2983 + [textures] Simplified supported image formats support 2984 + [textures] Improved text drawing within an image: ImageDrawText() 2985 + [textures] Support image alpha mixing: ImageAlphaMask() 2986 + [textures] Support textures filtering: SetTextureFilter() 2987 + [textures] Support textures wrap modes: SetTextureWrap() 2988 + [text] Improved TTF spritefont generation: LoadSpriteFontTTF() 2989 + [text] Improved AngelCode fonts support (unordered chars) 2990 + [text] Added TraceLog info on image spritefont loading 2991 + [text] Improved text measurement: MeasureTextEx() 2992 + [models] Improved OBJ loading flexibility 2993 + [models] Reviewed functions: DrawLine3D(), DrawCircle3D() 2994 + [models] Removed function: ResolveCollisionCubicmap() 2995 + [camera] Redesigned camera system and ported to header-only 2996 + [camera] Removed function: UpdateCameraPlayer() 2997 + [gestures] Redesigned gestures module to header-only 2998 + [audio] Simplified Music loading and playing system 2999 + [audio] Added trace on audio device closing 3000 + [audio] Reviewed Wave struct, improved flexibility 3001 + [audio] Support sound data update: UpdateSound() 3002 + [audio] Added support for FLAC audio loading/streaming 3003 + [raygui] Removed raygui from raylib repo (moved to own repo) 3004 + [build] Added OpenAL static library 3005 + [build] Added Visual Studio 2015 projects 3006 + [build] Support shared/dynamic raylib compilation 3007 + [*] Updated LibOVR to SDK version 1.8 3008 + [*] Updated games to latest raylib version 3009 + [*] Improved examples and added new ones 3010 + [*] Improved Android support 3011 + 3012 + ----------------------------------------------- 3013 + Release: raylib 1.5.0 (18 July 2016) 3014 + ----------------------------------------------- 3015 + NOTE: 3016 + Probably this new version is the biggest boost of the library ever, lots of parts of the library have been redesigned, 3017 + lots of bugs have been solved and some **AMAZING** new features have been added. 3018 + 3019 + HUGE changes: 3020 + [rlgl] OCULUS RIFT CV1: Added support for VR, not oly Oculus Rift CV1 but also stereo rendering simulator (multiplatform). 3021 + [rlgl] MATERIALS SYSTEM: Added support for Materials (.mtl) and multiple material properties: diffuse, specular, normal. 3022 + [rlgl] LIGHTING SYSTEM: Added support for up to 8 lights of 3 different types: Omni, Directional and Spot. 3023 + [physac] REDESIGNED: Improved performance and simplified usage, physic objects now are managed internally in a second thread! 3024 + [audio] CHIPTUNES: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels supported. 3025 + 3026 + other changes: 3027 + 3028 + [core] Review Android button inputs 3029 + [core] Support Android internal data storage 3030 + [core] Renamed WorldToScreen() to GetWorldToScreen() 3031 + [core] Removed function SetCustomCursor() 3032 + [core] Removed functions BeginDrawingEx(), BeginDrawingPro() 3033 + [core] Replaced functions InitDisplay() + InitGraphics() with: InitGraphicsDevice() 3034 + [core] Added support for field-of-view Y (fovy) on 3d Camera 3035 + [core] Added 2D camera mode functions: Begin2dMode() - End2dMode() 3036 + [core] Translate mouse inputs to Android touch/gestures internally 3037 + [core] Translate mouse inputs as touch inputs in HTML5 3038 + [core] Improved function GetKeyPressed() to support multiple keys (including function keys) 3039 + [core] Improved gamepad support, specially for RaspberryPi (including multiple gamepads support) 3040 + [rlgl] Support stereo rendering simulation (duplicate draw calls by viewport, optimized) 3041 + [rlgl] Added distortion shader (embeded) to support custom VR simulator: shader_distortion.h 3042 + [rlgl] Added support for OpenGL 2.1 on desktop 3043 + [rlgl] Improved 2D vs 3D drawing system (lines, triangles, quads) 3044 + [rlgl] Improved DXT-ETC1 support on HTML5 3045 + [rlgl] Review function: rlglUnproject() 3046 + [rlgl] Removed function: rlglInitGraphics(), integrated into rlglInit() 3047 + [rlgl] Updated Mesh and Shader structs 3048 + [rlgl] Simplified internal (default) dynamic buffers 3049 + [rlgl] Added support for indexed and dynamic mesh data 3050 + [rlgl] Set fixed vertex attribs location points 3051 + [rlgl] Improved mesh data loading support 3052 + [rlgl] Added standard shader (embeded) to support materials and lighting: shader_standard.h 3053 + [rlgl] Added light functions: CreateLight(), DestroyLight() 3054 + [rlgl] Added wire mode functions: rlDisableWireMode(), rlEnableWireMode() 3055 + [rlgl] Review function consistency, added: rlglLoadMesh(), rlglUpdateMesh(), rlglDrawMesh(), rlglUnloadMesh() 3056 + [rlgl] Replaced SetCustomShader() by: BeginShaderMode() - EndShaderMode() 3057 + [rlgl] Replaced SetBlendMode() by: BeginBlendMode() - EndBlendMode() 3058 + [rlgl] Added functions to customize internal matrices: SetMatrixProjection(), SetMatrixModelview() 3059 + [rlgl] Unified internal shaders to only one default shader 3060 + [rlgl] Added support for render to texture (RenderTexture2D): 3061 + LoadRenderTexture() - UnloadRenderTexture() 3062 + BeginTextureMode() - EndTextureMode() 3063 + [rlgl] Removed SetShaderMap*() functions 3064 + [rlgl] Redesigned default buffers usage functions: 3065 + LoadDefaultBuffers() - UnloadDefaultBuffers() 3066 + UpdateDefaultBuffers() - DrawDefaultBuffers() 3067 + [shapes] Corrected bug on GetCollisionRec() 3068 + [textures] Added support for Nearest-Neighbor image scaling 3069 + [textures] Added functions to draw text on image: ImageDrawText(), ImageDrawTextEx() 3070 + [text] Reorganized internal functions: Added LoadImageFont() 3071 + [text] Security check for unsupported BMFonts 3072 + [models] Split mesh creation from model loading on heightmap and cubicmap 3073 + [models] Updated BoundingBox collision detections 3074 + [models] Added color parameter to DrawBoundigBox() 3075 + [models] Removed function: DrawQuad() 3076 + [models] Removed function: SetModelTexture() 3077 + [models] Redesigned DrawPlane() to use RL_TRIANGLES 3078 + [models] Redesigned DrawRectangleV() to use RL_TRIANGLES 3079 + [models] Redesign to accomodate new materials system: LoadMaterial() 3080 + [models] Added material functions: LoadDefaultMaterial(), LoadStandardMaterial() 3081 + [models] Added MTL material loading support: LoadMTL() 3082 + [models] Added function: DrawLight() 3083 + [audio] Renamed SoundIsPlaying() to IsSoundPlaying() 3084 + [audio] Renamed MusicIsPlaying() to IsMusicPlaying() 3085 + [audio] Support multiple Music streams (indexed) 3086 + [audio] Support multiple mixing channels 3087 + [gestures] Improved and reviewed gestures system 3088 + [raymath] Added QuaternionInvert() 3089 + [raymath] Removed function: PrintMatrix() 3090 + [raygui] Ported to header-only library (https://github.com/raysan5/raygui) 3091 + [shaders] Added depth drawing shader (requires a depth texture) 3092 + [shaders] Reviewed included shaders and added comments 3093 + [OpenAL Soft] Updated to latest version (1.17.2) 3094 + [GLFW3] Updated to latest version (3.2) 3095 + [stb] Updated to latest headers versions 3096 + [GLAD] Converted to header only library and simplified to only used extensions 3097 + [*] Reorganize library folders: external libs moved to src/external folder 3098 + [*] Reorganize src folder for Android library 3099 + [*] Review external dependencies usage 3100 + [*] Improved Linux and OSX build systems 3101 + [*] Lots of tweaks and bugs corrected all around 3102 + 3103 + ----------------------------------------------- 3104 + Release: raylib 1.4.0 (22 February 2016) 3105 + ----------------------------------------------- 3106 + NOTE: 3107 + This version supposed another big improvement for raylib, including new modules and new features. 3108 + More than 30 new functions have been added to previous raylib version. 3109 + Around 8 new examples and +10 new game samples have been added. 3110 + 3111 + BIG changes: 3112 + [textures] IMAGE MANIPULATION: Functions to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image. 3113 + [text] SPRITEFONT SUPPORT: Added support for AngelCode fonts (.fnt) and TrueType fonts (.ttf). 3114 + [gestures] REDESIGN: Gestures system simplified and prepared to process generic touch events, including mouse events (multiplatform). 3115 + [physac] NEW MODULE: Basic 2D physics support, use colliders and rigidbodies; apply forces to physic objects. 3116 + 3117 + other changes: 3118 + 3119 + [rlgl] Removed GLEW library dependency, now using GLAD 3120 + [rlgl] Implemented alternative to glGetTexImage() on OpenGL ES 3121 + [rlgl] Using depth data on batch drawing 3122 + [rlgl] Reviewed glReadPixels() function 3123 + [core][rlgl] Reviewed raycast system, now 3D picking works 3124 + [core] Android: Reviewed Android App cycle, paused if inactive 3125 + [shaders] Implemented Blinn-Phong lighting shading model 3126 + [textures] Implemented Floyd-Steinberg dithering - ImageDither() 3127 + [text] Added line-break support to DrawText() 3128 + [text] Added TrueType Fonts support (using stb_truetype) 3129 + [models] Implement function: CalculateBoundingBox(Mesh mesh) 3130 + [models] Added functions to check Ray collisions 3131 + [models] Improve map resolution control on LoadHeightmap() 3132 + [camera] Corrected small-glitch on zoom-in with mouse-wheel 3133 + [gestures] Implemented SetGesturesEnabled() to enable only some gestures 3134 + [gestures] Implemented GetElapsedTime() on Windows system 3135 + [gestures] Support mouse gestures for desktop platforms 3136 + [raymath] Complete review of the module and converted to header-only 3137 + [easings] Added new module for easing animations 3138 + [stb] Updated to latest headers versions 3139 + [*] Lots of tweaks around 3140 + 3141 + ----------------------------------------------- 3142 + Release: raylib 1.3.0 (01 September 2015) 3143 + ----------------------------------------------- 3144 + NOTE: 3145 + This version supposed a big boost for raylib, new modules have been added with lots of features. 3146 + Most of the modules have been completely reviewed to accomodate to the new features. 3147 + Over 50 new functions have been added to previous raylib version. 3148 + Most of the examples have been redone and +10 new advanced examples have been added. 3149 + 3150 + BIG changes: 3151 + [rlgl] SHADERS: Support for model shaders and postprocessing shaders (multiple functions) 3152 + [textures] FORMATS: Support for multiple internal formats, including compressed formats 3153 + [camera] NEW MODULE: Set of cameras for 3d view: Free, Orbital, 1st person, 3rd person 3154 + [gestures] NEW MODULE: Gestures system for Android and HTML5 platforms 3155 + [raygui] NEW MODULE: Set of IMGUI elements for tools development (experimental) 3156 + 3157 + other changes: 3158 + 3159 + [rlgl] Added check for OpenGL supported extensions 3160 + [rlgl] Added function SetBlenMode() to select some predefined blending modes 3161 + [core] Added support for drop&drag of external files into running program 3162 + [core] Added functions ShowCursor(), HideCursor(), IsCursorHidden() 3163 + [core] Renamed function SetFlags() to SetConfigFlags() 3164 + [shapes] Simplified some functions to improve performance 3165 + [textures] Review of Image struct to support multiple data formats 3166 + [textures] Added function LoadImageEx() 3167 + [textures] Added function LoadImageRaw() 3168 + [textures] Added function LoadTextureEx() 3169 + [textures] Simplified function parameters LoadTextureFromImage() 3170 + [textures] Added function GetImageData() 3171 + [textures] Added function GetTextureData() 3172 + [textures] Renamed function ConvertToPOT() to ImageConvertToPOT() 3173 + [textures] Added function ImageConvertFormat() 3174 + [textures] Added function GenTextureMipmaps() 3175 + [text] Added support for Latin-1 Extended characters for default font 3176 + [text] Redesigned SpriteFont struct, replaced Character struct by Rectangle 3177 + [text] Removed function GetFontBaseSize(), use directly spriteFont.size 3178 + [models] Review of struct: Model (added shaders support) 3179 + [models] Added 3d collision functions (sphere vs sphere vs box vs box) 3180 + [models] Added function DrawCubeTexture() 3181 + [models] Added function DrawQuad() 3182 + [models] Added function DrawRay() 3183 + [models] Simplified function DrawPlane() 3184 + [models] Removed function DrawPlaneEx() 3185 + [models] Simplified function DrawGizmo() 3186 + [models] Removed function DrawGizmoEx() 3187 + [models] Added function LoadModelEx() 3188 + [models] Review of function LoadCubicMap() 3189 + [models] Added function ResolveCollisionCubicmap() 3190 + [audio] Decopupled from raylib, now this module can be used as standalone 3191 + [audio] Added function UpdateMusicStream() 3192 + [raymath] Complete review of the module 3193 + [stb] Updated to latest headers versions 3194 + [*] Lots of tweaks around 3195 + 3196 + ----------------------------------------------- 3197 + Release: raylib 1.2.2 (31 December 2014) 3198 + ----------------------------------------------- 3199 + [*] Added support for HTML5 compiling (emscripten, asm.js) 3200 + [core] Corrected bug on input handling (keyboard and mouse) 3201 + [textures] Renamed function CreateTexture() to LoadTextureFromImage() 3202 + [textures] Added function ConvertToPOT() 3203 + [rlgl] Added support for color tint on models on GL 3.3+ and ES2 3204 + [rlgl] Added support for normals on models 3205 + [models] Corrected bug on DrawBillboard() 3206 + [models] Corrected bug on DrawHeightmap() 3207 + [models] Renamed LoadCubesmap() to LoadCubicmap() 3208 + [audio] Added function LoadSoundFromWave() 3209 + [makefile] Added support for Linux and OSX compiling 3210 + [stb] Updated to latest headers versions 3211 + [*] Lots of tweaks around 3212 + 3213 + --------------------------------------------------------------- 3214 + Update: raylib 1.2.1 (17 October 2014) (Small Fixes Update) 3215 + --------------------------------------------------------------- 3216 + [core] Added function SetupFlags() to preconfigure raylib Window 3217 + [core] Corrected bug on fullscreen mode 3218 + [rlgl] rlglDrawmodel() - Added rotation on Y axis 3219 + [text] MeasureTextEx() - Corrected bug on measures for default font 3220 + 3221 + ----------------------------------------------- 3222 + Release: raylib 1.2 (16 September 2014) 3223 + ----------------------------------------------- 3224 + NOTE: 3225 + This version supposed a complete redesign of the [core] module to support Android and Raspberry Pi. 3226 + Multiples modules have also been tweaked to accomodate to the new platforms, specially [rlgl] 3227 + 3228 + [core] Added multiple platforms support: Android and Raspberry Pi 3229 + [core] InitWindow() - Complete rewrite and split for Android 3230 + [core] InitDisplay() - Internal function added to calculate proper display size 3231 + [core] InitGraphics() - Internal function where OpenGL graphics are initialized 3232 + [core] Complete refactoring of input functions to accomodate to new platforms 3233 + [core] Mouse and Keyboard raw data reading functions added for Raspberry Pi 3234 + [core] GetTouchX(), GetTouchY() - Added for Android 3235 + [core] Added Android callbacks to process inputs and Android activity commands 3236 + [rlgl] Adjusted buffers depending on platform 3237 + [rlgl] Added security check in case deployed vertex excess buffer size 3238 + [rlgl] Adjusted indices type depending on GL version (int or short) 3239 + [rlgl] Fallback to VBOs only usage if VAOs not supported on ES2 3240 + [rlgl] rlglLoadModel() stores vbo ids on new Model struct 3241 + [textures] Added support for PKM files (ETC1, ETC2 compression support) 3242 + [shapes] DrawRectangleV() - Modified, depending on OGL version uses TRIANGLES or QUADS 3243 + [text] LoadSpriteFont() - Modified to use LoadImage() 3244 + [models] Minor changes on models loading to accomodate to new Model struct 3245 + [audio] PauseMusicStream(), ResumeMusicStream() - Added 3246 + [audio] Reduced music buffer size to avoid stalls on Raspberry Pi 3247 + [src] Added makefile for Windows and RPI 3248 + [src] Added resources file (raylib icon and executable info) 3249 + [examples] Added makefile for Windows and RPI 3250 + [examples] Renamed and merged with test examples for coherence with module names 3251 + [templates] Added multiple templates to be use as a base-code for games 3252 + 3253 + ----------------------------------------------- 3254 + Release: raylib 1.1.1 (22 July 2014) 3255 + ----------------------------------------------- 3256 + [core] ShowLogo() - To enable raylib logo animation at startup 3257 + [core] Corrected bug with window resizing 3258 + [rlgl] Redefined colors arrays to use byte instead of float 3259 + [rlgl] Removed double buffer system (no performance improvement) 3260 + [rlgl] rlglDraw() - Reorganized buffers drawing order 3261 + [rlgl] Corrected bug on screen resizing 3262 + [shapes] DrawRectangle() - Use QUADS instead of TRIANGLES 3263 + [models] DrawSphereWires() - Corrected some issues 3264 + [models] LoadOBJ() - Redesigned to support multiple meshes 3265 + [models] LoadCubesMap() - Loading a map as cubes (by pixel color) 3266 + [textures] Added security check if file doesn't exist 3267 + [text] Corrected bug on SpriteFont loading 3268 + [examples] Corrected some 3d examples 3269 + [test] Added cubesmap loading test 3270 + 3271 + ----------------------------------------------- 3272 + Release: raylib 1.1.0 (19 April 2014) 3273 + ----------------------------------------------- 3274 + NOTE: 3275 + This version supposed a complete internal redesign of the library to support OpenGL 3.3+ and OpenGL ES 2.0. 3276 + New module [rlgl] has been added to 'translate' immediate mode style functions (i.e. rlVertex3f()) to GL 1.1, 3.3+ or ES2. 3277 + Another new module [raymath] has also been added with lot of useful 3D math vector-matrix-quaternion functions. 3278 + 3279 + [rlgl] New module, abstracts OpenGL rendering (multiple versions support) 3280 + [raymath] New module, useful 3D math vector-matrix-quaternion functions 3281 + [core] Adapt all OpenGL code (initialization, drawing) to use [rlgl] 3282 + [shapes] Rewrite all shapes drawing functions to use [rlgl] 3283 + [textures] Adapt texture GPU loading to use [rlgl] 3284 + [textures] Added support for DDS images (compressed and uncompressed) 3285 + [textures] CreateTexture() - Redesigned to add mipmap automatic generation 3286 + [textures] DrawTexturePro() - Redesigned and corrected bugs 3287 + [models] Rewrite all 3d-shapes drawing functions to use [rlgl] 3288 + [models] Adapt model loading and drawing to use [rlgl] 3289 + [models] Model struct updated to include texture id 3290 + [models] SetModelTexture() - Added, link a texture to a model 3291 + [models] DrawModelEx() - Redesigned with extended parameters 3292 + [audio] Added music streaming support (OGG files) 3293 + [audio] Added support for OGG files as Sound 3294 + [audio] PlayMusicStream() - Added, open a new music stream and play it 3295 + [audio] StopMusicStream() - Added, stop music stream playing and close stream 3296 + [audio] PauseMusicStream() - Added, pause music stream playing 3297 + [audio] MusicIsPlaying() - Added, to check if music is playing 3298 + [audio] SetMusicVolume() - Added, set volume for music 3299 + [audio] GetMusicTimeLength() - Added, get current music time length (in seconds) 3300 + [audio] GetMusicTimePlayed() - Added, get current music time played (in seconds) 3301 + [utils] Added log tracing functionality - TraceLog(), TraceLogOpen(), TraceLogClose() 3302 + [*] Log tracing messages all around the code 3303 + 3304 + ----------------------------------------------- 3305 + Release: raylib 1.0.6 (16 March 2014) 3306 + ----------------------------------------------- 3307 + [core] Removed unused lighting-system code 3308 + [core] Removed SetPerspective() function, calculated directly 3309 + [core] Unload and reload default font on fullscreen toggle 3310 + [core] Corrected bug gamepad buttons checking if no gamepad available 3311 + [texture] DrawTextureV() - Added, to draw using Vector2 for position 3312 + [texture] LoadTexture() - Redesigned, now uses LoadImage() + CreateTexture() 3313 + [text] FormatText() - Corrected memory leak bug 3314 + [models] Added Matrix struct and related functions 3315 + [models] DrawBillboard() - Reviewed, now it works! 3316 + [models] DrawBillboardRec() - Reviewed, now it works! 3317 + [tests] Added folder with multiple tests for new functions 3318 + 3319 + ----------------------------------------------- 3320 + Update: raylib 1.0.5 (28 January 2014) 3321 + ----------------------------------------------- 3322 + [audio] LoadSound() - Corrected a bug, WAV file was not closed! 3323 + [core] GetMouseWheelMove() - Added, check mouse wheel Y movement 3324 + [texture] CreateTexture2D() renamed to CreateTexture() 3325 + [models] LoadHeightmap() - Added, Heightmap can be loaded as a Model 3326 + [tool] rREM updated, now supports (partially) drag and drop of files 3327 + 3328 + ----------------------------------------------- 3329 + Release: raylib 1.0.4 (23 January 2014) 3330 + ----------------------------------------------- 3331 + [tool] Published a first alpha version of rREM tool (raylib Resource Embedder) 3332 + [core] GetRandomValue() - Bug corrected, now works right 3333 + [core] Fade() - Added, fades a color to an alpha percentadge 3334 + [core] WriteBitmap() - Moved to new module: utils.c, not used anymore 3335 + [core] TakeScreenshot() - Now uses WritePNG() (utils.c) 3336 + [utils] New module created with utility functions 3337 + [utils] WritePNG() - Write a PNG file (used by TakeScreenshot() on core) 3338 + [utils] DecompressData() - Added, used for rRES resource data decompresion 3339 + [textures] LoadImageFromRES() - Added, load an image from a rRES resource file 3340 + [textures] LoadTextureFromRES() - Added, load a texture from a rRES resource file 3341 + [audio] LoadSoundFromRES() - Added, load a sound from a rRES resource file 3342 + [audio] IsPlaying() - Added, check if a sound is currently playing 3343 + [audio] SetVolume() - Added, set the volume for a sound 3344 + [audio] SetPitch() - Added, set the pitch for a sound 3345 + [examples] ex06a_color_select completed 3346 + [examples] ex06b_logo_anim completed 3347 + [examples] ex06c_font select completed 3348 + 3349 + ----------------------------------------------- 3350 + Release: raylib 1.0.3 (19 December 2013) 3351 + ----------------------------------------------- 3352 + [fonts] Added 8 rBMF free fonts to be used on projects! 3353 + [text] LoadSpriteFont() - Now supports rBMF file loading (raylib Bitmap Font) 3354 + [examples] ex05a_sprite_fonts completed 3355 + [examples] ex05b_rbmf_fonts completed 3356 + [core] InitWindowEx() - InitWindow with extended parameters, resizing option and custom cursor! 3357 + [core] GetRandomValue() - Added, returns a random value within a range (int) 3358 + [core] SetExitKey() - Added, sets a key to exit program (default is ESC) 3359 + [core] Custom cursor not drawn when mouse out of screen 3360 + [shapes] CheckCollisionPointRec() - Added, check collision between point and rectangle 3361 + [shapes] CheckCollisionPointCircle() - Added, check collision between point and circle 3362 + [shapes] CheckCollisionPointTriangle() - Added, check collision between point and triangle 3363 + [shapes] DrawPoly() - Added, draw regular polygons of n sides, rotation can be defined! 3364 + 3365 + ----------------------------------------------- 3366 + Release: raylib 1.0.2 (1 December 2013) 3367 + ----------------------------------------------- 3368 + [text] GetDefaultFont() - Added, get default SpriteFont to be used on DrawTextEx() 3369 + [shapes] CheckCollisionRecs() - Added, check collision between rectangles 3370 + [shapes] CheckCollisionCircles() - Added, check collision between circles 3371 + [shapes] CheckCollisionCircleRec() - Added, check collision circle-rectangle 3372 + [shapes] GetCollisionRec() - Added, get collision rectangle 3373 + [textures] CreateTexture2D() - Added, create Texture2D from Image data 3374 + [audio] Fixed WAV loading function, now audio works! 3375 + 3376 + ----------------------------------------------- 3377 + Update: raylib 1.0.1 (28 November 2013) 3378 + ----------------------------------------------- 3379 + [text] DrawText() - Removed spacing parameter 3380 + [text] MeasureText() - Removed spacing parameter 3381 + [text] DrawFps() - Renamed to DrawFPS() for coherence with similar function 3382 + [core] IsKeyPressed() - Change functionality, check if key pressed once 3383 + [core] IsKeyDown() - Added, check if key is being pressed 3384 + [core] IsKeyReleased() - Change functionality, check if key released once 3385 + [core] IsKeyUp() - Added, check if key is being NOT pressed 3386 + [core] IsMouseButtonDown() - Added, check if mouse button is being pressed 3387 + [core] IsMouseButtonPressed() - Change functionality, check if mouse button pressed once 3388 + [core] IsMouseButtonUp() - Added, check if mouse button is NOT being pressed 3389 + [core] IsMouseButtonReleased() - Change functionality, check if mouse button released once 3390 + [textures] DrawTexturePro() - Added, texture drawing with 'pro' parameters 3391 + [examples] Function changes applied to ALL examples 3392 + 3393 + ----------------------------------------------- 3394 + Release: raylib 1.0.0 (18 November 2013) 3395 + ----------------------------------------------- 3396 + * Initial version 3397 + * 6 Modules provided: 3398 + - core: basic window/context creation functions, input management, timing functions 3399 + - shapes: basic shapes drawing functions 3400 + - textures: image data loading and conversion to OpenGL textures 3401 + - text: text drawing, sprite fonts loading, default font loading 3402 + - models: basic 3d shapes drawing, OBJ models loading and drawing 3403 + - audio: audio device initialization, WAV files loading and playing
+16
linked-libs/raylib-6.0_linux_amd64/LICENSE
··· 1 + Copyright (c) 2013-2026 Ramon Santamaria (@raysan5) 2 + 3 + This software is provided "as-is", without any express or implied warranty. In no event 4 + will the authors be held liable for any damages arising from the use of this software. 5 + 6 + Permission is granted to anyone to use this software for any purpose, including commercial 7 + applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 + 9 + 1. The origin of this software must not be misrepresented; you must not claim that you 10 + wrote the original software. If you use this software in a product, an acknowledgment 11 + in the product documentation would be appreciated but is not required. 12 + 13 + 2. Altered source versions must be plainly marked as such, and must not be misrepresented 14 + as being the original software. 15 + 16 + 3. This notice may not be removed or altered from any source distribution.
+152
linked-libs/raylib-6.0_linux_amd64/README.md
··· 1 + <img align="left" style="width:260px" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px"> 2 + 3 + **raylib is a simple and easy-to-use library to enjoy videogames programming.** 4 + 5 + raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's especially well suited for prototyping, tooling, graphical applications, embedded systems and education. 6 + 7 + *NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.* 8 + 9 + Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html) 10 + 11 + --- 12 + 13 + <br> 14 + 15 + [![GitHub Releases Downloads](https://img.shields.io/github/downloads/raysan5/raylib/total)](https://github.com/raysan5/raylib/releases) 16 + [![GitHub Stars](https://img.shields.io/github/stars/raysan5/raylib?style=flat&label=stars)](https://github.com/raysan5/raylib/stargazers) 17 + [![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/5.5)](https://github.com/raysan5/raylib/commits/master) 18 + [![GitHub Sponsors](https://img.shields.io/github/sponsors/raysan5?label=sponsors)](https://github.com/sponsors/raysan5) 19 + [![Packaging Status](https://repology.org/badge/tiny-repos/raylib.svg)](https://repology.org/project/raylib/versions) 20 + [![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE) 21 + 22 + [![Discord Members](https://img.shields.io/discord/426912293134270465.svg?label=Discord&logo=discord)](https://discord.gg/raylib) 23 + [![Reddit Static Badge](https://img.shields.io/badge/-r%2Fraylib-red?style=flat&logo=reddit&label=reddit)](https://www.reddit.com/r/raylib/) 24 + [![Youtube Subscribers](https://img.shields.io/youtube/channel/subscribers/UC8WIBkhYb5sBNqXO1mZ7WSQ?style=flat&label=Youtube&logo=youtube)](https://www.youtube.com/c/raylib) 25 + [![Twitch Status](https://img.shields.io/twitch/status/raysan5?style=flat&label=Twitch&logo=twitch)](https://www.twitch.tv/raysan5) 26 + 27 + [![Build Windows](https://github.com/raysan5/raylib/actions/workflows/build_windows.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_windows.yml) 28 + [![Build Linux](https://github.com/raysan5/raylib/actions/workflows/build_linux.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_linux.yml) 29 + [![Build macOS](https://github.com/raysan5/raylib/actions/workflows/build_macos.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_macos.yml) 30 + [![Build WebAssembly](https://github.com/raysan5/raylib/actions/workflows/build_webassembly.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_webassembly.yml) 31 + 32 + [![Build CMake](https://github.com/raysan5/raylib/actions/workflows/build_cmake.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_cmake.yml) 33 + [![Build examples Windows](https://github.com/raysan5/raylib/actions/workflows/build_examples_windows.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_examples_windows.yml) 34 + [![Build examples Linux](https://github.com/raysan5/raylib/actions/workflows/build_examples_linux.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_examples_linux.yml) 35 + 36 + features 37 + -------- 38 + - **NO external dependencies**, all required libraries are [included into raylib](https://github.com/raysan5/raylib/tree/master/src/external) 39 + - Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!** 40 + - Written in plain C code (C99) using PascalCase/camelCase notation 41 + - Hardware accelerated with OpenGL: **1.1, 2.1, 3.3, 4.3, ES 2.0, ES 3.0** 42 + - **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) 43 + - **Software Renderer** backend (no OpenGL required!): [rlsw](https://github.com/raysan5/raylib/blob/master/src/external/rlsw.h) 44 + - Multiple **Fonts** formats supported (TTF, OTF, FNT, BDF, sprite fonts) 45 + - Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC) 46 + - **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more! 47 + - Flexible Materials system, supporting classic maps and **PBR maps** 48 + - **Animated 3D models** supported (skeletal bones animation) (IQM, M3D, glTF) 49 + - Shaders support, including model shaders and **postprocessing** shaders 50 + - **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) 51 + - Audio loading and playing with streaming support (WAV, QOA, OGG, MP3, FLAC, XM, MOD) 52 + - **VR stereo rendering** support with configurable HMD device parameters 53 + - Huge examples collection with [+140 code examples](https://github.com/raysan5/raylib/tree/master/examples)! 54 + - Bindings to [+70 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)! 55 + - **Free and open source** 56 + 57 + basic example 58 + -------------- 59 + This is a basic raylib example, it creates a window and draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window). 60 + ```c 61 + #include "raylib.h" 62 + 63 + int main(void) 64 + { 65 + InitWindow(800, 450, "raylib example - basic window"); 66 + 67 + while (!WindowShouldClose()) 68 + { 69 + BeginDrawing(); 70 + ClearBackground(RAYWHITE); 71 + DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); 72 + EndDrawing(); 73 + } 74 + 75 + CloseWindow(); 76 + 77 + return 0; 78 + } 79 + ``` 80 + 81 + build and installation 82 + ---------------------- 83 + 84 + raylib binary releases for Windows, Linux, macOS, Android and HTML5 are available at the [Github Releases page](https://github.com/raysan5/raylib/releases). 85 + 86 + raylib is also available via multiple package managers on multiple OS distributions. 87 + 88 + #### Installing and building raylib on multiple platforms 89 + 90 + [raylib Wiki](https://github.com/raysan5/raylib/wiki#development-platforms) contains detailed instructions on building and usage on multiple platforms. 91 + 92 + - [Working on Windows](https://github.com/raysan5/raylib/wiki/Working-on-Windows) 93 + - [Working on macOS](https://github.com/raysan5/raylib/wiki/Working-on-macOS) 94 + - [Working on GNU Linux](https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux) 95 + - [Working on Chrome OS](https://github.com/raysan5/raylib/wiki/Working-on-Chrome-OS) 96 + - [Working on FreeBSD](https://github.com/raysan5/raylib/wiki/Working-on-FreeBSD) 97 + - [Working on Raspberry Pi](https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi) 98 + - [Working for Android](https://github.com/raysan5/raylib/wiki/Working-for-Android) 99 + - [Working for Web (HTML5)](https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5)) 100 + - [Working anywhere with CMake](https://github.com/raysan5/raylib/wiki/Working-with-CMake) 101 + 102 + *Note that the Wiki is open for edit, if you find some issues while building raylib for your target platform, feel free to edit the Wiki or open an issue related to it.* 103 + 104 + #### Setup raylib with multiple IDEs 105 + 106 + raylib has been developed on Windows platform using [Notepad++](https://notepad-plus-plus.org/) and [MinGW GCC](https://www.mingw-w64.org/) compiler but it can be used with other IDEs on multiple platforms. 107 + 108 + [Projects directory](https://github.com/raysan5/raylib/tree/master/projects) contains several ready-to-use **project templates** to build raylib and code examples with multiple IDEs. 109 + 110 + *Note that there are lots of IDEs supported, some of the provided templates could require some review, so please, if you find some issue with a template or you think they could be improved, feel free to send a PR or open a related issue.* 111 + 112 + learning and docs 113 + ------------------ 114 + 115 + raylib is designed to be learned using [the examples](https://github.com/raysan5/raylib/tree/master/examples) as the main reference. There is no standard API documentation but there is a [**cheatsheet**](https://www.raylib.com/cheatsheet/cheatsheet.html) containing all the functions available on the library a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works. 116 + 117 + Some additional documentation about raylib design can be found in [raylib GitHub Wiki](https://github.com/raysan5/raylib/wiki). Here are the relevant links: 118 + 119 + - [raylib cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html) 120 + - [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture) 121 + - [raylib library design](https://github.com/raysan5/raylib/wiki) 122 + - [raylib examples collection](https://github.com/raysan5/raylib/tree/master/examples) 123 + - [raylib games collection](https://github.com/raysan5/raylib-games) 124 + 125 + 126 + contact and networks 127 + --------------------- 128 + 129 + raylib is present in several networks and raylib community is growing everyday. If you are using raylib and enjoying it, feel free to join us in any of these networks. The most active network is our [Discord server](https://discord.gg/raylib)! :) 130 + 131 + - Webpage: [https://www.raylib.com](https://www.raylib.com) 132 + - Discord: [https://discord.gg/raylib](https://discord.gg/raylib) 133 + - X: [https://x.com/raysan5](https://x.com/raysan5) 134 + - BlueSky: [https://bsky.app/profile/raysan5](https://bsky.app/profile/raysan5.bsky.social) 135 + - Twitch: [https://www.twitch.tv/raysan5](https://www.twitch.tv/raysan5) 136 + - Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib) 137 + - Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib) 138 + - YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/c/raylib) 139 + 140 + contributors 141 + ------------ 142 + 143 + <a href="https://github.com/raysan5/raylib/graphs/contributors"> 144 + <img src="https://contrib.rocks/image?repo=raysan5/raylib&max=800&columns=24&anon=0" /> 145 + </a> 146 + 147 + license 148 + ------- 149 + 150 + raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details. 151 + 152 + raylib uses internally some libraries for window/graphics/inputs management and also to support different file formats loading, all those libraries are embedded with and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies LICENSES](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on [raylib Wiki](https://github.com/raysan5/raylib/wiki) for details.
+1743
linked-libs/raylib-6.0_linux_amd64/include/raylib.h
··· 1 + /********************************************************************************************** 2 + * 3 + * raylib v6.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) 4 + * 5 + * FEATURES: 6 + * - NO external dependencies, all required libraries included with raylib 7 + * - Multiplatform: Windows, Linux, macOS, FreeBSD, Web, Android, Raspberry Pi, DRM native... 8 + * - Written in plain C code (C99) in PascalCase/camelCase notation 9 + * - Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3, ES2, ES3 - choose at compile) 10 + * - Software renderer optional, for systems with no GPU: [rlsw] 11 + * - Custom OpenGL abstraction layer (usable as standalone module): [rlgl] 12 + * - Multiple Fonts formats supported (TTF, OTF, FNT, BDF, Sprite fonts) 13 + * - Many texture formats supported, including compressed formats (DXT, ETC, ASTC) 14 + * - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more! 15 + * - Flexible Materials system, supporting classic maps and PBR maps 16 + * - Animated 3D models supported (skeletal bones animation) (IQM, M3D, GLTF) 17 + * - Shaders support, including Model shaders and Postprocessing shaders 18 + * - Powerful math module for Vector, Matrix and Quaternion operations: [raymath] 19 + * - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, QOA, XM, MOD) 20 + * - VR stereo rendering with configurable HMD device parameters 21 + * - Bindings to multiple programming languages available! 22 + * 23 + * NOTES: 24 + * - One default Font is loaded on InitWindow()->LoadFontDefault() [core, text] 25 + * - One default Texture2D is loaded on rlglInit(), 1x1 white pixel R8G8B8A8 [rlgl] (OpenGL 3.3 or ES2) 26 + * - One default Shader is loaded on rlglInit()->rlLoadShaderDefault() [rlgl] (OpenGL 3.3 or ES2) 27 + * - One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() [rlgl] (OpenGL 3.3 or ES2) 28 + * 29 + * DEPENDENCIES: 30 + * [rcore] Depends on the selected platform backend, check rcore.c header for details 31 + * [rlgl] glad/glad_gles2 (David Herberth - github.com/Dav1dde/glad) for OpenGL extensions loading 32 + * [raudio] miniaudio (David Reid - github.com/mackron/miniaudio) for audio device/context management 33 + * 34 + * OPTIONAL DEPENDENCIES (included): 35 + * [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorithm 36 + * [rcore] sdefl (Micha Mettke) for DEFLATE compression algorithm 37 + * [rcore] rprand (Ramon Santamaria) for pseudo-random numbers generation 38 + * [rtextures] qoi (Dominic Szablewski - https://phoboslab.org) for QOI image management 39 + * [rtextures] stb_image (Sean Barrett) for images loading (BMP, TGA, PNG, JPEG, HDR...) 40 + * [rtextures] stb_image_write (Sean Barrett) for image writing (BMP, TGA, PNG, JPG) 41 + * [rtextures] stb_image_resize2 (Sean Barrett) for image resizing algorithms 42 + * [rtextures] stb_perlin (Sean Barrett) for Perlin Noise image generation 43 + * [rtextures] rltexgpu (Ramon Santamaria) for GPU-compressed texture formats 44 + * [rtext] stb_truetype (Sean Barrett) for ttf fonts loading 45 + * [rtext] stb_rect_pack (Sean Barrett) for rectangles packing 46 + * [rmodels] par_shapes (Philip Rideout) for parametric 3d shapes generation 47 + * [rmodels] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL) 48 + * [rmodels] cgltf (Johannes Kuhlmann) for models loading (glTF) 49 + * [rmodels] m3d (bzt) for models loading (M3D, https://bztsrc.gitlab.io/model3d) 50 + * [rmodels] vox_loader (Johann Nadalutti) for models loading (VOX) 51 + * [raudio] dr_wav (David Reid) for WAV audio file loading 52 + * [raudio] dr_flac (David Reid) for FLAC audio file loading 53 + * [raudio] dr_mp3 (David Reid) for MP3 audio file loading 54 + * [raudio] stb_vorbis (Sean Barrett) for OGG audio loading 55 + * [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading 56 + * [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading 57 + * [raudio] qoa (Dominic Szablewski - https://phoboslab.org) for QOA audio management 58 + * 59 + * 60 + * LICENSE: zlib/libpng 61 + * 62 + * raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, 63 + * BSD-like license that allows static linking with closed source software: 64 + * 65 + * Copyright (c) 2013-2026 Ramon Santamaria (@raysan5) 66 + * 67 + * This software is provided "as-is", without any express or implied warranty. In no event 68 + * will the authors be held liable for any damages arising from the use of this software. 69 + * 70 + * Permission is granted to anyone to use this software for any purpose, including commercial 71 + * applications, and to alter it and redistribute it freely, subject to the following restrictions: 72 + * 73 + * 1. The origin of this software must not be misrepresented; you must not claim that you 74 + * wrote the original software. If you use this software in a product, an acknowledgment 75 + * in the product documentation would be appreciated but is not required. 76 + * 77 + * 2. Altered source versions must be plainly marked as such, and must not be misrepresented 78 + * as being the original software. 79 + * 80 + * 3. This notice may not be removed or altered from any source distribution. 81 + * 82 + **********************************************************************************************/ 83 + 84 + #ifndef RAYLIB_H 85 + #define RAYLIB_H 86 + 87 + #include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback 88 + 89 + #define RAYLIB_VERSION_MAJOR 6 90 + #define RAYLIB_VERSION_MINOR 0 91 + #define RAYLIB_VERSION_PATCH 0 92 + #define RAYLIB_VERSION "6.0" 93 + 94 + // Function specifiers in case library is build/used as a shared library 95 + // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll 96 + // NOTE: visibility("default") attribute makes symbols "visible" when compiled with -fvisibility=hidden 97 + #if defined(_WIN32) 98 + #if defined(__TINYC__) 99 + #define __declspec(x) __attribute__((x)) 100 + #endif 101 + #if defined(BUILD_LIBTYPE_SHARED) 102 + #define RLAPI __declspec(dllexport) // Building the library as a Win32 shared library (.dll) 103 + #elif defined(USE_LIBTYPE_SHARED) 104 + #define RLAPI __declspec(dllimport) // Using the library as a Win32 shared library (.dll) 105 + #endif 106 + #else 107 + #if defined(BUILD_LIBTYPE_SHARED) 108 + #define RLAPI __attribute__((visibility("default"))) // Building as a Unix shared library (.so/.dylib) 109 + #endif 110 + #endif 111 + 112 + #ifndef RLAPI 113 + #define RLAPI // Functions defined as 'extern' by default (implicit specifiers) 114 + #endif 115 + 116 + //---------------------------------------------------------------------------------- 117 + // Defines and Macros 118 + //---------------------------------------------------------------------------------- 119 + #ifndef PI 120 + #define PI 3.14159265358979323846f 121 + #endif 122 + #ifndef DEG2RAD 123 + #define DEG2RAD (PI/180.0f) 124 + #endif 125 + #ifndef RAD2DEG 126 + #define RAD2DEG (180.0f/PI) 127 + #endif 128 + 129 + // Allow custom memory allocators 130 + // NOTE: Require recompiling raylib sources 131 + #ifndef RL_MALLOC 132 + #define RL_MALLOC(sz) malloc(sz) 133 + #endif 134 + #ifndef RL_CALLOC 135 + #define RL_CALLOC(n,sz) calloc(n,sz) 136 + #endif 137 + #ifndef RL_REALLOC 138 + #define RL_REALLOC(ptr,sz) realloc(ptr,sz) 139 + #endif 140 + #ifndef RL_FREE 141 + #define RL_FREE(ptr) free(ptr) 142 + #endif 143 + 144 + // NOTE: MSVC C++ compiler does not support compound literals (C99 feature) 145 + // Plain structures in C++ (without constructors) can be initialized with { } 146 + // This is called aggregate initialization (C++11 feature) 147 + #if defined(__cplusplus) 148 + #define CLITERAL(type) type 149 + #else 150 + #define CLITERAL(type) (type) 151 + #endif 152 + 153 + // Some compilers (mostly macos clang) default to C++98, 154 + // where aggregate initialization can't be used 155 + // So, give a more clear error stating how to fix this 156 + #if !defined(_MSC_VER) && (defined(__cplusplus) && __cplusplus < 201103L) 157 + #error "C++11 or later is required. Add -std=c++11" 158 + #endif 159 + 160 + // NOTE: Set some defines with some data types declared by raylib 161 + // Other modules (raymath, rlgl) also require some of those types, so, 162 + // to be able to use those other modules as standalone (not depending on raylib) 163 + // this defines are useful for internal check and avoid type (re)definitions 164 + #define RL_COLOR_TYPE 165 + #define RL_RECTANGLE_TYPE 166 + #define RL_VECTOR2_TYPE 167 + #define RL_VECTOR3_TYPE 168 + #define RL_VECTOR4_TYPE 169 + #define RL_QUATERNION_TYPE 170 + #define RL_MATRIX_TYPE 171 + 172 + // Some Basic Colors 173 + // NOTE: Custom raylib color palette for amazing visuals on WHITE background 174 + #define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray 175 + #define GRAY CLITERAL(Color){ 130, 130, 130, 255 } // Gray 176 + #define DARKGRAY CLITERAL(Color){ 80, 80, 80, 255 } // Dark Gray 177 + #define YELLOW CLITERAL(Color){ 253, 249, 0, 255 } // Yellow 178 + #define GOLD CLITERAL(Color){ 255, 203, 0, 255 } // Gold 179 + #define ORANGE CLITERAL(Color){ 255, 161, 0, 255 } // Orange 180 + #define PINK CLITERAL(Color){ 255, 109, 194, 255 } // Pink 181 + #define RED CLITERAL(Color){ 230, 41, 55, 255 } // Red 182 + #define MAROON CLITERAL(Color){ 190, 33, 55, 255 } // Maroon 183 + #define GREEN CLITERAL(Color){ 0, 228, 48, 255 } // Green 184 + #define LIME CLITERAL(Color){ 0, 158, 47, 255 } // Lime 185 + #define DARKGREEN CLITERAL(Color){ 0, 117, 44, 255 } // Dark Green 186 + #define SKYBLUE CLITERAL(Color){ 102, 191, 255, 255 } // Sky Blue 187 + #define BLUE CLITERAL(Color){ 0, 121, 241, 255 } // Blue 188 + #define DARKBLUE CLITERAL(Color){ 0, 82, 172, 255 } // Dark Blue 189 + #define PURPLE CLITERAL(Color){ 200, 122, 255, 255 } // Purple 190 + #define VIOLET CLITERAL(Color){ 135, 60, 190, 255 } // Violet 191 + #define DARKPURPLE CLITERAL(Color){ 112, 31, 126, 255 } // Dark Purple 192 + #define BEIGE CLITERAL(Color){ 211, 176, 131, 255 } // Beige 193 + #define BROWN CLITERAL(Color){ 127, 106, 79, 255 } // Brown 194 + #define DARKBROWN CLITERAL(Color){ 76, 63, 47, 255 } // Dark Brown 195 + 196 + #define WHITE CLITERAL(Color){ 255, 255, 255, 255 } // White 197 + #define BLACK CLITERAL(Color){ 0, 0, 0, 255 } // Black 198 + #define BLANK CLITERAL(Color){ 0, 0, 0, 0 } // Blank (Transparent) 199 + #define MAGENTA CLITERAL(Color){ 255, 0, 255, 255 } // Magenta 200 + #define RAYWHITE CLITERAL(Color){ 245, 245, 245, 255 } // My own White (raylib logo) 201 + 202 + //---------------------------------------------------------------------------------- 203 + // Types and Structures Definition 204 + //---------------------------------------------------------------------------------- 205 + // Boolean type 206 + #if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800) 207 + #include <stdbool.h> 208 + #elif !defined(__cplusplus) && !defined(bool) 209 + typedef enum bool { false = 0, true = !false } bool; 210 + #define RL_BOOL_TYPE 211 + #endif 212 + 213 + // Vector2, 2 components 214 + typedef struct Vector2 { 215 + float x; // Vector x component 216 + float y; // Vector y component 217 + } Vector2; 218 + 219 + // Vector3, 3 components 220 + typedef struct Vector3 { 221 + float x; // Vector x component 222 + float y; // Vector y component 223 + float z; // Vector z component 224 + } Vector3; 225 + 226 + // Vector4, 4 components 227 + typedef struct Vector4 { 228 + float x; // Vector x component 229 + float y; // Vector y component 230 + float z; // Vector z component 231 + float w; // Vector w component 232 + } Vector4; 233 + 234 + // Quaternion, 4 components (Vector4 alias) 235 + typedef Vector4 Quaternion; 236 + 237 + // Matrix, 4x4 components, column major, OpenGL style, right-handed 238 + typedef struct Matrix { 239 + float m0, m4, m8, m12; // Matrix first row (4 components) 240 + float m1, m5, m9, m13; // Matrix second row (4 components) 241 + float m2, m6, m10, m14; // Matrix third row (4 components) 242 + float m3, m7, m11, m15; // Matrix fourth row (4 components) 243 + } Matrix; 244 + 245 + // Color, 4 components, R8G8B8A8 (32bit) 246 + typedef struct Color { 247 + unsigned char r; // Color red value 248 + unsigned char g; // Color green value 249 + unsigned char b; // Color blue value 250 + unsigned char a; // Color alpha value 251 + } Color; 252 + 253 + // Rectangle, 4 components 254 + typedef struct Rectangle { 255 + float x; // Rectangle top-left corner position x 256 + float y; // Rectangle top-left corner position y 257 + float width; // Rectangle width 258 + float height; // Rectangle height 259 + } Rectangle; 260 + 261 + // Image, pixel data stored in CPU memory (RAM) 262 + typedef struct Image { 263 + void *data; // Image raw data 264 + int width; // Image base width 265 + int height; // Image base height 266 + int mipmaps; // Mipmap levels, 1 by default 267 + int format; // Data format (PixelFormat type) 268 + } Image; 269 + 270 + // Texture, tex data stored in GPU memory (VRAM) 271 + typedef struct Texture { 272 + unsigned int id; // OpenGL texture id 273 + int width; // Texture base width 274 + int height; // Texture base height 275 + int mipmaps; // Mipmap levels, 1 by default 276 + int format; // Data format (PixelFormat type) 277 + } Texture; 278 + 279 + // Texture2D, same as Texture 280 + typedef Texture Texture2D; 281 + 282 + // TextureCubemap, same as Texture 283 + typedef Texture TextureCubemap; 284 + 285 + // RenderTexture, fbo for texture rendering 286 + typedef struct RenderTexture { 287 + unsigned int id; // OpenGL framebuffer object id 288 + Texture texture; // Color buffer attachment texture 289 + Texture depth; // Depth buffer attachment texture 290 + } RenderTexture; 291 + 292 + // RenderTexture2D, same as RenderTexture 293 + typedef RenderTexture RenderTexture2D; 294 + 295 + // NPatchInfo, n-patch layout info 296 + typedef struct NPatchInfo { 297 + Rectangle source; // Texture source rectangle 298 + int left; // Left border offset 299 + int top; // Top border offset 300 + int right; // Right border offset 301 + int bottom; // Bottom border offset 302 + int layout; // Layout of the n-patch: 3x3, 1x3 or 3x1 303 + } NPatchInfo; 304 + 305 + // GlyphInfo, font characters glyphs info 306 + typedef struct GlyphInfo { 307 + int value; // Character value (Unicode) 308 + int offsetX; // Character offset X when drawing 309 + int offsetY; // Character offset Y when drawing 310 + int advanceX; // Character advance position X 311 + Image image; // Character image data 312 + } GlyphInfo; 313 + 314 + // Font, font texture and GlyphInfo array data 315 + typedef struct Font { 316 + int baseSize; // Base size (default chars height) 317 + int glyphCount; // Number of glyph characters 318 + int glyphPadding; // Padding around the glyph characters 319 + Texture2D texture; // Texture atlas containing the glyphs 320 + Rectangle *recs; // Rectangles in texture for the glyphs 321 + GlyphInfo *glyphs; // Glyphs info data 322 + } Font; 323 + 324 + // Camera, defines position/orientation in 3d space 325 + typedef struct Camera3D { 326 + Vector3 position; // Camera position 327 + Vector3 target; // Camera target it looks-at 328 + Vector3 up; // Camera up vector (rotation over its axis) 329 + float fovy; // Camera field-of-view aperture in Y (degrees) in perspective, used as near plane height in world units in orthographic 330 + int projection; // Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC 331 + } Camera3D; 332 + 333 + typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D 334 + 335 + // Camera2D, defines position/orientation in 2d space 336 + typedef struct Camera2D { 337 + Vector2 offset; // Camera offset (screen space offset from window origin) 338 + Vector2 target; // Camera target (world space target point that is mapped to screen space offset) 339 + float rotation; // Camera rotation in degrees (pivots around target) 340 + float zoom; // Camera zoom (scaling around target), must not be set to 0, set to 1.0f for no scale 341 + } Camera2D; 342 + 343 + // Mesh, vertex data and vao/vbo 344 + typedef struct Mesh { 345 + int vertexCount; // Number of vertices stored in arrays 346 + int triangleCount; // Number of triangles stored (indexed or not) 347 + 348 + // Vertex attributes data 349 + float *vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0) 350 + float *texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) 351 + float *texcoords2; // Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5) 352 + float *normals; // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2) 353 + float *tangents; // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4) 354 + unsigned char *colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) 355 + unsigned short *indices; // Vertex indices (in case vertex data comes indexed) 356 + 357 + // Skin data for animation 358 + int boneCount; // Number of bones (MAX: 256 bones) 359 + unsigned char *boneIndices; // Vertex bone indices, up to 4 bones influence by vertex (skinning) (shader-location = 6) 360 + float *boneWeights; // Vertex bone weight, up to 4 bones influence by vertex (skinning) (shader-location = 7) 361 + 362 + // Runtime animation vertex data (CPU skinning) 363 + // NOTE: In case of GPU skinning, not used, pointers are NULL 364 + float *animVertices; // Animated vertex positions (after bones transformations) 365 + float *animNormals; // Animated normals (after bones transformations) 366 + 367 + // OpenGL identifiers 368 + unsigned int vaoId; // OpenGL Vertex Array Object id 369 + unsigned int *vboId; // OpenGL Vertex Buffer Objects id (default vertex data) 370 + } Mesh; 371 + 372 + // Shader 373 + typedef struct Shader { 374 + unsigned int id; // Shader program id 375 + int *locs; // Shader locations array (RL_MAX_SHADER_LOCATIONS) 376 + } Shader; 377 + 378 + // MaterialMap 379 + typedef struct MaterialMap { 380 + Texture2D texture; // Material map texture 381 + Color color; // Material map color 382 + float value; // Material map value 383 + } MaterialMap; 384 + 385 + // Material, includes shader and maps 386 + typedef struct Material { 387 + Shader shader; // Material shader 388 + MaterialMap *maps; // Material maps array (MAX_MATERIAL_MAPS) 389 + float params[4]; // Material generic parameters (if required) 390 + } Material; 391 + 392 + // Transform, vertex transformation data 393 + typedef struct Transform { 394 + Vector3 translation; // Translation 395 + Quaternion rotation; // Rotation 396 + Vector3 scale; // Scale 397 + } Transform; 398 + 399 + // Anim pose, an array of Transform[] 400 + typedef Transform *ModelAnimPose; 401 + 402 + // Bone, skeletal animation bone 403 + typedef struct BoneInfo { 404 + char name[32]; // Bone name 405 + int parent; // Bone parent 406 + } BoneInfo; 407 + 408 + // Skeleton, animation bones hierarchy 409 + typedef struct ModelSkeleton { 410 + int boneCount; // Number of bones 411 + BoneInfo *bones; // Bones information (skeleton) 412 + ModelAnimPose bindPose; // Bones base transformation (Transform[]) 413 + } ModelSkeleton; 414 + 415 + // Model, meshes, materials and animation data 416 + typedef struct Model { 417 + Matrix transform; // Local transform matrix 418 + 419 + int meshCount; // Number of meshes 420 + int materialCount; // Number of materials 421 + Mesh *meshes; // Meshes array 422 + Material *materials; // Materials array 423 + int *meshMaterial; // Mesh material number 424 + 425 + // Animation data 426 + ModelSkeleton skeleton; // Skeleton for animation 427 + 428 + // Runtime animation data (CPU/GPU skinning) 429 + ModelAnimPose currentPose; // Current animation pose (Transform[]) 430 + Matrix *boneMatrices; // Bones animated transformation matrices 431 + } Model; 432 + 433 + // ModelAnimation, contains a full animation sequence 434 + typedef struct ModelAnimation { 435 + char name[32]; // Animation name 436 + 437 + int boneCount; // Number of bones (per pose) 438 + int keyframeCount; // Number of animation key frames 439 + ModelAnimPose *keyframePoses; // Animation sequence keyframe poses [keyframe][pose] 440 + } ModelAnimation; 441 + 442 + // Ray, ray for raycasting 443 + typedef struct Ray { 444 + Vector3 position; // Ray position (origin) 445 + Vector3 direction; // Ray direction (normalized) 446 + } Ray; 447 + 448 + // RayCollision, ray hit information 449 + typedef struct RayCollision { 450 + bool hit; // Did the ray hit something? 451 + float distance; // Distance to the nearest hit 452 + Vector3 point; // Point of the nearest hit 453 + Vector3 normal; // Surface normal of hit 454 + } RayCollision; 455 + 456 + // BoundingBox 457 + typedef struct BoundingBox { 458 + Vector3 min; // Minimum vertex box-corner 459 + Vector3 max; // Maximum vertex box-corner 460 + } BoundingBox; 461 + 462 + // Wave, audio wave data 463 + typedef struct Wave { 464 + unsigned int frameCount; // Total number of frames (considering channels) 465 + unsigned int sampleRate; // Frequency (samples per second) 466 + unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported) 467 + unsigned int channels; // Number of channels (1-mono, 2-stereo, ...) 468 + void *data; // Buffer data pointer 469 + } Wave; 470 + 471 + // Opaque structs declaration 472 + // NOTE: Actual structs are defined internally in raudio module 473 + typedef struct rAudioBuffer rAudioBuffer; 474 + typedef struct rAudioProcessor rAudioProcessor; 475 + 476 + // AudioStream, custom audio stream 477 + typedef struct AudioStream { 478 + rAudioBuffer *buffer; // Pointer to internal data used by the audio system 479 + rAudioProcessor *processor; // Pointer to internal data processor, useful for audio effects 480 + 481 + unsigned int sampleRate; // Frequency (samples per second) 482 + unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported) 483 + unsigned int channels; // Number of channels (1-mono, 2-stereo, ...) 484 + } AudioStream; 485 + 486 + // Sound 487 + typedef struct Sound { 488 + AudioStream stream; // Audio stream 489 + unsigned int frameCount; // Total number of frames (considering channels) 490 + } Sound; 491 + 492 + // Music, audio stream, anything longer than ~10 seconds should be streamed 493 + typedef struct Music { 494 + AudioStream stream; // Audio stream 495 + unsigned int frameCount; // Total number of frames (considering channels) 496 + bool looping; // Music looping enable 497 + 498 + int ctxType; // Type of music context (audio filetype) 499 + void *ctxData; // Audio context data, depends on type 500 + } Music; 501 + 502 + // VrDeviceInfo, Head-Mounted-Display device parameters 503 + typedef struct VrDeviceInfo { 504 + int hResolution; // Horizontal resolution in pixels 505 + int vResolution; // Vertical resolution in pixels 506 + float hScreenSize; // Horizontal size in meters 507 + float vScreenSize; // Vertical size in meters 508 + float eyeToScreenDistance; // Distance between eye and display in meters 509 + float lensSeparationDistance; // Lens separation distance in meters 510 + float interpupillaryDistance; // IPD (distance between pupils) in meters 511 + float lensDistortionValues[4]; // Lens distortion constant parameters 512 + float chromaAbCorrection[4]; // Chromatic aberration correction parameters 513 + } VrDeviceInfo; 514 + 515 + // VrStereoConfig, VR stereo rendering configuration for simulator 516 + typedef struct VrStereoConfig { 517 + Matrix projection[2]; // VR projection matrices (per eye) 518 + Matrix viewOffset[2]; // VR view offset matrices (per eye) 519 + float leftLensCenter[2]; // VR left lens center 520 + float rightLensCenter[2]; // VR right lens center 521 + float leftScreenCenter[2]; // VR left screen center 522 + float rightScreenCenter[2]; // VR right screen center 523 + float scale[2]; // VR distortion scale 524 + float scaleIn[2]; // VR distortion scale in 525 + } VrStereoConfig; 526 + 527 + // File path list 528 + typedef struct FilePathList { 529 + unsigned int count; // Filepaths entries count 530 + char **paths; // Filepaths entries 531 + } FilePathList; 532 + 533 + // Automation event 534 + typedef struct AutomationEvent { 535 + unsigned int frame; // Event frame 536 + unsigned int type; // Event type (AutomationEventType) 537 + int params[4]; // Event parameters (if required) 538 + } AutomationEvent; 539 + 540 + // Automation event list 541 + typedef struct AutomationEventList { 542 + unsigned int capacity; // Events max entries (MAX_AUTOMATION_EVENTS) 543 + unsigned int count; // Events entries count 544 + AutomationEvent *events; // Events entries 545 + } AutomationEventList; 546 + 547 + //---------------------------------------------------------------------------------- 548 + // Enumerators Definition 549 + //---------------------------------------------------------------------------------- 550 + // System/Window config flags 551 + // NOTE: Every bit registers one state (use it with bit masks) 552 + // By default all flags are set to 0 553 + typedef enum { 554 + FLAG_VSYNC_HINT = 0x00000040, // Set to try enabling V-Sync on GPU 555 + FLAG_FULLSCREEN_MODE = 0x00000002, // Set to run program in fullscreen 556 + FLAG_WINDOW_RESIZABLE = 0x00000004, // Set to allow resizable window 557 + FLAG_WINDOW_UNDECORATED = 0x00000008, // Set to disable window decoration (frame and buttons) 558 + FLAG_WINDOW_HIDDEN = 0x00000080, // Set to hide window 559 + FLAG_WINDOW_MINIMIZED = 0x00000200, // Set to minimize window (iconify) 560 + FLAG_WINDOW_MAXIMIZED = 0x00000400, // Set to maximize window (expanded to monitor) 561 + FLAG_WINDOW_UNFOCUSED = 0x00000800, // Set to window non focused 562 + FLAG_WINDOW_TOPMOST = 0x00001000, // Set to window always on top 563 + FLAG_WINDOW_ALWAYS_RUN = 0x00000100, // Set to allow windows running while minimized 564 + FLAG_WINDOW_TRANSPARENT = 0x00000010, // Set to allow transparent framebuffer 565 + FLAG_WINDOW_HIGHDPI = 0x00002000, // Set to support HighDPI 566 + FLAG_WINDOW_MOUSE_PASSTHROUGH = 0x00004000, // Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED 567 + FLAG_BORDERLESS_WINDOWED_MODE = 0x00008000, // Set to run program in borderless windowed mode 568 + FLAG_MSAA_4X_HINT = 0x00000020, // Set to try enabling MSAA 4X 569 + FLAG_INTERLACED_HINT = 0x00010000 // Set to try enabling interlaced video format (for V3D) 570 + } ConfigFlags; 571 + 572 + // Trace log level 573 + // NOTE: Organized by priority level 574 + typedef enum { 575 + LOG_ALL = 0, // Display all logs 576 + LOG_TRACE, // Trace logging, intended for internal use only 577 + LOG_DEBUG, // Debug logging, used for internal debugging, it should be disabled on release builds 578 + LOG_INFO, // Info logging, used for program execution info 579 + LOG_WARNING, // Warning logging, used on recoverable failures 580 + LOG_ERROR, // Error logging, used on unrecoverable failures 581 + LOG_FATAL, // Fatal logging, used to abort program: exit(EXIT_FAILURE) 582 + LOG_NONE // Disable logging 583 + } TraceLogLevel; 584 + 585 + // Keyboard keys (US keyboard layout) 586 + // NOTE: Use GetKeyPressed() to allow redefining required keys for alternative layouts 587 + typedef enum { 588 + KEY_NULL = 0, // Key: NULL, used for no key pressed 589 + // Alphanumeric keys 590 + KEY_APOSTROPHE = 39, // Key: ' 591 + KEY_COMMA = 44, // Key: , 592 + KEY_MINUS = 45, // Key: - 593 + KEY_PERIOD = 46, // Key: . 594 + KEY_SLASH = 47, // Key: / 595 + KEY_ZERO = 48, // Key: 0 596 + KEY_ONE = 49, // Key: 1 597 + KEY_TWO = 50, // Key: 2 598 + KEY_THREE = 51, // Key: 3 599 + KEY_FOUR = 52, // Key: 4 600 + KEY_FIVE = 53, // Key: 5 601 + KEY_SIX = 54, // Key: 6 602 + KEY_SEVEN = 55, // Key: 7 603 + KEY_EIGHT = 56, // Key: 8 604 + KEY_NINE = 57, // Key: 9 605 + KEY_SEMICOLON = 59, // Key: ; 606 + KEY_EQUAL = 61, // Key: = 607 + KEY_A = 65, // Key: A | a 608 + KEY_B = 66, // Key: B | b 609 + KEY_C = 67, // Key: C | c 610 + KEY_D = 68, // Key: D | d 611 + KEY_E = 69, // Key: E | e 612 + KEY_F = 70, // Key: F | f 613 + KEY_G = 71, // Key: G | g 614 + KEY_H = 72, // Key: H | h 615 + KEY_I = 73, // Key: I | i 616 + KEY_J = 74, // Key: J | j 617 + KEY_K = 75, // Key: K | k 618 + KEY_L = 76, // Key: L | l 619 + KEY_M = 77, // Key: M | m 620 + KEY_N = 78, // Key: N | n 621 + KEY_O = 79, // Key: O | o 622 + KEY_P = 80, // Key: P | p 623 + KEY_Q = 81, // Key: Q | q 624 + KEY_R = 82, // Key: R | r 625 + KEY_S = 83, // Key: S | s 626 + KEY_T = 84, // Key: T | t 627 + KEY_U = 85, // Key: U | u 628 + KEY_V = 86, // Key: V | v 629 + KEY_W = 87, // Key: W | w 630 + KEY_X = 88, // Key: X | x 631 + KEY_Y = 89, // Key: Y | y 632 + KEY_Z = 90, // Key: Z | z 633 + KEY_LEFT_BRACKET = 91, // Key: [ 634 + KEY_BACKSLASH = 92, // Key: '\' 635 + KEY_RIGHT_BRACKET = 93, // Key: ] 636 + KEY_GRAVE = 96, // Key: ` 637 + // Function keys 638 + KEY_SPACE = 32, // Key: Space 639 + KEY_ESCAPE = 256, // Key: Esc 640 + KEY_ENTER = 257, // Key: Enter 641 + KEY_TAB = 258, // Key: Tab 642 + KEY_BACKSPACE = 259, // Key: Backspace 643 + KEY_INSERT = 260, // Key: Ins 644 + KEY_DELETE = 261, // Key: Del 645 + KEY_RIGHT = 262, // Key: Cursor right 646 + KEY_LEFT = 263, // Key: Cursor left 647 + KEY_DOWN = 264, // Key: Cursor down 648 + KEY_UP = 265, // Key: Cursor up 649 + KEY_PAGE_UP = 266, // Key: Page up 650 + KEY_PAGE_DOWN = 267, // Key: Page down 651 + KEY_HOME = 268, // Key: Home 652 + KEY_END = 269, // Key: End 653 + KEY_CAPS_LOCK = 280, // Key: Caps lock 654 + KEY_SCROLL_LOCK = 281, // Key: Scroll down 655 + KEY_NUM_LOCK = 282, // Key: Num lock 656 + KEY_PRINT_SCREEN = 283, // Key: Print screen 657 + KEY_PAUSE = 284, // Key: Pause 658 + KEY_F1 = 290, // Key: F1 659 + KEY_F2 = 291, // Key: F2 660 + KEY_F3 = 292, // Key: F3 661 + KEY_F4 = 293, // Key: F4 662 + KEY_F5 = 294, // Key: F5 663 + KEY_F6 = 295, // Key: F6 664 + KEY_F7 = 296, // Key: F7 665 + KEY_F8 = 297, // Key: F8 666 + KEY_F9 = 298, // Key: F9 667 + KEY_F10 = 299, // Key: F10 668 + KEY_F11 = 300, // Key: F11 669 + KEY_F12 = 301, // Key: F12 670 + KEY_LEFT_SHIFT = 340, // Key: Shift left 671 + KEY_LEFT_CONTROL = 341, // Key: Control left 672 + KEY_LEFT_ALT = 342, // Key: Alt left 673 + KEY_LEFT_SUPER = 343, // Key: Super left 674 + KEY_RIGHT_SHIFT = 344, // Key: Shift right 675 + KEY_RIGHT_CONTROL = 345, // Key: Control right 676 + KEY_RIGHT_ALT = 346, // Key: Alt right 677 + KEY_RIGHT_SUPER = 347, // Key: Super right 678 + KEY_KB_MENU = 348, // Key: KB menu 679 + // Keypad keys 680 + KEY_KP_0 = 320, // Key: Keypad 0 681 + KEY_KP_1 = 321, // Key: Keypad 1 682 + KEY_KP_2 = 322, // Key: Keypad 2 683 + KEY_KP_3 = 323, // Key: Keypad 3 684 + KEY_KP_4 = 324, // Key: Keypad 4 685 + KEY_KP_5 = 325, // Key: Keypad 5 686 + KEY_KP_6 = 326, // Key: Keypad 6 687 + KEY_KP_7 = 327, // Key: Keypad 7 688 + KEY_KP_8 = 328, // Key: Keypad 8 689 + KEY_KP_9 = 329, // Key: Keypad 9 690 + KEY_KP_DECIMAL = 330, // Key: Keypad . 691 + KEY_KP_DIVIDE = 331, // Key: Keypad / 692 + KEY_KP_MULTIPLY = 332, // Key: Keypad * 693 + KEY_KP_SUBTRACT = 333, // Key: Keypad - 694 + KEY_KP_ADD = 334, // Key: Keypad + 695 + KEY_KP_ENTER = 335, // Key: Keypad Enter 696 + KEY_KP_EQUAL = 336, // Key: Keypad = 697 + // Android key buttons 698 + KEY_BACK = 4, // Key: Android back button 699 + KEY_MENU = 5, // Key: Android menu button 700 + KEY_VOLUME_UP = 24, // Key: Android volume up button 701 + KEY_VOLUME_DOWN = 25 // Key: Android volume down button 702 + } KeyboardKey; 703 + 704 + // Add backwards compatibility support for deprecated names 705 + #define MOUSE_LEFT_BUTTON MOUSE_BUTTON_LEFT 706 + #define MOUSE_RIGHT_BUTTON MOUSE_BUTTON_RIGHT 707 + #define MOUSE_MIDDLE_BUTTON MOUSE_BUTTON_MIDDLE 708 + 709 + // Mouse buttons 710 + typedef enum { 711 + MOUSE_BUTTON_LEFT = 0, // Mouse button left 712 + MOUSE_BUTTON_RIGHT = 1, // Mouse button right 713 + MOUSE_BUTTON_MIDDLE = 2, // Mouse button middle (pressed wheel) 714 + MOUSE_BUTTON_SIDE = 3, // Mouse button side (advanced mouse device) 715 + MOUSE_BUTTON_EXTRA = 4, // Mouse button extra (advanced mouse device) 716 + MOUSE_BUTTON_FORWARD = 5, // Mouse button forward (advanced mouse device) 717 + MOUSE_BUTTON_BACK = 6, // Mouse button back (advanced mouse device) 718 + } MouseButton; 719 + 720 + // Mouse cursor 721 + typedef enum { 722 + MOUSE_CURSOR_DEFAULT = 0, // Default pointer shape 723 + MOUSE_CURSOR_ARROW = 1, // Arrow shape 724 + MOUSE_CURSOR_IBEAM = 2, // Text writing cursor shape 725 + MOUSE_CURSOR_CROSSHAIR = 3, // Cross shape 726 + MOUSE_CURSOR_POINTING_HAND = 4, // Pointing hand cursor 727 + MOUSE_CURSOR_RESIZE_EW = 5, // Horizontal resize/move arrow shape 728 + MOUSE_CURSOR_RESIZE_NS = 6, // Vertical resize/move arrow shape 729 + MOUSE_CURSOR_RESIZE_NWSE = 7, // Top-left to bottom-right diagonal resize/move arrow shape 730 + MOUSE_CURSOR_RESIZE_NESW = 8, // The top-right to bottom-left diagonal resize/move arrow shape 731 + MOUSE_CURSOR_RESIZE_ALL = 9, // The omnidirectional resize/move cursor shape 732 + MOUSE_CURSOR_NOT_ALLOWED = 10 // The operation-not-allowed shape 733 + } MouseCursor; 734 + 735 + // Gamepad buttons 736 + typedef enum { 737 + GAMEPAD_BUTTON_UNKNOWN = 0, // Unknown button, for error checking 738 + GAMEPAD_BUTTON_LEFT_FACE_UP, // Gamepad left DPAD up button 739 + GAMEPAD_BUTTON_LEFT_FACE_RIGHT, // Gamepad left DPAD right button 740 + GAMEPAD_BUTTON_LEFT_FACE_DOWN, // Gamepad left DPAD down button 741 + GAMEPAD_BUTTON_LEFT_FACE_LEFT, // Gamepad left DPAD left button 742 + GAMEPAD_BUTTON_RIGHT_FACE_UP, // Gamepad right button up (i.e. PS3: Triangle, Xbox: Y) 743 + GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, // Gamepad right button right (i.e. PS3: Circle, Xbox: B) 744 + GAMEPAD_BUTTON_RIGHT_FACE_DOWN, // Gamepad right button down (i.e. PS3: Cross, Xbox: A) 745 + GAMEPAD_BUTTON_RIGHT_FACE_LEFT, // Gamepad right button left (i.e. PS3: Square, Xbox: X) 746 + GAMEPAD_BUTTON_LEFT_TRIGGER_1, // Gamepad top/back trigger left (first), it could be a trailing button 747 + GAMEPAD_BUTTON_LEFT_TRIGGER_2, // Gamepad top/back trigger left (second), it could be a trailing button 748 + GAMEPAD_BUTTON_RIGHT_TRIGGER_1, // Gamepad top/back trigger right (first), it could be a trailing button 749 + GAMEPAD_BUTTON_RIGHT_TRIGGER_2, // Gamepad top/back trigger right (second), it could be a trailing button 750 + GAMEPAD_BUTTON_MIDDLE_LEFT, // Gamepad center buttons, left one (i.e. PS3: Select) 751 + GAMEPAD_BUTTON_MIDDLE, // Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX) 752 + GAMEPAD_BUTTON_MIDDLE_RIGHT, // Gamepad center buttons, right one (i.e. PS3: Start) 753 + GAMEPAD_BUTTON_LEFT_THUMB, // Gamepad joystick pressed button left 754 + GAMEPAD_BUTTON_RIGHT_THUMB // Gamepad joystick pressed button right 755 + } GamepadButton; 756 + 757 + // Gamepad axes 758 + typedef enum { 759 + GAMEPAD_AXIS_LEFT_X = 0, // Gamepad left stick X axis 760 + GAMEPAD_AXIS_LEFT_Y = 1, // Gamepad left stick Y axis 761 + GAMEPAD_AXIS_RIGHT_X = 2, // Gamepad right stick X axis 762 + GAMEPAD_AXIS_RIGHT_Y = 3, // Gamepad right stick Y axis 763 + GAMEPAD_AXIS_LEFT_TRIGGER = 4, // Gamepad back trigger left, pressure level: [1..-1] 764 + GAMEPAD_AXIS_RIGHT_TRIGGER = 5 // Gamepad back trigger right, pressure level: [1..-1] 765 + } GamepadAxis; 766 + 767 + // Material map index 768 + typedef enum { 769 + MATERIAL_MAP_ALBEDO = 0, // Albedo material (same as: MATERIAL_MAP_DIFFUSE) 770 + MATERIAL_MAP_METALNESS, // Metalness material (same as: MATERIAL_MAP_SPECULAR) 771 + MATERIAL_MAP_NORMAL, // Normal material 772 + MATERIAL_MAP_ROUGHNESS, // Roughness material 773 + MATERIAL_MAP_OCCLUSION, // Ambient occlusion material 774 + MATERIAL_MAP_EMISSION, // Emission material 775 + MATERIAL_MAP_HEIGHT, // Heightmap material 776 + MATERIAL_MAP_CUBEMAP, // Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP) 777 + MATERIAL_MAP_IRRADIANCE, // Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP) 778 + MATERIAL_MAP_PREFILTER, // Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP) 779 + MATERIAL_MAP_BRDF // Brdf material 780 + } MaterialMapIndex; 781 + 782 + #define MATERIAL_MAP_DIFFUSE MATERIAL_MAP_ALBEDO 783 + #define MATERIAL_MAP_SPECULAR MATERIAL_MAP_METALNESS 784 + 785 + // Shader location index 786 + // NOTE: Some locations are tried to be set automatically on shader loading, 787 + // but only if default attributes/uniforms names are found, check config.h for names 788 + typedef enum { 789 + SHADER_LOC_VERTEX_POSITION = 0, // Shader location: vertex attribute: position 790 + SHADER_LOC_VERTEX_TEXCOORD01, // Shader location: vertex attribute: texcoord01 791 + SHADER_LOC_VERTEX_TEXCOORD02, // Shader location: vertex attribute: texcoord02 792 + SHADER_LOC_VERTEX_NORMAL, // Shader location: vertex attribute: normal 793 + SHADER_LOC_VERTEX_TANGENT, // Shader location: vertex attribute: tangent 794 + SHADER_LOC_VERTEX_COLOR, // Shader location: vertex attribute: color 795 + SHADER_LOC_MATRIX_MVP, // Shader location: matrix uniform: model-view-projection 796 + SHADER_LOC_MATRIX_VIEW, // Shader location: matrix uniform: view (camera transform) 797 + SHADER_LOC_MATRIX_PROJECTION, // Shader location: matrix uniform: projection 798 + SHADER_LOC_MATRIX_MODEL, // Shader location: matrix uniform: model (transform) 799 + SHADER_LOC_MATRIX_NORMAL, // Shader location: matrix uniform: normal 800 + SHADER_LOC_VECTOR_VIEW, // Shader location: vector uniform: view 801 + SHADER_LOC_COLOR_DIFFUSE, // Shader location: vector uniform: diffuse color 802 + SHADER_LOC_COLOR_SPECULAR, // Shader location: vector uniform: specular color 803 + SHADER_LOC_COLOR_AMBIENT, // Shader location: vector uniform: ambient color 804 + SHADER_LOC_MAP_ALBEDO, // Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE) 805 + SHADER_LOC_MAP_METALNESS, // Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR) 806 + SHADER_LOC_MAP_NORMAL, // Shader location: sampler2d texture: normal 807 + SHADER_LOC_MAP_ROUGHNESS, // Shader location: sampler2d texture: roughness 808 + SHADER_LOC_MAP_OCCLUSION, // Shader location: sampler2d texture: occlusion 809 + SHADER_LOC_MAP_EMISSION, // Shader location: sampler2d texture: emission 810 + SHADER_LOC_MAP_HEIGHT, // Shader location: sampler2d texture: heightmap 811 + SHADER_LOC_MAP_CUBEMAP, // Shader location: samplerCube texture: cubemap 812 + SHADER_LOC_MAP_IRRADIANCE, // Shader location: samplerCube texture: irradiance 813 + SHADER_LOC_MAP_PREFILTER, // Shader location: samplerCube texture: prefilter 814 + SHADER_LOC_MAP_BRDF, // Shader location: sampler2d texture: brdf 815 + SHADER_LOC_VERTEX_BONEIDS, // Shader location: vertex attribute: bone indices 816 + SHADER_LOC_VERTEX_BONEWEIGHTS, // Shader location: vertex attribute: bone weights 817 + SHADER_LOC_MATRIX_BONETRANSFORMS, // Shader location: matrix attribute: bone transforms (animation) 818 + SHADER_LOC_VERTEX_INSTANCETRANSFORM // Shader location: vertex attribute: instance transforms 819 + } ShaderLocationIndex; 820 + 821 + #define SHADER_LOC_MAP_DIFFUSE SHADER_LOC_MAP_ALBEDO 822 + #define SHADER_LOC_MAP_SPECULAR SHADER_LOC_MAP_METALNESS 823 + 824 + // Shader uniform data type 825 + typedef enum { 826 + SHADER_UNIFORM_FLOAT = 0, // Shader uniform type: float 827 + SHADER_UNIFORM_VEC2, // Shader uniform type: vec2 (2 float) 828 + SHADER_UNIFORM_VEC3, // Shader uniform type: vec3 (3 float) 829 + SHADER_UNIFORM_VEC4, // Shader uniform type: vec4 (4 float) 830 + SHADER_UNIFORM_INT, // Shader uniform type: int 831 + SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int) 832 + SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int) 833 + SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int) 834 + SHADER_UNIFORM_UINT, // Shader uniform type: unsigned int 835 + SHADER_UNIFORM_UIVEC2, // Shader uniform type: uivec2 (2 unsigned int) 836 + SHADER_UNIFORM_UIVEC3, // Shader uniform type: uivec3 (3 unsigned int) 837 + SHADER_UNIFORM_UIVEC4, // Shader uniform type: uivec4 (4 unsigned int) 838 + SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d 839 + } ShaderUniformDataType; 840 + 841 + // Shader attribute data types 842 + typedef enum { 843 + SHADER_ATTRIB_FLOAT = 0, // Shader attribute type: float 844 + SHADER_ATTRIB_VEC2, // Shader attribute type: vec2 (2 float) 845 + SHADER_ATTRIB_VEC3, // Shader attribute type: vec3 (3 float) 846 + SHADER_ATTRIB_VEC4 // Shader attribute type: vec4 (4 float) 847 + } ShaderAttributeDataType; 848 + 849 + // Pixel formats 850 + // NOTE: Support depends on OpenGL version and platform 851 + typedef enum { 852 + PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha) 853 + PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels) 854 + PIXELFORMAT_UNCOMPRESSED_R5G6B5, // 16 bpp 855 + PIXELFORMAT_UNCOMPRESSED_R8G8B8, // 24 bpp 856 + PIXELFORMAT_UNCOMPRESSED_R5G5B5A1, // 16 bpp (1 bit alpha) 857 + PIXELFORMAT_UNCOMPRESSED_R4G4B4A4, // 16 bpp (4 bit alpha) 858 + PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, // 32 bpp 859 + PIXELFORMAT_UNCOMPRESSED_R32, // 32 bpp (1 channel - float) 860 + PIXELFORMAT_UNCOMPRESSED_R32G32B32, // 32*3 bpp (3 channels - float) 861 + PIXELFORMAT_UNCOMPRESSED_R32G32B32A32, // 32*4 bpp (4 channels - float) 862 + PIXELFORMAT_UNCOMPRESSED_R16, // 16 bpp (1 channel - half float) 863 + PIXELFORMAT_UNCOMPRESSED_R16G16B16, // 16*3 bpp (3 channels - half float) 864 + PIXELFORMAT_UNCOMPRESSED_R16G16B16A16, // 16*4 bpp (4 channels - half float) 865 + PIXELFORMAT_COMPRESSED_DXT1_RGB, // 4 bpp (no alpha) 866 + PIXELFORMAT_COMPRESSED_DXT1_RGBA, // 4 bpp (1 bit alpha) 867 + PIXELFORMAT_COMPRESSED_DXT3_RGBA, // 8 bpp 868 + PIXELFORMAT_COMPRESSED_DXT5_RGBA, // 8 bpp 869 + PIXELFORMAT_COMPRESSED_ETC1_RGB, // 4 bpp 870 + PIXELFORMAT_COMPRESSED_ETC2_RGB, // 4 bpp 871 + PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA, // 8 bpp 872 + PIXELFORMAT_COMPRESSED_PVRT_RGB, // 4 bpp 873 + PIXELFORMAT_COMPRESSED_PVRT_RGBA, // 4 bpp 874 + PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA, // 8 bpp 875 + PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA // 2 bpp 876 + } PixelFormat; 877 + 878 + // Texture parameters: filter mode 879 + // NOTE 1: Filtering considers mipmaps if available in the texture 880 + // NOTE 2: Filter is accordingly set for minification and magnification 881 + typedef enum { 882 + TEXTURE_FILTER_POINT = 0, // No filter, pixel approximation 883 + TEXTURE_FILTER_BILINEAR, // Linear filtering 884 + TEXTURE_FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps) 885 + TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x 886 + TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x 887 + TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x 888 + } TextureFilter; 889 + 890 + // Texture parameters: wrap mode 891 + typedef enum { 892 + TEXTURE_WRAP_REPEAT = 0, // Repeats texture in tiled mode 893 + TEXTURE_WRAP_CLAMP, // Clamps texture to edge pixel in tiled mode 894 + TEXTURE_WRAP_MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode 895 + TEXTURE_WRAP_MIRROR_CLAMP // Mirrors and clamps to border the texture in tiled mode 896 + } TextureWrap; 897 + 898 + // Cubemap layouts 899 + typedef enum { 900 + CUBEMAP_LAYOUT_AUTO_DETECT = 0, // Automatically detect layout type 901 + CUBEMAP_LAYOUT_LINE_VERTICAL, // Layout is defined by a vertical line with faces 902 + CUBEMAP_LAYOUT_LINE_HORIZONTAL, // Layout is defined by a horizontal line with faces 903 + CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces 904 + CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE // Layout is defined by a 4x3 cross with cubemap faces 905 + } CubemapLayout; 906 + 907 + // Font type, defines generation method 908 + typedef enum { 909 + FONT_DEFAULT = 0, // Default font generation, anti-aliased 910 + FONT_BITMAP, // Bitmap font generation, no anti-aliasing 911 + FONT_SDF // SDF font generation, requires external shader 912 + } FontType; 913 + 914 + // Color blending modes (pre-defined) 915 + typedef enum { 916 + BLEND_ALPHA = 0, // Blend textures considering alpha (default) 917 + BLEND_ADDITIVE, // Blend textures adding colors 918 + BLEND_MULTIPLIED, // Blend textures multiplying colors 919 + BLEND_ADD_COLORS, // Blend textures adding colors (alternative) 920 + BLEND_SUBTRACT_COLORS, // Blend textures subtracting colors (alternative) 921 + BLEND_ALPHA_PREMULTIPLY, // Blend premultiplied textures considering alpha 922 + BLEND_CUSTOM, // Blend textures using custom src/dst factors (use rlSetBlendFactors()) 923 + BLEND_CUSTOM_SEPARATE // Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate()) 924 + } BlendMode; 925 + 926 + // Gesture 927 + // NOTE: Provided as bit-wise flags to enable only desired gestures 928 + typedef enum { 929 + GESTURE_NONE = 0, // No gesture 930 + GESTURE_TAP = 1, // Tap gesture 931 + GESTURE_DOUBLETAP = 2, // Double tap gesture 932 + GESTURE_HOLD = 4, // Hold gesture 933 + GESTURE_DRAG = 8, // Drag gesture 934 + GESTURE_SWIPE_RIGHT = 16, // Swipe right gesture 935 + GESTURE_SWIPE_LEFT = 32, // Swipe left gesture 936 + GESTURE_SWIPE_UP = 64, // Swipe up gesture 937 + GESTURE_SWIPE_DOWN = 128, // Swipe down gesture 938 + GESTURE_PINCH_IN = 256, // Pinch in gesture 939 + GESTURE_PINCH_OUT = 512 // Pinch out gesture 940 + } Gesture; 941 + 942 + // Camera system modes 943 + typedef enum { 944 + CAMERA_CUSTOM = 0, // Camera custom, controlled by user (UpdateCamera() does nothing) 945 + CAMERA_FREE, // Camera free mode 946 + CAMERA_ORBITAL, // Camera orbital, around target, zoom supported 947 + CAMERA_FIRST_PERSON, // Camera first person 948 + CAMERA_THIRD_PERSON // Camera third person 949 + } CameraMode; 950 + 951 + // Camera projection 952 + typedef enum { 953 + CAMERA_PERSPECTIVE = 0, // Perspective projection 954 + CAMERA_ORTHOGRAPHIC // Orthographic projection 955 + } CameraProjection; 956 + 957 + // N-patch layout 958 + typedef enum { 959 + NPATCH_NINE_PATCH = 0, // Npatch layout: 3x3 tiles 960 + NPATCH_THREE_PATCH_VERTICAL, // Npatch layout: 1x3 tiles 961 + NPATCH_THREE_PATCH_HORIZONTAL // Npatch layout: 3x1 tiles 962 + } NPatchLayout; 963 + 964 + // Callbacks to hook some internal functions 965 + // WARNING: These callbacks are intended for advanced users 966 + typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args); // Logging: Redirect trace log messages 967 + typedef unsigned char *(*LoadFileDataCallback)(const char *fileName, int *dataSize); // FileIO: Load binary data 968 + typedef bool (*SaveFileDataCallback)(const char *fileName, void *data, int dataSize); // FileIO: Save binary data 969 + typedef char *(*LoadFileTextCallback)(const char *fileName); // FileIO: Load text data 970 + typedef bool (*SaveFileTextCallback)(const char *fileName, const char *text); // FileIO: Save text data 971 + 972 + //------------------------------------------------------------------------------------ 973 + // Global Variables Definition 974 + //------------------------------------------------------------------------------------ 975 + // It's lonely here... 976 + 977 + //------------------------------------------------------------------------------------ 978 + // Window and Graphics Device Functions (Module: core) 979 + //------------------------------------------------------------------------------------ 980 + 981 + #if defined(__cplusplus) 982 + extern "C" { // Prevents name mangling of functions 983 + #endif 984 + 985 + // Window-related functions 986 + RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context 987 + RLAPI void CloseWindow(void); // Close window and unload OpenGL context 988 + RLAPI bool WindowShouldClose(void); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) 989 + RLAPI bool IsWindowReady(void); // Check if window has been initialized successfully 990 + RLAPI bool IsWindowFullscreen(void); // Check if window is currently fullscreen 991 + RLAPI bool IsWindowHidden(void); // Check if window is currently hidden 992 + RLAPI bool IsWindowMinimized(void); // Check if window is currently minimized 993 + RLAPI bool IsWindowMaximized(void); // Check if window is currently maximized 994 + RLAPI bool IsWindowFocused(void); // Check if window is currently focused 995 + RLAPI bool IsWindowResized(void); // Check if window has been resized last frame 996 + RLAPI bool IsWindowState(unsigned int flag); // Check if one specific window flag is enabled 997 + RLAPI void SetWindowState(unsigned int flags); // Set window configuration state using flags 998 + RLAPI void ClearWindowState(unsigned int flags); // Clear window configuration state flags 999 + RLAPI void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed, resizes monitor to match window resolution 1000 + RLAPI void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed, resizes window to match monitor resolution 1001 + RLAPI void MaximizeWindow(void); // Set window state: maximized, if resizable 1002 + RLAPI void MinimizeWindow(void); // Set window state: minimized, if resizable 1003 + RLAPI void RestoreWindow(void); // Restore window from being minimized/maximized 1004 + RLAPI void SetWindowIcon(Image image); // Set icon for window (single image, RGBA 32bit) 1005 + RLAPI void SetWindowIcons(Image *images, int count); // Set icon for window (multiple images, RGBA 32bit) 1006 + RLAPI void SetWindowTitle(const char *title); // Set title for window 1007 + RLAPI void SetWindowPosition(int x, int y); // Set window position on screen 1008 + RLAPI void SetWindowMonitor(int monitor); // Set monitor for the current window 1009 + RLAPI void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) 1010 + RLAPI void SetWindowMaxSize(int width, int height); // Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) 1011 + RLAPI void SetWindowSize(int width, int height); // Set window dimensions 1012 + RLAPI void SetWindowOpacity(float opacity); // Set window opacity [0.0f..1.0f] 1013 + RLAPI void SetWindowFocused(void); // Set window focused 1014 + RLAPI void *GetWindowHandle(void); // Get native window handle 1015 + RLAPI int GetScreenWidth(void); // Get current screen width 1016 + RLAPI int GetScreenHeight(void); // Get current screen height 1017 + RLAPI int GetRenderWidth(void); // Get current render width (it considers HiDPI) 1018 + RLAPI int GetRenderHeight(void); // Get current render height (it considers HiDPI) 1019 + RLAPI int GetMonitorCount(void); // Get number of connected monitors 1020 + RLAPI int GetCurrentMonitor(void); // Get current monitor where window is placed 1021 + RLAPI Vector2 GetMonitorPosition(int monitor); // Get specified monitor position 1022 + RLAPI int GetMonitorWidth(int monitor); // Get specified monitor width (current video mode used by monitor) 1023 + RLAPI int GetMonitorHeight(int monitor); // Get specified monitor height (current video mode used by monitor) 1024 + RLAPI int GetMonitorPhysicalWidth(int monitor); // Get specified monitor physical width in millimetres 1025 + RLAPI int GetMonitorPhysicalHeight(int monitor); // Get specified monitor physical height in millimetres 1026 + RLAPI int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate 1027 + RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor 1028 + RLAPI Vector2 GetWindowScaleDPI(void); // Get window scale DPI factor 1029 + RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor 1030 + RLAPI void SetClipboardText(const char *text); // Set clipboard text content 1031 + RLAPI const char *GetClipboardText(void); // Get clipboard text content 1032 + RLAPI Image GetClipboardImage(void); // Get clipboard image content 1033 + RLAPI void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling 1034 + RLAPI void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling 1035 + 1036 + // Cursor-related functions 1037 + RLAPI void ShowCursor(void); // Shows cursor 1038 + RLAPI void HideCursor(void); // Hides cursor 1039 + RLAPI bool IsCursorHidden(void); // Check if cursor is not visible 1040 + RLAPI void EnableCursor(void); // Enables cursor (unlock cursor) 1041 + RLAPI void DisableCursor(void); // Disables cursor (lock cursor) 1042 + RLAPI bool IsCursorOnScreen(void); // Check if cursor is on the screen 1043 + 1044 + // Drawing-related functions 1045 + RLAPI void ClearBackground(Color color); // Set background color (framebuffer clear color) 1046 + RLAPI void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing 1047 + RLAPI void EndDrawing(void); // End canvas drawing and swap buffers (double buffering) 1048 + RLAPI void BeginMode2D(Camera2D camera); // Begin 2D mode with custom camera (2D) 1049 + RLAPI void EndMode2D(void); // Ends 2D mode with custom camera 1050 + RLAPI void BeginMode3D(Camera3D camera); // Begin 3D mode with custom camera (3D) 1051 + RLAPI void EndMode3D(void); // Ends 3D mode and returns to default 2D orthographic mode 1052 + RLAPI void BeginTextureMode(RenderTexture2D target); // Begin drawing to render texture 1053 + RLAPI void EndTextureMode(void); // Ends drawing to render texture 1054 + RLAPI void BeginShaderMode(Shader shader); // Begin custom shader drawing 1055 + RLAPI void EndShaderMode(void); // End custom shader drawing (use default shader) 1056 + RLAPI void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied, subtract, custom) 1057 + RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending) 1058 + RLAPI void BeginScissorMode(int x, int y, int width, int height); // Begin scissor mode (define screen area for following drawing) 1059 + RLAPI void EndScissorMode(void); // End scissor mode 1060 + RLAPI void BeginVrStereoMode(VrStereoConfig config); // Begin stereo rendering (requires VR simulator) 1061 + RLAPI void EndVrStereoMode(void); // End stereo rendering (requires VR simulator) 1062 + 1063 + // VR stereo config functions for VR simulator 1064 + RLAPI VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device); // Load VR stereo config for VR simulator device parameters 1065 + RLAPI void UnloadVrStereoConfig(VrStereoConfig config); // Unload VR stereo config 1066 + 1067 + // Shader management functions 1068 + // NOTE: Shader functionality is not available on OpenGL 1.1 1069 + RLAPI Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations 1070 + RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations 1071 + RLAPI bool IsShaderValid(Shader shader); // Check if a shader is valid (loaded on GPU) 1072 + RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location 1073 + RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location 1074 + RLAPI void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value 1075 + RLAPI void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count); // Set shader uniform value vector 1076 + RLAPI void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); // Set shader uniform value (matrix 4x4) 1077 + RLAPI void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value and bind the texture (sampler2d) 1078 + RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM) 1079 + 1080 + // Screen-space-related functions 1081 + #define GetMouseRay GetScreenToWorldRay // Compatibility hack for previous raylib versions 1082 + RLAPI Ray GetScreenToWorldRay(Vector2 position, Camera camera); // Get a ray trace from screen position (i.e mouse) 1083 + RLAPI Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height); // Get a ray trace from screen position (i.e mouse) in a viewport 1084 + RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Get the screen space position for a 3d world space position 1085 + RLAPI Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); // Get size position for a 3d world space position 1086 + RLAPI Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); // Get the screen space position for a 2d camera world space position 1087 + RLAPI Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); // Get the world space position for a 2d camera screen space position 1088 + RLAPI Matrix GetCameraMatrix(Camera camera); // Get camera transform matrix (view matrix) 1089 + RLAPI Matrix GetCameraMatrix2D(Camera2D camera); // Get camera 2d transform matrix 1090 + 1091 + // Timing-related functions 1092 + RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum) 1093 + RLAPI float GetFrameTime(void); // Get time in seconds for last frame drawn (delta time) 1094 + RLAPI double GetTime(void); // Get elapsed time in seconds since InitWindow() 1095 + RLAPI int GetFPS(void); // Get current FPS 1096 + 1097 + // Custom frame control functions 1098 + // NOTE: Those functions are intended for advanced users that want full control over the frame processing 1099 + // By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents() 1100 + // To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL 1101 + RLAPI void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing) 1102 + RLAPI void PollInputEvents(void); // Register all input events 1103 + RLAPI void WaitTime(double seconds); // Wait for some time (halt program execution) 1104 + 1105 + // Random values generation functions 1106 + RLAPI void SetRandomSeed(unsigned int seed); // Set the seed for the random number generator 1107 + RLAPI int GetRandomValue(int min, int max); // Get a random value between min and max (both included) 1108 + RLAPI int *LoadRandomSequence(unsigned int count, int min, int max); // Load random values sequence, no values repeated 1109 + RLAPI void UnloadRandomSequence(int *sequence); // Unload random values sequence 1110 + 1111 + // Misc. functions 1112 + RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format) 1113 + RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS) 1114 + RLAPI void OpenURL(const char *url); // Open URL with default system browser (if available) 1115 + 1116 + // Logging system 1117 + RLAPI void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level 1118 + RLAPI void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) 1119 + RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log 1120 + 1121 + // Memory management, using internal allocators 1122 + RLAPI void *MemAlloc(unsigned int size); // Internal memory allocator 1123 + RLAPI void *MemRealloc(void *ptr, unsigned int size); // Internal memory reallocator 1124 + RLAPI void MemFree(void *ptr); // Internal memory free 1125 + 1126 + // File system management functions 1127 + RLAPI unsigned char *LoadFileData(const char *fileName, int *dataSize); // Load file data as byte array (read) 1128 + RLAPI void UnloadFileData(unsigned char *data); // Unload file data allocated by LoadFileData() 1129 + RLAPI bool SaveFileData(const char *fileName, void *data, int dataSize); // Save data to file from byte array (write), returns true on success 1130 + RLAPI bool ExportDataAsCode(const unsigned char *data, int dataSize, const char *fileName); // Export data to code (.h), returns true on success 1131 + RLAPI char *LoadFileText(const char *fileName); // Load text data from file (read), returns a '\0' terminated string 1132 + RLAPI void UnloadFileText(char *text); // Unload file text data allocated by LoadFileText() 1133 + RLAPI bool SaveFileText(const char *fileName, const char *text); // Save text data to file (write), string must be '\0' terminated, returns true on success 1134 + 1135 + // File access custom callbacks 1136 + // WARNING: Callbacks setup is intended for advanced users 1137 + RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader 1138 + RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver 1139 + RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader 1140 + RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver 1141 + 1142 + RLAPI int FileRename(const char *fileName, const char *fileRename); // Rename file (if exists) 1143 + RLAPI int FileRemove(const char *fileName); // Remove file (if exists) 1144 + RLAPI int FileCopy(const char *srcPath, const char *dstPath); // Copy file from one path to another, dstPath created if it doesn't exist 1145 + RLAPI int FileMove(const char *srcPath, const char *dstPath); // Move file from one directory to another, dstPath created if it doesn't exist 1146 + RLAPI int FileTextReplace(const char *fileName, const char *search, const char *replacement); // Replace text in an existing file 1147 + RLAPI int FileTextFindIndex(const char *fileName, const char *search); // Find text in existing file 1148 + RLAPI bool FileExists(const char *fileName); // Check if file exists 1149 + RLAPI bool DirectoryExists(const char *dirPath); // Check if a directory path exists 1150 + RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (recommended include point: .png, .wav) 1151 + RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) 1152 + RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time) 1153 + RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: '.png') 1154 + RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string 1155 + RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (uses static string) 1156 + RLAPI const char *GetDirectoryPath(const char *filePath); // Get full path for a given fileName with path (uses static string) 1157 + RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string) 1158 + RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string) 1159 + RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string) 1160 + RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success 1161 + RLAPI bool ChangeDirectory(const char *dirPath); // Change working directory, return true on success 1162 + RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory 1163 + RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS 1164 + RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths, files and directories, no subdirs scan 1165 + RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and subdir scan; some filters available: "*.*", "FILES*", "DIRS*" 1166 + RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths 1167 + RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window 1168 + RLAPI FilePathList LoadDroppedFiles(void); // Load dropped filepaths 1169 + RLAPI void UnloadDroppedFiles(FilePathList files); // Unload dropped filepaths 1170 + RLAPI unsigned int GetDirectoryFileCount(const char *dirPath); // Get the file count in a directory 1171 + RLAPI unsigned int GetDirectoryFileCountEx(const char *basePath, const char *filter, bool scanSubdirs); // Get the file count in a directory with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result 1172 + 1173 + // Compression/Encoding functionality 1174 + RLAPI unsigned char *CompressData(const unsigned char *data, int dataSize, int *compDataSize); // Compress data (DEFLATE algorithm), memory must be MemFree() 1175 + RLAPI unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // Decompress data (DEFLATE algorithm), memory must be MemFree() 1176 + RLAPI char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string (includes NULL terminator), memory must be MemFree() 1177 + RLAPI unsigned char *DecodeDataBase64(const char *text, int *outputSize); // Decode Base64 string (expected NULL terminated), memory must be MemFree() 1178 + RLAPI unsigned int ComputeCRC32(unsigned char *data, int dataSize); // Compute CRC32 hash code 1179 + RLAPI unsigned int *ComputeMD5(unsigned char *data, int dataSize); // Compute MD5 hash code, returns static int[4] (16 bytes) 1180 + RLAPI unsigned int *ComputeSHA1(unsigned char *data, int dataSize); // Compute SHA1 hash code, returns static int[5] (20 bytes) 1181 + RLAPI unsigned int *ComputeSHA256(unsigned char *data, int dataSize); // Compute SHA256 hash code, returns static int[8] (32 bytes) 1182 + 1183 + // Automation events functionality 1184 + RLAPI AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS 1185 + RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file 1186 + RLAPI bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file 1187 + RLAPI void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to 1188 + RLAPI void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording 1189 + RLAPI void StartAutomationEventRecording(void); // Start recording automation events (AutomationEventList must be set) 1190 + RLAPI void StopAutomationEventRecording(void); // Stop recording automation events 1191 + RLAPI void PlayAutomationEvent(AutomationEvent event); // Play a recorded automation event 1192 + 1193 + //------------------------------------------------------------------------------------ 1194 + // Input Handling Functions (Module: core) 1195 + //------------------------------------------------------------------------------------ 1196 + 1197 + // Input-related functions: keyboard 1198 + RLAPI bool IsKeyPressed(int key); // Check if a key has been pressed once 1199 + RLAPI bool IsKeyPressedRepeat(int key); // Check if a key has been pressed again 1200 + RLAPI bool IsKeyDown(int key); // Check if a key is being pressed 1201 + RLAPI bool IsKeyReleased(int key); // Check if a key has been released once 1202 + RLAPI bool IsKeyUp(int key); // Check if a key is NOT being pressed 1203 + RLAPI int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty 1204 + RLAPI int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty 1205 + RLAPI const char *GetKeyName(int key); // Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard) 1206 + RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC) 1207 + 1208 + // Input-related functions: gamepads 1209 + RLAPI bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available 1210 + RLAPI const char *GetGamepadName(int gamepad); // Get gamepad internal name id 1211 + RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Check if a gamepad button has been pressed once 1212 + RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Check if a gamepad button is being pressed 1213 + RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Check if a gamepad button has been released once 1214 + RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Check if a gamepad button is NOT being pressed 1215 + RLAPI int GetGamepadButtonPressed(void); // Get the last gamepad button pressed 1216 + RLAPI int GetGamepadAxisCount(int gamepad); // Get axis count for a gamepad 1217 + RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get movement value for a gamepad axis 1218 + RLAPI int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB) 1219 + RLAPI void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); // Set gamepad vibration for both motors (duration in seconds) 1220 + 1221 + // Input-related functions: mouse 1222 + RLAPI bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once 1223 + RLAPI bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed 1224 + RLAPI bool IsMouseButtonReleased(int button); // Check if a mouse button has been released once 1225 + RLAPI bool IsMouseButtonUp(int button); // Check if a mouse button is NOT being pressed 1226 + RLAPI int GetMouseX(void); // Get mouse position X 1227 + RLAPI int GetMouseY(void); // Get mouse position Y 1228 + RLAPI Vector2 GetMousePosition(void); // Get mouse position XY 1229 + RLAPI Vector2 GetMouseDelta(void); // Get mouse delta between frames 1230 + RLAPI void SetMousePosition(int x, int y); // Set mouse position XY 1231 + RLAPI void SetMouseOffset(int offsetX, int offsetY); // Set mouse offset 1232 + RLAPI void SetMouseScale(float scaleX, float scaleY); // Set mouse scaling 1233 + RLAPI float GetMouseWheelMove(void); // Get mouse wheel movement for X or Y, whichever is larger 1234 + RLAPI Vector2 GetMouseWheelMoveV(void); // Get mouse wheel movement for both X and Y 1235 + RLAPI void SetMouseCursor(int cursor); // Set mouse cursor 1236 + 1237 + // Input-related functions: touch 1238 + RLAPI int GetTouchX(void); // Get touch position X for touch point 0 (relative to screen size) 1239 + RLAPI int GetTouchY(void); // Get touch position Y for touch point 0 (relative to screen size) 1240 + RLAPI Vector2 GetTouchPosition(int index); // Get touch position XY for a touch point index (relative to screen size) 1241 + RLAPI int GetTouchPointId(int index); // Get touch point identifier for given index 1242 + RLAPI int GetTouchPointCount(void); // Get number of touch points 1243 + 1244 + //------------------------------------------------------------------------------------ 1245 + // Gestures and Touch Handling Functions (Module: rgestures) 1246 + //------------------------------------------------------------------------------------ 1247 + RLAPI void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags 1248 + RLAPI bool IsGestureDetected(unsigned int gesture); // Check if a gesture have been detected 1249 + RLAPI int GetGestureDetected(void); // Get latest detected gesture 1250 + RLAPI float GetGestureHoldDuration(void); // Get gesture hold time in seconds 1251 + RLAPI Vector2 GetGestureDragVector(void); // Get gesture drag vector 1252 + RLAPI float GetGestureDragAngle(void); // Get gesture drag angle 1253 + RLAPI Vector2 GetGesturePinchVector(void); // Get gesture pinch delta 1254 + RLAPI float GetGesturePinchAngle(void); // Get gesture pinch angle 1255 + 1256 + //------------------------------------------------------------------------------------ 1257 + // Camera System Functions (Module: rcamera) 1258 + //------------------------------------------------------------------------------------ 1259 + RLAPI void UpdateCamera(Camera *camera, int mode); // Update camera position for selected mode 1260 + RLAPI void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, float zoom); // Update camera movement/rotation 1261 + 1262 + //------------------------------------------------------------------------------------ 1263 + // Basic Shapes Drawing Functions (Module: shapes) 1264 + //------------------------------------------------------------------------------------ 1265 + // Set texture and rectangle to be used on shapes drawing 1266 + // NOTE: It can be useful when using basic shapes and one single font, 1267 + // defining a font char white rectangle would allow drawing everything in a single draw call 1268 + RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Set texture and rectangle to be used on shapes drawing 1269 + RLAPI Texture2D GetShapesTexture(void); // Get texture that is used for shapes drawing 1270 + RLAPI Rectangle GetShapesTextureRectangle(void); // Get texture source rectangle that is used for shapes drawing 1271 + 1272 + // Basic shapes drawing functions 1273 + RLAPI void DrawPixel(int posX, int posY, Color color); // Draw a pixel using geometry [Can be slow, use with care] 1274 + RLAPI void DrawPixelV(Vector2 position, Color color); // Draw a pixel using geometry (Vector version) [Can be slow, use with care] 1275 + RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line 1276 + RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines) 1277 + RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads) 1278 + RLAPI void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines) 1279 + RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation 1280 + RLAPI void DrawLineDashed(Vector2 startPos, Vector2 endPos, int dashSize, int spaceSize, Color color); // Draw a dashed line 1281 + RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle 1282 + RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version) 1283 + RLAPI void DrawCircleGradient(Vector2 center, float radius, Color inner, Color outer); // Draw a gradient-filled circle 1284 + RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle 1285 + RLAPI void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline 1286 + RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline 1287 + RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version) 1288 + RLAPI void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse 1289 + RLAPI void DrawEllipseV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse (Vector version) 1290 + RLAPI void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline 1291 + RLAPI void DrawEllipseLinesV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse outline (Vector version) 1292 + RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring 1293 + RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline 1294 + RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle 1295 + RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version) 1296 + RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle 1297 + RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters 1298 + RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); // Draw a vertical-gradient-filled rectangle 1299 + RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); // Draw a horizontal-gradient-filled rectangle 1300 + RLAPI void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color bottomRight, Color topRight); // Draw a gradient-filled rectangle with custom vertex colors 1301 + RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline 1302 + RLAPI void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters 1303 + RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges 1304 + RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle lines with rounded edges 1305 + RLAPI void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline 1306 + RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!) 1307 + RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!) 1308 + RLAPI void DrawTriangleFan(const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center) 1309 + RLAPI void DrawTriangleStrip(const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points 1310 + RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version) 1311 + RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides 1312 + 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 1313 + 1314 + // Splines drawing functions 1315 + RLAPI void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points 1316 + RLAPI void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points 1317 + RLAPI void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points 1318 + 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...] 1319 + 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...] 1320 + RLAPI void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points 1321 + RLAPI void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points 1322 + RLAPI void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points 1323 + RLAPI void DrawSplineSegmentBezierQuadratic(Vector2 p1, Vector2 c2, Vector2 p3, float thick, Color color); // Draw spline segment: Quadratic Bezier, 2 points, 1 control point 1324 + RLAPI void DrawSplineSegmentBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float thick, Color color); // Draw spline segment: Cubic Bezier, 2 points, 2 control points 1325 + 1326 + // Spline segment point evaluation functions, for a given t [0.0f .. 1.0f] 1327 + RLAPI Vector2 GetSplinePointLinear(Vector2 startPos, Vector2 endPos, float t); // Get (evaluate) spline point: Linear 1328 + RLAPI Vector2 GetSplinePointBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float t); // Get (evaluate) spline point: B-Spline 1329 + RLAPI Vector2 GetSplinePointCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float t); // Get (evaluate) spline point: Catmull-Rom 1330 + RLAPI Vector2 GetSplinePointBezierQuad(Vector2 p1, Vector2 c2, Vector2 p3, float t); // Get (evaluate) spline point: Quadratic Bezier 1331 + RLAPI Vector2 GetSplinePointBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float t); // Get (evaluate) spline point: Cubic Bezier 1332 + 1333 + // Basic shapes collision detection functions 1334 + RLAPI bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles 1335 + RLAPI bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); // Check collision between two circles 1336 + RLAPI bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); // Check collision between circle and rectangle 1337 + 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] 1338 + RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle 1339 + RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle 1340 + RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle 1341 + 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] 1342 + RLAPI bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices 1343 + 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 1344 + RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision 1345 + 1346 + //------------------------------------------------------------------------------------ 1347 + // Texture Loading and Drawing Functions (Module: textures) 1348 + //------------------------------------------------------------------------------------ 1349 + 1350 + // Image loading functions 1351 + // NOTE: These functions do not require GPU access 1352 + RLAPI Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM) 1353 + RLAPI Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data 1354 + RLAPI Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data) 1355 + RLAPI Image LoadImageAnimFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int *frames); // Load image sequence from memory buffer 1356 + RLAPI Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load image from memory buffer, fileType refers to extension: i.e. '.png' 1357 + RLAPI Image LoadImageFromTexture(Texture2D texture); // Load image from GPU texture data 1358 + RLAPI Image LoadImageFromScreen(void); // Load image from screen buffer and (screenshot) 1359 + RLAPI bool IsImageValid(Image image); // Check if an image is valid (data and parameters) 1360 + RLAPI void UnloadImage(Image image); // Unload image from CPU memory (RAM) 1361 + RLAPI bool ExportImage(Image image, const char *fileName); // Export image data to file, returns true on success 1362 + RLAPI unsigned char *ExportImageToMemory(Image image, const char *fileType, int *fileSize); // Export image to memory buffer, memory must be MemFree() 1363 + RLAPI bool ExportImageAsCode(Image image, const char *fileName); // Export image as code file defining an array of bytes, returns true on success 1364 + 1365 + // Image generation functions 1366 + RLAPI Image GenImageColor(int width, int height, Color color); // Generate image: plain color 1367 + RLAPI Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end); // Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient 1368 + RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient 1369 + RLAPI Image GenImageGradientSquare(int width, int height, float density, Color inner, Color outer); // Generate image: square gradient 1370 + RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked 1371 + RLAPI Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise 1372 + RLAPI Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); // Generate image: perlin noise 1373 + RLAPI Image GenImageCellular(int width, int height, int tileSize); // Generate image: cellular algorithm, bigger tileSize means bigger cells 1374 + RLAPI Image GenImageText(int width, int height, const char *text); // Generate image: grayscale image from text data 1375 + 1376 + // Image manipulation functions 1377 + RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) 1378 + RLAPI Image ImageFromImage(Image image, Rectangle rec); // Create an image from another image piece 1379 + RLAPI Image ImageFromChannel(Image image, int selectedChannel); // Create an image from a selected channel of another image (GRAYSCALE) 1380 + RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font) 1381 + RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font) 1382 + RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format 1383 + RLAPI void ImageToPOT(Image *image, Color fill); // Convert image to POT (power-of-two) 1384 + RLAPI void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle 1385 + RLAPI void ImageAlphaCrop(Image *image, float threshold); // Crop image depending on alpha value 1386 + RLAPI void ImageAlphaClear(Image *image, Color color, float threshold); // Clear alpha channel to desired color 1387 + RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image 1388 + RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel 1389 + RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation 1390 + RLAPI void ImageKernelConvolution(Image *image, const float *kernel, int kernelSize); // Apply custom square convolution kernel to image 1391 + RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm) 1392 + RLAPI void ImageResizeNN(Image *image, int newWidth, int newHeight); // Resize image (Nearest-Neighbor scaling algorithm) 1393 + RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color 1394 + RLAPI void ImageMipmaps(Image *image); // Compute all mipmap levels for a provided image 1395 + RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering) 1396 + RLAPI void ImageFlipVertical(Image *image); // Flip image vertically 1397 + RLAPI void ImageFlipHorizontal(Image *image); // Flip image horizontally 1398 + RLAPI void ImageRotate(Image *image, int degrees); // Rotate image by input angle in degrees (-359 to 359) 1399 + RLAPI void ImageRotateCW(Image *image); // Rotate image clockwise 90deg 1400 + RLAPI void ImageRotateCCW(Image *image); // Rotate image counter-clockwise 90deg 1401 + RLAPI void ImageColorTint(Image *image, Color color); // Modify image color: tint 1402 + RLAPI void ImageColorInvert(Image *image); // Modify image color: invert 1403 + RLAPI void ImageColorGrayscale(Image *image); // Modify image color: grayscale 1404 + RLAPI void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100) 1405 + RLAPI void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255) 1406 + RLAPI void ImageColorReplace(Image *image, Color color, Color replace); // Modify image color: replace color 1407 + RLAPI Color *LoadImageColors(Image image); // Load color data from image as a Color array (RGBA - 32bit) 1408 + RLAPI Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorCount); // Load colors palette from image as a Color array (RGBA - 32bit) 1409 + RLAPI void UnloadImageColors(Color *colors); // Unload color data loaded with LoadImageColors() 1410 + RLAPI void UnloadImagePalette(Color *colors); // Unload colors palette loaded with LoadImagePalette() 1411 + RLAPI Rectangle GetImageAlphaBorder(Image image, float threshold); // Get image alpha border rectangle 1412 + RLAPI Color GetImageColor(Image image, int x, int y); // Get image pixel color at (x, y) position 1413 + 1414 + // Image drawing functions 1415 + // NOTE: Image software-rendering functions (CPU) 1416 + RLAPI void ImageClearBackground(Image *dst, Color color); // Clear image background with given color 1417 + RLAPI void ImageDrawPixel(Image *dst, int posX, int posY, Color color); // Draw pixel within an image 1418 + RLAPI void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version) 1419 + RLAPI void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image 1420 + RLAPI void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version) 1421 + RLAPI void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, int thick, Color color); // Draw a line defining thickness within an image 1422 + RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image 1423 + RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version) 1424 + RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image 1425 + RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color); // Draw circle outline within an image (Vector version) 1426 + RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image 1427 + RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version) 1428 + RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image 1429 + RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image 1430 + RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image 1431 + 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 1432 + RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image 1433 + RLAPI void ImageDrawTriangleFan(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center) 1434 + RLAPI void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image 1435 + 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) 1436 + 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) 1437 + 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) 1438 + 1439 + // Texture loading functions 1440 + // NOTE: These functions require GPU access 1441 + RLAPI Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM) 1442 + RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data 1443 + RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported 1444 + RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer) 1445 + RLAPI bool IsTextureValid(Texture2D texture); // Check if a texture is valid (loaded in GPU) 1446 + RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM) 1447 + RLAPI bool IsRenderTextureValid(RenderTexture2D target); // Check if a render texture is valid (loaded in GPU) 1448 + RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM) 1449 + RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data (pixels should be able to fill texture) 1450 + RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data (pixels and rec should fit in texture) 1451 + 1452 + // Texture configuration functions 1453 + RLAPI void GenTextureMipmaps(Texture2D *texture); // Generate GPU mipmaps for a texture 1454 + RLAPI void SetTextureFilter(Texture2D texture, int filter); // Set texture scaling filter mode 1455 + RLAPI void SetTextureWrap(Texture2D texture, int wrap); // Set texture wrapping mode 1456 + 1457 + // Texture drawing functions 1458 + RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D 1459 + RLAPI void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2 1460 + RLAPI void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters 1461 + RLAPI void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle 1462 + RLAPI void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters 1463 + RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely 1464 + 1465 + // Color/pixel related functions 1466 + RLAPI bool ColorIsEqual(Color col1, Color col2); // Check if two colors are equal 1467 + RLAPI Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f 1468 + RLAPI int ColorToInt(Color color); // Get hexadecimal value for a Color (0xRRGGBBAA) 1469 + RLAPI Vector4 ColorNormalize(Color color); // Get Color normalized as float [0..1] 1470 + RLAPI Color ColorFromNormalized(Vector4 normalized); // Get Color from normalized values [0..1] 1471 + RLAPI Vector3 ColorToHSV(Color color); // Get HSV values for a Color, hue [0..360], saturation/value [0..1] 1472 + RLAPI Color ColorFromHSV(float hue, float saturation, float value); // Get a Color from HSV values, hue [0..360], saturation/value [0..1] 1473 + RLAPI Color ColorTint(Color color, Color tint); // Get color multiplied with another color 1474 + RLAPI Color ColorBrightness(Color color, float factor); // Get color with brightness correction, brightness factor goes from -1.0f to 1.0f 1475 + RLAPI Color ColorContrast(Color color, float contrast); // Get color with contrast correction, contrast values between -1.0f and 1.0f 1476 + RLAPI Color ColorAlpha(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f 1477 + RLAPI Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint 1478 + RLAPI Color ColorLerp(Color color1, Color color2, float factor); // Get color lerp interpolation between two colors, factor [0.0f..1.0f] 1479 + RLAPI Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value 1480 + RLAPI Color GetPixelColor(void *srcPtr, int format); // Get Color from a source pixel pointer of certain format 1481 + RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer 1482 + RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes for certain format 1483 + 1484 + //------------------------------------------------------------------------------------ 1485 + // Font Loading and Text Drawing Functions (Module: text) 1486 + //------------------------------------------------------------------------------------ 1487 + 1488 + // Font loading/unloading functions 1489 + RLAPI Font GetFontDefault(void); // Get the default Font 1490 + RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM) 1491 + RLAPI Font LoadFontEx(const char *fileName, int fontSize, const int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height 1492 + RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style) 1493 + RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf' 1494 + RLAPI bool IsFontValid(Font font); // Check if a font is valid (font data loaded, WARNING: GPU texture not checked) 1495 + RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount, int type, int *glyphCount); // Load font data for further use 1496 + RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info 1497 + RLAPI void UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM) 1498 + RLAPI void UnloadFont(Font font); // Unload font from GPU memory (VRAM) 1499 + RLAPI bool ExportFontAsCode(Font font, const char *fileName); // Export font as code file, returns true on success 1500 + 1501 + // Text drawing functions 1502 + RLAPI void DrawFPS(int posX, int posY); // Draw current FPS 1503 + RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) 1504 + RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters 1505 + RLAPI void DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); // Draw text using Font and pro parameters (rotation) 1506 + RLAPI void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint) 1507 + RLAPI void DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint); // Draw multiple character (codepoint) 1508 + 1509 + // Text font info functions 1510 + RLAPI void SetTextLineSpacing(int spacing); // Set vertical line spacing when drawing with line-breaks 1511 + RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font 1512 + RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font 1513 + RLAPI Vector2 MeasureTextCodepoints(Font font, const int *codepoints, int length, float fontSize, float spacing); // Measure string size for an existing array of codepoints for Font 1514 + RLAPI int GetGlyphIndex(Font font, int codepoint); // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found 1515 + RLAPI GlyphInfo GetGlyphInfo(Font font, int codepoint); // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found 1516 + RLAPI Rectangle GetGlyphAtlasRec(Font font, int codepoint); // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found 1517 + 1518 + // Text codepoints management functions (unicode characters) 1519 + RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array 1520 + RLAPI void UnloadUTF8(char *text); // Unload UTF-8 text encoded from codepoints array 1521 + RLAPI int *LoadCodepoints(const char *text, int *count); // Load all codepoints from a UTF-8 text string, codepoints count returned by parameter 1522 + RLAPI void UnloadCodepoints(int *codepoints); // Unload codepoints data from memory 1523 + RLAPI int GetCodepointCount(const char *text); // Get total number of codepoints in a UTF-8 encoded string 1524 + RLAPI int GetCodepoint(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure 1525 + RLAPI int GetCodepointNext(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure 1526 + RLAPI int GetCodepointPrevious(const char *text, int *codepointSize); // Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure 1527 + RLAPI const char *CodepointToUTF8(int codepoint, int *utf8Size); // Encode one codepoint into UTF-8 byte array (array length returned as parameter) 1528 + 1529 + // Text strings management functions (no UTF-8 strings, only byte chars) 1530 + // WARNING 1: Most of these functions use internal static buffers[], it's recommended to store returned data on user-side for re-use 1531 + // WARNING 2: Some functions allocate memory internally for the returned strings, those strings must be freed by user using MemFree() 1532 + RLAPI char **LoadTextLines(const char *text, int *count); // Load text as separate lines ('\n') 1533 + RLAPI void UnloadTextLines(char **text, int lineCount); // Unload text lines 1534 + RLAPI int TextCopy(char *dst, const char *src); // Copy one string to another, returns bytes copied 1535 + RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal 1536 + RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending 1537 + RLAPI const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf() style) 1538 + RLAPI const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string 1539 + RLAPI const char *TextRemoveSpaces(const char *text); // Remove text spaces, concat words 1540 + RLAPI char *GetTextBetween(const char *text, const char *begin, const char *end); // Get text between two strings 1541 + RLAPI char *TextReplace(const char *text, const char *search, const char *replacement); // Replace text string with new string 1542 + RLAPI char *TextReplaceAlloc(const char *text, const char *search, const char *replacement); // Replace text string with new string, memory must be MemFree() 1543 + RLAPI char *TextReplaceBetween(const char *text, const char *begin, const char *end, const char *replacement); // Replace text between two specific strings 1544 + RLAPI char *TextReplaceBetweenAlloc(const char *text, const char *begin, const char *end, const char *replacement); // Replace text between two specific strings, memory must be MemFree() 1545 + RLAPI char *TextInsert(const char *text, const char *insert, int position); // Insert text in a defined byte position 1546 + RLAPI char *TextInsertAlloc(const char *text, const char *insert, int position); // Insert text in a defined byte position, memory must be MemFree() 1547 + RLAPI char *TextJoin(char **textList, int count, const char *delimiter); // Join text strings with delimiter 1548 + RLAPI char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings, using MAX_TEXTSPLIT_COUNT static strings 1549 + RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor 1550 + RLAPI int TextFindIndex(const char *text, const char *search); // Find first text occurrence within a string, -1 if not found 1551 + RLAPI char *TextToUpper(const char *text); // Get upper case version of provided string 1552 + RLAPI char *TextToLower(const char *text); // Get lower case version of provided string 1553 + RLAPI char *TextToPascal(const char *text); // Get Pascal case notation version of provided string 1554 + RLAPI char *TextToSnake(const char *text); // Get Snake case notation version of provided string 1555 + RLAPI char *TextToCamel(const char *text); // Get Camel case notation version of provided string 1556 + RLAPI int TextToInteger(const char *text); // Get integer value from text 1557 + RLAPI float TextToFloat(const char *text); // Get float value from text 1558 + 1559 + //------------------------------------------------------------------------------------ 1560 + // Basic 3d Shapes Drawing Functions (Module: models) 1561 + //------------------------------------------------------------------------------------ 1562 + 1563 + // Basic geometric 3D shapes drawing functions 1564 + RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space 1565 + RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line 1566 + RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space 1567 + RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!) 1568 + RLAPI void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points 1569 + RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube 1570 + RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version) 1571 + RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires 1572 + RLAPI void DrawCubeWiresV(Vector3 position, Vector3 size, Color color); // Draw cube wires (Vector version) 1573 + RLAPI void DrawSphere(Vector3 centerPos, float radius, Color color); // Draw sphere 1574 + RLAPI void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere with extended parameters 1575 + RLAPI void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere wires 1576 + RLAPI void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone 1577 + RLAPI void DrawCylinderEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder with base at startPos and top at endPos 1578 + RLAPI void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone wires 1579 + RLAPI void DrawCylinderWiresEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder wires with base at startPos and top at endPos 1580 + RLAPI void DrawCapsule(Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color); // Draw a capsule with the center of its sphere caps at startPos and endPos 1581 + RLAPI void DrawCapsuleWires(Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color); // Draw capsule wireframe with the center of its sphere caps at startPos and endPos 1582 + RLAPI void DrawPlane(Vector3 centerPos, Vector2 size, Color color); // Draw a plane XZ 1583 + RLAPI void DrawRay(Ray ray, Color color); // Draw a ray line 1584 + RLAPI void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0)) 1585 + 1586 + //------------------------------------------------------------------------------------ 1587 + // Model 3d Loading and Drawing Functions (Module: models) 1588 + //------------------------------------------------------------------------------------ 1589 + 1590 + // Model management functions 1591 + RLAPI Model LoadModel(const char *fileName); // Load model from files (meshes and materials) 1592 + RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material) 1593 + RLAPI bool IsModelValid(Model model); // Check if a model is valid (loaded in GPU, VAO/VBOs) 1594 + RLAPI void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM) 1595 + RLAPI BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes) 1596 + 1597 + // Model drawing functions 1598 + RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set) 1599 + RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters 1600 + RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set) 1601 + RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters 1602 + RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires) 1603 + RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint); // Draw a billboard texture 1604 + RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source 1605 + RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation 1606 + 1607 + // Mesh management functions 1608 + RLAPI void UploadMesh(Mesh *mesh, bool dynamic); // Upload mesh vertex data in GPU and provide VAO/VBO ids 1609 + RLAPI void UpdateMeshBuffer(Mesh mesh, int index, const void *data, int dataSize, int offset); // Update mesh vertex data in GPU for a specific buffer index 1610 + RLAPI void UnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU 1611 + RLAPI void DrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform 1612 + RLAPI void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, int instances); // Draw multiple mesh instances with material and different transforms 1613 + RLAPI BoundingBox GetMeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits 1614 + RLAPI void GenMeshTangents(Mesh *mesh); // Compute mesh tangents 1615 + RLAPI bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success 1616 + RLAPI bool ExportMeshAsCode(Mesh mesh, const char *fileName); // Export mesh as code file (.h) defining multiple arrays of vertex attributes 1617 + 1618 + // Mesh generation functions 1619 + RLAPI Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh 1620 + RLAPI Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions) 1621 + RLAPI Mesh GenMeshCube(float width, float height, float length); // Generate cuboid mesh 1622 + RLAPI Mesh GenMeshSphere(float radius, int rings, int slices); // Generate sphere mesh (standard sphere) 1623 + RLAPI Mesh GenMeshHemiSphere(float radius, int rings, int slices); // Generate half-sphere mesh (no bottom cap) 1624 + RLAPI Mesh GenMeshCylinder(float radius, float height, int slices); // Generate cylinder mesh 1625 + RLAPI Mesh GenMeshCone(float radius, float height, int slices); // Generate cone/pyramid mesh 1626 + RLAPI Mesh GenMeshTorus(float radius, float size, int radSeg, int sides); // Generate torus mesh 1627 + RLAPI Mesh GenMeshKnot(float radius, float size, int radSeg, int sides); // Generate trefoil knot mesh 1628 + RLAPI Mesh GenMeshHeightmap(Image heightmap, Vector3 size); // Generate heightmap mesh from image data 1629 + RLAPI Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); // Generate cubes-based map mesh from image data 1630 + 1631 + // Material loading/unloading functions 1632 + RLAPI Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file 1633 + RLAPI Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) 1634 + RLAPI bool IsMaterialValid(Material material); // Check if a material is valid (shader assigned, map textures loaded in GPU) 1635 + RLAPI void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM) 1636 + RLAPI void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...) 1637 + RLAPI void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh 1638 + 1639 + // Model animations loading/unloading functions 1640 + RLAPI ModelAnimation *LoadModelAnimations(const char *fileName, int *animCount); // Load model animations from file 1641 + RLAPI void UpdateModelAnimation(Model model, ModelAnimation anim, float frame); // Update model animation pose (vertex buffers and bone matrices) 1642 + RLAPI void UpdateModelAnimationEx(Model model, ModelAnimation animA, float frameA, ModelAnimation animB, float frameB, float blend); // Update model animation pose, blending two animations 1643 + RLAPI void UnloadModelAnimations(ModelAnimation *animations, int animCount); // Unload animation array data 1644 + RLAPI bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match 1645 + 1646 + // Collision detection functions 1647 + RLAPI bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Check collision between two spheres 1648 + RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Check collision between two bounding boxes 1649 + RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); // Check collision between box and sphere 1650 + RLAPI RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius); // Get collision info between ray and sphere 1651 + RLAPI RayCollision GetRayCollisionBox(Ray ray, BoundingBox box); // Get collision info between ray and box 1652 + RLAPI RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix transform); // Get collision info between ray and mesh 1653 + RLAPI RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle 1654 + RLAPI RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4); // Get collision info between ray and quad 1655 + 1656 + //------------------------------------------------------------------------------------ 1657 + // Audio Loading and Playing Functions (Module: audio) 1658 + //------------------------------------------------------------------------------------ 1659 + typedef void (*AudioCallback)(void *bufferData, unsigned int frames); 1660 + 1661 + // Audio device management functions 1662 + RLAPI void InitAudioDevice(void); // Initialize audio device and context 1663 + RLAPI void CloseAudioDevice(void); // Close the audio device and context 1664 + RLAPI bool IsAudioDeviceReady(void); // Check if audio device has been initialized successfully 1665 + RLAPI void SetMasterVolume(float volume); // Set master volume (listener) 1666 + RLAPI float GetMasterVolume(void); // Get master volume (listener) 1667 + 1668 + // Wave/Sound loading/unloading functions 1669 + RLAPI Wave LoadWave(const char *fileName); // Load wave data from file 1670 + RLAPI Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load wave from memory buffer, fileType refers to extension: i.e. '.wav' 1671 + RLAPI bool IsWaveValid(Wave wave); // Checks if wave data is valid (data loaded and parameters) 1672 + RLAPI Sound LoadSound(const char *fileName); // Load sound from file 1673 + RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data 1674 + RLAPI Sound LoadSoundAlias(Sound source); // Create a new sound that shares the same sample data as the source sound, does not own the sound data 1675 + RLAPI bool IsSoundValid(Sound sound); // Checks if a sound is valid (data loaded and buffers initialized) 1676 + RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data (default data format: 32 bit float, stereo) 1677 + RLAPI void UnloadWave(Wave wave); // Unload wave data 1678 + RLAPI void UnloadSound(Sound sound); // Unload sound 1679 + RLAPI void UnloadSoundAlias(Sound alias); // Unload a sound alias (does not deallocate sample data) 1680 + RLAPI bool ExportWave(Wave wave, const char *fileName); // Export wave data to file, returns true on success 1681 + RLAPI bool ExportWaveAsCode(Wave wave, const char *fileName); // Export wave sample data to code (.h), returns true on success 1682 + 1683 + // Wave/Sound management functions 1684 + RLAPI void PlaySound(Sound sound); // Play a sound 1685 + RLAPI void StopSound(Sound sound); // Stop playing a sound 1686 + RLAPI void PauseSound(Sound sound); // Pause a sound 1687 + RLAPI void ResumeSound(Sound sound); // Resume a paused sound 1688 + RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing 1689 + RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level) 1690 + RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level) 1691 + RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (-1.0 left, 0.0 center, 1.0 right) 1692 + RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave 1693 + RLAPI void WaveCrop(Wave *wave, int initFrame, int finalFrame); // Crop a wave to defined frames range 1694 + RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format 1695 + RLAPI float *LoadWaveSamples(Wave wave); // Load samples data from wave as a 32bit float data array 1696 + RLAPI void UnloadWaveSamples(float *samples); // Unload samples data loaded with LoadWaveSamples() 1697 + 1698 + // Music management functions 1699 + RLAPI Music LoadMusicStream(const char *fileName); // Load music stream from file 1700 + RLAPI Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data, int dataSize); // Load music stream from data 1701 + RLAPI bool IsMusicValid(Music music); // Checks if a music stream is valid (context and buffers initialized) 1702 + RLAPI void UnloadMusicStream(Music music); // Unload music stream 1703 + RLAPI void PlayMusicStream(Music music); // Start music playing 1704 + RLAPI bool IsMusicStreamPlaying(Music music); // Check if music is playing 1705 + RLAPI void UpdateMusicStream(Music music); // Updates buffers for music streaming 1706 + RLAPI void StopMusicStream(Music music); // Stop music playing 1707 + RLAPI void PauseMusicStream(Music music); // Pause music playing 1708 + RLAPI void ResumeMusicStream(Music music); // Resume playing paused music 1709 + RLAPI void SeekMusicStream(Music music, float position); // Seek music to a position (in seconds) 1710 + RLAPI void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level) 1711 + RLAPI void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level) 1712 + RLAPI void SetMusicPan(Music music, float pan); // Set pan for a music (-1.0 left, 0.0 center, 1.0 right) 1713 + RLAPI float GetMusicTimeLength(Music music); // Get music time length (in seconds) 1714 + RLAPI float GetMusicTimePlayed(Music music); // Get current music time played (in seconds) 1715 + 1716 + // AudioStream management functions 1717 + RLAPI AudioStream LoadAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); // Load audio stream (to stream raw audio pcm data) 1718 + RLAPI bool IsAudioStreamValid(AudioStream stream); // Checks if an audio stream is valid (buffers initialized) 1719 + RLAPI void UnloadAudioStream(AudioStream stream); // Unload audio stream and free memory 1720 + RLAPI void UpdateAudioStream(AudioStream stream, const void *data, int frameCount); // Update audio stream buffers with data 1721 + RLAPI bool IsAudioStreamProcessed(AudioStream stream); // Check if any audio stream buffers requires refill 1722 + RLAPI void PlayAudioStream(AudioStream stream); // Play audio stream 1723 + RLAPI void PauseAudioStream(AudioStream stream); // Pause audio stream 1724 + RLAPI void ResumeAudioStream(AudioStream stream); // Resume audio stream 1725 + RLAPI bool IsAudioStreamPlaying(AudioStream stream); // Check if audio stream is playing 1726 + RLAPI void StopAudioStream(AudioStream stream); // Stop audio stream 1727 + RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level) 1728 + RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level) 1729 + RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (-1.0 to 1.0 range, 0.0 is centered) 1730 + RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams 1731 + RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data 1732 + 1733 + RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo) 1734 + RLAPI void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream 1735 + 1736 + RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo) 1737 + RLAPI void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline 1738 + 1739 + #if defined(__cplusplus) 1740 + } 1741 + #endif 1742 + 1743 + #endif // RAYLIB_H
+3139
linked-libs/raylib-6.0_linux_amd64/include/raymath.h
··· 1 + /********************************************************************************************** 2 + * 3 + * raymath v2.0 - Math functions to work with Vector2, Vector3, Matrix and Quaternions 4 + * 5 + * CONVENTIONS: 6 + * - Matrix structure is defined as row-major (memory layout) but parameters naming AND all 7 + * math operations performed by the library consider the structure as it was column-major 8 + * It is like transposed versions of the matrices are used for all the maths 9 + * It benefits some functions making them cache-friendly and also avoids matrix 10 + * transpositions sometimes required by OpenGL 11 + * Example: In memory order, row0 is [m0 m4 m8 m12] but in semantic math row0 is [m0 m1 m2 m3] 12 + * - Functions are always self-contained, no function use another raymath function inside, 13 + * required code is directly re-implemented inside 14 + * - Functions input parameters are always received by value (2 unavoidable exceptions) 15 + * - Functions use always a "result" variable for return (except C++ operators) 16 + * - Functions are always defined inline 17 + * - Angles are always in radians (DEG2RAD/RAD2DEG macros provided for convenience) 18 + * - No compound literals used to make sure the library is compatible with C++ 19 + * 20 + * CONFIGURATION: 21 + * #define RAYMATH_IMPLEMENTATION 22 + * Generates the implementation of the library into the included file 23 + * If not defined, the library is in header only mode and can be included in other headers 24 + * or source files without problems. But only ONE file should hold the implementation 25 + * 26 + * #define RAYMATH_STATIC_INLINE 27 + * Define static inline functions code, so #include header suffices for use 28 + * This may use up lots of memory 29 + * 30 + * #define RAYMATH_DISABLE_CPP_OPERATORS 31 + * Disables C++ operator overloads for raymath types. 32 + * 33 + * #define RAYMATH_USE_SIMD_INTRINSICS 1 34 + * Try to enable SIMD intrinsics for MatrixMultiply() 35 + * Note that users enabling it must be aware of the target platform where application will 36 + * run to support the selected SIMD intrinsic, for now, only SSE is supported 37 + * 38 + * LICENSE: zlib/libpng 39 + * 40 + * Copyright (c) 2015-2026 Ramon Santamaria (@raysan5) 41 + * 42 + * This software is provided "as-is", without any express or implied warranty. In no event 43 + * will the authors be held liable for any damages arising from the use of this software. 44 + * 45 + * Permission is granted to anyone to use this software for any purpose, including commercial 46 + * applications, and to alter it and redistribute it freely, subject to the following restrictions: 47 + * 48 + * 1. The origin of this software must not be misrepresented; you must not claim that you 49 + * wrote the original software. If you use this software in a product, an acknowledgment 50 + * in the product documentation would be appreciated but is not required. 51 + * 52 + * 2. Altered source versions must be plainly marked as such, and must not be misrepresented 53 + * as being the original software. 54 + * 55 + * 3. This notice may not be removed or altered from any source distribution. 56 + * 57 + **********************************************************************************************/ 58 + 59 + #ifndef RAYMATH_H 60 + #define RAYMATH_H 61 + 62 + #if defined(RAYMATH_IMPLEMENTATION) && defined(RAYMATH_STATIC_INLINE) 63 + #error "Specifying both RAYMATH_IMPLEMENTATION and RAYMATH_STATIC_INLINE is contradictory" 64 + #endif 65 + 66 + // Function specifiers definition 67 + #if defined(RAYMATH_IMPLEMENTATION) 68 + #if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED) 69 + #define RMAPI __declspec(dllexport) extern inline // Building raylib as a Win32 shared library (.dll) 70 + #elif defined(BUILD_LIBTYPE_SHARED) 71 + #define RMAPI __attribute__((visibility("default"))) // Building raylib as a Unix shared library (.so/.dylib) 72 + #elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED) 73 + #define RMAPI __declspec(dllimport) // Using raylib as a Win32 shared library (.dll) 74 + #else 75 + #define RMAPI extern inline // Provide external definition 76 + #endif 77 + #elif defined(RAYMATH_STATIC_INLINE) 78 + #define RMAPI static inline // Functions may be inlined, no external out-of-line definition 79 + #else 80 + #if defined(__TINYC__) 81 + #define RMAPI static inline // plain inline not supported by tinycc (See issue #435) 82 + #else 83 + #define RMAPI inline // Functions may be inlined or external definition used 84 + #endif 85 + #endif 86 + 87 + //---------------------------------------------------------------------------------- 88 + // Defines and Macros 89 + //---------------------------------------------------------------------------------- 90 + #ifndef PI 91 + #define PI 3.14159265358979323846f 92 + #endif 93 + 94 + #ifndef EPSILON 95 + #define EPSILON 0.000001f 96 + #endif 97 + 98 + #ifndef DEG2RAD 99 + #define DEG2RAD (PI/180.0f) 100 + #endif 101 + 102 + #ifndef RAD2DEG 103 + #define RAD2DEG (180.0f/PI) 104 + #endif 105 + 106 + // Get float vector for Matrix 107 + #ifndef MatrixToFloat 108 + #define MatrixToFloat(mat) (MatrixToFloatV(mat).v) 109 + #endif 110 + 111 + // Get float vector for Vector3 112 + #ifndef Vector3ToFloat 113 + #define Vector3ToFloat(vec) (Vector3ToFloatV(vec).v) 114 + #endif 115 + 116 + //---------------------------------------------------------------------------------- 117 + // Types and Structures Definition 118 + //---------------------------------------------------------------------------------- 119 + #if !defined(RL_VECTOR2_TYPE) 120 + // Vector2 type 121 + typedef struct Vector2 { 122 + float x; 123 + float y; 124 + } Vector2; 125 + #define RL_VECTOR2_TYPE 126 + #endif 127 + 128 + #if !defined(RL_VECTOR3_TYPE) 129 + // Vector3 type 130 + typedef struct Vector3 { 131 + float x; 132 + float y; 133 + float z; 134 + } Vector3; 135 + #define RL_VECTOR3_TYPE 136 + #endif 137 + 138 + #if !defined(RL_VECTOR4_TYPE) 139 + // Vector4 type 140 + typedef struct Vector4 { 141 + float x; 142 + float y; 143 + float z; 144 + float w; 145 + } Vector4; 146 + #define RL_VECTOR4_TYPE 147 + #endif 148 + 149 + #if !defined(RL_QUATERNION_TYPE) 150 + // Quaternion type 151 + typedef Vector4 Quaternion; 152 + #define RL_QUATERNION_TYPE 153 + #endif 154 + 155 + #if !defined(RL_MATRIX_TYPE) 156 + // Matrix type (OpenGL style 4x4 - right handed, column major) 157 + typedef struct Matrix { 158 + float m0, m4, m8, m12; // Matrix first row (4 components) 159 + float m1, m5, m9, m13; // Matrix second row (4 components) 160 + float m2, m6, m10, m14; // Matrix third row (4 components) 161 + float m3, m7, m11, m15; // Matrix fourth row (4 components) 162 + } Matrix; 163 + #define RL_MATRIX_TYPE 164 + #endif 165 + 166 + // NOTE: Helper types to be used instead of array return types for *ToFloat functions 167 + #if !defined(RL_FLOAT3_TYPE) 168 + typedef struct float3 { 169 + float v[3]; 170 + } float3; 171 + #define RL_FLOAT3_TYPE 172 + #endif 173 + 174 + #if !defined(RL_FLOAT16_TYPE) 175 + typedef struct float16 { 176 + float v[16]; 177 + } float16; 178 + #define RL_FLOAT16_TYPE 179 + #endif 180 + 181 + #include <math.h> // Required for: sinf(), cosf(), tan(), atan2f(), sqrtf(), floor(), fminf(), fmaxf(), fabsf() 182 + 183 + #if RAYMATH_USE_SIMD_INTRINSICS 184 + // SIMD is used on the most costly raymath function MatrixMultiply() 185 + // NOTE: Only SSE intrinsics support implemented 186 + // TODO: Consider support for other SIMD intrinsics: 187 + // - SSEx, AVX, AVX2, FMA, NEON, RVV 188 + /* 189 + #if defined(__SSE4_2__) 190 + #include <nmmintrin.h> 191 + #define RAYMATH_SSE42_ENABLED 192 + #elif defined(__SSE4_1__) 193 + #include <smmintrin.h> 194 + #define RAYMATH_SSE41_ENABLED 195 + #elif defined(__SSSE3__) 196 + #include <tmmintrin.h> 197 + #define RAYMATH_SSSE3_ENABLED 198 + #elif defined(__SSE3__) 199 + #include <pmmintrin.h> 200 + #define RAYMATH_SSE3_ENABLED 201 + #elif defined(__SSE2__) || (defined(_M_AMD64) || defined(_M_X64)) // SSE2 x64 202 + #include <emmintrin.h> 203 + #define RAYMATH_SSE2_ENABLED 204 + #endif 205 + */ 206 + #if defined(__SSE__) || defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1)) 207 + #include <xmmintrin.h> 208 + #define RAYMATH_SSE_ENABLED 209 + #endif 210 + #endif 211 + 212 + //---------------------------------------------------------------------------------- 213 + // Module Functions Definition - Utils math 214 + //---------------------------------------------------------------------------------- 215 + 216 + // Clamp float value 217 + RMAPI float Clamp(float value, float min, float max) 218 + { 219 + float result = (value < min)? min : value; 220 + 221 + if (result > max) result = max; 222 + 223 + return result; 224 + } 225 + 226 + // Calculate linear interpolation between two floats 227 + RMAPI float Lerp(float start, float end, float amount) 228 + { 229 + float result = start + amount*(end - start); 230 + 231 + return result; 232 + } 233 + 234 + // Normalize input value within input range 235 + RMAPI float Normalize(float value, float start, float end) 236 + { 237 + float result = (value - start)/(end - start); 238 + 239 + return result; 240 + } 241 + 242 + // Remap input value within input range to output range 243 + RMAPI float Remap(float value, float inputStart, float inputEnd, float outputStart, float outputEnd) 244 + { 245 + float result = (value - inputStart)/(inputEnd - inputStart)*(outputEnd - outputStart) + outputStart; 246 + 247 + return result; 248 + } 249 + 250 + // Wrap input value from min to max 251 + RMAPI float Wrap(float value, float min, float max) 252 + { 253 + float result = value - (max - min)*floorf((value - min)/(max - min)); 254 + 255 + return result; 256 + } 257 + 258 + // Check whether two given floats are almost equal 259 + RMAPI int FloatEquals(float x, float y) 260 + { 261 + #if !defined(EPSILON) 262 + #define EPSILON 0.000001f 263 + #endif 264 + 265 + int result = (fabsf(x - y)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(x), fabsf(y)))); 266 + 267 + return result; 268 + } 269 + 270 + //---------------------------------------------------------------------------------- 271 + // Module Functions Definition - Vector2 math 272 + //---------------------------------------------------------------------------------- 273 + 274 + // Vector with components value 0.0f 275 + RMAPI Vector2 Vector2Zero(void) 276 + { 277 + Vector2 result = { 0.0f, 0.0f }; 278 + 279 + return result; 280 + } 281 + 282 + // Vector with components value 1.0f 283 + RMAPI Vector2 Vector2One(void) 284 + { 285 + Vector2 result = { 1.0f, 1.0f }; 286 + 287 + return result; 288 + } 289 + 290 + // Add two vectors (v1 + v2) 291 + RMAPI Vector2 Vector2Add(Vector2 v1, Vector2 v2) 292 + { 293 + Vector2 result = { v1.x + v2.x, v1.y + v2.y }; 294 + 295 + return result; 296 + } 297 + 298 + // Add vector and float value 299 + RMAPI Vector2 Vector2AddValue(Vector2 v, float add) 300 + { 301 + Vector2 result = { v.x + add, v.y + add }; 302 + 303 + return result; 304 + } 305 + 306 + // Subtract two vectors (v1 - v2) 307 + RMAPI Vector2 Vector2Subtract(Vector2 v1, Vector2 v2) 308 + { 309 + Vector2 result = { v1.x - v2.x, v1.y - v2.y }; 310 + 311 + return result; 312 + } 313 + 314 + // Subtract vector by float value 315 + RMAPI Vector2 Vector2SubtractValue(Vector2 v, float sub) 316 + { 317 + Vector2 result = { v.x - sub, v.y - sub }; 318 + 319 + return result; 320 + } 321 + 322 + // Calculate vector length 323 + RMAPI float Vector2Length(Vector2 v) 324 + { 325 + float result = sqrtf((v.x*v.x) + (v.y*v.y)); 326 + 327 + return result; 328 + } 329 + 330 + // Calculate vector square length 331 + RMAPI float Vector2LengthSqr(Vector2 v) 332 + { 333 + float result = (v.x*v.x) + (v.y*v.y); 334 + 335 + return result; 336 + } 337 + 338 + // Calculate two vectors dot product 339 + RMAPI float Vector2DotProduct(Vector2 v1, Vector2 v2) 340 + { 341 + float result = (v1.x*v2.x + v1.y*v2.y); 342 + 343 + return result; 344 + } 345 + 346 + // Calculate two vectors cross product 347 + RMAPI float Vector2CrossProduct(Vector2 v1, Vector2 v2) 348 + { 349 + float result = (v1.x*v2.y - v1.y*v2.x); 350 + 351 + return result; 352 + } 353 + 354 + // Calculate distance between two vectors 355 + RMAPI float Vector2Distance(Vector2 v1, Vector2 v2) 356 + { 357 + float result = sqrtf((v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y)); 358 + 359 + return result; 360 + } 361 + 362 + // Calculate square distance between two vectors 363 + RMAPI float Vector2DistanceSqr(Vector2 v1, Vector2 v2) 364 + { 365 + float result = ((v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y)); 366 + 367 + return result; 368 + } 369 + 370 + // Calculate the signed angle from v1 to v2, relative to the origin (0, 0) 371 + // NOTE: Coordinate system convention: positive X right, positive Y down 372 + // positive angles appear clockwise, and negative angles appear counterclockwise 373 + RMAPI float Vector2Angle(Vector2 v1, Vector2 v2) 374 + { 375 + float result = 0.0f; 376 + 377 + float dot = v1.x*v2.x + v1.y*v2.y; 378 + float det = v1.x*v2.y - v1.y*v2.x; 379 + 380 + result = atan2f(det, dot); 381 + 382 + return result; 383 + } 384 + 385 + // Calculate angle defined by a two vectors line 386 + // NOTE: Parameters need to be normalized 387 + // Current implementation should be aligned with glm::angle 388 + RMAPI float Vector2LineAngle(Vector2 start, Vector2 end) 389 + { 390 + float result = 0.0f; 391 + 392 + // TODO(10/9/2023): Currently angles move clockwise, determine if this is wanted behavior 393 + result = -atan2f(end.y - start.y, end.x - start.x); 394 + 395 + return result; 396 + } 397 + 398 + // Scale vector (multiply by value) 399 + RMAPI Vector2 Vector2Scale(Vector2 v, float scale) 400 + { 401 + Vector2 result = { v.x*scale, v.y*scale }; 402 + 403 + return result; 404 + } 405 + 406 + // Multiply vector by vector 407 + RMAPI Vector2 Vector2Multiply(Vector2 v1, Vector2 v2) 408 + { 409 + Vector2 result = { v1.x*v2.x, v1.y*v2.y }; 410 + 411 + return result; 412 + } 413 + 414 + // Negate vector 415 + RMAPI Vector2 Vector2Negate(Vector2 v) 416 + { 417 + Vector2 result = { -v.x, -v.y }; 418 + 419 + return result; 420 + } 421 + 422 + // Divide vector by vector 423 + RMAPI Vector2 Vector2Divide(Vector2 v1, Vector2 v2) 424 + { 425 + Vector2 result = { v1.x/v2.x, v1.y/v2.y }; 426 + 427 + return result; 428 + } 429 + 430 + // Normalize provided vector 431 + RMAPI Vector2 Vector2Normalize(Vector2 v) 432 + { 433 + Vector2 result = { 0 }; 434 + float length = sqrtf((v.x*v.x) + (v.y*v.y)); 435 + 436 + if (length > 0) 437 + { 438 + float ilength = 1.0f/length; 439 + result.x = v.x*ilength; 440 + result.y = v.y*ilength; 441 + } 442 + 443 + return result; 444 + } 445 + 446 + // Transforms a Vector2 by a given Matrix 447 + RMAPI Vector2 Vector2Transform(Vector2 v, Matrix mat) 448 + { 449 + Vector2 result = { 0 }; 450 + 451 + float x = v.x; 452 + float y = v.y; 453 + float z = 0; 454 + 455 + result.x = mat.m0*x + mat.m4*y + mat.m8*z + mat.m12; 456 + result.y = mat.m1*x + mat.m5*y + mat.m9*z + mat.m13; 457 + 458 + return result; 459 + } 460 + 461 + // Calculate linear interpolation between two vectors 462 + RMAPI Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount) 463 + { 464 + Vector2 result = { 0 }; 465 + 466 + result.x = v1.x + amount*(v2.x - v1.x); 467 + result.y = v1.y + amount*(v2.y - v1.y); 468 + 469 + return result; 470 + } 471 + 472 + // Calculate reflected vector to normal 473 + RMAPI Vector2 Vector2Reflect(Vector2 v, Vector2 normal) 474 + { 475 + Vector2 result = { 0 }; 476 + 477 + float dotProduct = (v.x*normal.x + v.y*normal.y); // Dot product 478 + 479 + result.x = v.x - (2.0f*normal.x)*dotProduct; 480 + result.y = v.y - (2.0f*normal.y)*dotProduct; 481 + 482 + return result; 483 + } 484 + 485 + // Get min value for each pair of components 486 + RMAPI Vector2 Vector2Min(Vector2 v1, Vector2 v2) 487 + { 488 + Vector2 result = { 0 }; 489 + 490 + result.x = fminf(v1.x, v2.x); 491 + result.y = fminf(v1.y, v2.y); 492 + 493 + return result; 494 + } 495 + 496 + // Get max value for each pair of components 497 + RMAPI Vector2 Vector2Max(Vector2 v1, Vector2 v2) 498 + { 499 + Vector2 result = { 0 }; 500 + 501 + result.x = fmaxf(v1.x, v2.x); 502 + result.y = fmaxf(v1.y, v2.y); 503 + 504 + return result; 505 + } 506 + 507 + // Rotate vector by angle 508 + RMAPI Vector2 Vector2Rotate(Vector2 v, float angle) 509 + { 510 + Vector2 result = { 0 }; 511 + 512 + float cosres = cosf(angle); 513 + float sinres = sinf(angle); 514 + 515 + result.x = v.x*cosres - v.y*sinres; 516 + result.y = v.x*sinres + v.y*cosres; 517 + 518 + return result; 519 + } 520 + 521 + // Move Vector towards target 522 + RMAPI Vector2 Vector2MoveTowards(Vector2 v, Vector2 target, float maxDistance) 523 + { 524 + Vector2 result = { 0 }; 525 + 526 + float dx = target.x - v.x; 527 + float dy = target.y - v.y; 528 + float value = (dx*dx) + (dy*dy); 529 + 530 + if ((value == 0) || ((maxDistance >= 0) && (value <= maxDistance*maxDistance))) return target; 531 + 532 + float dist = sqrtf(value); 533 + 534 + result.x = v.x + dx/dist*maxDistance; 535 + result.y = v.y + dy/dist*maxDistance; 536 + 537 + return result; 538 + } 539 + 540 + // Invert the given vector 541 + RMAPI Vector2 Vector2Invert(Vector2 v) 542 + { 543 + Vector2 result = { 1.0f/v.x, 1.0f/v.y }; 544 + 545 + return result; 546 + } 547 + 548 + // Clamp the components of the vector between 549 + // min and max values specified by the given vectors 550 + RMAPI Vector2 Vector2Clamp(Vector2 v, Vector2 min, Vector2 max) 551 + { 552 + Vector2 result = { 0 }; 553 + 554 + result.x = fminf(max.x, fmaxf(min.x, v.x)); 555 + result.y = fminf(max.y, fmaxf(min.y, v.y)); 556 + 557 + return result; 558 + } 559 + 560 + // Clamp the magnitude of the vector between two min and max values 561 + RMAPI Vector2 Vector2ClampValue(Vector2 v, float min, float max) 562 + { 563 + Vector2 result = v; 564 + 565 + float length = (v.x*v.x) + (v.y*v.y); 566 + if (length > 0.0f) 567 + { 568 + length = sqrtf(length); 569 + 570 + float scale = 1; // By default, 1 as the neutral element 571 + if (length < min) scale = min/length; 572 + else if (length > max) scale = max/length; 573 + 574 + result.x = v.x*scale; 575 + result.y = v.y*scale; 576 + } 577 + 578 + return result; 579 + } 580 + 581 + // Check whether two given vectors are almost equal 582 + RMAPI int Vector2Equals(Vector2 p, Vector2 q) 583 + { 584 + #if !defined(EPSILON) 585 + #define EPSILON 0.000001f 586 + #endif 587 + 588 + int result = ((fabsf(p.x - q.x)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) && 589 + ((fabsf(p.y - q.y)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y))))); 590 + 591 + return result; 592 + } 593 + 594 + // Compute the direction of a refracted ray 595 + // v: normalized direction of the incoming ray 596 + // n: normalized normal vector of the interface of two optical media 597 + // r: ratio of the refractive index of the medium from where the ray comes 598 + // to the refractive index of the medium on the other side of the surface 599 + RMAPI Vector2 Vector2Refract(Vector2 v, Vector2 n, float r) 600 + { 601 + Vector2 result = { 0 }; 602 + 603 + float dot = v.x*n.x + v.y*n.y; 604 + float d = 1.0f - r*r*(1.0f - dot*dot); 605 + 606 + if (d >= 0.0f) 607 + { 608 + d = sqrtf(d); 609 + v.x = r*v.x - (r*dot + d)*n.x; 610 + v.y = r*v.y - (r*dot + d)*n.y; 611 + 612 + result = v; 613 + } 614 + 615 + return result; 616 + } 617 + 618 + 619 + //---------------------------------------------------------------------------------- 620 + // Module Functions Definition - Vector3 math 621 + //---------------------------------------------------------------------------------- 622 + 623 + // Vector with components value 0.0f 624 + RMAPI Vector3 Vector3Zero(void) 625 + { 626 + Vector3 result = { 0.0f, 0.0f, 0.0f }; 627 + 628 + return result; 629 + } 630 + 631 + // Vector with components value 1.0f 632 + RMAPI Vector3 Vector3One(void) 633 + { 634 + Vector3 result = { 1.0f, 1.0f, 1.0f }; 635 + 636 + return result; 637 + } 638 + 639 + // Add two vectors 640 + RMAPI Vector3 Vector3Add(Vector3 v1, Vector3 v2) 641 + { 642 + Vector3 result = { v1.x + v2.x, v1.y + v2.y, v1.z + v2.z }; 643 + 644 + return result; 645 + } 646 + 647 + // Add vector and float value 648 + RMAPI Vector3 Vector3AddValue(Vector3 v, float add) 649 + { 650 + Vector3 result = { v.x + add, v.y + add, v.z + add }; 651 + 652 + return result; 653 + } 654 + 655 + // Subtract two vectors 656 + RMAPI Vector3 Vector3Subtract(Vector3 v1, Vector3 v2) 657 + { 658 + Vector3 result = { v1.x - v2.x, v1.y - v2.y, v1.z - v2.z }; 659 + 660 + return result; 661 + } 662 + 663 + // Subtract vector by float value 664 + RMAPI Vector3 Vector3SubtractValue(Vector3 v, float sub) 665 + { 666 + Vector3 result = { v.x - sub, v.y - sub, v.z - sub }; 667 + 668 + return result; 669 + } 670 + 671 + // Multiply vector by scalar 672 + RMAPI Vector3 Vector3Scale(Vector3 v, float scalar) 673 + { 674 + Vector3 result = { v.x*scalar, v.y*scalar, v.z*scalar }; 675 + 676 + return result; 677 + } 678 + 679 + // Multiply vector by vector 680 + RMAPI Vector3 Vector3Multiply(Vector3 v1, Vector3 v2) 681 + { 682 + Vector3 result = { v1.x*v2.x, v1.y*v2.y, v1.z*v2.z }; 683 + 684 + return result; 685 + } 686 + 687 + // Calculate two vectors cross product 688 + RMAPI Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2) 689 + { 690 + Vector3 result = { v1.y*v2.z - v1.z*v2.y, v1.z*v2.x - v1.x*v2.z, v1.x*v2.y - v1.y*v2.x }; 691 + 692 + return result; 693 + } 694 + 695 + // Calculate one vector perpendicular vector 696 + RMAPI Vector3 Vector3Perpendicular(Vector3 v) 697 + { 698 + Vector3 result = { 0 }; 699 + 700 + float min = fabsf(v.x); 701 + Vector3 cardinalAxis = {1.0f, 0.0f, 0.0f}; 702 + 703 + if (fabsf(v.y) < min) 704 + { 705 + min = fabsf(v.y); 706 + Vector3 tmp = {0.0f, 1.0f, 0.0f}; 707 + cardinalAxis = tmp; 708 + } 709 + 710 + if (fabsf(v.z) < min) 711 + { 712 + Vector3 tmp = {0.0f, 0.0f, 1.0f}; 713 + cardinalAxis = tmp; 714 + } 715 + 716 + // Cross product between vectors 717 + result.x = v.y*cardinalAxis.z - v.z*cardinalAxis.y; 718 + result.y = v.z*cardinalAxis.x - v.x*cardinalAxis.z; 719 + result.z = v.x*cardinalAxis.y - v.y*cardinalAxis.x; 720 + 721 + return result; 722 + } 723 + 724 + // Calculate vector length 725 + RMAPI float Vector3Length(const Vector3 v) 726 + { 727 + float result = sqrtf(v.x*v.x + v.y*v.y + v.z*v.z); 728 + 729 + return result; 730 + } 731 + 732 + // Calculate vector square length 733 + RMAPI float Vector3LengthSqr(const Vector3 v) 734 + { 735 + float result = v.x*v.x + v.y*v.y + v.z*v.z; 736 + 737 + return result; 738 + } 739 + 740 + // Calculate two vectors dot product 741 + RMAPI float Vector3DotProduct(Vector3 v1, Vector3 v2) 742 + { 743 + float result = (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z); 744 + 745 + return result; 746 + } 747 + 748 + // Calculate distance between two vectors 749 + RMAPI float Vector3Distance(Vector3 v1, Vector3 v2) 750 + { 751 + float result = 0.0f; 752 + 753 + float dx = v2.x - v1.x; 754 + float dy = v2.y - v1.y; 755 + float dz = v2.z - v1.z; 756 + result = sqrtf(dx*dx + dy*dy + dz*dz); 757 + 758 + return result; 759 + } 760 + 761 + // Calculate square distance between two vectors 762 + RMAPI float Vector3DistanceSqr(Vector3 v1, Vector3 v2) 763 + { 764 + float result = 0.0f; 765 + 766 + float dx = v2.x - v1.x; 767 + float dy = v2.y - v1.y; 768 + float dz = v2.z - v1.z; 769 + result = dx*dx + dy*dy + dz*dz; 770 + 771 + return result; 772 + } 773 + 774 + // Calculate angle between two vectors 775 + RMAPI float Vector3Angle(Vector3 v1, Vector3 v2) 776 + { 777 + float result = 0.0f; 778 + 779 + Vector3 cross = { v1.y*v2.z - v1.z*v2.y, v1.z*v2.x - v1.x*v2.z, v1.x*v2.y - v1.y*v2.x }; 780 + float len = sqrtf(cross.x*cross.x + cross.y*cross.y + cross.z*cross.z); 781 + float dot = (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z); 782 + result = atan2f(len, dot); 783 + 784 + return result; 785 + } 786 + 787 + // Negate provided vector (invert direction) 788 + RMAPI Vector3 Vector3Negate(Vector3 v) 789 + { 790 + Vector3 result = { -v.x, -v.y, -v.z }; 791 + 792 + return result; 793 + } 794 + 795 + // Divide vector by vector 796 + RMAPI Vector3 Vector3Divide(Vector3 v1, Vector3 v2) 797 + { 798 + Vector3 result = { v1.x/v2.x, v1.y/v2.y, v1.z/v2.z }; 799 + 800 + return result; 801 + } 802 + 803 + // Normalize provided vector 804 + RMAPI Vector3 Vector3Normalize(Vector3 v) 805 + { 806 + Vector3 result = v; 807 + 808 + float length = sqrtf(v.x*v.x + v.y*v.y + v.z*v.z); 809 + if (length != 0.0f) 810 + { 811 + float ilength = 1.0f/length; 812 + 813 + result.x *= ilength; 814 + result.y *= ilength; 815 + result.z *= ilength; 816 + } 817 + 818 + return result; 819 + } 820 + 821 + //Calculate the projection of the vector v1 on to v2 822 + RMAPI Vector3 Vector3Project(Vector3 v1, Vector3 v2) 823 + { 824 + Vector3 result = { 0 }; 825 + 826 + float v1dv2 = (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z); 827 + float v2dv2 = (v2.x*v2.x + v2.y*v2.y + v2.z*v2.z); 828 + 829 + float mag = v1dv2/v2dv2; 830 + 831 + result.x = v2.x*mag; 832 + result.y = v2.y*mag; 833 + result.z = v2.z*mag; 834 + 835 + return result; 836 + } 837 + 838 + //Calculate the rejection of the vector v1 on to v2 839 + RMAPI Vector3 Vector3Reject(Vector3 v1, Vector3 v2) 840 + { 841 + Vector3 result = { 0 }; 842 + 843 + float v1dv2 = (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z); 844 + float v2dv2 = (v2.x*v2.x + v2.y*v2.y + v2.z*v2.z); 845 + 846 + float mag = v1dv2/v2dv2; 847 + 848 + result.x = v1.x - (v2.x*mag); 849 + result.y = v1.y - (v2.y*mag); 850 + result.z = v1.z - (v2.z*mag); 851 + 852 + return result; 853 + } 854 + 855 + // Orthonormalize provided vectors 856 + // Makes vectors normalized and orthogonal to each other 857 + // Gram-Schmidt function implementation 858 + RMAPI void Vector3OrthoNormalize(Vector3 *v1, Vector3 *v2) 859 + { 860 + float length = 0.0f; 861 + float ilength = 0.0f; 862 + 863 + // Vector3Normalize(*v1); 864 + Vector3 v = *v1; 865 + length = sqrtf(v.x*v.x + v.y*v.y + v.z*v.z); 866 + if (length == 0.0f) length = 1.0f; 867 + ilength = 1.0f/length; 868 + v1->x *= ilength; 869 + v1->y *= ilength; 870 + v1->z *= ilength; 871 + 872 + // Vector3CrossProduct(*v1, *v2) 873 + Vector3 vn1 = { v1->y*v2->z - v1->z*v2->y, v1->z*v2->x - v1->x*v2->z, v1->x*v2->y - v1->y*v2->x }; 874 + 875 + // Vector3Normalize(vn1); 876 + v = vn1; 877 + length = sqrtf(v.x*v.x + v.y*v.y + v.z*v.z); 878 + if (length == 0.0f) length = 1.0f; 879 + ilength = 1.0f/length; 880 + vn1.x *= ilength; 881 + vn1.y *= ilength; 882 + vn1.z *= ilength; 883 + 884 + // Vector3CrossProduct(vn1, *v1) 885 + Vector3 vn2 = { vn1.y*v1->z - vn1.z*v1->y, vn1.z*v1->x - vn1.x*v1->z, vn1.x*v1->y - vn1.y*v1->x }; 886 + 887 + *v2 = vn2; 888 + } 889 + 890 + // Transforms a Vector3 by a given Matrix 891 + RMAPI Vector3 Vector3Transform(Vector3 v, Matrix mat) 892 + { 893 + Vector3 result = { 0 }; 894 + 895 + float x = v.x; 896 + float y = v.y; 897 + float z = v.z; 898 + 899 + result.x = mat.m0*x + mat.m4*y + mat.m8*z + mat.m12; 900 + result.y = mat.m1*x + mat.m5*y + mat.m9*z + mat.m13; 901 + result.z = mat.m2*x + mat.m6*y + mat.m10*z + mat.m14; 902 + 903 + return result; 904 + } 905 + 906 + // Transform a vector by quaternion rotation 907 + RMAPI Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q) 908 + { 909 + Vector3 result = { 0 }; 910 + 911 + result.x = v.x*(q.x*q.x + q.w*q.w - q.y*q.y - q.z*q.z) + v.y*(2*q.x*q.y - 2*q.w*q.z) + v.z*(2*q.x*q.z + 2*q.w*q.y); 912 + result.y = v.x*(2*q.w*q.z + 2*q.x*q.y) + v.y*(q.w*q.w - q.x*q.x + q.y*q.y - q.z*q.z) + v.z*(-2*q.w*q.x + 2*q.y*q.z); 913 + result.z = v.x*(-2*q.w*q.y + 2*q.x*q.z) + v.y*(2*q.w*q.x + 2*q.y*q.z)+ v.z*(q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z); 914 + 915 + return result; 916 + } 917 + 918 + // Rotates a vector around an axis 919 + RMAPI Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle) 920 + { 921 + // Using Euler-Rodrigues Formula 922 + // Ref.: https://en.wikipedia.org/w/index.php?title=Euler%E2%80%93Rodrigues_formula 923 + 924 + Vector3 result = v; 925 + 926 + // Vector3Normalize(axis); 927 + float length = sqrtf(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z); 928 + if (length == 0.0f) length = 1.0f; 929 + float ilength = 1.0f/length; 930 + axis.x *= ilength; 931 + axis.y *= ilength; 932 + axis.z *= ilength; 933 + 934 + angle /= 2.0f; 935 + float a = sinf(angle); 936 + float b = axis.x*a; 937 + float c = axis.y*a; 938 + float d = axis.z*a; 939 + a = cosf(angle); 940 + Vector3 w = { b, c, d }; 941 + 942 + // Vector3CrossProduct(w, v) 943 + Vector3 wv = { w.y*v.z - w.z*v.y, w.z*v.x - w.x*v.z, w.x*v.y - w.y*v.x }; 944 + 945 + // Vector3CrossProduct(w, wv) 946 + Vector3 wwv = { w.y*wv.z - w.z*wv.y, w.z*wv.x - w.x*wv.z, w.x*wv.y - w.y*wv.x }; 947 + 948 + // Vector3Scale(wv, 2*a) 949 + a *= 2; 950 + wv.x *= a; 951 + wv.y *= a; 952 + wv.z *= a; 953 + 954 + // Vector3Scale(wwv, 2) 955 + wwv.x *= 2; 956 + wwv.y *= 2; 957 + wwv.z *= 2; 958 + 959 + result.x += wv.x; 960 + result.y += wv.y; 961 + result.z += wv.z; 962 + 963 + result.x += wwv.x; 964 + result.y += wwv.y; 965 + result.z += wwv.z; 966 + 967 + return result; 968 + } 969 + 970 + // Move Vector towards target 971 + RMAPI Vector3 Vector3MoveTowards(Vector3 v, Vector3 target, float maxDistance) 972 + { 973 + Vector3 result = { 0 }; 974 + 975 + float dx = target.x - v.x; 976 + float dy = target.y - v.y; 977 + float dz = target.z - v.z; 978 + float value = (dx*dx) + (dy*dy) + (dz*dz); 979 + 980 + if ((value == 0) || ((maxDistance >= 0) && (value <= maxDistance*maxDistance))) return target; 981 + 982 + float dist = sqrtf(value); 983 + 984 + result.x = v.x + dx/dist*maxDistance; 985 + result.y = v.y + dy/dist*maxDistance; 986 + result.z = v.z + dz/dist*maxDistance; 987 + 988 + return result; 989 + } 990 + 991 + // Calculate linear interpolation between two vectors 992 + RMAPI Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount) 993 + { 994 + Vector3 result = { 0 }; 995 + 996 + result.x = v1.x + amount*(v2.x - v1.x); 997 + result.y = v1.y + amount*(v2.y - v1.y); 998 + result.z = v1.z + amount*(v2.z - v1.z); 999 + 1000 + return result; 1001 + } 1002 + 1003 + // Calculate cubic hermite interpolation between two vectors and their tangents 1004 + // as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic 1005 + RMAPI Vector3 Vector3CubicHermite(Vector3 v1, Vector3 tangent1, Vector3 v2, Vector3 tangent2, float amount) 1006 + { 1007 + Vector3 result = { 0 }; 1008 + 1009 + float amountPow2 = amount*amount; 1010 + float amountPow3 = amount*amount*amount; 1011 + 1012 + result.x = (2*amountPow3 - 3*amountPow2 + 1)*v1.x + (amountPow3 - 2*amountPow2 + amount)*tangent1.x + (-2*amountPow3 + 3*amountPow2)*v2.x + (amountPow3 - amountPow2)*tangent2.x; 1013 + result.y = (2*amountPow3 - 3*amountPow2 + 1)*v1.y + (amountPow3 - 2*amountPow2 + amount)*tangent1.y + (-2*amountPow3 + 3*amountPow2)*v2.y + (amountPow3 - amountPow2)*tangent2.y; 1014 + result.z = (2*amountPow3 - 3*amountPow2 + 1)*v1.z + (amountPow3 - 2*amountPow2 + amount)*tangent1.z + (-2*amountPow3 + 3*amountPow2)*v2.z + (amountPow3 - amountPow2)*tangent2.z; 1015 + 1016 + return result; 1017 + } 1018 + 1019 + // Calculate reflected vector to normal 1020 + RMAPI Vector3 Vector3Reflect(Vector3 v, Vector3 normal) 1021 + { 1022 + Vector3 result = { 0 }; 1023 + 1024 + // I is the original vector 1025 + // N is the normal of the incident plane 1026 + // R = I - (2*N*(DotProduct[I, N])) 1027 + 1028 + float dotProduct = (v.x*normal.x + v.y*normal.y + v.z*normal.z); 1029 + 1030 + result.x = v.x - (2.0f*normal.x)*dotProduct; 1031 + result.y = v.y - (2.0f*normal.y)*dotProduct; 1032 + result.z = v.z - (2.0f*normal.z)*dotProduct; 1033 + 1034 + return result; 1035 + } 1036 + 1037 + // Get min value for each pair of components 1038 + RMAPI Vector3 Vector3Min(Vector3 v1, Vector3 v2) 1039 + { 1040 + Vector3 result = { 0 }; 1041 + 1042 + result.x = fminf(v1.x, v2.x); 1043 + result.y = fminf(v1.y, v2.y); 1044 + result.z = fminf(v1.z, v2.z); 1045 + 1046 + return result; 1047 + } 1048 + 1049 + // Get max value for each pair of components 1050 + RMAPI Vector3 Vector3Max(Vector3 v1, Vector3 v2) 1051 + { 1052 + Vector3 result = { 0 }; 1053 + 1054 + result.x = fmaxf(v1.x, v2.x); 1055 + result.y = fmaxf(v1.y, v2.y); 1056 + result.z = fmaxf(v1.z, v2.z); 1057 + 1058 + return result; 1059 + } 1060 + 1061 + // Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c) 1062 + // NOTE: Assumes P is on the plane of the triangle 1063 + RMAPI Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c) 1064 + { 1065 + Vector3 result = { 0 }; 1066 + 1067 + Vector3 v0 = { b.x - a.x, b.y - a.y, b.z - a.z }; // Vector3Subtract(b, a) 1068 + Vector3 v1 = { c.x - a.x, c.y - a.y, c.z - a.z }; // Vector3Subtract(c, a) 1069 + Vector3 v2 = { p.x - a.x, p.y - a.y, p.z - a.z }; // Vector3Subtract(p, a) 1070 + float d00 = (v0.x*v0.x + v0.y*v0.y + v0.z*v0.z); // Vector3DotProduct(v0, v0) 1071 + float d01 = (v0.x*v1.x + v0.y*v1.y + v0.z*v1.z); // Vector3DotProduct(v0, v1) 1072 + float d11 = (v1.x*v1.x + v1.y*v1.y + v1.z*v1.z); // Vector3DotProduct(v1, v1) 1073 + float d20 = (v2.x*v0.x + v2.y*v0.y + v2.z*v0.z); // Vector3DotProduct(v2, v0) 1074 + float d21 = (v2.x*v1.x + v2.y*v1.y + v2.z*v1.z); // Vector3DotProduct(v2, v1) 1075 + 1076 + float denom = d00*d11 - d01*d01; 1077 + 1078 + result.y = (d11*d20 - d01*d21)/denom; 1079 + result.z = (d00*d21 - d01*d20)/denom; 1080 + result.x = 1.0f - (result.z + result.y); 1081 + 1082 + return result; 1083 + } 1084 + 1085 + // Projects a Vector3 from screen space into object space 1086 + // NOTE: Self-contained function, no other raymath functions are called 1087 + RMAPI Vector3 Vector3Unproject(Vector3 source, Matrix projection, Matrix view) 1088 + { 1089 + Vector3 result = { 0 }; 1090 + 1091 + // Calculate unprojected matrix (multiply view matrix by projection matrix) and invert it 1092 + Matrix matViewProj = { // MatrixMultiply(view, projection); 1093 + view.m0*projection.m0 + view.m1*projection.m4 + view.m2*projection.m8 + view.m3*projection.m12, 1094 + view.m0*projection.m1 + view.m1*projection.m5 + view.m2*projection.m9 + view.m3*projection.m13, 1095 + view.m0*projection.m2 + view.m1*projection.m6 + view.m2*projection.m10 + view.m3*projection.m14, 1096 + view.m0*projection.m3 + view.m1*projection.m7 + view.m2*projection.m11 + view.m3*projection.m15, 1097 + view.m4*projection.m0 + view.m5*projection.m4 + view.m6*projection.m8 + view.m7*projection.m12, 1098 + view.m4*projection.m1 + view.m5*projection.m5 + view.m6*projection.m9 + view.m7*projection.m13, 1099 + view.m4*projection.m2 + view.m5*projection.m6 + view.m6*projection.m10 + view.m7*projection.m14, 1100 + view.m4*projection.m3 + view.m5*projection.m7 + view.m6*projection.m11 + view.m7*projection.m15, 1101 + view.m8*projection.m0 + view.m9*projection.m4 + view.m10*projection.m8 + view.m11*projection.m12, 1102 + view.m8*projection.m1 + view.m9*projection.m5 + view.m10*projection.m9 + view.m11*projection.m13, 1103 + view.m8*projection.m2 + view.m9*projection.m6 + view.m10*projection.m10 + view.m11*projection.m14, 1104 + view.m8*projection.m3 + view.m9*projection.m7 + view.m10*projection.m11 + view.m11*projection.m15, 1105 + view.m12*projection.m0 + view.m13*projection.m4 + view.m14*projection.m8 + view.m15*projection.m12, 1106 + view.m12*projection.m1 + view.m13*projection.m5 + view.m14*projection.m9 + view.m15*projection.m13, 1107 + view.m12*projection.m2 + view.m13*projection.m6 + view.m14*projection.m10 + view.m15*projection.m14, 1108 + view.m12*projection.m3 + view.m13*projection.m7 + view.m14*projection.m11 + view.m15*projection.m15 }; 1109 + 1110 + // Calculate inverted matrix -> MatrixInvert(matViewProj); 1111 + // Cache the matrix values (speed optimization) 1112 + float a00 = matViewProj.m0, a01 = matViewProj.m1, a02 = matViewProj.m2, a03 = matViewProj.m3; 1113 + float a10 = matViewProj.m4, a11 = matViewProj.m5, a12 = matViewProj.m6, a13 = matViewProj.m7; 1114 + float a20 = matViewProj.m8, a21 = matViewProj.m9, a22 = matViewProj.m10, a23 = matViewProj.m11; 1115 + float a30 = matViewProj.m12, a31 = matViewProj.m13, a32 = matViewProj.m14, a33 = matViewProj.m15; 1116 + 1117 + float b00 = a00*a11 - a01*a10; 1118 + float b01 = a00*a12 - a02*a10; 1119 + float b02 = a00*a13 - a03*a10; 1120 + float b03 = a01*a12 - a02*a11; 1121 + float b04 = a01*a13 - a03*a11; 1122 + float b05 = a02*a13 - a03*a12; 1123 + float b06 = a20*a31 - a21*a30; 1124 + float b07 = a20*a32 - a22*a30; 1125 + float b08 = a20*a33 - a23*a30; 1126 + float b09 = a21*a32 - a22*a31; 1127 + float b10 = a21*a33 - a23*a31; 1128 + float b11 = a22*a33 - a23*a32; 1129 + 1130 + // Calculate the invert determinant (inlined to avoid double-caching) 1131 + float invDet = 1.0f/(b00*b11 - b01*b10 + b02*b09 + b03*b08 - b04*b07 + b05*b06); 1132 + 1133 + Matrix matViewProjInv = { 1134 + (a11*b11 - a12*b10 + a13*b09)*invDet, 1135 + (-a01*b11 + a02*b10 - a03*b09)*invDet, 1136 + (a31*b05 - a32*b04 + a33*b03)*invDet, 1137 + (-a21*b05 + a22*b04 - a23*b03)*invDet, 1138 + (-a10*b11 + a12*b08 - a13*b07)*invDet, 1139 + (a00*b11 - a02*b08 + a03*b07)*invDet, 1140 + (-a30*b05 + a32*b02 - a33*b01)*invDet, 1141 + (a20*b05 - a22*b02 + a23*b01)*invDet, 1142 + (a10*b10 - a11*b08 + a13*b06)*invDet, 1143 + (-a00*b10 + a01*b08 - a03*b06)*invDet, 1144 + (a30*b04 - a31*b02 + a33*b00)*invDet, 1145 + (-a20*b04 + a21*b02 - a23*b00)*invDet, 1146 + (-a10*b09 + a11*b07 - a12*b06)*invDet, 1147 + (a00*b09 - a01*b07 + a02*b06)*invDet, 1148 + (-a30*b03 + a31*b01 - a32*b00)*invDet, 1149 + (a20*b03 - a21*b01 + a22*b00)*invDet }; 1150 + 1151 + // Create quaternion from source point 1152 + Quaternion quat = { source.x, source.y, source.z, 1.0f }; 1153 + 1154 + // Multiply quat point by unprojected matrix 1155 + Quaternion qtransformed = { // QuaternionTransform(quat, matViewProjInv) 1156 + matViewProjInv.m0*quat.x + matViewProjInv.m4*quat.y + matViewProjInv.m8*quat.z + matViewProjInv.m12*quat.w, 1157 + matViewProjInv.m1*quat.x + matViewProjInv.m5*quat.y + matViewProjInv.m9*quat.z + matViewProjInv.m13*quat.w, 1158 + matViewProjInv.m2*quat.x + matViewProjInv.m6*quat.y + matViewProjInv.m10*quat.z + matViewProjInv.m14*quat.w, 1159 + matViewProjInv.m3*quat.x + matViewProjInv.m7*quat.y + matViewProjInv.m11*quat.z + matViewProjInv.m15*quat.w }; 1160 + 1161 + // Normalized world points in vectors 1162 + result.x = qtransformed.x/qtransformed.w; 1163 + result.y = qtransformed.y/qtransformed.w; 1164 + result.z = qtransformed.z/qtransformed.w; 1165 + 1166 + return result; 1167 + } 1168 + 1169 + // Get Vector3 as float array 1170 + RMAPI float3 Vector3ToFloatV(Vector3 v) 1171 + { 1172 + float3 buffer = { 0 }; 1173 + 1174 + buffer.v[0] = v.x; 1175 + buffer.v[1] = v.y; 1176 + buffer.v[2] = v.z; 1177 + 1178 + return buffer; 1179 + } 1180 + 1181 + // Invert the given vector 1182 + RMAPI Vector3 Vector3Invert(Vector3 v) 1183 + { 1184 + Vector3 result = { 1.0f/v.x, 1.0f/v.y, 1.0f/v.z }; 1185 + 1186 + return result; 1187 + } 1188 + 1189 + // Clamp the components of the vector between 1190 + // min and max values specified by the given vectors 1191 + RMAPI Vector3 Vector3Clamp(Vector3 v, Vector3 min, Vector3 max) 1192 + { 1193 + Vector3 result = { 0 }; 1194 + 1195 + result.x = fminf(max.x, fmaxf(min.x, v.x)); 1196 + result.y = fminf(max.y, fmaxf(min.y, v.y)); 1197 + result.z = fminf(max.z, fmaxf(min.z, v.z)); 1198 + 1199 + return result; 1200 + } 1201 + 1202 + // Clamp the magnitude of the vector between two values 1203 + RMAPI Vector3 Vector3ClampValue(Vector3 v, float min, float max) 1204 + { 1205 + Vector3 result = v; 1206 + 1207 + float length = (v.x*v.x) + (v.y*v.y) + (v.z*v.z); 1208 + if (length > 0.0f) 1209 + { 1210 + length = sqrtf(length); 1211 + 1212 + float scale = 1; // By default, 1 as the neutral element 1213 + if (length < min) scale = min/length; 1214 + else if (length > max) scale = max/length; 1215 + 1216 + result.x = v.x*scale; 1217 + result.y = v.y*scale; 1218 + result.z = v.z*scale; 1219 + } 1220 + 1221 + return result; 1222 + } 1223 + 1224 + // Check whether two given vectors are almost equal 1225 + RMAPI int Vector3Equals(Vector3 p, Vector3 q) 1226 + { 1227 + #if !defined(EPSILON) 1228 + #define EPSILON 0.000001f 1229 + #endif 1230 + 1231 + int result = ((fabsf(p.x - q.x)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) && 1232 + ((fabsf(p.y - q.y)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y))))) && 1233 + ((fabsf(p.z - q.z)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z))))); 1234 + 1235 + return result; 1236 + } 1237 + 1238 + // Compute the direction of a refracted ray 1239 + // v: normalized direction of the incoming ray 1240 + // n: normalized normal vector of the interface of two optical media 1241 + // r: ratio of the refractive index of the medium from where the ray comes 1242 + // to the refractive index of the medium on the other side of the surface 1243 + RMAPI Vector3 Vector3Refract(Vector3 v, Vector3 n, float r) 1244 + { 1245 + Vector3 result = { 0 }; 1246 + 1247 + float dot = v.x*n.x + v.y*n.y + v.z*n.z; 1248 + float d = 1.0f - r*r*(1.0f - dot*dot); 1249 + 1250 + if (d >= 0.0f) 1251 + { 1252 + d = sqrtf(d); 1253 + v.x = r*v.x - (r*dot + d)*n.x; 1254 + v.y = r*v.y - (r*dot + d)*n.y; 1255 + v.z = r*v.z - (r*dot + d)*n.z; 1256 + 1257 + result = v; 1258 + } 1259 + 1260 + return result; 1261 + } 1262 + 1263 + 1264 + //---------------------------------------------------------------------------------- 1265 + // Module Functions Definition - Vector4 math 1266 + //---------------------------------------------------------------------------------- 1267 + // Get vector zero 1268 + RMAPI Vector4 Vector4Zero(void) 1269 + { 1270 + Vector4 result = { 0.0f, 0.0f, 0.0f, 0.0f }; 1271 + return result; 1272 + } 1273 + 1274 + // Get vector one 1275 + RMAPI Vector4 Vector4One(void) 1276 + { 1277 + Vector4 result = { 1.0f, 1.0f, 1.0f, 1.0f }; 1278 + return result; 1279 + } 1280 + 1281 + // Add two vectors 1282 + RMAPI Vector4 Vector4Add(Vector4 v1, Vector4 v2) 1283 + { 1284 + Vector4 result = { 1285 + v1.x + v2.x, 1286 + v1.y + v2.y, 1287 + v1.z + v2.z, 1288 + v1.w + v2.w 1289 + }; 1290 + return result; 1291 + } 1292 + 1293 + // Add value to vector components 1294 + RMAPI Vector4 Vector4AddValue(Vector4 v, float add) 1295 + { 1296 + Vector4 result = { 1297 + v.x + add, 1298 + v.y + add, 1299 + v.z + add, 1300 + v.w + add 1301 + }; 1302 + return result; 1303 + } 1304 + 1305 + // Substract vectors 1306 + RMAPI Vector4 Vector4Subtract(Vector4 v1, Vector4 v2) 1307 + { 1308 + Vector4 result = { 1309 + v1.x - v2.x, 1310 + v1.y - v2.y, 1311 + v1.z - v2.z, 1312 + v1.w - v2.w 1313 + }; 1314 + return result; 1315 + } 1316 + 1317 + // Substract value from vector components 1318 + RMAPI Vector4 Vector4SubtractValue(Vector4 v, float add) 1319 + { 1320 + Vector4 result = { 1321 + v.x - add, 1322 + v.y - add, 1323 + v.z - add, 1324 + v.w - add 1325 + }; 1326 + return result; 1327 + } 1328 + 1329 + // Vector length 1330 + RMAPI float Vector4Length(Vector4 v) 1331 + { 1332 + float result = sqrtf((v.x*v.x) + (v.y*v.y) + (v.z*v.z) + (v.w*v.w)); 1333 + return result; 1334 + } 1335 + 1336 + // Vector square length 1337 + RMAPI float Vector4LengthSqr(Vector4 v) 1338 + { 1339 + float result = (v.x*v.x) + (v.y*v.y) + (v.z*v.z) + (v.w*v.w); 1340 + return result; 1341 + } 1342 + 1343 + // Vectors dot product 1344 + RMAPI float Vector4DotProduct(Vector4 v1, Vector4 v2) 1345 + { 1346 + float result = (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z + v1.w*v2.w); 1347 + return result; 1348 + } 1349 + 1350 + // Calculate distance between two vectors 1351 + RMAPI float Vector4Distance(Vector4 v1, Vector4 v2) 1352 + { 1353 + float result = sqrtf( 1354 + (v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y) + 1355 + (v1.z - v2.z)*(v1.z - v2.z) + (v1.w - v2.w)*(v1.w - v2.w)); 1356 + return result; 1357 + } 1358 + 1359 + // Calculate square distance between two vectors 1360 + RMAPI float Vector4DistanceSqr(Vector4 v1, Vector4 v2) 1361 + { 1362 + float result = 1363 + (v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y) + 1364 + (v1.z - v2.z)*(v1.z - v2.z) + (v1.w - v2.w)*(v1.w - v2.w); 1365 + 1366 + return result; 1367 + } 1368 + 1369 + // Scale vector components by value (multiply) 1370 + RMAPI Vector4 Vector4Scale(Vector4 v, float scale) 1371 + { 1372 + Vector4 result = { v.x*scale, v.y*scale, v.z*scale, v.w*scale }; 1373 + return result; 1374 + } 1375 + 1376 + // Multiply vector by vector 1377 + RMAPI Vector4 Vector4Multiply(Vector4 v1, Vector4 v2) 1378 + { 1379 + Vector4 result = { v1.x*v2.x, v1.y*v2.y, v1.z*v2.z, v1.w*v2.w }; 1380 + return result; 1381 + } 1382 + 1383 + // Negate vector 1384 + RMAPI Vector4 Vector4Negate(Vector4 v) 1385 + { 1386 + Vector4 result = { -v.x, -v.y, -v.z, -v.w }; 1387 + return result; 1388 + } 1389 + 1390 + // Divide vector by vector 1391 + RMAPI Vector4 Vector4Divide(Vector4 v1, Vector4 v2) 1392 + { 1393 + Vector4 result = { v1.x/v2.x, v1.y/v2.y, v1.z/v2.z, v1.w/v2.w }; 1394 + return result; 1395 + } 1396 + 1397 + // Normalize provided vector 1398 + RMAPI Vector4 Vector4Normalize(Vector4 v) 1399 + { 1400 + Vector4 result = { 0 }; 1401 + float length = sqrtf((v.x*v.x) + (v.y*v.y) + (v.z*v.z) + (v.w*v.w)); 1402 + 1403 + if (length > 0) 1404 + { 1405 + float ilength = 1.0f/length; 1406 + result.x = v.x*ilength; 1407 + result.y = v.y*ilength; 1408 + result.z = v.z*ilength; 1409 + result.w = v.w*ilength; 1410 + } 1411 + 1412 + return result; 1413 + } 1414 + 1415 + // Get min value for each pair of components 1416 + RMAPI Vector4 Vector4Min(Vector4 v1, Vector4 v2) 1417 + { 1418 + Vector4 result = { 0 }; 1419 + 1420 + result.x = fminf(v1.x, v2.x); 1421 + result.y = fminf(v1.y, v2.y); 1422 + result.z = fminf(v1.z, v2.z); 1423 + result.w = fminf(v1.w, v2.w); 1424 + 1425 + return result; 1426 + } 1427 + 1428 + // Get max value for each pair of components 1429 + RMAPI Vector4 Vector4Max(Vector4 v1, Vector4 v2) 1430 + { 1431 + Vector4 result = { 0 }; 1432 + 1433 + result.x = fmaxf(v1.x, v2.x); 1434 + result.y = fmaxf(v1.y, v2.y); 1435 + result.z = fmaxf(v1.z, v2.z); 1436 + result.w = fmaxf(v1.w, v2.w); 1437 + 1438 + return result; 1439 + } 1440 + 1441 + // Calculate linear interpolation between two vectors 1442 + RMAPI Vector4 Vector4Lerp(Vector4 v1, Vector4 v2, float amount) 1443 + { 1444 + Vector4 result = { 0 }; 1445 + 1446 + result.x = v1.x + amount*(v2.x - v1.x); 1447 + result.y = v1.y + amount*(v2.y - v1.y); 1448 + result.z = v1.z + amount*(v2.z - v1.z); 1449 + result.w = v1.w + amount*(v2.w - v1.w); 1450 + 1451 + return result; 1452 + } 1453 + 1454 + // Move Vector towards target 1455 + RMAPI Vector4 Vector4MoveTowards(Vector4 v, Vector4 target, float maxDistance) 1456 + { 1457 + Vector4 result = { 0 }; 1458 + 1459 + float dx = target.x - v.x; 1460 + float dy = target.y - v.y; 1461 + float dz = target.z - v.z; 1462 + float dw = target.w - v.w; 1463 + float value = (dx*dx) + (dy*dy) + (dz*dz) + (dw*dw); 1464 + 1465 + if ((value == 0) || ((maxDistance >= 0) && (value <= maxDistance*maxDistance))) return target; 1466 + 1467 + float dist = sqrtf(value); 1468 + 1469 + result.x = v.x + dx/dist*maxDistance; 1470 + result.y = v.y + dy/dist*maxDistance; 1471 + result.z = v.z + dz/dist*maxDistance; 1472 + result.w = v.w + dw/dist*maxDistance; 1473 + 1474 + return result; 1475 + } 1476 + 1477 + // Invert the given vector 1478 + RMAPI Vector4 Vector4Invert(Vector4 v) 1479 + { 1480 + Vector4 result = { 1.0f/v.x, 1.0f/v.y, 1.0f/v.z, 1.0f/v.w }; 1481 + return result; 1482 + } 1483 + 1484 + // Check whether two given vectors are almost equal 1485 + RMAPI int Vector4Equals(Vector4 p, Vector4 q) 1486 + { 1487 + #if !defined(EPSILON) 1488 + #define EPSILON 0.000001f 1489 + #endif 1490 + 1491 + int result = ((fabsf(p.x - q.x)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) && 1492 + ((fabsf(p.y - q.y)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y))))) && 1493 + ((fabsf(p.z - q.z)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z))))) && 1494 + ((fabsf(p.w - q.w)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.w), fabsf(q.w))))); 1495 + return result; 1496 + } 1497 + 1498 + 1499 + //---------------------------------------------------------------------------------- 1500 + // Module Functions Definition - Matrix math 1501 + //---------------------------------------------------------------------------------- 1502 + 1503 + // Compute matrix determinant 1504 + RMAPI float MatrixDeterminant(Matrix mat) 1505 + { 1506 + float result = 0.0f; 1507 + /* 1508 + // Cache the matrix values (speed optimization) 1509 + float a00 = mat.m0, a01 = mat.m1, a02 = mat.m2, a03 = mat.m3; 1510 + float a10 = mat.m4, a11 = mat.m5, a12 = mat.m6, a13 = mat.m7; 1511 + float a20 = mat.m8, a21 = mat.m9, a22 = mat.m10, a23 = mat.m11; 1512 + float a30 = mat.m12, a31 = mat.m13, a32 = mat.m14, a33 = mat.m15; 1513 + 1514 + // NOTE: It takes 72 multiplication to calculate 4x4 matrix determinant 1515 + result = a30*a21*a12*a03 - a20*a31*a12*a03 - a30*a11*a22*a03 + a10*a31*a22*a03 + 1516 + a20*a11*a32*a03 - a10*a21*a32*a03 - a30*a21*a02*a13 + a20*a31*a02*a13 + 1517 + a30*a01*a22*a13 - a00*a31*a22*a13 - a20*a01*a32*a13 + a00*a21*a32*a13 + 1518 + a30*a11*a02*a23 - a10*a31*a02*a23 - a30*a01*a12*a23 + a00*a31*a12*a23 + 1519 + a10*a01*a32*a23 - a00*a11*a32*a23 - a20*a11*a02*a33 + a10*a21*a02*a33 + 1520 + a20*a01*a12*a33 - a00*a21*a12*a33 - a10*a01*a22*a33 + a00*a11*a22*a33; 1521 + */ 1522 + // Using Laplace expansion (https://en.wikipedia.org/wiki/Laplace_expansion), 1523 + // previous operation can be simplified to 40 multiplications, decreasing matrix 1524 + // size from 4x4 to 2x2 using minors 1525 + 1526 + // Cache the matrix values (speed optimization) 1527 + float m0 = mat.m0, m1 = mat.m1, m2 = mat.m2, m3 = mat.m3; 1528 + float m4 = mat.m4, m5 = mat.m5, m6 = mat.m6, m7 = mat.m7; 1529 + float m8 = mat.m8, m9 = mat.m9, m10 = mat.m10, m11 = mat.m11; 1530 + float m12 = mat.m12, m13 = mat.m13, m14 = mat.m14, m15 = mat.m15; 1531 + 1532 + result = (m0*((m5*(m10*m15 - m11*m14) - m9*(m6*m15 - m7*m14) + m13*(m6*m11 - m7*m10))) - 1533 + m4*((m1*(m10*m15 - m11*m14) - m9*(m2*m15 - m3*m14) + m13*(m2*m11 - m3*m10))) + 1534 + m8*((m1*(m6*m15 - m7*m14) - m5*(m2*m15 - m3*m14) + m13*(m2*m7 - m3*m6))) - 1535 + m12*((m1*(m6*m11 - m7*m10) - m5*(m2*m11 - m3*m10) + m9*(m2*m7 - m3*m6)))); 1536 + 1537 + return result; 1538 + } 1539 + 1540 + // Get the trace of the matrix (sum of the values along the diagonal) 1541 + RMAPI float MatrixTrace(Matrix mat) 1542 + { 1543 + float result = (mat.m0 + mat.m5 + mat.m10 + mat.m15); 1544 + 1545 + return result; 1546 + } 1547 + 1548 + // Transposes provided matrix 1549 + RMAPI Matrix MatrixTranspose(Matrix mat) 1550 + { 1551 + Matrix result = { 0 }; 1552 + 1553 + result.m0 = mat.m0; 1554 + result.m1 = mat.m4; 1555 + result.m2 = mat.m8; 1556 + result.m3 = mat.m12; 1557 + result.m4 = mat.m1; 1558 + result.m5 = mat.m5; 1559 + result.m6 = mat.m9; 1560 + result.m7 = mat.m13; 1561 + result.m8 = mat.m2; 1562 + result.m9 = mat.m6; 1563 + result.m10 = mat.m10; 1564 + result.m11 = mat.m14; 1565 + result.m12 = mat.m3; 1566 + result.m13 = mat.m7; 1567 + result.m14 = mat.m11; 1568 + result.m15 = mat.m15; 1569 + 1570 + return result; 1571 + } 1572 + 1573 + // Invert provided matrix 1574 + RMAPI Matrix MatrixInvert(Matrix mat) 1575 + { 1576 + Matrix result = { 0 }; 1577 + 1578 + // Cache the matrix values (speed optimization) 1579 + float a00 = mat.m0, a01 = mat.m1, a02 = mat.m2, a03 = mat.m3; 1580 + float a10 = mat.m4, a11 = mat.m5, a12 = mat.m6, a13 = mat.m7; 1581 + float a20 = mat.m8, a21 = mat.m9, a22 = mat.m10, a23 = mat.m11; 1582 + float a30 = mat.m12, a31 = mat.m13, a32 = mat.m14, a33 = mat.m15; 1583 + 1584 + float b00 = a00*a11 - a01*a10; 1585 + float b01 = a00*a12 - a02*a10; 1586 + float b02 = a00*a13 - a03*a10; 1587 + float b03 = a01*a12 - a02*a11; 1588 + float b04 = a01*a13 - a03*a11; 1589 + float b05 = a02*a13 - a03*a12; 1590 + float b06 = a20*a31 - a21*a30; 1591 + float b07 = a20*a32 - a22*a30; 1592 + float b08 = a20*a33 - a23*a30; 1593 + float b09 = a21*a32 - a22*a31; 1594 + float b10 = a21*a33 - a23*a31; 1595 + float b11 = a22*a33 - a23*a32; 1596 + 1597 + // Calculate the invert determinant (inlined to avoid double-caching) 1598 + float invDet = 1.0f/(b00*b11 - b01*b10 + b02*b09 + b03*b08 - b04*b07 + b05*b06); 1599 + 1600 + result.m0 = (a11*b11 - a12*b10 + a13*b09)*invDet; 1601 + result.m1 = (-a01*b11 + a02*b10 - a03*b09)*invDet; 1602 + result.m2 = (a31*b05 - a32*b04 + a33*b03)*invDet; 1603 + result.m3 = (-a21*b05 + a22*b04 - a23*b03)*invDet; 1604 + result.m4 = (-a10*b11 + a12*b08 - a13*b07)*invDet; 1605 + result.m5 = (a00*b11 - a02*b08 + a03*b07)*invDet; 1606 + result.m6 = (-a30*b05 + a32*b02 - a33*b01)*invDet; 1607 + result.m7 = (a20*b05 - a22*b02 + a23*b01)*invDet; 1608 + result.m8 = (a10*b10 - a11*b08 + a13*b06)*invDet; 1609 + result.m9 = (-a00*b10 + a01*b08 - a03*b06)*invDet; 1610 + result.m10 = (a30*b04 - a31*b02 + a33*b00)*invDet; 1611 + result.m11 = (-a20*b04 + a21*b02 - a23*b00)*invDet; 1612 + result.m12 = (-a10*b09 + a11*b07 - a12*b06)*invDet; 1613 + result.m13 = (a00*b09 - a01*b07 + a02*b06)*invDet; 1614 + result.m14 = (-a30*b03 + a31*b01 - a32*b00)*invDet; 1615 + result.m15 = (a20*b03 - a21*b01 + a22*b00)*invDet; 1616 + 1617 + return result; 1618 + } 1619 + 1620 + // Get identity matrix 1621 + RMAPI Matrix MatrixIdentity(void) 1622 + { 1623 + Matrix result = { 1.0f, 0.0f, 0.0f, 0.0f, 1624 + 0.0f, 1.0f, 0.0f, 0.0f, 1625 + 0.0f, 0.0f, 1.0f, 0.0f, 1626 + 0.0f, 0.0f, 0.0f, 1.0f }; 1627 + 1628 + return result; 1629 + } 1630 + 1631 + // Add two matrices 1632 + RMAPI Matrix MatrixAdd(Matrix left, Matrix right) 1633 + { 1634 + Matrix result = { 0 }; 1635 + 1636 + result.m0 = left.m0 + right.m0; 1637 + result.m1 = left.m1 + right.m1; 1638 + result.m2 = left.m2 + right.m2; 1639 + result.m3 = left.m3 + right.m3; 1640 + result.m4 = left.m4 + right.m4; 1641 + result.m5 = left.m5 + right.m5; 1642 + result.m6 = left.m6 + right.m6; 1643 + result.m7 = left.m7 + right.m7; 1644 + result.m8 = left.m8 + right.m8; 1645 + result.m9 = left.m9 + right.m9; 1646 + result.m10 = left.m10 + right.m10; 1647 + result.m11 = left.m11 + right.m11; 1648 + result.m12 = left.m12 + right.m12; 1649 + result.m13 = left.m13 + right.m13; 1650 + result.m14 = left.m14 + right.m14; 1651 + result.m15 = left.m15 + right.m15; 1652 + 1653 + return result; 1654 + } 1655 + 1656 + // Subtract two matrices (left - right) 1657 + RMAPI Matrix MatrixSubtract(Matrix left, Matrix right) 1658 + { 1659 + Matrix result = { 0 }; 1660 + 1661 + result.m0 = left.m0 - right.m0; 1662 + result.m1 = left.m1 - right.m1; 1663 + result.m2 = left.m2 - right.m2; 1664 + result.m3 = left.m3 - right.m3; 1665 + result.m4 = left.m4 - right.m4; 1666 + result.m5 = left.m5 - right.m5; 1667 + result.m6 = left.m6 - right.m6; 1668 + result.m7 = left.m7 - right.m7; 1669 + result.m8 = left.m8 - right.m8; 1670 + result.m9 = left.m9 - right.m9; 1671 + result.m10 = left.m10 - right.m10; 1672 + result.m11 = left.m11 - right.m11; 1673 + result.m12 = left.m12 - right.m12; 1674 + result.m13 = left.m13 - right.m13; 1675 + result.m14 = left.m14 - right.m14; 1676 + result.m15 = left.m15 - right.m15; 1677 + 1678 + return result; 1679 + } 1680 + 1681 + // Get two matrix multiplication 1682 + // NOTE: When multiplying matrices... the order matters! 1683 + RMAPI Matrix MatrixMultiply(Matrix left, Matrix right) 1684 + { 1685 + Matrix result = { 0 }; 1686 + 1687 + #if defined(RAYMATH_SSE_ENABLED) 1688 + // Load left side and right side 1689 + __m128 c0 = _mm_set_ps(right.m12, right.m8, right.m4, right.m0); 1690 + __m128 c1 = _mm_set_ps(right.m13, right.m9, right.m5, right.m1); 1691 + __m128 c2 = _mm_set_ps(right.m14, right.m10, right.m6, right.m2); 1692 + __m128 c3 = _mm_set_ps(right.m15, right.m11, right.m7, right.m3); 1693 + 1694 + // Transpose so c0..c3 become *rows* of the right matrix in semantic order 1695 + _MM_TRANSPOSE4_PS(c0, c1, c2, c3); 1696 + 1697 + float tmp[4] = { 0 }; 1698 + __m128 row; 1699 + 1700 + // Row 0 of result: [m0, m1, m2, m3] 1701 + row = _mm_mul_ps(_mm_set1_ps(left.m0), c0); 1702 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m1), c1)); 1703 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m2), c2)); 1704 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m3), c3)); 1705 + _mm_storeu_ps(tmp, row); 1706 + result.m0 = tmp[0]; 1707 + result.m1 = tmp[1]; 1708 + result.m2 = tmp[2]; 1709 + result.m3 = tmp[3]; 1710 + 1711 + // Row 1 of result: [m4, m5, m6, m7] 1712 + row = _mm_mul_ps(_mm_set1_ps(left.m4), c0); 1713 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m5), c1)); 1714 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m6), c2)); 1715 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m7), c3)); 1716 + _mm_storeu_ps(tmp, row); 1717 + result.m4 = tmp[0]; 1718 + result.m5 = tmp[1]; 1719 + result.m6 = tmp[2]; 1720 + result.m7 = tmp[3]; 1721 + 1722 + // Row 2 of result: [m8, m9, m10, m11] 1723 + row = _mm_mul_ps(_mm_set1_ps(left.m8), c0); 1724 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m9), c1)); 1725 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m10), c2)); 1726 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m11), c3)); 1727 + _mm_storeu_ps(tmp, row); 1728 + result.m8 = tmp[0]; 1729 + result.m9 = tmp[1]; 1730 + result.m10 = tmp[2]; 1731 + result.m11 = tmp[3]; 1732 + 1733 + // Row 3 of result: [m12, m13, m14, m15] 1734 + row = _mm_mul_ps(_mm_set1_ps(left.m12), c0); 1735 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m13), c1)); 1736 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m14), c2)); 1737 + row = _mm_add_ps(row, _mm_mul_ps(_mm_set1_ps(left.m15), c3)); 1738 + _mm_storeu_ps(tmp, row); 1739 + result.m12 = tmp[0]; 1740 + result.m13 = tmp[1]; 1741 + result.m14 = tmp[2]; 1742 + result.m15 = tmp[3]; 1743 + #else 1744 + result.m0 = left.m0*right.m0 + left.m1*right.m4 + left.m2*right.m8 + left.m3*right.m12; 1745 + result.m1 = left.m0*right.m1 + left.m1*right.m5 + left.m2*right.m9 + left.m3*right.m13; 1746 + result.m2 = left.m0*right.m2 + left.m1*right.m6 + left.m2*right.m10 + left.m3*right.m14; 1747 + result.m3 = left.m0*right.m3 + left.m1*right.m7 + left.m2*right.m11 + left.m3*right.m15; 1748 + result.m4 = left.m4*right.m0 + left.m5*right.m4 + left.m6*right.m8 + left.m7*right.m12; 1749 + result.m5 = left.m4*right.m1 + left.m5*right.m5 + left.m6*right.m9 + left.m7*right.m13; 1750 + result.m6 = left.m4*right.m2 + left.m5*right.m6 + left.m6*right.m10 + left.m7*right.m14; 1751 + result.m7 = left.m4*right.m3 + left.m5*right.m7 + left.m6*right.m11 + left.m7*right.m15; 1752 + result.m8 = left.m8*right.m0 + left.m9*right.m4 + left.m10*right.m8 + left.m11*right.m12; 1753 + result.m9 = left.m8*right.m1 + left.m9*right.m5 + left.m10*right.m9 + left.m11*right.m13; 1754 + result.m10 = left.m8*right.m2 + left.m9*right.m6 + left.m10*right.m10 + left.m11*right.m14; 1755 + result.m11 = left.m8*right.m3 + left.m9*right.m7 + left.m10*right.m11 + left.m11*right.m15; 1756 + result.m12 = left.m12*right.m0 + left.m13*right.m4 + left.m14*right.m8 + left.m15*right.m12; 1757 + result.m13 = left.m12*right.m1 + left.m13*right.m5 + left.m14*right.m9 + left.m15*right.m13; 1758 + result.m14 = left.m12*right.m2 + left.m13*right.m6 + left.m14*right.m10 + left.m15*right.m14; 1759 + result.m15 = left.m12*right.m3 + left.m13*right.m7 + left.m14*right.m11 + left.m15*right.m15; 1760 + #endif 1761 + 1762 + return result; 1763 + } 1764 + 1765 + // Multiply matrix components by value 1766 + RMAPI Matrix MatrixMultiplyValue(Matrix left, float value) 1767 + { 1768 + Matrix result = { 1769 + left.m0*value, left.m4*value, left.m8*value, left.m12*value, 1770 + left.m1*value, left.m5*value, left.m9*value, left.m13*value, 1771 + left.m2*value, left.m6*value, left.m10*value, left.m14*value, 1772 + left.m3*value, left.m7*value, left.m11*value, left.m15*value 1773 + }; 1774 + 1775 + return result; 1776 + } 1777 + 1778 + // Get translation matrix 1779 + RMAPI Matrix MatrixTranslate(float x, float y, float z) 1780 + { 1781 + Matrix result = { 1.0f, 0.0f, 0.0f, x, 1782 + 0.0f, 1.0f, 0.0f, y, 1783 + 0.0f, 0.0f, 1.0f, z, 1784 + 0.0f, 0.0f, 0.0f, 1.0f }; 1785 + 1786 + return result; 1787 + } 1788 + 1789 + // Create rotation matrix from axis and angle 1790 + // NOTE: Angle should be provided in radians 1791 + RMAPI Matrix MatrixRotate(Vector3 axis, float angle) 1792 + { 1793 + Matrix result = { 0 }; 1794 + 1795 + float x = axis.x, y = axis.y, z = axis.z; 1796 + 1797 + float lengthSquared = x*x + y*y + z*z; 1798 + 1799 + if ((lengthSquared != 1.0f) && (lengthSquared != 0.0f)) 1800 + { 1801 + float ilength = 1.0f/sqrtf(lengthSquared); 1802 + x *= ilength; 1803 + y *= ilength; 1804 + z *= ilength; 1805 + } 1806 + 1807 + float sinres = sinf(angle); 1808 + float cosres = cosf(angle); 1809 + float t = 1.0f - cosres; 1810 + 1811 + result.m0 = x*x*t + cosres; 1812 + result.m1 = y*x*t + z*sinres; 1813 + result.m2 = z*x*t - y*sinres; 1814 + result.m3 = 0.0f; 1815 + 1816 + result.m4 = x*y*t - z*sinres; 1817 + result.m5 = y*y*t + cosres; 1818 + result.m6 = z*y*t + x*sinres; 1819 + result.m7 = 0.0f; 1820 + 1821 + result.m8 = x*z*t + y*sinres; 1822 + result.m9 = y*z*t - x*sinres; 1823 + result.m10 = z*z*t + cosres; 1824 + result.m11 = 0.0f; 1825 + 1826 + result.m12 = 0.0f; 1827 + result.m13 = 0.0f; 1828 + result.m14 = 0.0f; 1829 + result.m15 = 1.0f; 1830 + 1831 + return result; 1832 + } 1833 + 1834 + // Get x-rotation matrix 1835 + // NOTE: Angle must be provided in radians 1836 + RMAPI Matrix MatrixRotateX(float angle) 1837 + { 1838 + Matrix result = { 1.0f, 0.0f, 0.0f, 0.0f, 1839 + 0.0f, 1.0f, 0.0f, 0.0f, 1840 + 0.0f, 0.0f, 1.0f, 0.0f, 1841 + 0.0f, 0.0f, 0.0f, 1.0f }; // MatrixIdentity() 1842 + 1843 + float cosres = cosf(angle); 1844 + float sinres = sinf(angle); 1845 + 1846 + result.m5 = cosres; 1847 + result.m6 = sinres; 1848 + result.m9 = -sinres; 1849 + result.m10 = cosres; 1850 + 1851 + return result; 1852 + } 1853 + 1854 + // Get y-rotation matrix 1855 + // NOTE: Angle must be provided in radians 1856 + RMAPI Matrix MatrixRotateY(float angle) 1857 + { 1858 + Matrix result = { 1.0f, 0.0f, 0.0f, 0.0f, 1859 + 0.0f, 1.0f, 0.0f, 0.0f, 1860 + 0.0f, 0.0f, 1.0f, 0.0f, 1861 + 0.0f, 0.0f, 0.0f, 1.0f }; // MatrixIdentity() 1862 + 1863 + float cosres = cosf(angle); 1864 + float sinres = sinf(angle); 1865 + 1866 + result.m0 = cosres; 1867 + result.m2 = -sinres; 1868 + result.m8 = sinres; 1869 + result.m10 = cosres; 1870 + 1871 + return result; 1872 + } 1873 + 1874 + // Get z-rotation matrix 1875 + // NOTE: Angle must be provided in radians 1876 + RMAPI Matrix MatrixRotateZ(float angle) 1877 + { 1878 + Matrix result = { 1.0f, 0.0f, 0.0f, 0.0f, 1879 + 0.0f, 1.0f, 0.0f, 0.0f, 1880 + 0.0f, 0.0f, 1.0f, 0.0f, 1881 + 0.0f, 0.0f, 0.0f, 1.0f }; // MatrixIdentity() 1882 + 1883 + float cosres = cosf(angle); 1884 + float sinres = sinf(angle); 1885 + 1886 + result.m0 = cosres; 1887 + result.m1 = sinres; 1888 + result.m4 = -sinres; 1889 + result.m5 = cosres; 1890 + 1891 + return result; 1892 + } 1893 + 1894 + 1895 + // Get xyz-rotation matrix 1896 + // NOTE: Angle must be provided in radians 1897 + RMAPI Matrix MatrixRotateXYZ(Vector3 angle) 1898 + { 1899 + Matrix result = { 1.0f, 0.0f, 0.0f, 0.0f, 1900 + 0.0f, 1.0f, 0.0f, 0.0f, 1901 + 0.0f, 0.0f, 1.0f, 0.0f, 1902 + 0.0f, 0.0f, 0.0f, 1.0f }; // MatrixIdentity() 1903 + 1904 + float cosz = cosf(-angle.z); 1905 + float sinz = sinf(-angle.z); 1906 + float cosy = cosf(-angle.y); 1907 + float siny = sinf(-angle.y); 1908 + float cosx = cosf(-angle.x); 1909 + float sinx = sinf(-angle.x); 1910 + 1911 + result.m0 = cosz*cosy; 1912 + result.m1 = (cosz*siny*sinx) - (sinz*cosx); 1913 + result.m2 = (cosz*siny*cosx) + (sinz*sinx); 1914 + 1915 + result.m4 = sinz*cosy; 1916 + result.m5 = (sinz*siny*sinx) + (cosz*cosx); 1917 + result.m6 = (sinz*siny*cosx) - (cosz*sinx); 1918 + 1919 + result.m8 = -siny; 1920 + result.m9 = cosy*sinx; 1921 + result.m10= cosy*cosx; 1922 + 1923 + return result; 1924 + } 1925 + 1926 + // Get zyx-rotation matrix 1927 + // NOTE: Angle must be provided in radians 1928 + RMAPI Matrix MatrixRotateZYX(Vector3 angle) 1929 + { 1930 + Matrix result = { 0 }; 1931 + 1932 + float cz = cosf(angle.z); 1933 + float sz = sinf(angle.z); 1934 + float cy = cosf(angle.y); 1935 + float sy = sinf(angle.y); 1936 + float cx = cosf(angle.x); 1937 + float sx = sinf(angle.x); 1938 + 1939 + result.m0 = cz*cy; 1940 + result.m4 = cz*sy*sx - cx*sz; 1941 + result.m8 = sz*sx + cz*cx*sy; 1942 + result.m12 = 0; 1943 + 1944 + result.m1 = cy*sz; 1945 + result.m5 = cz*cx + sz*sy*sx; 1946 + result.m9 = cx*sz*sy - cz*sx; 1947 + result.m13 = 0; 1948 + 1949 + result.m2 = -sy; 1950 + result.m6 = cy*sx; 1951 + result.m10 = cy*cx; 1952 + result.m14 = 0; 1953 + 1954 + result.m3 = 0; 1955 + result.m7 = 0; 1956 + result.m11 = 0; 1957 + result.m15 = 1; 1958 + 1959 + return result; 1960 + } 1961 + 1962 + // Get scaling matrix 1963 + RMAPI Matrix MatrixScale(float x, float y, float z) 1964 + { 1965 + Matrix result = { x, 0.0f, 0.0f, 0.0f, 1966 + 0.0f, y, 0.0f, 0.0f, 1967 + 0.0f, 0.0f, z, 0.0f, 1968 + 0.0f, 0.0f, 0.0f, 1.0f }; 1969 + 1970 + return result; 1971 + } 1972 + 1973 + // Get perspective projection matrix 1974 + RMAPI Matrix MatrixFrustum(double left, double right, double bottom, double top, double nearPlane, double farPlane) 1975 + { 1976 + Matrix result = { 0 }; 1977 + 1978 + float rl = (float)(right - left); 1979 + float tb = (float)(top - bottom); 1980 + float fn = (float)(farPlane - nearPlane); 1981 + 1982 + result.m0 = ((float)nearPlane*2.0f)/rl; 1983 + result.m1 = 0.0f; 1984 + result.m2 = 0.0f; 1985 + result.m3 = 0.0f; 1986 + 1987 + result.m4 = 0.0f; 1988 + result.m5 = ((float)nearPlane*2.0f)/tb; 1989 + result.m6 = 0.0f; 1990 + result.m7 = 0.0f; 1991 + 1992 + result.m8 = ((float)right + (float)left)/rl; 1993 + result.m9 = ((float)top + (float)bottom)/tb; 1994 + result.m10 = -((float)farPlane + (float)nearPlane)/fn; 1995 + result.m11 = -1.0f; 1996 + 1997 + result.m12 = 0.0f; 1998 + result.m13 = 0.0f; 1999 + result.m14 = -((float)farPlane*(float)nearPlane*2.0f)/fn; 2000 + result.m15 = 0.0f; 2001 + 2002 + return result; 2003 + } 2004 + 2005 + // Get perspective projection matrix 2006 + // NOTE: Fovy angle must be provided in radians 2007 + RMAPI Matrix MatrixPerspective(double fovY, double aspect, double nearPlane, double farPlane) 2008 + { 2009 + Matrix result = { 0 }; 2010 + 2011 + double top = nearPlane*tan(fovY*0.5); 2012 + double bottom = -top; 2013 + double right = top*aspect; 2014 + double left = -right; 2015 + 2016 + // MatrixFrustum(-right, right, -top, top, near, far); 2017 + float rl = (float)(right - left); 2018 + float tb = (float)(top - bottom); 2019 + float fn = (float)(farPlane - nearPlane); 2020 + 2021 + result.m0 = ((float)nearPlane*2.0f)/rl; 2022 + result.m5 = ((float)nearPlane*2.0f)/tb; 2023 + result.m8 = ((float)right + (float)left)/rl; 2024 + result.m9 = ((float)top + (float)bottom)/tb; 2025 + result.m10 = -((float)farPlane + (float)nearPlane)/fn; 2026 + result.m11 = -1.0f; 2027 + result.m14 = -((float)farPlane*(float)nearPlane*2.0f)/fn; 2028 + 2029 + return result; 2030 + } 2031 + 2032 + // Get orthographic projection matrix 2033 + RMAPI Matrix MatrixOrtho(double left, double right, double bottom, double top, double nearPlane, double farPlane) 2034 + { 2035 + Matrix result = { 0 }; 2036 + 2037 + float rl = (float)(right - left); 2038 + float tb = (float)(top - bottom); 2039 + float fn = (float)(farPlane - nearPlane); 2040 + 2041 + result.m0 = 2.0f/rl; 2042 + result.m1 = 0.0f; 2043 + result.m2 = 0.0f; 2044 + result.m3 = 0.0f; 2045 + result.m4 = 0.0f; 2046 + result.m5 = 2.0f/tb; 2047 + result.m6 = 0.0f; 2048 + result.m7 = 0.0f; 2049 + result.m8 = 0.0f; 2050 + result.m9 = 0.0f; 2051 + result.m10 = -2.0f/fn; 2052 + result.m11 = 0.0f; 2053 + result.m12 = -((float)left + (float)right)/rl; 2054 + result.m13 = -((float)top + (float)bottom)/tb; 2055 + result.m14 = -((float)farPlane + (float)nearPlane)/fn; 2056 + result.m15 = 1.0f; 2057 + 2058 + return result; 2059 + } 2060 + 2061 + // Get camera look-at matrix (view matrix) 2062 + RMAPI Matrix MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up) 2063 + { 2064 + Matrix result = { 0 }; 2065 + 2066 + float length = 0.0f; 2067 + float ilength = 0.0f; 2068 + 2069 + // Vector3Subtract(eye, target) 2070 + Vector3 vz = { eye.x - target.x, eye.y - target.y, eye.z - target.z }; 2071 + 2072 + // Vector3Normalize(vz) 2073 + Vector3 v = vz; 2074 + length = sqrtf(v.x*v.x + v.y*v.y + v.z*v.z); 2075 + if (length == 0.0f) length = 1.0f; 2076 + ilength = 1.0f/length; 2077 + vz.x *= ilength; 2078 + vz.y *= ilength; 2079 + vz.z *= ilength; 2080 + 2081 + // Vector3CrossProduct(up, vz) 2082 + Vector3 vx = { up.y*vz.z - up.z*vz.y, up.z*vz.x - up.x*vz.z, up.x*vz.y - up.y*vz.x }; 2083 + 2084 + // Vector3Normalize(x) 2085 + v = vx; 2086 + length = sqrtf(v.x*v.x + v.y*v.y + v.z*v.z); 2087 + if (length == 0.0f) length = 1.0f; 2088 + ilength = 1.0f/length; 2089 + vx.x *= ilength; 2090 + vx.y *= ilength; 2091 + vx.z *= ilength; 2092 + 2093 + // Vector3CrossProduct(vz, vx) 2094 + Vector3 vy = { vz.y*vx.z - vz.z*vx.y, vz.z*vx.x - vz.x*vx.z, vz.x*vx.y - vz.y*vx.x }; 2095 + 2096 + result.m0 = vx.x; 2097 + result.m1 = vy.x; 2098 + result.m2 = vz.x; 2099 + result.m3 = 0.0f; 2100 + result.m4 = vx.y; 2101 + result.m5 = vy.y; 2102 + result.m6 = vz.y; 2103 + result.m7 = 0.0f; 2104 + result.m8 = vx.z; 2105 + result.m9 = vy.z; 2106 + result.m10 = vz.z; 2107 + result.m11 = 0.0f; 2108 + result.m12 = -(vx.x*eye.x + vx.y*eye.y + vx.z*eye.z); // Vector3DotProduct(vx, eye) 2109 + result.m13 = -(vy.x*eye.x + vy.y*eye.y + vy.z*eye.z); // Vector3DotProduct(vy, eye) 2110 + result.m14 = -(vz.x*eye.x + vz.y*eye.y + vz.z*eye.z); // Vector3DotProduct(vz, eye) 2111 + result.m15 = 1.0f; 2112 + 2113 + return result; 2114 + } 2115 + 2116 + // Get float array of matrix data 2117 + RMAPI float16 MatrixToFloatV(Matrix mat) 2118 + { 2119 + float16 result = { 0 }; 2120 + 2121 + result.v[0] = mat.m0; 2122 + result.v[1] = mat.m1; 2123 + result.v[2] = mat.m2; 2124 + result.v[3] = mat.m3; 2125 + result.v[4] = mat.m4; 2126 + result.v[5] = mat.m5; 2127 + result.v[6] = mat.m6; 2128 + result.v[7] = mat.m7; 2129 + result.v[8] = mat.m8; 2130 + result.v[9] = mat.m9; 2131 + result.v[10] = mat.m10; 2132 + result.v[11] = mat.m11; 2133 + result.v[12] = mat.m12; 2134 + result.v[13] = mat.m13; 2135 + result.v[14] = mat.m14; 2136 + result.v[15] = mat.m15; 2137 + 2138 + return result; 2139 + } 2140 + 2141 + //---------------------------------------------------------------------------------- 2142 + // Module Functions Definition - Quaternion math 2143 + //---------------------------------------------------------------------------------- 2144 + 2145 + // Add two quaternions 2146 + RMAPI Quaternion QuaternionAdd(Quaternion q1, Quaternion q2) 2147 + { 2148 + Quaternion result = {q1.x + q2.x, q1.y + q2.y, q1.z + q2.z, q1.w + q2.w}; 2149 + 2150 + return result; 2151 + } 2152 + 2153 + // Add quaternion and float value 2154 + RMAPI Quaternion QuaternionAddValue(Quaternion q, float add) 2155 + { 2156 + Quaternion result = {q.x + add, q.y + add, q.z + add, q.w + add}; 2157 + 2158 + return result; 2159 + } 2160 + 2161 + // Subtract two quaternions 2162 + RMAPI Quaternion QuaternionSubtract(Quaternion q1, Quaternion q2) 2163 + { 2164 + Quaternion result = {q1.x - q2.x, q1.y - q2.y, q1.z - q2.z, q1.w - q2.w}; 2165 + 2166 + return result; 2167 + } 2168 + 2169 + // Subtract quaternion and float value 2170 + RMAPI Quaternion QuaternionSubtractValue(Quaternion q, float sub) 2171 + { 2172 + Quaternion result = {q.x - sub, q.y - sub, q.z - sub, q.w - sub}; 2173 + 2174 + return result; 2175 + } 2176 + 2177 + // Get identity quaternion 2178 + RMAPI Quaternion QuaternionIdentity(void) 2179 + { 2180 + Quaternion result = { 0.0f, 0.0f, 0.0f, 1.0f }; 2181 + 2182 + return result; 2183 + } 2184 + 2185 + // Computes the length of a quaternion 2186 + RMAPI float QuaternionLength(Quaternion q) 2187 + { 2188 + float result = sqrtf(q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w); 2189 + 2190 + return result; 2191 + } 2192 + 2193 + // Normalize provided quaternion 2194 + RMAPI Quaternion QuaternionNormalize(Quaternion q) 2195 + { 2196 + Quaternion result = { 0 }; 2197 + 2198 + float length = sqrtf(q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w); 2199 + if (length == 0.0f) length = 1.0f; 2200 + float ilength = 1.0f/length; 2201 + 2202 + result.x = q.x*ilength; 2203 + result.y = q.y*ilength; 2204 + result.z = q.z*ilength; 2205 + result.w = q.w*ilength; 2206 + 2207 + return result; 2208 + } 2209 + 2210 + // Invert provided quaternion 2211 + RMAPI Quaternion QuaternionInvert(Quaternion q) 2212 + { 2213 + Quaternion result = q; 2214 + 2215 + float lengthSq = q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w; 2216 + 2217 + if (lengthSq != 0.0f) 2218 + { 2219 + float invLength = 1.0f/lengthSq; 2220 + 2221 + result.x *= -invLength; 2222 + result.y *= -invLength; 2223 + result.z *= -invLength; 2224 + result.w *= invLength; 2225 + } 2226 + 2227 + return result; 2228 + } 2229 + 2230 + // Calculate two quaternion multiplication 2231 + RMAPI Quaternion QuaternionMultiply(Quaternion q1, Quaternion q2) 2232 + { 2233 + Quaternion result = { 0 }; 2234 + 2235 + float qax = q1.x, qay = q1.y, qaz = q1.z, qaw = q1.w; 2236 + float qbx = q2.x, qby = q2.y, qbz = q2.z, qbw = q2.w; 2237 + 2238 + result.x = qax*qbw + qaw*qbx + qay*qbz - qaz*qby; 2239 + result.y = qay*qbw + qaw*qby + qaz*qbx - qax*qbz; 2240 + result.z = qaz*qbw + qaw*qbz + qax*qby - qay*qbx; 2241 + result.w = qaw*qbw - qax*qbx - qay*qby - qaz*qbz; 2242 + 2243 + return result; 2244 + } 2245 + 2246 + // Scale quaternion by float value 2247 + RMAPI Quaternion QuaternionScale(Quaternion q, float mul) 2248 + { 2249 + Quaternion result = { 0 }; 2250 + 2251 + result.x = q.x*mul; 2252 + result.y = q.y*mul; 2253 + result.z = q.z*mul; 2254 + result.w = q.w*mul; 2255 + 2256 + return result; 2257 + } 2258 + 2259 + // Divide two quaternions 2260 + RMAPI Quaternion QuaternionDivide(Quaternion q1, Quaternion q2) 2261 + { 2262 + Quaternion result = { q1.x/q2.x, q1.y/q2.y, q1.z/q2.z, q1.w/q2.w }; 2263 + 2264 + return result; 2265 + } 2266 + 2267 + // Calculate linear interpolation between two quaternions 2268 + RMAPI Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount) 2269 + { 2270 + Quaternion result = { 0 }; 2271 + 2272 + result.x = q1.x + amount*(q2.x - q1.x); 2273 + result.y = q1.y + amount*(q2.y - q1.y); 2274 + result.z = q1.z + amount*(q2.z - q1.z); 2275 + result.w = q1.w + amount*(q2.w - q1.w); 2276 + 2277 + return result; 2278 + } 2279 + 2280 + // Calculate slerp-optimized interpolation between two quaternions 2281 + RMAPI Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount) 2282 + { 2283 + Quaternion result = { 0 }; 2284 + 2285 + // QuaternionLerp(q1, q2, amount) 2286 + result.x = q1.x + amount*(q2.x - q1.x); 2287 + result.y = q1.y + amount*(q2.y - q1.y); 2288 + result.z = q1.z + amount*(q2.z - q1.z); 2289 + result.w = q1.w + amount*(q2.w - q1.w); 2290 + 2291 + // QuaternionNormalize(q); 2292 + Quaternion q = result; 2293 + float length = sqrtf(q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w); 2294 + if (length == 0.0f) length = 1.0f; 2295 + float ilength = 1.0f/length; 2296 + 2297 + result.x = q.x*ilength; 2298 + result.y = q.y*ilength; 2299 + result.z = q.z*ilength; 2300 + result.w = q.w*ilength; 2301 + 2302 + return result; 2303 + } 2304 + 2305 + // Calculates spherical linear interpolation between two quaternions 2306 + RMAPI Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount) 2307 + { 2308 + Quaternion result = { 0 }; 2309 + 2310 + #if !defined(EPSILON) 2311 + #define EPSILON 0.000001f 2312 + #endif 2313 + 2314 + float cosHalfTheta = q1.x*q2.x + q1.y*q2.y + q1.z*q2.z + q1.w*q2.w; 2315 + 2316 + if (cosHalfTheta < 0) 2317 + { 2318 + q2.x = -q2.x; q2.y = -q2.y; q2.z = -q2.z; q2.w = -q2.w; 2319 + cosHalfTheta = -cosHalfTheta; 2320 + } 2321 + 2322 + if (fabsf(cosHalfTheta) >= 1.0f) result = q1; 2323 + else if (cosHalfTheta > 0.95f) result = QuaternionNlerp(q1, q2, amount); 2324 + else 2325 + { 2326 + float halfTheta = acosf(cosHalfTheta); 2327 + float sinHalfTheta = sqrtf(1.0f - cosHalfTheta*cosHalfTheta); 2328 + 2329 + if (fabsf(sinHalfTheta) < EPSILON) 2330 + { 2331 + result.x = (q1.x*0.5f + q2.x*0.5f); 2332 + result.y = (q1.y*0.5f + q2.y*0.5f); 2333 + result.z = (q1.z*0.5f + q2.z*0.5f); 2334 + result.w = (q1.w*0.5f + q2.w*0.5f); 2335 + } 2336 + else 2337 + { 2338 + float ratioA = sinf((1 - amount)*halfTheta)/sinHalfTheta; 2339 + float ratioB = sinf(amount*halfTheta)/sinHalfTheta; 2340 + 2341 + result.x = (q1.x*ratioA + q2.x*ratioB); 2342 + result.y = (q1.y*ratioA + q2.y*ratioB); 2343 + result.z = (q1.z*ratioA + q2.z*ratioB); 2344 + result.w = (q1.w*ratioA + q2.w*ratioB); 2345 + } 2346 + } 2347 + 2348 + return result; 2349 + } 2350 + 2351 + // Calculate quaternion cubic spline interpolation using Cubic Hermite Spline algorithm 2352 + // as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic 2353 + RMAPI Quaternion QuaternionCubicHermiteSpline(Quaternion q1, Quaternion outTangent1, Quaternion q2, Quaternion inTangent2, float t) 2354 + { 2355 + float t2 = t*t; 2356 + float t3 = t2*t; 2357 + float h00 = 2*t3 - 3*t2 + 1; 2358 + float h10 = t3 - 2*t2 + t; 2359 + float h01 = -2*t3 + 3*t2; 2360 + float h11 = t3 - t2; 2361 + 2362 + Quaternion p0 = QuaternionScale(q1, h00); 2363 + Quaternion m0 = QuaternionScale(outTangent1, h10); 2364 + Quaternion p1 = QuaternionScale(q2, h01); 2365 + Quaternion m1 = QuaternionScale(inTangent2, h11); 2366 + 2367 + Quaternion result = { 0 }; 2368 + 2369 + result = QuaternionAdd(p0, m0); 2370 + result = QuaternionAdd(result, p1); 2371 + result = QuaternionAdd(result, m1); 2372 + result = QuaternionNormalize(result); 2373 + 2374 + return result; 2375 + } 2376 + 2377 + // Calculate quaternion based on the rotation from one vector to another 2378 + RMAPI Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to) 2379 + { 2380 + Quaternion result = { 0 }; 2381 + 2382 + float cos2Theta = (from.x*to.x + from.y*to.y + from.z*to.z); // Vector3DotProduct(from, to) 2383 + Vector3 cross = { from.y*to.z - from.z*to.y, from.z*to.x - from.x*to.z, from.x*to.y - from.y*to.x }; // Vector3CrossProduct(from, to) 2384 + 2385 + result.x = cross.x; 2386 + result.y = cross.y; 2387 + result.z = cross.z; 2388 + result.w = sqrtf(cross.x*cross.x + cross.y*cross.y + cross.z*cross.z + cos2Theta*cos2Theta) + cos2Theta; 2389 + 2390 + // QuaternionNormalize(q); 2391 + // NOTE: Normalize to essentially nlerp the original and identity to 0.5 2392 + Quaternion q = result; 2393 + float length = sqrtf(q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w); 2394 + if (length == 0.0f) length = 1.0f; 2395 + float ilength = 1.0f/length; 2396 + 2397 + result.x = q.x*ilength; 2398 + result.y = q.y*ilength; 2399 + result.z = q.z*ilength; 2400 + result.w = q.w*ilength; 2401 + 2402 + return result; 2403 + } 2404 + 2405 + // Get a quaternion for a given rotation matrix 2406 + RMAPI Quaternion QuaternionFromMatrix(Matrix mat) 2407 + { 2408 + Quaternion result = { 0 }; 2409 + 2410 + float fourWSquaredMinus1 = mat.m0 + mat.m5 + mat.m10; 2411 + float fourXSquaredMinus1 = mat.m0 - mat.m5 - mat.m10; 2412 + float fourYSquaredMinus1 = mat.m5 - mat.m0 - mat.m10; 2413 + float fourZSquaredMinus1 = mat.m10 - mat.m0 - mat.m5; 2414 + 2415 + int biggestIndex = 0; 2416 + float fourBiggestSquaredMinus1 = fourWSquaredMinus1; 2417 + if (fourXSquaredMinus1 > fourBiggestSquaredMinus1) 2418 + { 2419 + fourBiggestSquaredMinus1 = fourXSquaredMinus1; 2420 + biggestIndex = 1; 2421 + } 2422 + 2423 + if (fourYSquaredMinus1 > fourBiggestSquaredMinus1) 2424 + { 2425 + fourBiggestSquaredMinus1 = fourYSquaredMinus1; 2426 + biggestIndex = 2; 2427 + } 2428 + 2429 + if (fourZSquaredMinus1 > fourBiggestSquaredMinus1) 2430 + { 2431 + fourBiggestSquaredMinus1 = fourZSquaredMinus1; 2432 + biggestIndex = 3; 2433 + } 2434 + 2435 + float biggestVal = sqrtf(fourBiggestSquaredMinus1 + 1.0f)*0.5f; 2436 + float mult = 0.25f/biggestVal; 2437 + 2438 + switch (biggestIndex) 2439 + { 2440 + case 0: 2441 + result.w = biggestVal; 2442 + result.x = (mat.m6 - mat.m9)*mult; 2443 + result.y = (mat.m8 - mat.m2)*mult; 2444 + result.z = (mat.m1 - mat.m4)*mult; 2445 + break; 2446 + case 1: 2447 + result.x = biggestVal; 2448 + result.w = (mat.m6 - mat.m9)*mult; 2449 + result.y = (mat.m1 + mat.m4)*mult; 2450 + result.z = (mat.m8 + mat.m2)*mult; 2451 + break; 2452 + case 2: 2453 + result.y = biggestVal; 2454 + result.w = (mat.m8 - mat.m2)*mult; 2455 + result.x = (mat.m1 + mat.m4)*mult; 2456 + result.z = (mat.m6 + mat.m9)*mult; 2457 + break; 2458 + case 3: 2459 + result.z = biggestVal; 2460 + result.w = (mat.m1 - mat.m4)*mult; 2461 + result.x = (mat.m8 + mat.m2)*mult; 2462 + result.y = (mat.m6 + mat.m9)*mult; 2463 + break; 2464 + } 2465 + 2466 + return result; 2467 + } 2468 + 2469 + // Get a matrix for a given quaternion 2470 + RMAPI Matrix QuaternionToMatrix(Quaternion q) 2471 + { 2472 + Matrix result = { 1.0f, 0.0f, 0.0f, 0.0f, 2473 + 0.0f, 1.0f, 0.0f, 0.0f, 2474 + 0.0f, 0.0f, 1.0f, 0.0f, 2475 + 0.0f, 0.0f, 0.0f, 1.0f }; // MatrixIdentity() 2476 + 2477 + float a2 = q.x*q.x; 2478 + float b2 = q.y*q.y; 2479 + float c2 = q.z*q.z; 2480 + float ac = q.x*q.z; 2481 + float ab = q.x*q.y; 2482 + float bc = q.y*q.z; 2483 + float ad = q.w*q.x; 2484 + float bd = q.w*q.y; 2485 + float cd = q.w*q.z; 2486 + 2487 + result.m0 = 1 - 2*(b2 + c2); 2488 + result.m1 = 2*(ab + cd); 2489 + result.m2 = 2*(ac - bd); 2490 + 2491 + result.m4 = 2*(ab - cd); 2492 + result.m5 = 1 - 2*(a2 + c2); 2493 + result.m6 = 2*(bc + ad); 2494 + 2495 + result.m8 = 2*(ac + bd); 2496 + result.m9 = 2*(bc - ad); 2497 + result.m10 = 1 - 2*(a2 + b2); 2498 + 2499 + return result; 2500 + } 2501 + 2502 + // Get rotation quaternion for an angle and axis 2503 + // NOTE: Angle must be provided in radians 2504 + RMAPI Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle) 2505 + { 2506 + Quaternion result = { 0.0f, 0.0f, 0.0f, 1.0f }; 2507 + 2508 + float length = sqrtf(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z); 2509 + 2510 + if (length != 0.0f) 2511 + { 2512 + angle *= 0.5f; 2513 + 2514 + // Vector3Normalize(axis) 2515 + float ilength = 1.0f/length; 2516 + axis.x *= ilength; 2517 + axis.y *= ilength; 2518 + axis.z *= ilength; 2519 + 2520 + float sinres = sinf(angle); 2521 + float cosres = cosf(angle); 2522 + 2523 + result.x = axis.x*sinres; 2524 + result.y = axis.y*sinres; 2525 + result.z = axis.z*sinres; 2526 + result.w = cosres; 2527 + 2528 + // QuaternionNormalize(q); 2529 + Quaternion q = result; 2530 + length = sqrtf(q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w); 2531 + if (length == 0.0f) length = 1.0f; 2532 + ilength = 1.0f/length; 2533 + result.x = q.x*ilength; 2534 + result.y = q.y*ilength; 2535 + result.z = q.z*ilength; 2536 + result.w = q.w*ilength; 2537 + } 2538 + 2539 + return result; 2540 + } 2541 + 2542 + // Get the rotation angle and axis for a given quaternion 2543 + RMAPI void QuaternionToAxisAngle(Quaternion q, Vector3 *outAxis, float *outAngle) 2544 + { 2545 + if (fabsf(q.w) > 1.0f) 2546 + { 2547 + // QuaternionNormalize(q); 2548 + float length = sqrtf(q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w); 2549 + if (length == 0.0f) length = 1.0f; 2550 + float ilength = 1.0f/length; 2551 + 2552 + q.x = q.x*ilength; 2553 + q.y = q.y*ilength; 2554 + q.z = q.z*ilength; 2555 + q.w = q.w*ilength; 2556 + } 2557 + 2558 + Vector3 resAxis = { 0.0f, 0.0f, 0.0f }; 2559 + float resAngle = 2.0f*acosf(q.w); 2560 + float den = sqrtf(1.0f - q.w*q.w); 2561 + 2562 + if (den > EPSILON) 2563 + { 2564 + resAxis.x = q.x/den; 2565 + resAxis.y = q.y/den; 2566 + resAxis.z = q.z/den; 2567 + } 2568 + else 2569 + { 2570 + // This occurs when the angle is zero 2571 + // Not a problem, set an arbitrary normalized axis 2572 + resAxis.x = 1.0f; 2573 + } 2574 + 2575 + *outAxis = resAxis; 2576 + *outAngle = resAngle; 2577 + } 2578 + 2579 + // Get the quaternion equivalent to Euler angles 2580 + // NOTE: Rotation order is ZYX 2581 + RMAPI Quaternion QuaternionFromEuler(float pitch, float yaw, float roll) 2582 + { 2583 + Quaternion result = { 0 }; 2584 + 2585 + float x0 = cosf(pitch*0.5f); 2586 + float x1 = sinf(pitch*0.5f); 2587 + float y0 = cosf(yaw*0.5f); 2588 + float y1 = sinf(yaw*0.5f); 2589 + float z0 = cosf(roll*0.5f); 2590 + float z1 = sinf(roll*0.5f); 2591 + 2592 + result.x = x1*y0*z0 - x0*y1*z1; 2593 + result.y = x0*y1*z0 + x1*y0*z1; 2594 + result.z = x0*y0*z1 - x1*y1*z0; 2595 + result.w = x0*y0*z0 + x1*y1*z1; 2596 + 2597 + return result; 2598 + } 2599 + 2600 + // Get the Euler angles equivalent to quaternion (roll, pitch, yaw) 2601 + // NOTE: Angles are returned in a Vector3 struct in radians 2602 + RMAPI Vector3 QuaternionToEuler(Quaternion q) 2603 + { 2604 + Vector3 result = { 0 }; 2605 + 2606 + // Roll (x-axis rotation) 2607 + float x0 = 2.0f*(q.w*q.x + q.y*q.z); 2608 + float x1 = 1.0f - 2.0f*(q.x*q.x + q.y*q.y); 2609 + result.x = atan2f(x0, x1); 2610 + 2611 + // Pitch (y-axis rotation) 2612 + float y0 = 2.0f*(q.w*q.y - q.z*q.x); 2613 + y0 = y0 > 1.0f ? 1.0f : y0; 2614 + y0 = y0 < -1.0f ? -1.0f : y0; 2615 + result.y = asinf(y0); 2616 + 2617 + // Yaw (z-axis rotation) 2618 + float z0 = 2.0f*(q.w*q.z + q.x*q.y); 2619 + float z1 = 1.0f - 2.0f*(q.y*q.y + q.z*q.z); 2620 + result.z = atan2f(z0, z1); 2621 + 2622 + return result; 2623 + } 2624 + 2625 + // Transform a quaternion given a transformation matrix 2626 + RMAPI Quaternion QuaternionTransform(Quaternion q, Matrix mat) 2627 + { 2628 + Quaternion result = { 0 }; 2629 + 2630 + result.x = mat.m0*q.x + mat.m4*q.y + mat.m8*q.z + mat.m12*q.w; 2631 + result.y = mat.m1*q.x + mat.m5*q.y + mat.m9*q.z + mat.m13*q.w; 2632 + result.z = mat.m2*q.x + mat.m6*q.y + mat.m10*q.z + mat.m14*q.w; 2633 + result.w = mat.m3*q.x + mat.m7*q.y + mat.m11*q.z + mat.m15*q.w; 2634 + 2635 + return result; 2636 + } 2637 + 2638 + // Check whether two given quaternions are almost equal 2639 + RMAPI int QuaternionEquals(Quaternion p, Quaternion q) 2640 + { 2641 + #if !defined(EPSILON) 2642 + #define EPSILON 0.000001f 2643 + #endif 2644 + 2645 + int result = (((fabsf(p.x - q.x)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) && 2646 + ((fabsf(p.y - q.y)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y))))) && 2647 + ((fabsf(p.z - q.z)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z))))) && 2648 + ((fabsf(p.w - q.w)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.w), fabsf(q.w)))))) || 2649 + (((fabsf(p.x + q.x)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) && 2650 + ((fabsf(p.y + q.y)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y))))) && 2651 + ((fabsf(p.z + q.z)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z))))) && 2652 + ((fabsf(p.w + q.w)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.w), fabsf(q.w)))))); 2653 + 2654 + return result; 2655 + } 2656 + 2657 + // Compose a transformation matrix from rotational, translational and scaling components 2658 + // TODO: This function is not following raymath conventions defined in header: NOT self-contained 2659 + RMAPI Matrix MatrixCompose(Vector3 translation, Quaternion rotation, Vector3 scale) 2660 + { 2661 + // Initialize vectors 2662 + Vector3 right = { 1.0f, 0.0f, 0.0f }; 2663 + Vector3 up = { 0.0f, 1.0f, 0.0f }; 2664 + Vector3 forward = { 0.0f, 0.0f, 1.0f }; 2665 + 2666 + // Scale vectors 2667 + right = Vector3Scale(right, scale.x); 2668 + up = Vector3Scale(up, scale.y); 2669 + forward = Vector3Scale(forward , scale.z); 2670 + 2671 + // Rotate vectors 2672 + right = Vector3RotateByQuaternion(right, rotation); 2673 + up = Vector3RotateByQuaternion(up, rotation); 2674 + forward = Vector3RotateByQuaternion(forward, rotation); 2675 + 2676 + // Set result matrix output 2677 + Matrix result = { 2678 + right.x, up.x, forward.x, translation.x, 2679 + right.y, up.y, forward.y, translation.y, 2680 + right.z, up.z, forward.z, translation.z, 2681 + 0.0f, 0.0f, 0.0f, 1.0f 2682 + }; 2683 + 2684 + return result; 2685 + } 2686 + 2687 + // Decompose a transformation matrix into its rotational, translational and scaling components and remove shear 2688 + // TODO: This function is not following raymath conventions defined in header: NOT self-contained 2689 + RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotation, Vector3 *scale) 2690 + { 2691 + float eps = (float)1e-9; 2692 + 2693 + // Extract Translation 2694 + translation->x = mat.m12; 2695 + translation->y = mat.m13; 2696 + translation->z = mat.m14; 2697 + 2698 + // Matrix Columns - Rotation will be extracted into here 2699 + Vector3 matColumns[3] = {{ mat.m0, mat.m4, mat.m8 }, 2700 + { mat.m1, mat.m5, mat.m9 }, 2701 + { mat.m2, mat.m6, mat.m10 }}; 2702 + 2703 + // Shear Parameters XY, XZ, and YZ (extract and ignored) 2704 + float shear[3] = { 0 }; 2705 + 2706 + // Normalized Scale Parameters 2707 + Vector3 scl = { 0 }; 2708 + 2709 + // Max-Normalizing helps numerical stability 2710 + float stabilizer = eps; 2711 + for (int i = 0; i < 3; i++) 2712 + { 2713 + stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].x)); 2714 + stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].y)); 2715 + stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].z)); 2716 + } 2717 + matColumns[0] = Vector3Scale(matColumns[0], 1.0f / stabilizer); 2718 + matColumns[1] = Vector3Scale(matColumns[1], 1.0f / stabilizer); 2719 + matColumns[2] = Vector3Scale(matColumns[2], 1.0f / stabilizer); 2720 + 2721 + // X Scale 2722 + scl.x = Vector3Length(matColumns[0]); 2723 + if (scl.x > eps) matColumns[0] = Vector3Scale(matColumns[0], 1.0f / scl.x); 2724 + 2725 + // Compute XY shear and make col2 orthogonal 2726 + shear[0] = Vector3DotProduct(matColumns[0], matColumns[1]); 2727 + matColumns[1] = Vector3Subtract(matColumns[1], Vector3Scale(matColumns[0], shear[0])); 2728 + 2729 + // Y Scale 2730 + scl.y = Vector3Length(matColumns[1]); 2731 + if (scl.y > eps) 2732 + { 2733 + matColumns[1] = Vector3Scale(matColumns[1], 1.0f / scl.y); 2734 + shear[0] /= scl.y; // Correct XY shear 2735 + } 2736 + 2737 + // Compute XZ and YZ shears and make col3 orthogonal 2738 + shear[1] = Vector3DotProduct(matColumns[0], matColumns[2]); 2739 + matColumns[2] = Vector3Subtract(matColumns[2], Vector3Scale(matColumns[0], shear[1])); 2740 + shear[2] = Vector3DotProduct(matColumns[1], matColumns[2]); 2741 + matColumns[2] = Vector3Subtract(matColumns[2], Vector3Scale(matColumns[1], shear[2])); 2742 + 2743 + // Z Scale 2744 + scl.z = Vector3Length(matColumns[2]); 2745 + if (scl.z > eps) 2746 + { 2747 + matColumns[2] = Vector3Scale(matColumns[2], 1.0f / scl.z); 2748 + shear[1] /= scl.z; // Correct XZ shear 2749 + shear[2] /= scl.z; // Correct YZ shear 2750 + } 2751 + 2752 + // matColumns are now orthonormal in O(3). Now ensure its in SO(3) by enforcing det = 1 2753 + if (Vector3DotProduct(matColumns[0], Vector3CrossProduct(matColumns[1], matColumns[2])) < 0) 2754 + { 2755 + scl = Vector3Negate(scl); 2756 + matColumns[0] = Vector3Negate(matColumns[0]); 2757 + matColumns[1] = Vector3Negate(matColumns[1]); 2758 + matColumns[2] = Vector3Negate(matColumns[2]); 2759 + } 2760 + 2761 + // Set Scale 2762 + *scale = Vector3Scale(scl, stabilizer); 2763 + 2764 + // Extract Rotation 2765 + Matrix rotationMatrix = { matColumns[0].x, matColumns[0].y, matColumns[0].z, 0, 2766 + matColumns[1].x, matColumns[1].y, matColumns[1].z, 0, 2767 + matColumns[2].x, matColumns[2].y, matColumns[2].z, 0, 2768 + 0, 0, 0, 1 }; 2769 + *rotation = QuaternionFromMatrix(rotationMatrix); 2770 + } 2771 + 2772 + #if defined(__cplusplus) && !defined(RAYMATH_DISABLE_CPP_OPERATORS) 2773 + 2774 + // Optional C++ math operators 2775 + //------------------------------------------------------------------------------- 2776 + 2777 + // Vector2 operators 2778 + static constexpr Vector2 Vector2Zeros = { 0, 0 }; 2779 + static constexpr Vector2 Vector2Ones = { 1, 1 }; 2780 + static constexpr Vector2 Vector2UnitX = { 1, 0 }; 2781 + static constexpr Vector2 Vector2UnitY = { 0, 1 }; 2782 + 2783 + inline Vector2 operator + (const Vector2& lhs, const Vector2& rhs) 2784 + { 2785 + return Vector2Add(lhs, rhs); 2786 + } 2787 + 2788 + inline const Vector2& operator += (Vector2& lhs, const Vector2& rhs) 2789 + { 2790 + lhs = Vector2Add(lhs, rhs); 2791 + return lhs; 2792 + } 2793 + 2794 + inline Vector2 operator - (const Vector2& lhs, const Vector2& rhs) 2795 + { 2796 + return Vector2Subtract(lhs, rhs); 2797 + } 2798 + 2799 + inline const Vector2& operator -= (Vector2& lhs, const Vector2& rhs) 2800 + { 2801 + lhs = Vector2Subtract(lhs, rhs); 2802 + return lhs; 2803 + } 2804 + 2805 + inline Vector2 operator * (const Vector2& lhs, const float& rhs) 2806 + { 2807 + return Vector2Scale(lhs, rhs); 2808 + } 2809 + 2810 + inline const Vector2& operator *= (Vector2& lhs, const float& rhs) 2811 + { 2812 + lhs = Vector2Scale(lhs, rhs); 2813 + return lhs; 2814 + } 2815 + 2816 + inline Vector2 operator * (const Vector2& lhs, const Vector2& rhs) 2817 + { 2818 + return Vector2Multiply(lhs, rhs); 2819 + } 2820 + 2821 + inline const Vector2& operator *= (Vector2& lhs, const Vector2& rhs) 2822 + { 2823 + lhs = Vector2Multiply(lhs, rhs); 2824 + return lhs; 2825 + } 2826 + 2827 + inline Vector2 operator * (const Vector2& lhs, const Matrix& rhs) 2828 + { 2829 + return Vector2Transform(lhs, rhs); 2830 + } 2831 + 2832 + inline const Vector2& operator *= (Vector2& lhs, const Matrix& rhs) 2833 + { 2834 + lhs = Vector2Transform(lhs, rhs); 2835 + return lhs; 2836 + } 2837 + 2838 + inline Vector2 operator / (const Vector2& lhs, const float& rhs) 2839 + { 2840 + return Vector2Scale(lhs, 1.0f/rhs); 2841 + } 2842 + 2843 + inline const Vector2& operator /= (Vector2& lhs, const float& rhs) 2844 + { 2845 + lhs = Vector2Scale(lhs, 1.0f/rhs); 2846 + return lhs; 2847 + } 2848 + 2849 + inline Vector2 operator / (const Vector2& lhs, const Vector2& rhs) 2850 + { 2851 + return Vector2Divide(lhs, rhs); 2852 + } 2853 + 2854 + inline const Vector2& operator /= (Vector2& lhs, const Vector2& rhs) 2855 + { 2856 + lhs = Vector2Divide(lhs, rhs); 2857 + return lhs; 2858 + } 2859 + 2860 + inline bool operator == (const Vector2& lhs, const Vector2& rhs) 2861 + { 2862 + return FloatEquals(lhs.x, rhs.x) && FloatEquals(lhs.y, rhs.y); 2863 + } 2864 + 2865 + inline bool operator != (const Vector2& lhs, const Vector2& rhs) 2866 + { 2867 + return !FloatEquals(lhs.x, rhs.x) || !FloatEquals(lhs.y, rhs.y); 2868 + } 2869 + 2870 + // Vector3 operators 2871 + static constexpr Vector3 Vector3Zeros = { 0, 0, 0 }; 2872 + static constexpr Vector3 Vector3Ones = { 1, 1, 1 }; 2873 + static constexpr Vector3 Vector3UnitX = { 1, 0, 0 }; 2874 + static constexpr Vector3 Vector3UnitY = { 0, 1, 0 }; 2875 + static constexpr Vector3 Vector3UnitZ = { 0, 0, 1 }; 2876 + 2877 + inline Vector3 operator + (const Vector3& lhs, const Vector3& rhs) 2878 + { 2879 + return Vector3Add(lhs, rhs); 2880 + } 2881 + 2882 + inline const Vector3& operator += (Vector3& lhs, const Vector3& rhs) 2883 + { 2884 + lhs = Vector3Add(lhs, rhs); 2885 + return lhs; 2886 + } 2887 + 2888 + inline Vector3 operator - (const Vector3& lhs, const Vector3& rhs) 2889 + { 2890 + return Vector3Subtract(lhs, rhs); 2891 + } 2892 + 2893 + inline const Vector3& operator -= (Vector3& lhs, const Vector3& rhs) 2894 + { 2895 + lhs = Vector3Subtract(lhs, rhs); 2896 + return lhs; 2897 + } 2898 + 2899 + inline Vector3 operator * (const Vector3& lhs, const float& rhs) 2900 + { 2901 + return Vector3Scale(lhs, rhs); 2902 + } 2903 + 2904 + inline const Vector3& operator *= (Vector3& lhs, const float& rhs) 2905 + { 2906 + lhs = Vector3Scale(lhs, rhs); 2907 + return lhs; 2908 + } 2909 + 2910 + inline Vector3 operator * (const Vector3& lhs, const Vector3& rhs) 2911 + { 2912 + return Vector3Multiply(lhs, rhs); 2913 + } 2914 + 2915 + inline const Vector3& operator *= (Vector3& lhs, const Vector3& rhs) 2916 + { 2917 + lhs = Vector3Multiply(lhs, rhs); 2918 + return lhs; 2919 + } 2920 + 2921 + inline Vector3 operator * (const Vector3& lhs, const Matrix& rhs) 2922 + { 2923 + return Vector3Transform(lhs, rhs); 2924 + } 2925 + 2926 + inline const Vector3& operator *= (Vector3& lhs, const Matrix& rhs) 2927 + { 2928 + lhs = Vector3Transform(lhs, rhs); 2929 + return lhs; 2930 + } 2931 + 2932 + inline Vector3 operator / (const Vector3& lhs, const float& rhs) 2933 + { 2934 + return Vector3Scale(lhs, 1.0f/rhs); 2935 + } 2936 + 2937 + inline const Vector3& operator /= (Vector3& lhs, const float& rhs) 2938 + { 2939 + lhs = Vector3Scale(lhs, 1.0f/rhs); 2940 + return lhs; 2941 + } 2942 + 2943 + inline Vector3 operator / (const Vector3& lhs, const Vector3& rhs) 2944 + { 2945 + return Vector3Divide(lhs, rhs); 2946 + } 2947 + 2948 + inline const Vector3& operator /= (Vector3& lhs, const Vector3& rhs) 2949 + { 2950 + lhs = Vector3Divide(lhs, rhs); 2951 + return lhs; 2952 + } 2953 + 2954 + inline bool operator == (const Vector3& lhs, const Vector3& rhs) 2955 + { 2956 + return FloatEquals(lhs.x, rhs.x) && FloatEquals(lhs.y, rhs.y) && FloatEquals(lhs.z, rhs.z); 2957 + } 2958 + 2959 + inline bool operator != (const Vector3& lhs, const Vector3& rhs) 2960 + { 2961 + return !FloatEquals(lhs.x, rhs.x) || !FloatEquals(lhs.y, rhs.y) || !FloatEquals(lhs.z, rhs.z); 2962 + } 2963 + 2964 + // Vector4 operators 2965 + static constexpr Vector4 Vector4Zeros = { 0, 0, 0, 0 }; 2966 + static constexpr Vector4 Vector4Ones = { 1, 1, 1, 1 }; 2967 + static constexpr Vector4 Vector4UnitX = { 1, 0, 0, 0 }; 2968 + static constexpr Vector4 Vector4UnitY = { 0, 1, 0, 0 }; 2969 + static constexpr Vector4 Vector4UnitZ = { 0, 0, 1, 0 }; 2970 + static constexpr Vector4 Vector4UnitW = { 0, 0, 0, 1 }; 2971 + 2972 + inline Vector4 operator + (const Vector4& lhs, const Vector4& rhs) 2973 + { 2974 + return Vector4Add(lhs, rhs); 2975 + } 2976 + 2977 + inline const Vector4& operator += (Vector4& lhs, const Vector4& rhs) 2978 + { 2979 + lhs = Vector4Add(lhs, rhs); 2980 + return lhs; 2981 + } 2982 + 2983 + inline Vector4 operator - (const Vector4& lhs, const Vector4& rhs) 2984 + { 2985 + return Vector4Subtract(lhs, rhs); 2986 + } 2987 + 2988 + inline const Vector4& operator -= (Vector4& lhs, const Vector4& rhs) 2989 + { 2990 + lhs = Vector4Subtract(lhs, rhs); 2991 + return lhs; 2992 + } 2993 + 2994 + inline Vector4 operator * (const Vector4& lhs, const float& rhs) 2995 + { 2996 + return Vector4Scale(lhs, rhs); 2997 + } 2998 + 2999 + inline const Vector4& operator *= (Vector4& lhs, const float& rhs) 3000 + { 3001 + lhs = Vector4Scale(lhs, rhs); 3002 + return lhs; 3003 + } 3004 + 3005 + inline Vector4 operator * (const Vector4& lhs, const Vector4& rhs) 3006 + { 3007 + return Vector4Multiply(lhs, rhs); 3008 + } 3009 + 3010 + inline const Vector4& operator *= (Vector4& lhs, const Vector4& rhs) 3011 + { 3012 + lhs = Vector4Multiply(lhs, rhs); 3013 + return lhs; 3014 + } 3015 + 3016 + inline Vector4 operator / (const Vector4& lhs, const float& rhs) 3017 + { 3018 + return Vector4Scale(lhs, 1.0f/rhs); 3019 + } 3020 + 3021 + inline const Vector4& operator /= (Vector4& lhs, const float& rhs) 3022 + { 3023 + lhs = Vector4Scale(lhs, 1.0f/rhs); 3024 + return lhs; 3025 + } 3026 + 3027 + inline Vector4 operator / (const Vector4& lhs, const Vector4& rhs) 3028 + { 3029 + return Vector4Divide(lhs, rhs); 3030 + } 3031 + 3032 + inline const Vector4& operator /= (Vector4& lhs, const Vector4& rhs) 3033 + { 3034 + lhs = Vector4Divide(lhs, rhs); 3035 + return lhs; 3036 + } 3037 + 3038 + inline bool operator == (const Vector4& lhs, const Vector4& rhs) 3039 + { 3040 + return FloatEquals(lhs.x, rhs.x) && FloatEquals(lhs.y, rhs.y) && FloatEquals(lhs.z, rhs.z) && FloatEquals(lhs.w, rhs.w); 3041 + } 3042 + 3043 + inline bool operator != (const Vector4& lhs, const Vector4& rhs) 3044 + { 3045 + return !FloatEquals(lhs.x, rhs.x) || !FloatEquals(lhs.y, rhs.y) || !FloatEquals(lhs.z, rhs.z) || !FloatEquals(lhs.w, rhs.w); 3046 + } 3047 + 3048 + // Quaternion operators 3049 + static constexpr Quaternion QuaternionZeros = { 0, 0, 0, 0 }; 3050 + static constexpr Quaternion QuaternionOnes = { 1, 1, 1, 1 }; 3051 + static constexpr Quaternion QuaternionUnitX = { 0, 0, 0, 1 }; 3052 + 3053 + inline Quaternion operator + (const Quaternion& lhs, const float& rhs) 3054 + { 3055 + return QuaternionAddValue(lhs, rhs); 3056 + } 3057 + 3058 + inline const Quaternion& operator += (Quaternion& lhs, const float& rhs) 3059 + { 3060 + lhs = QuaternionAddValue(lhs, rhs); 3061 + return lhs; 3062 + } 3063 + 3064 + inline Quaternion operator - (const Quaternion& lhs, const float& rhs) 3065 + { 3066 + return QuaternionSubtractValue(lhs, rhs); 3067 + } 3068 + 3069 + inline const Quaternion& operator -= (Quaternion& lhs, const float& rhs) 3070 + { 3071 + lhs = QuaternionSubtractValue(lhs, rhs); 3072 + return lhs; 3073 + } 3074 + 3075 + inline Quaternion operator * (const Quaternion& lhs, const Matrix& rhs) 3076 + { 3077 + return QuaternionTransform(lhs, rhs); 3078 + } 3079 + 3080 + inline const Quaternion& operator *= (Quaternion& lhs, const Matrix& rhs) 3081 + { 3082 + lhs = QuaternionTransform(lhs, rhs); 3083 + return lhs; 3084 + } 3085 + 3086 + // Matrix operators 3087 + static constexpr Matrix MatrixUnit = { 1, 0, 0, 0, 3088 + 0, 1, 0, 0, 3089 + 0, 0, 1, 0, 3090 + 0, 0, 0, 1 }; 3091 + 3092 + inline Matrix operator + (const Matrix& lhs, const Matrix& rhs) 3093 + { 3094 + return MatrixAdd(lhs, rhs); 3095 + } 3096 + 3097 + inline const Matrix& operator += (Matrix& lhs, const Matrix& rhs) 3098 + { 3099 + lhs = MatrixAdd(lhs, rhs); 3100 + return lhs; 3101 + } 3102 + 3103 + inline Matrix operator - (const Matrix& lhs, const Matrix& rhs) 3104 + { 3105 + return MatrixSubtract(lhs, rhs); 3106 + } 3107 + 3108 + inline const Matrix& operator -= (Matrix& lhs, const Matrix& rhs) 3109 + { 3110 + lhs = MatrixSubtract(lhs, rhs); 3111 + return lhs; 3112 + } 3113 + 3114 + inline Matrix operator * (const Matrix& lhs, const Matrix& rhs) 3115 + { 3116 + return MatrixMultiply(lhs, rhs); 3117 + } 3118 + 3119 + inline const Matrix& operator *= (Matrix& lhs, const Matrix& rhs) 3120 + { 3121 + lhs = MatrixMultiply(lhs, rhs); 3122 + return lhs; 3123 + } 3124 + 3125 + inline Matrix operator * (const Matrix& lhs, const float value) 3126 + { 3127 + return MatrixMultiplyValue(lhs, value); 3128 + } 3129 + 3130 + inline const Matrix& operator *= (Matrix& lhs, const float value) 3131 + { 3132 + lhs = MatrixMultiplyValue(lhs, value); 3133 + return lhs; 3134 + } 3135 + 3136 + //------------------------------------------------------------------------------- 3137 + #endif // C++ operators 3138 + 3139 + #endif // RAYMATH_H
+5421
linked-libs/raylib-6.0_linux_amd64/include/rlgl.h
··· 1 + /********************************************************************************************** 2 + * 3 + * rlgl v6.0 - A multi-OpenGL abstraction layer with an immediate-mode style API 4 + * 5 + * DESCRIPTION: 6 + * An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0, ES 3.0) 7 + * that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...) 8 + * 9 + * ADDITIONAL NOTES: 10 + * When choosing an OpenGL backend different than OpenGL 1.1, some internal buffers are 11 + * initialized on rlglInit() to accumulate vertex data 12 + * 13 + * When an internal state change is required all the stored vertex data is rendered in a batch, 14 + * additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch 15 + * 16 + * Some resources are also loaded for convenience, here the complete list: 17 + * - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data 18 + * - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8 19 + * - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs) 20 + * 21 + * Internal buffer (and resources) must be manually unloaded calling rlglClose() 22 + * 23 + * CONFIGURATION: 24 + * #define GRAPHICS_API_OPENGL_SOFTWARE 25 + * #define GRAPHICS_API_OPENGL_11 26 + * #define GRAPHICS_API_OPENGL_21 27 + * #define GRAPHICS_API_OPENGL_33 28 + * #define GRAPHICS_API_OPENGL_43 29 + * #define GRAPHICS_API_OPENGL_ES2 30 + * #define GRAPHICS_API_OPENGL_ES3 31 + * Use selected OpenGL graphics backend, should be supported by platform 32 + * Those preprocessor defines are only used on the rlgl module, if OpenGL version is 33 + * required by any other module, use rlGetVersion() to check it 34 + * 35 + * #define RLGL_IMPLEMENTATION 36 + * Generates the implementation of the library into the included file 37 + * If not defined, the library is in header only mode and can be included in other headers 38 + * or source files without problems. But only ONE file should hold the implementation 39 + * 40 + * #if RLGL_SHOW_GL_DETAILS_INFO 41 + * Show OpenGL extensions and capabilities detailed logs on init 42 + * 43 + * #if RLGL_ENABLE_OPENGL_DEBUG_CONTEXT 44 + * Enable debug context (only available on OpenGL 4.3) 45 + * 46 + * rlgl capabilities could be customized defining some internal 47 + * values before library inclusion (default values listed): 48 + * 49 + * #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits 50 + * #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering) 51 + * #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture) 52 + * #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of texture units that can be activated on batch drawing (SetShaderValueTexture()) 53 + * 54 + * #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack 55 + * #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported 56 + * #define RL_CULL_DISTANCE_NEAR 0.05 // Default projection matrix near cull distance 57 + * #define RL_CULL_DISTANCE_FAR 4000.0 // Default projection matrix far cull distance 58 + * 59 + * When loading a shader, the following vertex attributes and uniform 60 + * location names are tried to be set automatically: 61 + * 62 + * #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 63 + * #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 64 + * #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 65 + * #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 66 + * #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 67 + * #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 68 + * #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES "vertexBoneIndices" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES 69 + * #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 70 + * #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix 71 + * #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix 72 + * #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix 73 + * #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix 74 + * #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))) 75 + * #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color) 76 + * #define RL_DEFAULT_SHADER_UNIFORM_NAME_BONEMATRICES "boneMatrices" // bone matrices 77 + * #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0) 78 + * #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1) 79 + * #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2) 80 + * 81 + * DEPENDENCIES: 82 + * - OpenGL libraries (depending on platform and OpenGL version selected) 83 + * - GLAD OpenGL extensions loading library (only for OpenGL 3.3 Core, 4.3 Core) 84 + * 85 + * 86 + * LICENSE: zlib/libpng 87 + * 88 + * Copyright (c) 2014-2026 Ramon Santamaria (@raysan5) 89 + * 90 + * This software is provided "as-is", without any express or implied warranty. In no event 91 + * will the authors be held liable for any damages arising from the use of this software. 92 + * 93 + * Permission is granted to anyone to use this software for any purpose, including commercial 94 + * applications, and to alter it and redistribute it freely, subject to the following restrictions: 95 + * 96 + * 1. The origin of this software must not be misrepresented; you must not claim that you 97 + * wrote the original software. If you use this software in a product, an acknowledgment 98 + * in the product documentation would be appreciated but is not required. 99 + * 100 + * 2. Altered source versions must be plainly marked as such, and must not be misrepresented 101 + * as being the original software. 102 + * 103 + * 3. This notice may not be removed or altered from any source distribution. 104 + * 105 + **********************************************************************************************/ 106 + 107 + #ifndef RLGL_H 108 + #define RLGL_H 109 + 110 + #define RLGL_VERSION "6.0" 111 + 112 + // Function specifiers in case library is build/used as a shared library 113 + // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll 114 + // NOTE: visibility(default) attribute makes symbols "visible" when compiled with -fvisibility=hidden 115 + #if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED) 116 + #define RLAPI __declspec(dllexport) // Building the library as a Win32 shared library (.dll) 117 + #elif defined(BUILD_LIBTYPE_SHARED) 118 + #define RLAPI __attribute__((visibility("default"))) // Building the library as a Unix shared library (.so/.dylib) 119 + #elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED) 120 + #define RLAPI __declspec(dllimport) // Using the library as a Win32 shared library (.dll) 121 + #endif 122 + 123 + // Function specifiers definition 124 + #ifndef RLAPI 125 + #define RLAPI // Functions defined as 'extern' by default (implicit specifiers) 126 + #endif 127 + 128 + // Support TRACELOG macros 129 + #ifndef TRACELOG 130 + #define TRACELOG(level, ...) (void)0 131 + #endif 132 + 133 + // Allow custom memory allocators 134 + #ifndef RL_MALLOC 135 + #define RL_MALLOC(sz) malloc(sz) 136 + #endif 137 + #ifndef RL_CALLOC 138 + #define RL_CALLOC(n,sz) calloc(n,sz) 139 + #endif 140 + #ifndef RL_REALLOC 141 + #define RL_REALLOC(n,sz) realloc(n,sz) 142 + #endif 143 + #ifndef RL_FREE 144 + #define RL_FREE(p) free(p) 145 + #endif 146 + 147 + // Security check in case no GRAPHICS_API_OPENGL_* defined 148 + #if !defined(GRAPHICS_API_OPENGL_SOFTWARE) && \ 149 + !defined(GRAPHICS_API_OPENGL_11) && \ 150 + !defined(GRAPHICS_API_OPENGL_21) && \ 151 + !defined(GRAPHICS_API_OPENGL_33) && \ 152 + !defined(GRAPHICS_API_OPENGL_43) && \ 153 + !defined(GRAPHICS_API_OPENGL_ES2) && \ 154 + !defined(GRAPHICS_API_OPENGL_ES3) 155 + #define GRAPHICS_API_OPENGL_33 156 + #endif 157 + 158 + // Security check in case multiple GRAPHICS_API_OPENGL_* defined 159 + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_SOFTWARE) 160 + #if defined(GRAPHICS_API_OPENGL_21) 161 + #undef GRAPHICS_API_OPENGL_21 162 + #endif 163 + #if defined(GRAPHICS_API_OPENGL_33) 164 + #undef GRAPHICS_API_OPENGL_33 165 + #endif 166 + #if defined(GRAPHICS_API_OPENGL_43) 167 + #undef GRAPHICS_API_OPENGL_43 168 + #endif 169 + #if defined(GRAPHICS_API_OPENGL_ES2) 170 + #undef GRAPHICS_API_OPENGL_ES2 171 + #endif 172 + #endif 173 + 174 + // Software implementation uses OpenGL 1.1 functionality 175 + #if defined(GRAPHICS_API_OPENGL_SOFTWARE) 176 + #define GRAPHICS_API_OPENGL_11 177 + #endif 178 + 179 + // OpenGL 2.1 uses most of OpenGL 3.3 Core functionality 180 + // WARNING: Specific parts are checked with #if defines 181 + #if defined(GRAPHICS_API_OPENGL_21) 182 + #define GRAPHICS_API_OPENGL_33 183 + #endif 184 + 185 + // OpenGL 4.3 uses OpenGL 3.3 Core functionality 186 + #if defined(GRAPHICS_API_OPENGL_43) 187 + #define GRAPHICS_API_OPENGL_33 188 + #endif 189 + 190 + // OpenGL ES 3.0 uses OpenGL ES 2.0 functionality (and more) 191 + #if defined(GRAPHICS_API_OPENGL_ES3) 192 + #define GRAPHICS_API_OPENGL_ES2 193 + #endif 194 + 195 + //---------------------------------------------------------------------------------- 196 + // Defines and Macros 197 + //---------------------------------------------------------------------------------- 198 + 199 + // Default internal render batch elements limits 200 + #ifndef RL_DEFAULT_BATCH_BUFFER_ELEMENTS 201 + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) 202 + // This is the maximum amount of elements (quads) per batch 203 + // NOTE: Be careful with text, every letter maps to a quad 204 + #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 205 + #endif 206 + #if defined(GRAPHICS_API_OPENGL_ES2) 207 + // Reducing memory sizes for embedded systems (RPI and HTML5) 208 + // NOTE: On HTML5 (emscripten) this is allocated on heap, 209 + // by default heap is only 16MB!...just take care... 210 + #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 2048 211 + #endif 212 + #endif 213 + #ifndef RL_DEFAULT_BATCH_BUFFERS 214 + #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering) 215 + #endif 216 + #ifndef RL_DEFAULT_BATCH_DRAWCALLS 217 + #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture) 218 + #endif 219 + #ifndef RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 220 + #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture()) 221 + #endif 222 + 223 + // Internal Matrix stack 224 + #ifndef RL_MAX_MATRIX_STACK_SIZE 225 + #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of Matrix stack 226 + #endif 227 + 228 + // Shader limits 229 + #ifndef RL_MAX_SHADER_LOCATIONS 230 + #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported 231 + #endif 232 + 233 + // Projection matrix culling 234 + #ifndef RL_CULL_DISTANCE_NEAR 235 + #define RL_CULL_DISTANCE_NEAR 0.05 // Default near cull distance 236 + #endif 237 + #ifndef RL_CULL_DISTANCE_FAR 238 + #define RL_CULL_DISTANCE_FAR 4000.0 // Default far cull distance 239 + #endif 240 + 241 + // Texture parameters (equivalent to OpenGL defines) 242 + #define RL_TEXTURE_WRAP_S 0x2802 // GL_TEXTURE_WRAP_S 243 + #define RL_TEXTURE_WRAP_T 0x2803 // GL_TEXTURE_WRAP_T 244 + #define RL_TEXTURE_MAG_FILTER 0x2800 // GL_TEXTURE_MAG_FILTER 245 + #define RL_TEXTURE_MIN_FILTER 0x2801 // GL_TEXTURE_MIN_FILTER 246 + 247 + #define RL_TEXTURE_FILTER_NEAREST 0x2600 // GL_NEAREST 248 + #define RL_TEXTURE_FILTER_LINEAR 0x2601 // GL_LINEAR 249 + #define RL_TEXTURE_FILTER_MIP_NEAREST 0x2700 // GL_NEAREST_MIPMAP_NEAREST 250 + #define RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR 0x2702 // GL_NEAREST_MIPMAP_LINEAR 251 + #define RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST 0x2701 // GL_LINEAR_MIPMAP_NEAREST 252 + #define RL_TEXTURE_FILTER_MIP_LINEAR 0x2703 // GL_LINEAR_MIPMAP_LINEAR 253 + #define RL_TEXTURE_FILTER_ANISOTROPIC 0x3000 // Anisotropic filter (custom identifier) 254 + #define RL_TEXTURE_MIPMAP_BIAS_RATIO 0x4000 // Texture mipmap bias, percentage ratio (custom identifier) 255 + 256 + #define RL_TEXTURE_WRAP_REPEAT 0x2901 // GL_REPEAT 257 + #define RL_TEXTURE_WRAP_CLAMP 0x812F // GL_CLAMP_TO_EDGE 258 + #define RL_TEXTURE_WRAP_MIRROR_REPEAT 0x8370 // GL_MIRRORED_REPEAT 259 + #define RL_TEXTURE_WRAP_MIRROR_CLAMP 0x8742 // GL_MIRROR_CLAMP_EXT 260 + 261 + // Matrix modes (equivalent to OpenGL) 262 + #define RL_MODELVIEW 0x1700 // GL_MODELVIEW 263 + #define RL_PROJECTION 0x1701 // GL_PROJECTION 264 + #define RL_TEXTURE 0x1702 // GL_TEXTURE 265 + 266 + // Primitive assembly draw modes 267 + #define RL_LINES 0x0001 // GL_LINES 268 + #define RL_TRIANGLES 0x0004 // GL_TRIANGLES 269 + #define RL_QUADS 0x0007 // GL_QUADS 270 + 271 + // GL equivalent data types 272 + #define RL_UNSIGNED_BYTE 0x1401 // GL_UNSIGNED_BYTE 273 + #define RL_FLOAT 0x1406 // GL_FLOAT 274 + 275 + // GL buffer usage hint 276 + #define RL_STREAM_DRAW 0x88E0 // GL_STREAM_DRAW 277 + #define RL_STREAM_READ 0x88E1 // GL_STREAM_READ 278 + #define RL_STREAM_COPY 0x88E2 // GL_STREAM_COPY 279 + #define RL_STATIC_DRAW 0x88E4 // GL_STATIC_DRAW 280 + #define RL_STATIC_READ 0x88E5 // GL_STATIC_READ 281 + #define RL_STATIC_COPY 0x88E6 // GL_STATIC_COPY 282 + #define RL_DYNAMIC_DRAW 0x88E8 // GL_DYNAMIC_DRAW 283 + #define RL_DYNAMIC_READ 0x88E9 // GL_DYNAMIC_READ 284 + #define RL_DYNAMIC_COPY 0x88EA // GL_DYNAMIC_COPY 285 + 286 + // GL Shader type 287 + #define RL_FRAGMENT_SHADER 0x8B30 // GL_FRAGMENT_SHADER 288 + #define RL_VERTEX_SHADER 0x8B31 // GL_VERTEX_SHADER 289 + #define RL_COMPUTE_SHADER 0x91B9 // GL_COMPUTE_SHADER 290 + 291 + // GL blending factors 292 + #define RL_ZERO 0 // GL_ZERO 293 + #define RL_ONE 1 // GL_ONE 294 + #define RL_SRC_COLOR 0x0300 // GL_SRC_COLOR 295 + #define RL_ONE_MINUS_SRC_COLOR 0x0301 // GL_ONE_MINUS_SRC_COLOR 296 + #define RL_SRC_ALPHA 0x0302 // GL_SRC_ALPHA 297 + #define RL_ONE_MINUS_SRC_ALPHA 0x0303 // GL_ONE_MINUS_SRC_ALPHA 298 + #define RL_DST_ALPHA 0x0304 // GL_DST_ALPHA 299 + #define RL_ONE_MINUS_DST_ALPHA 0x0305 // GL_ONE_MINUS_DST_ALPHA 300 + #define RL_DST_COLOR 0x0306 // GL_DST_COLOR 301 + #define RL_ONE_MINUS_DST_COLOR 0x0307 // GL_ONE_MINUS_DST_COLOR 302 + #define RL_SRC_ALPHA_SATURATE 0x0308 // GL_SRC_ALPHA_SATURATE 303 + #define RL_CONSTANT_COLOR 0x8001 // GL_CONSTANT_COLOR 304 + #define RL_ONE_MINUS_CONSTANT_COLOR 0x8002 // GL_ONE_MINUS_CONSTANT_COLOR 305 + #define RL_CONSTANT_ALPHA 0x8003 // GL_CONSTANT_ALPHA 306 + #define RL_ONE_MINUS_CONSTANT_ALPHA 0x8004 // GL_ONE_MINUS_CONSTANT_ALPHA 307 + 308 + // GL blending functions/equations 309 + #define RL_FUNC_ADD 0x8006 // GL_FUNC_ADD 310 + #define RL_MIN 0x8007 // GL_MIN 311 + #define RL_MAX 0x8008 // GL_MAX 312 + #define RL_FUNC_SUBTRACT 0x800A // GL_FUNC_SUBTRACT 313 + #define RL_FUNC_REVERSE_SUBTRACT 0x800B // GL_FUNC_REVERSE_SUBTRACT 314 + #define RL_BLEND_EQUATION 0x8009 // GL_BLEND_EQUATION 315 + #define RL_BLEND_EQUATION_RGB 0x8009 // GL_BLEND_EQUATION_RGB // (Same as BLEND_EQUATION) 316 + #define RL_BLEND_EQUATION_ALPHA 0x883D // GL_BLEND_EQUATION_ALPHA 317 + #define RL_BLEND_DST_RGB 0x80C8 // GL_BLEND_DST_RGB 318 + #define RL_BLEND_SRC_RGB 0x80C9 // GL_BLEND_SRC_RGB 319 + #define RL_BLEND_DST_ALPHA 0x80CA // GL_BLEND_DST_ALPHA 320 + #define RL_BLEND_SRC_ALPHA 0x80CB // GL_BLEND_SRC_ALPHA 321 + #define RL_BLEND_COLOR 0x8005 // GL_BLEND_COLOR 322 + 323 + #define RL_READ_FRAMEBUFFER 0x8CA8 // GL_READ_FRAMEBUFFER 324 + #define RL_DRAW_FRAMEBUFFER 0x8CA9 // GL_DRAW_FRAMEBUFFER 325 + 326 + // Default shader vertex attribute locations 327 + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 328 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0 329 + #endif 330 + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 331 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1 332 + #endif 333 + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 334 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2 335 + #endif 336 + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 337 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3 338 + #endif 339 + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 340 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4 341 + #endif 342 + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 343 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5 344 + #endif 345 + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 346 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6 347 + #endif 348 + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES 349 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES 7 350 + #endif 351 + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 352 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8 353 + #endif 354 + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM 355 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM 9 356 + #endif 357 + 358 + //---------------------------------------------------------------------------------- 359 + // Types and Structures Definition 360 + //---------------------------------------------------------------------------------- 361 + #if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800) 362 + #include <stdbool.h> 363 + #elif !defined(__cplusplus) && !defined(bool) && !defined(RL_BOOL_TYPE) 364 + // Boolean type 365 + typedef enum bool { false = 0, true = !false } bool; 366 + #endif 367 + 368 + #if !defined(RL_MATRIX_TYPE) 369 + // Matrix, 4x4 components, column major, OpenGL style, right handed 370 + typedef struct Matrix { 371 + float m0, m4, m8, m12; // Matrix first row (4 components) 372 + float m1, m5, m9, m13; // Matrix second row (4 components) 373 + float m2, m6, m10, m14; // Matrix third row (4 components) 374 + float m3, m7, m11, m15; // Matrix fourth row (4 components) 375 + } Matrix; 376 + #define RL_MATRIX_TYPE 377 + #endif 378 + 379 + // Dynamic vertex buffers (position + texcoords + colors + indices arrays) 380 + typedef struct rlVertexBuffer { 381 + int elementCount; // Number of elements in the buffer (QUADS) 382 + 383 + float *vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0) 384 + float *texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) 385 + float *normals; // Vertex normal (XYZ - 3 components per vertex) (shader-location = 2) 386 + unsigned char *colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) 387 + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) 388 + unsigned int *indices; // Vertex indices (in case vertex data comes indexed) (6 indices per quad) 389 + #endif 390 + #if defined(GRAPHICS_API_OPENGL_ES2) 391 + unsigned short *indices; // Vertex indices (in case vertex data comes indexed) (6 indices per quad) 392 + #endif 393 + unsigned int vaoId; // OpenGL Vertex Array Object id 394 + unsigned int vboId[5]; // OpenGL Vertex Buffer Objects id (5 types of vertex data) 395 + } rlVertexBuffer; 396 + 397 + // Draw call type 398 + // NOTE: Only texture changes register a new draw, other state-change-related elements are not 399 + // used at this moment (vaoId, shaderId, matrices), raylib forces a batch draw call if any 400 + // of those state-change happens (this is done in core module) 401 + typedef struct rlDrawCall { 402 + int mode; // Drawing mode: LINES, TRIANGLES, QUADS 403 + int vertexCount; // Number of vertex of the draw 404 + int vertexAlignment; // Number of vertex required for index alignment (LINES, TRIANGLES) 405 + //unsigned int vaoId; // Vertex array id to be used on the draw -> Using RLGL.currentBatch->vertexBuffer.vaoId 406 + //unsigned int shaderId; // Shader id to be used on the draw -> Using RLGL.currentShaderId 407 + unsigned int textureId; // Texture id to be used on the draw -> Use to create new draw call if changes 408 + 409 + //Matrix projection; // Projection matrix for this draw -> Using RLGL.projection by default 410 + //Matrix modelview; // Modelview matrix for this draw -> Using RLGL.modelview by default 411 + } rlDrawCall; 412 + 413 + // rlRenderBatch type 414 + typedef struct rlRenderBatch { 415 + int bufferCount; // Number of vertex buffers (multi-buffering support) 416 + int currentBuffer; // Current buffer tracking in case of multi-buffering 417 + rlVertexBuffer *vertexBuffer; // Dynamic buffer(s) for vertex data 418 + 419 + rlDrawCall *draws; // Draw calls array, depends on textureId 420 + int drawCounter; // Draw calls counter 421 + float currentDepth; // Current depth value for next draw 422 + } rlRenderBatch; 423 + 424 + // OpenGL version 425 + typedef enum { 426 + RL_OPENGL_SOFTWARE = 0, // Software rendering 427 + RL_OPENGL_11, // OpenGL 1.1 428 + RL_OPENGL_21, // OpenGL 2.1 (GLSL 120) 429 + RL_OPENGL_33, // OpenGL 3.3 (GLSL 330) 430 + RL_OPENGL_43, // OpenGL 4.3 (using GLSL 330) 431 + RL_OPENGL_ES_20, // OpenGL ES 2.0 (GLSL 100) 432 + RL_OPENGL_ES_30 // OpenGL ES 3.0 (GLSL 300 es) 433 + } rlGlVersion; 434 + 435 + // Trace log level 436 + // NOTE: Organized by priority level 437 + typedef enum { 438 + RL_LOG_ALL = 0, // Display all logs 439 + RL_LOG_TRACE, // Trace logging, intended for internal use only 440 + RL_LOG_DEBUG, // Debug logging, used for internal debugging, it should be disabled on release builds 441 + RL_LOG_INFO, // Info logging, used for program execution info 442 + RL_LOG_WARNING, // Warning logging, used on recoverable failures 443 + RL_LOG_ERROR, // Error logging, used on unrecoverable failures 444 + RL_LOG_FATAL, // Fatal logging, used to abort program: exit(EXIT_FAILURE) 445 + RL_LOG_NONE // Disable logging 446 + } rlTraceLogLevel; 447 + 448 + // Texture pixel formats 449 + // NOTE: Support depends on OpenGL version 450 + typedef enum { 451 + RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha) 452 + RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels) 453 + RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5, // 16 bpp 454 + RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8, // 24 bpp 455 + RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1, // 16 bpp (1 bit alpha) 456 + RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4, // 16 bpp (4 bit alpha) 457 + RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, // 32 bpp 458 + RL_PIXELFORMAT_UNCOMPRESSED_R32, // 32 bpp (1 channel - float) 459 + RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32, // 32*3 bpp (3 channels - float) 460 + RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32, // 32*4 bpp (4 channels - float) 461 + RL_PIXELFORMAT_UNCOMPRESSED_R16, // 16 bpp (1 channel - half float) 462 + RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16, // 16*3 bpp (3 channels - half float) 463 + RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16, // 16*4 bpp (4 channels - half float) 464 + RL_PIXELFORMAT_COMPRESSED_DXT1_RGB, // 4 bpp (no alpha) 465 + RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA, // 4 bpp (1 bit alpha) 466 + RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA, // 8 bpp 467 + RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA, // 8 bpp 468 + RL_PIXELFORMAT_COMPRESSED_ETC1_RGB, // 4 bpp 469 + RL_PIXELFORMAT_COMPRESSED_ETC2_RGB, // 4 bpp 470 + RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA, // 8 bpp 471 + RL_PIXELFORMAT_COMPRESSED_PVRT_RGB, // 4 bpp 472 + RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA, // 4 bpp 473 + RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA, // 8 bpp 474 + RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA // 2 bpp 475 + } rlPixelFormat; 476 + 477 + // Texture parameters: filter mode 478 + // NOTE 1: Filtering considers mipmaps if available in the texture 479 + // NOTE 2: Filter is accordingly set for minification and magnification 480 + typedef enum { 481 + RL_TEXTURE_FILTER_POINT = 0, // No filter, pixel approximation 482 + RL_TEXTURE_FILTER_BILINEAR, // Linear filtering 483 + RL_TEXTURE_FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps) 484 + RL_TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x 485 + RL_TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x 486 + RL_TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x 487 + } rlTextureFilter; 488 + 489 + // Color blending modes (pre-defined) 490 + typedef enum { 491 + RL_BLEND_ALPHA = 0, // Blend textures considering alpha (default) 492 + RL_BLEND_ADDITIVE, // Blend textures adding colors 493 + RL_BLEND_MULTIPLIED, // Blend textures multiplying colors 494 + RL_BLEND_ADD_COLORS, // Blend textures adding colors (alternative) 495 + RL_BLEND_SUBTRACT_COLORS, // Blend textures subtracting colors (alternative) 496 + RL_BLEND_ALPHA_PREMULTIPLY, // Blend premultiplied textures considering alpha 497 + RL_BLEND_CUSTOM, // Blend textures using custom src/dst factors (use rlSetBlendFactors()) 498 + RL_BLEND_CUSTOM_SEPARATE // Blend textures using custom src/dst factors (use rlSetBlendFactorsSeparate()) 499 + } rlBlendMode; 500 + 501 + // Shader location point type 502 + typedef enum { 503 + RL_SHADER_LOC_VERTEX_POSITION = 0, // Shader location: vertex attribute: position 504 + RL_SHADER_LOC_VERTEX_TEXCOORD01, // Shader location: vertex attribute: texcoord01 505 + RL_SHADER_LOC_VERTEX_TEXCOORD02, // Shader location: vertex attribute: texcoord02 506 + RL_SHADER_LOC_VERTEX_NORMAL, // Shader location: vertex attribute: normal 507 + RL_SHADER_LOC_VERTEX_TANGENT, // Shader location: vertex attribute: tangent 508 + RL_SHADER_LOC_VERTEX_COLOR, // Shader location: vertex attribute: color 509 + RL_SHADER_LOC_MATRIX_MVP, // Shader location: matrix uniform: model-view-projection 510 + RL_SHADER_LOC_MATRIX_VIEW, // Shader location: matrix uniform: view (camera transform) 511 + RL_SHADER_LOC_MATRIX_PROJECTION, // Shader location: matrix uniform: projection 512 + RL_SHADER_LOC_MATRIX_MODEL, // Shader location: matrix uniform: model (transform) 513 + RL_SHADER_LOC_MATRIX_NORMAL, // Shader location: matrix uniform: normal 514 + RL_SHADER_LOC_VECTOR_VIEW, // Shader location: vector uniform: view 515 + RL_SHADER_LOC_COLOR_DIFFUSE, // Shader location: vector uniform: diffuse color 516 + RL_SHADER_LOC_COLOR_SPECULAR, // Shader location: vector uniform: specular color 517 + RL_SHADER_LOC_COLOR_AMBIENT, // Shader location: vector uniform: ambient color 518 + RL_SHADER_LOC_MAP_ALBEDO, // Shader location: sampler2d texture: albedo (same as: RL_SHADER_LOC_MAP_DIFFUSE) 519 + RL_SHADER_LOC_MAP_METALNESS, // Shader location: sampler2d texture: metalness (same as: RL_SHADER_LOC_MAP_SPECULAR) 520 + RL_SHADER_LOC_MAP_NORMAL, // Shader location: sampler2d texture: normal 521 + RL_SHADER_LOC_MAP_ROUGHNESS, // Shader location: sampler2d texture: roughness 522 + RL_SHADER_LOC_MAP_OCCLUSION, // Shader location: sampler2d texture: occlusion 523 + RL_SHADER_LOC_MAP_EMISSION, // Shader location: sampler2d texture: emission 524 + RL_SHADER_LOC_MAP_HEIGHT, // Shader location: sampler2d texture: height 525 + RL_SHADER_LOC_MAP_CUBEMAP, // Shader location: samplerCube texture: cubemap 526 + RL_SHADER_LOC_MAP_IRRADIANCE, // Shader location: samplerCube texture: irradiance 527 + RL_SHADER_LOC_MAP_PREFILTER, // Shader location: samplerCube texture: prefilter 528 + RL_SHADER_LOC_MAP_BRDF // Shader location: sampler2d texture: brdf 529 + } rlShaderLocationIndex; 530 + 531 + #define RL_SHADER_LOC_MAP_DIFFUSE RL_SHADER_LOC_MAP_ALBEDO 532 + #define RL_SHADER_LOC_MAP_SPECULAR RL_SHADER_LOC_MAP_METALNESS 533 + 534 + // Shader uniform data type 535 + typedef enum { 536 + RL_SHADER_UNIFORM_FLOAT = 0, // Shader uniform type: float 537 + RL_SHADER_UNIFORM_VEC2, // Shader uniform type: vec2 (2 float) 538 + RL_SHADER_UNIFORM_VEC3, // Shader uniform type: vec3 (3 float) 539 + RL_SHADER_UNIFORM_VEC4, // Shader uniform type: vec4 (4 float) 540 + RL_SHADER_UNIFORM_INT, // Shader uniform type: int 541 + RL_SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int) 542 + RL_SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int) 543 + RL_SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int) 544 + RL_SHADER_UNIFORM_UINT, // Shader uniform type: unsigned int 545 + RL_SHADER_UNIFORM_UIVEC2, // Shader uniform type: uivec2 (2 unsigned int) 546 + RL_SHADER_UNIFORM_UIVEC3, // Shader uniform type: uivec3 (3 unsigned int) 547 + RL_SHADER_UNIFORM_UIVEC4, // Shader uniform type: uivec4 (4 unsigned int) 548 + RL_SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d 549 + } rlShaderUniformDataType; 550 + 551 + // Shader attribute data types 552 + typedef enum { 553 + RL_SHADER_ATTRIB_FLOAT = 0, // Shader attribute type: float 554 + RL_SHADER_ATTRIB_VEC2, // Shader attribute type: vec2 (2 float) 555 + RL_SHADER_ATTRIB_VEC3, // Shader attribute type: vec3 (3 float) 556 + RL_SHADER_ATTRIB_VEC4 // Shader attribute type: vec4 (4 float) 557 + } rlShaderAttributeDataType; 558 + 559 + // Framebuffer attachment type 560 + // NOTE: By default up to 8 color channels defined, but it can be more 561 + typedef enum { 562 + RL_ATTACHMENT_COLOR_CHANNEL0 = 0, // Framebuffer attachment type: color 0 563 + RL_ATTACHMENT_COLOR_CHANNEL1 = 1, // Framebuffer attachment type: color 1 564 + RL_ATTACHMENT_COLOR_CHANNEL2 = 2, // Framebuffer attachment type: color 2 565 + RL_ATTACHMENT_COLOR_CHANNEL3 = 3, // Framebuffer attachment type: color 3 566 + RL_ATTACHMENT_COLOR_CHANNEL4 = 4, // Framebuffer attachment type: color 4 567 + RL_ATTACHMENT_COLOR_CHANNEL5 = 5, // Framebuffer attachment type: color 5 568 + RL_ATTACHMENT_COLOR_CHANNEL6 = 6, // Framebuffer attachment type: color 6 569 + RL_ATTACHMENT_COLOR_CHANNEL7 = 7, // Framebuffer attachment type: color 7 570 + RL_ATTACHMENT_DEPTH = 100, // Framebuffer attachment type: depth 571 + RL_ATTACHMENT_STENCIL = 200, // Framebuffer attachment type: stencil 572 + } rlFramebufferAttachType; 573 + 574 + // Framebuffer texture attachment type 575 + typedef enum { 576 + RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0, // Framebuffer texture attachment type: cubemap, +X side 577 + RL_ATTACHMENT_CUBEMAP_NEGATIVE_X = 1, // Framebuffer texture attachment type: cubemap, -X side 578 + RL_ATTACHMENT_CUBEMAP_POSITIVE_Y = 2, // Framebuffer texture attachment type: cubemap, +Y side 579 + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y = 3, // Framebuffer texture attachment type: cubemap, -Y side 580 + RL_ATTACHMENT_CUBEMAP_POSITIVE_Z = 4, // Framebuffer texture attachment type: cubemap, +Z side 581 + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z = 5, // Framebuffer texture attachment type: cubemap, -Z side 582 + RL_ATTACHMENT_TEXTURE2D = 100, // Framebuffer texture attachment type: texture2d 583 + RL_ATTACHMENT_RENDERBUFFER = 200, // Framebuffer texture attachment type: renderbuffer 584 + } rlFramebufferAttachTextureType; 585 + 586 + // Face culling mode 587 + typedef enum { 588 + RL_CULL_FACE_FRONT = 0, 589 + RL_CULL_FACE_BACK 590 + } rlCullMode; 591 + 592 + //------------------------------------------------------------------------------------ 593 + // Functions Declaration - Matrix operations 594 + //------------------------------------------------------------------------------------ 595 + 596 + #if defined(__cplusplus) 597 + extern "C" { // Prevents name mangling of functions 598 + #endif 599 + 600 + RLAPI void rlMatrixMode(int mode); // Choose the current matrix to be transformed 601 + RLAPI void rlPushMatrix(void); // Push the current matrix to stack 602 + RLAPI void rlPopMatrix(void); // Pop latest inserted matrix from stack 603 + RLAPI void rlLoadIdentity(void); // Reset current matrix to identity matrix 604 + RLAPI void rlTranslatef(float x, float y, float z); // Multiply the current matrix by a translation matrix 605 + RLAPI void rlRotatef(float angle, float x, float y, float z); // Multiply the current matrix by a rotation matrix 606 + RLAPI void rlScalef(float x, float y, float z); // Multiply the current matrix by a scaling matrix 607 + RLAPI void rlMultMatrixf(const float *matf); // Multiply the current matrix by another matrix 608 + RLAPI void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar); 609 + RLAPI void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar); 610 + RLAPI void rlViewport(int x, int y, int width, int height); // Set the viewport area 611 + RLAPI void rlSetClipPlanes(double nearPlane, double farPlane); // Set clip planes distances 612 + RLAPI double rlGetCullDistanceNear(void); // Get cull plane distance near 613 + RLAPI double rlGetCullDistanceFar(void); // Get cull plane distance far 614 + 615 + //------------------------------------------------------------------------------------ 616 + // Functions Declaration - Vertex level operations 617 + //------------------------------------------------------------------------------------ 618 + RLAPI void rlBegin(int mode); // Initialize drawing mode (how to organize vertex) 619 + RLAPI void rlEnd(void); // Finish vertex providing 620 + RLAPI void rlVertex2i(int x, int y); // Define one vertex (position) - 2 int 621 + RLAPI void rlVertex2f(float x, float y); // Define one vertex (position) - 2 float 622 + RLAPI void rlVertex3f(float x, float y, float z); // Define one vertex (position) - 3 float 623 + RLAPI void rlTexCoord2f(float x, float y); // Define one vertex (texture coordinate) - 2 float 624 + RLAPI void rlNormal3f(float x, float y, float z); // Define one vertex (normal) - 3 float 625 + RLAPI void rlColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a); // Define one vertex (color) - 4 byte 626 + RLAPI void rlColor3f(float x, float y, float z); // Define one vertex (color) - 3 float 627 + RLAPI void rlColor4f(float x, float y, float z, float w); // Define one vertex (color) - 4 float 628 + 629 + //------------------------------------------------------------------------------------ 630 + // Functions Declaration - OpenGL style functions (common to 1.1, 3.3+, ES2) 631 + // NOTE: This functions are used to completely abstract raylib code from OpenGL layer, 632 + // some of them are direct wrappers over OpenGL calls, some others are custom 633 + //------------------------------------------------------------------------------------ 634 + 635 + // Vertex buffers state 636 + RLAPI bool rlEnableVertexArray(unsigned int vaoId); // Enable vertex array (VAO, if supported) 637 + RLAPI void rlDisableVertexArray(void); // Disable vertex array (VAO, if supported) 638 + RLAPI void rlEnableVertexBuffer(unsigned int id); // Enable vertex buffer (VBO) 639 + RLAPI void rlDisableVertexBuffer(void); // Disable vertex buffer (VBO) 640 + RLAPI void rlEnableVertexBufferElement(unsigned int id); // Enable vertex buffer element (VBO element) 641 + RLAPI void rlDisableVertexBufferElement(void); // Disable vertex buffer element (VBO element) 642 + RLAPI void rlEnableVertexAttribute(unsigned int index); // Enable vertex attribute index 643 + RLAPI void rlDisableVertexAttribute(unsigned int index); // Disable vertex attribute index 644 + RLAPI void rlEnableStatePointer(int vertexAttribType, void *buffer); // Enable attribute state pointer 645 + RLAPI void rlDisableStatePointer(int vertexAttribType); // Disable attribute state pointer 646 + 647 + // Textures state 648 + RLAPI void rlActiveTextureSlot(int slot); // Select and active a texture slot 649 + RLAPI void rlEnableTexture(unsigned int id); // Enable texture 650 + RLAPI void rlDisableTexture(void); // Disable texture 651 + RLAPI void rlEnableTextureCubemap(unsigned int id); // Enable texture cubemap 652 + RLAPI void rlDisableTextureCubemap(void); // Disable texture cubemap 653 + RLAPI void rlTextureParameters(unsigned int id, int param, int value); // Set texture parameters (filter, wrap) 654 + RLAPI void rlCubemapParameters(unsigned int id, int param, int value); // Set cubemap parameters (filter, wrap) 655 + 656 + // Shader state 657 + RLAPI void rlEnableShader(unsigned int id); // Enable shader program 658 + RLAPI void rlDisableShader(void); // Disable shader program 659 + 660 + // Framebuffer state 661 + RLAPI void rlEnableFramebuffer(unsigned int id); // Enable render texture (fbo) 662 + RLAPI void rlDisableFramebuffer(void); // Disable render texture (fbo), return to default framebuffer 663 + RLAPI unsigned int rlGetActiveFramebuffer(void); // Get the currently active render texture (fbo), 0 for default framebuffer 664 + RLAPI void rlActiveDrawBuffers(int count); // Activate multiple draw color buffers 665 + RLAPI void rlBlitFramebuffer(int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY, int dstWidth, int dstHeight, int bufferMask); // Blit active framebuffer to main framebuffer 666 + RLAPI void rlBindFramebuffer(unsigned int target, unsigned int framebuffer); // Bind framebuffer (FBO) 667 + 668 + // General render state 669 + RLAPI void rlEnableColorBlend(void); // Enable color blending 670 + RLAPI void rlDisableColorBlend(void); // Disable color blending 671 + RLAPI void rlEnableDepthTest(void); // Enable depth test 672 + RLAPI void rlDisableDepthTest(void); // Disable depth test 673 + RLAPI void rlEnableDepthMask(void); // Enable depth write 674 + RLAPI void rlDisableDepthMask(void); // Disable depth write 675 + RLAPI void rlEnableBackfaceCulling(void); // Enable backface culling 676 + RLAPI void rlDisableBackfaceCulling(void); // Disable backface culling 677 + RLAPI void rlColorMask(bool r, bool g, bool b, bool a); // Color mask control 678 + RLAPI void rlSetCullFace(int mode); // Set face culling mode 679 + RLAPI void rlEnableScissorTest(void); // Enable scissor test 680 + RLAPI void rlDisableScissorTest(void); // Disable scissor test 681 + RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test 682 + RLAPI void rlEnablePointMode(void); // Enable point mode 683 + RLAPI void rlDisablePointMode(void); // Disable point mode 684 + RLAPI void rlSetPointSize(float size); // Set the point drawing size 685 + RLAPI float rlGetPointSize(void); // Get the point drawing size 686 + RLAPI void rlEnableWireMode(void); // Enable wire mode 687 + RLAPI void rlDisableWireMode(void); // Disable wire mode 688 + RLAPI void rlSetLineWidth(float width); // Set the line drawing width 689 + RLAPI float rlGetLineWidth(void); // Get the line drawing width 690 + RLAPI void rlEnableSmoothLines(void); // Enable line aliasing 691 + RLAPI void rlDisableSmoothLines(void); // Disable line aliasing 692 + RLAPI void rlEnableStereoRender(void); // Enable stereo rendering 693 + RLAPI void rlDisableStereoRender(void); // Disable stereo rendering 694 + RLAPI bool rlIsStereoRenderEnabled(void); // Check if stereo render is enabled 695 + 696 + RLAPI void rlClearColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a); // Clear color buffer with color 697 + RLAPI void rlClearScreenBuffers(void); // Clear used screen buffers (color and depth) 698 + RLAPI void rlCheckErrors(void); // Check and log OpenGL error codes 699 + RLAPI void rlSetBlendMode(int mode); // Set blending mode 700 + RLAPI void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation); // Set blending mode factor and equation (using OpenGL factors) 701 + RLAPI void rlSetBlendFactorsSeparate(int glSrcRGB, int glDstRGB, int glSrcAlpha, int glDstAlpha, int glEqRGB, int glEqAlpha); // Set blending mode factors and equations separately (using OpenGL factors) 702 + 703 + //------------------------------------------------------------------------------------ 704 + // Functions Declaration - rlgl functionality 705 + //------------------------------------------------------------------------------------ 706 + // rlgl initialization functions 707 + RLAPI void rlglInit(int width, int height); // Initialize rlgl (buffers, shaders, textures, states) 708 + RLAPI void rlglClose(void); // De-initialize rlgl (buffers, shaders, textures) 709 + RLAPI void rlLoadExtensions(void *loader); // Load OpenGL extensions (loader function required) 710 + RLAPI void *rlGetProcAddress(const char *procName); // Get OpenGL procedure address 711 + RLAPI int rlGetVersion(void); // Get current OpenGL version 712 + RLAPI void rlSetFramebufferWidth(int width); // Set current framebuffer width 713 + RLAPI int rlGetFramebufferWidth(void); // Get default framebuffer width 714 + RLAPI void rlSetFramebufferHeight(int height); // Set current framebuffer height 715 + RLAPI int rlGetFramebufferHeight(void); // Get default framebuffer height 716 + 717 + RLAPI unsigned int rlGetTextureIdDefault(void); // Get default texture id 718 + RLAPI unsigned int rlGetShaderIdDefault(void); // Get default shader id 719 + RLAPI int *rlGetShaderLocsDefault(void); // Get default shader locations 720 + 721 + // Render batch management 722 + // NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode 723 + // but this render batch API is exposed in case of custom batches are required 724 + RLAPI rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements); // Load a render batch system 725 + RLAPI void rlUnloadRenderBatch(rlRenderBatch batch); // Unload render batch system 726 + RLAPI void rlDrawRenderBatch(rlRenderBatch *batch); // Draw render batch data (Update->Draw->Reset) 727 + RLAPI void rlSetRenderBatchActive(rlRenderBatch *batch); // Set the active render batch for rlgl (NULL for default internal) 728 + RLAPI void rlDrawRenderBatchActive(void); // Update and draw internal render batch 729 + RLAPI bool rlCheckRenderBatchLimit(int vCount); // Check internal buffer overflow for a given number of vertex 730 + 731 + RLAPI void rlSetTexture(unsigned int id); // Set current texture for render batch and check buffers limits 732 + 733 + //------------------------------------------------------------------------------------------------------------------------ 734 + 735 + // Vertex buffers management 736 + RLAPI unsigned int rlLoadVertexArray(void); // Load vertex array (vao) if supported 737 + RLAPI unsigned int rlLoadVertexBuffer(const void *buffer, int size, bool dynamic); // Load a vertex buffer object 738 + RLAPI unsigned int rlLoadVertexBufferElement(const void *buffer, int size, bool dynamic); // Load vertex buffer elements object 739 + RLAPI void rlUpdateVertexBuffer(unsigned int bufferId, const void *data, int dataSize, int offset); // Update vertex buffer object data on GPU buffer 740 + RLAPI void rlUpdateVertexBufferElements(unsigned int id, const void *data, int dataSize, int offset); // Update vertex buffer elements data on GPU buffer 741 + RLAPI void rlUnloadVertexArray(unsigned int vaoId); // Unload vertex array (vao) 742 + RLAPI void rlUnloadVertexBuffer(unsigned int vboId); // Unload vertex buffer object 743 + RLAPI void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, int offset); // Set vertex attribute data configuration 744 + RLAPI void rlSetVertexAttributeDivisor(unsigned int index, int divisor); // Set vertex attribute data divisor 745 + RLAPI void rlSetVertexAttributeDefault(int locIndex, const void *value, int attribType, int count); // Set vertex attribute default value, when attribute to provided 746 + RLAPI void rlDrawVertexArray(int offset, int count); // Draw vertex array (currently active vao) 747 + RLAPI void rlDrawVertexArrayElements(int offset, int count, const void *buffer); // Draw vertex array elements 748 + RLAPI void rlDrawVertexArrayInstanced(int offset, int count, int instances); // Draw vertex array (currently active vao) with instancing 749 + RLAPI void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffer, int instances); // Draw vertex array elements with instancing 750 + 751 + // Textures management 752 + RLAPI unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount); // Load texture data 753 + RLAPI unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo) 754 + RLAPI unsigned int rlLoadTextureCubemap(const void *data, int size, int format, int mipmapCount); // Load texture cubemap data 755 + RLAPI void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update texture with new data on GPU 756 + RLAPI void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType); // Get OpenGL internal formats 757 + RLAPI const char *rlGetPixelFormatName(unsigned int format); // Get name string for pixel format 758 + RLAPI void rlUnloadTexture(unsigned int id); // Unload texture from GPU memory 759 + RLAPI void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int *mipmaps); // Generate mipmap data for selected texture 760 + RLAPI void *rlReadTexturePixels(unsigned int id, int width, int height, int format); // Read texture pixel data 761 + RLAPI unsigned char *rlReadScreenPixels(int width, int height); // Read screen pixel data (color buffer) 762 + 763 + // Framebuffer management (fbo) 764 + RLAPI unsigned int rlLoadFramebuffer(void); // Load an empty framebuffer 765 + RLAPI void rlFramebufferAttach(unsigned int id, unsigned int texId, int attachType, int texType, int mipLevel); // Attach texture/renderbuffer to a framebuffer 766 + RLAPI bool rlFramebufferComplete(unsigned int id); // Verify framebuffer is complete 767 + RLAPI void rlUnloadFramebuffer(unsigned int id); // Delete framebuffer from GPU 768 + // WARNING: Copy and resize framebuffer functionality only defined for software backend 769 + RLAPI void rlCopyFramebuffer(int x, int y, int width, int height, int format, void *pixels); // Copy framebuffer pixel data to internal buffer 770 + RLAPI void rlResizeFramebuffer(int width, int height); // Resize internal framebuffer 771 + 772 + // Shaders management 773 + RLAPI unsigned int rlLoadShader(const char *code, int type); // Load (compile) shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER) 774 + RLAPI unsigned int rlLoadShaderProgram(const char *vsCode, const char *fsCode); // Load shader from code strings 775 + RLAPI unsigned int rlLoadShaderProgramEx(unsigned int vsId, unsigned int fsId); // Load shader program, using already loaded shader ids 776 + RLAPI unsigned int rlLoadShaderProgramCompute(unsigned int csId); // Load compute shader program 777 + RLAPI void rlUnloadShader(unsigned int id); // Unload shader, loaded with rlLoadShader() 778 + RLAPI void rlUnloadShaderProgram(unsigned int id); // Unload shader program 779 + RLAPI int rlGetLocationUniform(unsigned int id, const char *uniformName); // Get shader location uniform, requires shader program id 780 + RLAPI int rlGetLocationAttrib(unsigned int id, const char *attribName); // Get shader location attribute, requires shader program id 781 + RLAPI void rlSetUniform(int locIndex, const void *value, int uniformType, int count); // Set shader value uniform 782 + RLAPI void rlSetUniformMatrix(int locIndex, Matrix mat); // Set shader value matrix 783 + RLAPI void rlSetUniformMatrices(int locIndex, const Matrix *mat, int count); // Set shader value matrices 784 + RLAPI void rlSetUniformSampler(int locIndex, unsigned int textureId); // Set shader value sampler 785 + RLAPI void rlSetShader(unsigned int id, int *locs); // Set shader currently active (id and locations) 786 + 787 + // Compute shader management 788 + RLAPI void rlComputeShaderDispatch(unsigned int groupX, unsigned int groupY, unsigned int groupZ); // Dispatch compute shader (equivalent to *draw* for graphics pipeline) 789 + 790 + // Shader buffer storage object management (ssbo) 791 + RLAPI unsigned int rlLoadShaderBuffer(unsigned int size, const void *data, int usageHint); // Load shader storage buffer object (SSBO) 792 + RLAPI void rlUnloadShaderBuffer(unsigned int ssboId); // Unload shader storage buffer object (SSBO) 793 + RLAPI void rlUpdateShaderBuffer(unsigned int id, const void *data, unsigned int dataSize, unsigned int offset); // Update SSBO buffer data 794 + RLAPI void rlBindShaderBuffer(unsigned int id, unsigned int index); // Bind SSBO buffer 795 + RLAPI void rlReadShaderBuffer(unsigned int id, void *dest, unsigned int count, unsigned int offset); // Read SSBO buffer data (GPU->CPU) 796 + RLAPI void rlCopyShaderBuffer(unsigned int destId, unsigned int srcId, unsigned int destOffset, unsigned int srcOffset, unsigned int count); // Copy SSBO data between buffers 797 + RLAPI unsigned int rlGetShaderBufferSize(unsigned int id); // Get SSBO buffer size 798 + 799 + // Buffer management 800 + RLAPI void rlBindImageTexture(unsigned int id, unsigned int index, int format, bool readonly); // Bind image texture 801 + 802 + // Matrix state management 803 + RLAPI Matrix rlGetMatrixModelview(void); // Get internal modelview matrix 804 + RLAPI Matrix rlGetMatrixProjection(void); // Get internal projection matrix 805 + RLAPI Matrix rlGetMatrixTransform(void); // Get internal accumulated transform matrix 806 + RLAPI Matrix rlGetMatrixProjectionStereo(int eye); // Get internal projection matrix for stereo render (selected eye) 807 + RLAPI Matrix rlGetMatrixViewOffsetStereo(int eye); // Get internal view offset matrix for stereo render (selected eye) 808 + RLAPI void rlSetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix) 809 + RLAPI void rlSetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix) 810 + RLAPI void rlSetMatrixProjectionStereo(Matrix right, Matrix left); // Set eyes projection matrices for stereo rendering 811 + RLAPI void rlSetMatrixViewOffsetStereo(Matrix right, Matrix left); // Set eyes view offsets matrices for stereo rendering 812 + 813 + // Quick and dirty cube/quad buffers load->draw->unload 814 + RLAPI void rlLoadDrawCube(void); // Load and draw a cube 815 + RLAPI void rlLoadDrawQuad(void); // Load and draw a quad 816 + 817 + #if defined(__cplusplus) 818 + } 819 + #endif 820 + 821 + #endif // RLGL_H 822 + 823 + /*********************************************************************************** 824 + * 825 + * RLGL IMPLEMENTATION 826 + * 827 + ************************************************************************************/ 828 + 829 + #if defined(RLGL_IMPLEMENTATION) 830 + 831 + // Expose OpenGL functions from glad in raylib 832 + #if defined(BUILD_LIBTYPE_SHARED) 833 + #define GLAD_API_CALL_EXPORT 834 + #define GLAD_API_CALL_EXPORT_BUILD 835 + #endif 836 + 837 + #if defined(GRAPHICS_API_OPENGL_11) 838 + #if defined(GRAPHICS_API_OPENGL_SOFTWARE) 839 + #define RLSW_IMPLEMENTATION 840 + #define SW_MALLOC(sz) RL_MALLOC(sz) 841 + #define SW_CALLOC(n,sz) RL_CALLOC(n, sz) 842 + #define SW_REALLOC(ptr, newSz) RL_REALLOC(ptr, newSz) 843 + #define SW_FREE(ptr) RL_FREE(ptr) 844 + #include "external/rlsw.h" // OpenGL 1.1 software implementation 845 + #else 846 + #if defined(__APPLE__) 847 + #include <OpenGL/gl.h> // OpenGL 1.1 library for OSX 848 + #include <OpenGL/glext.h> // OpenGL extensions library 849 + #else 850 + // APIENTRY for OpenGL function pointer declarations is required 851 + #if !defined(APIENTRY) 852 + #if defined(_WIN32) 853 + #define APIENTRY __stdcall 854 + #else 855 + #define APIENTRY 856 + #endif 857 + #endif 858 + // WINGDIAPI definition. Some Windows OpenGL headers need it 859 + #if !defined(WINGDIAPI) && defined(_WIN32) 860 + #define WINGDIAPI __declspec(dllimport) 861 + #endif 862 + 863 + #include <GL/gl.h> // OpenGL 1.1 library 864 + #endif 865 + #endif 866 + #endif 867 + 868 + #if defined(GRAPHICS_API_OPENGL_33) 869 + #define GLAD_MALLOC RL_MALLOC 870 + #define GLAD_FREE RL_FREE 871 + 872 + #define GLAD_GL_IMPLEMENTATION 873 + #include "external/glad.h" // GLAD extensions loading library, includes OpenGL headers 874 + #endif 875 + 876 + #if defined(GRAPHICS_API_OPENGL_ES3) 877 + #include <GLES3/gl3.h> // OpenGL ES 3.0 library 878 + #define GL_GLEXT_PROTOTYPES 879 + #include <GLES2/gl2ext.h> // OpenGL ES 2.0 extensions library 880 + #elif defined(GRAPHICS_API_OPENGL_ES2) 881 + // NOTE: OpenGL ES 2.0 can be enabled on Desktop platforms, 882 + // in that case, functions are loaded from a custom glad for OpenGL ES 2.0 883 + // TODO: OpenGL ES 2.0 support shouldn't be platform-dependent, neither require GLAD 884 + #if defined(PLATFORM_DESKTOP_GLFW) || defined(PLATFORM_DESKTOP_SDL) 885 + #define GLAD_GLES2_IMPLEMENTATION 886 + #include "external/glad_gles2.h" 887 + #else 888 + #define GL_GLEXT_PROTOTYPES 889 + //#include <EGL/egl.h> // EGL library -> not required, platform layer 890 + #include <GLES2/gl2.h> // OpenGL ES 2.0 library 891 + #include <GLES2/gl2ext.h> // OpenGL ES 2.0 extensions library 892 + #endif 893 + 894 + // It seems OpenGL ES 2.0 instancing entry points are not defined on Raspberry Pi 895 + // provided headers (despite being defined in official Khronos GLES2 headers) 896 + // TODO: Avoid raylib platform-dependent code on rlgl, it should be a completely portable library 897 + #if defined(PLATFORM_DRM) 898 + typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); 899 + typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); 900 + typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor); 901 + #endif 902 + #endif 903 + 904 + #include <stdlib.h> // Required for: calloc(), free() 905 + #include <string.h> // Required for: strcmp(), strlen() [Used in rlglInit(), on extensions loading] 906 + #include <math.h> // Required for: sqrtf(), sinf(), cosf(), floor(), log() 907 + 908 + //---------------------------------------------------------------------------------- 909 + // Defines and Macros 910 + //---------------------------------------------------------------------------------- 911 + #ifndef PI 912 + #define PI 3.14159265358979323846f 913 + #endif 914 + #ifndef DEG2RAD 915 + #define DEG2RAD (PI/180.0f) 916 + #endif 917 + #ifndef RAD2DEG 918 + #define RAD2DEG (180.0f/PI) 919 + #endif 920 + 921 + #ifndef GL_SHADING_LANGUAGE_VERSION 922 + #define GL_SHADING_LANGUAGE_VERSION 0x8B8C 923 + #endif 924 + 925 + #ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT 926 + #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 927 + #endif 928 + #ifndef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 929 + #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 930 + #endif 931 + #ifndef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 932 + #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 933 + #endif 934 + #ifndef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 935 + #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 936 + #endif 937 + #ifndef GL_ETC1_RGB8_OES 938 + #define GL_ETC1_RGB8_OES 0x8D64 939 + #endif 940 + #ifndef GL_COMPRESSED_RGB8_ETC2 941 + #define GL_COMPRESSED_RGB8_ETC2 0x9274 942 + #endif 943 + #ifndef GL_COMPRESSED_RGBA8_ETC2_EAC 944 + #define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 945 + #endif 946 + #ifndef GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 947 + #define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 948 + #endif 949 + #ifndef GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 950 + #define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 951 + #endif 952 + #ifndef GL_COMPRESSED_RGBA_ASTC_4x4_KHR 953 + #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93b0 954 + #endif 955 + #ifndef GL_COMPRESSED_RGBA_ASTC_8x8_KHR 956 + #define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93b7 957 + #endif 958 + 959 + #ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 960 + #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF 961 + #endif 962 + #ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT 963 + #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE 964 + #endif 965 + 966 + #ifndef GL_PROGRAM_POINT_SIZE 967 + #define GL_PROGRAM_POINT_SIZE 0x8642 968 + #endif 969 + 970 + #ifndef GL_LINE_WIDTH 971 + #define GL_LINE_WIDTH 0x0B21 972 + #endif 973 + 974 + #if defined(GRAPHICS_API_OPENGL_11) 975 + #define GL_UNSIGNED_SHORT_5_6_5 0x8363 976 + #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 977 + #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 978 + #endif 979 + 980 + #if defined(GRAPHICS_API_OPENGL_21) 981 + #define GL_LUMINANCE 0x1909 982 + #define GL_LUMINANCE_ALPHA 0x190A 983 + #endif 984 + 985 + #if defined(GRAPHICS_API_OPENGL_ES2) 986 + #define glClearDepth glClearDepthf 987 + #if !defined(GRAPHICS_API_OPENGL_ES3) 988 + #define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER 989 + #define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER 990 + #endif 991 + #endif 992 + 993 + // Default shader vertex attribute names to set location points 994 + #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION 995 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 996 + #endif 997 + #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD 998 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 999 + #endif 1000 + #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL 1001 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 1002 + #endif 1003 + #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR 1004 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 1005 + #endif 1006 + #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT 1007 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 1008 + #endif 1009 + #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 1010 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 1011 + #endif 1012 + #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES 1013 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES "vertexBoneIndices" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES 1014 + #endif 1015 + #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS 1016 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 1017 + #endif 1018 + 1019 + #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCETRANSFORM 1020 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCETRANSFORM "instanceTransform" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM 1021 + #endif 1022 + 1023 + #ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MVP 1024 + #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix 1025 + #endif 1026 + #ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW 1027 + #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix 1028 + #endif 1029 + #ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION 1030 + #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix 1031 + #endif 1032 + #ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL 1033 + #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix 1034 + #endif 1035 + #ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL 1036 + #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView)) 1037 + #endif 1038 + #ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR 1039 + #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color) 1040 + #endif 1041 + #ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 1042 + #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0) 1043 + #endif 1044 + #ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 1045 + #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1) 1046 + #endif 1047 + #ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 1048 + #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2) 1049 + #endif 1050 + #ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_BONEMATRICES 1051 + #define RL_DEFAULT_SHADER_UNIFORM_NAME_BONEMATRICES "boneMatrices" // bone matrices (required for GPU skinning) 1052 + #endif 1053 + 1054 + //---------------------------------------------------------------------------------- 1055 + // Module Types and Structures Definition 1056 + //---------------------------------------------------------------------------------- 1057 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 1058 + 1059 + typedef void *(*rlglLoadProc)(const char *name); // OpenGL extension functions loader signature (same as GLADloadproc) 1060 + 1061 + typedef struct rlglData { 1062 + rlRenderBatch *currentBatch; // Current render batch 1063 + rlRenderBatch defaultBatch; // Default internal render batch 1064 + 1065 + rlglLoadProc loader; // OpenGL function loader 1066 + 1067 + struct { 1068 + int vertexCounter; // Current active render batch vertex counter (generic, used for all batches) 1069 + float texcoordx, texcoordy; // Current active texture coordinate (added on glVertex*()) 1070 + float normalx, normaly, normalz; // Current active normal (added on glVertex*()) 1071 + unsigned char colorr, colorg, colorb, colora; // Current active color (added on glVertex*()) 1072 + 1073 + int currentMatrixMode; // Current matrix mode 1074 + Matrix *currentMatrix; // Current matrix pointer 1075 + Matrix modelview; // Default modelview matrix 1076 + Matrix projection; // Default projection matrix 1077 + Matrix transform; // Transform matrix to be used with rlTranslate, rlRotate, rlScale 1078 + bool transformRequired; // Require transform matrix application to current draw-call vertex (if required) 1079 + Matrix stack[RL_MAX_MATRIX_STACK_SIZE];// Matrix stack for push/pop 1080 + int stackCounter; // Matrix stack counter 1081 + 1082 + unsigned int currentTextureId; // Current texture id to be used on glBegin 1083 + unsigned int defaultTextureId; // Default texture used on shapes/poly drawing (required by shader) 1084 + unsigned int activeTextureId[RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS]; // Active texture ids to be enabled on batch drawing (0 active by default) 1085 + unsigned int defaultVShaderId; // Default vertex shader id (used by default shader program) 1086 + unsigned int defaultFShaderId; // Default fragment shader id (used by default shader program) 1087 + unsigned int defaultShaderId; // Default shader program id, supports vertex color and diffuse texture 1088 + int *defaultShaderLocs; // Default shader locations pointer to be used on rendering 1089 + unsigned int currentShaderId; // Current shader id to be used on rendering (by default, defaultShaderId) 1090 + int *currentShaderLocs; // Current shader locations pointer to be used on rendering (by default, defaultShaderLocs) 1091 + 1092 + bool stereoRender; // Stereo rendering flag 1093 + Matrix projectionStereo[2]; // VR stereo rendering eyes projection matrices 1094 + Matrix viewOffsetStereo[2]; // VR stereo rendering eyes view offset matrices 1095 + 1096 + // Blending variables 1097 + int currentBlendMode; // Blending mode active 1098 + int glBlendSrcFactor; // Blending source factor 1099 + int glBlendDstFactor; // Blending destination factor 1100 + int glBlendEquation; // Blending equation 1101 + int glBlendSrcFactorRGB; // Blending source RGB factor 1102 + int glBlendDestFactorRGB; // Blending destination RGB factor 1103 + int glBlendSrcFactorAlpha; // Blending source alpha factor 1104 + int glBlendDestFactorAlpha; // Blending destination alpha factor 1105 + int glBlendEquationRGB; // Blending equation for RGB 1106 + int glBlendEquationAlpha; // Blending equation for alpha 1107 + bool glCustomBlendModeModified; // Custom blending factor and equation modification status 1108 + 1109 + int framebufferWidth; // Current framebuffer width 1110 + int framebufferHeight; // Current framebuffer height 1111 + 1112 + } State; // Renderer state 1113 + struct { 1114 + bool vao; // VAO support (OpenGL ES2 could not support VAO extension) (GL_ARB_vertex_array_object) 1115 + bool instancing; // Instancing supported (GL_ANGLE_instanced_arrays, GL_EXT_draw_instanced + GL_EXT_instanced_arrays) 1116 + bool texNPOT; // NPOT textures full support (GL_ARB_texture_non_power_of_two, GL_OES_texture_npot) 1117 + bool texDepth; // Depth textures supported (GL_ARB_depth_texture, GL_OES_depth_texture) 1118 + bool texDepthWebGL; // Depth textures supported WebGL specific (GL_WEBGL_depth_texture) 1119 + bool texFloat32; // float textures support (32 bit per channel) (GL_OES_texture_float) 1120 + bool texFloat16; // half float textures support (16 bit per channel) (GL_OES_texture_half_float) 1121 + bool texCompDXT; // DDS texture compression support (GL_EXT_texture_compression_s3tc, GL_WEBGL_compressed_texture_s3tc, GL_WEBKIT_WEBGL_compressed_texture_s3tc) 1122 + bool texCompETC1; // ETC1 texture compression support (GL_OES_compressed_ETC1_RGB8_texture, GL_WEBGL_compressed_texture_etc1) 1123 + bool texCompETC2; // ETC2/EAC texture compression support (GL_ARB_ES3_compatibility) 1124 + bool texCompPVRT; // PVR texture compression support (GL_IMG_texture_compression_pvrtc) 1125 + bool texCompASTC; // ASTC texture compression support (GL_KHR_texture_compression_astc_hdr, GL_KHR_texture_compression_astc_ldr) 1126 + bool texMirrorClamp; // Clamp mirror wrap mode supported (GL_EXT_texture_mirror_clamp) 1127 + bool texAnisoFilter; // Anisotropic texture filtering support (GL_EXT_texture_filter_anisotropic) 1128 + bool computeShader; // Compute shaders support (GL_ARB_compute_shader) 1129 + bool ssbo; // Shader storage buffer object support (GL_ARB_shader_storage_buffer_object) 1130 + 1131 + float maxAnisotropyLevel; // Maximum anisotropy level supported (minimum is 2.0f) 1132 + int maxDepthBits; // Maximum bits for depth component 1133 + 1134 + } ExtSupported; // Extensions supported flags 1135 + } rlglData; 1136 + 1137 + #endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 1138 + 1139 + //---------------------------------------------------------------------------------- 1140 + // Global Variables Definition 1141 + //---------------------------------------------------------------------------------- 1142 + static bool isGpuReady = false; 1143 + static double rlCullDistanceNear = RL_CULL_DISTANCE_NEAR; 1144 + static double rlCullDistanceFar = RL_CULL_DISTANCE_FAR; 1145 + 1146 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 1147 + static rlglData RLGL = { 0 }; 1148 + #endif 1149 + 1150 + #if defined(GRAPHICS_API_OPENGL_ES2) && !defined(GRAPHICS_API_OPENGL_ES3) 1151 + // VAO functions entry points 1152 + // NOTE: VAO functionality is exposed through extensions (OES) 1153 + static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL; 1154 + static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL; 1155 + static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = NULL; 1156 + 1157 + // Instancing functionality entry points 1158 + // NOTE: Instancing functionality could be available through extensions 1159 + static PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstanced = NULL; 1160 + static PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstanced = NULL; 1161 + static PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisor = NULL; 1162 + #endif 1163 + 1164 + //---------------------------------------------------------------------------------- 1165 + // Module Functions Declaration 1166 + //---------------------------------------------------------------------------------- 1167 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 1168 + static void rlLoadShaderDefault(void); // Load default shader 1169 + static void rlUnloadShaderDefault(void); // Unload default shader 1170 + #if RLGL_SHOW_GL_DETAILS_INFO 1171 + static const char *rlGetCompressedFormatName(int format); // Get compressed format official GL identifier name 1172 + #endif 1173 + #endif 1174 + 1175 + static int rlGetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes (image or texture) 1176 + 1177 + static Matrix rlMatrixIdentity(void); // Get identity matrix 1178 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 1179 + // Auxiliar matrix math functions 1180 + typedef struct rl_float16 { float v[16]; } rl_float16; 1181 + static rl_float16 rlMatrixToFloatV(Matrix mat); // Get float array of matrix data 1182 + #define rlMatrixToFloat(mat) (rlMatrixToFloatV(mat).v) // Get float vector for Matrix 1183 + static Matrix rlMatrixMultiply(Matrix left, Matrix right); // Multiply two matrices 1184 + static Matrix rlMatrixTranspose(Matrix mat); // Transposes provided matrix 1185 + static Matrix rlMatrixInvert(Matrix mat); // Invert provided matrix 1186 + #endif 1187 + 1188 + //---------------------------------------------------------------------------------- 1189 + // Module Functions Definition - Matrix operations 1190 + //---------------------------------------------------------------------------------- 1191 + 1192 + #if defined(GRAPHICS_API_OPENGL_11) 1193 + // Fallback to OpenGL 1.1 function calls 1194 + //--------------------------------------- 1195 + void rlMatrixMode(int mode) 1196 + { 1197 + switch (mode) 1198 + { 1199 + case RL_PROJECTION: glMatrixMode(GL_PROJECTION); break; 1200 + case RL_MODELVIEW: glMatrixMode(GL_MODELVIEW); break; 1201 + case RL_TEXTURE: glMatrixMode(GL_TEXTURE); break; 1202 + default: break; 1203 + } 1204 + } 1205 + 1206 + void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar) 1207 + { 1208 + glFrustum(left, right, bottom, top, znear, zfar); 1209 + } 1210 + 1211 + void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar) 1212 + { 1213 + glOrtho(left, right, bottom, top, znear, zfar); 1214 + } 1215 + 1216 + void rlPushMatrix(void) { glPushMatrix(); } 1217 + void rlPopMatrix(void) { glPopMatrix(); } 1218 + void rlLoadIdentity(void) { glLoadIdentity(); } 1219 + void rlTranslatef(float x, float y, float z) { glTranslatef(x, y, z); } 1220 + void rlRotatef(float angle, float x, float y, float z) { glRotatef(angle, x, y, z); } 1221 + void rlScalef(float x, float y, float z) { glScalef(x, y, z); } 1222 + void rlMultMatrixf(const float *matf) { glMultMatrixf(matf); } 1223 + #endif 1224 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 1225 + // Choose the current matrix to be transformed 1226 + void rlMatrixMode(int mode) 1227 + { 1228 + if (mode == RL_PROJECTION) RLGL.State.currentMatrix = &RLGL.State.projection; 1229 + else if (mode == RL_MODELVIEW) RLGL.State.currentMatrix = &RLGL.State.modelview; 1230 + //else if (mode == RL_TEXTURE) // Not supported 1231 + 1232 + RLGL.State.currentMatrixMode = mode; 1233 + } 1234 + 1235 + // Push the current matrix into RLGL.State.stack 1236 + void rlPushMatrix(void) 1237 + { 1238 + if (RLGL.State.stackCounter >= RL_MAX_MATRIX_STACK_SIZE) TRACELOG(RL_LOG_ERROR, "RLGL: Matrix stack overflow (RL_MAX_MATRIX_STACK_SIZE)"); 1239 + 1240 + if (RLGL.State.currentMatrixMode == RL_MODELVIEW) 1241 + { 1242 + RLGL.State.transformRequired = true; 1243 + RLGL.State.currentMatrix = &RLGL.State.transform; 1244 + } 1245 + 1246 + RLGL.State.stack[RLGL.State.stackCounter] = *RLGL.State.currentMatrix; 1247 + RLGL.State.stackCounter++; 1248 + } 1249 + 1250 + // Pop latest inserted matrix from RLGL.State.stack 1251 + void rlPopMatrix(void) 1252 + { 1253 + if (RLGL.State.stackCounter > 0) 1254 + { 1255 + Matrix mat = RLGL.State.stack[RLGL.State.stackCounter - 1]; 1256 + *RLGL.State.currentMatrix = mat; 1257 + RLGL.State.stackCounter--; 1258 + } 1259 + 1260 + if ((RLGL.State.stackCounter == 0) && (RLGL.State.currentMatrixMode == RL_MODELVIEW)) 1261 + { 1262 + RLGL.State.currentMatrix = &RLGL.State.modelview; 1263 + RLGL.State.transformRequired = false; 1264 + } 1265 + } 1266 + 1267 + // Reset current matrix to identity matrix 1268 + void rlLoadIdentity(void) 1269 + { 1270 + *RLGL.State.currentMatrix = rlMatrixIdentity(); 1271 + } 1272 + 1273 + // Multiply the current matrix by a translation matrix 1274 + void rlTranslatef(float x, float y, float z) 1275 + { 1276 + Matrix matTranslation = rlMatrixIdentity(); 1277 + 1278 + // Set translation component of matrix 1279 + matTranslation.m12 = x; 1280 + matTranslation.m13 = y; 1281 + matTranslation.m14 = z; 1282 + 1283 + // NOTE: Transposing matrix by multiplication order 1284 + *RLGL.State.currentMatrix = rlMatrixMultiply(matTranslation, *RLGL.State.currentMatrix); 1285 + } 1286 + 1287 + // Multiply the current matrix by a rotation matrix 1288 + // NOTE: The provided angle must be in degrees 1289 + void rlRotatef(float angle, float x, float y, float z) 1290 + { 1291 + Matrix matRotation = rlMatrixIdentity(); 1292 + 1293 + // Axis vector (x, y, z) normalization 1294 + float lengthSquared = x*x + y*y + z*z; 1295 + if ((lengthSquared != 1.0f) && (lengthSquared != 0.0f)) 1296 + { 1297 + float inverseLength = 1.0f/sqrtf(lengthSquared); 1298 + x *= inverseLength; 1299 + y *= inverseLength; 1300 + z *= inverseLength; 1301 + } 1302 + 1303 + // Rotation matrix generation 1304 + float sinres = sinf(DEG2RAD*angle); 1305 + float cosres = cosf(DEG2RAD*angle); 1306 + float t = 1.0f - cosres; 1307 + 1308 + matRotation.m0 = x*x*t + cosres; 1309 + matRotation.m1 = y*x*t + z*sinres; 1310 + matRotation.m2 = z*x*t - y*sinres; 1311 + matRotation.m3 = 0.0f; 1312 + 1313 + matRotation.m4 = x*y*t - z*sinres; 1314 + matRotation.m5 = y*y*t + cosres; 1315 + matRotation.m6 = z*y*t + x*sinres; 1316 + matRotation.m7 = 0.0f; 1317 + 1318 + matRotation.m8 = x*z*t + y*sinres; 1319 + matRotation.m9 = y*z*t - x*sinres; 1320 + matRotation.m10 = z*z*t + cosres; 1321 + matRotation.m11 = 0.0f; 1322 + 1323 + matRotation.m12 = 0.0f; 1324 + matRotation.m13 = 0.0f; 1325 + matRotation.m14 = 0.0f; 1326 + matRotation.m15 = 1.0f; 1327 + 1328 + // NOTE: Transposing matrix by multiplication order 1329 + *RLGL.State.currentMatrix = rlMatrixMultiply(matRotation, *RLGL.State.currentMatrix); 1330 + } 1331 + 1332 + // Multiply the current matrix by a scaling matrix 1333 + void rlScalef(float x, float y, float z) 1334 + { 1335 + Matrix matScale = rlMatrixIdentity(); 1336 + 1337 + // Set scale component of matrix 1338 + matScale.m0 = x; 1339 + matScale.m5 = y; 1340 + matScale.m10 = z; 1341 + 1342 + // NOTE: Transposing matrix by multiplication order 1343 + *RLGL.State.currentMatrix = rlMatrixMultiply(matScale, *RLGL.State.currentMatrix); 1344 + } 1345 + 1346 + // Multiply the current matrix by another matrix 1347 + void rlMultMatrixf(const float *matf) 1348 + { 1349 + // Matrix creation from array 1350 + // Conversion from column-major to row-major memory order 1351 + Matrix mat = { matf[0], matf[4], matf[8], matf[12], 1352 + matf[1], matf[5], matf[9], matf[13], 1353 + matf[2], matf[6], matf[10], matf[14], 1354 + matf[3], matf[7], matf[11], matf[15] }; 1355 + 1356 + *RLGL.State.currentMatrix = rlMatrixMultiply(mat, *RLGL.State.currentMatrix); 1357 + } 1358 + 1359 + // Multiply the current matrix by a perspective matrix generated by parameters 1360 + void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar) 1361 + { 1362 + Matrix matFrustum = { 0 }; 1363 + 1364 + float rl = (float)(right - left); 1365 + float tb = (float)(top - bottom); 1366 + float fn = (float)(zfar - znear); 1367 + 1368 + matFrustum.m0 = ((float) znear*2.0f)/rl; 1369 + matFrustum.m1 = 0.0f; 1370 + matFrustum.m2 = 0.0f; 1371 + matFrustum.m3 = 0.0f; 1372 + 1373 + matFrustum.m4 = 0.0f; 1374 + matFrustum.m5 = ((float) znear*2.0f)/tb; 1375 + matFrustum.m6 = 0.0f; 1376 + matFrustum.m7 = 0.0f; 1377 + 1378 + matFrustum.m8 = ((float)right + (float)left)/rl; 1379 + matFrustum.m9 = ((float)top + (float)bottom)/tb; 1380 + matFrustum.m10 = -((float)zfar + (float)znear)/fn; 1381 + matFrustum.m11 = -1.0f; 1382 + 1383 + matFrustum.m12 = 0.0f; 1384 + matFrustum.m13 = 0.0f; 1385 + matFrustum.m14 = -((float)zfar*(float)znear*2.0f)/fn; 1386 + matFrustum.m15 = 0.0f; 1387 + 1388 + *RLGL.State.currentMatrix = rlMatrixMultiply(*RLGL.State.currentMatrix, matFrustum); 1389 + } 1390 + 1391 + // Multiply the current matrix by an orthographic matrix generated by parameters 1392 + void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar) 1393 + { 1394 + // NOTE: If left-right and top-botton values are equal it could create a division by zero, 1395 + // response to it is platform/compiler dependent 1396 + Matrix matOrtho = { 0 }; 1397 + 1398 + float rl = (float)(right - left); 1399 + float tb = (float)(top - bottom); 1400 + float fn = (float)(zfar - znear); 1401 + 1402 + matOrtho.m0 = 2.0f/rl; 1403 + matOrtho.m1 = 0.0f; 1404 + matOrtho.m2 = 0.0f; 1405 + matOrtho.m3 = 0.0f; 1406 + matOrtho.m4 = 0.0f; 1407 + matOrtho.m5 = 2.0f/tb; 1408 + matOrtho.m6 = 0.0f; 1409 + matOrtho.m7 = 0.0f; 1410 + matOrtho.m8 = 0.0f; 1411 + matOrtho.m9 = 0.0f; 1412 + matOrtho.m10 = -2.0f/fn; 1413 + matOrtho.m11 = 0.0f; 1414 + matOrtho.m12 = -((float)left + (float)right)/rl; 1415 + matOrtho.m13 = -((float)top + (float)bottom)/tb; 1416 + matOrtho.m14 = -((float)zfar + (float)znear)/fn; 1417 + matOrtho.m15 = 1.0f; 1418 + 1419 + *RLGL.State.currentMatrix = rlMatrixMultiply(*RLGL.State.currentMatrix, matOrtho); 1420 + } 1421 + #endif 1422 + 1423 + // Set the viewport area (transformation from normalized device coordinates to window coordinates) 1424 + void rlViewport(int x, int y, int width, int height) 1425 + { 1426 + glViewport(x, y, width, height); 1427 + } 1428 + 1429 + // Set clip planes distances 1430 + void rlSetClipPlanes(double nearPlane, double farPlane) 1431 + { 1432 + rlCullDistanceNear = nearPlane; 1433 + rlCullDistanceFar = farPlane; 1434 + } 1435 + 1436 + // Get cull plane distance near 1437 + double rlGetCullDistanceNear(void) 1438 + { 1439 + return rlCullDistanceNear; 1440 + } 1441 + 1442 + // Get cull plane distance far 1443 + double rlGetCullDistanceFar(void) 1444 + { 1445 + return rlCullDistanceFar; 1446 + } 1447 + 1448 + //---------------------------------------------------------------------------------- 1449 + // Module Functions Definition - Vertex level operations 1450 + //---------------------------------------------------------------------------------- 1451 + #if defined(GRAPHICS_API_OPENGL_11) 1452 + // Fallback to OpenGL 1.1 function calls 1453 + //--------------------------------------- 1454 + void rlBegin(int mode) 1455 + { 1456 + switch (mode) 1457 + { 1458 + case RL_LINES: glBegin(GL_LINES); break; 1459 + case RL_TRIANGLES: glBegin(GL_TRIANGLES); break; 1460 + case RL_QUADS: glBegin(GL_QUADS); break; 1461 + default: break; 1462 + } 1463 + } 1464 + 1465 + void rlEnd(void) { glEnd(); } 1466 + void rlVertex2i(int x, int y) { glVertex2i(x, y); } 1467 + void rlVertex2f(float x, float y) { glVertex2f(x, y); } 1468 + void rlVertex3f(float x, float y, float z) { glVertex3f(x, y, z); } 1469 + void rlTexCoord2f(float x, float y) { glTexCoord2f(x, y); } 1470 + void rlNormal3f(float x, float y, float z) { glNormal3f(x, y, z); } 1471 + void rlColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a) { glColor4ub(r, g, b, a); } 1472 + void rlColor3f(float x, float y, float z) { glColor3f(x, y, z); } 1473 + void rlColor4f(float x, float y, float z, float w) { glColor4f(x, y, z, w); } 1474 + #endif 1475 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 1476 + // Initialize drawing mode (how to organize vertex) 1477 + void rlBegin(int mode) 1478 + { 1479 + // Draw mode can be RL_LINES, RL_TRIANGLES and RL_QUADS 1480 + // NOTE: In all three cases, vertex are accumulated over default internal vertex buffer 1481 + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode != mode) 1482 + { 1483 + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount > 0) 1484 + { 1485 + // Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4, 1486 + // that way, following QUADS drawing will keep aligned with index processing 1487 + // It implies adding some extra alignment vertex at the end of the draw, 1488 + // those vertex are not processed but they are considered as an additional offset 1489 + // for the next set of vertex to be drawn 1490 + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4); 1491 + else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_TRIANGLES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? 1 : (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4))); 1492 + else RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = 0; 1493 + 1494 + if (!rlCheckRenderBatchLimit(RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment)) 1495 + { 1496 + RLGL.State.vertexCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment; 1497 + RLGL.currentBatch->drawCounter++; 1498 + } 1499 + } 1500 + 1501 + if (RLGL.currentBatch->drawCounter >= RL_DEFAULT_BATCH_DRAWCALLS) rlDrawRenderBatch(RLGL.currentBatch); 1502 + 1503 + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = mode; 1504 + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = RLGL.State.currentTextureId; 1505 + RLGL.State.currentTextureId = RLGL.State.defaultTextureId; 1506 + } 1507 + } 1508 + 1509 + // Finish vertex providing 1510 + void rlEnd(void) 1511 + { 1512 + // NOTE: Depth increment is dependent on rlOrtho(): z-near and z-far values, 1513 + // as well as depth buffer bit-depth (16bit or 24bit or 32bit) 1514 + // Correct increment formula would be: depthInc = (zfar - znear)/pow(2, bits) 1515 + RLGL.currentBatch->currentDepth += (1.0f/20000.0f); 1516 + } 1517 + 1518 + // Define one vertex (position) 1519 + // NOTE: Vertex position data is the basic information required for drawing 1520 + void rlVertex3f(float x, float y, float z) 1521 + { 1522 + float tx = x; 1523 + float ty = y; 1524 + float tz = z; 1525 + 1526 + // Transform provided vector if required 1527 + if (RLGL.State.transformRequired) 1528 + { 1529 + tx = RLGL.State.transform.m0*x + RLGL.State.transform.m4*y + RLGL.State.transform.m8*z + RLGL.State.transform.m12; 1530 + ty = RLGL.State.transform.m1*x + RLGL.State.transform.m5*y + RLGL.State.transform.m9*z + RLGL.State.transform.m13; 1531 + tz = RLGL.State.transform.m2*x + RLGL.State.transform.m6*y + RLGL.State.transform.m10*z + RLGL.State.transform.m14; 1532 + } 1533 + 1534 + // WARNING: Be careful with primitives breaking when launching a new batch! 1535 + // RL_LINES comes in pairs, RL_TRIANGLES come in groups of 3 vertices and RL_QUADS come in groups of 4 vertices 1536 + // Checking current draw.mode when a new vertex is required and finish the batch only if the draw.mode draw.vertexCount is %2, %3 or %4 1537 + if (RLGL.State.vertexCounter > (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4 - 4)) 1538 + { 1539 + if ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) && 1540 + (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%2 == 0)) 1541 + { 1542 + // Reached the maximum number of vertices for RL_LINES drawing 1543 + // Launch a draw call but keep current state for next vertices comming 1544 + // NOTE: Adding +1 vertex to the check for some safety 1545 + rlCheckRenderBatchLimit(2 + 1); 1546 + } 1547 + else if ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_TRIANGLES) && 1548 + (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%3 == 0)) 1549 + { 1550 + rlCheckRenderBatchLimit(3 + 1); 1551 + } 1552 + else if ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_QUADS) && 1553 + (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4 == 0)) 1554 + { 1555 + rlCheckRenderBatchLimit(4 + 1); 1556 + } 1557 + } 1558 + 1559 + // Add vertices 1560 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.State.vertexCounter] = tx; 1561 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.State.vertexCounter + 1] = ty; 1562 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.State.vertexCounter + 2] = tz; 1563 + 1564 + // Add current texcoord 1565 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].texcoords[2*RLGL.State.vertexCounter] = RLGL.State.texcoordx; 1566 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].texcoords[2*RLGL.State.vertexCounter + 1] = RLGL.State.texcoordy; 1567 + 1568 + // Add current normal 1569 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].normals[3*RLGL.State.vertexCounter] = RLGL.State.normalx; 1570 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].normals[3*RLGL.State.vertexCounter + 1] = RLGL.State.normaly; 1571 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].normals[3*RLGL.State.vertexCounter + 2] = RLGL.State.normalz; 1572 + 1573 + // Add current color 1574 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].colors[4*RLGL.State.vertexCounter] = RLGL.State.colorr; 1575 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].colors[4*RLGL.State.vertexCounter + 1] = RLGL.State.colorg; 1576 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].colors[4*RLGL.State.vertexCounter + 2] = RLGL.State.colorb; 1577 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].colors[4*RLGL.State.vertexCounter + 3] = RLGL.State.colora; 1578 + 1579 + RLGL.State.vertexCounter++; 1580 + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount++; 1581 + } 1582 + 1583 + // Define one vertex (position) 1584 + void rlVertex2f(float x, float y) 1585 + { 1586 + rlVertex3f(x, y, RLGL.currentBatch->currentDepth); 1587 + } 1588 + 1589 + // Define one vertex (position) 1590 + void rlVertex2i(int x, int y) 1591 + { 1592 + rlVertex3f((float)x, (float)y, RLGL.currentBatch->currentDepth); 1593 + } 1594 + 1595 + // Define one vertex (texture coordinate) 1596 + // NOTE: Texture coordinates are limited to QUADS only 1597 + void rlTexCoord2f(float x, float y) 1598 + { 1599 + RLGL.State.texcoordx = x; 1600 + RLGL.State.texcoordy = y; 1601 + } 1602 + 1603 + // Define one vertex (normal) 1604 + // NOTE: Normals limited to TRIANGLES only? 1605 + void rlNormal3f(float x, float y, float z) 1606 + { 1607 + float normalx = x; 1608 + float normaly = y; 1609 + float normalz = z; 1610 + if (RLGL.State.transformRequired) 1611 + { 1612 + normalx = RLGL.State.transform.m0*x + RLGL.State.transform.m4*y + RLGL.State.transform.m8*z; 1613 + normaly = RLGL.State.transform.m1*x + RLGL.State.transform.m5*y + RLGL.State.transform.m9*z; 1614 + normalz = RLGL.State.transform.m2*x + RLGL.State.transform.m6*y + RLGL.State.transform.m10*z; 1615 + } 1616 + 1617 + // NOTE: Default behavior assumes the normal vector is in the correct space for what the shader expects, 1618 + // it could be not normalized to 0.0f..1.0f, magnitud can be useed for some effects 1619 + /* 1620 + // WARNING: Vector normalization if required 1621 + float length = sqrtf(normalx*normalx + normaly*normaly + normalz*normalz); 1622 + if (length != 0.0f) 1623 + { 1624 + float ilength = 1.0f/length; 1625 + normalx *= ilength; 1626 + normaly *= ilength; 1627 + normalz *= ilength; 1628 + } 1629 + */ 1630 + RLGL.State.normalx = normalx; 1631 + RLGL.State.normaly = normaly; 1632 + RLGL.State.normalz = normalz; 1633 + } 1634 + 1635 + // Define one vertex (color) 1636 + void rlColor4ub(unsigned char x, unsigned char y, unsigned char z, unsigned char w) 1637 + { 1638 + RLGL.State.colorr = x; 1639 + RLGL.State.colorg = y; 1640 + RLGL.State.colorb = z; 1641 + RLGL.State.colora = w; 1642 + } 1643 + 1644 + // Define one vertex (color) 1645 + void rlColor4f(float r, float g, float b, float a) 1646 + { 1647 + rlColor4ub((unsigned char)(r*255), (unsigned char)(g*255), (unsigned char)(b*255), (unsigned char)(a*255)); 1648 + } 1649 + 1650 + // Define one vertex (color) 1651 + void rlColor3f(float x, float y, float z) 1652 + { 1653 + rlColor4ub((unsigned char)(x*255), (unsigned char)(y*255), (unsigned char)(z*255), 255); 1654 + } 1655 + 1656 + #endif 1657 + 1658 + //-------------------------------------------------------------------------------------- 1659 + // Module Functions Definition - OpenGL style functions (common to 1.1, 3.3+, ES2) 1660 + //-------------------------------------------------------------------------------------- 1661 + 1662 + // Set current texture to use 1663 + void rlSetTexture(unsigned int id) 1664 + { 1665 + if (id == 0) 1666 + { 1667 + #if defined(GRAPHICS_API_OPENGL_11) 1668 + rlDisableTexture(); 1669 + #else 1670 + // NOTE: If quads batch limit is reached, force a draw call and next batch starts 1671 + if (RLGL.State.vertexCounter >= 1672 + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4) 1673 + { 1674 + rlDrawRenderBatch(RLGL.currentBatch); 1675 + } 1676 + RLGL.State.currentTextureId = RLGL.State.defaultTextureId; 1677 + #endif 1678 + } 1679 + else 1680 + { 1681 + #if defined(GRAPHICS_API_OPENGL_11) 1682 + rlEnableTexture(id); 1683 + #else 1684 + RLGL.State.currentTextureId = id; 1685 + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId != id) 1686 + { 1687 + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount > 0) 1688 + { 1689 + // Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4, 1690 + // that way, following QUADS drawing will keep aligned with index processing 1691 + // It implies adding some extra alignment vertex at the end of the draw, 1692 + // those vertex are not processed but they are considered as an additional offset 1693 + // for the next set of vertex to be drawn 1694 + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4); 1695 + else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_TRIANGLES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? 1 : (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4))); 1696 + else RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = 0; 1697 + 1698 + if (!rlCheckRenderBatchLimit(RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment)) 1699 + { 1700 + RLGL.State.vertexCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment; 1701 + 1702 + RLGL.currentBatch->drawCounter++; 1703 + 1704 + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 2].mode; 1705 + 1706 + } 1707 + } 1708 + 1709 + if (RLGL.currentBatch->drawCounter >= RL_DEFAULT_BATCH_DRAWCALLS) rlDrawRenderBatch(RLGL.currentBatch); 1710 + 1711 + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = id; 1712 + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount = 0; 1713 + } 1714 + #endif 1715 + } 1716 + } 1717 + 1718 + // Select and active a texture slot 1719 + void rlActiveTextureSlot(int slot) 1720 + { 1721 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 1722 + glActiveTexture(GL_TEXTURE0 + slot); 1723 + #endif 1724 + } 1725 + 1726 + // Enable texture 1727 + void rlEnableTexture(unsigned int id) 1728 + { 1729 + #if defined(GRAPHICS_API_OPENGL_11) 1730 + glEnable(GL_TEXTURE_2D); 1731 + #endif 1732 + glBindTexture(GL_TEXTURE_2D, id); 1733 + } 1734 + 1735 + // Disable texture 1736 + void rlDisableTexture(void) 1737 + { 1738 + #if defined(GRAPHICS_API_OPENGL_11) 1739 + glDisable(GL_TEXTURE_2D); 1740 + #endif 1741 + glBindTexture(GL_TEXTURE_2D, 0); 1742 + } 1743 + 1744 + // Enable texture cubemap 1745 + void rlEnableTextureCubemap(unsigned int id) 1746 + { 1747 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 1748 + glBindTexture(GL_TEXTURE_CUBE_MAP, id); 1749 + #endif 1750 + } 1751 + 1752 + // Disable texture cubemap 1753 + void rlDisableTextureCubemap(void) 1754 + { 1755 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 1756 + glBindTexture(GL_TEXTURE_CUBE_MAP, 0); 1757 + #endif 1758 + } 1759 + 1760 + // Set texture parameters (wrap mode/filter mode) 1761 + void rlTextureParameters(unsigned int id, int param, int value) 1762 + { 1763 + glBindTexture(GL_TEXTURE_2D, id); 1764 + 1765 + switch (param) 1766 + { 1767 + case RL_TEXTURE_WRAP_S: 1768 + case RL_TEXTURE_WRAP_T: 1769 + { 1770 + if (value == RL_TEXTURE_WRAP_MIRROR_CLAMP) 1771 + { 1772 + #if !defined(GRAPHICS_API_OPENGL_11) 1773 + if (RLGL.ExtSupported.texMirrorClamp) glTexParameteri(GL_TEXTURE_2D, param, value); 1774 + else TRACELOG(RL_LOG_WARNING, "GL: Clamp mirror wrap mode not supported (GL_MIRROR_CLAMP_EXT)"); 1775 + #endif 1776 + } 1777 + else glTexParameteri(GL_TEXTURE_2D, param, value); 1778 + } break; 1779 + case RL_TEXTURE_MAG_FILTER: 1780 + case RL_TEXTURE_MIN_FILTER: glTexParameteri(GL_TEXTURE_2D, param, value); break; 1781 + case RL_TEXTURE_FILTER_ANISOTROPIC: 1782 + { 1783 + #if !defined(GRAPHICS_API_OPENGL_11) 1784 + // Reset anisotropy filter, in case it was set 1785 + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f); 1786 + 1787 + if (value <= RLGL.ExtSupported.maxAnisotropyLevel) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)value); 1788 + else if (RLGL.ExtSupported.maxAnisotropyLevel > 0.0f) 1789 + { 1790 + TRACELOG(RL_LOG_WARNING, "GL: Maximum anisotropic filter level supported is %iX", id, (int)RLGL.ExtSupported.maxAnisotropyLevel); 1791 + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)value); 1792 + } 1793 + else TRACELOG(RL_LOG_WARNING, "GL: Anisotropic filtering not supported"); 1794 + #endif 1795 + } break; 1796 + #if defined(GRAPHICS_API_OPENGL_33) 1797 + case RL_TEXTURE_MIPMAP_BIAS_RATIO: glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, value/100.0f); 1798 + #endif 1799 + default: break; 1800 + } 1801 + 1802 + glBindTexture(GL_TEXTURE_2D, 0); 1803 + } 1804 + 1805 + // Set cubemap parameters (wrap mode/filter mode) 1806 + void rlCubemapParameters(unsigned int id, int param, int value) 1807 + { 1808 + #if !defined(GRAPHICS_API_OPENGL_11) 1809 + glBindTexture(GL_TEXTURE_CUBE_MAP, id); 1810 + 1811 + // Reset anisotropy filter, in case it was set 1812 + glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f); 1813 + 1814 + switch (param) 1815 + { 1816 + case RL_TEXTURE_WRAP_S: 1817 + case RL_TEXTURE_WRAP_T: 1818 + { 1819 + if (value == RL_TEXTURE_WRAP_MIRROR_CLAMP) 1820 + { 1821 + if (RLGL.ExtSupported.texMirrorClamp) glTexParameteri(GL_TEXTURE_CUBE_MAP, param, value); 1822 + else TRACELOG(RL_LOG_WARNING, "GL: Clamp mirror wrap mode not supported (GL_MIRROR_CLAMP_EXT)"); 1823 + } 1824 + else glTexParameteri(GL_TEXTURE_CUBE_MAP, param, value); 1825 + } break; 1826 + case RL_TEXTURE_MAG_FILTER: 1827 + case RL_TEXTURE_MIN_FILTER: glTexParameteri(GL_TEXTURE_CUBE_MAP, param, value); break; 1828 + case RL_TEXTURE_FILTER_ANISOTROPIC: 1829 + { 1830 + if (value <= RLGL.ExtSupported.maxAnisotropyLevel) glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)value); 1831 + else if (RLGL.ExtSupported.maxAnisotropyLevel > 0.0f) 1832 + { 1833 + TRACELOG(RL_LOG_WARNING, "GL: Maximum anisotropic filter level supported is %iX", id, (int)RLGL.ExtSupported.maxAnisotropyLevel); 1834 + glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)value); 1835 + } 1836 + else TRACELOG(RL_LOG_WARNING, "GL: Anisotropic filtering not supported"); 1837 + } break; 1838 + #if defined(GRAPHICS_API_OPENGL_33) 1839 + case RL_TEXTURE_MIPMAP_BIAS_RATIO: glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_LOD_BIAS, value/100.0f); 1840 + #endif 1841 + default: break; 1842 + } 1843 + 1844 + glBindTexture(GL_TEXTURE_CUBE_MAP, 0); 1845 + #endif 1846 + } 1847 + 1848 + // Enable shader program 1849 + void rlEnableShader(unsigned int id) 1850 + { 1851 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) 1852 + glUseProgram(id); 1853 + #endif 1854 + } 1855 + 1856 + // Disable shader program 1857 + void rlDisableShader(void) 1858 + { 1859 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) 1860 + glUseProgram(0); 1861 + #endif 1862 + } 1863 + 1864 + // Enable rendering to texture (fbo) 1865 + void rlEnableFramebuffer(unsigned int id) 1866 + { 1867 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_SOFTWARE)) 1868 + glBindFramebuffer(GL_FRAMEBUFFER, id); 1869 + #endif 1870 + } 1871 + 1872 + // return the active render texture (fbo) 1873 + unsigned int rlGetActiveFramebuffer(void) 1874 + { 1875 + GLint fboId = 0; 1876 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES3) || defined(GRAPHICS_API_OPENGL_SOFTWARE)) 1877 + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &fboId); 1878 + #endif 1879 + return fboId; 1880 + } 1881 + 1882 + // Disable rendering to texture 1883 + void rlDisableFramebuffer(void) 1884 + { 1885 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_SOFTWARE)) 1886 + glBindFramebuffer(GL_FRAMEBUFFER, 0); 1887 + #endif 1888 + } 1889 + 1890 + // Blit active framebuffer to main framebuffer 1891 + void rlBlitFramebuffer(int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY, int dstWidth, int dstHeight, int bufferMask) 1892 + { 1893 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES3)) 1894 + glBlitFramebuffer(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask, GL_NEAREST); 1895 + #endif 1896 + } 1897 + 1898 + // Bind framebuffer object (fbo) 1899 + void rlBindFramebuffer(unsigned int target, unsigned int framebuffer) 1900 + { 1901 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_SOFTWARE)) 1902 + glBindFramebuffer(target, framebuffer); 1903 + #endif 1904 + } 1905 + 1906 + // Activate multiple draw color buffers 1907 + // NOTE: One color buffer is always active by default 1908 + void rlActiveDrawBuffers(int count) 1909 + { 1910 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES3)) 1911 + // NOTE: Maximum number of draw buffers supported is implementation dependent, 1912 + // it can be queried with glGet*() but it must be at least 8 1913 + //GLint maxDrawBuffers = 0; 1914 + //glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); 1915 + 1916 + if (count > 0) 1917 + { 1918 + if (count > 8) TRACELOG(RL_LOG_WARNING, "GL: Max color buffers limited to 8"); 1919 + else 1920 + { 1921 + unsigned int buffers[8] = { 1922 + GL_COLOR_ATTACHMENT0, 1923 + GL_COLOR_ATTACHMENT1, 1924 + GL_COLOR_ATTACHMENT2, 1925 + GL_COLOR_ATTACHMENT3, 1926 + GL_COLOR_ATTACHMENT4, 1927 + GL_COLOR_ATTACHMENT5, 1928 + GL_COLOR_ATTACHMENT6, 1929 + GL_COLOR_ATTACHMENT7, 1930 + }; 1931 + 1932 + glDrawBuffers(count, buffers); 1933 + } 1934 + } 1935 + else TRACELOG(RL_LOG_WARNING, "GL: One color buffer active by default"); 1936 + #endif 1937 + } 1938 + 1939 + //---------------------------------------------------------------------------------- 1940 + // General render state configuration 1941 + //---------------------------------------------------------------------------------- 1942 + 1943 + // Enable color blending 1944 + void rlEnableColorBlend(void) { glEnable(GL_BLEND); } 1945 + 1946 + // Disable color blending 1947 + void rlDisableColorBlend(void) { glDisable(GL_BLEND); } 1948 + 1949 + // Enable depth test 1950 + void rlEnableDepthTest(void) { glEnable(GL_DEPTH_TEST); } 1951 + 1952 + // Disable depth test 1953 + void rlDisableDepthTest(void) { glDisable(GL_DEPTH_TEST); } 1954 + 1955 + // Enable depth write 1956 + void rlEnableDepthMask(void) { glDepthMask(GL_TRUE); } 1957 + 1958 + // Disable depth write 1959 + void rlDisableDepthMask(void) { glDepthMask(GL_FALSE); } 1960 + 1961 + // Enable backface culling 1962 + void rlEnableBackfaceCulling(void) { glEnable(GL_CULL_FACE); } 1963 + 1964 + // Disable backface culling 1965 + void rlDisableBackfaceCulling(void) { glDisable(GL_CULL_FACE); } 1966 + 1967 + // Set color mask active for screen read/draw 1968 + void rlColorMask(bool r, bool g, bool b, bool a) { glColorMask(r, g, b, a); } 1969 + 1970 + // Set face culling mode 1971 + void rlSetCullFace(int mode) 1972 + { 1973 + switch (mode) 1974 + { 1975 + case RL_CULL_FACE_BACK: glCullFace(GL_BACK); break; 1976 + case RL_CULL_FACE_FRONT: glCullFace(GL_FRONT); break; 1977 + default: break; 1978 + } 1979 + } 1980 + 1981 + // Enable scissor test 1982 + void rlEnableScissorTest(void) { glEnable(GL_SCISSOR_TEST); } 1983 + 1984 + // Disable scissor test 1985 + void rlDisableScissorTest(void) { glDisable(GL_SCISSOR_TEST); } 1986 + 1987 + // Scissor test 1988 + void rlScissor(int x, int y, int width, int height) { glScissor(x, y, width, height); } 1989 + 1990 + // Enable wire mode 1991 + void rlEnableWireMode(void) 1992 + { 1993 + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) 1994 + // NOTE: glPolygonMode() not available on OpenGL ES 1995 + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 1996 + #endif 1997 + } 1998 + 1999 + // Disable wire mode 2000 + void rlDisableWireMode(void) 2001 + { 2002 + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) 2003 + // NOTE: glPolygonMode() not available on OpenGL ES 2004 + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 2005 + #endif 2006 + } 2007 + 2008 + // Enable point mode 2009 + void rlEnablePointMode(void) 2010 + { 2011 + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) 2012 + // NOTE: glPolygonMode() not available on OpenGL ES 2013 + glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); 2014 + glEnable(GL_PROGRAM_POINT_SIZE); 2015 + #endif 2016 + } 2017 + 2018 + // Disable point mode 2019 + void rlDisablePointMode(void) 2020 + { 2021 + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) 2022 + // NOTE: glPolygonMode() not available on OpenGL ES 2023 + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 2024 + #endif 2025 + } 2026 + 2027 + // Set the line drawing width 2028 + void rlSetLineWidth(float width) { glLineWidth(width); } 2029 + 2030 + // Get the line drawing width 2031 + float rlGetLineWidth(void) 2032 + { 2033 + float width = 0; 2034 + glGetFloatv(GL_LINE_WIDTH, &width); 2035 + return width; 2036 + } 2037 + 2038 + // Set the point drawing size 2039 + void rlSetPointSize(float size) 2040 + { 2041 + #if defined(GRAPHICS_API_OPENGL_11) 2042 + glPointSize(size); 2043 + #endif 2044 + } 2045 + 2046 + // Get the point drawing size 2047 + float rlGetPointSize(void) 2048 + { 2049 + float size = 1; 2050 + #if defined(GRAPHICS_API_OPENGL_11) 2051 + glGetFloatv(GL_POINT_SIZE, &size); 2052 + #endif 2053 + return size; 2054 + 2055 + } 2056 + 2057 + // Enable line aliasing 2058 + void rlEnableSmoothLines(void) 2059 + { 2060 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_11) 2061 + glEnable(GL_LINE_SMOOTH); 2062 + #endif 2063 + } 2064 + 2065 + // Disable line aliasing 2066 + void rlDisableSmoothLines(void) 2067 + { 2068 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_11) 2069 + glDisable(GL_LINE_SMOOTH); 2070 + #endif 2071 + } 2072 + 2073 + // Enable stereo rendering 2074 + void rlEnableStereoRender(void) 2075 + { 2076 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) 2077 + RLGL.State.stereoRender = true; 2078 + #endif 2079 + } 2080 + 2081 + // Disable stereo rendering 2082 + void rlDisableStereoRender(void) 2083 + { 2084 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) 2085 + RLGL.State.stereoRender = false; 2086 + #endif 2087 + } 2088 + 2089 + // Check if stereo render is enabled 2090 + bool rlIsStereoRenderEnabled(void) 2091 + { 2092 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) 2093 + return RLGL.State.stereoRender; 2094 + #else 2095 + return false; 2096 + #endif 2097 + } 2098 + 2099 + // Clear color buffer with color 2100 + void rlClearColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a) 2101 + { 2102 + // Color values clamp to 0.0f(0) and 1.0f(255) 2103 + float cr = (float)r/255; 2104 + float cg = (float)g/255; 2105 + float cb = (float)b/255; 2106 + float ca = (float)a/255; 2107 + 2108 + glClearColor(cr, cg, cb, ca); 2109 + } 2110 + 2111 + // Clear used screen buffers (color and depth) 2112 + void rlClearScreenBuffers(void) 2113 + { 2114 + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear used buffers: Color and Depth (Depth is used for 3D) 2115 + //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // Stencil buffer not used... 2116 + } 2117 + 2118 + // Check and log OpenGL error codes 2119 + void rlCheckErrors(void) 2120 + { 2121 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2122 + int check = 1; 2123 + while (check) 2124 + { 2125 + const GLenum err = glGetError(); 2126 + switch (err) 2127 + { 2128 + case GL_NO_ERROR: check = 0; break; 2129 + case 0x0500: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_INVALID_ENUM"); break; 2130 + case 0x0501: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_INVALID_VALUE"); break; 2131 + case 0x0502: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_INVALID_OPERATION"); break; 2132 + case 0x0503: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_STACK_OVERFLOW"); break; 2133 + case 0x0504: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_STACK_UNDERFLOW"); break; 2134 + case 0x0505: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_OUT_OF_MEMORY"); break; 2135 + case 0x0506: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_INVALID_FRAMEBUFFER_OPERATION"); break; 2136 + default: TRACELOG(RL_LOG_WARNING, "GL: Error detected: Unknown error code: %x", err); break; 2137 + } 2138 + } 2139 + #endif 2140 + } 2141 + 2142 + // Set blend mode 2143 + void rlSetBlendMode(int mode) 2144 + { 2145 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2146 + if ((RLGL.State.currentBlendMode != mode) || ((mode == RL_BLEND_CUSTOM || mode == RL_BLEND_CUSTOM_SEPARATE) && RLGL.State.glCustomBlendModeModified)) 2147 + { 2148 + rlDrawRenderBatch(RLGL.currentBatch); 2149 + 2150 + switch (mode) 2151 + { 2152 + case RL_BLEND_ALPHA: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); break; 2153 + case RL_BLEND_ADDITIVE: glBlendFunc(GL_SRC_ALPHA, GL_ONE); glBlendEquation(GL_FUNC_ADD); break; 2154 + case RL_BLEND_MULTIPLIED: glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); break; 2155 + case RL_BLEND_ADD_COLORS: glBlendFunc(GL_ONE, GL_ONE); glBlendEquation(GL_FUNC_ADD); break; 2156 + case RL_BLEND_SUBTRACT_COLORS: glBlendFunc(GL_ONE, GL_ONE); glBlendEquation(GL_FUNC_SUBTRACT); break; 2157 + case RL_BLEND_ALPHA_PREMULTIPLY: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); break; 2158 + case RL_BLEND_CUSTOM: 2159 + { 2160 + // NOTE: Using GL blend src/dst factors and GL equation configured with rlSetBlendFactors() 2161 + glBlendFunc(RLGL.State.glBlendSrcFactor, RLGL.State.glBlendDstFactor); glBlendEquation(RLGL.State.glBlendEquation); 2162 + } break; 2163 + case RL_BLEND_CUSTOM_SEPARATE: 2164 + { 2165 + // NOTE: Using GL blend src/dst factors and GL equation configured with rlSetBlendFactorsSeparate() 2166 + glBlendFuncSeparate(RLGL.State.glBlendSrcFactorRGB, RLGL.State.glBlendDestFactorRGB, RLGL.State.glBlendSrcFactorAlpha, RLGL.State.glBlendDestFactorAlpha); 2167 + glBlendEquationSeparate(RLGL.State.glBlendEquationRGB, RLGL.State.glBlendEquationAlpha); 2168 + } break; 2169 + default: break; 2170 + } 2171 + 2172 + RLGL.State.currentBlendMode = mode; 2173 + RLGL.State.glCustomBlendModeModified = false; 2174 + } 2175 + #endif 2176 + } 2177 + 2178 + // Set blending mode factor and equation 2179 + void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation) 2180 + { 2181 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2182 + if ((RLGL.State.glBlendSrcFactor != glSrcFactor) || 2183 + (RLGL.State.glBlendDstFactor != glDstFactor) || 2184 + (RLGL.State.glBlendEquation != glEquation)) 2185 + { 2186 + RLGL.State.glBlendSrcFactor = glSrcFactor; 2187 + RLGL.State.glBlendDstFactor = glDstFactor; 2188 + RLGL.State.glBlendEquation = glEquation; 2189 + 2190 + RLGL.State.glCustomBlendModeModified = true; 2191 + } 2192 + #endif 2193 + } 2194 + 2195 + // Set blending mode factor and equation separately for RGB and alpha 2196 + void rlSetBlendFactorsSeparate(int glSrcRGB, int glDstRGB, int glSrcAlpha, int glDstAlpha, int glEqRGB, int glEqAlpha) 2197 + { 2198 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2199 + if ((RLGL.State.glBlendSrcFactorRGB != glSrcRGB) || 2200 + (RLGL.State.glBlendDestFactorRGB != glDstRGB) || 2201 + (RLGL.State.glBlendSrcFactorAlpha != glSrcAlpha) || 2202 + (RLGL.State.glBlendDestFactorAlpha != glDstAlpha) || 2203 + (RLGL.State.glBlendEquationRGB != glEqRGB) || 2204 + (RLGL.State.glBlendEquationAlpha != glEqAlpha)) 2205 + { 2206 + RLGL.State.glBlendSrcFactorRGB = glSrcRGB; 2207 + RLGL.State.glBlendDestFactorRGB = glDstRGB; 2208 + RLGL.State.glBlendSrcFactorAlpha = glSrcAlpha; 2209 + RLGL.State.glBlendDestFactorAlpha = glDstAlpha; 2210 + RLGL.State.glBlendEquationRGB = glEqRGB; 2211 + RLGL.State.glBlendEquationAlpha = glEqAlpha; 2212 + 2213 + RLGL.State.glCustomBlendModeModified = true; 2214 + } 2215 + #endif 2216 + } 2217 + 2218 + //---------------------------------------------------------------------------------- 2219 + // Module Functions Definition - OpenGL Debug 2220 + //---------------------------------------------------------------------------------- 2221 + #if defined(GRAPHICS_API_OPENGL_43) && RLGL_ENABLE_OPENGL_DEBUG_CONTEXT 2222 + static void GLAPIENTRY rlDebugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam) 2223 + { 2224 + // Ignore non-significant error/warning codes (NVidia drivers) 2225 + // NOTE: Here there are the details with a sample output: 2226 + // - #131169 - Framebuffer detailed info: The driver allocated storage for renderbuffer 2. (severity: low) 2227 + // - #131185 - Buffer detailed info: Buffer object 1 (bound to GL_ELEMENT_ARRAY_BUFFER_ARB, usage hint is GL_ENUM_88e4) 2228 + // will use VIDEO memory as the source for buffer object operations. (severity: low) 2229 + // - #131218 - Program/shader state performance warning: Vertex shader in program 7 is being recompiled based on GL state. (severity: medium) 2230 + // - #131204 - Texture state usage warning: The texture object (0) bound to texture image unit 0 does not have 2231 + // a defined base level and cannot be used for texture mapping. (severity: low) 2232 + if ((id == 131169) || (id == 131185) || (id == 131218) || (id == 131204)) return; 2233 + 2234 + const char *msgSource = NULL; 2235 + switch (source) 2236 + { 2237 + case GL_DEBUG_SOURCE_API: msgSource = "API"; break; 2238 + case GL_DEBUG_SOURCE_WINDOW_SYSTEM: msgSource = "WINDOW_SYSTEM"; break; 2239 + case GL_DEBUG_SOURCE_SHADER_COMPILER: msgSource = "SHADER_COMPILER"; break; 2240 + case GL_DEBUG_SOURCE_THIRD_PARTY: msgSource = "THIRD_PARTY"; break; 2241 + case GL_DEBUG_SOURCE_APPLICATION: msgSource = "APPLICATION"; break; 2242 + case GL_DEBUG_SOURCE_OTHER: msgSource = "OTHER"; break; 2243 + default: break; 2244 + } 2245 + 2246 + const char *msgType = NULL; 2247 + switch (type) 2248 + { 2249 + case GL_DEBUG_TYPE_ERROR: msgType = "ERROR"; break; 2250 + case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: msgType = "DEPRECATED_BEHAVIOR"; break; 2251 + case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: msgType = "UNDEFINED_BEHAVIOR"; break; 2252 + case GL_DEBUG_TYPE_PORTABILITY: msgType = "PORTABILITY"; break; 2253 + case GL_DEBUG_TYPE_PERFORMANCE: msgType = "PERFORMANCE"; break; 2254 + case GL_DEBUG_TYPE_MARKER: msgType = "MARKER"; break; 2255 + case GL_DEBUG_TYPE_PUSH_GROUP: msgType = "PUSH_GROUP"; break; 2256 + case GL_DEBUG_TYPE_POP_GROUP: msgType = "POP_GROUP"; break; 2257 + case GL_DEBUG_TYPE_OTHER: msgType = "OTHER"; break; 2258 + default: break; 2259 + } 2260 + 2261 + const char *msgSeverity = "DEFAULT"; 2262 + switch (severity) 2263 + { 2264 + case GL_DEBUG_SEVERITY_LOW: msgSeverity = "LOW"; break; 2265 + case GL_DEBUG_SEVERITY_MEDIUM: msgSeverity = "MEDIUM"; break; 2266 + case GL_DEBUG_SEVERITY_HIGH: msgSeverity = "HIGH"; break; 2267 + case GL_DEBUG_SEVERITY_NOTIFICATION: msgSeverity = "NOTIFICATION"; break; 2268 + default: break; 2269 + } 2270 + 2271 + TRACELOG(RL_LOG_WARNING, "GL: OpenGL debug message: %s", message); 2272 + TRACELOG(RL_LOG_WARNING, " > Type: %s", msgType); 2273 + TRACELOG(RL_LOG_WARNING, " > Source = %s", msgSource); 2274 + TRACELOG(RL_LOG_WARNING, " > Severity = %s", msgSeverity); 2275 + } 2276 + #endif 2277 + 2278 + //---------------------------------------------------------------------------------- 2279 + // Module Functions Definition - rlgl functionality 2280 + //---------------------------------------------------------------------------------- 2281 + 2282 + // Initialize rlgl: OpenGL extensions, default buffers/shaders/textures, OpenGL states 2283 + void rlglInit(int width, int height) 2284 + { 2285 + isGpuReady = true; 2286 + 2287 + // Enable OpenGL debug context if requested (and supported) 2288 + #if defined(GRAPHICS_API_OPENGL_43) && RLGL_ENABLE_OPENGL_DEBUG_CONTEXT 2289 + if ((glDebugMessageCallback != NULL) && (glDebugMessageControl != NULL)) 2290 + { 2291 + glDebugMessageCallback(rlDebugMessageCallback, 0); 2292 + // glDebugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, GL_DEBUG_SEVERITY_HIGH, 0, 0, GL_TRUE); 2293 + 2294 + // Debug context options: 2295 + // - GL_DEBUG_OUTPUT - Faster version but not useful for breakpoints 2296 + // - GL_DEBUG_OUTPUT_SYNCHRONUS - Callback is in sync with errors, so a breakpoint can be placed on the callback in order to get a stacktrace for the GL error 2297 + glEnable(GL_DEBUG_OUTPUT); 2298 + glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); 2299 + } 2300 + #endif 2301 + 2302 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2303 + // Init default white texture 2304 + unsigned char pixels[4] = { 255, 255, 255, 255 }; // 1 pixel RGBA (4 bytes) 2305 + RLGL.State.defaultTextureId = rlLoadTexture(pixels, 1, 1, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1); 2306 + RLGL.State.currentTextureId = RLGL.State.defaultTextureId; 2307 + 2308 + if (RLGL.State.defaultTextureId != 0) TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Default texture loaded successfully", RLGL.State.defaultTextureId); 2309 + else TRACELOG(RL_LOG_WARNING, "TEXTURE: Failed to load default texture"); 2310 + 2311 + // Init default Shader (customized for GL 3.3 and ES2) 2312 + // Loaded: RLGL.State.defaultShaderId + RLGL.State.defaultShaderLocs 2313 + rlLoadShaderDefault(); 2314 + RLGL.State.currentShaderId = RLGL.State.defaultShaderId; 2315 + RLGL.State.currentShaderLocs = RLGL.State.defaultShaderLocs; 2316 + 2317 + // Init default vertex arrays buffers 2318 + // Simulate that the default shader has the location RL_SHADER_LOC_VERTEX_NORMAL to bind the normal buffer for the default render batch 2319 + RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL] = RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL; 2320 + RLGL.defaultBatch = rlLoadRenderBatch(RL_DEFAULT_BATCH_BUFFERS, RL_DEFAULT_BATCH_BUFFER_ELEMENTS); 2321 + RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL] = -1; 2322 + RLGL.currentBatch = &RLGL.defaultBatch; 2323 + 2324 + // Init stack matrices (emulating OpenGL 1.1) 2325 + for (int i = 0; i < RL_MAX_MATRIX_STACK_SIZE; i++) RLGL.State.stack[i] = rlMatrixIdentity(); 2326 + 2327 + // Init internal matrices 2328 + RLGL.State.transform = rlMatrixIdentity(); 2329 + RLGL.State.projection = rlMatrixIdentity(); 2330 + RLGL.State.modelview = rlMatrixIdentity(); 2331 + RLGL.State.currentMatrix = &RLGL.State.modelview; 2332 + #endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 2333 + 2334 + #if defined(GRAPHICS_API_OPENGL_SOFTWARE) 2335 + // Initialize software renderer backend 2336 + int result = swInit(width, height); 2337 + if (result == 0) 2338 + { 2339 + TRACELOG(RL_LOG_ERROR, "RLSW: Software renderer initialization failed!"); 2340 + exit(-1); 2341 + } 2342 + #endif 2343 + 2344 + // Initialize OpenGL default states 2345 + //---------------------------------------------------------- 2346 + // Init state: Depth test 2347 + glDepthFunc(GL_LEQUAL); // Type of depth testing to apply 2348 + glDisable(GL_DEPTH_TEST); // Disable depth testing for 2D (only used for 3D) 2349 + 2350 + // Init state: Blending mode 2351 + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Color blending function (how colors are mixed) 2352 + glEnable(GL_BLEND); // Enable color blending (required to work with transparencies) 2353 + 2354 + // Init state: Culling 2355 + // NOTE: All shapes/models triangles are drawn CCW 2356 + glCullFace(GL_BACK); // Cull the back face (default) 2357 + glFrontFace(GL_CCW); // Front face are defined counter clockwise (default) 2358 + glEnable(GL_CULL_FACE); // Enable backface culling 2359 + 2360 + #if defined(GRAPHICS_API_OPENGL_11) 2361 + // Init state: Color hints (deprecated in OpenGL 3.0+) 2362 + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Improve quality of color and texture coordinate interpolation 2363 + glShadeModel(GL_SMOOTH); // Smooth shading between vertex (vertex colors interpolation) 2364 + #endif 2365 + #if defined(GRAPHICS_API_OPENGL_33) 2366 + // Init state: Cubemap seamless 2367 + glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); // Seamless cubemaps (not supported on OpenGL ES 2.0) 2368 + #endif 2369 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2370 + // Store screen size into global variables 2371 + RLGL.State.framebufferWidth = width; 2372 + RLGL.State.framebufferHeight = height; 2373 + #endif 2374 + 2375 + // Init state: Color/Depth buffers clear 2376 + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set clear color (black) 2377 + glClearDepth(1.0f); // Set clear depth value (default) 2378 + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers (depth buffer required for 3D) 2379 + 2380 + TRACELOG(RL_LOG_INFO, "RLGL: Default OpenGL state initialized successfully"); 2381 + //---------------------------------------------------------- 2382 + } 2383 + 2384 + // Vertex Buffer Object deinitialization (memory free) 2385 + void rlglClose(void) 2386 + { 2387 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2388 + rlUnloadRenderBatch(RLGL.defaultBatch); 2389 + 2390 + rlUnloadShaderDefault(); // Unload default shader 2391 + 2392 + glDeleteTextures(1, &RLGL.State.defaultTextureId); // Unload default texture 2393 + TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Default texture unloaded successfully", RLGL.State.defaultTextureId); 2394 + #endif 2395 + 2396 + #if defined(GRAPHICS_API_OPENGL_SOFTWARE) 2397 + swClose(); // Unload sofware renderer resources 2398 + #endif 2399 + isGpuReady = false; 2400 + } 2401 + 2402 + // Load OpenGL extensions 2403 + // NOTE: External loader function must be provided 2404 + void rlLoadExtensions(void *loader) 2405 + { 2406 + #if defined(GRAPHICS_API_OPENGL_33) // Also defined for GRAPHICS_API_OPENGL_21 2407 + // NOTE: glad is generated and contains only required OpenGL 3.3 Core extensions (and lower versions) 2408 + if (gladLoadGL((GLADloadfunc)loader) == 0) TRACELOG(RL_LOG_WARNING, "GLAD: Cannot load OpenGL extensions"); 2409 + else TRACELOG(RL_LOG_INFO, "GLAD: OpenGL extensions loaded successfully"); 2410 + 2411 + // Get number of supported extensions 2412 + GLint numExt = 0; 2413 + glGetIntegerv(GL_NUM_EXTENSIONS, &numExt); 2414 + TRACELOG(RL_LOG_INFO, "GL: Supported extensions count: %i", numExt); 2415 + 2416 + #if RLGL_SHOW_GL_DETAILS_INFO 2417 + // Get supported extensions list 2418 + // WARNING: glGetStringi() not available on OpenGL 2.1 2419 + TRACELOG(RL_LOG_INFO, "GL: OpenGL extensions:"); 2420 + for (int i = 0; i < numExt; i++) TRACELOG(RL_LOG_INFO, " %s", glGetStringi(GL_EXTENSIONS, i)); 2421 + #endif 2422 + 2423 + #if defined(GRAPHICS_API_OPENGL_21) 2424 + // Register supported extensions flags 2425 + // Optional OpenGL 2.1 extensions 2426 + RLGL.ExtSupported.vao = GLAD_GL_ARB_vertex_array_object; 2427 + RLGL.ExtSupported.instancing = (GLAD_GL_EXT_draw_instanced && GLAD_GL_ARB_instanced_arrays); 2428 + RLGL.ExtSupported.texNPOT = GLAD_GL_ARB_texture_non_power_of_two; 2429 + RLGL.ExtSupported.texFloat32 = GLAD_GL_ARB_texture_float; 2430 + RLGL.ExtSupported.texFloat16 = GLAD_GL_ARB_texture_float; 2431 + RLGL.ExtSupported.texDepth = GLAD_GL_ARB_depth_texture; 2432 + RLGL.ExtSupported.maxDepthBits = 32; 2433 + RLGL.ExtSupported.texAnisoFilter = GLAD_GL_EXT_texture_filter_anisotropic; 2434 + RLGL.ExtSupported.texMirrorClamp = GLAD_GL_EXT_texture_mirror_clamp; 2435 + #else 2436 + // Register supported extensions flags 2437 + // OpenGL 3.3 extensions supported by default (core) 2438 + RLGL.ExtSupported.vao = true; 2439 + RLGL.ExtSupported.instancing = true; 2440 + RLGL.ExtSupported.texNPOT = true; 2441 + RLGL.ExtSupported.texFloat32 = true; 2442 + RLGL.ExtSupported.texFloat16 = true; 2443 + RLGL.ExtSupported.texDepth = true; 2444 + RLGL.ExtSupported.maxDepthBits = 32; 2445 + RLGL.ExtSupported.texAnisoFilter = true; 2446 + RLGL.ExtSupported.texMirrorClamp = true; 2447 + #endif 2448 + 2449 + // Optional OpenGL 3.3 extensions 2450 + RLGL.ExtSupported.texCompASTC = GLAD_GL_KHR_texture_compression_astc_hdr && GLAD_GL_KHR_texture_compression_astc_ldr; 2451 + RLGL.ExtSupported.texCompDXT = GLAD_GL_EXT_texture_compression_s3tc; // Texture compression: DXT 2452 + RLGL.ExtSupported.texCompETC2 = GLAD_GL_ARB_ES3_compatibility; // Texture compression: ETC2/EAC 2453 + #if defined(GRAPHICS_API_OPENGL_43) 2454 + RLGL.ExtSupported.computeShader = GLAD_GL_ARB_compute_shader; 2455 + RLGL.ExtSupported.ssbo = GLAD_GL_ARB_shader_storage_buffer_object; 2456 + #endif 2457 + 2458 + #endif // GRAPHICS_API_OPENGL_33 2459 + 2460 + #if defined(GRAPHICS_API_OPENGL_ES3) 2461 + // Register supported extensions flags 2462 + // OpenGL ES 3.0 extensions supported by default (or it should be) 2463 + RLGL.ExtSupported.vao = true; 2464 + RLGL.ExtSupported.instancing = true; 2465 + RLGL.ExtSupported.texNPOT = true; 2466 + RLGL.ExtSupported.texFloat32 = true; 2467 + RLGL.ExtSupported.texFloat16 = true; 2468 + RLGL.ExtSupported.texDepth = true; 2469 + RLGL.ExtSupported.texDepthWebGL = true; 2470 + RLGL.ExtSupported.maxDepthBits = 24; 2471 + RLGL.ExtSupported.texAnisoFilter = true; 2472 + RLGL.ExtSupported.texMirrorClamp = true; 2473 + // TODO: Check for additional OpenGL ES 3.0 supported extensions: 2474 + //RLGL.ExtSupported.texCompDXT = true; 2475 + //RLGL.ExtSupported.texCompETC1 = true; 2476 + //RLGL.ExtSupported.texCompETC2 = true; 2477 + //RLGL.ExtSupported.texCompPVRT = true; 2478 + //RLGL.ExtSupported.texCompASTC = true; 2479 + //RLGL.ExtSupported.maxAnisotropyLevel = true; 2480 + //RLGL.ExtSupported.computeShader = true; 2481 + //RLGL.ExtSupported.ssbo = true; 2482 + 2483 + #elif defined(GRAPHICS_API_OPENGL_ES2) 2484 + 2485 + #if defined(PLATFORM_DESKTOP_GLFW) || defined(PLATFORM_DESKTOP_SDL) 2486 + // TODO: Support GLAD loader for OpenGL ES 3.0 2487 + if (gladLoadGLES2((GLADloadfunc)loader) == 0) TRACELOG(RL_LOG_WARNING, "GLAD: Cannot load OpenGL ES2.0 functions"); 2488 + else TRACELOG(RL_LOG_INFO, "GLAD: OpenGL ES 2.0 loaded successfully"); 2489 + #endif 2490 + 2491 + // Get supported extensions list 2492 + GLint numExt = 0; 2493 + const char **extList = (const char **)RL_CALLOC(512, sizeof(const char *)); // Allocate 512 strings pointers (2 KB) 2494 + const char *extensions = (const char *)glGetString(GL_EXTENSIONS); // One big const string 2495 + 2496 + // NOTE: String duplication rquired because glGetString() returns a const string 2497 + int extensionsLength = (int)strlen(extensions); // Get extensions string size in bytes 2498 + char *extensionsDup = (char *)RL_CALLOC(extensionsLength + 1, sizeof(char)); // Allocate space for copy with additional EOL byte 2499 + strncpy(extensionsDup, extensions, extensionsLength); 2500 + extList[numExt] = extensionsDup; 2501 + 2502 + for (int i = 0; i < extensionsLength; i++) 2503 + { 2504 + if (extensionsDup[i] == ' ') 2505 + { 2506 + extensionsDup[i] = '\0'; 2507 + numExt++; 2508 + extList[numExt] = &extensionsDup[i + 1]; 2509 + } 2510 + } 2511 + 2512 + TRACELOG(RL_LOG_INFO, "GL: Supported extensions count: %i", numExt); 2513 + 2514 + #if RLGL_SHOW_GL_DETAILS_INFO 2515 + TRACELOG(RL_LOG_INFO, "GL: OpenGL extensions:"); 2516 + for (int i = 0; i < numExt; i++) TRACELOG(RL_LOG_INFO, " %s", extList[i]); 2517 + #endif 2518 + 2519 + // Check required extensions 2520 + for (int i = 0; i < numExt; i++) 2521 + { 2522 + // Check VAO support 2523 + // NOTE: Only check on OpenGL ES, OpenGL 3.3 has VAO support as core feature 2524 + if (strcmp(extList[i], (const char *)"GL_OES_vertex_array_object") == 0) 2525 + { 2526 + // The extension is supported by our hardware and driver, try to get related functions pointers 2527 + // NOTE: emscripten does not support VAOs natively, it uses emulation and it reduces overall performance... 2528 + glGenVertexArrays = (PFNGLGENVERTEXARRAYSOESPROC)((rlglLoadProc)loader)("glGenVertexArraysOES"); 2529 + glBindVertexArray = (PFNGLBINDVERTEXARRAYOESPROC)((rlglLoadProc)loader)("glBindVertexArrayOES"); 2530 + glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSOESPROC)((rlglLoadProc)loader)("glDeleteVertexArraysOES"); 2531 + //glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)loader("glIsVertexArrayOES"); // NOTE: Fails in WebGL, omitted 2532 + 2533 + if ((glGenVertexArrays != NULL) && (glBindVertexArray != NULL) && (glDeleteVertexArrays != NULL)) RLGL.ExtSupported.vao = true; 2534 + } 2535 + 2536 + // Check instanced rendering support 2537 + if (strstr(extList[i], (const char *)"instanced_arrays") != NULL) // Broad check for instanced_arrays 2538 + { 2539 + // Specific check 2540 + if (strcmp(extList[i], (const char *)"GL_ANGLE_instanced_arrays") == 0) // ANGLE 2541 + { 2542 + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedANGLE"); 2543 + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedANGLE"); 2544 + glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISOREXTPROC)((rlglLoadProc)loader)("glVertexAttribDivisorANGLE"); 2545 + } 2546 + else if (strcmp(extList[i], (const char *)"GL_EXT_instanced_arrays") == 0) // EXT 2547 + { 2548 + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedEXT"); 2549 + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedEXT"); 2550 + glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISOREXTPROC)((rlglLoadProc)loader)("glVertexAttribDivisorEXT"); 2551 + } 2552 + else if (strcmp(extList[i], (const char *)"GL_NV_instanced_arrays") == 0) // NVIDIA GLES 2553 + { 2554 + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedNV"); 2555 + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedNV"); 2556 + glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISOREXTPROC)((rlglLoadProc)loader)("glVertexAttribDivisorNV"); 2557 + } 2558 + 2559 + // The feature will only be marked as supported if the elements from GL_XXX_instanced_arrays are present 2560 + if ((glDrawArraysInstanced != NULL) && (glDrawElementsInstanced != NULL) && (glVertexAttribDivisor != NULL)) RLGL.ExtSupported.instancing = true; 2561 + } 2562 + else if (strstr(extList[i], (const char *)"draw_instanced") != NULL) 2563 + { 2564 + // GL_ANGLE_draw_instanced doesn't exist 2565 + if (strcmp(extList[i], (const char *)"GL_EXT_draw_instanced") == 0) 2566 + { 2567 + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedEXT"); 2568 + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedEXT"); 2569 + } 2570 + else if (strcmp(extList[i], (const char *)"GL_NV_draw_instanced") == 0) 2571 + { 2572 + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedNV"); 2573 + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedNV"); 2574 + } 2575 + 2576 + // But the functions will at least be loaded if only GL_XX_EXT_draw_instanced exist 2577 + if ((glDrawArraysInstanced != NULL) && (glDrawElementsInstanced != NULL) && (glVertexAttribDivisor != NULL)) RLGL.ExtSupported.instancing = true; 2578 + } 2579 + 2580 + // Check NPOT textures support 2581 + // NOTE: Only check on OpenGL ES, OpenGL 3.3 has NPOT textures full support as core feature 2582 + if (strcmp(extList[i], (const char *)"GL_OES_texture_npot") == 0) RLGL.ExtSupported.texNPOT = true; 2583 + 2584 + // Check texture float support 2585 + if (strcmp(extList[i], (const char *)"GL_OES_texture_float") == 0) RLGL.ExtSupported.texFloat32 = true; 2586 + if (strcmp(extList[i], (const char *)"GL_OES_texture_half_float") == 0) RLGL.ExtSupported.texFloat16 = true; 2587 + 2588 + // Check depth texture support 2589 + if (strcmp(extList[i], (const char *)"GL_OES_depth_texture") == 0) RLGL.ExtSupported.texDepth = true; 2590 + if (strcmp(extList[i], (const char *)"GL_WEBGL_depth_texture") == 0) RLGL.ExtSupported.texDepthWebGL = true; // WebGL requires unsized internal format 2591 + if (RLGL.ExtSupported.texDepthWebGL) RLGL.ExtSupported.texDepth = true; 2592 + 2593 + if (strcmp(extList[i], (const char *)"GL_OES_depth24") == 0) RLGL.ExtSupported.maxDepthBits = 24; // Not available on WebGL 2594 + if (strcmp(extList[i], (const char *)"GL_OES_depth32") == 0) RLGL.ExtSupported.maxDepthBits = 32; // Not available on WebGL 2595 + 2596 + // Check texture compression support: DXT 2597 + if ((strcmp(extList[i], (const char *)"GL_EXT_texture_compression_s3tc") == 0) || 2598 + (strcmp(extList[i], (const char *)"GL_WEBGL_compressed_texture_s3tc") == 0) || 2599 + (strcmp(extList[i], (const char *)"GL_WEBKIT_WEBGL_compressed_texture_s3tc") == 0)) RLGL.ExtSupported.texCompDXT = true; 2600 + 2601 + // Check texture compression support: ETC1 2602 + if ((strcmp(extList[i], (const char *)"GL_OES_compressed_ETC1_RGB8_texture") == 0) || 2603 + (strcmp(extList[i], (const char *)"GL_WEBGL_compressed_texture_etc1") == 0)) RLGL.ExtSupported.texCompETC1 = true; 2604 + 2605 + // Check texture compression support: ETC2/EAC 2606 + if (strcmp(extList[i], (const char *)"GL_ARB_ES3_compatibility") == 0) RLGL.ExtSupported.texCompETC2 = true; 2607 + 2608 + // Check texture compression support: PVR 2609 + if (strcmp(extList[i], (const char *)"GL_IMG_texture_compression_pvrtc") == 0) RLGL.ExtSupported.texCompPVRT = true; 2610 + 2611 + // Check texture compression support: ASTC 2612 + if (strcmp(extList[i], (const char *)"GL_KHR_texture_compression_astc_hdr") == 0) RLGL.ExtSupported.texCompASTC = true; 2613 + 2614 + // Check anisotropic texture filter support 2615 + if (strcmp(extList[i], (const char *)"GL_EXT_texture_filter_anisotropic") == 0) RLGL.ExtSupported.texAnisoFilter = true; 2616 + 2617 + // Check clamp mirror wrap mode support 2618 + if (strcmp(extList[i], (const char *)"GL_EXT_texture_mirror_clamp") == 0) RLGL.ExtSupported.texMirrorClamp = true; 2619 + } 2620 + 2621 + // Free extensions pointers 2622 + RL_FREE(extList); 2623 + RL_FREE(extensionsDup); // Duplicated string must be deallocated 2624 + #endif // GRAPHICS_API_OPENGL_ES2 2625 + 2626 + // Check OpenGL information and capabilities 2627 + //------------------------------------------------------------------------------ 2628 + // Show current OpenGL and GLSL version 2629 + TRACELOG(RL_LOG_INFO, "GL: OpenGL device information:"); 2630 + TRACELOG(RL_LOG_INFO, " > Vendor: %s", glGetString(GL_VENDOR)); 2631 + TRACELOG(RL_LOG_INFO, " > Renderer: %s", glGetString(GL_RENDERER)); 2632 + TRACELOG(RL_LOG_INFO, " > Version: %s", glGetString(GL_VERSION)); 2633 + TRACELOG(RL_LOG_INFO, " > GLSL: %s", glGetString(GL_SHADING_LANGUAGE_VERSION)); 2634 + 2635 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2636 + RLGL.loader = (rlglLoadProc)loader; 2637 + 2638 + // NOTE: Anisotropy levels capability is an extension 2639 + #ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 2640 + #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF 2641 + #endif 2642 + glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &RLGL.ExtSupported.maxAnisotropyLevel); 2643 + 2644 + #if RLGL_SHOW_GL_DETAILS_INFO 2645 + // Show some OpenGL GPU capabilities 2646 + TRACELOG(RL_LOG_INFO, "GL: OpenGL capabilities:"); 2647 + GLint capability = 0; 2648 + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &capability); 2649 + TRACELOG(RL_LOG_INFO, " GL_MAX_TEXTURE_SIZE: %i", capability); 2650 + glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &capability); 2651 + TRACELOG(RL_LOG_INFO, " GL_MAX_CUBE_MAP_TEXTURE_SIZE: %i", capability); 2652 + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &capability); 2653 + TRACELOG(RL_LOG_INFO, " GL_MAX_TEXTURE_IMAGE_UNITS: %i", capability); 2654 + glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &capability); 2655 + TRACELOG(RL_LOG_INFO, " GL_MAX_VERTEX_ATTRIBS: %i", capability); 2656 + #if !defined(GRAPHICS_API_OPENGL_ES2) 2657 + glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &capability); 2658 + TRACELOG(RL_LOG_INFO, " GL_MAX_UNIFORM_BLOCK_SIZE: %i", capability); 2659 + glGetIntegerv(GL_MAX_DRAW_BUFFERS, &capability); 2660 + TRACELOG(RL_LOG_INFO, " GL_MAX_DRAW_BUFFERS: %i", capability); 2661 + if (RLGL.ExtSupported.texAnisoFilter) TRACELOG(RL_LOG_INFO, " GL_MAX_TEXTURE_MAX_ANISOTROPY: %.0f", RLGL.ExtSupported.maxAnisotropyLevel); 2662 + #endif 2663 + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &capability); 2664 + TRACELOG(RL_LOG_INFO, " GL_NUM_COMPRESSED_TEXTURE_FORMATS: %i", capability); 2665 + GLint *compFormats = (GLint *)RL_CALLOC(capability, sizeof(GLint)); 2666 + glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, compFormats); 2667 + for (int i = 0; i < capability; i++) TRACELOG(RL_LOG_INFO, " %s", rlGetCompressedFormatName(compFormats[i])); 2668 + RL_FREE(compFormats); 2669 + 2670 + #if defined(GRAPHICS_API_OPENGL_43) 2671 + glGetIntegerv(GL_MAX_VERTEX_ATTRIB_BINDINGS, &capability); 2672 + TRACELOG(RL_LOG_INFO, " GL_MAX_VERTEX_ATTRIB_BINDINGS: %i", capability); 2673 + glGetIntegerv(GL_MAX_UNIFORM_LOCATIONS, &capability); 2674 + TRACELOG(RL_LOG_INFO, " GL_MAX_UNIFORM_LOCATIONS: %i", capability); 2675 + #endif 2676 + 2677 + #else // !RLGL_SHOW_GL_DETAILS_INFO 2678 + 2679 + // Show some basic info about GL supported features 2680 + if (RLGL.ExtSupported.vao) TRACELOG(RL_LOG_INFO, "GL: VAO extension detected, VAO functions loaded successfully"); 2681 + else TRACELOG(RL_LOG_WARNING, "GL: VAO extension not found, VAO not supported"); 2682 + if (RLGL.ExtSupported.texNPOT) TRACELOG(RL_LOG_INFO, "GL: NPOT textures extension detected, full NPOT textures supported"); 2683 + else TRACELOG(RL_LOG_WARNING, "GL: NPOT textures extension not found, limited NPOT support (no-mipmaps, no-repeat)"); 2684 + if (RLGL.ExtSupported.texCompDXT) TRACELOG(RL_LOG_INFO, "GL: DXT compressed textures supported"); 2685 + if (RLGL.ExtSupported.texCompETC1) TRACELOG(RL_LOG_INFO, "GL: ETC1 compressed textures supported"); 2686 + if (RLGL.ExtSupported.texCompETC2) TRACELOG(RL_LOG_INFO, "GL: ETC2/EAC compressed textures supported"); 2687 + if (RLGL.ExtSupported.texCompPVRT) TRACELOG(RL_LOG_INFO, "GL: PVRT compressed textures supported"); 2688 + if (RLGL.ExtSupported.texCompASTC) TRACELOG(RL_LOG_INFO, "GL: ASTC compressed textures supported"); 2689 + if (RLGL.ExtSupported.computeShader) TRACELOG(RL_LOG_INFO, "GL: Compute shaders supported"); 2690 + if (RLGL.ExtSupported.ssbo) TRACELOG(RL_LOG_INFO, "GL: Shader storage buffer objects supported"); 2691 + #endif 2692 + 2693 + #endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 2694 + } 2695 + 2696 + // Get OpenGL procedure address 2697 + void *rlGetProcAddress(const char *procName) 2698 + { 2699 + void *func = NULL; 2700 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2701 + func = RLGL.loader(procName); 2702 + #endif 2703 + return func; 2704 + } 2705 + 2706 + // Get current OpenGL version 2707 + int rlGetVersion(void) 2708 + { 2709 + int glVersion = 0; 2710 + 2711 + #if defined(GRAPHICS_API_OPENGL_SOFTWARE) 2712 + glVersion = RL_OPENGL_SOFTWARE; 2713 + #elif defined(GRAPHICS_API_OPENGL_11) 2714 + glVersion = RL_OPENGL_11; 2715 + #endif 2716 + #if defined(GRAPHICS_API_OPENGL_21) 2717 + glVersion = RL_OPENGL_21; 2718 + #elif defined(GRAPHICS_API_OPENGL_43) 2719 + glVersion = RL_OPENGL_43; 2720 + #elif defined(GRAPHICS_API_OPENGL_33) 2721 + glVersion = RL_OPENGL_33; 2722 + #endif 2723 + #if defined(GRAPHICS_API_OPENGL_ES3) 2724 + glVersion = RL_OPENGL_ES_30; 2725 + #elif defined(GRAPHICS_API_OPENGL_ES2) 2726 + glVersion = RL_OPENGL_ES_20; 2727 + #endif 2728 + 2729 + return glVersion; 2730 + } 2731 + 2732 + // Set current framebuffer width 2733 + void rlSetFramebufferWidth(int width) 2734 + { 2735 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2736 + RLGL.State.framebufferWidth = width; 2737 + #endif 2738 + } 2739 + 2740 + // Set current framebuffer height 2741 + void rlSetFramebufferHeight(int height) 2742 + { 2743 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2744 + RLGL.State.framebufferHeight = height; 2745 + #endif 2746 + } 2747 + 2748 + // Get default framebuffer width 2749 + int rlGetFramebufferWidth(void) 2750 + { 2751 + int width = 0; 2752 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2753 + width = RLGL.State.framebufferWidth; 2754 + #endif 2755 + return width; 2756 + } 2757 + 2758 + // Get default framebuffer height 2759 + int rlGetFramebufferHeight(void) 2760 + { 2761 + int height = 0; 2762 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2763 + height = RLGL.State.framebufferHeight; 2764 + #endif 2765 + return height; 2766 + } 2767 + 2768 + // Get default internal texture (white texture) 2769 + // NOTE: Default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8 2770 + unsigned int rlGetTextureIdDefault(void) 2771 + { 2772 + unsigned int id = 0; 2773 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2774 + id = RLGL.State.defaultTextureId; 2775 + #endif 2776 + return id; 2777 + } 2778 + 2779 + // Get default shader id 2780 + unsigned int rlGetShaderIdDefault(void) 2781 + { 2782 + unsigned int id = 0; 2783 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2784 + id = RLGL.State.defaultShaderId; 2785 + #endif 2786 + return id; 2787 + } 2788 + 2789 + // Get default shader locs 2790 + int *rlGetShaderLocsDefault(void) 2791 + { 2792 + int *locs = NULL; 2793 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2794 + locs = RLGL.State.defaultShaderLocs; 2795 + #endif 2796 + return locs; 2797 + } 2798 + 2799 + // Render batch management 2800 + //------------------------------------------------------------------------------------------------ 2801 + // Load render batch 2802 + rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements) 2803 + { 2804 + rlRenderBatch batch = { 0 }; 2805 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return batch; } 2806 + 2807 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2808 + // Initialize CPU (RAM) vertex buffers (position, texcoord, color data and indexes) 2809 + //-------------------------------------------------------------------------------------------- 2810 + batch.vertexBuffer = (rlVertexBuffer *)RL_CALLOC(numBuffers, sizeof(rlVertexBuffer)); 2811 + 2812 + for (int i = 0; i < numBuffers; i++) 2813 + { 2814 + batch.vertexBuffer[i].elementCount = bufferElements; 2815 + 2816 + batch.vertexBuffer[i].vertices = (float *)RL_CALLOC(bufferElements*3*4, sizeof(float)); // 3 float by vertex, 4 vertex by quad 2817 + batch.vertexBuffer[i].texcoords = (float *)RL_CALLOC(bufferElements*2*4, sizeof(float)); // 2 float by texcoord, 4 texcoord by quad 2818 + batch.vertexBuffer[i].normals = (float *)RL_CALLOC(bufferElements*3*4, sizeof(float)); // 3 float by vertex, 4 vertex by quad 2819 + batch.vertexBuffer[i].colors = (unsigned char *)RL_CALLOC(bufferElements*4*4, sizeof(unsigned char)); // 4 float by color, 4 colors by quad 2820 + #if defined(GRAPHICS_API_OPENGL_33) 2821 + batch.vertexBuffer[i].indices = (unsigned int *)RL_CALLOC(bufferElements*6, sizeof(unsigned int)); // 6 int by quad (indices) 2822 + #endif 2823 + #if defined(GRAPHICS_API_OPENGL_ES2) 2824 + batch.vertexBuffer[i].indices = (unsigned short *)RL_CALLOC(bufferElements*6, sizeof(unsigned short)); // 6 int by quad (indices) 2825 + #endif 2826 + 2827 + for (int j = 0; j < (3*4*bufferElements); j++) batch.vertexBuffer[i].vertices[j] = 0.0f; 2828 + for (int j = 0; j < (2*4*bufferElements); j++) batch.vertexBuffer[i].texcoords[j] = 0.0f; 2829 + for (int j = 0; j < (3*4*bufferElements); j++) batch.vertexBuffer[i].normals[j] = 0.0f; 2830 + for (int j = 0; j < (4*4*bufferElements); j++) batch.vertexBuffer[i].colors[j] = 0; 2831 + 2832 + int k = 0; 2833 + 2834 + // Indices can be initialized right now 2835 + for (int j = 0; j < (6*bufferElements); j += 6) 2836 + { 2837 + batch.vertexBuffer[i].indices[j] = 4*k; 2838 + batch.vertexBuffer[i].indices[j + 1] = 4*k + 1; 2839 + batch.vertexBuffer[i].indices[j + 2] = 4*k + 2; 2840 + batch.vertexBuffer[i].indices[j + 3] = 4*k; 2841 + batch.vertexBuffer[i].indices[j + 4] = 4*k + 2; 2842 + batch.vertexBuffer[i].indices[j + 5] = 4*k + 3; 2843 + 2844 + k++; 2845 + } 2846 + 2847 + RLGL.State.vertexCounter = 0; 2848 + } 2849 + 2850 + TRACELOG(RL_LOG_INFO, "RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)"); 2851 + //-------------------------------------------------------------------------------------------- 2852 + 2853 + // Upload to GPU (VRAM) vertex data and initialize VAOs/VBOs 2854 + //-------------------------------------------------------------------------------------------- 2855 + for (int i = 0; i < numBuffers; i++) 2856 + { 2857 + if (RLGL.ExtSupported.vao) 2858 + { 2859 + // Initialize Quads VAO 2860 + glGenVertexArrays(1, &batch.vertexBuffer[i].vaoId); 2861 + glBindVertexArray(batch.vertexBuffer[i].vaoId); 2862 + } 2863 + 2864 + // Quads - Vertex buffers binding and attributes enable 2865 + // Vertex position buffer (shader-location = 0) 2866 + glGenBuffers(1, &batch.vertexBuffer[i].vboId[0]); 2867 + glBindBuffer(GL_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[0]); 2868 + glBufferData(GL_ARRAY_BUFFER, bufferElements*3*4*sizeof(float), batch.vertexBuffer[i].vertices, GL_DYNAMIC_DRAW); 2869 + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_POSITION]); 2870 + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_POSITION], 3, GL_FLOAT, 0, 0, 0); 2871 + 2872 + // Vertex texcoord buffer (shader-location = 1) 2873 + glGenBuffers(1, &batch.vertexBuffer[i].vboId[1]); 2874 + glBindBuffer(GL_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[1]); 2875 + glBufferData(GL_ARRAY_BUFFER, bufferElements*2*4*sizeof(float), batch.vertexBuffer[i].texcoords, GL_DYNAMIC_DRAW); 2876 + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01]); 2877 + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01], 2, GL_FLOAT, 0, 0, 0); 2878 + 2879 + // Vertex normal buffer (shader-location = 2) 2880 + glGenBuffers(1, &batch.vertexBuffer[i].vboId[2]); 2881 + glBindBuffer(GL_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[2]); 2882 + glBufferData(GL_ARRAY_BUFFER, bufferElements*3*4*sizeof(float), batch.vertexBuffer[i].normals, GL_DYNAMIC_DRAW); 2883 + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL]); 2884 + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL], 3, GL_FLOAT, 0, 0, 0); 2885 + 2886 + // Vertex color buffer (shader-location = 3) 2887 + glGenBuffers(1, &batch.vertexBuffer[i].vboId[3]); 2888 + glBindBuffer(GL_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[3]); 2889 + glBufferData(GL_ARRAY_BUFFER, bufferElements*4*4*sizeof(unsigned char), batch.vertexBuffer[i].colors, GL_DYNAMIC_DRAW); 2890 + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_COLOR]); 2891 + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_COLOR], 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, 0); 2892 + 2893 + // Fill index buffer 2894 + glGenBuffers(1, &batch.vertexBuffer[i].vboId[4]); 2895 + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[4]); 2896 + #if defined(GRAPHICS_API_OPENGL_33) 2897 + glBufferData(GL_ELEMENT_ARRAY_BUFFER, bufferElements*6*sizeof(int), batch.vertexBuffer[i].indices, GL_STATIC_DRAW); 2898 + #endif 2899 + #if defined(GRAPHICS_API_OPENGL_ES2) 2900 + glBufferData(GL_ELEMENT_ARRAY_BUFFER, bufferElements*6*sizeof(short), batch.vertexBuffer[i].indices, GL_STATIC_DRAW); 2901 + #endif 2902 + } 2903 + 2904 + TRACELOG(RL_LOG_INFO, "RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)"); 2905 + 2906 + // Unbind the current VAO 2907 + if (RLGL.ExtSupported.vao) glBindVertexArray(0); 2908 + //-------------------------------------------------------------------------------------------- 2909 + 2910 + // Init draw calls tracking system 2911 + //-------------------------------------------------------------------------------------------- 2912 + batch.draws = (rlDrawCall *)RL_CALLOC(RL_DEFAULT_BATCH_DRAWCALLS, sizeof(rlDrawCall)); 2913 + 2914 + for (int i = 0; i < RL_DEFAULT_BATCH_DRAWCALLS; i++) 2915 + { 2916 + batch.draws[i].mode = RL_QUADS; 2917 + batch.draws[i].vertexCount = 0; 2918 + batch.draws[i].vertexAlignment = 0; 2919 + //batch.draws[i].vaoId = 0; 2920 + //batch.draws[i].shaderId = 0; 2921 + batch.draws[i].textureId = RLGL.State.defaultTextureId; 2922 + //batch.draws[i].RLGL.State.projection = rlMatrixIdentity(); 2923 + //batch.draws[i].RLGL.State.modelview = rlMatrixIdentity(); 2924 + } 2925 + 2926 + batch.bufferCount = numBuffers; // Record buffer count 2927 + batch.drawCounter = 1; // Reset draws counter 2928 + batch.currentDepth = -1.0f; // Reset depth value 2929 + //-------------------------------------------------------------------------------------------- 2930 + #endif 2931 + 2932 + return batch; 2933 + } 2934 + 2935 + // Unload default internal buffers vertex data from CPU and GPU 2936 + void rlUnloadRenderBatch(rlRenderBatch batch) 2937 + { 2938 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2939 + // Unbind everything 2940 + glBindBuffer(GL_ARRAY_BUFFER, 0); 2941 + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); 2942 + 2943 + // Unload all vertex buffers data 2944 + for (int i = 0; i < batch.bufferCount; i++) 2945 + { 2946 + // Unbind VAO attribs data 2947 + if (RLGL.ExtSupported.vao) 2948 + { 2949 + glBindVertexArray(batch.vertexBuffer[i].vaoId); 2950 + glDisableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION); 2951 + glDisableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD); 2952 + glDisableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL); 2953 + glDisableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR); 2954 + glBindVertexArray(0); 2955 + } 2956 + 2957 + // Delete VBOs from GPU (VRAM) 2958 + glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[0]); 2959 + glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[1]); 2960 + glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[2]); 2961 + glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[3]); 2962 + glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[4]); 2963 + 2964 + // Delete VAOs from GPU (VRAM) 2965 + if (RLGL.ExtSupported.vao) glDeleteVertexArrays(1, &batch.vertexBuffer[i].vaoId); 2966 + 2967 + // Free vertex arrays memory from CPU (RAM) 2968 + RL_FREE(batch.vertexBuffer[i].vertices); 2969 + RL_FREE(batch.vertexBuffer[i].texcoords); 2970 + RL_FREE(batch.vertexBuffer[i].normals); 2971 + RL_FREE(batch.vertexBuffer[i].colors); 2972 + RL_FREE(batch.vertexBuffer[i].indices); 2973 + } 2974 + 2975 + // Unload arrays 2976 + RL_FREE(batch.vertexBuffer); 2977 + RL_FREE(batch.draws); 2978 + #endif 2979 + } 2980 + 2981 + // Draw render batch 2982 + // NOTE: Batch is reseted and current buffer is updated (for multi-buffer config) 2983 + void rlDrawRenderBatch(rlRenderBatch *batch) 2984 + { 2985 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 2986 + // Update batch vertex buffers 2987 + //------------------------------------------------------------------------------------------------------------ 2988 + // NOTE: If there is not vertex data, buffers doesn't need to be updated (vertexCount > 0) 2989 + if (RLGL.State.vertexCounter > 0) 2990 + { 2991 + // Activate elements VAO 2992 + if (RLGL.ExtSupported.vao) glBindVertexArray(batch->vertexBuffer[batch->currentBuffer].vaoId); 2993 + 2994 + // TODO: If no data changed on the CPU arrays there is no need to re-upload data to GPU, 2995 + // a flag can be used to detect changes but it would imply keeping a copy buffer and memcmp() both, does it worth it? 2996 + 2997 + // Vertex positions buffer 2998 + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[0]); 2999 + glBufferSubData(GL_ARRAY_BUFFER, 0, RLGL.State.vertexCounter*3*sizeof(float), batch->vertexBuffer[batch->currentBuffer].vertices); 3000 + //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*3*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].vertices, GL_DYNAMIC_DRAW); // Update all buffer 3001 + 3002 + // Texture coordinates buffer 3003 + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[1]); 3004 + glBufferSubData(GL_ARRAY_BUFFER, 0, RLGL.State.vertexCounter*2*sizeof(float), batch->vertexBuffer[batch->currentBuffer].texcoords); 3005 + //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*2*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].texcoords, GL_DYNAMIC_DRAW); // Update all buffer 3006 + 3007 + // Normals buffer 3008 + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[2]); 3009 + glBufferSubData(GL_ARRAY_BUFFER, 0, RLGL.State.vertexCounter*3*sizeof(float), batch->vertexBuffer[batch->currentBuffer].normals); 3010 + //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*3*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].normals, GL_DYNAMIC_DRAW); // Update all buffer 3011 + 3012 + // Colors buffer 3013 + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[3]); 3014 + glBufferSubData(GL_ARRAY_BUFFER, 0, RLGL.State.vertexCounter*4*sizeof(unsigned char), batch->vertexBuffer[batch->currentBuffer].colors); 3015 + //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*4*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].colors, GL_DYNAMIC_DRAW); // Update all buffer 3016 + 3017 + // NOTE: glMapBuffer() causes sync issue 3018 + // If GPU is working with this buffer, glMapBuffer() will wait(stall) until GPU to finish its job 3019 + // To avoid waiting (idle), glBufferData() can bee called first with NULL pointer before glMapBuffer() 3020 + // Doing that, the previous data in PBO will be discarded and glMapBuffer() returns a new 3021 + // allocated pointer immediately even if GPU is still working with the previous data 3022 + 3023 + // Another option: map the buffer object into client's memory 3024 + //batch->vertexBuffer[batch->currentBuffer].vertices = (float *)glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); 3025 + //if (batch->vertexBuffer[batch->currentBuffer].vertices) 3026 + //{ 3027 + // Update vertex data 3028 + //} 3029 + //glUnmapBuffer(GL_ARRAY_BUFFER); 3030 + 3031 + // Unbind the current VAO 3032 + if (RLGL.ExtSupported.vao) glBindVertexArray(0); 3033 + } 3034 + //------------------------------------------------------------------------------------------------------------ 3035 + 3036 + // Draw batch vertex buffers (considering VR stereo if required) 3037 + //------------------------------------------------------------------------------------------------------------ 3038 + Matrix matProjection = RLGL.State.projection; 3039 + Matrix matModelView = RLGL.State.modelview; 3040 + 3041 + int eyeCount = 1; 3042 + if (RLGL.State.stereoRender) eyeCount = 2; 3043 + 3044 + for (int eye = 0; eye < eyeCount; eye++) 3045 + { 3046 + if (eyeCount == 2) 3047 + { 3048 + // Setup current eye viewport (half screen width) 3049 + rlViewport(eye*RLGL.State.framebufferWidth/2, 0, RLGL.State.framebufferWidth/2, RLGL.State.framebufferHeight); 3050 + 3051 + // Set current eye view offset to modelview matrix 3052 + rlSetMatrixModelview(rlMatrixMultiply(matModelView, RLGL.State.viewOffsetStereo[eye])); 3053 + // Set current eye projection matrix 3054 + rlSetMatrixProjection(RLGL.State.projectionStereo[eye]); 3055 + } 3056 + 3057 + // Draw buffers 3058 + if (RLGL.State.vertexCounter > 0) 3059 + { 3060 + // Set current shader and upload current MVP matrix 3061 + glUseProgram(RLGL.State.currentShaderId); 3062 + 3063 + // Create modelview-projection matrix and upload to shader 3064 + Matrix matMVP = rlMatrixMultiply(RLGL.State.modelview, RLGL.State.projection); 3065 + glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_MVP], 1, false, rlMatrixToFloat(matMVP)); 3066 + 3067 + if (RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_PROJECTION] != -1) 3068 + { 3069 + glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_PROJECTION], 1, false, rlMatrixToFloat(RLGL.State.projection)); 3070 + } 3071 + 3072 + // WARNING: For the following setup of the view, model, and normal matrices, it is expected that 3073 + // transformations and rendering occur between rlPushMatrix() and rlPopMatrix() 3074 + 3075 + if (RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_VIEW] != -1) 3076 + { 3077 + glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_VIEW], 1, false, rlMatrixToFloat(RLGL.State.modelview)); 3078 + } 3079 + 3080 + if (RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_MODEL] != -1) 3081 + { 3082 + glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_MODEL], 1, false, rlMatrixToFloat(RLGL.State.transform)); 3083 + } 3084 + 3085 + if (RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_NORMAL] != -1) 3086 + { 3087 + glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_NORMAL], 1, false, rlMatrixToFloat(rlMatrixTranspose(rlMatrixInvert(RLGL.State.transform)))); 3088 + } 3089 + 3090 + if (RLGL.ExtSupported.vao) glBindVertexArray(batch->vertexBuffer[batch->currentBuffer].vaoId); 3091 + else 3092 + { 3093 + // Bind vertex attrib: position (shader-location = 0) 3094 + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[0]); 3095 + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_POSITION], 3, GL_FLOAT, 0, 0, 0); 3096 + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_POSITION]); 3097 + 3098 + // Bind vertex attrib: texcoord (shader-location = 1) 3099 + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[1]); 3100 + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01], 2, GL_FLOAT, 0, 0, 0); 3101 + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01]); 3102 + 3103 + // Bind vertex attrib: normal (shader-location = 2) 3104 + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[2]); 3105 + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL], 3, GL_FLOAT, 0, 0, 0); 3106 + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL]); 3107 + 3108 + // Bind vertex attrib: color (shader-location = 3) 3109 + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[3]); 3110 + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_COLOR], 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, 0); 3111 + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_COLOR]); 3112 + 3113 + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[4]); 3114 + } 3115 + 3116 + // Setup some default shader values 3117 + glUniform4f(RLGL.State.currentShaderLocs[RL_SHADER_LOC_COLOR_DIFFUSE], 1.0f, 1.0f, 1.0f, 1.0f); 3118 + glUniform1i(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MAP_DIFFUSE], 0); // Active default sampler2D: texture0 3119 + 3120 + // Activate additional sampler textures 3121 + // Those additional textures will be common for all draw calls of the batch 3122 + for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) 3123 + { 3124 + if (RLGL.State.activeTextureId[i] > 0) 3125 + { 3126 + glActiveTexture(GL_TEXTURE0 + 1 + i); 3127 + glBindTexture(GL_TEXTURE_2D, RLGL.State.activeTextureId[i]); 3128 + } 3129 + } 3130 + 3131 + // Activate default sampler2D texture0 (one texture is always active for default batch shader) 3132 + // NOTE: Batch system accumulates calls by texture0 changes, additional textures are enabled for all the draw calls 3133 + glActiveTexture(GL_TEXTURE0); 3134 + 3135 + for (int i = 0, vertexOffset = 0; i < batch->drawCounter; i++) 3136 + { 3137 + // Bind current draw call texture, activated as GL_TEXTURE0 and bound to sampler2D texture0 by default 3138 + glBindTexture(GL_TEXTURE_2D, batch->draws[i].textureId); 3139 + 3140 + if ((batch->draws[i].mode == RL_LINES) || (batch->draws[i].mode == RL_TRIANGLES)) glDrawArrays(batch->draws[i].mode, vertexOffset, batch->draws[i].vertexCount); 3141 + else 3142 + { 3143 + #if defined(GRAPHICS_API_OPENGL_33) 3144 + // The number of indices to be processed needs to be defined: elementCount*6 3145 + // NOTE: The final parameter tells the GPU the offset in bytes from the 3146 + // start of the index buffer to the location of the first index to process 3147 + glDrawElements(GL_TRIANGLES, batch->draws[i].vertexCount/4*6, GL_UNSIGNED_INT, (GLvoid *)(vertexOffset/4*6*sizeof(GLuint))); 3148 + #endif 3149 + #if defined(GRAPHICS_API_OPENGL_ES2) 3150 + glDrawElements(GL_TRIANGLES, batch->draws[i].vertexCount/4*6, GL_UNSIGNED_SHORT, (GLvoid *)(vertexOffset/4*6*sizeof(GLushort))); 3151 + #endif 3152 + } 3153 + 3154 + vertexOffset += (batch->draws[i].vertexCount + batch->draws[i].vertexAlignment); 3155 + } 3156 + 3157 + if (!RLGL.ExtSupported.vao) 3158 + { 3159 + glBindBuffer(GL_ARRAY_BUFFER, 0); 3160 + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); 3161 + } 3162 + 3163 + glBindTexture(GL_TEXTURE_2D, 0); // Unbind textures 3164 + } 3165 + 3166 + if (RLGL.ExtSupported.vao) glBindVertexArray(0); // Unbind VAO 3167 + 3168 + glUseProgram(0); // Unbind shader program 3169 + } 3170 + 3171 + // Restore viewport to default measures 3172 + if (eyeCount == 2) rlViewport(0, 0, RLGL.State.framebufferWidth, RLGL.State.framebufferHeight); 3173 + //------------------------------------------------------------------------------------------------------------ 3174 + 3175 + // Reset batch buffers 3176 + //------------------------------------------------------------------------------------------------------------ 3177 + // Reset vertex counter for next frame 3178 + RLGL.State.vertexCounter = 0; 3179 + 3180 + // Reset depth for next draw 3181 + batch->currentDepth = -1.0f; 3182 + 3183 + // Restore projection/modelview matrices 3184 + RLGL.State.projection = matProjection; 3185 + RLGL.State.modelview = matModelView; 3186 + 3187 + // Reset RLGL.currentBatch->draws array 3188 + for (int i = 0; i < RL_DEFAULT_BATCH_DRAWCALLS; i++) 3189 + { 3190 + batch->draws[i].mode = RL_QUADS; 3191 + batch->draws[i].vertexCount = 0; 3192 + batch->draws[i].textureId = RLGL.State.defaultTextureId; 3193 + } 3194 + 3195 + // Reset active texture units for next batch 3196 + for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) RLGL.State.activeTextureId[i] = 0; 3197 + 3198 + // Reset draws counter to one draw for the batch 3199 + batch->drawCounter = 1; 3200 + //------------------------------------------------------------------------------------------------------------ 3201 + 3202 + // Change to next buffer in the list (in case of multi-buffering) 3203 + batch->currentBuffer++; 3204 + if (batch->currentBuffer >= batch->bufferCount) batch->currentBuffer = 0; 3205 + #endif 3206 + } 3207 + 3208 + // Set the active render batch for rlgl 3209 + void rlSetRenderBatchActive(rlRenderBatch *batch) 3210 + { 3211 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 3212 + rlDrawRenderBatch(RLGL.currentBatch); 3213 + 3214 + if (batch != NULL) RLGL.currentBatch = batch; 3215 + else RLGL.currentBatch = &RLGL.defaultBatch; 3216 + #endif 3217 + } 3218 + 3219 + // Update and draw internal render batch 3220 + void rlDrawRenderBatchActive(void) 3221 + { 3222 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 3223 + rlDrawRenderBatch(RLGL.currentBatch); // NOTE: Stereo rendering is checked inside 3224 + #endif 3225 + } 3226 + 3227 + // Check internal buffer overflow for a given number of vertex 3228 + // and force a rlRenderBatch draw call if required 3229 + bool rlCheckRenderBatchLimit(int vCount) 3230 + { 3231 + bool overflow = false; 3232 + 3233 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 3234 + if ((RLGL.State.vertexCounter + vCount) >= 3235 + (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4)) 3236 + { 3237 + overflow = true; 3238 + 3239 + // Store current primitive drawing mode and texture id 3240 + int currentMode = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode; 3241 + int currentTexture = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId; 3242 + 3243 + rlDrawRenderBatch(RLGL.currentBatch); // NOTE: Stereo rendering is checked inside 3244 + 3245 + // Restore state of last batch so new vertices can be added 3246 + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = currentMode; 3247 + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = currentTexture; 3248 + } 3249 + #endif 3250 + 3251 + return overflow; 3252 + } 3253 + 3254 + // Textures data management 3255 + //----------------------------------------------------------------------------------------- 3256 + // Convert image data to OpenGL texture (returns OpenGL valid Id) 3257 + unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount) 3258 + { 3259 + unsigned int id = 0; 3260 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return id; } 3261 + 3262 + glBindTexture(GL_TEXTURE_2D, 0); // Free any old binding 3263 + 3264 + // Check texture format support by OpenGL 1.1 (compressed textures not supported) 3265 + #if defined(GRAPHICS_API_OPENGL_11) 3266 + if (format >= RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) 3267 + { 3268 + // TODO: Support texture data decompression 3269 + TRACELOG(RL_LOG_WARNING, "GL: OpenGL 1.1 does not support GPU compressed texture formats"); 3270 + return id; 3271 + } 3272 + #else 3273 + if ((!RLGL.ExtSupported.texCompDXT) && ((format == RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) || (format == RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA) || 3274 + (format == RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA) || (format == RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA))) 3275 + { 3276 + TRACELOG(RL_LOG_WARNING, "GL: DXT compressed texture format not supported"); 3277 + return id; 3278 + } 3279 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 3280 + if ((!RLGL.ExtSupported.texCompETC1) && (format == RL_PIXELFORMAT_COMPRESSED_ETC1_RGB)) 3281 + { 3282 + TRACELOG(RL_LOG_WARNING, "GL: ETC1 compressed texture format not supported"); 3283 + return id; 3284 + } 3285 + 3286 + if ((!RLGL.ExtSupported.texCompETC2) && ((format == RL_PIXELFORMAT_COMPRESSED_ETC2_RGB) || (format == RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA))) 3287 + { 3288 + TRACELOG(RL_LOG_WARNING, "GL: ETC2 compressed texture format not supported"); 3289 + return id; 3290 + } 3291 + 3292 + if ((!RLGL.ExtSupported.texCompPVRT) && ((format == RL_PIXELFORMAT_COMPRESSED_PVRT_RGB) || (format == RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA))) 3293 + { 3294 + TRACELOG(RL_LOG_WARNING, "GL: PVRT compressed texture format not supported"); 3295 + return id; 3296 + } 3297 + 3298 + if ((!RLGL.ExtSupported.texCompASTC) && ((format == RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA) || (format == RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA))) 3299 + { 3300 + TRACELOG(RL_LOG_WARNING, "GL: ASTC compressed texture format not supported"); 3301 + return id; 3302 + } 3303 + #endif 3304 + #endif // GRAPHICS_API_OPENGL_11 3305 + 3306 + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 3307 + 3308 + glGenTextures(1, &id); // Generate texture id 3309 + 3310 + glBindTexture(GL_TEXTURE_2D, id); 3311 + 3312 + int mipWidth = width; 3313 + int mipHeight = height; 3314 + int mipOffset = 0; // Mipmap data offset, only used for tracelog 3315 + (void)mipOffset; // Used to avoid gcc warnings about unused variable 3316 + 3317 + // NOTE: Added pointer math separately from function to avoid UBSAN complaining 3318 + unsigned char *dataPtr = NULL; 3319 + if (data != NULL) dataPtr = (unsigned char *)data; 3320 + 3321 + // Load the different mipmap levels 3322 + for (int i = 0; i < mipmapCount; i++) 3323 + { 3324 + unsigned int mipSize = rlGetPixelDataSize(mipWidth, mipHeight, format); 3325 + 3326 + unsigned int glInternalFormat, glFormat, glType; 3327 + rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); 3328 + 3329 + TRACELOG(RL_LOG_DEBUG, "TEXTURE: Load mipmap level %i (%i x %i), size: %i, offset: %i", i, mipWidth, mipHeight, mipSize, mipOffset); 3330 + 3331 + if (glInternalFormat != 0) 3332 + { 3333 + if (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) glTexImage2D(GL_TEXTURE_2D, i, glInternalFormat, mipWidth, mipHeight, 0, glFormat, glType, dataPtr); 3334 + #if !defined(GRAPHICS_API_OPENGL_11) 3335 + else glCompressedTexImage2D(GL_TEXTURE_2D, i, glInternalFormat, mipWidth, mipHeight, 0, mipSize, dataPtr); 3336 + #endif 3337 + 3338 + #if defined(GRAPHICS_API_OPENGL_33) 3339 + if (format == RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) 3340 + { 3341 + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_ONE }; 3342 + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); 3343 + } 3344 + else if (format == RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) 3345 + { 3346 + #if defined(GRAPHICS_API_OPENGL_21) 3347 + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_ALPHA }; 3348 + #elif defined(GRAPHICS_API_OPENGL_33) 3349 + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_GREEN }; 3350 + #endif 3351 + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); 3352 + } 3353 + #endif 3354 + } 3355 + 3356 + mipWidth /= 2; 3357 + mipHeight /= 2; 3358 + mipOffset += mipSize; // Increment offset position to next mipmap 3359 + if (data != NULL) dataPtr += mipSize; // Increment data pointer to next mipmap 3360 + 3361 + // Security check for NPOT textures 3362 + if (mipWidth < 1) mipWidth = 1; 3363 + if (mipHeight < 1) mipHeight = 1; 3364 + } 3365 + 3366 + // Texture parameters configuration 3367 + // NOTE: glTexParameteri does NOT affect texture uploading 3368 + #if defined(GRAPHICS_API_OPENGL_ES2) 3369 + // NOTE: OpenGL ES 2.0 with no GL_OES_texture_npot support (i.e. WebGL) has limited NPOT support, so CLAMP_TO_EDGE must be used 3370 + if (RLGL.ExtSupported.texNPOT) 3371 + { 3372 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // Set texture to repeat on x-axis 3373 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Set texture to repeat on y-axis 3374 + } 3375 + else 3376 + { 3377 + // NOTE: If using negative texture coordinates (LoadOBJ()), it does not work! 3378 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // Set texture to clamp on x-axis 3379 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Set texture to clamp on y-axis 3380 + } 3381 + #else 3382 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // Set texture to repeat on x-axis 3383 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Set texture to repeat on y-axis 3384 + #endif 3385 + 3386 + // Magnification and minification filters 3387 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Alternative: GL_LINEAR 3388 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // Alternative: GL_LINEAR 3389 + 3390 + #if defined(GRAPHICS_API_OPENGL_33) 3391 + if (mipmapCount > 1) 3392 + { 3393 + // Activate trilinear filtering if mipmaps are available 3394 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 3395 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 3396 + 3397 + // Define the maximum number of mipmap levels to be used, 0 is base texture size 3398 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); 3399 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapCount - 1); 3400 + 3401 + // Check if the loaded texture with mipmaps is complete, 3402 + // uncomplete textures will draw in black if mipmap filtering is required 3403 + //GLint complete = 0; 3404 + //glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_IMMUTABLE_FORMAT, &complete); 3405 + } 3406 + #endif 3407 + 3408 + // At this point texture is loaded in GPU and texture parameters configured 3409 + 3410 + // NOTE: If mipmaps were not in data, they are not generated automatically 3411 + 3412 + // Unbind current texture 3413 + glBindTexture(GL_TEXTURE_2D, 0); 3414 + 3415 + if (id > 0) TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Texture loaded successfully (%ix%i | %s | %i mipmaps)", id, width, height, rlGetPixelFormatName(format), mipmapCount); 3416 + else TRACELOG(RL_LOG_WARNING, "TEXTURE: Failed to load texture"); 3417 + 3418 + return id; 3419 + } 3420 + 3421 + // Load depth texture/renderbuffer (to be attached to fbo) 3422 + // WARNING: OpenGL ES 2.0 requires GL_OES_depth_texture and WebGL requires WEBGL_depth_texture extensions 3423 + unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer) 3424 + { 3425 + unsigned int id = 0; 3426 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return id; } 3427 + 3428 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 3429 + // In case depth textures were not supported, force renderbuffer usage 3430 + if (!RLGL.ExtSupported.texDepth) useRenderBuffer = true; 3431 + 3432 + // NOTE: Letting the implementation to choose the best bit-depth 3433 + // Possible formats: GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT32 and GL_DEPTH_COMPONENT32F 3434 + unsigned int glInternalFormat = GL_DEPTH_COMPONENT; 3435 + 3436 + #if defined(GRAPHICS_API_OPENGL_ES2) 3437 + // WARNING: WebGL platform requires unsized internal format definition (GL_DEPTH_COMPONENT) 3438 + // while other platforms using OpenGL ES 2.0 require/support sized internal formats depending on the GPU capabilities 3439 + if (!RLGL.ExtSupported.texDepthWebGL || useRenderBuffer) 3440 + { 3441 + if (RLGL.ExtSupported.maxDepthBits == 32) glInternalFormat = GL_DEPTH_COMPONENT32_OES; 3442 + else if (RLGL.ExtSupported.maxDepthBits == 24) glInternalFormat = GL_DEPTH_COMPONENT24_OES; 3443 + else glInternalFormat = GL_DEPTH_COMPONENT16; 3444 + } 3445 + #endif 3446 + #if defined(GRAPHICS_API_OPENGL_ES3) 3447 + // NOTE: This sized internal format should also work for WebGL 2.0 3448 + // WARNING: Specification only allows GL_DEPTH_COMPONENT32F for GL_FLOAT type 3449 + // REF: https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml 3450 + if (RLGL.ExtSupported.maxDepthBits == 24) glInternalFormat = GL_DEPTH_COMPONENT24; 3451 + else glInternalFormat = GL_DEPTH_COMPONENT16; 3452 + #endif 3453 + 3454 + if (!useRenderBuffer && RLGL.ExtSupported.texDepth) 3455 + { 3456 + glGenTextures(1, &id); 3457 + glBindTexture(GL_TEXTURE_2D, id); 3458 + glTexImage2D(GL_TEXTURE_2D, 0, glInternalFormat, width, height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); 3459 + 3460 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 3461 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 3462 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 3463 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 3464 + 3465 + glBindTexture(GL_TEXTURE_2D, 0); 3466 + 3467 + TRACELOG(RL_LOG_INFO, "TEXTURE: Depth texture loaded successfully"); 3468 + } 3469 + else 3470 + { 3471 + // Create the renderbuffer that will serve as the depth attachment for the framebuffer 3472 + // NOTE: A renderbuffer is simpler than a texture and could offer better performance on embedded devices 3473 + glGenRenderbuffers(1, &id); 3474 + glBindRenderbuffer(GL_RENDERBUFFER, id); 3475 + glRenderbufferStorage(GL_RENDERBUFFER, glInternalFormat, width, height); 3476 + 3477 + glBindRenderbuffer(GL_RENDERBUFFER, 0); 3478 + 3479 + TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Depth renderbuffer loaded successfully (%i bits)", id, (RLGL.ExtSupported.maxDepthBits >= 24)? RLGL.ExtSupported.maxDepthBits : 16); 3480 + } 3481 + #elif defined(GRAPHICS_API_OPENGL_SOFTWARE) 3482 + // NOTE: Renderbuffers are the same type of object as textures in rlsw 3483 + // WARNING: Ensure that the depth format is the one specified at rlsw compilation 3484 + glGenRenderbuffers(1, &id); 3485 + glBindRenderbuffer(GL_RENDERBUFFER, id); 3486 + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT32, width, height); 3487 + glBindRenderbuffer(GL_RENDERBUFFER, 0); 3488 + #endif 3489 + 3490 + return id; 3491 + } 3492 + 3493 + // Load texture cubemap 3494 + // NOTE: Cubemap data is expected to be 6 images in a single data array (one after the other), 3495 + // expected the following convention: +X, -X, +Y, -Y, +Z, -Z 3496 + unsigned int rlLoadTextureCubemap(const void *data, int size, int format, int mipmapCount) 3497 + { 3498 + unsigned int id = 0; 3499 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return id; } 3500 + 3501 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 3502 + int mipSize = size; 3503 + 3504 + // NOTE: Added pointer math separately from function to avoid UBSAN complaining 3505 + unsigned char *dataPtr = NULL; 3506 + if (data != NULL) dataPtr = (unsigned char *)data; 3507 + 3508 + unsigned int dataSize = rlGetPixelDataSize(size, size, format); 3509 + 3510 + glGenTextures(1, &id); 3511 + glBindTexture(GL_TEXTURE_CUBE_MAP, id); 3512 + 3513 + unsigned int glInternalFormat, glFormat, glType; 3514 + rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); 3515 + 3516 + if (glInternalFormat != 0) 3517 + { 3518 + // Load cubemap faces/mipmaps 3519 + for (int i = 0; i < 6*mipmapCount; i++) 3520 + { 3521 + int mipmapLevel = i/6; 3522 + int face = i%6; 3523 + 3524 + if (data == NULL) 3525 + { 3526 + if (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) 3527 + { 3528 + if ((format == RL_PIXELFORMAT_UNCOMPRESSED_R32) || 3529 + (format == RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32) || 3530 + (format == RL_PIXELFORMAT_UNCOMPRESSED_R16) || 3531 + (format == RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16)) TRACELOG(RL_LOG_WARNING, "TEXTURES: Cubemap requested format not supported"); 3532 + else glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, mipmapLevel, glInternalFormat, mipSize, mipSize, 0, glFormat, glType, NULL); 3533 + } 3534 + else TRACELOG(RL_LOG_WARNING, "TEXTURES: Empty cubemap creation does not support compressed format"); 3535 + } 3536 + else 3537 + { 3538 + if (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, mipmapLevel, glInternalFormat, mipSize, mipSize, 0, glFormat, glType, (unsigned char *)dataPtr + face*dataSize); 3539 + else glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, mipmapLevel, glInternalFormat, mipSize, mipSize, 0, dataSize, (unsigned char *)dataPtr + face*dataSize); 3540 + } 3541 + 3542 + #if defined(GRAPHICS_API_OPENGL_33) 3543 + if (format == RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) 3544 + { 3545 + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_ONE }; 3546 + glTexParameteriv(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); 3547 + } 3548 + else if (format == RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) 3549 + { 3550 + #if defined(GRAPHICS_API_OPENGL_21) 3551 + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_ALPHA }; 3552 + #elif defined(GRAPHICS_API_OPENGL_33) 3553 + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_GREEN }; 3554 + #endif 3555 + glTexParameteriv(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); 3556 + } 3557 + #endif 3558 + if (face == 5) 3559 + { 3560 + mipSize /= 2; 3561 + if (data != NULL) dataPtr += dataSize*6; // Increment data pointer to next mipmap 3562 + 3563 + // Security check for NPOT textures 3564 + if (mipSize < 1) mipSize = 1; 3565 + 3566 + dataSize = rlGetPixelDataSize(mipSize, mipSize, format); 3567 + } 3568 + } 3569 + } 3570 + 3571 + // Set cubemap texture sampling parameters 3572 + if (mipmapCount > 1) glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 3573 + else glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 3574 + 3575 + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 3576 + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 3577 + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 3578 + #if defined(GRAPHICS_API_OPENGL_33) 3579 + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); // Flag not supported on OpenGL ES 2.0 3580 + #endif 3581 + 3582 + glBindTexture(GL_TEXTURE_CUBE_MAP, 0); 3583 + #endif 3584 + 3585 + if (id > 0) TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Cubemap texture loaded successfully (%ix%i)", id, size, size); 3586 + else TRACELOG(RL_LOG_WARNING, "TEXTURE: Failed to load cubemap texture"); 3587 + 3588 + return id; 3589 + } 3590 + 3591 + // Update already loaded texture in GPU with new data 3592 + // WARNING: Not possible to know safely if internal texture format is the expected one... 3593 + void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data) 3594 + { 3595 + glBindTexture(GL_TEXTURE_2D, id); 3596 + 3597 + unsigned int glInternalFormat, glFormat, glType; 3598 + rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); 3599 + 3600 + if ((glInternalFormat != 0) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) 3601 + { 3602 + glTexSubImage2D(GL_TEXTURE_2D, 0, offsetX, offsetY, width, height, glFormat, glType, data); 3603 + } 3604 + else TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] Failed to update for current texture format (%i)", id, format); 3605 + } 3606 + 3607 + // Get OpenGL internal formats and data type from raylib PixelFormat 3608 + void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType) 3609 + { 3610 + *glInternalFormat = 0; 3611 + *glFormat = 0; 3612 + *glType = 0; 3613 + 3614 + switch (format) 3615 + { 3616 + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_21) || defined(GRAPHICS_API_OPENGL_ES2) 3617 + // NOTE: on OpenGL ES 2.0 (WebGL), internalFormat must match format and options allowed are: GL_LUMINANCE, GL_RGB, GL_RGBA 3618 + case RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: *glInternalFormat = GL_LUMINANCE; *glFormat = GL_LUMINANCE; *glType = GL_UNSIGNED_BYTE; break; 3619 + case RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: *glInternalFormat = GL_LUMINANCE_ALPHA; *glFormat = GL_LUMINANCE_ALPHA; *glType = GL_UNSIGNED_BYTE; break; 3620 + case RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5: *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_UNSIGNED_SHORT_5_6_5; break; 3621 + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8: *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_UNSIGNED_BYTE; break; 3622 + case RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_SHORT_5_5_5_1; break; 3623 + case RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_SHORT_4_4_4_4; break; 3624 + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_BYTE; break; 3625 + #if !defined(GRAPHICS_API_OPENGL_11) 3626 + #if defined(GRAPHICS_API_OPENGL_ES3) 3627 + case RL_PIXELFORMAT_UNCOMPRESSED_R32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_R32F_EXT; *glFormat = GL_RED_EXT; *glType = GL_FLOAT; break; 3628 + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGB32F_EXT; *glFormat = GL_RGB; *glType = GL_FLOAT; break; 3629 + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGBA32F_EXT; *glFormat = GL_RGBA; *glType = GL_FLOAT; break; 3630 + case RL_PIXELFORMAT_UNCOMPRESSED_R16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_R16F_EXT; *glFormat = GL_RED_EXT; *glType = GL_HALF_FLOAT; break; 3631 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGB16F_EXT; *glFormat = GL_RGB; *glType = GL_HALF_FLOAT; break; 3632 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGBA16F_EXT; *glFormat = GL_RGBA; *glType = GL_HALF_FLOAT; break; 3633 + #else 3634 + case RL_PIXELFORMAT_UNCOMPRESSED_R32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_LUMINANCE; *glFormat = GL_LUMINANCE; *glType = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float 3635 + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float 3636 + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float 3637 + #if defined(GRAPHICS_API_OPENGL_21) 3638 + case RL_PIXELFORMAT_UNCOMPRESSED_R16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_LUMINANCE; *glFormat = GL_LUMINANCE; *glType = GL_HALF_FLOAT_ARB; break; 3639 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_HALF_FLOAT_ARB; break; 3640 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_HALF_FLOAT_ARB; break; 3641 + #else // defined(GRAPHICS_API_OPENGL_ES2) 3642 + case RL_PIXELFORMAT_UNCOMPRESSED_R16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_LUMINANCE; *glFormat = GL_LUMINANCE; *glType = GL_HALF_FLOAT_OES; break; // NOTE: Requires extension OES_texture_half_float 3643 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_HALF_FLOAT_OES; break; // NOTE: Requires extension OES_texture_half_float 3644 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_HALF_FLOAT_OES; break; // NOTE: Requires extension OES_texture_half_float 3645 + #endif 3646 + #endif 3647 + #endif 3648 + #elif defined(GRAPHICS_API_OPENGL_33) 3649 + case RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: *glInternalFormat = GL_R8; *glFormat = GL_RED; *glType = GL_UNSIGNED_BYTE; break; 3650 + case RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: *glInternalFormat = GL_RG8; *glFormat = GL_RG; *glType = GL_UNSIGNED_BYTE; break; 3651 + case RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5: *glInternalFormat = GL_RGB565; *glFormat = GL_RGB; *glType = GL_UNSIGNED_SHORT_5_6_5; break; 3652 + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8: *glInternalFormat = GL_RGB8; *glFormat = GL_RGB; *glType = GL_UNSIGNED_BYTE; break; 3653 + case RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: *glInternalFormat = GL_RGB5_A1; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_SHORT_5_5_5_1; break; 3654 + case RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: *glInternalFormat = GL_RGBA4; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_SHORT_4_4_4_4; break; 3655 + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: *glInternalFormat = GL_RGBA8; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_BYTE; break; 3656 + case RL_PIXELFORMAT_UNCOMPRESSED_R32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_R32F; *glFormat = GL_RED; *glType = GL_FLOAT; break; 3657 + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGB32F; *glFormat = GL_RGB; *glType = GL_FLOAT; break; 3658 + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGBA32F; *glFormat = GL_RGBA; *glType = GL_FLOAT; break; 3659 + case RL_PIXELFORMAT_UNCOMPRESSED_R16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_R16F; *glFormat = GL_RED; *glType = GL_HALF_FLOAT; break; 3660 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGB16F; *glFormat = GL_RGB; *glType = GL_HALF_FLOAT; break; 3661 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGBA16F; *glFormat = GL_RGBA; *glType = GL_HALF_FLOAT; break; 3662 + #endif 3663 + #if !defined(GRAPHICS_API_OPENGL_11) 3664 + case RL_PIXELFORMAT_COMPRESSED_DXT1_RGB: if (RLGL.ExtSupported.texCompDXT) *glInternalFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; break; 3665 + case RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA: if (RLGL.ExtSupported.texCompDXT) *glInternalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break; 3666 + case RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA: if (RLGL.ExtSupported.texCompDXT) *glInternalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break; 3667 + case RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA: if (RLGL.ExtSupported.texCompDXT) *glInternalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break; 3668 + case RL_PIXELFORMAT_COMPRESSED_ETC1_RGB: if (RLGL.ExtSupported.texCompETC1) *glInternalFormat = GL_ETC1_RGB8_OES; break; // NOTE: Requires OpenGL ES 2.0 or OpenGL 4.3 3669 + case RL_PIXELFORMAT_COMPRESSED_ETC2_RGB: if (RLGL.ExtSupported.texCompETC2) *glInternalFormat = GL_COMPRESSED_RGB8_ETC2; break; // NOTE: Requires OpenGL ES 3.0 or OpenGL 4.3 3670 + case RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: if (RLGL.ExtSupported.texCompETC2) *glInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; break; // NOTE: Requires OpenGL ES 3.0 or OpenGL 4.3 3671 + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGB: if (RLGL.ExtSupported.texCompPVRT) *glInternalFormat = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; break; // NOTE: Requires PowerVR GPU 3672 + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA: if (RLGL.ExtSupported.texCompPVRT) *glInternalFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; break; // NOTE: Requires PowerVR GPU 3673 + case RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: if (RLGL.ExtSupported.texCompASTC) *glInternalFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR; break; // NOTE: Requires OpenGL ES 3.1 or OpenGL 4.3 3674 + case RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: if (RLGL.ExtSupported.texCompASTC) *glInternalFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR; break; // NOTE: Requires OpenGL ES 3.1 or OpenGL 4.3 3675 + #endif 3676 + default: TRACELOG(RL_LOG_WARNING, "TEXTURE: Current format not supported (%i)", format); break; 3677 + } 3678 + } 3679 + 3680 + // Unload texture from GPU memory 3681 + void rlUnloadTexture(unsigned int id) 3682 + { 3683 + glDeleteTextures(1, &id); 3684 + } 3685 + 3686 + // Generate mipmap data for selected texture 3687 + // NOTE: Only supports GPU mipmap generation 3688 + void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int *mipmaps) 3689 + { 3690 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return; } 3691 + 3692 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 3693 + glBindTexture(GL_TEXTURE_2D, id); 3694 + 3695 + // Check if texture is power-of-two (POT) 3696 + bool texIsPOT = false; 3697 + 3698 + if (((width > 0) && ((width & (width - 1)) == 0)) && 3699 + ((height > 0) && ((height & (height - 1)) == 0))) texIsPOT = true; 3700 + 3701 + if ((texIsPOT) || (RLGL.ExtSupported.texNPOT)) 3702 + { 3703 + //glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE); // Hint for mipmaps generation algorithm: GL_FASTEST, GL_NICEST, GL_DONT_CARE 3704 + glGenerateMipmap(GL_TEXTURE_2D); // Generate mipmaps automatically 3705 + 3706 + #define MIN(a,b) (((a)<(b))? (a):(b)) 3707 + #define MAX(a,b) (((a)>(b))? (a):(b)) 3708 + 3709 + *mipmaps = 1 + (int)floor(log(MAX(width, height))/log(2)); 3710 + TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Mipmaps generated automatically, total: %i", id, *mipmaps); 3711 + } 3712 + else TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] Failed to generate mipmaps", id); 3713 + 3714 + glBindTexture(GL_TEXTURE_2D, 0); 3715 + #else 3716 + TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] GPU mipmap generation not supported", id); 3717 + #endif 3718 + } 3719 + 3720 + // Read texture pixel data 3721 + void *rlReadTexturePixels(unsigned int id, int width, int height, int format) 3722 + { 3723 + void *pixels = NULL; 3724 + 3725 + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) 3726 + glBindTexture(GL_TEXTURE_2D, id); 3727 + 3728 + // NOTE: Using texture id, some texture info can be retrieved (but not on OpenGL ES 2.0) 3729 + // Possible texture info: GL_TEXTURE_RED_SIZE, GL_TEXTURE_GREEN_SIZE, GL_TEXTURE_BLUE_SIZE, GL_TEXTURE_ALPHA_SIZE 3730 + //int width, height, format; 3731 + //glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); 3732 + //glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height); 3733 + //glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &format); 3734 + 3735 + // NOTE: Each row written to or read from by OpenGL pixel operations like glGetTexImage are aligned to a 4 byte boundary by default, which may add some padding 3736 + // Use glPixelStorei to modify padding with the GL_[UN]PACK_ALIGNMENT setting 3737 + // GL_PACK_ALIGNMENT affects operations that read from OpenGL memory (glReadPixels, glGetTexImage, etc.) 3738 + // GL_UNPACK_ALIGNMENT affects operations that write to OpenGL memory (glTexImage, etc.) 3739 + glPixelStorei(GL_PACK_ALIGNMENT, 1); 3740 + 3741 + unsigned int glInternalFormat, glFormat, glType; 3742 + rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); 3743 + unsigned int size = rlGetPixelDataSize(width, height, format); 3744 + 3745 + if ((glInternalFormat != 0) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) 3746 + { 3747 + pixels = RL_CALLOC(size, 1); 3748 + glGetTexImage(GL_TEXTURE_2D, 0, glFormat, glType, pixels); 3749 + } 3750 + else TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] Data retrieval not suported for pixel format (%i)", id, format); 3751 + 3752 + glBindTexture(GL_TEXTURE_2D, 0); 3753 + #endif 3754 + 3755 + #if defined(GRAPHICS_API_OPENGL_ES2) 3756 + // glGetTexImage() is not available on OpenGL ES 2.0 3757 + // Texture width and height are required on OpenGL ES 2.0, there is no way to get it from texture id 3758 + // Two possible Options: 3759 + // 1 - Bind texture to color fbo attachment and glReadPixels() 3760 + // 2 - Create an fbo, activate it, render quad with texture, glReadPixels() 3761 + // Using Option 1, care for texture format on retrieval 3762 + // NOTE: This behaviour could be conditioned by graphic driver... 3763 + unsigned int fboId = rlLoadFramebuffer(); 3764 + 3765 + glBindFramebuffer(GL_FRAMEBUFFER, fboId); 3766 + glBindTexture(GL_TEXTURE_2D, 0); 3767 + 3768 + // Attach our texture to FBO 3769 + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, id, 0); 3770 + 3771 + // Reading data as RGBA because FBO texture is configured as RGBA, despite binding another texture format 3772 + pixels = RL_CALLOC(rlGetPixelDataSize(width, height, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8), 1); 3773 + glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); 3774 + 3775 + glBindFramebuffer(GL_FRAMEBUFFER, 0); 3776 + 3777 + // Clean up temporal fbo 3778 + rlUnloadFramebuffer(fboId); 3779 + #endif 3780 + 3781 + return pixels; 3782 + } 3783 + 3784 + // Copy framebuffer pixel data to internal buffer 3785 + void rlCopyFramebuffer(int x, int y, int width, int height, int format, void *pixels) 3786 + { 3787 + #if defined(GRAPHICS_API_OPENGL_SOFTWARE) 3788 + unsigned int glInternalFormat, glFormat, glType; 3789 + rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); // Get OpenGL texture format 3790 + swReadPixels(x, y, width, height, glFormat, glType, pixels); 3791 + #endif 3792 + } 3793 + 3794 + // Resize internal framebuffer 3795 + void rlResizeFramebuffer(int width, int height) 3796 + { 3797 + #if defined(GRAPHICS_API_OPENGL_SOFTWARE) 3798 + swResize(width, height); 3799 + #endif 3800 + } 3801 + 3802 + // Read screen pixel data (color buffer) 3803 + unsigned char *rlReadScreenPixels(int width, int height) 3804 + { 3805 + unsigned char *imgData = (unsigned char *)RL_CALLOC(width*height*4, sizeof(unsigned char)); 3806 + 3807 + // NOTE: glReadPixels() returns image flipped vertically -> (0,0) is the bottom left corner of the framebuffer 3808 + // WARNING: Getting alpha channel! Be careful, it can be transparent if not cleared properly! 3809 + glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, imgData); 3810 + 3811 + // Flip image vertically 3812 + // NOTE: Alpha value has already been applied to RGB in framebuffer, not needed anymore 3813 + for (int y = height - 1; y >= height/2; y--) 3814 + { 3815 + for (int x = 0; x < (width*4); x += 4) 3816 + { 3817 + unsigned int s = ((height - 1) - y)*width*4 + x; 3818 + unsigned int e = y*width*4 + x; 3819 + 3820 + unsigned char r = imgData[s]; 3821 + unsigned char g = imgData[s+1]; 3822 + unsigned char b = imgData[s+2]; 3823 + 3824 + imgData[s] = imgData[e]; 3825 + imgData[s+1] = imgData[e+1]; 3826 + imgData[s+2] = imgData[e+2]; 3827 + imgData[s+3] = 255; // Set alpha component value to 255 (no trasparent image retrieval) 3828 + 3829 + imgData[e] = r; 3830 + imgData[e+1] = g; 3831 + imgData[e+2] = b; 3832 + imgData[e+3] = 255; // Ditto 3833 + } 3834 + } 3835 + 3836 + return imgData; // NOTE: image data should be freed 3837 + } 3838 + 3839 + // Framebuffer management (fbo) 3840 + //----------------------------------------------------------------------------------------- 3841 + // Load a framebuffer to be used for rendering 3842 + // NOTE: No textures attached 3843 + unsigned int rlLoadFramebuffer(void) 3844 + { 3845 + unsigned int fboId = 0; 3846 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return fboId; } 3847 + 3848 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_SOFTWARE)) 3849 + glGenFramebuffers(1, &fboId); // Create the framebuffer object 3850 + glBindFramebuffer(GL_FRAMEBUFFER, 0); // Unbind any framebuffer 3851 + #endif 3852 + 3853 + return fboId; 3854 + } 3855 + 3856 + // Attach color buffer texture to a framebuffer object (unloads previous attachment) 3857 + // NOTE: Attach type: 0-Color, 1-Depth renderbuffer, 2-Depth texture 3858 + void rlFramebufferAttach(unsigned int id, unsigned int texId, int attachType, int texType, int mipLevel) 3859 + { 3860 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_SOFTWARE)) 3861 + glBindFramebuffer(GL_FRAMEBUFFER, id); 3862 + 3863 + switch (attachType) 3864 + { 3865 + case RL_ATTACHMENT_COLOR_CHANNEL0: 3866 + case RL_ATTACHMENT_COLOR_CHANNEL1: 3867 + case RL_ATTACHMENT_COLOR_CHANNEL2: 3868 + case RL_ATTACHMENT_COLOR_CHANNEL3: 3869 + case RL_ATTACHMENT_COLOR_CHANNEL4: 3870 + case RL_ATTACHMENT_COLOR_CHANNEL5: 3871 + case RL_ATTACHMENT_COLOR_CHANNEL6: 3872 + case RL_ATTACHMENT_COLOR_CHANNEL7: 3873 + { 3874 + if (texType == RL_ATTACHMENT_TEXTURE2D) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + attachType, GL_TEXTURE_2D, texId, mipLevel); 3875 + else if (texType == RL_ATTACHMENT_RENDERBUFFER) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + attachType, GL_RENDERBUFFER, texId); 3876 + else if (texType >= RL_ATTACHMENT_CUBEMAP_POSITIVE_X) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + attachType, GL_TEXTURE_CUBE_MAP_POSITIVE_X + texType, texId, mipLevel); 3877 + } break; 3878 + case RL_ATTACHMENT_DEPTH: 3879 + { 3880 + if (texType == RL_ATTACHMENT_TEXTURE2D) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, texId, mipLevel); 3881 + else if (texType == RL_ATTACHMENT_RENDERBUFFER) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, texId); 3882 + } break; 3883 + case RL_ATTACHMENT_STENCIL: 3884 + { 3885 + if (texType == RL_ATTACHMENT_TEXTURE2D) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, texId, mipLevel); 3886 + else if (texType == RL_ATTACHMENT_RENDERBUFFER) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, texId); 3887 + } break; 3888 + default: break; 3889 + } 3890 + 3891 + glBindFramebuffer(GL_FRAMEBUFFER, 0); 3892 + #endif 3893 + } 3894 + 3895 + // Verify render texture is complete 3896 + bool rlFramebufferComplete(unsigned int id) 3897 + { 3898 + bool result = false; 3899 + 3900 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_SOFTWARE)) 3901 + glBindFramebuffer(GL_FRAMEBUFFER, id); 3902 + 3903 + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); 3904 + 3905 + if (status != GL_FRAMEBUFFER_COMPLETE) 3906 + { 3907 + switch (status) 3908 + { 3909 + case GL_FRAMEBUFFER_UNSUPPORTED: TRACELOG(RL_LOG_WARNING, "FBO: [ID %i] Framebuffer is unsupported", id); break; 3910 + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: TRACELOG(RL_LOG_WARNING, "FBO: [ID %i] Framebuffer has incomplete attachment", id); break; 3911 + #if defined(GRAPHICS_API_OPENGL_ES2) 3912 + case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: TRACELOG(RL_LOG_WARNING, "FBO: [ID %i] Framebuffer has incomplete dimensions", id); break; 3913 + #endif 3914 + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: TRACELOG(RL_LOG_WARNING, "FBO: [ID %i] Framebuffer has a missing attachment", id); break; 3915 + default: break; 3916 + } 3917 + } 3918 + 3919 + glBindFramebuffer(GL_FRAMEBUFFER, 0); 3920 + 3921 + result = (status == GL_FRAMEBUFFER_COMPLETE); 3922 + #endif 3923 + 3924 + return result; 3925 + } 3926 + 3927 + // Unload framebuffer from GPU memory 3928 + // NOTE: All attached textures/cubemaps/renderbuffers are also deleted 3929 + void rlUnloadFramebuffer(unsigned int id) 3930 + { 3931 + #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_SOFTWARE)) 3932 + // Query depth attachment to automatically delete texture/renderbuffer 3933 + int depthType = 0; 3934 + glBindFramebuffer(GL_FRAMEBUFFER, id); // Bind framebuffer to query depth texture type 3935 + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &depthType); 3936 + 3937 + // WARNING: WebGL: INVALID_ENUM: getFramebufferAttachmentParameter: invalid parameter name 3938 + // REF: https://registry.khronos.org/webgl/specs/latest/1.0/ 3939 + int depthId = 0; 3940 + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &depthId); 3941 + 3942 + unsigned int depthIdU = (unsigned int)depthId; 3943 + if (depthType == GL_RENDERBUFFER) glDeleteRenderbuffers(1, &depthIdU); 3944 + else if (depthType == GL_TEXTURE) glDeleteTextures(1, &depthIdU); 3945 + 3946 + // NOTE: If a texture object is deleted while its image is attached to the *currently bound* framebuffer, 3947 + // the texture image is automatically detached from the currently bound framebuffer 3948 + 3949 + glBindFramebuffer(GL_FRAMEBUFFER, 0); 3950 + glDeleteFramebuffers(1, &id); 3951 + 3952 + TRACELOG(RL_LOG_INFO, "FBO: [ID %i] Unloaded framebuffer from VRAM (GPU)", id); 3953 + #endif 3954 + } 3955 + 3956 + // Vertex data management 3957 + //----------------------------------------------------------------------------------------- 3958 + // Load a new attributes buffer 3959 + unsigned int rlLoadVertexBuffer(const void *buffer, int size, bool dynamic) 3960 + { 3961 + unsigned int id = 0; 3962 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return id; } 3963 + 3964 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 3965 + glGenBuffers(1, &id); 3966 + glBindBuffer(GL_ARRAY_BUFFER, id); 3967 + glBufferData(GL_ARRAY_BUFFER, size, buffer, dynamic? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); 3968 + #endif 3969 + 3970 + return id; 3971 + } 3972 + 3973 + // Load a new attributes element buffer 3974 + unsigned int rlLoadVertexBufferElement(const void *buffer, int size, bool dynamic) 3975 + { 3976 + unsigned int id = 0; 3977 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return id; } 3978 + 3979 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 3980 + glGenBuffers(1, &id); 3981 + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id); 3982 + glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, buffer, dynamic? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); 3983 + #endif 3984 + 3985 + return id; 3986 + } 3987 + 3988 + // Enable vertex buffer (VBO) 3989 + void rlEnableVertexBuffer(unsigned int id) 3990 + { 3991 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 3992 + glBindBuffer(GL_ARRAY_BUFFER, id); 3993 + #endif 3994 + } 3995 + 3996 + // Disable vertex buffer (VBO) 3997 + void rlDisableVertexBuffer(void) 3998 + { 3999 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4000 + glBindBuffer(GL_ARRAY_BUFFER, 0); 4001 + #endif 4002 + } 4003 + 4004 + // Enable vertex buffer element (VBO element) 4005 + void rlEnableVertexBufferElement(unsigned int id) 4006 + { 4007 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4008 + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id); 4009 + #endif 4010 + } 4011 + 4012 + // Disable vertex buffer element (VBO element) 4013 + void rlDisableVertexBufferElement(void) 4014 + { 4015 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4016 + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); 4017 + #endif 4018 + } 4019 + 4020 + // Update vertex buffer with new data 4021 + // NOTE: dataSize and offset must be provided in bytes 4022 + void rlUpdateVertexBuffer(unsigned int id, const void *data, int dataSize, int offset) 4023 + { 4024 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4025 + glBindBuffer(GL_ARRAY_BUFFER, id); 4026 + glBufferSubData(GL_ARRAY_BUFFER, offset, dataSize, data); 4027 + #endif 4028 + } 4029 + 4030 + // Update vertex buffer elements with new data 4031 + // NOTE: dataSize and offset must be provided in bytes 4032 + void rlUpdateVertexBufferElements(unsigned int id, const void *data, int dataSize, int offset) 4033 + { 4034 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4035 + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id); 4036 + glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, offset, dataSize, data); 4037 + #endif 4038 + } 4039 + 4040 + // Enable vertex array object (VAO) 4041 + bool rlEnableVertexArray(unsigned int vaoId) 4042 + { 4043 + bool result = false; 4044 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4045 + if (RLGL.ExtSupported.vao) 4046 + { 4047 + glBindVertexArray(vaoId); 4048 + result = true; 4049 + } 4050 + #endif 4051 + return result; 4052 + } 4053 + 4054 + // Disable vertex array object (VAO) 4055 + void rlDisableVertexArray(void) 4056 + { 4057 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4058 + if (RLGL.ExtSupported.vao) glBindVertexArray(0); 4059 + #endif 4060 + } 4061 + 4062 + // Enable vertex attribute index 4063 + void rlEnableVertexAttribute(unsigned int index) 4064 + { 4065 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4066 + glEnableVertexAttribArray(index); 4067 + #endif 4068 + } 4069 + 4070 + // Disable vertex attribute index 4071 + void rlDisableVertexAttribute(unsigned int index) 4072 + { 4073 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4074 + glDisableVertexAttribArray(index); 4075 + #endif 4076 + } 4077 + 4078 + // Draw vertex array 4079 + void rlDrawVertexArray(int offset, int count) 4080 + { 4081 + glDrawArrays(GL_TRIANGLES, offset, count); 4082 + } 4083 + 4084 + // Draw vertex array elements 4085 + void rlDrawVertexArrayElements(int offset, int count, const void *buffer) 4086 + { 4087 + // NOTE: Added pointer math separately from function to avoid UBSAN complaining 4088 + unsigned short *bufferPtr = (unsigned short *)buffer; 4089 + if (offset > 0) bufferPtr += offset; 4090 + 4091 + glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)bufferPtr); 4092 + } 4093 + 4094 + // Draw vertex array instanced 4095 + void rlDrawVertexArrayInstanced(int offset, int count, int instances) 4096 + { 4097 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4098 + glDrawArraysInstanced(GL_TRIANGLES, offset, count, instances); 4099 + #endif 4100 + } 4101 + 4102 + // Draw vertex array elements instanced 4103 + void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffer, int instances) 4104 + { 4105 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4106 + // NOTE: Added pointer math separately from function to avoid UBSAN complaining 4107 + unsigned short *bufferPtr = (unsigned short *)buffer; 4108 + if (offset > 0) bufferPtr += offset; 4109 + 4110 + glDrawElementsInstanced(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)bufferPtr, instances); 4111 + #endif 4112 + } 4113 + 4114 + // Enable vertex state pointer 4115 + void rlEnableStatePointer(int vertexAttribType, void *buffer) 4116 + { 4117 + #if defined(GRAPHICS_API_OPENGL_11) 4118 + if (buffer != NULL) glEnableClientState(vertexAttribType); 4119 + switch (vertexAttribType) 4120 + { 4121 + case GL_VERTEX_ARRAY: glVertexPointer(3, GL_FLOAT, 0, buffer); break; 4122 + case GL_TEXTURE_COORD_ARRAY: glTexCoordPointer(2, GL_FLOAT, 0, buffer); break; 4123 + case GL_NORMAL_ARRAY: if (buffer != NULL) glNormalPointer(GL_FLOAT, 0, buffer); break; 4124 + case GL_COLOR_ARRAY: if (buffer != NULL) glColorPointer(4, GL_UNSIGNED_BYTE, 0, buffer); break; 4125 + //case GL_INDEX_ARRAY: if (buffer != NULL) glIndexPointer(GL_SHORT, 0, buffer); break; // Indexed colors 4126 + default: break; 4127 + } 4128 + #endif 4129 + } 4130 + 4131 + // Disable vertex state pointer 4132 + void rlDisableStatePointer(int vertexAttribType) 4133 + { 4134 + #if defined(GRAPHICS_API_OPENGL_11) 4135 + glDisableClientState(vertexAttribType); 4136 + #endif 4137 + } 4138 + 4139 + // Load vertex array object (VAO) 4140 + unsigned int rlLoadVertexArray(void) 4141 + { 4142 + unsigned int vaoId = 0; 4143 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return vaoId; } 4144 + 4145 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4146 + if (RLGL.ExtSupported.vao) glGenVertexArrays(1, &vaoId); 4147 + #endif 4148 + 4149 + return vaoId; 4150 + } 4151 + 4152 + // Set vertex attribute 4153 + void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, int offset) 4154 + { 4155 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4156 + // NOTE: Data type could be: GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT 4157 + // Additional types (depends on OpenGL version or extensions): 4158 + // - GL_HALF_FLOAT, GL_FLOAT, GL_DOUBLE, GL_FIXED, 4159 + // - GL_INT_2_10_10_10_REV, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_10F_11F_11F_REV 4160 + 4161 + size_t offsetNative = offset; 4162 + glVertexAttribPointer(index, compSize, type, normalized, stride, (void *)offsetNative); 4163 + #endif 4164 + } 4165 + 4166 + // Set vertex attribute divisor 4167 + void rlSetVertexAttributeDivisor(unsigned int index, int divisor) 4168 + { 4169 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4170 + glVertexAttribDivisor(index, divisor); 4171 + #endif 4172 + } 4173 + 4174 + // Unload vertex array object (VAO) 4175 + void rlUnloadVertexArray(unsigned int vaoId) 4176 + { 4177 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4178 + if (RLGL.ExtSupported.vao) 4179 + { 4180 + glBindVertexArray(0); 4181 + glDeleteVertexArrays(1, &vaoId); 4182 + TRACELOG(RL_LOG_INFO, "VAO: [ID %i] Unloaded vertex array data from VRAM (GPU)", vaoId); 4183 + } 4184 + #endif 4185 + } 4186 + 4187 + // Unload vertex buffer (VBO) 4188 + void rlUnloadVertexBuffer(unsigned int vboId) 4189 + { 4190 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4191 + glDeleteBuffers(1, &vboId); 4192 + //TRACELOG(RL_LOG_INFO, "VBO: Unloaded vertex data from VRAM (GPU)"); 4193 + #endif 4194 + } 4195 + 4196 + // Shaders management 4197 + //----------------------------------------------------------------------------------------------- 4198 + // Load (compile) shader and return shader id 4199 + unsigned int rlLoadShader(const char *code, int type) 4200 + { 4201 + unsigned int shaderId = 0; 4202 + 4203 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4204 + shaderId = glCreateShader(type); 4205 + glShaderSource(shaderId, 1, &code, NULL); 4206 + 4207 + GLint success = 0; 4208 + glCompileShader(shaderId); 4209 + glGetShaderiv(shaderId, GL_COMPILE_STATUS, &success); 4210 + 4211 + if (success == GL_FALSE) 4212 + { 4213 + switch (type) 4214 + { 4215 + case GL_VERTEX_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to compile vertex shader code", shaderId); break; 4216 + case GL_FRAGMENT_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to compile fragment shader code", shaderId); break; 4217 + //case GL_GEOMETRY_SHADER: 4218 + #if defined(GRAPHICS_API_OPENGL_43) 4219 + case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to compile compute shader code", shaderId); break; 4220 + #elif defined(GRAPHICS_API_OPENGL_33) 4221 + case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: Compute shaders not enabled. Define GRAPHICS_API_OPENGL_43", shaderId); break; 4222 + #endif 4223 + default: break; 4224 + } 4225 + 4226 + int maxLength = 0; 4227 + glGetShaderiv(shaderId, GL_INFO_LOG_LENGTH, &maxLength); 4228 + 4229 + if (maxLength > 0) 4230 + { 4231 + int length = 0; 4232 + char *log = (char *)RL_CALLOC(maxLength, sizeof(char)); 4233 + glGetShaderInfoLog(shaderId, maxLength, &length, log); 4234 + TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Compile error: %s", shaderId, log); 4235 + RL_FREE(log); 4236 + } 4237 + 4238 + // Unload object allocated by glCreateShader(), 4239 + // despite failing in the compilation process 4240 + glDeleteShader(shaderId); 4241 + shaderId = 0; 4242 + } 4243 + else 4244 + { 4245 + switch (type) 4246 + { 4247 + case GL_VERTEX_SHADER: TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Vertex shader compiled successfully", shaderId); break; 4248 + case GL_FRAGMENT_SHADER: TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Fragment shader compiled successfully", shaderId); break; 4249 + //case GL_GEOMETRY_SHADER: 4250 + #if defined(GRAPHICS_API_OPENGL_43) 4251 + case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Compute shader compiled successfully", shaderId); break; 4252 + #elif defined(GRAPHICS_API_OPENGL_33) 4253 + case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: Compute shaders not enabled. Define GRAPHICS_API_OPENGL_43", shaderId); break; 4254 + #endif 4255 + default: break; 4256 + } 4257 + } 4258 + #endif 4259 + 4260 + return shaderId; 4261 + } 4262 + 4263 + // Load shader program from code strings 4264 + // NOTE: If shader string is NULL, using default vertex/fragment shaders 4265 + unsigned int rlLoadShaderProgram(const char *vsCode, const char *fsCode) 4266 + { 4267 + unsigned int id = 0; // Shader program id 4268 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return id; } 4269 + 4270 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4271 + unsigned int vertexShaderId = 0; 4272 + unsigned int fragmentShaderId = 0; 4273 + 4274 + // Compile vertex shader (if provided) 4275 + // NOTE: If not vertex shader is provided, use default one 4276 + if (vsCode != NULL) vertexShaderId = rlLoadShader(vsCode, GL_VERTEX_SHADER); 4277 + else vertexShaderId = RLGL.State.defaultVShaderId; 4278 + 4279 + // Compile fragment shader (if provided) 4280 + // NOTE: If not vertex shader is provided, use default one 4281 + if (fsCode != NULL) fragmentShaderId = rlLoadShader(fsCode, GL_FRAGMENT_SHADER); 4282 + else fragmentShaderId = RLGL.State.defaultFShaderId; 4283 + 4284 + // In case vertex and fragment shader are the default ones, no need to recompile, assign the default shader program id 4285 + if ((vertexShaderId == RLGL.State.defaultVShaderId) && (fragmentShaderId == RLGL.State.defaultFShaderId)) id = RLGL.State.defaultShaderId; 4286 + else if ((vertexShaderId > 0) && (fragmentShaderId > 0)) 4287 + { 4288 + // One of or both shader are new, a new shader program needs to be compiled 4289 + id = rlLoadShaderProgramEx(vertexShaderId, fragmentShaderId); 4290 + 4291 + // Detaching and deleting vertex/fragment shaders (if not default ones) 4292 + // WARNING: Detach shader before deletion to make sure memory is freed 4293 + if (vertexShaderId != RLGL.State.defaultVShaderId) 4294 + { 4295 + // WARNING: Shader program linkage could fail and returned id is 0 4296 + if (id > 0) glDetachShader(id, vertexShaderId); 4297 + glDeleteShader(vertexShaderId); 4298 + } 4299 + if (fragmentShaderId != RLGL.State.defaultFShaderId) 4300 + { 4301 + // WARNING: Shader program linkage could fail and returned id is 0 4302 + if (id > 0) glDetachShader(id, fragmentShaderId); 4303 + glDeleteShader(fragmentShaderId); 4304 + } 4305 + 4306 + // In case shader program loading failed, assign default shader 4307 + if (id == 0) 4308 + { 4309 + // In case shader loading fails, reassigning default shader 4310 + TRACELOG(RL_LOG_WARNING, "SHADER: Failed to load custom shader code, using default shader"); 4311 + id = RLGL.State.defaultShaderId; 4312 + } 4313 + /* 4314 + else 4315 + { 4316 + // Get available shader uniforms 4317 + // NOTE: This information is useful for debug... 4318 + int uniformCount = -1; 4319 + glGetProgramiv(id, GL_ACTIVE_UNIFORMS, &uniformCount); 4320 + 4321 + for (int i = 0; i < uniformCount; i++) 4322 + { 4323 + int namelen = -1; 4324 + int num = -1; 4325 + char name[256] = { 0 }; // Assume no variable names longer than 256 4326 + GLenum type = GL_ZERO; 4327 + 4328 + // Get the name of the uniforms 4329 + glGetActiveUniform(id, i, sizeof(name) - 1, &namelen, &num, &type, name); 4330 + 4331 + name[namelen] = 0; 4332 + TRACELOG(RL_LOG_DEBUG, "SHADER: [ID %i] Active uniform (%s) set at location: %i", id, name, glGetUniformLocation(id, name)); 4333 + } 4334 + } 4335 + */ 4336 + } 4337 + #endif 4338 + 4339 + return id; 4340 + } 4341 + 4342 + // Load shader program from already loaded shader ids 4343 + unsigned int rlLoadShaderProgramEx(unsigned int vsId, unsigned int fsId) 4344 + { 4345 + unsigned int programId = 0; 4346 + if (!isGpuReady) { TRACELOG(RL_LOG_WARNING, "GL: GPU is not ready to load data, trying to load before InitWindow()?"); return programId; } 4347 + 4348 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4349 + GLint success = 0; 4350 + programId = glCreateProgram(); 4351 + 4352 + glAttachShader(programId, vsId); 4353 + glAttachShader(programId, fsId); 4354 + 4355 + // Default attribute shader locations must be bound before linking 4356 + // NOTE: There is no problem with binding a generic attribute index to an attribute variable name 4357 + // that is never used; if some attrib name is no found on the shader, it locations becomes -1 4358 + glBindAttribLocation(programId, RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION, RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION); 4359 + glBindAttribLocation(programId, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD); 4360 + glBindAttribLocation(programId, RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL, RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL); 4361 + glBindAttribLocation(programId, RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR, RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR); 4362 + glBindAttribLocation(programId, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT, RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT); 4363 + glBindAttribLocation(programId, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2); 4364 + glBindAttribLocation(programId, RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM, RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCETRANSFORM); 4365 + glBindAttribLocation(programId, RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES); 4366 + glBindAttribLocation(programId, RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS); 4367 + 4368 + glLinkProgram(programId); 4369 + 4370 + // NOTE: All uniform variables are intitialised to 0 when a program links 4371 + 4372 + glGetProgramiv(programId, GL_LINK_STATUS, &success); 4373 + 4374 + if (success == GL_FALSE) 4375 + { 4376 + TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to link shader program", programId); 4377 + 4378 + int maxLength = 0; 4379 + glGetProgramiv(programId, GL_INFO_LOG_LENGTH, &maxLength); 4380 + 4381 + if (maxLength > 0) 4382 + { 4383 + int length = 0; 4384 + char *log = (char *)RL_CALLOC(maxLength, sizeof(char)); 4385 + glGetProgramInfoLog(programId, maxLength, &length, log); 4386 + TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Link error: %s", programId, log); 4387 + RL_FREE(log); 4388 + } 4389 + 4390 + glDeleteProgram(programId); 4391 + 4392 + programId = 0; 4393 + } 4394 + else 4395 + { 4396 + // Get the size of compiled shader program (not available on OpenGL ES 2.0) 4397 + // NOTE: If GL_LINK_STATUS is GL_FALSE, program binary length is zero 4398 + //GLint binarySize = 0; 4399 + //glGetProgramiv(id, GL_PROGRAM_BINARY_LENGTH, &binarySize); 4400 + 4401 + TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Program shader loaded successfully", programId); 4402 + } 4403 + #endif 4404 + return programId; 4405 + } 4406 + 4407 + // Load compute shader program 4408 + unsigned int rlLoadShaderProgramCompute(unsigned int csId) 4409 + { 4410 + unsigned int programId = 0; 4411 + 4412 + #if defined(GRAPHICS_API_OPENGL_43) 4413 + GLint success = 0; 4414 + programId = glCreateProgram(); 4415 + 4416 + glAttachShader(programId, csId); 4417 + 4418 + glLinkProgram(programId); 4419 + 4420 + // NOTE: All uniform variables are intitialised to 0 when a program links 4421 + 4422 + glGetProgramiv(programId, GL_LINK_STATUS, &success); 4423 + 4424 + if (success == GL_FALSE) 4425 + { 4426 + TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to link compute shader program", programId); 4427 + 4428 + int maxLength = 0; 4429 + glGetProgramiv(programId, GL_INFO_LOG_LENGTH, &maxLength); 4430 + 4431 + if (maxLength > 0) 4432 + { 4433 + int length = 0; 4434 + char *log = (char *)RL_CALLOC(maxLength, sizeof(char)); 4435 + glGetProgramInfoLog(programId, maxLength, &length, log); 4436 + TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Link error: %s", programId, log); 4437 + RL_FREE(log); 4438 + } 4439 + 4440 + glDeleteProgram(programId); 4441 + 4442 + programId = 0; 4443 + } 4444 + else 4445 + { 4446 + // Get the size of compiled shader program (not available on OpenGL ES 2.0) 4447 + // NOTE: If GL_LINK_STATUS is GL_FALSE, program binary length is zero 4448 + //GLint binarySize = 0; 4449 + //glGetProgramiv(id, GL_PROGRAM_BINARY_LENGTH, &binarySize); 4450 + 4451 + TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Compute shader program loaded successfully", programId); 4452 + } 4453 + #else 4454 + TRACELOG(RL_LOG_WARNING, "SHADER: Compute shaders not supported, enable GRAPHICS_API_OPENGL_43"); 4455 + #endif 4456 + 4457 + return programId; 4458 + } 4459 + 4460 + // Delete shader 4461 + void rlUnloadShader(unsigned int id) 4462 + { 4463 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4464 + glDeleteShader(id); 4465 + 4466 + TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Unloaded shader data from VRAM (GPU)", id); 4467 + #endif 4468 + } 4469 + 4470 + // Unload shader program 4471 + void rlUnloadShaderProgram(unsigned int id) 4472 + { 4473 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4474 + glDeleteProgram(id); 4475 + 4476 + TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Unloaded shader program data from VRAM (GPU)", id); 4477 + #endif 4478 + } 4479 + 4480 + // Get shader location uniform 4481 + // NOTE: First parameter refers to shader program id 4482 + int rlGetLocationUniform(unsigned int id, const char *uniformName) 4483 + { 4484 + int location = -1; 4485 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4486 + location = glGetUniformLocation(id, uniformName); 4487 + 4488 + //if (location == -1) TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to find shader uniform: %s", shaderId, uniformName); 4489 + //else TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Shader uniform (%s) set at location: %i", shaderId, uniformName, location); 4490 + #endif 4491 + return location; 4492 + } 4493 + 4494 + // Get shader location attribute 4495 + // NOTE: First parameter refers to shader program id 4496 + int rlGetLocationAttrib(unsigned int id, const char *attribName) 4497 + { 4498 + int location = -1; 4499 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4500 + location = glGetAttribLocation(id, attribName); 4501 + 4502 + //if (location == -1) TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to find shader attribute: %s", shaderId, attribName); 4503 + //else TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Shader attribute (%s) set at location: %i", shaderId, attribName, location); 4504 + #endif 4505 + return location; 4506 + } 4507 + 4508 + // Set shader value uniform 4509 + void rlSetUniform(int locIndex, const void *value, int uniformType, int count) 4510 + { 4511 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4512 + switch (uniformType) 4513 + { 4514 + case RL_SHADER_UNIFORM_FLOAT: glUniform1fv(locIndex, count, (float *)value); break; 4515 + case RL_SHADER_UNIFORM_VEC2: glUniform2fv(locIndex, count, (float *)value); break; 4516 + case RL_SHADER_UNIFORM_VEC3: glUniform3fv(locIndex, count, (float *)value); break; 4517 + case RL_SHADER_UNIFORM_VEC4: glUniform4fv(locIndex, count, (float *)value); break; 4518 + case RL_SHADER_UNIFORM_INT: glUniform1iv(locIndex, count, (int *)value); break; 4519 + case RL_SHADER_UNIFORM_IVEC2: glUniform2iv(locIndex, count, (int *)value); break; 4520 + case RL_SHADER_UNIFORM_IVEC3: glUniform3iv(locIndex, count, (int *)value); break; 4521 + case RL_SHADER_UNIFORM_IVEC4: glUniform4iv(locIndex, count, (int *)value); break; 4522 + #if !defined(GRAPHICS_API_OPENGL_ES2) 4523 + case RL_SHADER_UNIFORM_UINT: glUniform1uiv(locIndex, count, (unsigned int *)value); break; 4524 + case RL_SHADER_UNIFORM_UIVEC2: glUniform2uiv(locIndex, count, (unsigned int *)value); break; 4525 + case RL_SHADER_UNIFORM_UIVEC3: glUniform3uiv(locIndex, count, (unsigned int *)value); break; 4526 + case RL_SHADER_UNIFORM_UIVEC4: glUniform4uiv(locIndex, count, (unsigned int *)value); break; 4527 + #endif 4528 + case RL_SHADER_UNIFORM_SAMPLER2D: glUniform1iv(locIndex, count, (int *)value); break; 4529 + default: TRACELOG(RL_LOG_WARNING, "SHADER: Failed to set uniform value, data type not recognized"); 4530 + } 4531 + #endif 4532 + } 4533 + 4534 + // Set shader value attribute 4535 + void rlSetVertexAttributeDefault(int locIndex, const void *value, int attribType, int count) 4536 + { 4537 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4538 + switch (attribType) 4539 + { 4540 + case RL_SHADER_ATTRIB_FLOAT: if (count == 1) glVertexAttrib1fv(locIndex, (float *)value); break; 4541 + case RL_SHADER_ATTRIB_VEC2: if (count == 2) glVertexAttrib2fv(locIndex, (float *)value); break; 4542 + case RL_SHADER_ATTRIB_VEC3: if (count == 3) glVertexAttrib3fv(locIndex, (float *)value); break; 4543 + case RL_SHADER_ATTRIB_VEC4: if (count == 4) glVertexAttrib4fv(locIndex, (float *)value); break; 4544 + default: TRACELOG(RL_LOG_WARNING, "SHADER: Failed to set attrib default value, data type not recognized"); 4545 + } 4546 + #endif 4547 + } 4548 + 4549 + // Set shader value uniform matrix 4550 + void rlSetUniformMatrix(int locIndex, Matrix mat) 4551 + { 4552 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4553 + glUniformMatrix4fv(locIndex, 1, false, rlMatrixToFloat(mat)); 4554 + #endif 4555 + } 4556 + 4557 + // Set shader value uniform matrix 4558 + void rlSetUniformMatrices(int locIndex, const Matrix *matrices, int count) 4559 + { 4560 + #if defined(GRAPHICS_API_OPENGL_33) 4561 + glUniformMatrix4fv(locIndex, count, true, (const float *)matrices); 4562 + #elif defined(GRAPHICS_API_OPENGL_ES2) 4563 + // WARNING: WebGL does not support Matrix transpose ("true" parameter) 4564 + // REF: https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix 4565 + glUniformMatrix4fv(locIndex, count, false, (const float *)matrices); 4566 + #endif 4567 + } 4568 + 4569 + // Set shader value uniform sampler 4570 + void rlSetUniformSampler(int locIndex, unsigned int textureId) 4571 + { 4572 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4573 + // Check if texture is already active 4574 + for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) 4575 + { 4576 + if (RLGL.State.activeTextureId[i] == textureId) 4577 + { 4578 + glUniform1i(locIndex, 1 + i); 4579 + return; 4580 + } 4581 + } 4582 + 4583 + // Register a new active texture for the internal batch system 4584 + // NOTE: Default texture is always activated as GL_TEXTURE0 4585 + for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) 4586 + { 4587 + if (RLGL.State.activeTextureId[i] == 0) 4588 + { 4589 + glUniform1i(locIndex, 1 + i); // Activate new texture unit 4590 + RLGL.State.activeTextureId[i] = textureId; // Save texture id for binding on drawing 4591 + break; 4592 + } 4593 + } 4594 + #endif 4595 + } 4596 + 4597 + // Set shader currently active (id and locations) 4598 + void rlSetShader(unsigned int id, int *locs) 4599 + { 4600 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4601 + if (RLGL.State.currentShaderId != id) 4602 + { 4603 + rlDrawRenderBatch(RLGL.currentBatch); 4604 + RLGL.State.currentShaderId = id; 4605 + RLGL.State.currentShaderLocs = locs; 4606 + } 4607 + #endif 4608 + } 4609 + 4610 + // Dispatch compute shader (equivalent to *draw* for graphics pilepine) 4611 + void rlComputeShaderDispatch(unsigned int groupX, unsigned int groupY, unsigned int groupZ) 4612 + { 4613 + #if defined(GRAPHICS_API_OPENGL_43) 4614 + glDispatchCompute(groupX, groupY, groupZ); 4615 + #endif 4616 + } 4617 + 4618 + // Load shader storage buffer object (SSBO) 4619 + unsigned int rlLoadShaderBuffer(unsigned int size, const void *data, int usageHint) 4620 + { 4621 + unsigned int ssbo = 0; 4622 + 4623 + #if defined(GRAPHICS_API_OPENGL_43) 4624 + glGenBuffers(1, &ssbo); 4625 + glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo); 4626 + glBufferData(GL_SHADER_STORAGE_BUFFER, size, data, usageHint? usageHint : RL_STREAM_COPY); 4627 + if (data == NULL) glClearBufferData(GL_SHADER_STORAGE_BUFFER, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, NULL); // Clear buffer data to 0 4628 + glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); 4629 + #else 4630 + TRACELOG(RL_LOG_WARNING, "SSBO: SSBO not enabled. Define GRAPHICS_API_OPENGL_43"); 4631 + #endif 4632 + 4633 + return ssbo; 4634 + } 4635 + 4636 + // Unload shader storage buffer object (SSBO) 4637 + void rlUnloadShaderBuffer(unsigned int ssboId) 4638 + { 4639 + #if defined(GRAPHICS_API_OPENGL_43) 4640 + glDeleteBuffers(1, &ssboId); 4641 + #else 4642 + TRACELOG(RL_LOG_WARNING, "SSBO: SSBO not enabled. Define GRAPHICS_API_OPENGL_43"); 4643 + #endif 4644 + } 4645 + 4646 + // Update SSBO buffer data 4647 + void rlUpdateShaderBuffer(unsigned int id, const void *data, unsigned int dataSize, unsigned int offset) 4648 + { 4649 + #if defined(GRAPHICS_API_OPENGL_43) 4650 + glBindBuffer(GL_SHADER_STORAGE_BUFFER, id); 4651 + glBufferSubData(GL_SHADER_STORAGE_BUFFER, offset, dataSize, data); 4652 + #endif 4653 + } 4654 + 4655 + // Get SSBO buffer size 4656 + unsigned int rlGetShaderBufferSize(unsigned int id) 4657 + { 4658 + unsigned int result = 0; 4659 + #if defined(GRAPHICS_API_OPENGL_43) 4660 + GLint64 size = 0; 4661 + glBindBuffer(GL_SHADER_STORAGE_BUFFER, id); 4662 + glGetBufferParameteri64v(GL_SHADER_STORAGE_BUFFER, GL_BUFFER_SIZE, &size); 4663 + if (size > 0) result = (unsigned int)size; 4664 + #endif 4665 + return result; 4666 + } 4667 + 4668 + // Read SSBO buffer data (GPU->CPU) 4669 + void rlReadShaderBuffer(unsigned int id, void *dest, unsigned int count, unsigned int offset) 4670 + { 4671 + #if defined(GRAPHICS_API_OPENGL_43) 4672 + glBindBuffer(GL_SHADER_STORAGE_BUFFER, id); 4673 + glGetBufferSubData(GL_SHADER_STORAGE_BUFFER, offset, count, dest); 4674 + #endif 4675 + } 4676 + 4677 + // Bind SSBO buffer 4678 + void rlBindShaderBuffer(unsigned int id, unsigned int index) 4679 + { 4680 + #if defined(GRAPHICS_API_OPENGL_43) 4681 + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, index, id); 4682 + #endif 4683 + } 4684 + 4685 + // Copy SSBO buffer data 4686 + void rlCopyShaderBuffer(unsigned int destId, unsigned int srcId, unsigned int destOffset, unsigned int srcOffset, unsigned int count) 4687 + { 4688 + #if defined(GRAPHICS_API_OPENGL_43) 4689 + glBindBuffer(GL_COPY_READ_BUFFER, srcId); 4690 + glBindBuffer(GL_COPY_WRITE_BUFFER, destId); 4691 + glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, srcOffset, destOffset, count); 4692 + #endif 4693 + } 4694 + 4695 + // Bind image texture 4696 + void rlBindImageTexture(unsigned int id, unsigned int index, int format, bool readonly) 4697 + { 4698 + #if defined(GRAPHICS_API_OPENGL_43) 4699 + unsigned int glInternalFormat = 0, glFormat = 0, glType = 0; 4700 + 4701 + rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); 4702 + glBindImageTexture(index, id, 0, 0, 0, readonly? GL_READ_ONLY : GL_READ_WRITE, glInternalFormat); 4703 + #else 4704 + TRACELOG(RL_LOG_WARNING, "TEXTURE: Image texture binding not enabled. Define GRAPHICS_API_OPENGL_43"); 4705 + #endif 4706 + } 4707 + 4708 + // Matrix state management 4709 + //----------------------------------------------------------------------------------------- 4710 + // Get internal modelview matrix 4711 + Matrix rlGetMatrixModelview(void) 4712 + { 4713 + Matrix matrix = rlMatrixIdentity(); 4714 + #if defined(GRAPHICS_API_OPENGL_11) 4715 + float mat[16]; 4716 + glGetFloatv(GL_MODELVIEW_MATRIX, mat); 4717 + matrix.m0 = mat[0]; 4718 + matrix.m1 = mat[1]; 4719 + matrix.m2 = mat[2]; 4720 + matrix.m3 = mat[3]; 4721 + matrix.m4 = mat[4]; 4722 + matrix.m5 = mat[5]; 4723 + matrix.m6 = mat[6]; 4724 + matrix.m7 = mat[7]; 4725 + matrix.m8 = mat[8]; 4726 + matrix.m9 = mat[9]; 4727 + matrix.m10 = mat[10]; 4728 + matrix.m11 = mat[11]; 4729 + matrix.m12 = mat[12]; 4730 + matrix.m13 = mat[13]; 4731 + matrix.m14 = mat[14]; 4732 + matrix.m15 = mat[15]; 4733 + #else 4734 + matrix = RLGL.State.modelview; 4735 + #endif 4736 + return matrix; 4737 + } 4738 + 4739 + // Get internal projection matrix 4740 + Matrix rlGetMatrixProjection(void) 4741 + { 4742 + #if defined(GRAPHICS_API_OPENGL_11) 4743 + float mat[16]; 4744 + glGetFloatv(GL_PROJECTION_MATRIX,mat); 4745 + Matrix m; 4746 + m.m0 = mat[0]; 4747 + m.m1 = mat[1]; 4748 + m.m2 = mat[2]; 4749 + m.m3 = mat[3]; 4750 + m.m4 = mat[4]; 4751 + m.m5 = mat[5]; 4752 + m.m6 = mat[6]; 4753 + m.m7 = mat[7]; 4754 + m.m8 = mat[8]; 4755 + m.m9 = mat[9]; 4756 + m.m10 = mat[10]; 4757 + m.m11 = mat[11]; 4758 + m.m12 = mat[12]; 4759 + m.m13 = mat[13]; 4760 + m.m14 = mat[14]; 4761 + m.m15 = mat[15]; 4762 + return m; 4763 + #else 4764 + return RLGL.State.projection; 4765 + #endif 4766 + } 4767 + 4768 + // Get internal accumulated transform matrix 4769 + Matrix rlGetMatrixTransform(void) 4770 + { 4771 + Matrix mat = rlMatrixIdentity(); 4772 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4773 + // TODO: Consider possible transform matrices in the RLGL.State.stack 4774 + //Matrix matStackTransform = rlMatrixIdentity(); 4775 + //for (int i = RLGL.State.stackCounter; i > 0; i--) matStackTransform = rlMatrixMultiply(RLGL.State.stack[i], matStackTransform); 4776 + 4777 + mat = RLGL.State.transform; 4778 + #endif 4779 + return mat; 4780 + } 4781 + 4782 + // Get internal projection matrix for stereo render (selected eye) 4783 + Matrix rlGetMatrixProjectionStereo(int eye) 4784 + { 4785 + Matrix mat = rlMatrixIdentity(); 4786 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4787 + mat = RLGL.State.projectionStereo[eye]; 4788 + #endif 4789 + return mat; 4790 + } 4791 + 4792 + // Get internal view offset matrix for stereo render (selected eye) 4793 + Matrix rlGetMatrixViewOffsetStereo(int eye) 4794 + { 4795 + Matrix mat = rlMatrixIdentity(); 4796 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4797 + mat = RLGL.State.viewOffsetStereo[eye]; 4798 + #endif 4799 + return mat; 4800 + } 4801 + 4802 + // Set a custom modelview matrix (replaces internal modelview matrix) 4803 + void rlSetMatrixModelview(Matrix view) 4804 + { 4805 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4806 + RLGL.State.modelview = view; 4807 + #endif 4808 + } 4809 + 4810 + // Set a custom projection matrix (replaces internal projection matrix) 4811 + void rlSetMatrixProjection(Matrix projection) 4812 + { 4813 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4814 + RLGL.State.projection = projection; 4815 + #endif 4816 + } 4817 + 4818 + // Set eyes projection matrices for stereo rendering 4819 + void rlSetMatrixProjectionStereo(Matrix right, Matrix left) 4820 + { 4821 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4822 + RLGL.State.projectionStereo[0] = right; 4823 + RLGL.State.projectionStereo[1] = left; 4824 + #endif 4825 + } 4826 + 4827 + // Set eyes view offsets matrices for stereo rendering 4828 + void rlSetMatrixViewOffsetStereo(Matrix right, Matrix left) 4829 + { 4830 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4831 + RLGL.State.viewOffsetStereo[0] = right; 4832 + RLGL.State.viewOffsetStereo[1] = left; 4833 + #endif 4834 + } 4835 + 4836 + // Load and draw a quad in NDC 4837 + void rlLoadDrawQuad(void) 4838 + { 4839 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4840 + unsigned int quadVAO = 0; 4841 + unsigned int quadVBO = 0; 4842 + 4843 + float vertices[] = { 4844 + // Positions Texcoords 4845 + -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 4846 + -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 4847 + 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 4848 + 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 4849 + }; 4850 + 4851 + // Gen VAO to contain VBO 4852 + glGenVertexArrays(1, &quadVAO); 4853 + glBindVertexArray(quadVAO); 4854 + 4855 + // Gen and fill vertex buffer (VBO) 4856 + glGenBuffers(1, &quadVBO); 4857 + glBindBuffer(GL_ARRAY_BUFFER, quadVBO); 4858 + glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), &vertices, GL_STATIC_DRAW); 4859 + 4860 + // Bind vertex attributes (position, texcoords) 4861 + glEnableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION); 4862 + glVertexAttribPointer(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION, 3, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void *)0); // Positions 4863 + glEnableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD); 4864 + glVertexAttribPointer(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void *)(3*sizeof(float))); // Texcoords 4865 + 4866 + // Draw quad 4867 + glBindVertexArray(quadVAO); 4868 + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 4869 + glBindVertexArray(0); 4870 + 4871 + // Delete buffers (VBO and VAO) 4872 + glDeleteBuffers(1, &quadVBO); 4873 + glDeleteVertexArrays(1, &quadVAO); 4874 + #endif 4875 + } 4876 + 4877 + // Load and draw a cube in NDC 4878 + void rlLoadDrawCube(void) 4879 + { 4880 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4881 + unsigned int cubeVAO = 0; 4882 + unsigned int cubeVBO = 0; 4883 + 4884 + float vertices[] = { 4885 + // Positions Normals Texcoords 4886 + -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 4887 + 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, 4888 + 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, 4889 + 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, 4890 + -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 4891 + -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 4892 + -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 4893 + 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 4894 + 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 4895 + 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 4896 + -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 4897 + -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 4898 + -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 4899 + -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 4900 + -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 4901 + -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 4902 + -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4903 + -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 4904 + 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 4905 + 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 4906 + 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 4907 + 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 4908 + 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 4909 + 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4910 + -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 4911 + 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, 4912 + 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, 4913 + 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, 4914 + -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 4915 + -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 4916 + -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 4917 + 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 4918 + 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 4919 + 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 4920 + -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 4921 + -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f 4922 + }; 4923 + 4924 + // Gen VAO to contain VBO 4925 + glGenVertexArrays(1, &cubeVAO); 4926 + glBindVertexArray(cubeVAO); 4927 + 4928 + // Gen and fill vertex buffer (VBO) 4929 + glGenBuffers(1, &cubeVBO); 4930 + glBindBuffer(GL_ARRAY_BUFFER, cubeVBO); 4931 + glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); 4932 + 4933 + // Bind vertex attributes (position, normals, texcoords) 4934 + glBindVertexArray(cubeVAO); 4935 + glEnableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION); 4936 + glVertexAttribPointer(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION, 3, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void *)0); // Positions 4937 + glEnableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL); 4938 + glVertexAttribPointer(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL, 3, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void *)(3*sizeof(float))); // Normals 4939 + glEnableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD); 4940 + glVertexAttribPointer(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void *)(6*sizeof(float))); // Texcoords 4941 + glBindBuffer(GL_ARRAY_BUFFER, 0); 4942 + glBindVertexArray(0); 4943 + 4944 + // Draw cube 4945 + glBindVertexArray(cubeVAO); 4946 + glDrawArrays(GL_TRIANGLES, 0, 36); 4947 + glBindVertexArray(0); 4948 + 4949 + // Delete VBO and VAO 4950 + glDeleteBuffers(1, &cubeVBO); 4951 + glDeleteVertexArrays(1, &cubeVAO); 4952 + #endif 4953 + } 4954 + 4955 + // Get name string for pixel format 4956 + const char *rlGetPixelFormatName(unsigned int format) 4957 + { 4958 + switch (format) 4959 + { 4960 + case RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: return "GRAYSCALE"; break; // 8 bit per pixel (no alpha) 4961 + case RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: return "GRAY_ALPHA"; break; // 8*2 bpp (2 channels) 4962 + case RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5: return "R5G6B5"; break; // 16 bpp 4963 + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8: return "R8G8B8"; break; // 24 bpp 4964 + case RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: return "R5G5B5A1"; break; // 16 bpp (1 bit alpha) 4965 + case RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: return "R4G4B4A4"; break; // 16 bpp (4 bit alpha) 4966 + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: return "R8G8B8A8"; break; // 32 bpp 4967 + case RL_PIXELFORMAT_UNCOMPRESSED_R32: return "R32"; break; // 32 bpp (1 channel - float) 4968 + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: return "R32G32B32"; break; // 32*3 bpp (3 channels - float) 4969 + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: return "R32G32B32A32"; break; // 32*4 bpp (4 channels - float) 4970 + case RL_PIXELFORMAT_UNCOMPRESSED_R16: return "R16"; break; // 16 bpp (1 channel - half float) 4971 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: return "R16G16B16"; break; // 16*3 bpp (3 channels - half float) 4972 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: return "R16G16B16A16"; break; // 16*4 bpp (4 channels - half float) 4973 + case RL_PIXELFORMAT_COMPRESSED_DXT1_RGB: return "DXT1_RGB"; break; // 4 bpp (no alpha) 4974 + case RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA: return "DXT1_RGBA"; break; // 4 bpp (1 bit alpha) 4975 + case RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA: return "DXT3_RGBA"; break; // 8 bpp 4976 + case RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA: return "DXT5_RGBA"; break; // 8 bpp 4977 + case RL_PIXELFORMAT_COMPRESSED_ETC1_RGB: return "ETC1_RGB"; break; // 4 bpp 4978 + case RL_PIXELFORMAT_COMPRESSED_ETC2_RGB: return "ETC2_RGB"; break; // 4 bpp 4979 + case RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: return "ETC2_RGBA"; break; // 8 bpp 4980 + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGB: return "PVRT_RGB"; break; // 4 bpp 4981 + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA: return "PVRT_RGBA"; break; // 4 bpp 4982 + case RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: return "ASTC_4x4_RGBA"; break; // 8 bpp 4983 + case RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: return "ASTC_8x8_RGBA"; break; // 2 bpp 4984 + default: return "UNKNOWN"; break; 4985 + } 4986 + } 4987 + 4988 + //---------------------------------------------------------------------------------- 4989 + // Module Functions Definition 4990 + //---------------------------------------------------------------------------------- 4991 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 4992 + // Load default shader (just vertex positioning and texture coloring) 4993 + // NOTE: This shader program is used for internal buffers 4994 + // NOTE: Loaded: RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs 4995 + static void rlLoadShaderDefault(void) 4996 + { 4997 + RLGL.State.defaultShaderLocs = (int *)RL_CALLOC(RL_MAX_SHADER_LOCATIONS, sizeof(int)); 4998 + 4999 + // NOTE: All locations must be reseted to -1 (no location) 5000 + for (int i = 0; i < RL_MAX_SHADER_LOCATIONS; i++) RLGL.State.defaultShaderLocs[i] = -1; 5001 + 5002 + // Vertex shader directly defined, no external file required 5003 + const char *defaultVShaderCode = 5004 + #if defined(GRAPHICS_API_OPENGL_21) 5005 + "#version 120 \n" 5006 + "attribute vec3 vertexPosition; \n" 5007 + "attribute vec2 vertexTexCoord; \n" 5008 + "attribute vec4 vertexColor; \n" 5009 + "varying vec2 fragTexCoord; \n" 5010 + "varying vec4 fragColor; \n" 5011 + #elif defined(GRAPHICS_API_OPENGL_33) 5012 + "#version 330 \n" 5013 + "in vec3 vertexPosition; \n" 5014 + "in vec2 vertexTexCoord; \n" 5015 + "in vec4 vertexColor; \n" 5016 + "out vec2 fragTexCoord; \n" 5017 + "out vec4 fragColor; \n" 5018 + #endif 5019 + 5020 + #if defined(GRAPHICS_API_OPENGL_ES3) 5021 + "#version 300 es \n" 5022 + "precision mediump float; \n" // Precision required for OpenGL ES3 (WebGL 2) (on some browsers) 5023 + "in vec3 vertexPosition; \n" 5024 + "in vec2 vertexTexCoord; \n" 5025 + "in vec4 vertexColor; \n" 5026 + "out vec2 fragTexCoord; \n" 5027 + "out vec4 fragColor; \n" 5028 + #elif defined(GRAPHICS_API_OPENGL_ES2) 5029 + "#version 100 \n" 5030 + "precision mediump float; \n" // Precision required for OpenGL ES2 (WebGL) (on some browsers) 5031 + "attribute vec3 vertexPosition; \n" 5032 + "attribute vec2 vertexTexCoord; \n" 5033 + "attribute vec4 vertexColor; \n" 5034 + "varying vec2 fragTexCoord; \n" 5035 + "varying vec4 fragColor; \n" 5036 + #endif 5037 + 5038 + "uniform mat4 mvp; \n" 5039 + "void main() \n" 5040 + "{ \n" 5041 + " fragTexCoord = vertexTexCoord; \n" 5042 + " fragColor = vertexColor; \n" 5043 + " gl_Position = mvp*vec4(vertexPosition, 1.0); \n" 5044 + "} \n"; 5045 + 5046 + // Fragment shader directly defined, no external file required 5047 + const char *defaultFShaderCode = 5048 + #if defined(GRAPHICS_API_OPENGL_21) 5049 + "#version 120 \n" 5050 + "varying vec2 fragTexCoord; \n" 5051 + "varying vec4 fragColor; \n" 5052 + "uniform sampler2D texture0; \n" 5053 + "uniform vec4 colDiffuse; \n" 5054 + "void main() \n" 5055 + "{ \n" 5056 + " vec4 texelColor = texture2D(texture0, fragTexCoord); \n" 5057 + " gl_FragColor = texelColor*colDiffuse*fragColor; \n" 5058 + "} \n"; 5059 + #elif defined(GRAPHICS_API_OPENGL_33) 5060 + "#version 330 \n" 5061 + "in vec2 fragTexCoord; \n" 5062 + "in vec4 fragColor; \n" 5063 + "out vec4 finalColor; \n" 5064 + "uniform sampler2D texture0; \n" 5065 + "uniform vec4 colDiffuse; \n" 5066 + "void main() \n" 5067 + "{ \n" 5068 + " vec4 texelColor = texture(texture0, fragTexCoord); \n" 5069 + " finalColor = texelColor*colDiffuse*fragColor; \n" 5070 + "} \n"; 5071 + #endif 5072 + 5073 + #if defined(GRAPHICS_API_OPENGL_ES3) 5074 + "#version 300 es \n" 5075 + "precision mediump float; \n" // Precision required for OpenGL ES3 (WebGL 2) 5076 + "in vec2 fragTexCoord; \n" 5077 + "in vec4 fragColor; \n" 5078 + "out vec4 finalColor; \n" 5079 + "uniform sampler2D texture0; \n" 5080 + "uniform vec4 colDiffuse; \n" 5081 + "void main() \n" 5082 + "{ \n" 5083 + " vec4 texelColor = texture(texture0, fragTexCoord); \n" 5084 + " finalColor = texelColor*colDiffuse*fragColor; \n" 5085 + "} \n"; 5086 + #elif defined(GRAPHICS_API_OPENGL_ES2) 5087 + "#version 100 \n" 5088 + "precision mediump float; \n" // Precision required for OpenGL ES2 (WebGL) 5089 + "varying vec2 fragTexCoord; \n" 5090 + "varying vec4 fragColor; \n" 5091 + "uniform sampler2D texture0; \n" 5092 + "uniform vec4 colDiffuse; \n" 5093 + "void main() \n" 5094 + "{ \n" 5095 + " vec4 texelColor = texture2D(texture0, fragTexCoord); \n" 5096 + " gl_FragColor = texelColor*colDiffuse*fragColor; \n" 5097 + "} \n"; 5098 + #endif 5099 + 5100 + // NOTE: Compiled vertex/fragment shaders are not deleted, 5101 + // they are kept for re-use as default shaders in case some shader loading fails 5102 + RLGL.State.defaultVShaderId = rlLoadShader(defaultVShaderCode, GL_VERTEX_SHADER); // Compile default vertex shader 5103 + RLGL.State.defaultFShaderId = rlLoadShader(defaultFShaderCode, GL_FRAGMENT_SHADER); // Compile default fragment shader 5104 + 5105 + RLGL.State.defaultShaderId = rlLoadShaderProgramEx(RLGL.State.defaultVShaderId, RLGL.State.defaultFShaderId); 5106 + 5107 + if (RLGL.State.defaultShaderId > 0) 5108 + { 5109 + TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Default shader loaded successfully", RLGL.State.defaultShaderId); 5110 + 5111 + // Set default shader locations: attributes locations 5112 + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_VERTEX_POSITION] = glGetAttribLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION); 5113 + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01] = glGetAttribLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD); 5114 + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_VERTEX_COLOR] = glGetAttribLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR); 5115 + 5116 + // Set default shader locations: uniform locations 5117 + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_MATRIX_MVP] = glGetUniformLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_UNIFORM_NAME_MVP); 5118 + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_COLOR_DIFFUSE] = glGetUniformLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR); 5119 + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_MAP_DIFFUSE] = glGetUniformLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0); 5120 + } 5121 + else TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to load default shader", RLGL.State.defaultShaderId); 5122 + } 5123 + 5124 + // Unload default shader 5125 + // NOTE: Unloads: RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs 5126 + static void rlUnloadShaderDefault(void) 5127 + { 5128 + glUseProgram(0); 5129 + 5130 + glDetachShader(RLGL.State.defaultShaderId, RLGL.State.defaultVShaderId); 5131 + glDetachShader(RLGL.State.defaultShaderId, RLGL.State.defaultFShaderId); 5132 + glDeleteShader(RLGL.State.defaultVShaderId); 5133 + glDeleteShader(RLGL.State.defaultFShaderId); 5134 + 5135 + glDeleteProgram(RLGL.State.defaultShaderId); 5136 + 5137 + RL_FREE(RLGL.State.defaultShaderLocs); 5138 + 5139 + TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Default shader unloaded successfully", RLGL.State.defaultShaderId); 5140 + } 5141 + 5142 + #if RLGL_SHOW_GL_DETAILS_INFO 5143 + // Get compressed format official GL identifier name 5144 + static const char *rlGetCompressedFormatName(int format) 5145 + { 5146 + switch (format) 5147 + { 5148 + // GL_EXT_texture_compression_s3tc 5149 + case 0x83F0: return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT"; break; 5150 + case 0x83F1: return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT"; break; 5151 + case 0x83F2: return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT"; break; 5152 + case 0x83F3: return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT"; break; 5153 + // GL_3DFX_texture_compression_FXT1 5154 + case 0x86B0: return "GL_COMPRESSED_RGB_FXT1_3DFX"; break; 5155 + case 0x86B1: return "GL_COMPRESSED_RGBA_FXT1_3DFX"; break; 5156 + // GL_IMG_texture_compression_pvrtc 5157 + case 0x8C00: return "GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG"; break; 5158 + case 0x8C01: return "GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG"; break; 5159 + case 0x8C02: return "GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG"; break; 5160 + case 0x8C03: return "GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG"; break; 5161 + // GL_OES_compressed_ETC1_RGB8_texture 5162 + case 0x8D64: return "GL_ETC1_RGB8_OES"; break; 5163 + // GL_ARB_texture_compression_rgtc 5164 + case 0x8DBB: return "GL_COMPRESSED_RED_RGTC1"; break; 5165 + case 0x8DBC: return "GL_COMPRESSED_SIGNED_RED_RGTC1"; break; 5166 + case 0x8DBD: return "GL_COMPRESSED_RG_RGTC2"; break; 5167 + case 0x8DBE: return "GL_COMPRESSED_SIGNED_RG_RGTC2"; break; 5168 + // GL_ARB_texture_compression_bptc 5169 + case 0x8E8C: return "GL_COMPRESSED_RGBA_BPTC_UNORM_ARB"; break; 5170 + case 0x8E8D: return "GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB"; break; 5171 + case 0x8E8E: return "GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB"; break; 5172 + case 0x8E8F: return "GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB"; break; 5173 + // GL_ARB_ES3_compatibility 5174 + case 0x9274: return "GL_COMPRESSED_RGB8_ETC2"; break; 5175 + case 0x9275: return "GL_COMPRESSED_SRGB8_ETC2"; break; 5176 + case 0x9276: return "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2"; break; 5177 + case 0x9277: return "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2"; break; 5178 + case 0x9278: return "GL_COMPRESSED_RGBA8_ETC2_EAC"; break; 5179 + case 0x9279: return "GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"; break; 5180 + case 0x9270: return "GL_COMPRESSED_R11_EAC"; break; 5181 + case 0x9271: return "GL_COMPRESSED_SIGNED_R11_EAC"; break; 5182 + case 0x9272: return "GL_COMPRESSED_RG11_EAC"; break; 5183 + case 0x9273: return "GL_COMPRESSED_SIGNED_RG11_EAC"; break; 5184 + // GL_KHR_texture_compression_astc_hdr 5185 + case 0x93B0: return "GL_COMPRESSED_RGBA_ASTC_4x4_KHR"; break; 5186 + case 0x93B1: return "GL_COMPRESSED_RGBA_ASTC_5x4_KHR"; break; 5187 + case 0x93B2: return "GL_COMPRESSED_RGBA_ASTC_5x5_KHR"; break; 5188 + case 0x93B3: return "GL_COMPRESSED_RGBA_ASTC_6x5_KHR"; break; 5189 + case 0x93B4: return "GL_COMPRESSED_RGBA_ASTC_6x6_KHR"; break; 5190 + case 0x93B5: return "GL_COMPRESSED_RGBA_ASTC_8x5_KHR"; break; 5191 + case 0x93B6: return "GL_COMPRESSED_RGBA_ASTC_8x6_KHR"; break; 5192 + case 0x93B7: return "GL_COMPRESSED_RGBA_ASTC_8x8_KHR"; break; 5193 + case 0x93B8: return "GL_COMPRESSED_RGBA_ASTC_10x5_KHR"; break; 5194 + case 0x93B9: return "GL_COMPRESSED_RGBA_ASTC_10x6_KHR"; break; 5195 + case 0x93BA: return "GL_COMPRESSED_RGBA_ASTC_10x8_KHR"; break; 5196 + case 0x93BB: return "GL_COMPRESSED_RGBA_ASTC_10x10_KHR"; break; 5197 + case 0x93BC: return "GL_COMPRESSED_RGBA_ASTC_12x10_KHR"; break; 5198 + case 0x93BD: return "GL_COMPRESSED_RGBA_ASTC_12x12_KHR"; break; 5199 + case 0x93D0: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR"; break; 5200 + case 0x93D1: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR"; break; 5201 + case 0x93D2: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR"; break; 5202 + case 0x93D3: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR"; break; 5203 + case 0x93D4: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR"; break; 5204 + case 0x93D5: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR"; break; 5205 + case 0x93D6: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR"; break; 5206 + case 0x93D7: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR"; break; 5207 + case 0x93D8: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR"; break; 5208 + case 0x93D9: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR"; break; 5209 + case 0x93DA: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR"; break; 5210 + case 0x93DB: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR"; break; 5211 + case 0x93DC: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR"; break; 5212 + case 0x93DD: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"; break; 5213 + default: return "GL_COMPRESSED_UNKNOWN"; break; 5214 + } 5215 + } 5216 + #endif 5217 + 5218 + #endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 5219 + 5220 + // Get pixel data size in bytes (image or texture) 5221 + // NOTE: Size depends on pixel format 5222 + static int rlGetPixelDataSize(int width, int height, int format) 5223 + { 5224 + int dataSize = 0; // Size in bytes 5225 + int bpp = 0; // Bits per pixel 5226 + 5227 + switch (format) 5228 + { 5229 + case RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: bpp = 8; break; 5230 + case RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: 5231 + case RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5: 5232 + case RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: 5233 + case RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: bpp = 16; break; 5234 + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: bpp = 32; break; 5235 + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8: bpp = 24; break; 5236 + case RL_PIXELFORMAT_UNCOMPRESSED_R32: bpp = 32; break; 5237 + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: bpp = 32*3; break; 5238 + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: bpp = 32*4; break; 5239 + case RL_PIXELFORMAT_UNCOMPRESSED_R16: bpp = 16; break; 5240 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: bpp = 16*3; break; 5241 + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: bpp = 16*4; break; 5242 + case RL_PIXELFORMAT_COMPRESSED_DXT1_RGB: 5243 + case RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA: 5244 + case RL_PIXELFORMAT_COMPRESSED_ETC1_RGB: 5245 + case RL_PIXELFORMAT_COMPRESSED_ETC2_RGB: 5246 + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGB: 5247 + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA: // 8 bytes per each 4x4 block 5248 + { 5249 + int blockWidth = (width + 3)/4; 5250 + int blockHeight = (height + 3)/4; 5251 + dataSize = blockWidth*blockHeight*8; 5252 + } break; 5253 + case RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA: 5254 + case RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA: 5255 + case RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: 5256 + case RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: // 16 bytes per each 4x4 block 5257 + { 5258 + int blockWidth = (width + 3)/4; 5259 + int blockHeight = (height + 3)/4; 5260 + dataSize = blockWidth*blockHeight*16; 5261 + } break; 5262 + case RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: // 4 bytes per each 4x4 block 5263 + { 5264 + int blockWidth = (width + 3)/4; 5265 + int blockHeight = (height + 3)/4; 5266 + dataSize = blockWidth*blockHeight*4; 5267 + } break; 5268 + default: break; 5269 + } 5270 + 5271 + // Compute dataSize for uncompressed texture data (no blocks) 5272 + if ((format >= RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) && 5273 + (format <= RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16)) 5274 + { 5275 + double bytesPerPixel = (double)bpp/8.0; 5276 + dataSize = (int)(bytesPerPixel*width*height); // Total data size in bytes 5277 + } 5278 + 5279 + return dataSize; 5280 + } 5281 + 5282 + // Auxiliar math functions 5283 + //------------------------------------------------------------------------------- 5284 + // Get identity matrix 5285 + static Matrix rlMatrixIdentity(void) 5286 + { 5287 + Matrix matIdentity = { 0 }; 5288 + matIdentity.m0 = 1.0f; 5289 + matIdentity.m5 = 1.0f; 5290 + matIdentity.m10 = 1.0f; 5291 + matIdentity.m15 = 1.0f; 5292 + 5293 + return matIdentity; 5294 + } 5295 + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) 5296 + // Get float array of matrix data 5297 + // Explicit conversion to column-major memory layout 5298 + static rl_float16 rlMatrixToFloatV(Matrix mat) 5299 + { 5300 + rl_float16 result = { 0 }; 5301 + 5302 + result.v[0] = mat.m0; 5303 + result.v[1] = mat.m1; 5304 + result.v[2] = mat.m2; 5305 + result.v[3] = mat.m3; 5306 + result.v[4] = mat.m4; 5307 + result.v[5] = mat.m5; 5308 + result.v[6] = mat.m6; 5309 + result.v[7] = mat.m7; 5310 + result.v[8] = mat.m8; 5311 + result.v[9] = mat.m9; 5312 + result.v[10] = mat.m10; 5313 + result.v[11] = mat.m11; 5314 + result.v[12] = mat.m12; 5315 + result.v[13] = mat.m13; 5316 + result.v[14] = mat.m14; 5317 + result.v[15] = mat.m15; 5318 + 5319 + return result; 5320 + } 5321 + 5322 + // Get two matrix multiplication 5323 + // NOTE: When multiplying matrices... the order matters! 5324 + static Matrix rlMatrixMultiply(Matrix left, Matrix right) 5325 + { 5326 + Matrix result = { 0 }; 5327 + 5328 + result.m0 = left.m0*right.m0 + left.m1*right.m4 + left.m2*right.m8 + left.m3*right.m12; 5329 + result.m1 = left.m0*right.m1 + left.m1*right.m5 + left.m2*right.m9 + left.m3*right.m13; 5330 + result.m2 = left.m0*right.m2 + left.m1*right.m6 + left.m2*right.m10 + left.m3*right.m14; 5331 + result.m3 = left.m0*right.m3 + left.m1*right.m7 + left.m2*right.m11 + left.m3*right.m15; 5332 + result.m4 = left.m4*right.m0 + left.m5*right.m4 + left.m6*right.m8 + left.m7*right.m12; 5333 + result.m5 = left.m4*right.m1 + left.m5*right.m5 + left.m6*right.m9 + left.m7*right.m13; 5334 + result.m6 = left.m4*right.m2 + left.m5*right.m6 + left.m6*right.m10 + left.m7*right.m14; 5335 + result.m7 = left.m4*right.m3 + left.m5*right.m7 + left.m6*right.m11 + left.m7*right.m15; 5336 + result.m8 = left.m8*right.m0 + left.m9*right.m4 + left.m10*right.m8 + left.m11*right.m12; 5337 + result.m9 = left.m8*right.m1 + left.m9*right.m5 + left.m10*right.m9 + left.m11*right.m13; 5338 + result.m10 = left.m8*right.m2 + left.m9*right.m6 + left.m10*right.m10 + left.m11*right.m14; 5339 + result.m11 = left.m8*right.m3 + left.m9*right.m7 + left.m10*right.m11 + left.m11*right.m15; 5340 + result.m12 = left.m12*right.m0 + left.m13*right.m4 + left.m14*right.m8 + left.m15*right.m12; 5341 + result.m13 = left.m12*right.m1 + left.m13*right.m5 + left.m14*right.m9 + left.m15*right.m13; 5342 + result.m14 = left.m12*right.m2 + left.m13*right.m6 + left.m14*right.m10 + left.m15*right.m14; 5343 + result.m15 = left.m12*right.m3 + left.m13*right.m7 + left.m14*right.m11 + left.m15*right.m15; 5344 + 5345 + return result; 5346 + } 5347 + 5348 + // Transposes provided matrix 5349 + static Matrix rlMatrixTranspose(Matrix mat) 5350 + { 5351 + Matrix result = { 0 }; 5352 + 5353 + result.m0 = mat.m0; 5354 + result.m1 = mat.m4; 5355 + result.m2 = mat.m8; 5356 + result.m3 = mat.m12; 5357 + result.m4 = mat.m1; 5358 + result.m5 = mat.m5; 5359 + result.m6 = mat.m9; 5360 + result.m7 = mat.m13; 5361 + result.m8 = mat.m2; 5362 + result.m9 = mat.m6; 5363 + result.m10 = mat.m10; 5364 + result.m11 = mat.m14; 5365 + result.m12 = mat.m3; 5366 + result.m13 = mat.m7; 5367 + result.m14 = mat.m11; 5368 + result.m15 = mat.m15; 5369 + 5370 + return result; 5371 + } 5372 + 5373 + // Invert provided matrix 5374 + static Matrix rlMatrixInvert(Matrix mat) 5375 + { 5376 + Matrix result = { 0 }; 5377 + 5378 + // Cache the matrix values (speed optimization) 5379 + float a00 = mat.m0, a01 = mat.m1, a02 = mat.m2, a03 = mat.m3; 5380 + float a10 = mat.m4, a11 = mat.m5, a12 = mat.m6, a13 = mat.m7; 5381 + float a20 = mat.m8, a21 = mat.m9, a22 = mat.m10, a23 = mat.m11; 5382 + float a30 = mat.m12, a31 = mat.m13, a32 = mat.m14, a33 = mat.m15; 5383 + 5384 + float b00 = a00*a11 - a01*a10; 5385 + float b01 = a00*a12 - a02*a10; 5386 + float b02 = a00*a13 - a03*a10; 5387 + float b03 = a01*a12 - a02*a11; 5388 + float b04 = a01*a13 - a03*a11; 5389 + float b05 = a02*a13 - a03*a12; 5390 + float b06 = a20*a31 - a21*a30; 5391 + float b07 = a20*a32 - a22*a30; 5392 + float b08 = a20*a33 - a23*a30; 5393 + float b09 = a21*a32 - a22*a31; 5394 + float b10 = a21*a33 - a23*a31; 5395 + float b11 = a22*a33 - a23*a32; 5396 + 5397 + // Calculate the invert determinant (inlined to avoid double-caching) 5398 + float invDet = 1.0f/(b00*b11 - b01*b10 + b02*b09 + b03*b08 - b04*b07 + b05*b06); 5399 + 5400 + result.m0 = (a11*b11 - a12*b10 + a13*b09)*invDet; 5401 + result.m1 = (-a01*b11 + a02*b10 - a03*b09)*invDet; 5402 + result.m2 = (a31*b05 - a32*b04 + a33*b03)*invDet; 5403 + result.m3 = (-a21*b05 + a22*b04 - a23*b03)*invDet; 5404 + result.m4 = (-a10*b11 + a12*b08 - a13*b07)*invDet; 5405 + result.m5 = (a00*b11 - a02*b08 + a03*b07)*invDet; 5406 + result.m6 = (-a30*b05 + a32*b02 - a33*b01)*invDet; 5407 + result.m7 = (a20*b05 - a22*b02 + a23*b01)*invDet; 5408 + result.m8 = (a10*b10 - a11*b08 + a13*b06)*invDet; 5409 + result.m9 = (-a00*b10 + a01*b08 - a03*b06)*invDet; 5410 + result.m10 = (a30*b04 - a31*b02 + a33*b00)*invDet; 5411 + result.m11 = (-a20*b04 + a21*b02 - a23*b00)*invDet; 5412 + result.m12 = (-a10*b09 + a11*b07 - a12*b06)*invDet; 5413 + result.m13 = (a00*b09 - a01*b07 + a02*b06)*invDet; 5414 + result.m14 = (-a30*b03 + a31*b01 - a32*b00)*invDet; 5415 + result.m15 = (a20*b03 - a21*b01 + a22*b00)*invDet; 5416 + 5417 + return result; 5418 + } 5419 + #endif 5420 + 5421 + #endif // RLGL_IMPLEMENTATION
linked-libs/raylib-6.0_linux_amd64/lib/libraylib.a

This is a binary file and will not be displayed.

+1
linked-libs/raylib-6.0_linux_amd64/lib/libraylib.so
··· 1 + libraylib.so.600
linked-libs/raylib-6.0_linux_amd64/lib/libraylib.so.6.0.0

This is a binary file and will not be displayed.

+1
linked-libs/raylib-6.0_linux_amd64/lib/libraylib.so.600
··· 1 + libraylib.so.6.0.0
+12
manifest.json
··· 1 + { 2 + "provides" : "raylib", 3 + "sources" : [ "src/**" ], 4 + "linklib-dir" : "linked-libs", 5 + "targets" : { 6 + "linux-x64" : { 7 + "link-args" : [ "X11" ], 8 + "dependencies" : [], 9 + "linked-libraries" : [ "raylib-6.0_linux_amd64/lib/raylib.a" ] 10 + } 11 + } 12 + }
scripts/.gitkeep

This is a binary file and will not be displayed.

+695
src/raylib.c3i
··· 1 + module raylib6::rl; 2 + 3 + alias Color = char[<4>]; 4 + alias Vector2 = float[<2>]; 5 + alias Vector3 = float[<3>]; 6 + alias Vector4 = float[<4>]; 7 + alias Quaternion = Vector4; 8 + alias Context = void*; 9 + 10 + struct Matrix { 11 + float m0, m4, m8, m12; 12 + float m1, m5, m9, m13; 13 + float m2, m6, m10, m14; 14 + float m3, m7, m11, m15; 15 + } 16 + 17 + struct Rectangle { 18 + float x, y; 19 + float width, height; 20 + } 21 + 22 + struct Image { 23 + void *data; 24 + int width; 25 + int height; 26 + int mipmaps; 27 + int format; 28 + } 29 + 30 + struct Texture { 31 + uint id; 32 + int width, height; 33 + int mipmaps; 34 + int format; 35 + } 36 + 37 + alias Texture2D = Texture; 38 + 39 + alias TextureCubemap = Texture; 40 + 41 + struct RenderTexture { 42 + uint id; 43 + Texture texture; 44 + Texture depth; 45 + } 46 + 47 + alias RenderTexture2D = RenderTexture; 48 + 49 + struct NPatchInfo { 50 + Rectangle source; 51 + int left, top, right, bottom; 52 + int layout; 53 + } 54 + 55 + struct GlyphInfo { 56 + int value; 57 + int offset_x, offset_y; 58 + int advance_x; 59 + Image image; 60 + } 61 + 62 + struct Font { 63 + int base_size; 64 + int glyph_count; 65 + int glyph_padding; 66 + Texture2D texture; 67 + Rectangle *recs; 68 + GlyphInfo *glyphs; 69 + } 70 + 71 + struct Camera3D { 72 + Vector3 position; 73 + Vector3 target; 74 + Vector3 up; 75 + float fov_y; 76 + int projection; 77 + } 78 + 79 + alias Camera = Camera3D; 80 + 81 + struct Camera2D { 82 + Vector2 offset; 83 + Vector2 target; 84 + float rotation, zoom; 85 + } 86 + 87 + struct Mesh { 88 + int vertext_count; 89 + int triangle_count; 90 + 91 + float *vertices; 92 + float *texcoords; 93 + float *texcoords2; 94 + float *normals; 95 + float *tangents; 96 + char *colors; 97 + ushort *indices; 98 + int bone_count; 99 + char *bone_indices; 100 + float *bone_weights; 101 + float *anim_vertices; 102 + float *anim_normals; 103 + uint vao_id; 104 + uint *vbo_id; 105 + } 106 + 107 + struct Shader { 108 + uint id; 109 + int *locs; 110 + } 111 + 112 + struct MaterialMap { 113 + Texture2D texture; 114 + Color color; 115 + float value; 116 + } 117 + 118 + struct Material { 119 + Shader shader; 120 + MaterialMap *maps; 121 + float[4] params; 122 + } 123 + 124 + struct Transform { 125 + Vector3 translation; 126 + Quaternion rotation; 127 + Vector3 scale; 128 + } 129 + 130 + alias ModelAnimPose = Transform*; 131 + 132 + struct BoneInfo { 133 + char[32] name; 134 + int parent; 135 + } 136 + 137 + struct ModelSkeleton { 138 + int bone_count; 139 + BoneInfo *bones; 140 + ModelAnimPose bind_pose; 141 + } 142 + 143 + struct Model { 144 + Matrix transform; 145 + int mesh_count; 146 + int material_count; 147 + Mesh *meshes; 148 + Material *materials; 149 + int *mesh_material; 150 + ModelSkeleton skeleton; 151 + ModelAnimPose current_pose; 152 + Matrix *bone_matrices; 153 + } 154 + 155 + struct ModelAnimation { 156 + char[32] name; 157 + int bone_count; 158 + int keyframe_count; 159 + ModelAnimPose *keyframe_poses; 160 + } 161 + 162 + struct Ray { 163 + Vector3 position; 164 + Vector3 direction; 165 + } 166 + 167 + struct RayCollision { 168 + bool hit; 169 + float distance; 170 + Vector3 point; 171 + Vector3 normal; 172 + } 173 + 174 + struct BoundingBox { 175 + Vector3 min; 176 + Vector3 max; 177 + } 178 + 179 + struct Wave { 180 + uint frame_count; 181 + uint sample_rate; 182 + uint sample_size; 183 + uint channels; 184 + void *data; 185 + } 186 + 187 + alias RAudioBuffer = void; 188 + alias RAudioProcessor = void; 189 + 190 + struct AudioStream { 191 + RAudioBuffer *buffer; 192 + RAudioProcessor *processor; 193 + uint sample_rate; 194 + uint sample_size; 195 + uint channels; 196 + } 197 + 198 + struct Sound { 199 + AudioStream steam; 200 + uint frame_count; 201 + } 202 + 203 + struct Music { 204 + AudioStream stream; 205 + uint frame_count; 206 + bool looping; 207 + int ctx_type; 208 + void *ctx_data; 209 + } 210 + 211 + struct VrDeviceInfo { 212 + int h_resolution; 213 + int v_resolution; 214 + float h_screen_size; 215 + float v_screen_size; 216 + float eye_to_screen_distance; 217 + float lens_separation_distance; 218 + float interpupillary_distance; 219 + float[4] lens_distortion_values; 220 + float[4] chroma_ab_correction; 221 + } 222 + 223 + struct VrStereoConfig { 224 + Matrix[2] projection; 225 + Matrix[2] view_offset; 226 + float[2] left_lens_center; 227 + float[2] right_lens_center; 228 + float[2] left_screen_center; 229 + float[2] right_screen_center; 230 + float[2] scale; 231 + float[2] scale_in; 232 + } 233 + 234 + struct FilePathList { 235 + uint count; 236 + char **paths; 237 + } 238 + 239 + struct AutomationEvent { 240 + uint frame; 241 + uint type; 242 + int[4] params; 243 + } 244 + 245 + struct AutomationEventList { 246 + uint capacity; 247 + uint count; 248 + AutomationEvent *events; 249 + } 250 + 251 + constdef ConfigFlags { 252 + VSYNC_HINT = 0x00000040, 253 + FULLSCREEN_MODE = 0x00000002, 254 + WINDOW_RESIZABLE = 0x00000004, 255 + WINDOW_UNDECORATED = 0x00000008, 256 + WINDOW_HIDDEN = 0x00000080, 257 + WINDOW_MINIMIZED = 0x00000200, 258 + WINDOW_MAXIMIZED = 0x00000400, 259 + WINDOW_UNFOCUSED = 0x00000800, 260 + WINDOW_TOPMOST = 0x00001000, 261 + WINDOW_ALWAYS_RUN = 0x00000100, 262 + WINDOW_TRANSPARENT = 0x00000010, 263 + WINDOW_HIGHDPI = 0x00002000, 264 + WINDOW_MOUSE_PASSTHROUGH = 0x00004000, 265 + BORDERLESS_WINDOWED_MODE = 0x00008000, 266 + MSAA_4X_HINT = 0x00000020, 267 + INTERLACED_HINT = 0x00010000 268 + } 269 + 270 + enum TraceLogLevel { 271 + ALL, 272 + TRACE, 273 + DEBUG, 274 + INFO, 275 + WARNING, 276 + ERROR, 277 + FATAL, 278 + NONE 279 + } 280 + 281 + constdef KeyboardKey { 282 + NULL = 0, // Key: NULL, used for no key pressed 283 + // Alphanumeric keys 284 + APOSTROPHE = 39, // Key: ' 285 + COMMA = 44, // Key: , 286 + MINUS = 45, // Key: - 287 + PERIOD = 46, // Key: . 288 + SLASH = 47, // Key: / 289 + ZERO = 48, // Key: 0 290 + ONE = 49, // Key: 1 291 + TWO = 50, // Key: 2 292 + THREE = 51, // Key: 3 293 + FOUR = 52, // Key: 4 294 + FIVE = 53, // Key: 5 295 + SIX = 54, // Key: 6 296 + SEVEN = 55, // Key: 7 297 + EIGHT = 56, // Key: 8 298 + NINE = 57, // Key: 9 299 + SEMICOLON = 59, // Key: ; 300 + EQUAL = 61, // Key: = 301 + A = 65, // Key: A | a 302 + B = 66, // Key: B | b 303 + C = 67, // Key: C | c 304 + D = 68, // Key: D | d 305 + E = 69, // Key: E | e 306 + F = 70, // Key: F | f 307 + G = 71, // Key: G | g 308 + H = 72, // Key: H | h 309 + I = 73, // Key: I | i 310 + J = 74, // Key: J | j 311 + K = 75, // Key: K | k 312 + L = 76, // Key: L | l 313 + M = 77, // Key: M | m 314 + N = 78, // Key: N | n 315 + O = 79, // Key: O | o 316 + P = 80, // Key: P | p 317 + Q = 81, // Key: Q | q 318 + R = 82, // Key: R | r 319 + S = 83, // Key: S | s 320 + T = 84, // Key: T | t 321 + U = 85, // Key: U | u 322 + V = 86, // Key: V | v 323 + W = 87, // Key: W | w 324 + X = 88, // Key: X | x 325 + Y = 89, // Key: Y | y 326 + Z = 90, // Key: Z | z 327 + LEFT_BRACKET = 91, // Key: [ 328 + BACKSLASH = 92, // Key: '\' 329 + RIGHT_BRACKET = 93, // Key: ] 330 + GRAVE = 96, // Key: ` 331 + // Function keys 332 + SPACE = 32, // Key: Space 333 + ESCAPE = 256, // Key: Esc 334 + ENTER = 257, // Key: Enter 335 + TAB = 258, // Key: Tab 336 + BACKSPACE = 259, // Key: Backspace 337 + INSERT = 260, // Key: Ins 338 + DELETE = 261, // Key: Del 339 + RIGHT = 262, // Key: Cursor right 340 + LEFT = 263, // Key: Cursor left 341 + DOWN = 264, // Key: Cursor down 342 + UP = 265, // Key: Cursor up 343 + PAGE_UP = 266, // Key: Page up 344 + PAGE_DOWN = 267, // Key: Page down 345 + HOME = 268, // Key: Home 346 + END = 269, // Key: End 347 + CAPS_LOCK = 280, // Key: Caps lock 348 + SCROLL_LOCK = 281, // Key: Scroll down 349 + NUM_LOCK = 282, // Key: Num lock 350 + PRINT_SCREEN = 283, // Key: Print screen 351 + PAUSE = 284, // Key: Pause 352 + F1 = 290, // Key: F1 353 + F2 = 291, // Key: F2 354 + F3 = 292, // Key: F3 355 + F4 = 293, // Key: F4 356 + F5 = 294, // Key: F5 357 + F6 = 295, // Key: F6 358 + F7 = 296, // Key: F7 359 + F8 = 297, // Key: F8 360 + F9 = 298, // Key: F9 361 + F10 = 299, // Key: F10 362 + F11 = 300, // Key: F11 363 + F12 = 301, // Key: F12 364 + LEFT_SHIFT = 340, // Key: Shift left 365 + LEFT_CONTROL = 341, // Key: Control left 366 + LEFT_ALT = 342, // Key: Alt left 367 + LEFT_SUPER = 343, // Key: Super left 368 + RIGHT_SHIFT = 344, // Key: Shift right 369 + RIGHT_CONTROL = 345, // Key: Control right 370 + RIGHT_ALT = 346, // Key: Alt right 371 + RIGHT_SUPER = 347, // Key: Super right 372 + KB_MENU = 348, // Key: KB menu 373 + // Keypad keys 374 + KP_0 = 320, // Key: Keypad 0 375 + KP_1 = 321, // Key: Keypad 1 376 + KP_2 = 322, // Key: Keypad 2 377 + KP_3 = 323, // Key: Keypad 3 378 + KP_4 = 324, // Key: Keypad 4 379 + KP_5 = 325, // Key: Keypad 5 380 + KP_6 = 326, // Key: Keypad 6 381 + KP_7 = 327, // Key: Keypad 7 382 + KP_8 = 328, // Key: Keypad 8 383 + KP_9 = 329, // Key: Keypad 9 384 + KP_DECIMAL = 330, // Key: Keypad . 385 + KP_DIVIDE = 331, // Key: Keypad / 386 + KP_MULTIPLY = 332, // Key: Keypad * 387 + KP_SUBTRACT = 333, // Key: Keypad - 388 + KP_ADD = 334, // Key: Keypad + 389 + KP_ENTER = 335, // Key: Keypad Enter 390 + KP_EQUAL = 336, // Key: Keypad = 391 + // Android key buttons 392 + BACK = 4, // Key: Android back button 393 + MENU = 5, // Key: Android menu button 394 + VOLUME_UP = 24, // Key: Android volume up button 395 + VOLUME_DOWN = 25 // Key: Android volume down button 396 + 397 + } 398 + 399 + enum MouseButton { 400 + LEFT, 401 + RIGHT, 402 + MIDDLE, 403 + SIDE, 404 + EXTRA, 405 + FORWARD, 406 + BACK 407 + } 408 + 409 + enum MouseCursor { 410 + DEFAULT, 411 + ARROW, 412 + IBEAM, 413 + CROSSHAIR, 414 + POINTING_HAND, 415 + RESIZE_EW, 416 + RESIZE_NS, 417 + RESIZE_NWSE, 418 + RESIZE_NESW, 419 + RSIZE_ALL, 420 + NOT_ALLOWED 421 + } 422 + 423 + enum GamepadButton { 424 + UNKNOWN, 425 + LEFT_FACE_UP, 426 + LEFT_FACE_RIGHT, 427 + LEFT_FACE_DOWN, 428 + LEFT_FACE_LEFT, 429 + RIGHT_FACE_UP, 430 + RIGHT_FACE_RIGHT, 431 + RIGHT_FACE_DOWN, 432 + RIGHT_FACE_LEFT, 433 + LEFT_TRIGGER_1, 434 + LEFT_TRIGGER_2, 435 + RIGHT_TRIGGER_1, 436 + RIGHT_TRIGGER_2, 437 + MIDDLE_LEFT, 438 + MIDDLE_RIGHT, 439 + LEFT_THUMB, 440 + RIGHT_THUMB 441 + } 442 + 443 + enum GamepadAxis { 444 + LEFT_X, 445 + LEFT_Y, 446 + RIGHT_X, 447 + RIGHT_Y, 448 + LEFT_TRIGGER, 449 + RIGHT_TRIGGER 450 + } 451 + 452 + enum MaterialMapIndex { 453 + ALBEDO, 454 + METALNESS, 455 + NORMAL, 456 + ROUGHNESS, 457 + OCCLUSION, 458 + EMISSION, 459 + HEIGHT, 460 + CUBEMAP, 461 + IRRADIANCE, 462 + PREFILTER, 463 + BRDF 464 + } 465 + 466 + enum ShaderLocationIndex { 467 + VERTEX_POSITION, // Shader location: vertex attribute: position 468 + VERTEX_TEXCOORD01, // Shader location: vertex attribute: texcoord01 469 + VERTEX_TEXCOORD02, // Shader location: vertex attribute: texcoord02 470 + VERTEX_NORMAL, // Shader location: vertex attribute: normal 471 + VERTEX_TANGENT, // Shader location: vertex attribute: tangent 472 + VERTEX_COLOR, // Shader location: vertex attribute: color 473 + MATRIX_MVP, // Shader location: matrix uniform: model-view-projection 474 + MATRIX_VIEW, // Shader location: matrix uniform: view (camera transform) 475 + MATRIX_PROJECTION, // Shader location: matrix uniform: projection 476 + MATRIX_MODEL, // Shader location: matrix uniform: model (transform) 477 + MATRIX_NORMAL, // Shader location: matrix uniform: normal 478 + VECTOR_VIEW, // Shader location: vector uniform: view 479 + COLOR_DIFFUSE, // Shader location: vector uniform: diffuse color 480 + COLOR_SPECULAR, // Shader location: vector uniform: specular color 481 + COLOR_AMBIENT, // Shader location: vector uniform: ambient color 482 + MAP_ALBEDO, // Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE) 483 + MAP_METALNESS, // Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR) 484 + MAP_NORMAL, // Shader location: sampler2d texture: normal 485 + MAP_ROUGHNESS, // Shader location: sampler2d texture: roughness 486 + MAP_OCCLUSION, // Shader location: sampler2d texture: occlusion 487 + MAP_EMISSION, // Shader location: sampler2d texture: emission 488 + MAP_HEIGHT, // Shader location: sampler2d texture: heightmap 489 + MAP_CUBEMAP, // Shader location: samplerCube texture: cubemap 490 + MAP_IRRADIANCE, // Shader location: samplerCube texture: irradiance 491 + MAP_PREFILTER, // Shader location: samplerCube texture: prefilter 492 + MAP_BRDF, // Shader location: sampler2d texture: brdf 493 + VERTEX_BONEIDS, // Shader location: vertex attribute: bone indices 494 + VERTEX_BONEWEIGHTS, // Shader location: vertex attribute: bone weights 495 + MATRIX_BONETRANSFORMS, // Shader location: matrix attribute: bone transforms (animation) 496 + VERTEX_INSTANCETRANSFORM // Shader location: vertex attribute: instance transforms 497 + } 498 + 499 + enum ShaderUniformDataType { 500 + FLOAT, 501 + VEC2, 502 + VEC3, 503 + VEC4, 504 + INT, 505 + IVEC2, 506 + IVEC3, 507 + IVEC4, 508 + UINT, 509 + UIVEC2, 510 + UIVEC3, 511 + UIVEC4, 512 + SAMPLER2D 513 + } 514 + 515 + enum ShaderAttributeDataType { 516 + FLOAT, 517 + VEC2, 518 + VEC3, 519 + VEC4 520 + } 521 + 522 + enum PixelFormat { 523 + NONE, 524 + UNCOMPRESSED_GRAYSCALE, 525 + UNCOMPRESSED_GRAY_ALPHA, 526 + UNCOMPRESSED_R5G6B5, 527 + UNCOMPRESSED_R5G5B5A1, 528 + UNCOMPRESSED_R4G4B4A4, 529 + UNCOMPRESSED_R8G8B8A8, 530 + UNCOMPRESSED_R32, 531 + UNCOMPRESSED_R32G32B32, 532 + UNCOMPRESSED_R32G32B32A32, 533 + UNCOMPRESSED_R16, 534 + UNCOMPRESSED_R16G16B16, 535 + UNCOMPRESSED_R16G16B16A16, 536 + COMPRESSED_DXT1_RGB, 537 + COMPRESSED_DXT1_RGBA, 538 + COMPRESSED_DXT3_RGBA, 539 + COMPRESSED_DXT5_RGBA, 540 + COMPRESSED_ETC1_RGB, 541 + COMPRESSED_ETC2_RGB, 542 + COMPRESSED_ETC2_EAC_RGBA, 543 + COMPRESSED_PVRT_RGB, 544 + COMPRESSED_PVRT_RGBA, 545 + COMPRESSED_ASTC_4X4_RGBA, 546 + COMPRESSED_ASTC_8X8_RGBA 547 + } 548 + 549 + enum TextureFilter { 550 + POINT, 551 + BILINEAR, 552 + TRILINEAR, 553 + ANISOTROPIC_4X, 554 + ANISOTROPIC_8X, 555 + ANISOTROPIC_16X 556 + } 557 + 558 + enum TextureWrap { 559 + REPEAT, 560 + CLAMP, 561 + MIRROR_REPEAT, 562 + MIRROR_CLAMP 563 + } 564 + 565 + enum CubemapLayout { 566 + AUTO_DETECT, 567 + LINE_VERTICAL, 568 + LINE_HORIZONTAL, 569 + CROSS_THREE_BY_FOUR, 570 + CROSS_FOUR_BY_THREE 571 + } 572 + 573 + enum FontType { 574 + DEFAULT, 575 + BITMAP, 576 + SDF 577 + } 578 + 579 + enum BlendMode { 580 + ALPHA, 581 + ADDITIVE, 582 + MULTIPLIED, 583 + ADD_COLORS, 584 + SUBTRACT_COLORS, 585 + ALPHA_PREMULTIPLY, 586 + CUSTOM, 587 + CUSTOM_SEPARATE 588 + } 589 + 590 + constdef Gesture { 591 + NONE = 0, 592 + TAP = 1, 593 + DOUBLETAP = 2, 594 + HOLD = 4, 595 + DRAG = 8, 596 + SWIPE_RIGHT = 16, 597 + SWIP_LEFT = 32, 598 + SWIPE_UP = 64, 599 + SWIPE_DOWN = 128, 600 + PINCH_IN = 256, 601 + PINCH_OUT = 512 602 + } 603 + 604 + enum CameraMode { 605 + CUSTOM, 606 + FREE, 607 + ORBITAL, 608 + FIRST_PERSON, 609 + THIRD_PERSON 610 + } 611 + 612 + enum NPatchLayout { 613 + NINE_PATCH, 614 + THREE_PATHC_VERTICAL, 615 + THREE_PATCH_HORIZONTAL 616 + } 617 + 618 + extern fn void init_window(int width, int height, char *title) @cname("InitWindow"); 619 + extern fn void close_window() @cname("CloseWindow"); 620 + extern fn bool window_should_close() @cname("WindowShouldClose"); 621 + extern fn bool is_window_ready() @cname("IsWindowReady"); 622 + extern fn bool is_window_fullscreen() @cname("IsWindowFullscreen"); 623 + extern fn bool is_window_hidden() @cname("IsWindowHidden"); 624 + extern fn bool is_window_minimized() @cname("IsWindowMinimized"); 625 + extern fn bool is_window_maximized() @cname("IsWindowMaximized"); 626 + extern fn bool is_window_focused() @cname("IsWindowFocused"); 627 + extern fn bool is_window_resized() @cname("IsWindowResized"); 628 + extern fn bool is_window_state(uint flag) @cname("IsWindowState"); 629 + extern fn void set_window_state(uint flags) @cname("SetWindowState"); 630 + extern fn void clear_window_state(uint flags) @cname("ClearWindowState"); 631 + extern fn void toggle_fullscreen() @cname("ToggleFullscreen"); 632 + extern fn void toggle_borderless_windowed() @cname("ToggleBorderlessWindowed"); 633 + extern fn void maximize_window() @cname("MaximizeWindow"); 634 + extern fn void minimize_window() @cname("MinimizeWindow"); 635 + extern fn void restore_window() @cname("RestoreWindow"); 636 + extern fn void set_window_icon(Image image) @cname("SetWindowIcon"); 637 + extern fn void set_window_icons(Image *images, int count) @cname("SetWindowIcons"); 638 + extern fn void set_window_title(char *title) @cname("SetWindowTitle"); 639 + extern fn void set_window_position(int x, int y) @cname("SetWindowPosition"); 640 + extern fn void set_window_monitor(int monitor) @cname("SetWindowMonitor"); 641 + extern fn void set_window_min_size(int width, int height) @cname("SetWindowMinSize"); 642 + extern fn void set_window_max_size(int width, int height) @cname("SetWindowMaxSize"); 643 + extern fn void set_window_size(int width, int height) @cname("SetWindowSize"); 644 + extern fn void set_window_opacity(float opacity) @cname("SetWindowOpacity"); 645 + extern fn void set_window_focused() @cname("SetWindowFocused"); 646 + extern fn void *get_window_handle() @cname("GetWindowHandle"); 647 + extern fn int get_screen_width() @cname("GetScreenWidth"); 648 + extern fn int get_screen_height() @cname("GetScreenHeight"); 649 + extern fn int get_render_width() @cname("GetRenderWidth"); 650 + extern fn int get_render_height() @cname("GetRenderHeight"); 651 + extern fn int get_monitor_count() @cname("GetMonitorCount"); 652 + extern fn int get_current_monitor() @cname("GetCurrentMonitor"); 653 + extern fn Vector2 get_monitor_position(int monitor) @cname("GetMonitorPosition"); 654 + extern fn int get_monitor_width(int monitor) @cname("GetMonitorWidth"); 655 + extern fn int get_monitor_height(int monitor) @cname("GetMonitorHeight"); 656 + extern fn int get_monitor_physical_width(int monitor) @cname("GetMonitorPhysicalWidth"); 657 + extern fn int get_monitor_physical_height(int monitor) @cname("GetMonitorPhysicalHeight"); 658 + extern fn int get_monitor_refresh_rate(int monitor) @cname("GetMonitorRefreshRate"); 659 + extern fn Vector2 get_window_position() @cname("GetWindowPosition"); 660 + extern fn Vector2 get_window_scale_dpi() @cname("GetWindowScaleDPI"); 661 + extern fn char *get_monitor_name(int monitor) @cname("GetMonitorName"); 662 + extern fn void set_clipboard_text(char *text) @cname("SetClipboardText"); 663 + extern fn char *get_clipboard_text() @cname("GetClipboardText"); 664 + extern fn Image get_clipboard_image() @cname("GetClipboardImage"); 665 + extern fn void enable_event_waiting() @cname("EnableEventWaiting"); 666 + extern fn void disable_event_waiting() @cname("DisableEventWaiting"); 667 + extern fn void show_cursor() @cname("ShowCursor"); 668 + extern fn void hide_cursor() @cname("HideCursor"); 669 + extern fn bool is_cursor_hidden() @cname("IsCursorHidden"); 670 + extern fn void enable_cursor() @cname("EnableCursor"); 671 + extern fn void disable_cursor() @cname("DisableCursor"); 672 + extern fn bool is_cursor_on_screen() @cname("IsCursorOnScreen"); 673 + extern fn void clear_background(Color color) @cname("ClearBackground"); 674 + extern fn void begin_drawing() @cname("BeginDrawing"); 675 + extern fn void end_drawing() @cname("EndDrawing"); 676 + extern fn void begin_mode_2d(Camera2D camera) @cname("BeginMode2D"); 677 + extern fn void end_mode_2d() @cname("EndMode2D"); 678 + extern fn void begin_mode_3d(Camera3D camera) @cname("BeginMode3D"); 679 + extern fn void end_mode_3d() @cname("EndMode3D"); 680 + extern fn void begin_texture_mode(RenderTexture2D target) @cname("BeginTextureMode"); 681 + extern fn void end_texture_mode() @cname("EndTextureMode"); 682 + extern fn void begin_shader_mode(Shader shader) @cname("BeginShaderMode"); 683 + extern fn void end_shader_mode() @cname("EndShaderMode"); 684 + extern fn void begin_blend_mode(int mode) @cname("BeginBlendMode"); 685 + extern fn void end_blend_mode() @cname("EndBlendMode"); 686 + extern fn void begin_scissor_mode(int x, int y, int width, int height) @cname("BeginScissorMode"); 687 + extern fn void end_scissor_mode() @cname("EndScissorMode"); 688 + extern fn void begin_vr_stereo_mode(VrStereoConfig config) @cname("BeginVrStereoMode"); 689 + extern fn void end_vr_stereo_mode() @cname("EndVrStereoMode"); 690 + extern fn VrStereoConfig load_vr_stereo_config(VrDeviceInfo device) @cname("LoadVrStereoConfig"); 691 + extern fn void unload_vr_stereo_config(VrStereoConfig config) @cname("UnloadVrStereoConfig"); 692 + // to be continued 693 + extern fn void draw_rectangle(Rectangle rec, Color color) @cname("DrawRectangleRec"); 694 + extern fn void draw_poly(Vector2 center, int sides, float radius, float rotation, Color color) @cname("DrawPoly"); 695 + extern fn void draw_pixel(int pos_x, int pos_y, Color color) @cname("DrawPixel");
+28
test/test.c3
··· 1 + import std::io; 2 + import raylib6::rl; 3 + import libc; 4 + 5 + fn Color random_color() 6 + { 7 + return {(char)(libc::rand() % 255), (char)(libc::rand() % 255), (char) (libc::rand() % 255), (char)(libc::rand() % 255)}; 8 + } 9 + 10 + fn void main() 11 + { 12 + Rectangle rect = {50, 30, 20.0, 20.0}; 13 + Color red = {255, 0, 0, 255}; 14 + Color pink = {255, 200, 200, 255}; 15 + Vector2 true_origin = {400, 300}; 16 + rl::init_window(800, 600, "penis"); 17 + while (!rl::window_should_close()) { 18 + int screen_height = rl::get_screen_height(); 19 + int screen_width = rl::get_screen_width(); 20 + rl::begin_drawing(); 21 + for(int i = 0; i < screen_width; i++) { 22 + for (int j = 0; j < screen_height; j++) { 23 + rl::draw_pixel(i, j, random_color()); 24 + } 25 + } 26 + rl::end_drawing(); 27 + } 28 + }