356 Commits

Author SHA1 Message Date
Ray
46b9579f0c Update README.md 2026-07-16 15:03:30 +02:00
Ray
8eb613e50a Update rcore_desktop_glfw.c 2026-07-16 12:28:25 +02:00
89b4fbd298 [rcore] fic position on mouse leave for emscripten. Issue raysan5#5945 followup (#5981) 2026-07-16 12:10:03 +02:00
93e64f2210 Fix TextInsertAlloc overflow by correcting loop bounds (#5982)
Co-authored-by: gideons <gse@newspacesystems.com>
2026-07-16 12:08:41 +02:00
a9a0c046f1 Fix pixel data size regressions (#5984)
Co-authored-by: gideons <gse@newspacesystems.com>
2026-07-16 12:07:19 +02:00
d224912bd5 Fix rlsw persistent alpha blending state (#5964) 2026-07-15 21:21:38 +02:00
39706cccbe [rshapes] Fix DrawRectangleRoundedLinesEx not scaling with transform when thick=1 (#5980) 2026-07-15 21:20:18 +02:00
Ray
4640c84920 WARNING: Not updating mouse.previousPosition when SeMousePosition() #5962
This could be a sensible change, not sure if it can break anything...
2026-07-13 19:32:30 +02:00
Ray
af98e3126e Merge branch 'master' of https://github.com/raysan5/raylib 2026-07-13 19:25:08 +02:00
Ray
e063385c47 Fix #5965 2026-07-13 19:24:49 +02:00
7a247ff40f Fix swScissor() Y-axis clipping inversion in software renderer (#5976) 2026-07-13 19:19:02 +02:00
5de8c3521f fix: ImageFromImage rectangle validation use >= and <= (#5979) 2026-07-13 15:13:12 +02:00
b631fb3d05 Fix TextSubtext() returning empty string when position is 0 (#5975) 2026-07-13 15:11:42 +02:00
fb4649a3fe [rcore][desktop] Fix clipboard image memory leak (#5968)
* [rcore][desktop] Fix clipboard image memory leak

* [delete] delete comment GetClipboardImage into  NOTE about where put SDL_free() .
2026-07-13 15:10:27 +02:00
Ray
f00317bead Added required library 2026-07-11 17:01:09 +02:00
Ray
8805ab3ee2 Update rmodels.c 2026-07-11 16:57:49 +02:00
Ray
ebec978443 REVIEWED: TextJoin(), TextSubtext(), TextInsert*() - ROS: CLN-018 2026-07-11 16:45:56 +02:00
Ray
cfe56d97ea REVIEWED: GetPixelDataSize(), avoid allocations >2GB - ROS: CLN-013
REVIEWED: `GenImageColor()`, `ImageRotate()`
2026-07-11 16:42:57 +02:00
Ray
97d2b0146c REVIEWED: Replace assert() by runtime checks - ROS: CLN-012 2026-07-11 16:22:05 +02:00
Ray
c31666fe2a REVIEWED: ImageFromImage() - ROS: CLN-007 2026-07-11 16:20:41 +02:00
Ray
ab35e0f712 REVIEWED: LoadAutomationEventList() - ROS: CLN-005, CLN-006 2026-07-11 16:18:34 +02:00
Ray
c85cd07db0 Update rmodels.c 2026-07-11 12:22:03 +02:00
Ray
f458296a07 small optimization 2026-07-11 12:21:24 +02:00
Ray
8df2f13962 Update raudio.c 2026-07-11 12:20:57 +02:00
cba8f4286d Fix initial macOS window size (#5967) 2026-07-11 12:06:54 +02:00
86c7edfd74 [raudio] Fix memory leak when loading .wav files (#5963)
* [raudio] Fix memory leak when loading .wav files

* [change] Insert a space.
2026-07-11 12:03:41 +02:00
Ray
caadb48e25 Update SECURITY.md 2026-07-07 15:54:57 +02:00
Ray
3e9fb4757f Update rcore_drm.c 2026-07-07 12:17:23 +02:00
d159739a8b Fix DRM/EGL segfault on some NVIDIA proprietary drivers (#5960) 2026-07-07 12:15:54 +02:00
Ray
f20f61d754 Merge branch 'master' of https://github.com/raysan5/raylib 2026-07-07 11:47:31 +02:00
Ray
81b740403a Updated 2026-07-07 11:47:19 +02:00
3cb8a3d782 ReiLua Lua binding update to raylib 6.0. (#5959) 2026-07-07 11:46:07 +02:00
Ray
f8e42cb509 REVIEWED: OpenURL(), added some safety checks to mitigate possible malicious url inputs 2026-07-07 11:45:30 +02:00
Ray
d631a5a466 Merge branch 'master' of https://github.com/raysan5/raylib 2026-07-06 19:14:22 +02:00
Ray
5992929e56 REVIEWED: Security: strncpy() replaced by snprintf() 2026-07-06 19:13:44 +02:00
3d640698d8 fix UB in ComputeSHA-1 (#5957) 2026-07-06 18:35:02 +02:00
088177b269 rlparser: update raylib_api.* by CI 2026-07-06 16:33:13 +00:00
2e03c9c266 Change boneCount field type from int to unsigned int (#5955) 2026-07-06 18:33:01 +02:00
Ray
65abee1cba Updated GA setup-emsdk action 2026-07-04 12:25:06 +02:00
Ray
1911a2827b REVIEWED: GitHub Actuions update to latest actions 2026-07-03 23:09:19 +02:00
Ray
bb96b920d3 Update rtextures.c 2026-07-03 11:31:45 +02:00
350124a45b [rcore] Fix SDL3 backend using wrong joystick functions (#5948)
* [rcore] Fix gamepad code using outdated functions

* [rcore] Remove printing available joysticks
2026-07-03 01:00:51 +02:00
Ray
5e374218ee REVIEWED: Set mouse position to (0,0) when mouse leaves window area #5945 2026-07-02 18:58:01 +02:00
9f60957b84 rlparser: update raylib_api.* by CI 2026-07-02 08:49:50 +00:00
Ray
0c0375f8ae ADDED: IsPathDirectory(), for convenience and more readability at user code 2026-07-02 10:49:31 +02:00
Ray
77ecd5befc REVIEWED: TextToSnake(), not considering spaces properly 2026-07-02 10:46:38 +02:00
Ray
a7ac5c2823 Merge branch 'master' of https://github.com/raysan5/raylib 2026-07-01 12:19:29 +02:00
Ray
44b16a548f Update rtextures.c 2026-07-01 12:18:58 +02:00
9deaae0716 rlparser: update raylib_api.* by CI 2026-07-01 10:09:45 +00:00
Ray
122e378e93 ADDED: New image drawing functions, aligned with texture/text drawing -WIP-
The new functions are direct maps of the Texture2D equivalents, they can be useful for a future mapping Texture2D --> Image; an alternative 2d software renderer...
2026-07-01 12:09:26 +02:00
Ray
2c24ca1407 Typos 2026-07-01 11:55:43 +02:00
Ray
04a269f4f8 ADDED: Support for .pep image fileformat, useful for pixl-art 2026-07-01 11:55:27 +02:00
8999d2ba44 [tools] Add S-Expression Output Type to rlparser (#5943)
* Add S-Expression output to rlparser.c

* minor whitespace fix
2026-07-01 10:05:11 +02:00
Ray
7ac798cef9 REVIEWED: Shader attribute/uniform default names can not be overriden #5925 2026-07-01 10:04:24 +02:00
67359073ca [rcore] Add gamepad >= 0 lower-bound guard to six sibling functions (#5938)
Commit 3edfe194 added a `gamepad >= 0` lower-bound check to
GetGamepadAxisCount() and GetGamepadName(), but six sibling functions
were left with only the upper-bound check (`gamepad < MAX_GAMEPADS`).
A negative signed int passes that check and triggers out-of-bounds
access on CORE.Input.Gamepad.ready[gamepad] and related arrays (UB in C).

Apply the same `(gamepad >= 0) &&` guard added in 3edfe194 to:
- IsGamepadAvailable
- IsGamepadButtonPressed
- IsGamepadButtonDown
- IsGamepadButtonReleased
- IsGamepadButtonUp
- GetGamepadAxisMovement
2026-06-27 21:06:49 +02:00
3edfe19438 [rcore] Bounds-check gamepad index in GetGamepadAxisCount() and GetGamepadName() (#5937)
* [rcore] Bounds-check gamepad index in GetGamepadAxisCount() and GetGamepadName()

Both public getters indexed CORE.Input.Gamepad.axisCount[gamepad] / .name[gamepad]
with an unvalidated gamepad argument -- an out-of-bounds read for gamepad < 0 or
gamepad >= MAX_GAMEPADS. Every sibling gamepad accessor (IsGamepadAvailable,
IsGamepadButton*, GetGamepadAxisMovement) already guards the index; add the same
check, returning a safe default (0 / NULL).

* Refactor GetGamepadName/GetGamepadAxisCount to single-return pattern

---------

Co-authored-by: Brandon Arrendondo <brandon.arrendondo@bissell.com>
2026-06-24 17:40:28 +02:00
9215540015 [rtext] Fix buffer overflow in TextReplaceBetween() (#5936)
The MAX_TEXT_BUFFER_LENGTH guard present in TextReplace()/TextInsert() was
missing here, so the three strncpy() calls could write past the 1024-byte
static buffer for long inputs. Add the same length check before copying.

Co-authored-by: Brandon Arrendondo <brandon.arrendondo@bissell.com>
2026-06-24 16:41:19 +02:00
83cb4cc210 [rlgl] Fix matrix stack overflow in rlPushMatrix() (#5935)
The RL_MAX_MATRIX_STACK_SIZE check logged an error but did not return, so
RLGL.State.stack[stackCounter] = *currentMatrix still executed when the stack
was full -- writing one element past stack[RL_MAX_MATRIX_STACK_SIZE] and
corrupting the adjacent RLGL.State members (stackCounter, etc.). rlPopMatrix()
already guards the symmetric underflow case; add the missing early return.

Co-authored-by: Brandon Arrendondo <brandon.arrendondo@bissell.com>
2026-06-24 16:38:08 +02:00
Ray
d1a14bee5d Update rmodels.c 2026-06-24 10:38:20 +02:00
eu
ba3b8f8370 Add comments for GenMeshTorus (#5934) 2026-06-24 10:36:30 +02:00
Ray
962bbfc6bf Revert "Implemented JS output format. (#5929)"
This reverts commit b00e465deb.
2026-06-23 09:24:06 +02:00
b00e465deb Implemented JS output format. (#5929) 2026-06-23 00:55:08 +02:00
db0870f31f Update supported version for Jai to 6.0 (#5928)
Update supported version for Jai to 6.0
2026-06-19 23:09:30 +02:00
Ray
87a6e9693c Format tweaks 2026-06-19 12:27:02 +02:00
aaacda6e14 Remove commit message from CMakeLists.txt (#5924)
Remove ambiguous footnote that would be better suited for the commit log.
2026-06-17 16:55:51 +02:00
Ray
f9c41a0866 Reemove trailing spaces 2026-06-16 21:12:12 +02:00
Ray
fa8aca8789 Update rlgl.h 2026-06-16 13:06:16 +02:00
Ray
efef4e31dd REVIEWED: LoadImageFromTexture() for Wasm https://github.com/raysan5/rguistyler/issues/10
Let's see if it breaks on some other platform...
2026-06-16 13:01:50 +02:00
Ray
3973766b84 Update rexm.c 2026-06-15 23:19:31 +02:00
Ray
4d2b1d51e4 Update rcore_desktop_glfw.c 2026-06-15 23:19:27 +02:00
Ray
8713741782 Update rcore.c 2026-06-13 09:21:39 +02:00
ac6526b731 [rcore] Fix `FileCopy` doesn't copy file when directory exists (#5920)
* Fix FileCopy result

* fix code style
2026-06-13 09:18:41 +02:00
94897c4eca [platform/RGFW] update rgfw (#5919)
* update rgfw + platform v1

* added drop events

* updates
2026-06-10 08:56:07 +02:00
Dz
444cc22633 update BINDINGS.md (#5917)
Dart binding for Raylib: support hooks
2026-06-09 14:57:52 +02:00
Ray
aeea213873 Update raudio.c 2026-06-09 13:19:19 +02:00
8d31d0c3cc remove extra drflac_free (#5916) 2026-06-09 13:16:41 +02:00
Ray
9bd3d84f3d Update models_basic_voxel.c 2026-06-07 22:59:20 +02:00
Ray
04b66f1965 Merge branch 'master' of https://github.com/raysan5/raylib 2026-06-07 22:54:16 +02:00
Ray
7c1b9d0a32 Update textures_image_drawing.c 2026-06-07 22:53:36 +02:00
02869da279 rlparser: update raylib_api.* by CI 2026-06-07 19:53:22 +00:00
Ray
aebfd788c7 WARNING: BREAKING: REDESIGNED: ImageDraw() API, align with DrawTexture() 2026-06-07 21:53:07 +02:00
26d82cf55d rlparser: update raylib_api.* by CI 2026-06-07 19:51:18 +00:00
Ray
d9335f6a95 ADDED: TODO: ImageDrawCircleGradient() 2026-06-07 21:51:02 +02:00
0e7cc36567 rlparser: update raylib_api.* by CI 2026-06-07 19:29:40 +00:00
Ray
e57663c937 Update raylib.h 2026-06-07 21:29:26 +02:00
23433fe2dc rlparser: update raylib_api.* by CI 2026-06-07 19:29:06 +00:00
Ray
fefb9f4428 Merge branch 'master' of https://github.com/raysan5/raylib 2026-06-07 21:27:07 +02:00
Ray
68c4b8a60f Removed old compatibility hack 2026-06-07 21:26:59 +02:00
33b6f0f3a4 rlparser: update raylib_api.* by CI 2026-06-07 19:26:49 +00:00
Ray
ca0ba55050 Reviewed parameter names, added comment about order 2026-06-07 21:26:32 +02:00
Ray
236618f87b Reorder functions by drawing vertex/sides 2026-06-07 21:06:53 +02:00
f5ea52a2b8 rlparser: update raylib_api.* by CI 2026-06-07 16:49:09 +00:00
Ray
6a6daad739 Merge branch 'master' of https://github.com/raysan5/raylib 2026-06-07 18:48:50 +02:00
Ray
4724e5fec3 ADDED: ImageDrawLineStrip() 2026-06-07 18:48:41 +02:00
Ray
d3d1b0cbcc ADDED: DrawCircleLinesEx(), simpler naming than DrawRing() 2026-06-07 18:48:16 +02:00
20aa6cb764 rlparser: update raylib_api.* by CI 2026-06-07 16:47:29 +00:00
Ray
a41bb7c07a Reorder shapes drawing API functions by number of vertices
NOTE: Consistency between shapes and Image drawing functionality is being aligned (as much as possible)
2026-06-07 18:47:14 +02:00
Ray
53ccae09cc Merge branch 'master' of https://github.com/raysan5/raylib 2026-06-07 18:43:00 +02:00
Ray
869251e590 REVIEWED: Parameter name, shorter 2026-06-07 18:42:50 +02:00
45f1af2bde rlparser: update raylib_api.* by CI 2026-06-07 16:42:02 +00:00
Ray
15d25242be REVIEWED: Comments to be more descriptive 2026-06-07 18:41:44 +02:00
22509ab2d4 Update ocaml bindings version (#5912) 2026-06-06 23:30:21 +02:00
796e1ad22a Use CORE.Input.Keyboard.exitKey instead of KEY_ESCAPE (#5911)
... in rcore_desktop_win32 when handling window closing
2026-06-06 22:25:48 +02:00
acfcf2f1d1 [rmodels] Fix minimum rings validation in DrawCapsule and DrawCapsuleWires (#5909)
Ensure rings is at least 1 to prevent rendering issues or crashes when 0 or negative values are passed.
2026-06-06 19:47:57 +02:00
ca46387b64 use inverse bind matrices for bind pose in gltf loader (#5832) 2026-06-05 09:27:05 +02:00
fd79b81918 Fix memory leak in UnloadModel() (#5907) 2026-06-04 23:32:52 +02:00
9ace148917 rlparser: update raylib_api.* by CI 2026-06-03 19:07:28 +00:00
Ray
a85c9f4898 REVIEWED: File*() functions for consistent return result value
NOTE: `SaveFile*()` still follows original convention, returning true on success...
2026-06-03 21:07:07 +02:00
fadcd1fac5 rlparser: update raylib_api.* by CI 2026-06-03 19:05:06 +00:00
Ray
1a4445f510 Renamed parameters to align with internal implementations 2026-06-03 21:03:47 +02:00
fc824ff6d4 rlparser: update raylib_api.* by CI 2026-06-03 19:03:21 +00:00
Ray
2c690425c9 Reviewed comments, remove article usage 2026-06-03 21:02:59 +02:00
Ray
ee71f0f870 REVIEWED: GetPixelColor() const 2026-06-03 21:00:34 +02:00
e8650c1b8e rlparser: update raylib_api.* by CI 2026-06-03 18:16:31 +00:00
Ray
cef7718468 RENAMED: Some Rectangle parameters with more descriptive names 2026-06-03 20:16:12 +02:00
Ray
895154bcb2 Clarify that GPU_SKINNING is not enabled by default and the requirements 2026-06-01 21:00:17 +02:00
Ray
f421b74c0f Revert "Enable GPU skinning for GL 3.3+, (#5902)"
This reverts commit f1d602029c.
2026-06-01 20:42:48 +02:00
Ray
90edc3b0a5 Update models_animation_blending.c 2026-06-01 20:42:38 +02:00
f1d602029c Enable GPU skinning for GL 3.3+, (#5902)
only do GPU skinning if the shader supports bone IDs.
2026-06-01 20:25:09 +02:00
10a889c482 [rlsw] Replace SW_TEXTURE_REPEAT_POT_FAST with SW_SUPPORT_NPOT_TEXTURE (#5901)
* replace `SW_TEXTURE_REPEAT_POT_FAST` by `SW_SUPPORT_NPOT_TEXTURE`

* tweak `SW_SUPPORT_NPOT_TEXTURE` comment

* remove extra comment
2026-05-30 19:44:45 +02:00
b7f50b2fb6 [rtextures] ImageDrawLine() rounding and length fix (#5896)
* Fixing ImageDrawLine to be more pixel accurate

Changes to ImageDrawLine() function.
. Added one pixel to the length of a line so it wont draw lines one pixel short.
. Changed rounding by adding 0.5 in 16 bit fixed point to 'j' in for-loop.

* Changed ImagDrawLine to be more acurate
2026-05-30 19:39:16 +02:00
Ray
2ee6a76464 REVIEWED: GetWindowHandle(), to be consistent between backends, fix #5885
Returns the underlying window handle for platforms with some windowing system.
2026-05-30 12:20:58 +02:00
f0d3e9a5c8 Security fixes (rcore_desktop_win32.c) (#5899)
* Security fixes in rcore_desktop_win32.c

* Avoid calling strlen() twice
2026-05-30 08:49:34 +02:00
7c284cc5bc Fix warning about unused variables (#5898) 2026-05-30 08:47:35 +02:00
7b96144716 [rcore] GetCurrentMonitor(), fix for integer overflow in distance calculation (#5842)
* Fix signed integer overflow in GetCurrentMonitor distance calc

* Revert "Fix signed integer overflow in GetCurrentMonitor distance calc"

This reverts commit e0083bc7fe.

* fix GetCurrentMonitor() distance calc overflow

* fix GetCurrentMonitor() distance calc
2026-05-29 18:18:18 +02:00
81c7cb6527 [rmodels] Fix glTF skinning when joints have non-joint parent nodes (#5876)
* [rmodels] Fix glTF skinning when joints have non-joint parent nodes

Some glTF exporters (notably wow.export, but also various other DCC pipelines) place skin joints under intermediate non-joint transform nodes that carry part of the bind-pose offset. raylib's existing LoadBoneInfoGLTF and LoadModelAnimationsGLTF only inspected a joint's immediate parent and only sampled joint-local TRS, so any transform stored on an intermediate non-joint ancestor was silently dropped, producing exploded or stretched meshes at runtime.

Two surgical changes:

LoadBoneInfoGLTF: walk the parent chain past any non-joint ancestors when looking up parentIndex, instead of comparing only against node.parent. Joints whose direct parent is a non-joint were previously treated as skeleton roots.

LoadModelAnimationsGLTF: precompute a per-joint extOffset matrix that bakes in the static TRS contribution of any intermediate non-joint nodes between the joint and its nearest joint ancestor. Apply it to each frame's joint TRS before BuildPoseFromParentJoints so the per-frame world transforms match the bind-pose world transforms (LoadGLTF already used cgltf_node_transform_world for bindPose, so this aligns the two code paths).

The replaced root-only worldTransform adjustment is a strict subset of the new per-joint extOffset machinery, so it has been removed.

Spec-compliant files (the six skeletal-skinning .glb examples shipped with raylib) render bit-identically before and after; previously broken files (e.g. wow.export's babyoctopus.gltf) now match the reference rendering from f3d, the Khronos sample viewer, and three.js.

* Resolve review: NULL-check joint offset allocation, fail fast

[rmodels] Address review feedback on glTF joint offset handling

Resolve the open review points raised on PR #5876 for the per-joint
extOffset precompute in LoadModelAnimationsGLTF.

* NULL check: validate the extOffset RL_MALLOC result before use, which
  was previously missing.

* Fail-fast handling: detect the allocation failure at its source and
  abort animation loading (log a warning, free resources, return NULL)
  instead of propagating a NULL pointer into the per-frame loop.

* Brace formatting: expand the collapsed one-line joint-match check
  (if (...) { isJoint = true; break; }) into raylib's standard Allman
  brace style.

* Readability: break the deeply nested MatrixMultiply(MatrixMultiply(...))
  into named nodeScale/nodeRotation/nodeTranslation/nodeTransform locals,
  mirroring the existing S/R/T composition later in the function.

* Spacing/line breaks: add blank lines within the precompute block to
  match the surrounding code style.
2026-05-29 18:17:04 +02:00
186d3ce9fb [CMake] Properly remove raudio.c and rmodels.c if they're disabled modules (#5878)
* only build raudio.c in cmake if it's still enabled

* only compile rmodels if it's supported
2026-05-29 18:16:17 +02:00
e7edb181dc cmake: Reduce minimum CMake version from 3.25 to 3.22 (#5890)
There isn't anything in 3.25 that we actually need, so we can reduce the minimum requirement. 3.22 is commonly available across many package managers.

For a list of the changes in `FetchContent`, see:
https://cmake.org/cmake/help/latest/module/FetchContent.html
2026-05-27 09:20:11 +02:00
Ray
ef8b3e6195 Update rlgl.h 2026-05-26 20:46:56 +02:00
7f9ded7642 [makefile] ANDROID_ARCH check (#5888) 2026-05-26 18:13:58 +02:00
34b06ca587 Update BINDINGS.md (#5887) 2026-05-25 16:05:20 +02:00
4d845608b8 Update listed Raylib version for zig bindings (#5886)
As per the README at https://github.com/raylib-zig/raylib-zig, raylib-zig now supports raylib 6.0
2026-05-25 08:32:52 +02:00
Ray
eaf32c83bf REXM: Latest w64devkit supports make directly, simplifying code to avoid mingw32-make 2026-05-25 00:26:26 +02:00
808e6b9b20 Raylib-lua version to 5.5 (#5884)
raylib-lua from 5.0 to 5.5 in bindings.
2026-05-24 17:36:12 +02:00
7dd72e7328 rlparser: update raylib_api.* by CI 2026-05-24 07:25:01 +00:00
Ray
f8270483e1 Merge branch 'master' of https://github.com/raysan5/raylib 2026-05-24 09:24:33 +02:00
Ray
f17babfe8a REVIEWED: #5879 2026-05-24 09:24:26 +02:00
f65d5ad7a9 rshapes: fix auto segment rounded-corner math and rounding (#5883) 2026-05-24 08:55:08 +02:00
Ray
0d78f10161 Reviewed comments formating 2026-05-20 09:16:16 +02:00
7d5b61ce01 [rlsw][SEGFAULT] Fix triangle and quad spans applying pixels out of bounds (#5849)
* fix triangle and quad spans applying pixels out of bounds

* remove off by one errors on x/y LoopMax

* apply the RASTER_QUAD offset at the loop start so it increments correctly

* fix missing endif

* remove include guard to allow dyMin usage

* early exit if nothing to draw on a span

* incorporate dxStart into xSubstep to make xOffset calculate a single time

* remove ghost comment

* early exit for quads, with a float cast on the left and top distance calculation

* remove duplicate xLoopEnd
2026-05-20 09:12:20 +02:00
Ray
b48933b096 Merge branch 'master' of https://github.com/raysan5/raylib 2026-05-19 18:59:30 +02:00
Ray
fd1dfd7d65 ADDED: rprand_get_value_raw() 2026-05-19 18:59:23 +02:00
be56f2c524 [rcore][GLFW] Fix GetClipboardImage() creating new connection under X11 (#5871)
* Improve GetClipboardImage implementation under X11

* Remove code for creating new connection, handle selection in GLFW connection instead.

* `GetClipboardImage()`: Small fix to remove unnecessary boolean
2026-05-19 18:57:42 +02:00
d31c10a01e Adjust segment calculation in DrawRectangleRounded to be consistent with DrawRectangleRoundedLinesEx (#5875) 2026-05-19 18:48:28 +02:00
c04e57399a Fix compilation for -DPLATFORM=RGFW (#5870)
When compiling with
cmake -S . -B build-desktop-rgfw -DPLATFORM=RGFW -DCMAKE_BUILD_TYPE=Release
cmake --build build-desktop-rgfw

these errors appeared:
raylib/examples/others/raylib_opengl_interop.c💯5: error: unknown type name ‘GLuint’
  100 |     GLuint vao = 0;
[etc]
2026-05-15 17:40:26 +02:00
6c090f6193 Fix build.zig building examples all the time (#5869) 2026-05-15 17:39:27 +02:00
Ray
5ca45bce37 Update rcore.c 2026-05-14 20:05:25 +02:00
Ray
729327a078 Update .gitignore 2026-05-14 20:05:21 +02:00
ea76845ecb [cmake]: remove GLFW_BUILD warnings for when platform is SDL (#5865) 2026-05-14 13:02:38 +02:00
5506aed190 BINDINGS.md: update golang binding to v6.0 (#5866) 2026-05-14 13:00:40 +02:00
Ray
43366d1c6a Some formatting tweaks 2026-05-13 09:28:08 +02:00
Ray
f35f4b9fad REVIEWED: GetTime(), small addition for RPI Pico 2 2026-05-13 09:17:04 +02:00
Ray
c4b4fcc17e Format review 2026-05-13 09:16:29 +02:00
Ray
fbf132d1d1 Use rlgl provided interface instead of rlsw direct access 2026-05-13 09:16:19 +02:00
Ray
e274c195af Update rcore.c 2026-05-13 09:15:50 +02:00
fd28dc5644 [rtext] add warning for loadfontex/loadfontfrommemory (#5864)
* add warning for loadfontex/loadfontfrommemory

* bump to re-run build tests
2026-05-13 08:56:13 +02:00
Ray
5aa3de194c Updated miniaudio warnings with emscripten 2026-05-12 20:33:20 +02:00
9400199b80 [rcore][RGFW] Add fullscreen behaviour on size 0 window creation (#5859)
* port glfw's behaviour on size 0 window creation to rgfw

* updates with change suggestions

* don't do the FLAG_FULLSCREEN_MODE check twice for no reason

---------

Co-authored-by: CrackedPixel <5776225+CrackedPixel@users.noreply.github.com>
2026-05-11 23:25:00 +02:00
Ray
200d344dee Merge branch 'master' of https://github.com/raysan5/raylib 2026-05-10 19:31:22 +02:00
Ray
094edcd32e Update Makefile 2026-05-10 19:31:19 +02:00
a005a044da [rcore_android] Restore face-button input on Android gamepads (#5824)
The KEYBOARD-source veto added in #5439 drops face-button key
events that arrive with both AINPUT_SOURCE_KEYBOARD and
AINPUT_SOURCE_GAMEPAD set on the source bitmask. Confirmed
reproducible on GameSir X2 Type-C and 8BitDo Ultimate Bluetooth,
both reporting source 0x501 on every face-button key event.

This source-bit pattern is general AOSP behaviour since Android
3.2 (commit 6f2fba4 in frameworks/base, Feb 2011): EventHub adds
InputDeviceClass::KEYBOARD to any device whose evdev keyBitmask
claims gamepad buttons (BTN_JOYSTICK..BTN_DIGI), and
KeyboardInputMapper::getEventSource stamps the resulting
KEYBOARD|GAMEPAD source on every outgoing key event.

Use AndroidTranslateGamepadButton(keycode) as the discriminator
instead. Recognised gamepad keycodes route to the gamepad path;
unknown keycodes fall through to the keyboard handler.

Assisted-by: Claude:claude-opus-4-7
2026-05-10 19:20:35 +02:00
ae315eecb9 added win32 to cmake + examples (#5855) 2026-05-10 19:09:24 +02:00
dcb0ca5d14 [raudio]: free converterResidual in UnloadSoundAlias to prevent leak (#5857)
The example audio_sound_multi was leaking memory every single time the spacebar was pressed.

```c
Direct leak of 576 byte(s) in 9 object(s) allocated from:
    #0 0x758a41019447 in calloc (/usr/lib/liblsan.so.0+0x19447) (BuildId: 8ee115309adc591d231c961c43d245cfa68d9aa7)
    #1 0x562dfbd2c4f3 in LoadAudioBuffer (/home/peter/raylib/examples/audio/audio_sound_multi+0xfa4f3) (BuildId: ea2a6f45d724abeccf904143a32012266f259f93)
```

This patch fixes that leak.
2026-05-10 15:01:38 +02:00
07b729d5d6 fix: check fread return value in jar_mod_load_file (#5840) 2026-05-09 18:55:02 +02:00
cd4599b447 Update BINDINGS.md (#5850) 2026-05-09 18:48:10 +02:00
Ray
b2ea5eae5e REVIEWED: long long usage in all raylib, minimize
REVIEWED: Using `long long` format instead of `long long int`, more consistent with the `short` alternative for smaller `int`, instead of `short int`
2026-05-08 22:59:55 +02:00
mjt
29ff1f02e9 Update Makefile comment (#5846) 2026-05-08 20:19:08 +02:00
d840a100a7 [CMake] Add configure-time test for libatomic requirement (#5847)
CMake now checks if -latomic is required for 64-bit atomics, and links
it if it's required. Miniaudio is the only thing in raylib that needs
it, so it's put behind SUPPORT_MODULE_RAUDIO.
2026-05-08 20:16:45 +02:00
95bfa196fd [cmake] Fix config.h parsing into cmake options (#5844)
Parse SUPPORT_ defines from src/config.h by their actual 0/1 values so CUSTOMIZE_BUILD exposes the correct defaults. Apply INCLUDE_EVERYTHING explicitly when registering dependent options.
2026-05-08 10:08:09 +02:00
Ray
aceb8ce3a8 Re-enable GLFW_LINUX_ENABLE_WAYLAND flag by default #5816
Wayland should be more stable at this point...
2026-05-07 15:24:08 +02:00
Ray
33e889907e ADDED: GL_SHADING_LANGUAGE_VERSION for swGetString() 2026-05-07 15:20:24 +02:00
Ray
61537200c0 Code cleaning 2026-05-07 15:18:42 +02:00
080f5c94bd [rlsw][rcore_drm] Silence warnings when using PLATFORM_DRM and GRAPHICS_API_OPENGL_SOFTWARE (#5839)
* fix warnings: goto label not used outside of SW_ENABLE_DEPTH_TEST

* comment out x coordinates that aren't used in SW_RASTER_TRIANGLE

* silence warnings: unused DrmModeConnector functions in rcore_drm.c when using GRAPHICS_API_OPENGL_SOFTWARE
2026-05-07 15:17:20 +02:00
7207c03c72 [rlsw] ESP32 optimizations (#5827)
* [rlsw] Add sw_rcp helper using Xtensa recip0.s for hot-path divisions

Adds a `sw_rcp(x)` inline reciprocal that on Xtensa (ESP32 / ESP32-S3
LX6/LX7) emits a `recip0.s` seed plus two Newton-Raphson refinement
steps -- 1-ULP accurate in ~7 instructions, all in FPU registers.
On every other target it expands to plain `1.0f/x`, so generated code
is byte-identical to before for non-Xtensa builds.

Replaces the hot-path `1.0f/x` calls that were previously compiling to
the `__divsf3` software helper on Xtensa:

  - perspective divide (1/w) in triangle clip-and-project (PCT and PC paths)
  - line and point clip-and-project NDC conversion
  - triangle span setup: dxRcp, blockLenRcp, wRcpA, wRcpB
  - triangle scanline setup: h02Rcp, h01Rcp, h12Rcp
  - axis-aligned quad: wRcp, hRcp
  - line rasterizer: stepRcp

Other `1.0f/x` uses (matrix translate/normalize, texture init `tx`/`ty`,
sw_matrix_rotate inverse-length) are not on the per-pixel hot path and
are left untouched.

Measured on ESP32-S3 @ 240 MHz, R5G6B5 240x240, textured 3D model:
contributes to a ~10-15% rasterization speedup.

Made-with: Cursor

* [rlsw] Use ESP-DSP for 4x4 matrix multiply and per-vertex MVP transform

Adds an opt-in ESP-DSP code path for ESP32 / ESP32-S3 builds. ESP-DSP is
ESP-IDF's official optimized math library and ships hand-vectorized
kernels that beat the scalar implementations on Xtensa.

Two integration points:

  1. `sw_matrix_mul_rst` -> `dspm_mult_4x4x4_f32` for any 4x4*4x4 multiply
     (used for MVP build, gluLookAt, push/multiply, etc.). rlsw stores
     matrices column-major and ESP-DSP reads row-major; the comment on the
     call site explains why the flat-buffer call still produces the
     correct column-major product (transpose-of-transposes equivalence).

  2. `sw_immediate_push_vertex` -> `dspm_mult_4x4x1_f32` for the per-vertex
     clip-space transform. Because ESP-DSP expects a row-major matrix in
     this case, a row-major copy `matMVP_rm[16]` is maintained alongside
     `matMVP` and refreshed once per `isDirtyMVP` rebuild in
     `sw_immediate_begin`. Cost is 16 scalar copies per matrix update,
     amortized over thousands of vertices per frame.

Detection is **opt-in** via `SW_USE_ESP_DSP` so existing ESP-IDF projects
that don't depend on the `esp-dsp` component keep building unchanged.
A user enables it from CMakeLists.txt (or anywhere before including
rlgl.h):

    target_compile_definitions(${COMPONENT_LIB} PRIVATE SW_USE_ESP_DSP=1)

and adds the dependency to `idf_component.yml`:

    espressif/esp-dsp: "^1.4.0"

Measured on ESP32-S3 @ 240 MHz, R5G6B5 240x240, textured 3D model:
contributes meaningfully to the overall frame-time improvement
(combined with sw_rcp).

Made-with: Cursor

* [rlsw] Add SW_TEXTURE_REPEAT_POT_FAST opt-in for POT bitmask wrap

Adds an opt-in compile-time flag that replaces the SW_REPEAT wrap chain
with a bitmask (`x & (size-1)`) for power-of-two textures. NPOT textures
keep using the original `sw_fract` / signed-modulo paths via a runtime
`(size & (size-1)) == 0` check, so SW_REPEAT remains correct for them.

Affects two samplers:

  - `sw_texture_sample_nearest`: drops the `floorf` + multiply + cast for
    POT textures in REPEAT mode (saves a software call on Xtensa).
  - `sw_texture_sample_linear`: replaces the `(x % w + w) % w` two-step
    modulo (a software divide on Xtensa) with a single bitwise AND for
    POT textures in REPEAT mode. Two's-complement int wrap covers
    negative coordinates correctly.

Off by default: for POT textures sampled with negative UVs, bitmask wrap
can differ from `sw_fract` wrap by one texel at the boundary. That is
imperceptible at typical resolutions but technically a behavior change,
so existing users get bit-for-bit identical output. Opt in if you
control your asset UVs and want the speedup:

    #define SW_TEXTURE_REPEAT_POT_FAST

This addresses the long-standing TODO comment "If the textures are POT,
avoid the division for SW_REPEAT" in `sw_texture_sample_linear`.

Made-with: Cursor
2026-05-06 12:38:52 +02:00
Ray
cf9f27db54 Update raymath.h 2026-05-02 09:09:50 +02:00
Ray
0a2b81b128 Update rcore_web.c 2026-05-02 09:09:40 +02:00
05c15c8ba7 SDL: Use precise mouse wheel values (#5830) 2026-05-01 19:29:51 +02:00
d768dae402 [build] Shift __cplusplus check to a higher level for bool type define (#5804)
* Adds a missing macro definition check

* Shifts __cplusplus check to a higher level for bool define

* Copy same change to rgestures.h and rlgl.h

* Fixes float comparison issues in raymath functions

* Revert "Fixes float comparison issues in raymath functions"

This reverts commit a266d0bbaa.
2026-04-29 18:02:49 +02:00
d580c47504 [raymath.h] Add missing (float * Vector) operator overloads (#5815) 2026-04-29 17:49:23 +02:00
7b7ded566c Fix directory navigation in core_directory_files (#5823)
Co-authored-by: zhanlong9890 <lichuang59559890@gmail.com>
2026-04-29 17:45:25 +02:00
Ray
d9427b1e6f REVIEWED: Avoid static variable floating around and include it to PlatformData struct 2026-04-29 17:42:51 +02:00
da55d9067c added NPOT check to rlLoadTexture to match rlGenTextureMipmaps and WebGL 1.0 standard (#5820) 2026-04-29 08:43:50 +02:00
e5702a716f Update DenoRaylib550 to Deno-Raylib with version 6.0 (#5821) 2026-04-29 08:41:48 +02:00
Ray
2dd8d7e8b1 Update rcore_desktop_sdl.c 2026-04-29 01:08:16 +02:00
168e2c43d0 fix(rcore): correct string boundary handling (#5812)
Co-authored-by: Huang Zhaobin <xcpky@proton.me>
2026-04-29 00:18:33 +02:00
638c1cb339 Update BINDINGS.md (#5819)
Raylib 6.0 support has been released for C3
2026-04-28 23:10:15 +02:00
6a430eb834 [examples] Update build.zig to support wasm examples (#5811)
* Include resource preloads when building wasm examples with Zig.

List of resources derived from examples/Makefile.Web

* Move resource list to zon file to reduce build.zig bloat
2026-04-28 12:26:30 +02:00
3c82b48b1f Update BINDINGS.md to reflect raylib4fb project supporting 6.0 (#5813) 2026-04-27 22:27:13 +02:00
Ray
72a341a37f Update rtext.c 2026-04-27 12:34:43 +02:00
79d5353cfd rlparser: update raylib_api.* by CI 2026-04-27 09:48:08 +00:00
Ray
98efce4b0d WARNING: RENAMED: GetSplinePointBezierQuad() to GetSplinePointBezierQuadratic()
Consistent with similar spline functions and avoid confusion with `Quad` related functions.
2026-04-27 11:47:48 +02:00
Ray
c9c26d8071 REVIEWED: ImageColorContrast() parameter type, consistent with other Image*() functions 2026-04-27 11:46:43 +02:00
Ray
0e68f812b5 WARNING: REDESIGNED: ImageDrawRectangleLines(), consistency with DrawRectangleLines()
ADDED: `ImageDrawRectangleLinesEx()`
2026-04-27 11:45:50 +02:00
Ray
2752837839 REVIEWED: UpdateSound(), missleading parameter name! 2026-04-27 11:44:14 +02:00
a627cd5b65 rlparser: update raylib_api.* by CI 2026-04-27 09:43:37 +00:00
Ray
361dcb2a1f WARNING: REVIEWED: DrawCapsule()/DrawCapsuleWires() parameter order
for consistency with `DrawSphere*()`
2026-04-27 11:42:53 +02:00
5082f5a813 rlparser: update raylib_api.* by CI 2026-04-27 09:40:32 +00:00
Ray
3d2008c70b RENAMED: ImageDrawTriangleEx() to ImageDrawTriangleGradient()
For consistency with the new `DrawTriangleGradient()`
2026-04-27 11:40:14 +02:00
a685b812d9 rlparser: update raylib_api.* by CI 2026-04-27 09:38:41 +00:00
Ray
3b70f83c7d Update raylib.h 2026-04-27 11:38:23 +02:00
Ray
a28b924f94 Merge branch 'master' of https://github.com/raysan5/raylib 2026-04-27 11:38:00 +02:00
Ray
636269f6af ADDED: DrawTriangleGradient() 2026-04-27 11:37:48 +02:00
826ca42d83 rlparser: update raylib_api.* by CI 2026-04-27 09:36:49 +00:00
Ray
620b21bfce REVIEWED: Several functions const correctness 2026-04-27 11:36:32 +02:00
52dc7658da rlparser: update raylib_api.* by CI 2026-04-27 09:35:19 +00:00
Ray
06621eb3b7 REVIEWED: Comments for consistency and spelling 2026-04-27 11:34:58 +02:00
Ray
3b9ee2e9f3 Merge branch 'master' of https://github.com/raysan5/raylib 2026-04-27 10:23:44 +02:00
Ray
6ae16c9895 REVIEWED: FileMove(), additional security checks 2026-04-27 10:23:28 +02:00
aa1100817a rlparser: update raylib_api.* by CI 2026-04-27 08:23:03 +00:00
Ray
725c8b57ae Merge branch 'master' of https://github.com/raysan5/raylib 2026-04-27 10:22:42 +02:00
Ray
00f3af78e3 UPDATED: Set version to raylib 6.1-dev to avoid confusions 2026-04-27 10:22:31 +02:00
3d3e6996b0 rlparser: update raylib_api.* by CI 2026-04-27 08:22:08 +00:00
Ray
47bb749ce9 RVIEWED: Comment to avoid invalid json gneration #5809 2026-04-27 10:21:50 +02:00
ba72d25867 [examples] Improve core_smooth_pixelperfect (#5803)
* Improve smooth pixel-perfect example: add overscan and smoothing toggles

* Add render size
2026-04-27 10:08:12 +02:00
8e82249f65 Update to latest DR libs to fix some warnings in MSVC (#5808) 2026-04-26 20:16:35 +02:00
dff07d020c Fix FileMove from delete file if FileCopy did not work (#5806) 2026-04-26 20:15:33 +02:00
Ray
0f98d78a67 Update README.md 2026-04-25 21:02:34 +02:00
c2ea6a38b5 Fix: Add NULL check to CheckCollisionLines (#5802) 2026-04-25 19:53:34 +02:00
ccc0d7452a chore(bindings): Update binding version for raylib-d to 6.0 (#5799) 2026-04-25 14:49:29 +02:00
386eabb932 Update sola-raylib Raylib supported version to 6 (#5795)
I just published crate version 6.0.0 which supports Raylib 6's new
functions and platforms.
2026-04-24 22:22:34 +02:00
4ee2013169 various rlparser fixes (#5794) 2026-04-24 21:08:20 +02:00
Ray
d892f3ba4a Update shapes_ball_physics.c 2026-04-24 15:11:39 +02:00
61dd488b76 [examples] Move window for ball shake (#5791) 2026-04-24 15:09:02 +02:00
Ray
4cae4ba9d5 REVIEWED: IsModelValid() #5780 2026-04-24 14:03:59 +02:00
Ray
07a056441a Update raudio.c 2026-04-24 13:59:41 +02:00
Ray
254953611e Update rcore.c 2026-04-24 13:58:52 +02:00
5608460901 add missing UnloadFileData() (#5787)
Adds missing function necessary for using the module as a standalone library.
2026-04-24 13:57:20 +02:00
3b23200b85 Update BINDINGS.md to add vala-vapi version update (#5789) 2026-04-24 13:56:30 +02:00
1c5cd35372 Add sola-raylib to BINDINGS.md (#5790)
Rust bindings and wrapper library. A maintained fork of raylib-rs with
bug fixes in the 5.5.x series and upcoming support for 6.0.
2026-04-24 13:55:59 +02:00
e9caf5a981 BINDINGS: Update raylib-cpp version to 6.0 (#5785)
The C++ wrapper, [raylib-cpp](https://github.com/RobLoach/raylib-cpp), now works with raylib 6.0:
https://github.com/RobLoach/raylib-cpp/releases/tag/v6.0.0
2026-04-23 15:01:58 +02:00
de8419cc8b removed web_basic_window mentions (#5782) 2026-04-23 13:28:34 +02:00
f220848896 Update pascal binding (#5784)
* Update BINDINGS.md

added support for Delphi

* Update BINDINGS.md
2026-04-23 13:27:42 +02:00
Ray
dbc56a87da Update HISTORY.md 2026-04-23 00:18:40 +02:00
Ray
932558ca7a Update HISTORY.md 2026-04-22 13:41:27 +02:00
Ray
7495a77a79 Update CHANGELOG 2026-04-22 13:41:15 +02:00
Ray
a4680fc677 Update HISTORY.md 2026-04-19 20:03:35 +02:00
Ray
d6445b55d6 Update core_basic_window.c 2026-04-19 20:03:31 +02:00
Ray
d87bf55607 Update CHANGELOG 2026-04-19 20:03:29 +02:00
a32b53f4d6 [build.zig] Refactor (#5764)
* Add better structure for build.zig

Temporarily disabled the tests

* Cleanup build.zig a bit

* Fixed zemscripten and cleanup other platforms

* Make opengl_version selection more restritive

* Add traslateC to build; Renable examples

* Add raygui build to build.zig

* Deny glfw from android target

* Fix android platform includes

* Add Zig project example

* Add Zig project mention to README

* Set right name for web build in zig example

* Cleanup last parts of build.zig

* Add linking method for build.zig

* Fix lshcore link for glfw and rgfw build.zig

* Fix weird sdl linkage build.zig

* Add zig example to zig project

* Fix win32, mac build bugs in build.zig

* Rename argument lshcore to shcore build.zig
2026-04-19 13:57:58 +02:00
Ray
cc752037b9 Update rmodels.c 2026-04-19 13:54:39 +02:00
90e9145978 Making it similar to CheckCollisionSpheres to remove pow function (#5776) 2026-04-19 13:51:52 +02:00
9060ac7c95 Mouse delta calculation with scaling (#5779)
Added scaling from SetMouseScale to mouse GetMouseDelta
2026-04-19 13:50:15 +02:00
Ray
4ced756474 Merge branch 'master' of https://github.com/raysan5/raylib 2026-04-18 18:53:05 +02:00
Ray
88f8ca42f5 Update rcore_drm.c 2026-04-18 18:53:03 +02:00
9a3283f698 [examples] shapes_collision_ellipses (#5722)
* Added shapes_collision_ellipses example

* Address review comments from raysan

* Address review comments

* update collision ellipses screenshot

* Restore shapes_following_eyes.c to upstream

* Rename shapes_collision_ellipses to shapes_ellipse_collision and fix header
2026-04-18 18:40:07 +02:00
f0a043bb75 [Platform/RGFW] add support for software rendering (#5773)
* add support for software rendering

* null check on freeing

* add back line

* rename framebuffer to surface

* add guard on free

* update makefile to prevent software on web

* update for mac
2026-04-17 18:09:57 +02:00
dde8c8e07e [build-windows.bat] Update build-windows script (#5769)
* Update build-windows script

* Use vswhere in build-windows script
2026-04-17 18:04:08 +02:00
Ray
1cbe438f93 Update rcore_desktop_rgfw.c 2026-04-17 18:03:29 +02:00
Ray
7c96c24cf9 Update rcore.c 2026-04-17 17:57:05 +02:00
Ray
d116c92f13 Merge branch 'master' of https://github.com/raysan5/raylib 2026-04-17 17:57:01 +02:00
Ray
14fe0cbfd8 Update rlgl.h 2026-04-17 17:56:49 +02:00
Ray
94f3c094e7 Update raudio.c 2026-04-17 17:56:47 +02:00
be768e27f9 fix issue with gettime (#5772) 2026-04-17 17:55:04 +02:00
6ef36c0a17 fix examples makefile define (#5767) 2026-04-16 13:01:54 +02:00
Ray
49f88dc6ed Update config.h 2026-04-16 11:12:50 +02:00
86aa0950bd [raymath] Refactor QuaternionFromAxisAngle (#5766)
Checking if lenght equals 0 inside the if statement is not necessary.
2026-04-16 08:37:04 +02:00
Ray
96e30549f5 Align default values on comments for config variables 2026-04-16 00:05:23 +02:00
Ray
1e43c1d372 Revert "Remap stb_vorbis malloc/free calls to RL_MALLOC/RL_FREE (#5763)"
This reverts commit 21897f4bb9.
2026-04-15 23:58:05 +02:00
21897f4bb9 Remap stb_vorbis malloc/free calls to RL_MALLOC/RL_FREE (#5763) 2026-04-15 23:51:47 +02:00
Ray
d8ebeb8939 Update raymath.h 2026-04-15 21:03:25 +02:00
Ray
82e980bd42 Log info about HighDPI content scaling on display initialization 2026-04-15 12:37:42 +02:00
0decdcd497 update defines for new format etc (#5760) 2026-04-15 12:20:51 +02:00
4628915787 Update typos/grammar (#5759) 2026-04-15 09:18:30 +02:00
dfbaafa337 [zig] Adjusting build.zig to run on 0.16.0 (#5758)
* Adjusting build.zig to run on 0.16.0

* changing version to 6
2026-04-14 20:57:50 +02:00
Ray
019cc889fc Updated Notepad++ scripts and autocomplete 2026-04-13 19:26:28 +02:00
034ffda887 [cmake] update cmake for PLATFORM_MEMORY (#5749)
* update cmake for PLATFORM_MEMORY

* remove opengl example for memory platform

* update for winmm and cross compile
2026-04-13 18:55:45 +02:00
970531d112 Update BINDINGS.md to add new FreeBASIC port (#5755)
Added the raylib4fb port
2026-04-12 23:49:38 +02:00
Ray
99eaf72362 Merge branch 'master' of https://github.com/raysan5/raylib 2026-04-12 19:49:54 +02:00
Ray
1339ec637e Update raylib.h 2026-04-12 19:49:45 +02:00
44e5126d08 update 2025->2026, 5.5->6.0 (#5754) 2026-04-12 19:21:09 +02:00
Ray
51d693607e Update Makefile 2026-04-12 11:07:19 +02:00
Ray
a5427bc38f Update rlsw.h 2026-04-12 11:07:09 +02:00
605303f62b fix: pthread_mutex_lock called on a destroyed mutex (#5752) 2026-04-12 10:32:05 +02:00
b3592631b0 update makefile for PLATFORM_MEMORY (#5750) 2026-04-12 10:25:59 +02:00
Ray
ddfbe973d4 Updated Windows resource file 2026-04-12 10:24:35 +02:00
fe5271c568 update raylib.rc to 6.0 (2026) (#5748) 2026-04-12 10:23:09 +02:00
de95b3aa70 added gpuready check to gentexturemipmaps (#5747) 2026-04-10 15:42:06 +02:00
Ray
fbcc8cdb55 Update shapes_top_down_lights.c 2026-04-09 11:52:06 +02:00
Ray
ca6f188233 Update shaders_shapes_textures.c 2026-04-09 11:52:04 +02:00
Ray
8e54b19d9f Update shapes_basic_shapes.c 2026-04-09 11:46:00 +02:00
Ray
e24b01bb28 Update HISTORY.md 2026-04-09 11:36:26 +02:00
Ray
68d519910a Merge branch 'master' of https://github.com/raysan5/raylib 2026-04-09 11:35:24 +02:00
Ray
53915d77e6 Update CHANGELOG 2026-04-09 11:22:13 +02:00
b202421e08 rlparser: update raylib_api.* by CI 2026-04-09 09:16:49 +00:00
Ray
05a14456ae REDESIGNED: DrawCircleGradieent() to use Vector2 as center parameter #5738 2026-04-09 11:16:31 +02:00
c5fc771622 removed the first RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEMATRICES (#5727) 2026-04-06 00:38:04 +02:00
Ray
d3c6f426b4 Update for software renderer on DRM #5721 2026-04-05 11:02:26 +02:00
c4bd4faab5 [build][CMake] REVIEWED: DRM software renderer configuration (#5721)
https://github.com/raysan5/raylib/pull/5720#issuecomment-4187113099

In this comment, it was pointed out that LibraryConfigurations.cmake
still tries to find and link egl, gbm, and glesv2, even when using the
software renderer is it not necessary.

This patch addresses that.
2026-04-05 11:01:44 +02:00
4a6ceb9c76 [rcore_rgfw] Icon color format fix (#5724)
After RGFW update to 2.0.0-dev in fbd83cafc7, RGFW_window_setIcon api has changed -- not it takes pixel format enum instead of number of channels. On raylib side it was still passing 4 (number of channels in rgba) which is enum value for BGRA8. Instead we have to pass 2 now (RGFW_formatRGBA8 = 2).
2026-04-05 10:50:31 +02:00
Ray
6ef0044381 REVIEWED: Window messages WM_SIZING, WM_SIZE, WM_WINDOWPOSCHANGED #5720 2026-04-04 17:37:25 +02:00
Ray
1122add3ee Minor format tweak 2026-04-04 17:36:18 +02:00
Ray
92f82b4add Update raylib.h 2026-04-04 16:50:15 +02:00
Ray
cdff3d7bea Update CHANGELOG 2026-04-04 16:50:10 +02:00
138ef838d9 [rlsw] Some platform fixes (#5720)
* fix drm with rlsw

* fix window resizing with sdl

* fix window resizing with win32
2026-04-04 16:47:33 +02:00
Ray
6ff51d3a2a Update audio_amp_envelope.c 2026-04-04 11:13:29 +02:00
Ray
ea6292e27a REVIEWED: example: audio_amp_envelope, code formating to follow raylib code conventions #5713 2026-04-04 11:12:30 +02:00
bb7b8d70e9 Example/audio adsr (#5713)
* add  audio_amp_envelope example

* Change 1.0f to env->sustainLevel in case the user
release the spacebar before attack state done
2026-04-04 11:04:24 +02:00
f36533cbd8 rlparser: update raylib_api.* by CI 2026-04-01 21:23:44 +00:00
Ray
5c2dee0862 REVIEWED: LoadDirectoryFiles*() comments 2026-04-01 23:23:25 +02:00
12140cd444 explicitly state TEXTURE_WRAP_REPEAT for web build (#5711) 2026-04-01 14:48:49 +02:00
Ray
3f7f040c7e Merge branch 'master' of https://github.com/raysan5/raylib 2026-04-01 10:17:43 +02:00
Ray
4799cab772 Update rexm.c 2026-04-01 10:17:41 +02:00
Ray
eb4f1a6da0 Update ROADMAP.md 2026-04-01 10:17:37 +02:00
Ray
449182bb51 Update README.md 2026-04-01 10:17:34 +02:00
4ca9170f5b [rcore_rgfw] Updating render resolution as well on SetWindowSize (#5709)
* [rcore_rgfw] Updating render resolution as well on SetWindowSize

* Actually, maybe even better call SetupViewport()
2026-04-01 09:46:14 +02:00
78797757f0 store bytes at global data seg (#5708) 2026-03-31 16:45:54 +02:00
Ray
a6dc9f9e92 Update LICENSE.md 2026-03-30 20:16:40 +02:00
Ray
c7df641aa2 Update text_font_loading.c 2026-03-30 11:00:39 +02:00
Ray
63beefd0de Update Makefile.Web 2026-03-30 11:00:29 +02:00
Ray
b3bf537fab Update rexm.c 2026-03-30 11:00:26 +02:00
Ray
8743e11285 Update rmodels.c 2026-03-29 21:40:41 +02:00
Ray
04f81538b7 ADDED: Some sample code to export gltf/glb meshes -WIP- 2026-03-29 21:37:01 +02:00
Ray
8d70f1007b Update CHANGELOG 2026-03-29 21:24:33 +02:00
Ray
6c0134bb5c Create cgltf_write.h 2026-03-29 21:24:24 +02:00
Ray
e9231bc4f1 Update stb_image_resize2.h 2026-03-29 21:24:20 +02:00
Ray
4c79c6837b Update qoi.h 2026-03-29 21:21:16 +02:00
Ray
e5f0c9f8b1 Update qoa.h 2026-03-29 21:21:11 +02:00
Ray
d5326fe880 Update m3d.h 2026-03-29 21:20:23 +02:00
Ray
adc4c9b875 Update dr_wav.h 2026-03-29 21:19:31 +02:00
Ray
b09da8fce8 Update dr_mp3.h 2026-03-29 21:18:56 +02:00
Ray
0b87a35e5a Update dr_flac.h 2026-03-29 21:18:28 +02:00
Ray
a1bf8d9c75 Update cgltf.h 2026-03-29 21:17:51 +02:00
Ray
d3cc78d9d7 Update rexm.c 2026-03-29 01:44:33 +01:00
Ray
e3dcb144bc Update rexm.c 2026-03-29 01:33:27 +01:00
Ray
da93ec4a21 Remove trailing spaces 2026-03-29 01:17:25 +01:00
Ray
fb0f83bc91 Remove trailing spaces on shaders 2026-03-29 01:10:29 +01:00
Ray
29ded51ea4 Update rlgl.h 2026-03-29 00:43:50 +01:00
bb78e98a71 Remove forced normalization of normal vectors in rlNormal3f, assume the user has set the correct input for the shader. (#5703) 2026-03-29 00:39:23 +01:00
5915584cd6 Fix zig build and minor improvements (#5702)
- Added zig-pkg directory to gitignore
- Brought min zig version to recent nightly release these improvements
  were completed on
- For linux build, only add rglfw.c if the platform is glfw
- Add a None option to the LinuxDisplayBackend
- Fixed xcode-frameworks dependency and update to using most recent
  commit hash
2026-03-29 00:38:45 +01:00
Ray
8c44ea5032 Code gardening
REVIEWED: Some early returns, avoid if possible
REVIEWED: Some return variable names, for consistency, rename `success` to `result`
2026-03-29 00:37:01 +01:00
Ray
5fad835ff1 Update rcore.c 2026-03-28 23:54:51 +01:00
mjt
4142c89baa Update rcore.c comment (#5700) 2026-03-27 21:58:28 +01:00
990a5e0cb4 rlparser: update raylib_api.* by CI 2026-03-27 20:56:45 +00:00
Ray
8a7aff509d WARNING: BREAKING: REDESIGNED: TextInsert(), TextReplace(), TextReplaceBetween(), using static buffers
Redesign has been conditioned by the usage of those functions on `rexm`, `rpc` and other tools; for many use cases a static buffer is enough and way more comfortable to use.
ADDED: `TextInsertAlloc()`, `TextReplaceAlloc()`, `TextReplaceBetweenAlloc()`, alternatives with internal allocations
2026-03-27 21:56:29 +01:00
ba83bd33f3 simplify CheckCollisionSpheres using Vector3DistanceSqr (#5695) 2026-03-27 09:26:53 +01:00
mjt
98d6e24c44 remove comment (#5696) 2026-03-27 09:26:01 +01:00
51f4741912 [rmodel] fix for devices without VAO support (#5692) 2026-03-27 09:25:26 +01:00
d7bd56ef1b rlparser: update raylib_api.* by CI 2026-03-26 17:29:18 +00:00
a693365bf2 Move DrawModelPoints methods to example - point rendering (#5697) 2026-03-26 18:29:05 +01:00
bd3a35ca21 [build.zig.zon] Fix: replace deleted hexops/xcode-frameworks with pkg.machengine.org mirror (#5693) 2026-03-26 09:20:44 +01:00
Ray
0f0983c065 Remove trailing spaces 2026-03-25 16:51:02 +01:00
5dd4036ed0 Fix UI Cellular Automata (#5688) 2026-03-24 08:20:37 +01:00
cb05ef7f03 [rcore_desktop_rgfw] [emscripten] fix typo (#5687)
* RGFW also requires RGBA8 images as window icons, as raylib already reports in raylib.h

* LibraryConfigurations.cmake: exchanged MATCHES -> STREQUAL in platform choosing if-statements

* WebRGFW: remapping mouse/touch position to canvas pixel coordinates

* fix 'typo'

* has to be done like that because of += in case of captured mouse

* [rcore_desktop_rgfw] [emscripten] fix typo
2026-03-23 22:22:21 +01:00
Ray
52d2158f49 Update ROADMAP.md 2026-03-23 18:28:09 +01:00
0f1e14a600 Fix typo: dependant -> dependent in rlgl.h and rexm.c (#5685)
5 instances in src/rlgl.h comments and 1 in tools/rexm/rexm.c.
Skipped vendored raygui.h files in examples/.
2026-03-23 17:58:45 +01:00
6cf71f565c Fix typo: dependant -> dependent in rlgl.h and rexm.c (#5685)
5 instances in src/rlgl.h comments and 1 in tools/rexm/rexm.c.
Skipped vendored raygui.h files in examples/.
2026-03-23 17:17:50 +01:00
e71633a0be Set textureWrapRepeat to avoid issue on web version (#5684) 2026-03-23 14:05:23 +01:00
Ray
ca1baca7c2 REVIEWED: examples memory allocators, using raylib provided macros 2026-03-23 11:53:57 +01:00
Ray
7e8aca00b6 Update textures_raw_data.c 2026-03-23 11:53:31 +01:00
Ray
c1dbfc87f3 REVIEWED: PR #5679 2026-03-23 11:52:01 +01:00
Ray
644e4adbe2 Update rcore.c 2026-03-23 11:51:37 +01:00
1e74aba7c3 WebRGFW: remapping mouse/touch position to canvas pixel coordinates (#5679)
* RGFW also requires RGBA8 images as window icons, as raylib already reports in raylib.h

* LibraryConfigurations.cmake: exchanged MATCHES -> STREQUAL in platform choosing if-statements

* WebRGFW: remapping mouse/touch position to canvas pixel coordinates

* fix 'typo'

* has to be done like that because of += in case of captured mouse
2026-03-23 11:31:06 +01:00
83e35ba170 [rcore] refactor possible data loss on FileMove() (#5682) 2026-03-23 11:30:28 +01:00
22cc2554b1 Fix Memory out of bounds in [shapes] example - ball physics (#5683)
Update screenshot to shapes_bouncing_ball.png
2026-03-23 11:28:28 +01:00
1b084ff9f2 fixed error in readme, found by discord user the.enemy (#5680) 2026-03-22 09:06:03 +01:00
8a685877eb [rlsw] Remove position attribute from sw_vertex_t (#5677)
* review `sw_vertex_t`

* fix comment

* fix pop matrix
2026-03-20 12:07:50 +01:00
192 changed files with 30415 additions and 9974 deletions

View File

@ -44,7 +44,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@master
with:
submodules: recursive
@ -128,7 +128,7 @@ jobs:
- name: Upload CodeQL results as an artifact
if: success() || failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: codeql-results
path: ${{ steps.step1.outputs.sarif-output }}

View File

@ -21,27 +21,27 @@ permissions:
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
contents: write # Required for actions/upload-release-asset to upload release asset
runs-on: windows-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
ARCH: ["arm64", "x86_64"]
env:
RELEASE_NAME: raylib-dev_android_api29_${{ matrix.ARCH }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Release Version
run: |
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_android_api29_${{ matrix.ARCH }}" >> $GITHUB_ENV
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Android NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
@ -52,7 +52,7 @@ jobs:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Setup Environment
run: |
run: |
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
@ -60,7 +60,7 @@ jobs:
mkdir include
mkdir lib
cd ../..
# Generating static + shared library for 64bit arquitectures and API version 29
- name: Build Library
run: |
@ -69,7 +69,7 @@ jobs:
make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=${{ matrix.ARCH }} ANDROID_API_VERSION=29 ANDROID_NDK=${{ env.ANDROID_NDK_HOME }} RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
shell: cmd
- name: Generate Artifacts
run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
@ -80,17 +80,17 @@ jobs:
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ env.RELEASE_NAME }}
path: |
./build/${{ env.RELEASE_NAME }}
!./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v3
with:
files: ./build/${{ env.RELEASE_NAME }}.tar.gz
env:

View File

@ -36,7 +36,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@master
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@master
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory

View File

@ -22,19 +22,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@master
- name: Setup Environment
run: |
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev
- name: Build Library
run: |
cd src
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC
cd ..
- name: Build Examples
run: |
cd examples

View File

@ -13,7 +13,7 @@ on:
- 'src/**'
- 'examples/**'
- '.github/workflows/windows_examples.yml'
permissions:
contents: read
@ -22,7 +22,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@master
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1

View File

@ -21,7 +21,7 @@ permissions:
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
contents: write # Required for actions/upload-release-asset to upload release asset
strategy:
fail-fast: false
max-parallel: 1
@ -42,23 +42,23 @@ jobs:
ARCH_NAME: "arm64"
COMPILER_PATH: "/usr/bin"
runner: "ubuntu-24.04-arm"
runs-on: ${{ matrix.runner }}
env:
RELEASE_NAME: raylib-dev_linux_${{ matrix.ARCH_NAME }}
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Setup Release Version
run: |
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_linux_${{ matrix.ARCH_NAME }}" >> $GITHUB_ENV
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev
mkdir build
@ -74,7 +74,7 @@ jobs:
run : |
sudo apt-get install gcc-multilib
if: matrix.bits == 32 && matrix.ARCH == 'i386'
# TODO: Support 32bit (i386) static/shared library building
- name: Build Library (32-bit)
run: |
@ -91,7 +91,7 @@ jobs:
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
if: matrix.bits == 64 && matrix.ARCH == 'x86_64'
- name: Build Library (64-bit ARM)
run: |
cd src
@ -99,7 +99,7 @@ jobs:
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
if: matrix.bits == 64 && matrix.ARCH == 'aarch64'
- name: Generate Artifacts
run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
@ -110,17 +110,17 @@ jobs:
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ env.RELEASE_NAME }}
path: |
./build/${{ env.RELEASE_NAME }}
!./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v3
with:
files: ./build/${{ env.RELEASE_NAME }}.tar.gz
env:

View File

@ -21,16 +21,16 @@ permissions:
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
contents: write # Required for actions/upload-release-asset to upload release asset
runs-on: macos-latest
env:
RELEASE_NAME: raylib-dev_macos
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Release Version
run: |
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_macos" >> $GITHUB_ENV
@ -38,7 +38,7 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
run: |
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
@ -46,47 +46,47 @@ jobs:
mkdir include
mkdir lib
cd ../..
# Generating static + shared library, note that i386 architecture is deprecated
# Defining GL_SILENCE_DEPRECATION because OpenGL is deprecated on macOS
- name: Build Library
run: |
cd src
clang --version
# Extract version numbers from Makefile
brew install grep
RAYLIB_API_VERSION=`ggrep -Po 'RAYLIB_API_VERSION\s*=\s\K(.*)' Makefile`
RAYLIB_VERSION=`ggrep -Po 'RAYLIB_VERSION\s*=\s\K(.*)' Makefile`
# Build raylib x86_64 static
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
mv libraylib.a /tmp/libraylib_x86_64.a
make clean
# Build raylib arm64 static
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B
mv libraylib.a /tmp/libraylib_arm64.a
make clean
# Join x86_64 and arm64 static
lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a /tmp/libraylib_x86_64.a /tmp/libraylib_arm64.a
# Build raylib x86_64 dynamic
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target x86_64-apple-macos10.12" -B
mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib
make clean
# Build raylib arm64 dynamic
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target arm64-apple-macos11" -B
mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib
# Join x86_64 and arm64 dynamic
lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib
ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.dylib
ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_API_VERSION}.dylib
cd ..
- name: Generate Artifacts
run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
@ -97,17 +97,17 @@ jobs:
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ env.RELEASE_NAME }}
path: |
./build/${{ env.RELEASE_NAME }}
!./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v3
with:
files: ./build/${{ env.RELEASE_NAME }}.tar.gz
env:

View File

@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@master
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v14
uses: emscripten-core/setup-emsdk@v15
with:
version: 5.0.3
actions-cache-folder: 'emsdk-cache'
@ -69,7 +69,7 @@ jobs:
shell: cmd
- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ env.RELEASE_NAME }}
path: |
@ -77,7 +77,7 @@ jobs:
!./build/${{ env.RELEASE_NAME }}.zip
- name: Upload Artifact to Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v3
with:
files: ./build/${{ env.RELEASE_NAME }}.zip
env:

View File

@ -21,7 +21,7 @@ permissions:
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
contents: write # Required for actions/upload-release-asset to upload release asset
runs-on: windows-latest
strategy:
fail-fast: false
@ -81,7 +81,7 @@ jobs:
# Setup MSBuild.exe path if required
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
uses: microsoft/setup-msbuild@v3
if: matrix.compiler == 'msvc16'
- name: Build Library (MinGW-w64 32bit)
@ -140,7 +140,7 @@ jobs:
shell: cmd
- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ env.RELEASE_NAME }}
path: |
@ -148,7 +148,7 @@ jobs:
!./build/${{ env.RELEASE_NAME }}.zip
- name: Upload Artifact to Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v3
with:
files: ./build/${{ env.RELEASE_NAME }}.zip
env:

View File

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@master
- name: Update parse files
working-directory: tools/rlparser

View File

@ -12,13 +12,13 @@ on:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@master
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v14
uses: emscripten-core/setup-emsdk@v15
with:
version: 'latest'
actions-cache-folder: 'emsdk-cache'

7
.gitignore vendored
View File

@ -65,7 +65,7 @@ src/external/SDL3
# Emscripten
emsdk
# Ignore wasm data in examples/
# Ignore binaries generated in examples/
examples/**/*
!examples/**/*.*
!examples/**/*/
@ -118,14 +118,15 @@ GTAGS
# Zig programming language
.zig-cache/
zig-cache/
zig-pkg/
zig-out/
build/
build-*/
docgen_tmp/
# Tools stuff
tools/parser/rlparser.exe
tools/parser/rlparser
tools/rlparser/rlparser.exe
tools/rlparser/rlparser
tools/rexm/rexm.exe
tools/rexm/rexm

View File

@ -6,12 +6,12 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| Name | raylib Version | Language | License |
| :--------------------------------------------------------------------------------------- | :--------------: | :------------------------------------------------------------------: | :------------------: |
| [raylib](https://github.com/raysan5/raylib) | **5.5** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
| [raylib](https://github.com/raysan5/raylib) | **6.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
| [raylib-ada](https://github.com/Fabien-Chouteau/raylib-ada) | **5.5** | [Ada](https://en.wikipedia.org/wiki/Ada_(programming_language)) | MIT |
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.5** | [Beef](https://www.beeflang.org) | MIT |
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
| [raylib-c3](https://github.com/c3lang/vendor/tree/main/libraries/raylib55.c3l) | **5.5** | [C3](https://c3-lang.org) | MIT |
| [raylib-cs](https://github.com/raylib-cs/raylib-cs) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
| [raylib-c3](https://github.com/c3lang/vendor/tree/main/libraries/raylib6.c3l) | **6** | [C3](https://c3-lang.org) | MIT |
| [raylib-cs](https://github.com/raylib-cs/raylib-cs) | **6.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
| [Raylib-CsLo](https://github.com/NotNotTech/Raylib-CsLo) | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
| [Raylib-CSharp-Vinculum](https://github.com/ZeroElectric/Raylib-CSharp-Vinculum) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
| [Raylib-CSharp](https://github.com/MrScautHD/Raylib-CSharp) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MIT |
@ -26,17 +26,19 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| [raylib-cr](https://github.com/sol-vin/raylib-cr) | 4.6-dev (5e1a81) | [Crystal](https://crystal-lang.org) | Apache-2.0 |
| [ray-cyber](https://github.com/fubark/ray-cyber) | **5.0** | [Cyber](https://cyberscript.dev) | MIT |
| [dart-raylib](https://gitlab.com/wolfenrain/dart-raylib) | 4.0 | [Dart](https://dart.dev) | MIT |
| [raylib_dart](https://pub.dev/packages/raylib_dart) | 6.0 | [Dart](https://dart.dev) | MIT |
| [bindbc-raylib3](https://github.com/o3o/bindbc-raylib3) | **5.0** | [D](https://dlang.org) | BSL-1.0 |
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) | Apache-2.0 |
| [raylib-d](https://github.com/schveiguy/raylib-d) | **5.5** | [D](https://dlang.org) | Zlib |
| [DenoRaylib550](https://github.com/JJLDonley/DenoRaylib550) | **5.5** | [Deno](https://deno.land) | MIT |
| [raylib-d](https://github.com/schveiguy/raylib-d) | **6.0** | [D](https://dlang.org) | Zlib |
| [Deno-Raylib](https://github.com/JJLDonley/Deno-Raylib) | **6.0** | [Deno / TS](https://deno.land) | MIT |
| [rayex](https://github.com/shiryel/rayex) | 3.7 | [elixir](https://elixir-lang.org) | Apache-2.0 |
| [raylib-elle](https://github.com/acquitelol/elle/blob/rewrite/std/raylib.le) | **5.5** | [Elle](https://github.com/acquitelol/elle) | GPL-3.0 |
| [raylib-factor](https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor) | 5.5 | [Factor](https://factorcode.org) | BSD |
| [raylib4fb](https://github.com/mudhairless/raylib4fb) | **6.0** | [FreeBASIC](https://www.freebasic.net) | Zlib |
| [raylib-freebasic](https://github.com/WIITD/raylib-freebasic) | **5.0** | [FreeBASIC](https://www.freebasic.net) | MIT |
| [raylib.f](https://github.com/cthulhuology/raylib.f) | **5.5** | [Forth](https://forth.com) | Zlib |
| [fortran-raylib](https://github.com/interkosmos/fortran-raylib) | **5.5** | [Fortran](https://fortran-lang.org) | ISC |
| [raylib-go](https://github.com/gen2brain/raylib-go) | **5.5** | [Go](https://golang.org) | Zlib |
| [raylib-go](https://github.com/gen2brain/raylib-go) | **6.0** | [Go](https://golang.org) | Zlib |
| [raylib-guile](https://github.com/petelliott/raylib-guile) | **auto** | [Guile](https://www.gnu.org/software/guile) | Zlib |
| [gforth-raylib](https://github.com/ArnautDaniel/gforth-raylib) | 3.5 | [Gforth](https://gforth.org) | **???** |
| [h-raylib](https://github.com/Anut-py/h-raylib) | **5.5-dev** | [Haskell](https://haskell.org) | Apache-2.0 |
@ -48,9 +50,9 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| [Raylib.jl](https://github.com/chengchingwen/Raylib.jl) | 4.2 | [Julia](https://julialang.org) | Zlib |
| [kaylib](https://github.com/electronstudio/kaylib) | 3.7 | [Kotlin/native](https://kotlinlang.org) | **???** |
| [KaylibKit](https://codeberg.org/Kenta/KaylibKit) | 4.5 | [Kotlin/native](https://kotlinlang.org) | Zlib |
| [raylib-lua](https://github.com/TSnake41/raylib-lua) | 5.0 | [Lua](http://www.lua.org) | ISC |
| [raylib-lua](https://github.com/TSnake41/raylib-lua) | 5.5 | [Lua](http://www.lua.org) | ISC |
| [raylib-lua-bindings (WIP)](https://github.com/legendaryredfox/raylib-lua-bindings) | 5.5 | [Lua](http://www.lua.org) | ISC |
| [ReiLua](https://github.com/nullstare/ReiLua) | 5.5 | [Lua](http://www.lua.org) | MIT |
| [ReiLua](https://github.com/nullstare/ReiLua) | 6.0 | [Lua](http://www.lua.org) | MIT |
| [raylib-lua-sol](https://github.com/RobLoach/raylib-lua-sol) | 5.5 | [Lua](http://www.lua.org) | Zlib |
| [raylib-luajit](https://github.com/homma/raylib-luajit) | 5.5 | [Lua](http://www.lua.org) | MIT |
| [raylib-luajit-generated](https://github.com/james2doyle/raylib-luajit-generated) | 5.5 | [Lua](http://www.lua.org) | MIT |
@ -61,9 +63,9 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| [node-raylib](https://github.com/RobLoach/node-raylib) | 4.5 | [Node.js](https://nodejs.org/en) | Zlib |
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.5** | [Odin](https://odin-lang.org) | Zlib |
| [raylib_odin_bindings](https://github.com/Deathbat2190/raylib_odin_bindings) | 4.0-dev | [Odin](https://odin-lang.org) | MIT |
| [raylib-ocaml](https://github.com/tjammer/raylib-ocaml) | **5.0** | [OCaml](https://ocaml.org) | MIT |
| [raylib-ocaml](https://github.com/tjammer/raylib-ocaml) | **6.0** | [OCaml](https://ocaml.org) | MIT |
| [TurboRaylib](https://github.com/turborium/TurboRaylib) | 4.5 | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT |
| [Ray4Laz](https://github.com/GuvaCode/Ray4Laz) | **5.5** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)/[Delphi](https://en.wikipedia.org/wiki/Delphi_(software)) | Zlib |
| [Ray4Laz](https://github.com/GuvaCode/Ray4Laz) | **6.0** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)/[Delphi](https://en.wikipedia.org/wiki/Delphi_(software)) | Zlib |
| [Raylib.4.0.Pascal](https://github.com/sysrpl/Raylib.4.0.Pascal) | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
| [pyraylib](https://github.com/Ho011/pyraylib) | 3.7 | [Python](https://www.python.org) | Zlib |
| [raylib-python-cffi](https://github.com/electronstudio/raylib-python-cffi) | **5.5** | [Python](https://www.python.org) | EPL-2.0 |
@ -76,6 +78,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| [raylibr](https://github.com/jeroenjanssens/raylibr) | 4.0 | [R](https://www.r-project.org) | MIT |
| [raylib-ffi](https://github.com/ewpratten/raylib-ffi) | 5.5 | [Rust](https://www.rust-lang.org) | GPLv3 |
| [raylib-rs](https://github.com/raylib-rs/raylib-rs) | **5.5** | [Rust](https://www.rust-lang.org) | Zlib |
| [sola-raylib](https://github.com/brettchalupa/sola-raylib) | **6.0** | [Rust](https://www.rust-lang.org) | Zlib |
| [raylib-ruby](https://github.com/wilsonsilva/raylib-ruby) | 4.5 | [Ruby](https://www.ruby-lang.org) | Zlib |
| [Relib](https://github.com/RedCubeDev-ByteSpace/Relib) | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | **???** |
| [racket-raylib](https://github.com/eutro/racket-raylib) | **5.5** | [Racket](https://racket-lang.org) | MIT/Apache-2.0 |
@ -85,10 +88,10 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| [raylib-umka](https://github.com/robloach/raylib-umka) | 4.5 | [Umka](https://github.com/vtereshkov/umka-lang) | Zlib |
| [raylib-v](https://github.com/vlang/raylib) | 5.5 | [V](https://vlang.io) | MIT/Unlicense |
| [raylib.v](https://github.com/irishgreencitrus/raylib.v) | 4.2 | [V](https://vlang.io) | Zlib |
| [raylib-vapi](https://github.com/lxmcf/raylib-vapi) | **5.0** | [Vala](https://vala.dev) | Zlib |
| [raylib-vapi](https://github.com/lxmcf/raylib-vapi) | **6.0** | [Vala](https://vala.dev) | Zlib |
| [raylib-wave](https://github.com/wavefnd/raylib-wave) | **auto** |[Wave](http://wave-lang.dev) | Zlib |
| [raylib-wren](https://github.com/TSnake41/raylib-wren) | 4.5 | [Wren](http://wren.io) | ISC |
| [raylib-zig](https://github.com/raylib-zig/raylib-zig) | **5.6-dev** | [Zig](https://ziglang.org) | MIT |
| [raylib-zig](https://github.com/raylib-zig/raylib-zig) | **6.0** | [Zig](https://ziglang.org) | MIT |
| [raylib.zig](https://github.com/ryupold/raylib.zig) | **5.1-dev** | [Zig](https://ziglang.org) | MIT |
| [raylib-zig-bindings](https://github.com/L-Briand/raylib-zig-bindings) | **5.0** | [Zig](https://ziglang.org) | Zlib |
| [hare-raylib](https://git.sr.ht/~evantj/hare-raylib) | **auto** | [Hare](https://harelang.org) | Zlib |
@ -100,10 +103,11 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| [Raylib.lean](https://github.com/KislyjKisel/Raylib.lean) | **5.5-dev** | [Lean4](https://lean-lang.org) | BSD-3-Clause |
| [raylib-cobol](https://codeberg.org/glowiak/raylib-cobol) | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain |
| [raylib-apl](https://github.com/Brian-ED/raylib-apl) | **5.0** | [Dyalog APL](https://www.dyalog.com/) | MIT |
| [raylib-jai](https://github.com/ahmedqarmout2/raylib-jai) | **5.5** | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | MIT |
| [raylib-jai](https://github.com/ahmedqarmout2/raylib-jai) | **6.0** | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | MIT |
| [fnl-raylib](https://github.com/0riginaln0/fnl-raylib) | **5.5** | [Fennel](https://fennel-lang.org/) | MIT |
| [Rayua](https://github.com/uiua-lang/rayua) | **5.5** | [Uiua](https://www.uiua.org/) | **???** |
| [Target](https://github.com/FinnDemonCat/Target/tree/main/libs/raylib) | **5.5** | [Dart](https://dart.dev/) | Apache-2.0 license |
| [Target](https://github.com/FinnDemonCat/Target/tree/main/libs/raylib) | **5.5** | [Dart](https://dart.dev/) | Apache-2.0 license |
| [gclang-raylib](https://github.com/gnuchanos/gcLang_Compiler/tree/main/windows_version/raylib_version)| **6.0** | [gclang](https://github.com/gnuchanos/gcLang_Compiler) | AGPL-3.0 |
### Utility Wrapers
@ -111,7 +115,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's paradigm.
| Name | raylib Version | Language | License |
| ---------------------------------------------------- | :------------: | :------------------------------------------: | :-----: |
| [raylib-cpp](https://github.com/robloach/raylib-cpp) | **5.5** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib |
| [raylib-cpp](https://github.com/robloach/raylib-cpp) | **6.0** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib |
| [claylib](https://github.com/defun-games/claylib) | 4.5 | [Common Lisp](https://common-lisp.net) | Zlib |
| [rayed-bqn](https://github.com/Brian-ED/rayed-bqn) | **5.0** | [BQN](https://mlochbaum.github.io/BQN) | MIT |
| [DOOR](https://github.com/RealDoigt/DOOR) | 4.0 | [D](https://dlang.org) | MIT |

View File

@ -1,10 +1,10 @@
changelog
---------
Current Release: raylib 5.5 (18 November 2024)
Current Release: raylib 6.0 (23 April 2026)
-------------------------------------------------------------------------
Release: raylib 6.0 (?? March 2026)
Release: raylib 6.0 (23 April 2026)
-------------------------------------------------------------------------
KEY CHANGES:
- New Software Renderer backend [rlsw]
@ -17,15 +17,21 @@ KEY CHANGES:
- New File System API
- New Text Management API
- New tool: [rexm] raylib examples manager
- Added +50 new examples to learn from
- Added +70 new examples to learn from
Detailed changes:
[rcore] ADDED: `FileRename()`, by @raysan5
[rcore] ADDED: `FileRemove()`, by @raysan5
[rcore] ADDED: `FileCopy()`, by @raysan5
[rcore] ADDED: `FileMove()`, by @raysan5
[rcore] ADDED: `FileTextReplace()`, by @raysan5
[rcore] ADDED: `FileTextFindIndex()`, by @raysan5
[rcore] ADDED: `ComputeSHA256()` (#5264) by @iamahuman1395
[rcore] ADDED: `GetKeyName()` (#4544) by @lecongsebastien
[rcore] ADDED: Logging and file-system functionality from `utils` (#4551) by @raysan5 -WARNING-
[rcore] ADDED: Flags set/clear macros: FLAG_SET, FLAG_CLEAR, FLAG_IS_SET (#5169) by @raysan5
[rcore] ADDED: Warnings in case of no platform backend defined by @raysan5
[rcore] ADDED: `ComputeSHA256()` (#5264) by @iamahuman1395
[rcore] ADDED: `GetKeyName()` (#4544) by @lecongsebastien
[rcore] REMOVED: GIF recording option, added example by @raysan5 -WARNING-
[rcore] REMOVED: `CORE.Window.fullscreen` variable, using available flag instead by @raysan5
[rcore] REMOVED: `SetupFramebuffer()`, most platforms do not need it any more by @raysan5
@ -109,9 +115,10 @@ Detailed changes:
[rcore][GLFW] REVIEWED: `GetGamepadButtonPressed()`, return GAMEPAD_BUTTON_*_TRIGGER_2 if pressed (#4742) by @whaleymar
[rcore][GLFW] REVIEWED: Update `mappings.h` using `GenerateMappings.cmake` by @sleeptightAnsiC
[rcore][RGFW] ADDED: New backend option: `PLATFORM_WEB_RGFW` and update RGFW (#4480) by @colleagueRiley
[rcore][RGFW] ADDED: Support for software rendering (#5773) by @CrackedPixel
[rcore][RGFW] REVIEWED: Added missing Right Control key by @M374LX
[rcore][RGFW] REVIEWED: Changed `RGFW_window_eventWait` timeout to -1 by @doggymangc
[rcore][RGFW] REVIEWED: Duplicate entries reemoved from `keyMappingRGFW` (#5242) by @iamahuman1395
[rcore][RGFW] REVIEWED: Duplicate entries removed from `keyMappingRGFW` (#5242) by @iamahuman1395
[rcore][RGFW] REVIEWED: Fix Escape always closing the window by @M374LX
[rcore][RGFW] REVIEWED: Forward declare the windows stuff, prevents failures in GCC (#5269) by @Jeffm2501
[rcore][RGFW] REVIEWED: Requires RGBA8 images as window icons (#5431) by @crisserpl2
@ -198,7 +205,7 @@ Detailed changes:
[rlgl] REVIEWED: `rlActiveDrawBuffers`, fix for OpenGL ES 3.0 (#4605) by @Bigfoot71
[rlgl] REVIEWED: `rlGetPixelDataSize()`, correct compressed data size calculation per blocks #5416 by @raysan5
[rlgl] REVIEWED: `instranceTransform` shader location index #4538 (#4579) by @meadiode
[rlgl] REVIEWED: `SetShaderValueTexture()`, updatee comments (#4703) by @pejorativefox
[rlgl] REVIEWED: `SetShaderValueTexture()`, update comments (#4703) by @pejorativefox
[rlgl] REDESIGNED: Avoid program crash if GPU data is tried to be loaded before `InitWindow()` #4751 by @raysan5 -WARNING-
[rlgl] REDESIGNED: Shader loading API function names for more consistency #5631 by @raysan5 -WARNING-
[rlsw] ADDED: `swGetColorBuffer()` for convenience by @raysan5
@ -215,6 +222,7 @@ Detailed changes:
[rlsw] REVIEWED: C++ support (#5291) by @alexgb0
[rshapes] ADDED: `DrawLineDashed()` (#5222) by @luis605
[rshapes] ADDED: `DrawEllipseV()` and `DrawEllipseLinesV()` (#4963) by @meowstr
[rshapes] REDESIGNED: `DrawCircleGradient()` to use Vector2 as center parameter by @raysan5 -WARNING-
[rshapes] REVIEWED: `DrawLine()`, fix pixel offset issue on drawing (#4666) by @Bigfoot71
[rshapes] REVIEWED: `DrawRectangleGradientEx()`, incorrect parameter names (#4980) by @vincent
[rshapes] REVIEWED: `DrawRectangleLines`, fix pixel offset issue (#4669) by @Bigfoot71
@ -239,6 +247,13 @@ Detailed changes:
[rtextures] REVIEWED: `ImageDrawLineEx(), to be able to draw even numbered thicknesses (#5042) by @Sir-Irk
[rtextures] REVIEWED: `ImageBlurGaussian()`, fix integer overflow in cast (#5037) by @garrisonhh
[rtext] ADDED: `LoadTextLines()`/`UnloadTextLines()` by @raysan5
[rtext] ADDED: `TextInsertAlloc()`, returns memory allocated string by @raysan5
[rtext] ADDED: `TextReplace()`, using static buffer by @raysan5
[rtext] ADDED: `TextReplaceAlloc()`, returns memory allocated string by @raysan5
[rtext] ADDED: `TextReplaceBetween()`, using static buffer by @raysan5
[rtext] ADDED: `TextReplaceBetweenAlloc()`, returns memory allocated string by @raysan5
[rtext] ADDED: `GetTextBetween()`, using static buffer by @raysan5
[rtext] ADDED: `TextRemoveSpaces()`, using static buffer by @raysan5
[rtext] ADDED: `MeasureTextCodepoints()` for direct measurement of codepoints (#5623) by @creeperblin
[rtext] RENAMED: Variable names for consistency, `textLength` (length in bytes) vs `textSize` (measure in pixels) by @raysan5
[rtext] REVIEWED: Support default font loading with no GPU enabled, to be used with Image API
@ -263,16 +278,16 @@ Detailed changes:
[rtext] REVIEWED: `GetCodepointCount()`, misuse of cast (#4741) by @sleeptightAnsiC
[rtext] REVIEWED: `GenImageFontAtlas()`, memory corruption and invalid size calculation (#5602) by @konakona418
[rtext] REVIEWED: `TextInsert()`, fix bug on insertion (#5644) by @CrackedPixel
[rtext] REVIEWED: `TextInsert()`, use static buffer, easier to use by @raysan5 -WARNING-
[rtext] REVIEWED: `TextJoin()`, convert `const char **` to `char**` by @raysan5
[rtext] REVIEWED: `TextReplace()` and `TextLength()`, avoid using `strcpy()` by @raysan5
[rtext] REVIEWED: `TextReplace()` by @raysan5
[rtext] REVIEWED: `TextReplace()`, improvements (#5511) by @belan2470
[rtext] REVIEWED: `TextReplaceBetween()` by @raysan5
[rtext] REVIEWED: `TextReplace()` and `TextLength()`, avoid using `strcpy()` by @raysan5
[rtext] REVIEWED: `TextSubtext(), fixes (#4759) by @veins1
[rtext] REVIEWED: `TextToPascal()`, fix issue by @raysan5
[rtext] REVIEWED: `TextToFloat()`, remove removed inaccurate comment (#4596) by @hexmaster111
[rtext] REDESIGNED: `LoadFontData()`, added input parameter by @raysan5 -WARNING-
[rmodels] ADDED: Support CPU animation in OpenGL 1.1 (#4925) by @JeffM2501
[rmodels] REMOVED: `DrawModelPoints()` and `DrawModelPointsEx()`, moved to an example (#5697) by @maiconpintoabreu -WARNING-
[rmodels] RENAMED: Skinning shader variables (new default naming) by @raysan5
[rmodels] REVIEWED: glTF animation framerate calculation (#4472, #5445) by @TheLazyIndianTechie
[rmodels] REVIEWED: Assign meshes without bone weights to the bone they are attached to so they animate by @Jeffm2501
@ -299,6 +314,7 @@ Detailed changes:
[rmodels] REVIEWED: `LoadModelAnimationsGLTF()`, properly load 1 frame animations (#5561) by @arlez80
[rmodels] REVIEWED: `LoadModelAnimationsGLTF()`, anim correctly inherits world transform (#5206) by @ArmanOmmid
[rmodels] REVIEWED: `UploadMesh()`, improve default normal and tangent values (#4763) by @Bigfoot71
[rmodels] REVIEWED: `UplaodMesh()`, fix for devices without VAO support (#5692) by @psxdev
[rmodels] REVIEWED: `GenMeshTangents()`, improvements (#4937) by @Bigfoot71
[rmodels] REVIEWED: `UpdateModelAnimation()` optimization (#5244) by @Arrangemonk
[rmodels] REVIEWED: `UpdateModelAnimationBones()`, break on first mesh found and formating by @raysan5
@ -310,6 +326,8 @@ Detailed changes:
[rmodels] REVIEWED: `DrawMeshInstanced()`, breaking if instanceTransform was unused (#5469) by @al13n321
[rmodels] REVIEWED: `DrawSphereEx()`, normals support (#4926) by @karl-zylinski
[rmodels] REVIEWED: `ExportMesh()`, improve OBJ vertex data precision and lower memory usage (#4496) by @mikeemm
[rmodels] REVIEWED: `CheckCollisionSpheres()`, simplified using `Vector3DistanceSqr()` (#5695) by @Bigfoot71
[rmodels] REVIEWED: `CheckCollisionBoxSphere()`, improved performance and consistency (#5776) by @maiconpintoabreu
[raudio] REVIEWED: Fix a glitch at the end of a sound (#5578) by @mackron
[raudio] REVIEWED: Improvements to device configuration (#5577) by @mackron
[raudio] REVIEWED: Initialize sound alias properties as if it was a new sound (#5123) by @JeffM2501
@ -394,11 +412,12 @@ Detailed changes:
[build][CMake] REVIEWED: Set `libm` as public so it can be linked by consumer (#5193) by @brccabral
[build][Cmake] REVIEWED: Expose PLATFORM_WEB_RGFW (#5579) by @crisserpl2
[build][Zig] ADDED: Android target to build by @lumenkeyes
[build][Zig] REDESIGNED: Complete refactor of build.zig to support Zig 0.16.0 (#5764) by @HaxSam
[build][Zig] REVIEWED: Link EGL for Android by @lumenkeyes
[build][Zig] REVIEWED: Approach to build for web with zig-build (#5157) by @haxsam
[build][Zig] REVIEWED: Fix build accessing env vars (#5490) by @iisakki
[build][Zig] REVIEWED: Fix emscripten building by @johnnymarler
[build][Zig] REVIWED: Move examples/build.zig into main build.zig by @johnnymarler
[build][Zig] REVIEWED: Move examples/build.zig into main build.zig by @johnnymarler
[build][Zig] REVIEWED: Fix raygui inclusion in windows crosscompilation (#4489) by @kimierik
[build][Zig] REVIEWED: Issue on emscripten run if the user has not installed emsdk by @emilhakimov415
[build][Zig] REVIEWED: Make X11 the default display backend instead of choosing at runtime (#5168) by @Not-Nik
@ -446,6 +465,7 @@ Detailed changes:
[examples] ADDED: `shapes_rlgl_triangle` example (#5353) by @robinsaviary
[examples] ADDED: `shapes_starfield` (#5255) by @themushroompirates
[examples] ADDED: `shapes_triangle_strip` (#5240) by @Jopestpe
[examples] ADDED: `shapes_collision_ellipses` (#5722) by @Monjaris
[examples] ADDED: `text_inline_styling` by @raysan5
[examples] ADDED: `text_strings_management` (#5379) by @davidbuzatto
[examples] ADDED: `text_words_alignment` (#5254) by @themushroompirates
@ -735,7 +755,7 @@ Detailed changes:
[rexm] REVIEWED: `ScanExampleResources()` avoid resources to be saved by the program by @raysan5
[rexm] REVIEWED: `UpdateSourceMetadata()` and `TextReplaceBetween()` by @raysan5
[rexm] REVIEWED: `examples.js` example addition working by @raysan5
[rexm] REVIEWED: `add` command logic for existing examplee addition by @raysan5
[rexm] REVIEWED: `add` command logic for existing example addition by @raysan5
[rexm] REVIEWED: Replace example name on project file by @raysan5
[rexm] REVIEWED: Report issues if logs can not be loaded by @raysan5
[rexm] REVIEWED: VS project adding to solution by @raysan5
@ -747,6 +767,7 @@ Detailed changes:
[rexm] REVIEWED: `Makefile.Web` before trying to rebuild new example for web by @raysan5
[rexm] REVIEWED: Using `Makefile.Web` for specific web versions generation by @raysan5
[external] ADDED: `cgltf_write` 1.15, to support glTF models export in the future, by @raysan5
[external] RENAMED: `rl_gputex.h` to `rltexgpu.h`, compressed textures loading
[external] REVIEWED: `rltexgpu.h`, make it usable standalone by @raysan5
[external] REVIEWED: `rltexgpu.h, fix the swizzling in `rl_load_dds_from_memory()` (#5422) by @msmith-codes
@ -755,16 +776,23 @@ Detailed changes:
[external] REVIEWED: `sdefl` and `sinfl` issues (#5367) by @raysan5
[external] REVIEWED: `sinfl_bsr()`, improvements by @RicoP
[external] REVIEWED: `stb_truetype`, fix composite glyph scaling logic (#4811) by @ashishbhattarai
[external] UPDATED: `raygui` to 5.0-dev for examples by @raysan5
[external] UPDATED: dr_libs (#5020) by @Emil2010
[external] UPDATED: miniaudio to v0.11.22 (#4983) by @M374LX
[external] UPDATED: miniaudio to v0.11.23 (#5234) by @pyrokn8
[external] UPDATED: miniaudio to v0.11.24 (#5506) by @vdemcak
[external] UPDATED: raygui to 5.0-dev for examples by @raysan5
[external] UPDATED: RGFW to 1.5 (#4688) by @ColleagueRiley
[external] UPDATED: RGFW to 1.6 (#4795) by @colleagueRiley
[external] UPDATED: RGFW to 1.7 (#4965) by @M374LX
[external] UPDATED: RGFW to 1.7.5-dev (#4976) by @M374LX
[external] UPDATED: RGFW to 2.0.0 (#5582) by @CrackedPixel
[external] UPDATED: `miniaudio` to v0.11.22 (#4983) by @M374LX
[external] UPDATED: `miniaudio` to v0.11.23 (#5234) by @pyrokn8
[external] UPDATED: `miniaudio` to v0.11.24 (#5506) by @vdemcak
[external] UPDATED: `RGFW` to 1.5 (#4688) by @ColleagueRiley
[external] UPDATED: `RGFW` to 1.6 (#4795) by @colleagueRiley
[external] UPDATED: `RGFW` to 1.7 (#4965) by @M374LX
[external] UPDATED: `RGFW` to 1.7.5-dev (#4976) by @M374LX
[external] UPDATED: `RGFW` to 2.0.0 (#5582) by @CrackedPixel
[external] UPDATED: `cgltf` 1.14 to 1.15 by @raysan5
[external] UPDATED: `dr_flac` v0.13.0 to v0.13.3 by @raysan5
[external] UPDATED: `dr_mp3` v0.7.0 to v0.7.4 by @raysan5
[external] UPDATED: `m3d` to latest master by @raysan5
[external] UPDATED: `qoi` to latest master by @raysan5
[external] UPDATED: `qoa` to latest master by @raysan5
[external] UPDATED: `stb_image_resize2` v2.12 to v2.18 by @raysan5
[misc] ADDED: SECURITY.md for security reporting policies by @raysan5
[misc] ADDED: `examples/examples_list`, to be used by `rexm` or other tools by @raysan5

View File

@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.25)
#this change avoid the warning that appear when we include raylib using Cmake fatch content
cmake_minimum_required(VERSION 3.22)
project(raylib)
# Avoid excessive expansion of variables in conditionals. In particular, if
@ -29,7 +28,7 @@ include(CompilerFlags)
# Registers build options that are exposed to cmake
include(CMakeOptions.txt)
if (UNIX AND NOT APPLE AND NOT "${PLATFORM}" MATCHES "DRM" AND NOT "${PLATFORM}" MATCHES "Web")
if (UNIX AND NOT APPLE AND NOT "${PLATFORM}" MATCHES "DRM" AND NOT "${PLATFORM}" MATCHES "Web" AND NOT "${PLATFORM}" MATCHES "SDL")
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
message(FATAL_ERROR "Cannot disable both Wayland and X11")
endif()

View File

@ -6,7 +6,7 @@ if(EMSCRIPTEN)
# When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default
SET(PLATFORM Web CACHE STRING "Platform to build for.")
endif()
enum_option(PLATFORM "Desktop;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW" "Platform to build for.")
enum_option(PLATFORM "Desktop;Win32;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW;Memory" "Platform to build for.")
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0;Software" "Force a specific OpenGL Version?")
@ -29,11 +29,15 @@ option(GLFW_BUILD_WAYLAND "Build the bundled GLFW with Wayland support" OFF)
option(GLFW_BUILD_X11 "Build the bundled GLFW with X11 support" ON)
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage)" OFF)
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
include(ParseConfigHeader)
foreach(FLAG IN LISTS CONFIG_HEADER_FLAGS)
string(REGEX MATCH "([^=]+)=(.+)" _ ${FLAG})
cmake_dependent_option(${CMAKE_MATCH_1} "" ${CMAKE_MATCH_2} CUSTOMIZE_BUILD ${CMAKE_MATCH_2})
set(CONFIG_HEADER_FLAG_DEFAULT ${CMAKE_MATCH_2})
if (INCLUDE_EVERYTHING AND "${CONFIG_HEADER_FLAG_DEFAULT}" STREQUAL "OFF")
set(CONFIG_HEADER_FLAG_DEFAULT ON)
endif()
cmake_dependent_option(${CMAKE_MATCH_1} "" ${CONFIG_HEADER_FLAG_DEFAULT} CUSTOMIZE_BUILD ${CONFIG_HEADER_FLAG_DEFAULT})
endforeach()

View File

@ -526,26 +526,79 @@ Last but not least, I want to thank **raylib sponsors and all the raylib communi
notes on raylib 6.0
-------------------
A new raylib release is finally ready, after almost 1.5 years since last release. This is the biggest release ever with many improvements to the library, thanks to the support of many amazing contributors and also thanks to the financial support of NLnet/NGI0 funds.
A new `raylib` release is finally ready and, again, this is the **biggest `raylib` release ever**! Thanks to the support of many amazing contributors this release comes packed with many new features and improvements, also thanks to the financial support of [NLnet](https://nlnet.nl/) and the [NGI Zero Commond Fund](https://nlnet.nl/NGI0/) that allow me to work on this project mostly fulltime for the past few months.
Some astonishing numbers for this release:
- **+320** closed issues (for a TOTAL of **+2130**!)
- **+1800** commits since previous RELEASE (for a TOTAL of **+9600**!)
- **18** functions ADDED to raylib API (for a TOTAL of **599**!)
- **+50** new examples to learn from (for a TOTAL of **212**!)
- **+200** new contributors (for a TOTAL of **+840**!)
- **+330** closed issues (for a TOTAL of **+2150**!)
- **+2000** commits since previous RELEASE (for a TOTAL of **+9760**!)
- **+20** new functions ADDED to raylib API (for a TOTAL of **600**!)
- **+70** new examples to learn from (for a TOTAL of **+215**!)
- **+210** new contributors (for a TOTAL of **+850**!)
Highlights for `raylib 6.0`:
- New Software Renderer backend [rlsw]
- New rcore platform backend: Memory (memory buffer)
- New rcore platform backend: Win32 (experimental)
- New rcore platform backend: Emscripten (experimental)
- Redesigned Skeletal Animation System
- Redesigned fullscreen modes and high-dpi content scaling
- Redesigned Build Config System [config.h]
- New File System API
- New Text Management API
- New tool: [rexm] raylib examples manager
- **`NEW` Software Renderer - [`rlsw`](https://github.com/raysan5/raylib/blob/master/src/external/rlsw.h)**: The biggest addition of this new release. A new software renderer backend, that allows raylib to run purely on CPU, with no neeed for a GPU. It finally closes the circle of my search for a portable self-contained, with **no-external-dependencies**, graphics library, able to run on any device providing some CPU-power and some RAM memory. It has been possible thanks to the amazing work of **Le Juez Victor** ([@Bigfoot71](https://github.com/Bigfoot71)), who created [`rlsw`](https://github.com/raysan5/raylib/blob/master/src/external/rlsw.h), a single-file header-only library implementing OpenGL 1.1+ specification, tailored to fit into raylib [`rlgl`](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) OpenGL wrapper, and allowing to run raylib seamlessly over CPU with **no code changes required on user side**. As expected, software rendering is slower than hardware-accelerated rendering but it is still fast enough to run basic application at 30-60 fps. Actually, it already proved it usefulness on a new [raylib port for ESP32](https://components.espressif.com/components/georgik/raylib/versions/6.0.0/readme) microcontroller by Espressif, useful for industrial applications, and opens the door to the upcoming RISC-V powered devices that start arriving to the marked, and many times come with no GPU. Along the new software renderer, some of the existing platform backends have been adapted to support it (SDL, RGFW, DRM) and also **new platforms backends have been created** to accomodate it (Win32, Emscripten), incluing a new `PLATFORM_MEMORY`, that allows direct rendering to a memory framebuffer.
- **`NEW` Platform backend: Memory - [`rcore_memory`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_memory.c)**: This new platform has been added along the **software renderer** backend, allowing 2d and 3d rendering over a **platform-agnostic memory framebuffer**, it can run headless and output frames can be directly exported to images. This new backend could also be useful for graphics rendering on servers or process images directly using the memory buffer.
- **`NEW` Platform backend: Win32 - [`rcore_desktop_win32`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_desktop_win32.c)**: A new **Windows platform backend** and the first step towards a potential replacement/alternative to the platform libraries currently used by raylib (GLFW/SDL/RGFW). This backend follows same API template structure than the other raylib backends, but directly implementing Win32 API calls. It allows initializing OpenGL GPU-accelerated windows and also GDI based windows, useful for the software renderer backend. This new backend approach, following a common template-structure and separating the platform logic by specific OS/Windowing system, will simplify code, improve maintenance, readability and portability for raylib, setting some bases for the future. *NOTE: This backend is new and it could require further testing, use it as an experimental backend for now.*
- **`NEW` Platform backend: Emscripten - [`rcore_web_emscripten`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_web_emscripten.c)**: In the same line as Win32 backend, this new web backend moves away from `libglfw.js` and **directly implements Emscripten/JS functionality**, with **no other dependencies**, adding support for the new software renderer to draw directly on a **non-accelerated 2d canvas** but also supporting a WebGL-hardware-accelerated canvas when required. *NOTE: This backend is new and it could require further testing, use it as an experimental backend for now.*
- **`REDESIGNED` Fullscreen modes and High-DPI content scaling**: After many years and many related issues, the full-screen and high-dpi content scaling support has been **completely redesigned** from scratch. New design prioritizes **borderless fullscreen modes** and automatically detects current monitor content scaling configuration to scale window and framebuffer accordingly when required. Still, High-DPI support must be requested by user if desired enabling `FLAG_WINDOW_HIGHDPI` on window creation. This new system has been carefully tested on Windows, Linux (X11, Wayland), macOS with multiple monitors and multiple resolutions, including 4K monitors.
- **`REDESIGNED` Skeletal Animation System**: A new animation system for 3d models has been created to support animation blending, between single frames but also between differents frames on different animations, to allow easy **timed transitions** between animations. This redesign implied reviewing several raylib structures to better accomodate animation data: `Model`, `ModelSkeleton`, `ModelAnimation`, but the API was simplified and support for GPU-skinning was improved with multiple optimizations.
- **`REDESIGNED` Build Config System - [`config.h`](https://github.com/raysan5/raylib/blob/master/src/config.h)**: raylib allows lot of customization for specific needs (i.e. disabling modules not needed for specific applications like rmodels or raudio) but previous implementation did not allow easely disabling some features from **custom build systems**. New design not only allows disabling features with simple `-DSUPPORT_FILEFORMAT_OBJ=0` on building command-line but also the full system has been reviewed, removing useless flags and exposing new ones.
- **`NEW` File System API**: Along the years, multiple filesystem functions have been added to raylib API as required but it felt somewhat inconsistent with some pieces missing. In this new release, the full filesystem API has beeen reviewed and reorganized, compiling all the functionality single module: [rcore](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L1126), consequently `utils` module has been removed and build system has been simplified even more; **only 6-7 modules (.c) need to be compiled containing the full raylib library**. This new filesystem API will allow raylib to be used on the creation of custom build systems, as already demostrated with the new `rexm` tool for examples management. At the moment raylib includes **+40 file system management functions**, here a list with the new functions added:
```c
int FileRename(const char *fileName, const char *fileRename); // Rename file (if exists)
int FileRemove(const char *fileName); // Remove file (if exists)
int FileCopy(const char *srcPath, const char *dstPath); // Copy file from one path to another, dstPath created if it doesn't exist
int FileMove(const char *srcPath, const char *dstPath); // Move file from one directory to another, dstPath created if it doesn't exist
int FileTextReplace(const char *fileName, const char *search, const char *replacement); // Replace text in an existing file
int FileTextFindIndex(const char *fileName, const char *search); // Find text in existing file
```
- **`NEW` Text Management API**: Along with the new file system functionality, a new set of text management functions has been added, also very useful for text procesing and also used in custom build systems creation using raylib. At the moment raylib includes **+30 text management functions**, here a list with the new functions added:
```c
char **LoadTextLines(const char *text, int *count); // Load text as separate lines ('\n')
void UnloadTextLines(char **text, int lineCount); // Unload text lines
const char *TextRemoveSpaces(const char *text); // Remove text spaces, concat words
char *GetTextBetween(const char *text, const char *begin, const char *end); // Get text between two strings
char *TextReplace(const char *text, const char *search, const char *replacement); // Replace text string with new string
char *TextReplaceAlloc(const char *text, const char *search, const char *replacement); // Replace text string with new string, memory must be MemFree()
char *TextReplaceBetween(const char *text, const char *begin, const char *end, const char *replacement); // Replace text between two specific strings
char *TextReplaceBetweenAlloc(const char *text, const char *begin, const char *end, const char *replacement); // Replace text between two specific strings, memory must be MemFree()
char *TextInsertAlloc(const char *text, const char *insert, int position); // Insert text in a defined byte position, memory must be MemFree()
```
- **`NEW` tool: raylib examples manager - [rexm](https://github.com/raysan5/raylib/tree/master/tools/rexm)**: raylib examples collection is huge, with **more than 200 examples** it was quite difficult to manage: adding, removing, renaming examples was a very costly process involving many files to be modified (including build systems), also the examples did not follow a common header convention neither a structure conventions. For that reason, a new support tool has been created: **rexm**, a raylib examples manager that allows to easely add/remove/rename examples, automatically fix inconsistencies and even **building and automated testing** on multiple platforms.
```
USAGE:
> rexm <command> <example_name> [<example_rename>]
COMMANDS:
create <new_example_name> : Creates an empty example, from internal template
add <example_name> : Add existing example to collection
rename <old_examples_name> <new_example_name> : Rename an existing example
remove <example_name> : Remove an existing example from collection
build <example_name> : Build example for Desktop and Web platforms
test <example_name> : Build and Test example for Desktop and Web platforms
validate : Validate examples collection, generates report
update : Validate and update examples collection, generates report
```
- **`NEW` +70 new examples**: Thanks to `rexm` and the simplification on examples management, this new raylib release includes +70 new examples to learn from, most of them contributed by community. Multiple examples have also been renamed for consistency and all examples header and structure have been reviewed and unified.
Make sure to check raylib [CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG) for a detailed list of changes!
I want to **thank all the contributors (+850!**) that along the years have **greatly improved raylib** and pushed it further and better day after day. And **many thanks to raylib community and all raylib users** for supporting the library along those many years.
Finally, I want to thank [puffer.ai](https://puffer.ai/) and [comma.ai](https://comma.ai/) for **using raylib and supporting the project** as platinum sponsors, along many others individuals that have been sponsoring raylib along the years. Thanks to all of you for allowing me to keep working on this library!
**After +12 years of development, `raylib 6.0` is today one of the bests libraries to enjoy games/tools/graphics programming!**
**Enjoy graphics programming with raylib!** :)

View File

@ -14,7 +14,7 @@ Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
[![GitHub Releases Downloads](https://img.shields.io/github/downloads/raysan5/raylib/total)](https://github.com/raysan5/raylib/releases)
[![GitHub Stars](https://img.shields.io/github/stars/raysan5/raylib?style=flat&label=stars)](https://github.com/raysan5/raylib/stargazers)
[![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/5.5)](https://github.com/raysan5/raylib/commits/master)
[![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/6.0)](https://github.com/raysan5/raylib/commits/master)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/raysan5?label=sponsors)](https://github.com/sponsors/raysan5)
[![Packaging Status](https://repology.org/badge/tiny-repos/raylib.svg)](https://repology.org/project/raylib/versions)
[![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE)
@ -40,6 +40,7 @@ features
- Written in plain C code (C99) using PascalCase/camelCase notation
- Hardware accelerated with OpenGL: **1.1, 2.1, 3.3, 4.3, ES 2.0, ES 3.0**
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
- **Software Renderer** backend (no OpenGL required!): [rlsw](https://github.com/raysan5/raylib/blob/master/src/external/rlsw.h)
- Multiple **Fonts** formats supported (TTF, OTF, FNT, BDF, sprite fonts)
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
@ -61,7 +62,7 @@ This is a basic raylib example, it creates a window and draws the text `"Congrat
int main(void)
{
InitWindow(800, 450, "raylib [core] example - basic window");
InitWindow(800, 450, "raylib example - basic window");
while (!WindowShouldClose())
{

View File

@ -6,6 +6,7 @@ Here is a wishlist with features and ideas to improve the library. Note that fea
- [GitHub PRs](https://github.com/raysan5/raylib/pulls) open with improvements to be reviewed.
- [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve.
- raylib wishlists discussions are open to everyone to ask for improvements, feel free to check and comment:
- [raylib 7.0 wishlist](https://github.com/raysan5/raylib/discussions/5710)
- [raylib 6.0 wishlist](https://github.com/raysan5/raylib/discussions/4660)
- [raylib 5.0 wishlist](https://github.com/raysan5/raylib/discussions/2952)
- [raylib wishlist 2022](https://github.com/raysan5/raylib/discussions/2272)
@ -21,8 +22,9 @@ _Current version of raylib is complete and functional but there is always room f
- [ ] `rcore_desktop_wayland`: Create additional platform backend: Linux/Wayland
- [ ] `rcore`: Investigate alternative embedded platforms and realtime OSs
- [ ] `rlsw`: Software renderer optimizations: mipmaps, platform-specific SIMD
- [ ] `rtextures`: Consider moving N-patch system to separate example
- [ ] `rtextures`: Consider removing N-patch system, provide as separate example
- [ ] `rtextures`: Review blending modes system, provide more options or better samples
- [ ] `rtext`: Investigate the recently opened [`Slug`](https://sluglibrary.com/) font rendering algorithm
- [ ] `raudio`: Support microphone input, basic API to read microphone
- [ ] `rltexgpu`: Improve compressed textures support, loading and saving, improve KTX 2.0
- [ ] `rlobj`: Create OBJ loader, supporting material file separately (low priority)

View File

@ -11,8 +11,4 @@ Most considerations of errors and defects can be handled using the project Issue
## Reporting a Vulnerability
Discovered vulnerability can be directly reported using the project Issues and/or Discussions.
_TODO: Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc._
Discovered vulnerability can be directly reported using the project Issues and/or Discussions. They will be reviewed as soon as possible.

874
build.zig

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,19 @@
.{
.name = .raylib,
.version = "5.6.0-dev",
.minimum_zig_version = "0.15.1",
.version = "6.0.0",
.minimum_zig_version = "0.16.0",
.fingerprint = 0x13035e5cb8bc1ac2, // Changing this has security and trust implications.
.dependencies = .{
.xcode_frameworks = .{
.url = "git+https://github.com/hexops/xcode-frameworks#9a45f3ac977fd25dff77e58c6de1870b6808c4a7",
.hash = "N-V-__8AABHMqAWYuRdIlflwi8gksPnlUMQBiSxAqQAAZFms",
.url = "https://pkg.machengine.org/xcode-frameworks/8a1cfb373587ea4c9bb1468b7c986462d8d4e10e.tar.gz",
.hash = "N-V-__8AALShqgXkvqYU6f__FrA22SMWmi2TXCJjNTO1m8XJ",
.lazy = true,
},
.raygui = .{
.url = "git+https://github.com/raysan5/raygui#3b2855842ab578a034f827c38cf8f62c042fc983",
.hash = "N-V-__8AAHvybwBw1kyBGn0BW_s1RqIpycNjLf_XbE-fpLUF",
.lazy = true,
},
.emsdk = .{

View File

@ -7,6 +7,30 @@ if(POLICY CMP0072)
cmake_policy(SET CMP0072 NEW)
endif()
include(CheckCSourceCompiles)
include(CMakePushCheckState)
function(raylib_check_libatomic_required result)
set(_atomic_test_source "
int main(void)
{
volatile long long value = 0;
return (int)__atomic_fetch_add(&value, 1, __ATOMIC_SEQ_CST);
}")
check_c_source_compiles("${_atomic_test_source}" RAYLIB_ATOMICS_WITHOUT_LIBATOMIC)
if (RAYLIB_ATOMICS_WITHOUT_LIBATOMIC)
set(${result} FALSE PARENT_SCOPE)
else ()
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LIBRARIES atomic)
check_c_source_compiles("${_atomic_test_source}" RAYLIB_ATOMICS_WITH_LIBATOMIC)
cmake_pop_check_state()
set(${result} ${RAYLIB_ATOMICS_WITH_LIBATOMIC} PARENT_SCOPE)
endif ()
endfunction()
set(RAYLIB_DEPENDENCIES "include(CMakeFindDependencyMacro)")
if (${PLATFORM} STREQUAL "Desktop")
@ -67,6 +91,21 @@ if (${PLATFORM} STREQUAL "Desktop")
endif ()
endif ()
elseif (${PLATFORM} STREQUAL "Win32")
if ((NOT WIN32) AND (NOT CMAKE_C_COMPILER MATCHES "mingw|mingw32|mingw64"))
message(FATAL_ERROR "Win32 platform requires Windows or a cross compiler.")
endif ()
set(PLATFORM_CPP "PLATFORM_DESKTOP_WIN32")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
if (${OPENGL_VERSION} MATCHES "Software")
set(GRAPHICS "GRAPHICS_API_OPENGL_SOFTWARE")
endif ()
find_package(OpenGL QUIET)
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
elseif (${PLATFORM} STREQUAL "Web")
set(PLATFORM_CPP "PLATFORM_WEB")
if(NOT GRAPHICS)
@ -96,21 +135,30 @@ elseif (${PLATFORM} STREQUAL "Android")
elseif ("${PLATFORM}" STREQUAL "DRM")
set(PLATFORM_CPP "PLATFORM_DRM")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
add_definitions(-D_DEFAULT_SOURCE)
add_definitions(-DEGL_NO_X11)
add_definitions(-DPLATFORM_DRM)
find_library(GLESV2 GLESv2)
find_library(EGL EGL)
find_library(DRM drm)
find_library(GBM gbm)
if (NOT CMAKE_CROSSCOMPILING OR NOT CMAKE_SYSROOT)
include_directories(/usr/include/libdrm)
endif ()
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread dl)
if ("${OPENGL_VERSION}" STREQUAL "Software")
# software rendering does not require EGL/GBM.
set(GRAPHICS "GRAPHICS_API_OPENGL_SOFTWARE")
set(LIBS_PRIVATE ${DRM} atomic pthread dl)
else ()
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
add_definitions(-DEGL_NO_X11)
find_library(GLESV2 GLESv2)
find_library(EGL EGL)
find_library(GBM gbm)
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread dl)
endif ()
set(LIBS_PUBLIC m)
elseif ("${PLATFORM}" STREQUAL "SDL")
@ -147,6 +195,7 @@ elseif ("${PLATFORM}" STREQUAL "SDL")
add_compile_definitions(USING_SDL2_PACKAGE)
endif()
endif()
elseif ("${PLATFORM}" STREQUAL "RGFW")
set(PLATFORM_CPP "PLATFORM_DESKTOP_RGFW")
@ -172,6 +221,15 @@ elseif ("${PLATFORM}" STREQUAL "WebRGFW")
set(PLATFORM_CPP "PLATFORM_WEB_RGFW")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
elseif ("${PLATFORM}" STREQUAL "Memory")
set(PLATFORM_CPP "PLATFORM_MEMORY")
set(GRAPHICS "GRAPHICS_API_OPENGL_SOFTWARE")
set(OPENGL_VERSION "Software")
if(WIN32 OR CMAKE_C_COMPILER MATCHES "mingw|mingw32|mingw64")
set(LIBS_PRIVATE winmm)
endif()
endif ()
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
@ -203,6 +261,14 @@ endif ()
set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY})
if (SUPPORT_MODULE_RAUDIO AND UNIX AND NOT APPLE)
raylib_check_libatomic_required(RAYLIB_LIBATOMIC_REQUIRED)
if (RAYLIB_LIBATOMIC_REQUIRED)
message(STATUS "64-bit atomics require libatomic")
list(APPEND LIBS_PRIVATE atomic)
endif ()
endif ()
if (${PLATFORM} MATCHES "Desktop")
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
endif ()

View File

@ -10,7 +10,9 @@ string(REGEX MATCHALL ${MACRO_REGEX} MACRO_LIST ${CONFIG_HEADER_CONTENT})
set(CONFIG_HEADER_FLAGS ${MACRO_LIST})
list(FILTER CONFIG_HEADER_FLAGS INCLUDE REGEX "^.+SUPPORT_")
list(TRANSFORM CONFIG_HEADER_FLAGS REPLACE ${MACRO_REGEX} [[\2=OFF]] REGEX "^//")
list(TRANSFORM CONFIG_HEADER_FLAGS REPLACE ${MACRO_REGEX} [[\2=ON]])
list(TRANSFORM CONFIG_HEADER_FLAGS REPLACE ${MACRO_REGEX} [[\2=\3]] REGEX "^[^/]")
list(TRANSFORM CONFIG_HEADER_FLAGS REPLACE [[=0$]] [[=OFF]])
list(TRANSFORM CONFIG_HEADER_FLAGS REPLACE [[=1$]] [[=ON]])
set(CONFIG_HEADER_VALUES ${MACRO_LIST})
list(FILTER CONFIG_HEADER_VALUES EXCLUDE REGEX "(^.+SUPPORT_)|(^//)")

View File

@ -98,13 +98,15 @@ if (${PLATFORM} MATCHES "Android")
elseif (${PLATFORM} MATCHES "Web")
set(example_sources) # clear example_sources
list(APPEND example_sources others/web_basic_window.c)
list(APPEND example_sources core/core_input_gestures_testbed.c)
elseif ("${PLATFORM}" STREQUAL "DRM")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
elseif ("${PLATFORM}" MATCHES "Memory")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
elseif ("${OPENGL_VERSION}" STREQUAL "Software")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)

View File

@ -20,6 +20,8 @@
# - Linux (X11 desktop mode)
# - macOS/OSX (x64, arm64 (not tested))
# - Others (not tested)
# > PLATFORM_DESKTOP_WIN32 (native Win32):
# - Windows (Win32, Win64)
# > PLATFORM_WEB_RGFW:
# - HTML5 (WebAssembly)
# > PLATFORM_WEB:
@ -510,7 +512,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32)
# Libraries for Windows desktop compilation
LDFLAGS += -L..\src
LDLIBS = -lraylib -lgdi32 -lwinmm -lshcore
ifneq ($(GRAPHICS),GRAPHICS_API_OPENGL_11_SOFTWARE)
ifneq ($(GRAPHICS),GRAPHICS_API_OPENGL_SOFTWARE)
LDLIBS += -lopengl32
endif
endif
@ -794,6 +796,23 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
rm -f *.o
endif
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32)
ifeq ($(PLATFORM_OS),WINDOWS)
del *.o *.exe /s
endif
ifeq ($(PLATFORM_OS),BSD)
find . -type f -perm -ugo+x -delete
rm -fv *.o
endif
ifeq ($(PLATFORM_OS),LINUX)
find . -type f -executable -delete
rm -fv *.o
endif
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete
rm -f *.o
endif
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
find . -type f -executable -delete
rm -fv *.o

View File

@ -2,7 +2,7 @@
#
# raylib makefile for Android project (APK building)
#
# Copyright (c) 2017-2025 Ramon Santamaria (@raysan5)
# Copyright (c) 2017-2026 Ramon Santamaria (@raysan5)
#
# This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software.

View File

@ -1153,7 +1153,10 @@ text/text_font_filters: text/text_font_filters.c
--preload-file text/resources/KAISG.ttf@resources/KAISG.ttf
text/text_font_loading: text/text_font_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file text/resources/pixantiqua.fnt@resources/pixantiqua.fnt \
--preload-file text/resources/pixantiqua.png@resources/pixantiqua.png \
--preload-file text/resources/pixantiqua.ttf@resources/pixantiqua.ttf
text/text_font_sdf: text/text_font_sdf.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \

View File

@ -223,7 +223,7 @@ Examples using raylib models functionality, including models loading/generation
### category: shaders [35]
Examples using raylib shaders functionality, including shaders loading, parameters configuration and drawing using them (model shaders and postprocessing shaders). This functionality is directly provided by raylib [rlgl](../src/rlgl.c) module.
Examples using raylib shaders functionality, including shaders loading, parameters configuration and drawing using them (model shaders and postprocessing shaders). This functionality is directly provided by raylib [rlgl](../src/rlgl.h) module.
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|

View File

@ -0,0 +1,238 @@
/*******************************************************************************************
*
* raylib [audio] example - amp envelope
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 6.0, last time updated with raylib 6.0
*
* Example contributed by Arbinda Rizki Muhammad (@arbipink) and reviewed by Ramon Santamaria (@raysan5)
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2026 Arbinda Rizki Muhammad (@arbipink)
*
********************************************************************************************/
#include "raylib.h"
#define RAYGUI_IMPLEMENTATION
#include "raygui.h"
#include <math.h> // Required for: sinf()
#define BUFFER_SIZE 4096
#define SAMPLE_RATE 44100
// Wave state
typedef enum {
IDLE,
ATTACK,
DECAY,
SUSTAIN,
RELEASE
} ADSRState;
// Grouping all ADSR parameters and state into a struct
typedef struct {
float attackTime;
float decayTime;
float sustainLevel;
float releaseTime;
float currentValue;
ADSRState state;
} Envelope;
//------------------------------------------------------------------------------------
// Module Functions Declaration
//------------------------------------------------------------------------------------
static void FillAudioBuffer(int i, float *buffer, float envelopeValue, float *audioTime);
static void UpdateEnvelope(Envelope *env);
static void DrawADSRGraph(Envelope *env, Rectangle bounds);
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - amp envelope");
InitAudioDevice();
// Set the number of samples the stream will keep in memory at a time to BUFFER_SIZE
SetAudioStreamBufferSizeDefault(BUFFER_SIZE);
float buffer[BUFFER_SIZE] = { 0 };
// Init raw audio stream (sample rate: 44100, sample size: 32bit-float, channels: 1-mono)
AudioStream stream = LoadAudioStream(SAMPLE_RATE, 32, 1);
// Init Phase
float audioTime = 0.0f;
// Initialize the struct
Envelope env = {
.attackTime = 1.0f,
.decayTime = 1.0f,
.sustainLevel = 0.5f,
.releaseTime = 1.0f,
.currentValue = 0.0f,
.state = IDLE
};
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose())
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE)) env.state = ATTACK;
if (IsKeyReleased(KEY_SPACE) && (env.state != IDLE)) env.state = RELEASE;
if (IsAudioStreamProcessed(stream))
{
if ((env.state != IDLE) || (env.currentValue > 0.0f))
{
for (int i = 0; i < BUFFER_SIZE; i++)
{
UpdateEnvelope(&env);
FillAudioBuffer(i, buffer, env.currentValue, &audioTime);
}
}
else
{
// Clear buffer if silent to avoid looping noise
for (int i = 0; i < BUFFER_SIZE; i++) buffer[i] = 0;
audioTime = 0.0f;
}
UpdateAudioStream(stream, buffer, BUFFER_SIZE);
}
if (!IsAudioStreamPlaying(stream)) PlayAudioStream(stream);
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
GuiSliderBar((Rectangle){ 100, 60, 400, 30 }, "Attack (s)", TextFormat("%2.2fs", env.attackTime), &env.attackTime, 0.1f, 3.0f);
GuiSliderBar((Rectangle){ 100, 100, 400, 30 }, "Decay (s)", TextFormat("%2.2fs", env.decayTime), &env.decayTime, 0.1f, 3.0f);
GuiSliderBar((Rectangle){ 100, 140, 400, 30 }, "Sustain", TextFormat("%2.2f", env.sustainLevel), &env.sustainLevel, 0.0f, 1.0f);
GuiSliderBar((Rectangle){ 100, 180, 400, 30 }, "Release (s)", TextFormat("%2.2fs", env.releaseTime), &env.releaseTime, 0.1f, 3.0f);
DrawADSRGraph(&env, (Rectangle){ 100, 250, 400, 100 });
DrawCircleV((Vector2){ 520, 350 - (env.currentValue * 100) }, 5, MAROON);
DrawText(TextFormat("Current Gain: %2.2f", env.currentValue), 535, 345 - (env.currentValue * 100), 10, MAROON);
DrawText("Press SPACE to PLAY the sound!", 200, 400, 20, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadAudioStream(stream);
CloseAudioDevice();
CloseWindow();
//--------------------------------------------------------------------------------------
return 0;
}
//------------------------------------------------------------------------------------
// Module Functions Definition
//------------------------------------------------------------------------------------
static void FillAudioBuffer(int i, float *buffer, float envelopeValue, float *audioTime)
{
int frequency = 440;
buffer[i] = envelopeValue*sinf(2.0f*PI*frequency*(*audioTime));
*audioTime += (1.0f/SAMPLE_RATE);
}
static void UpdateEnvelope(Envelope *env)
{
// Calculate the time delta for ONE sample (1/44100)
float sampleTime = 1.0f/SAMPLE_RATE;
switch(env->state)
{
case ATTACK:
{
env->currentValue += (1.0f/env->attackTime)*sampleTime;
if (env->currentValue >= 1.0f)
{
env->currentValue = 1.0f;
env->state = DECAY;
}
} break;
case DECAY:
{
env->currentValue -= ((1.0f - env->sustainLevel)/env->decayTime)*sampleTime;
if (env->currentValue <= env->sustainLevel)
{
env->currentValue = env->sustainLevel;
env->state = SUSTAIN;
}
} break;
case SUSTAIN:
{
env->currentValue = env->sustainLevel;
} break;
case RELEASE:
{
env->currentValue -= (env->sustainLevel/env->releaseTime)*sampleTime;
if (env->currentValue <= 0.001f) // Use a small threshold to avoid infinite tail
{
env->currentValue = 0.0f;
env->state = IDLE;
}
} break;
default: break;
}
}
static void DrawADSRGraph(Envelope *env, Rectangle bounds)
{
DrawRectangleRec(bounds, Fade(LIGHTGRAY, 0.3f));
DrawRectangleLinesEx(bounds, 1, GRAY);
// Fixed visual width for sustain stage since it's an amplitude not a time value
float sustainWidth = 1.0f;
// Total time to visualize (sum of A, D, R + a padding for Sustain)
float totalTime = env->attackTime + env->decayTime + sustainWidth + env->releaseTime;
float scaleX = bounds.width/totalTime;
float scaleY = bounds.height;
Vector2 start = { bounds.x, bounds.y + bounds.height };
Vector2 peak = { start.x + (env->attackTime*scaleX), bounds.y };
Vector2 sustain = { peak.x + (env->decayTime*scaleX), bounds.y + (1.0f - env->sustainLevel)*scaleY };
Vector2 rel = { sustain.x + (sustainWidth*scaleX), sustain.y };
Vector2 end = { rel.x + (env->releaseTime*scaleX), bounds.y + bounds.height };
DrawLineV(start, peak, SKYBLUE);
DrawLineV(peak, sustain, BLUE);
DrawLineV(sustain, rel, DARKBLUE);
DrawLineV(rel, end, ORANGE);
DrawText("ADSR Visualizer", bounds.x, bounds.y - 20, 10, DARKGRAY);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -110,16 +110,16 @@ int main(void)
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText(TextFormat("sine frequency: %i", sineFrequency), screenWidth - 220, 10, 20, RED);
DrawText(TextFormat("pan: %.2f", pan), screenWidth - 220, 30, 20, RED);
DrawText("Up/down to change frequency", 10, 10, 20, DARKGRAY);
DrawText("Left/right to pan", 10, 30, 20, DARKGRAY);
int windowStart = (GetTime() - sineStartTime)*SAMPLE_RATE;
int windowSize = 0.1f*SAMPLE_RATE;
int wavelength = SAMPLE_RATE/sineFrequency;
// Draw a sine wave with the same frequency as the one being sent to the audio stream
for (int i = 0; i < screenWidth; i++)
{

6051
examples/audio/raygui.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -23,15 +23,15 @@ void main()
float localX = mod(fragCoord.x, cellWidth);
float barWidth = cellWidth - 1.0;
vec4 color = WHITE;
if (localX <= barWidth)
{
float sampleX = (binIndex + 0.5)/NUM_OF_BINS;
vec2 sampleCoord = vec2(sampleX, FFT_ROW);
float amplitude = texture2D(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use
if (fragTexCoord.y < amplitude) color = BLACK;
}
gl_FragColor = color;
}

View File

@ -21,15 +21,15 @@ void main()
float localX = mod(fragCoord.x, cellWidth);
float barWidth = cellWidth - 1.0;
vec4 color = WHITE;
if (localX <= barWidth)
{
float sampleX = (binIndex + 0.5)/NUM_OF_BINS;
vec2 sampleCoord = vec2(sampleX, FFT_ROW);
float amplitude = texture2D(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use
if (fragTexCoord.y < amplitude) color = BLACK;
}
gl_FragColor = color;
}

View File

@ -21,15 +21,15 @@ void main()
float localX = mod(fragCoord.x, cellWidth);
float barWidth = cellWidth - 1.0;
vec4 color = WHITE;
if (localX <= barWidth)
{
float sampleX = (binIndex + 0.5)/NUM_OF_BINS;
vec2 sampleCoord = vec2(sampleX, FFT_ROW);
float amplitude = texture(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use
if (fragTexCoord.y < amplitude) color = BLACK;
}
finalColor = color;
}

View File

@ -22,7 +22,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
* Copyright (c) 2013-2026 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@ -21,6 +21,7 @@
#include "raygui.h" // Required for GUI controls
#define MAX_FILEPATH_SIZE 1024
#define FILE_FILTER "DIRS*;.png;.c"
//------------------------------------------------------------------------------------
// Program main entry point
@ -41,7 +42,7 @@ int main(void)
// NOTE: LoadDirectoryFiles() loads files and directories by default,
// use LoadDirectoryFilesEx() for custom filters and recursive directories loading
//FilePathList files = LoadDirectoryFiles(directory);
FilePathList files = LoadDirectoryFilesEx(directory, ".png;.c", false);
FilePathList files = LoadDirectoryFilesEx(directory, FILE_FILTER, false);
int btnBackPressed = false;
@ -61,7 +62,22 @@ int main(void)
{
TextCopy(directory, GetPrevDirectoryPath(directory));
UnloadDirectoryFiles(files);
files = LoadDirectoryFiles(directory);
files = LoadDirectoryFilesEx(directory, FILE_FILTER, false);
listScrollIndex = 0;
listItemActive = -1;
listItemFocused = -1;
}
if ((listItemActive >= 0) && (listItemActive < (int)files.count) && DirectoryExists(files.paths[listItemActive]))
{
TextCopy(directory, files.paths[listItemActive]);
UnloadDirectoryFiles(files);
files = LoadDirectoryFilesEx(directory, FILE_FILTER, false);
listScrollIndex = 0;
listItemActive = -1;
listItemFocused = -1;
}
//----------------------------------------------------------------------------------

View File

@ -73,7 +73,7 @@ int main(void)
}
// Draw UI info
DrawText(TextFormat("CURRENT MONITOR: %i/%i (%ix%i)", currentMonitor + 1, GetMonitorCount(),
DrawText(TextFormat("CURRENT MONITOR: %i/%i (%ix%i)", currentMonitor + 1, GetMonitorCount(),
GetMonitorWidth(currentMonitor), GetMonitorHeight(currentMonitor)), 50, 50, 20, DARKGRAY);
DrawText(TextFormat("WINDOW POSITION: %ix%i", (int)windowPos.x, (int)windowPos.y), 50, 90, 20, DARKGRAY);
DrawText(TextFormat("SCREEN SIZE: %ix%i", GetScreenWidth(), GetScreenHeight()), 50, 130, 20, DARKGRAY);

View File

@ -4,7 +4,7 @@
*
* Example complexity rating: [★★☆☆] 2/4
*
* NOTE: raylib defined keys refer to ENG-US Keyboard layout,
* NOTE: raylib defined keys refer to ENG-US Keyboard layout,
* mapping to other layouts is up to the user
*
* Example originally created with raylib 5.6, last time updated with raylib 5.6
@ -43,20 +43,20 @@ int main(void)
int line01KeyWidths[15] = { 0 };
for (int i = 0; i < 15; i++) line01KeyWidths[i] = 45;
line01KeyWidths[13] = 62; // PRINTSCREEN
int line01Keys[15] = {
KEY_ESCAPE, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5,
KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11,
KEY_F12, KEY_PRINT_SCREEN, KEY_PAUSE
int line01Keys[15] = {
KEY_ESCAPE, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5,
KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11,
KEY_F12, KEY_PRINT_SCREEN, KEY_PAUSE
};
// Keyboard line 02
int line02KeyWidths[15] = { 0 };
for (int i = 0; i < 15; i++) line02KeyWidths[i] = 45;
line02KeyWidths[0] = 25; // GRAVE
line02KeyWidths[13] = 82; // BACKSPACE
int line02Keys[15] = {
KEY_GRAVE, KEY_ONE, KEY_TWO, KEY_THREE, KEY_FOUR,
KEY_FIVE, KEY_SIX, KEY_SEVEN, KEY_EIGHT, KEY_NINE,
int line02Keys[15] = {
KEY_GRAVE, KEY_ONE, KEY_TWO, KEY_THREE, KEY_FOUR,
KEY_FIVE, KEY_SIX, KEY_SEVEN, KEY_EIGHT, KEY_NINE,
KEY_ZERO, KEY_MINUS, KEY_EQUAL, KEY_BACKSPACE, KEY_DELETE };
// Keyboard line 03
@ -103,7 +103,7 @@ int main(void)
KEY_SPACE, KEY_RIGHT_ALT, 162, KEY_NULL,
KEY_RIGHT_CONTROL, KEY_LEFT, KEY_DOWN, KEY_RIGHT
};
Vector2 keyboardOffset = { 26, 80 };
SetTargetFPS(60);
@ -128,23 +128,23 @@ int main(void)
ClearBackground(RAYWHITE);
DrawText("KEYBOARD LAYOUT: ENG-US", 26, 38, 20, LIGHTGRAY);
// Keyboard line 01 - 15 keys
// ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, IMP, CLOSE
for (int i = 0, recOffsetX = 0; i < 15; i++)
for (int i = 0, recOffsetX = 0; i < 15; i++)
{
GuiKeyboardKey((Rectangle){ keyboardOffset.x + recOffsetX, keyboardOffset.y, (float)line01KeyWidths[i], 30.0f }, line01Keys[i]);
recOffsetX += line01KeyWidths[i] + KEY_REC_SPACING;
}
// Keyboard line 02 - 15 keys
// `, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =, BACKSPACE, DEL
for (int i = 0, recOffsetX = 0; i < 15; i++)
for (int i = 0, recOffsetX = 0; i < 15; i++)
{
GuiKeyboardKey((Rectangle){ keyboardOffset.x + recOffsetX, keyboardOffset.y + 30 + KEY_REC_SPACING, (float)line02KeyWidths[i], 38.0f }, line02Keys[i]);
recOffsetX += line02KeyWidths[i] + KEY_REC_SPACING;
}
// Keyboard line 03 - 15 keys
// TAB, Q, W, E, R, T, Y, U, I, O, P, [, ], \, INS
for (int i = 0, recOffsetX = 0; i < 15; i++)
@ -324,8 +324,8 @@ static void GuiKeyboardKey(Rectangle bounds, int key)
DrawText(GetKeyText(key), (int)(bounds.x + 4), (int)(bounds.y + 4), 10, DARKGRAY);
}
}
if (CheckCollisionPointRec(GetMousePosition(), bounds))
if (CheckCollisionPointRec(GetMousePosition(), bounds))
{
DrawRectangleRec(bounds, Fade(RED, 0.2f));
DrawRectangleLinesEx(bounds, 3.0f, RED);

View File

@ -111,7 +111,7 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
free(rectangles);
RL_FREE(rectangles);
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

View File

@ -52,7 +52,7 @@ int main(void)
// The target's height is flipped (in the source Rectangle), due to OpenGL reasons
Rectangle sourceRec = { 0.0f, 0.0f, (float)target.texture.width, -(float)target.texture.height };
Rectangle destRec = { -virtualRatio, -virtualRatio, screenWidth + (virtualRatio*2), screenHeight + (virtualRatio*2) };
Rectangle destRec = { (screenWidth - screenWidth/1.25f)/2.0f, (screenHeight - screenHeight/1.25f)/2.0f, screenWidth/1.25f, screenHeight/1.25f };
Vector2 origin = { 0.0f, 0.0f };
@ -61,6 +61,9 @@ int main(void)
float cameraX = 0.0f;
float cameraY = 0.0f;
bool smoothOn = true;
bool overscan = false;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
@ -86,6 +89,18 @@ int main(void)
worldSpaceCamera.target.y = truncf(screenSpaceCamera.target.y);
screenSpaceCamera.target.y -= worldSpaceCamera.target.y;
screenSpaceCamera.target.y *= virtualRatio;
if (IsKeyPressed(KEY_S)) smoothOn = !smoothOn;
if (IsKeyPressed(KEY_O)) overscan = !overscan;
if (overscan)
{
destRec = (Rectangle) { -virtualRatio, -virtualRatio, screenWidth + (virtualRatio*2), screenHeight + (virtualRatio*2) };
}
else
{
destRec = (Rectangle) { (screenWidth - screenWidth/1.25f)/2.0f, (screenHeight - screenHeight/1.25f)/2.0f, screenWidth/1.25f, screenHeight/1.25f };
}
//----------------------------------------------------------------------------------
// Draw
@ -101,14 +116,23 @@ int main(void)
EndTextureMode();
BeginDrawing();
ClearBackground(RED);
ClearBackground(LIGHTGRAY);
BeginMode2D(screenSpaceCamera);
if (smoothOn)
{
BeginMode2D(screenSpaceCamera);
DrawTexturePro(target.texture, sourceRec, destRec, origin, 0.0f, WHITE);
EndMode2D();
}
else
{
DrawTexturePro(target.texture, sourceRec, destRec, origin, 0.0f, WHITE);
EndMode2D();
}
DrawText(TextFormat("Screen resolution: %ix%i", screenWidth, screenHeight), 10, 10, 20, DARKBLUE);
DrawText(TextFormat("World resolution: %ix%i", virtualScreenWidth, virtualScreenHeight), 10, 40, 20, DARKGREEN);
DrawText(TextFormat("Smooth: %s", (smoothOn ? "ON" : "OFF")), 10, screenHeight - 60, 20, RED);
DrawText(TextFormat("Overscan: %s", (overscan ? "ON" : "OFF")), 10, screenHeight - 30, 20, RED);
DrawFPS(GetScreenWidth() - 95, 10);
EndDrawing();
//----------------------------------------------------------------------------------
@ -122,4 +146,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
GLFW_ICON ICON "raylib.ico"
1 VERSIONINFO
FILEVERSION 5,5,0,0
PRODUCTVERSION 5,5,0,0
FILEVERSION 6,0,0,0
PRODUCTVERSION 6,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
@ -11,12 +11,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "raylib technologies"
VALUE "FileDescription", "raylib application (www.raylib.com)"
VALUE "FileVersion", "5.5.0"
VALUE "FileVersion", "6.0.0"
VALUE "InternalName", "raylib-example"
VALUE "LegalCopyright", "(c) 2025 Ramon Santamaria (@raysan5)"
VALUE "LegalCopyright", "(c) 2026 Ramon Santamaria (@raysan5)"
VALUE "OriginalFilename", "raylib-example"
VALUE "ProductName", "raylib-example"
VALUE "ProductVersion", "5.5.0"
VALUE "ProductVersion", "6.0.0"
END
END
BLOCK "VarFileInfo"

View File

@ -43,7 +43,7 @@
// Module Functions Declaration
//------------------------------------------------------------------------------------
static bool IsUpperBodyBone(const char *boneName);
static void UpdateModelAnimationBones(Model *model, ModelAnimation *anim1, int frame1,
static void UpdateModelAnimationBones(Model *model, ModelAnimation *anim1, int frame1,
ModelAnimation *anim2, int frame2, float blend, bool upperBodyBlend);
//------------------------------------------------------------------------------------
@ -86,7 +86,7 @@ int main(void)
int animIndex1 = 3; // Attack animation (index 3)
int animCurrentFrame0 = 0;
int animCurrentFrame1 = 0;
// Validate indices
if (animIndex0 >= animCount) animIndex0 = 0;
if (animIndex1 >= animCount) animIndex1 = (animCount > 1) ? 1 : 0;
@ -109,7 +109,7 @@ int main(void)
// Update animation frames
ModelAnimation anim0 = anims[animIndex0];
ModelAnimation anim1 = anims[animIndex1];
animCurrentFrame0 = (animCurrentFrame0 + 1)%anim0.keyframeCount;
animCurrentFrame1 = (animCurrentFrame1 + 1)%anim1.keyframeCount;
@ -117,11 +117,11 @@ int main(void)
// When upperBodyBlend is ON: upper body = attack (1.0), lower body = walk (0.0)
// When upperBodyBlend is OFF: uniform blend at 0.5 (50% walk, 50% attack)
float blendFactor = (upperBodyBlend? 1.0f : 0.5f);
UpdateModelAnimationBones(&model, &anim0, animCurrentFrame0,
UpdateModelAnimationBones(&model, &anim0, animCurrentFrame0,
&anim1, animCurrentFrame1, blendFactor, upperBodyBlend);
// raylib provided animation blending function
//UpdateModelAnimationEx(model, anim0, (float)animCurrentFrame0,
//UpdateModelAnimationEx(model, anim0, (float)animCurrentFrame0,
// anim1, (float)animCurrentFrame1, blendFactor);
//----------------------------------------------------------------------------------
@ -142,8 +142,8 @@ int main(void)
// Draw UI
DrawText(TextFormat("ANIM 0: %s", anim0.name), 10, 10, 20, GRAY);
DrawText(TextFormat("ANIM 1: %s", anim1.name), 10, 40, 20, GRAY);
DrawText(TextFormat("[SPACE] Toggle blending mode: %s",
upperBodyBlend? "Upper/Lower Body Blending" : "Uniform Blending"),
DrawText(TextFormat("[SPACE] Toggle blending mode: %s",
upperBodyBlend? "Upper/Lower Body Blending" : "Uniform Blending"),
10, GetScreenHeight() - 30, 20, DARKGRAY);
EndDrawing();
@ -180,7 +180,7 @@ static bool IsUpperBodyBone(const char *boneName)
{
return true;
}
// Check if bone name contains upper body keywords
if (strstr(boneName, "spine") != NULL || strstr(boneName, "chest") != NULL ||
strstr(boneName, "neck") != NULL || strstr(boneName, "head") != NULL ||
@ -189,12 +189,12 @@ static bool IsUpperBodyBone(const char *boneName)
{
return true;
}
return false;
}
// Blend two animations per-bone with selective upper/lower body blending
static void UpdateModelAnimationBones(Model *model, ModelAnimation *anim0, int frame0,
static void UpdateModelAnimationBones(Model *model, ModelAnimation *anim0, int frame0,
ModelAnimation *anim1, int frame1, float blend, bool upperBodyBlend)
{
// Validate inputs
@ -204,59 +204,59 @@ static void UpdateModelAnimationBones(Model *model, ModelAnimation *anim0, int f
{
// Clamp blend factor to [0, 1]
blend = fminf(1.0f, fmaxf(0.0f, blend));
// Ensure frame indices are valid
if (frame0 >= anim0->keyframeCount) frame0 = anim0->keyframeCount - 1;
if (frame1 >= anim1->keyframeCount) frame1 = anim1->keyframeCount - 1;
if (frame0 < 0) frame0 = 0;
if (frame1 < 0) frame1 = 0;
// Get bone count (use minimum of all to be safe)
int boneCount = model->skeleton.boneCount;
if (anim0->boneCount < boneCount) boneCount = anim0->boneCount;
if (anim1->boneCount < boneCount) boneCount = anim1->boneCount;
// Blend each bone
for (int boneIndex = 0; boneIndex < boneCount; boneIndex++)
{
// Determine blend factor for this bone
float boneBlendFactor = blend;
// If upper body blending is enabled, use different blend factors for upper vs lower body
if (upperBodyBlend)
{
const char *boneName = model->skeleton.bones[boneIndex].name;
bool isUpperBody = IsUpperBodyBone(boneName);
// Upper body: use anim1 (attack), Lower body: use anim0 (walk)
// blend = 0.0 means full anim0 (walk), 1.0 means full anim1 (attack)
if (isUpperBody) boneBlendFactor = blend; // Upper body: blend towards anim1 (attack)
else boneBlendFactor = 1.0f - blend; // Lower body: blend towards anim0 (walk) - invert the blend
}
// Get transforms from both animations
Transform *bindTransform = &model->skeleton.bindPose[boneIndex];
Transform *animTransform0 = &anim0->keyframePoses[frame0][boneIndex];
Transform *animTransform1 = &anim1->keyframePoses[frame1][boneIndex];
// Blend the transforms
Transform blended = { 0 };
blended.translation = Vector3Lerp(animTransform0->translation, animTransform1->translation, boneBlendFactor);
blended.rotation = QuaternionSlerp(animTransform0->rotation, animTransform1->rotation, boneBlendFactor);
blended.scale = Vector3Lerp(animTransform0->scale, animTransform1->scale, boneBlendFactor);
// Convert bind pose to matrix
Matrix bindMatrix = MatrixMultiply(MatrixMultiply(
MatrixScale(bindTransform->scale.x, bindTransform->scale.y, bindTransform->scale.z),
QuaternionToMatrix(bindTransform->rotation)),
MatrixTranslate(bindTransform->translation.x, bindTransform->translation.y, bindTransform->translation.z));
// Convert blended transform to matrix
Matrix blendedMatrix = MatrixMultiply(MatrixMultiply(
MatrixScale(blended.scale.x, blended.scale.y, blended.scale.z),
QuaternionToMatrix(blended.rotation)),
MatrixTranslate(blended.translation.x, blended.translation.y, blended.translation.z));
// Calculate final bone matrix (similar to UpdateModelAnimationBones)
model->boneMatrices[boneIndex] = MatrixMultiply(MatrixInvert(bindMatrix), blendedMatrix);
}
@ -276,7 +276,7 @@ static void UpdateModelAnimationBones(Model *model, ModelAnimation *anim0, int f
bool bufferUpdateRequired = false; // Flag to check when anim vertex information is updated
// Skip if missing bone data or missing anim buffers initialization
if ((mesh.boneWeights == NULL) || (mesh.boneIndices == NULL) ||
if ((mesh.boneWeights == NULL) || (mesh.boneIndices == NULL) ||
(mesh.animVertices == NULL) || (mesh.animNormals == NULL)) continue;
for (int vCounter = 0; vCounter < vertexValuesCount; vCounter += 3)

View File

@ -3,7 +3,7 @@
* raylib [models] example - animation blending
*
* Example complexity rating: [★★★★] 4/4
*
*
* Example originally created with raylib 5.5, last time updated with raylib 6.0
*
* Example contributed by Kirandeep (@Kirandeep-Singh-Khehra) and reviewed by Ramon Santamaria (@raysan5)
@ -53,13 +53,19 @@ int main(void)
Model model = LoadModel("resources/models/gltf/robot.glb"); // Load character model
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model world position
#if SUPPORT_GPU_SKINNING
// WARNING: SUPPORT_GPU_SKINNING is required to be enabled at raylib compile time (disabled by default)
// It will skip loading CPU required buffers to store animation updated data, so, both modes are exclusive
// Load skinning shader
// WARNING: It requires SUPPORT_GPU_SKINNING enabled on raylib (disabled by default)
// NOTE: It must be a valid shader, following raylib attribs/uniform conventions for GPU skinning
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
// Assign skinning shader to all materials shaders
//for (int i = 0; i < model.materialCount; i++) model.materials[i].shader = skinningShader;
// Skinning shader could be required to be assigned to all materials shaders, just to make
// sure required uniforms are being updated for the mesh using that material (and shader)
for (int i = 0; i < model.materialCount; i++) model.materials[i].shader = skinningShader;
#endif
// Load model animations
int animCount = 0;
@ -105,7 +111,7 @@ int main(void)
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_ORBITAL);
if (IsKeyPressed(KEY_P)) animPause = !animPause;
if (!animPause)
@ -127,7 +133,7 @@ int main(void)
}
// Set animation transition
animTransition = true;
animTransition = true;
animBlendTimeCounter = 0.0f;
animBlendFactor = 0.0f;
}
@ -182,7 +188,7 @@ int main(void)
animCurrentFrame0 += animFrameSpeed0;
if (animCurrentFrame0 >= anims[animIndex0].keyframeCount) animCurrentFrame0 = 0.0f;
UpdateModelAnimation(model, anims[animIndex0], animCurrentFrame0);
//UpdateModelAnimationEx(model, anims[animIndex0], animCurrentFrame0,
//UpdateModelAnimationEx(model, anims[animIndex0], animCurrentFrame0,
// anims[animIndex1], animCurrentFrame1, 0.0f); // Same as above, first animation frame blend
}
else if (currentAnimPlaying == 1)
@ -191,7 +197,7 @@ int main(void)
animCurrentFrame1 += animFrameSpeed1;
if (animCurrentFrame1 >= anims[animIndex1].keyframeCount) animCurrentFrame1 = 0.0f;
UpdateModelAnimation(model, anims[animIndex1], animCurrentFrame1);
//UpdateModelAnimationEx(model, anims[animIndex0], animCurrentFrame0,
//UpdateModelAnimationEx(model, anims[animIndex0], animCurrentFrame0,
// anims[animIndex1], animCurrentFrame1, 1.0f); // Same as above, second animation frame blend
}
}
@ -213,7 +219,7 @@ int main(void)
DrawModel(model, position, 1.0f, WHITE); // Draw animated model
DrawGrid(10, 1.0f);
EndMode3D();
if (animTransition) DrawText("ANIM TRANSITION BLENDING!", 170, 50, 30, BLUE);
@ -221,18 +227,18 @@ int main(void)
// Draw UI elements
//---------------------------------------------------------------------------------------------
if (dropdownEditMode0) GuiDisable();
GuiSlider((Rectangle){ 10, 38, 160, 12 },
GuiSlider((Rectangle){ 10, 38, 160, 12 },
NULL, TextFormat("x%.1f", animFrameSpeed0), &animFrameSpeed0, 0.1f, 2.0f);
GuiEnable();
if (dropdownEditMode1) GuiDisable();
GuiSlider((Rectangle){ GetScreenWidth() - 170.0f, 38, 160, 12 },
GuiSlider((Rectangle){ GetScreenWidth() - 170.0f, 38, 160, 12 },
TextFormat("%.1fx", animFrameSpeed1), NULL, &animFrameSpeed1, 0.1f, 2.0f);
GuiEnable();
// Draw animation selectors for blending transition
// NOTE: Transition does not start until requested
// NOTE: Transition does not start until requested
GuiSetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING, 1);
if (GuiDropdownBox((Rectangle){ 10, 10, 160, 24 }, TextJoin(animNames, animCount, ";"),
if (GuiDropdownBox((Rectangle){ 10, 10, 160, 24 }, TextJoin(animNames, animCount, ";"),
&animIndex0, dropdownEditMode0)) dropdownEditMode0 = !dropdownEditMode0;
// Blending process progress bar
@ -244,12 +250,18 @@ int main(void)
if (GuiDropdownBox((Rectangle){ GetScreenWidth() - 170.0f, 10, 160, 24 }, TextJoin(animNames, animCount, ";"),
&animIndex1, dropdownEditMode1)) dropdownEditMode1 = !dropdownEditMode1;
GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetFont().baseSize*2);
GuiLabel((Rectangle){ 0, GetScreenHeight() - 100.0f, GetScreenWidth(), 40 }, "PRESS SPACE to START BLENDING");
GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetFont().baseSize);
GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
// Draw playing timeline with keyframes for anim0[]
GuiProgressBar((Rectangle){ 60, GetScreenHeight() - 60.0f, GetScreenWidth() - 180.0f, 20 }, "ANIM 0",
TextFormat("FRAME: %.2f / %i", animFrameProgress0, anims[animIndex0].keyframeCount),
&animFrameProgress0, 0.0f, (float)anims[animIndex0].keyframeCount);
for (int i = 0; i < anims[animIndex0].keyframeCount; i++)
DrawRectangle(60 + (int)(((float)(GetScreenWidth() - 180)/(float)anims[animIndex0].keyframeCount)*(float)i),
DrawRectangle(60 + (int)(((float)(GetScreenWidth() - 180)/(float)anims[animIndex0].keyframeCount)*(float)i),
GetScreenHeight() - 60, 1, 20, BLUE);
// Draw playing timeline with keyframes for anim1[]
@ -257,7 +269,7 @@ int main(void)
TextFormat("FRAME: %.2f / %i", animFrameProgress1, anims[animIndex1].keyframeCount),
&animFrameProgress1, 0.0f, (float)anims[animIndex1].keyframeCount);
for (int i = 0; i < anims[animIndex1].keyframeCount; i++)
DrawRectangle(60 + (int)(((float)(GetScreenWidth() - 180)/(float)anims[animIndex1].keyframeCount)*(float)i),
DrawRectangle(60 + (int)(((float)(GetScreenWidth() - 180)/(float)anims[animIndex1].keyframeCount)*(float)i),
GetScreenHeight() - 30, 1, 20, BLUE);
//---------------------------------------------------------------------------------------------
@ -269,8 +281,10 @@ int main(void)
//--------------------------------------------------------------------------------------
UnloadModelAnimations(anims, animCount); // Unload model animation
UnloadModel(model); // Unload model and meshes/material
#if SUPPORT_GPU_SKINNING
UnloadShader(skinningShader); // Unload GPU skinning shader
#endif
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

View File

@ -52,12 +52,19 @@ int main(void)
Model model = LoadModel("resources/models/gltf/greenman.glb"); // Load character model
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
#if SUPPORT_GPU_SKINNING
// WARNING: SUPPORT_GPU_SKINNING is required to be enabled at raylib compile time (disabled by default)
// It will skip loading CPU required buffers to store animation updated data, so, both modes are exclusive
// Load skinning shader
// WARNING: GPU skinning must be enabled in raylib with a compilation flag,
// if not enabled, CPU skinning will be used instead
// NOTE: It must be a valid shader, following raylib attribs/uniform conventions for GPU skinning
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
model.materials[1].shader = skinningShader;
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
// Skinning shader could be required to be assigned to all materials shaders, just to make
// sure required uniforms are being updated for the mesh using that material (and shader)
model.materials[1].shader = skinningShader; // Just assigning to materials[1] for this model
#endif
// Load gltf model animations
int animCount = 0;
@ -111,7 +118,9 @@ int main(void)
//--------------------------------------------------------------------------------------
UnloadModelAnimations(anims, animCount); // Unload model animation
UnloadModel(model); // Unload model and meshes/material
#if SUPPORT_GPU_SKINNING
UnloadShader(skinningShader); // Unload GPU skinning shader
#endif
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

View File

@ -94,26 +94,26 @@ int main(void)
BeginMode3D(camera);
DrawModel(model, position, 1.0f, WHITE);
DrawGrid(10, 1.0f);
EndMode3D();
// Draw UI, select anim and playing speed
GuiSetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING, 1);
if (GuiDropdownBox((Rectangle){ 10, 10, 140, 24 }, TextJoin(animNames, animCount, ";"),
if (GuiDropdownBox((Rectangle){ 10, 10, 140, 24 }, TextJoin(animNames, animCount, ";"),
&animIndex, dropdownEditMode)) dropdownEditMode = !dropdownEditMode;
GuiSlider((Rectangle){ 260, 10, 500, 24 }, "FRAME SPEED: ", TextFormat("x%.1f", animFrameSpeed),
&animFrameSpeed, 0.1f, 2.0f);
// Draw playing timeline with keyframes
GuiLabel((Rectangle){ 10, GetScreenHeight() - 64.0f, GetScreenWidth() - 20.0f, 24 },
GuiLabel((Rectangle){ 10, GetScreenHeight() - 64.0f, GetScreenWidth() - 20.0f, 24 },
TextFormat("CURRENT FRAME: %.2f / %i", animFrameProgress, anims[animIndex].keyframeCount));
GuiProgressBar((Rectangle){ 10, GetScreenHeight() - 40.0f, GetScreenWidth() - 20.0f, 24 }, NULL, NULL,
&animFrameProgress, 0.0f, (float)anims[animIndex].keyframeCount);
for (int i = 0; i < anims[animIndex].keyframeCount; i++)
DrawRectangle(10 + (int)(((float)(GetScreenWidth() - 20)/(float)anims[animIndex].keyframeCount)*(float)i),
DrawRectangle(10 + (int)(((float)(GetScreenWidth() - 20)/(float)anims[animIndex].keyframeCount)*(float)i),
GetScreenHeight() - 40, 1, 24, BLUE);
EndDrawing();

View File

@ -60,7 +60,7 @@ int main(void)
}
}
}
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
@ -77,7 +77,7 @@ int main(void)
{
// Cast a ray from the screen center (where crosshair would be)
Vector2 screenCenter = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
Ray ray = GetMouseRay(screenCenter, camera);
Ray ray = GetScreenToWorldRay(screenCenter, camera);
// Check ray collision with all voxels
float closestDistance = 99999.0f;
@ -109,7 +109,7 @@ int main(void)
}
}
}
// Remove the closest voxel if one was hit
if (voxelFound)
{
@ -145,9 +145,9 @@ int main(void)
}
}
}
EndMode3D();
// Draw reference point for raycasting to delete blocks
DrawCircle(GetScreenWidth()/2, GetScreenHeight()/2, 4, RED);
@ -161,7 +161,7 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadModel(cubeModel);
CloseWindow();
//--------------------------------------------------------------------------------------

View File

@ -108,7 +108,7 @@ int main(void)
decalMaterial.maps[MATERIAL_MAP_DIFFUSE].color = RAYWHITE;
bool showModel = true;
Model decalModels[MAX_DECALS] = { 0 };
static Model decalModels[MAX_DECALS] = { 0 };
int decalCount = 0;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second

View File

@ -16,6 +16,7 @@
********************************************************************************************/
#include "raylib.h"
#include "rlgl.h"
#include <stdlib.h> // Required for: rand()
#include <math.h> // Required for: cosf(), sinf()
@ -26,8 +27,9 @@
//------------------------------------------------------------------------------------
// Module Functions Declaration
//------------------------------------------------------------------------------------
// Generate mesh using points
static Mesh GenMeshPoints(int numPoints);
static Mesh GenMeshPoints(int numPoints); // Generate mesh using points
void DrawModelPoints(Model model, Vector3 position, float scale, Color tint); // Draw a model as points
void DrawModelPointsEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model as points with extended parameters
//------------------------------------------------------------------------------------
// Program main entry point
@ -184,3 +186,30 @@ static Mesh GenMeshPoints(int numPoints)
return mesh;
}
// Draw a model points
// WARNING: OpenGL ES 2.0 does not support point mode drawing
void DrawModelPoints(Model model, Vector3 position, float scale, Color tint)
{
rlEnablePointMode();
rlDisableBackfaceCulling();
DrawModel(model, position, scale, tint);
rlEnableBackfaceCulling();
rlDisablePointMode();
}
// Draw a model points
// WARNING: OpenGL ES 2.0 does not support point mode drawing
void DrawModelPointsEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint)
{
rlEnablePointMode();
rlDisableBackfaceCulling();
DrawModelEx(model, position, rotationAxis, rotationAngle, scale, tint);
rlEnableBackfaceCulling();
rlDisablePointMode();
}

View File

@ -92,7 +92,7 @@ int main(void)
}
else
{
// TODO: WARNING: On PLATFORM_WEB it requires a big amount of memory to process input image
// TODO: WARNING: On PLATFORM_WEB it requires a big amount of memory to process input image
// and generate the required cubemap image to be passed to rlLoadTextureCubemap()
Image image = LoadImage("resources/skybox.png");
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = LoadTextureCubemap(image, CUBEMAP_LAYOUT_AUTO_DETECT);

View File

@ -41,6 +41,9 @@ int main(void)
Model model = LoadModel("resources/models/obj/plane.obj"); // Load model
Texture2D texture = LoadTexture("resources/models/obj/plane_diffuse.png"); // Load model texture
SetTextureWrap(texture, TEXTURE_WRAP_REPEAT); // Force Repeat to avoid issue on Web version
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
float pitch = 0.0f;

View File

@ -13,9 +13,9 @@
| models/vox/chr_knight.vox | ❔ | ❔ | - |
| models/vox/chr_sword.vox | ❔ | ❔ | - |
| models/vox/monu9.vox | ❔ | ❔ | - |
| billboard.png | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| billboard.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| cubicmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| cubicmap_atlas.png | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| cubicmap_atlas.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| heightmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| dresden_square_1k.hdr | [HDRIHaven](https://hdrihaven.com/hdri/?h=dresden_square) | [CC0](https://hdrihaven.com/p/license.php) | - |
| dresden_square_2k.hdr | [HDRIHaven](https://hdrihaven.com/hdri/?h=dresden_square) | [CC0](https://hdrihaven.com/p/license.php) | - |

View File

@ -14,7 +14,7 @@ void main()
{
// Fetch color from texture sampler
vec4 texelColor = texture2D(texture0, fragTexCoord);
// Calculate final fragment color
gl_FragColor = texelColor*colDiffuse*fragColor;
}

View File

@ -23,7 +23,7 @@ void main()
int boneIndex1 = int(vertexBoneIndices.y);
int boneIndex2 = int(vertexBoneIndices.z);
int boneIndex3 = int(vertexBoneIndices.w);
// WARNING: OpenGL ES 2.0 does not support automatic matrix transposing, neither transpose() function
mat4 boneMatrixTransposed0 = mat4(
vec4(boneMatrices[boneIndex0][0].x, boneMatrices[boneIndex0][1].x, boneMatrices[boneIndex0][2].x, boneMatrices[boneIndex0][3].x),
@ -45,13 +45,13 @@ void main()
vec4(boneMatrices[boneIndex3][0].y, boneMatrices[boneIndex3][1].y, boneMatrices[boneIndex3][2].y, boneMatrices[boneIndex3][3].y),
vec4(boneMatrices[boneIndex3][0].z, boneMatrices[boneIndex3][1].z, boneMatrices[boneIndex3][2].z, boneMatrices[boneIndex3][3].z),
vec4(boneMatrices[boneIndex3][0].w, boneMatrices[boneIndex3][1].w, boneMatrices[boneIndex3][2].w, boneMatrices[boneIndex3][3].w));
vec4 skinnedPosition =
vertexBoneWeights.x*(boneMatrixTransposed0*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.y*(boneMatrixTransposed1*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.z*(boneMatrixTransposed2*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.y*(boneMatrixTransposed1*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.z*(boneMatrixTransposed2*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.w*(boneMatrixTransposed3*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;

View File

@ -12,7 +12,7 @@ void main()
{
// Fetch color from texture sampler
vec4 texelColor = texture2D(texture0, fragTexCoord);
// Calculate final fragment color
gl_FragColor = texelColor*colDiffuse*fragColor;
}

View File

@ -23,7 +23,7 @@ void main()
int boneIndex1 = int(vertexBoneIndices.y);
int boneIndex2 = int(vertexBoneIndices.z);
int boneIndex3 = int(vertexBoneIndices.w);
// WARNING: OpenGL ES 2.0 does not support automatic matrix transposing, neither transpose() function
mat4 boneMatrixTransposed0 = mat4(
vec4(boneMatrices[boneIndex0][0].x, boneMatrices[boneIndex0][1].x, boneMatrices[boneIndex0][2].x, boneMatrices[boneIndex0][3].x),
@ -45,13 +45,13 @@ void main()
vec4(boneMatrices[boneIndex3][0].y, boneMatrices[boneIndex3][1].y, boneMatrices[boneIndex3][2].y, boneMatrices[boneIndex3][3].y),
vec4(boneMatrices[boneIndex3][0].z, boneMatrices[boneIndex3][1].z, boneMatrices[boneIndex3][2].z, boneMatrices[boneIndex3][3].z),
vec4(boneMatrices[boneIndex3][0].w, boneMatrices[boneIndex3][1].w, boneMatrices[boneIndex3][2].w, boneMatrices[boneIndex3][3].w));
vec4 skinnedPosition =
vertexBoneWeights.x*(boneMatrixTransposed0*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.y*(boneMatrixTransposed1*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.z*(boneMatrixTransposed2*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.y*(boneMatrixTransposed1*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.z*(boneMatrixTransposed2*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.w*(boneMatrixTransposed3*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;

View File

@ -26,17 +26,17 @@ void main()
int boneIndex1 = int(vertexBoneIndices.y);
int boneIndex2 = int(vertexBoneIndices.z);
int boneIndex3 = int(vertexBoneIndices.w);
vec4 skinnedPosition =
vertexBoneWeights.x*(boneMatrices[boneIndex0]*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexPosition, 1.0)) +
vertexBoneWeights.w*(boneMatrices[boneIndex3]*vec4(vertexPosition, 1.0));
vec4 skinnedNormal =
vertexBoneWeights.x*(boneMatrices[boneIndex0]*vec4(vertexNormal, 0.0)) +
vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexNormal, 0.0)) +
vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexNormal, 0.0)) +
vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexNormal, 0.0)) +
vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexNormal, 0.0)) +
vertexBoneWeights.w*(boneMatrices[boneIndex3]*vec4(vertexNormal, 0.0));
skinnedNormal.w = 0.0;

View File

@ -28,7 +28,7 @@
#include "raylib.h"
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_DESKTOP_SDL)
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_DESKTOP_SDL) || defined(PLATFORM_DESKTOP_RGFW)
#if defined(GRAPHICS_API_OPENGL_ES2)
#include "glad_gles2.h" // Required for: OpenGL functionality
#define glGenVertexArrays glGenVertexArraysOES

View File

@ -58,12 +58,12 @@ void main()
float gray = GreyScale(cellColor);
float n = 4096.0;
// Character set from https://www.shadertoy.com/view/lssGDj
// Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/
if (gray > 0.2) n = 65600.0; // :
if (gray > 0.3) n = 18725316.0; // v
if (gray > 0.4) n = 15255086.0; // o
if (gray > 0.4) n = 15255086.0; // o
if (gray > 0.5) n = 13121101.0; // &
if (gray > 0.6) n = 15252014.0; // 8
if (gray > 0.7) n = 13195790.0; // @

View File

@ -12,5 +12,5 @@ void main()
fragTexCoord = vertexTexCoord;
// Calculate final vertex position
gl_Position = vec4(vertexPosition, 1.0);
gl_Position = vec4(vertexPosition, 1.0);
}

View File

@ -1,5 +1,5 @@
#version 100
#extension GL_EXT_frag_depth : enable
#extension GL_EXT_frag_depth : enable
precision mediump float;
@ -14,7 +14,7 @@ uniform vec4 colDiffuse;
void main()
{
vec4 texelColor = texture2D(texture0, fragTexCoord);
gl_FragColor = texelColor*colDiffuse*fragColor;
gl_FragDepthEXT = 1.0 - gl_FragCoord.z;
}

View File

@ -24,13 +24,13 @@ void main()
{
// Store the fragment position vector in the first gbuffer texture
//gPosition = fragPosition;
// Store the per-fragment normals into the gbuffer
//gNormal = normalize(fragNormal);
// Store the diffuse per-fragment color
gl_FragColor.rgb = texture2D(texture0, fragTexCoord).rgb;
// Store specular intensity in gAlbedoSpec's alpha component
gl_FragColor.a = texture2D(specularTexture, fragTexCoord).r;
}

View File

@ -48,7 +48,7 @@ void main()
{
// Calculate vertex attributes for fragment shader
vec4 worldPos = matModel*vec4(vertexPosition, 1.0);
fragPosition = worldPos.xyz;
fragPosition = worldPos.xyz;
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;

View File

@ -1,7 +1,7 @@
#version 100
#extension GL_EXT_frag_depth : enable // Extension required for writing depth
precision mediump float; // Precision required for OpenGL ES2 (WebGL)
varying vec2 fragTexCoord;

View File

@ -32,12 +32,12 @@ float sdHorseshoe(in vec3 p, in vec2 c, in float r, in float le, vec2 w)
{
p.x = abs(p.x);
float l = length(p.xy);
p.xy = mat2(-c.x, c.y,
p.xy = mat2(-c.x, c.y,
c.y, c.x)*p.xy;
p.xy = vec2((p.y>0.0 || p.x>0.0)?p.x:l*sign(-c.x),
(p.x>0.0)?p.y:l);
p.xy = vec2(p.x,abs(p.y-r))-vec2(le,0.0);
vec2 q = vec2(length(max(p.xy,0.0)) + min(0.0,max(p.x,p.y)),p.z);
vec2 d = abs(q) - w;
return min(max(d.x,d.y),0.0) + length(max(d,0.0));
@ -56,9 +56,9 @@ float sdSixWayCutHollowSphere(vec3 p, float r, float h, float t)
}
vec2 q = vec2(length(ap.yz), ap.x);
float w = sqrt(r*r-h*h);
return ((h*q.x<w*q.y) ? length(q-vec2(w,h)) : abs(length(q)-r)) - t;
}
@ -110,8 +110,8 @@ vec2 raycast(in vec3 ro, in vec3 rd)
if (t>tmax) break;
vec2 h = map(ro+rd*t);
if (abs(h.x) < (0.0001*t))
{
res = vec2(t,h.y);
{
res = vec2(t,h.y);
break;
}
t += h.x;
@ -146,9 +146,9 @@ float calcSoftshadow(in vec3 ro, in vec3 rd, in float mint, in float tmax)
vec3 calcNormal(in vec3 pos)
{
vec2 e = vec2(1.0,-1.0)*0.5773*0.0005;
return normalize(e.xyy*map(pos + e.xyy).x +
e.yyx*map(pos + e.yyx).x +
e.yxy*map(pos + e.yxy).x +
return normalize(e.xyy*map(pos + e.xyy).x +
e.yyx*map(pos + e.yyx).x +
e.yxy*map(pos + e.yxy).x +
e.xxx*map(pos + e.xxx).x);
}
@ -176,15 +176,15 @@ float checkersGradBox(in vec2 p)
// analytical integral (box filter)
vec2 i = 2.0*(abs(fract((p-0.5*w)*0.5)-0.5)-abs(fract((p+0.5*w)*0.5)-0.5))/w;
// xor pattern
return 0.5 - 0.5*i.x*i.y;
return 0.5 - 0.5*i.x*i.y;
}
// https://www.shadertoy.com/view/tdS3DG
vec4 render(in vec3 ro, in vec3 rd)
{
{
// background
vec3 col = vec3(0.7, 0.7, 0.9) - max(rd.y,0.0)*0.3;
// raycast scene
vec2 res = raycast(ro,rd);
float t = res.x;
@ -194,11 +194,11 @@ vec4 render(in vec3 ro, in vec3 rd)
vec3 pos = ro + t*rd;
vec3 nor = (m<1.5) ? vec3(0.0,1.0,0.0) : calcNormal(pos);
vec3 ref = reflect(rd, nor);
// material
// material
col = 0.2 + 0.2*sin(m*2.0 + vec3(0.0,1.0,2.0));
float ks = 1.0;
if (m<1.5)
{
float f = checkersGradBox(3.0*pos.xz);
@ -208,7 +208,7 @@ vec4 render(in vec3 ro, in vec3 rd)
// lighting
float occ = calcAO(pos, nor);
vec3 lin = vec3(0.0);
// sun
@ -249,7 +249,7 @@ vec4 render(in vec3 ro, in vec3 rd)
dif *= occ;
lin += col*0.25*dif*vec3(1.00,1.00,1.00);
}
col = lin;
col = mix(col, vec3(0.7,0.7,0.9), 1.0-exp(-0.0001*t*t*t));
@ -289,7 +289,7 @@ void main()
color = res.xyz;
depth = CalcDepth(rd,res.w);
}
gl_FragColor = vec4(color , 1.0);
gl_FragDepthEXT = depth;
}

View File

@ -48,7 +48,7 @@ void main()
float normR = float(iter - (iter/55)*55)/55.0;
float normG = float(iter - (iter/69)*69)/69.0;
float normB = float(iter - (iter/40)*40)/40.0;
gl_FragColor = vec4(sin(normR*PI), sin(normG*PI), sin(normB*PI), 1.0);
return;
}

View File

@ -52,7 +52,7 @@ void main()
float specCo = 0.0;
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewDir, reflect(-lightDir, normal))), specularExponent); // 16 refers to shine
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewDir, reflect(-lightDir, normal))), specularExponent);
specular += specCo;

View File

@ -21,7 +21,7 @@ void main()
// Convert the (normalized) texel color RED component (GB would work, too)
// to the palette index by scaling up from [0..1] to [0..255]
int index = int(texelColor.r*255.0);
ivec3 color = ivec3(0);
// NOTE: On GLSL 100 we are not allowed to index a uniform array by a variable value,
@ -34,7 +34,7 @@ void main()
else if (index == 5) color = palette[5];
else if (index == 6) color = palette[6];
else if (index == 7) color = palette[7];
//gl_FragColor = texture2D(palette, texelColor.xy); // Alternative to ivec3
// Calculate final fragment color. Note that the palette color components

View File

@ -83,11 +83,11 @@ vec3 ComputePBR()
{
vec3 albedo = texture2D(albedoMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z);
float metallic = clamp(metallicValue, 0.0, 1.0);
float roughness = clamp(roughnessValue, 0.0, 1.0);
float ao = clamp(aoValue, 0.0, 1.0);
if (useTexMRA == 1)
{
vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y));
@ -99,7 +99,7 @@ vec3 ComputePBR()
vec3 N = normalize(fragNormal);
if (useTexNormal == 1)
{
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb;
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
N = normalize(N*2.0 - 1.0);
N = normalize(N*TBN);
}
@ -132,18 +132,18 @@ vec3 ComputePBR()
vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance
vec3 spec = (D*G*F)/(4.0*nDotV*nDotL);
// Difuse and spec light can't be above 1.0
// kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent
vec3 kD = vec3(1.0) - F;
// Mult kD by the inverse of metallnes, only non-metals should have diffuse light
kD *= 1.0 - metallic;
lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*float(lights[i].enabled); // Angle of light has impact on result
}
vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5;
return (ambientFinal + lightAccum*ao + emissive);
}
@ -153,7 +153,7 @@ void main()
// HDR tonemapping
color = pow(color, color + vec3(1.0));
// Gamma correction
color = pow(color, vec3(1.0/2.2));

View File

@ -60,7 +60,7 @@ void main()
float bias = max(0.0008*(1.0 - dot(normal, l)), 0.00008);
int shadowCounter = 0;
const int numSamples = 9;
// PCF (percentage-closer filtering) algorithm:
// Instead of testing if just one point is closer to the current point,
// we test the surrounding points as well
@ -74,7 +74,7 @@ void main()
if (curDepth - bias > sampleDepth) shadowCounter++;
}
}
finalColor = mix(finalColor, vec4(0, 0, 0, 1), float(shadowCounter)/float(numSamples));
// Add ambient lighting whether in shadow or not

View File

@ -56,12 +56,12 @@ void main()
float gray = GreyScale(cellColor);
float n = 4096.0;
// Character set from https://www.shadertoy.com/view/lssGDj
// Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/
if (gray > 0.2) n = 65600.0; // :
if (gray > 0.3) n = 18725316.0; // v
if (gray > 0.4) n = 15255086.0; // o
if (gray > 0.4) n = 15255086.0; // o
if (gray > 0.5) n = 13121101.0; // &
if (gray > 0.6) n = 15252014.0; // 8
if (gray > 0.7) n = 13195790.0; // @

View File

@ -12,5 +12,5 @@ void main()
fragTexCoord = vertexTexCoord;
// Calculate final vertex position
gl_Position = vec4(vertexPosition, 1.0);
gl_Position = vec4(vertexPosition, 1.0);
}

View File

@ -1,6 +1,6 @@
#version 120
#extension GL_EXT_frag_depth : enable
#extension GL_EXT_frag_depth : enable
varying vec2 fragTexCoord;
varying vec4 fragColor;
@ -11,7 +11,7 @@ uniform vec4 colDiffuse;
void main()
{
vec4 texelColor = texture2D(texture0, fragTexCoord);
gl_FragColor = texelColor*colDiffuse*fragColor;
gl_FragDepthEXT = 1.0 - gl_FragCoord.z;
}

View File

@ -22,13 +22,13 @@ void main()
{
// Store the fragment position vector in the first gbuffer texture
//gPosition = fragPosition;
// Store the per-fragment normals into the gbuffer
//gNormal = normalize(fragNormal);
// Store the diffuse per-fragment color
gl_FragColor.rgb = texture2D(texture0, fragTexCoord).rgb;
// Store specular intensity in gAlbedoSpec's alpha component
gl_FragColor.a = texture2D(specularTexture, fragTexCoord).r;
}

View File

@ -48,7 +48,7 @@ void main()
{
// Calculate vertex attributes for fragment shader
vec4 worldPos = matModel*vec4(vertexPosition, 1.0);
fragPosition = worldPos.xyz;
fragPosition = worldPos.xyz;
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;

View File

@ -1,6 +1,6 @@
#version 120
#extension GL_EXT_frag_depth : enable // Extension required for writing depth
#extension GL_EXT_frag_depth : enable // Extension required for writing depth
varying vec2 fragTexCoord;
varying vec4 fragColor;

View File

@ -30,12 +30,12 @@ float sdHorseshoe(in vec3 p, in vec2 c, in float r, in float le, vec2 w)
{
p.x = abs(p.x);
float l = length(p.xy);
p.xy = mat2(-c.x, c.y,
p.xy = mat2(-c.x, c.y,
c.y, c.x)*p.xy;
p.xy = vec2((p.y>0.0 || p.x>0.0)?p.x:l*sign(-c.x),
(p.x>0.0)?p.y:l);
p.xy = vec2(p.x,abs(p.y-r))-vec2(le,0.0);
vec2 q = vec2(length(max(p.xy,0.0)) + min(0.0,max(p.x,p.y)),p.z);
vec2 d = abs(q) - w;
return min(max(d.x,d.y),0.0) + length(max(d,0.0));
@ -54,9 +54,9 @@ float sdSixWayCutHollowSphere(vec3 p, float r, float h, float t)
}
vec2 q = vec2(length(ap.yz), ap.x);
float w = sqrt(r*r-h*h);
return ((h*q.x<w*q.y) ? length(q-vec2(w,h)) : abs(length(q)-r)) - t;
}
@ -108,8 +108,8 @@ vec2 raycast(in vec3 ro, in vec3 rd)
if (t>tmax) break;
vec2 h = map(ro+rd*t);
if (abs(h.x) < (0.0001*t))
{
res = vec2(t,h.y);
{
res = vec2(t,h.y);
break;
}
t += h.x;
@ -144,9 +144,9 @@ float calcSoftshadow(in vec3 ro, in vec3 rd, in float mint, in float tmax)
vec3 calcNormal(in vec3 pos)
{
vec2 e = vec2(1.0, -1.0)*0.5773*0.0005;
return normalize(e.xyy*map(pos + e.xyy).x +
e.yyx*map(pos + e.yyx).x +
e.yxy*map(pos + e.yxy).x +
return normalize(e.xyy*map(pos + e.xyy).x +
e.yyx*map(pos + e.yyx).x +
e.yxy*map(pos + e.yxy).x +
e.xxx*map(pos + e.xxx).x);
}
@ -174,15 +174,15 @@ float checkersGradBox(in vec2 p)
// analytical integral (box filter)
vec2 i = 2.0*(abs(fract((p-0.5*w)*0.5)-0.5)-abs(fract((p+0.5*w)*0.5)-0.5))/w;
// xor pattern
return 0.5 - 0.5*i.x*i.y;
return 0.5 - 0.5*i.x*i.y;
}
// https://www.shadertoy.com/view/tdS3DG
vec4 render(in vec3 ro, in vec3 rd)
{
{
// background
vec3 col = vec3(0.7, 0.7, 0.9) - max(rd.y,0.0)*0.3;
// raycast scene
vec2 res = raycast(ro,rd);
float t = res.x;
@ -192,11 +192,11 @@ vec4 render(in vec3 ro, in vec3 rd)
vec3 pos = ro + t*rd;
vec3 nor = (m<1.5) ? vec3(0.0,1.0,0.0) : calcNormal(pos);
vec3 ref = reflect(rd, nor);
// material
// material
col = 0.2 + 0.2*sin(m*2.0 + vec3(0.0,1.0,2.0));
float ks = 1.0;
if (m<1.5)
{
float f = checkersGradBox(3.0*pos.xz);
@ -206,7 +206,7 @@ vec4 render(in vec3 ro, in vec3 rd)
// lighting
float occ = calcAO(pos, nor);
vec3 lin = vec3(0.0);
// sun
@ -247,7 +247,7 @@ vec4 render(in vec3 ro, in vec3 rd)
dif *= occ;
lin += col*0.25*dif*vec3(1.00,1.00,1.00);
}
col = lin;
col = mix(col, vec3(0.7,0.7,0.9), 1.0-exp(-0.0001*t*t*t));

View File

@ -50,7 +50,7 @@ void main()
float specCo = 0.0;
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewDir, reflect(-lightDir, normal))), specularExponent); // 16 refers to shine
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewDir, reflect(-lightDir, normal))), specularExponent);
specular += specCo;

View File

@ -81,11 +81,11 @@ vec3 ComputePBR()
{
vec3 albedo = texture2D(albedoMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z);
float metallic = clamp(metallicValue, 0.0, 1.0);
float roughness = clamp(roughnessValue, 0.0, 1.0);
float ao = clamp(aoValue, 0.0, 1.0);
if (useTexMRA == 1)
{
vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y));
@ -97,7 +97,7 @@ vec3 ComputePBR()
vec3 N = normalize(fragNormal);
if (useTexNormal == 1)
{
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb;
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
N = normalize(N*2.0 - 1.0);
N = normalize(N*TBN);
}
@ -130,18 +130,18 @@ vec3 ComputePBR()
vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance
vec3 spec = (D*G*F)/(4.0*nDotV*nDotL);
// Difuse and spec light can't be above 1.0
// kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent
vec3 kD = vec3(1.0) - F;
// Mult kD by the inverse of metallnes, only non-metals should have diffuse light
kD *= 1.0 - metallic;
lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*float(lights[i].enabled); // Angle of light has impact on result
}
vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5;
return (ambientFinal + lightAccum*ao + emissive);
}
@ -151,7 +151,7 @@ void main()
// HDR tonemapping
color = pow(color, color + vec3(1.0));
// Gamma correction
color = pow(color, vec3(1.0/2.2));

View File

@ -58,7 +58,7 @@ void main()
float bias = max(0.0008*(1.0 - dot(normal, l)), 0.00008);
int shadowCounter = 0;
const int numSamples = 9;
// PCF (percentage-closer filtering) algorithm:
// Instead of testing if just one point is closer to the current point,
// we test the surrounding points as well
@ -72,7 +72,7 @@ void main()
if (curDepth - bias > sampleDepth) shadowCounter++;
}
}
finalColor = mix(finalColor, vec4(0, 0, 0, 1), float(shadowCounter)/float(numSamples));
// Add ambient lighting whether in shadow or not

View File

@ -52,12 +52,12 @@ void main()
float gray = GreyScale(cellColor);
int n = 4096;
// Character set from https://www.shadertoy.com/view/lssGDj
// Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/
if (gray > 0.2) n = 65600; // :
if (gray > 0.3) n = 18725316; // v
if (gray > 0.4) n = 15255086; // o
if (gray > 0.4) n = 15255086; // o
if (gray > 0.5) n = 13121101; // &
if (gray > 0.6) n = 15252014; // 8
if (gray > 0.7) n = 13195790; // @

View File

@ -20,7 +20,7 @@ void main()
// NOTE: Implement here your fragment shader code
// final color is the color from the texture
// final color is the color from the texture
// times the tint color (colDiffuse)
// times the fragment color (interpolated vertex color)
finalColor = texelColor*colDiffuse*fragColor;

View File

@ -14,7 +14,7 @@ out vec4 finalColor;
void main()
{
vec4 texelColor = texture(texture0, fragTexCoord);
finalColor = texelColor*colDiffuse*fragColor;
gl_FragDepth = 1.0 - finalColor.z;
}

View File

@ -14,7 +14,7 @@ uniform mat4 matProjection;
void main()
{
vec4 worldPos = matModel*vec4(vertexPosition, 1.0);
fragPosition = worldPos.xyz;
fragPosition = worldPos.xyz;
fragTexCoord = vertexTexCoord;
mat3 normalMatrix = transpose(inverse(mat3(matModel)));

View File

@ -16,7 +16,7 @@ out vec4 finalColor;
void main()
{
vec4 texelColor = texture(texture0, fragTexCoord);
finalColor = texelColor*colDiffuse*fragColor;
gl_FragDepth = finalColor.z;
}

View File

@ -33,7 +33,7 @@ float sdHorseshoe(in vec3 p, in vec2 c, in float r, in float le, vec2 w)
p.xy = mat2(-c.x, c.y, c.y, c.x)*p.xy;
p.xy = vec2(((p.y > 0.0) || (p.x > 0.0))? p.x : l*sign(-c.x), (p.x>0.0)? p.y : l);
p.xy = vec2(p.x, abs(p.y - r)) - vec2(le, 0.0);
vec2 q = vec2(length(max(p.xy, 0.0)) + min(0.0, max(p.x, p.y)), p.z);
vec2 d = abs(q) - w;
return min(max(d.x, d.y), 0.0) + length(max(d, 0.0));
@ -54,7 +54,7 @@ float sdSixWayCutHollowSphere(vec3 p, float r, float h, float t)
vec2 q = vec2(length(ap.yz), ap.x);
float w = sqrt(r*r-h*h);
return ((h*q.x < w*q.y)? length(q - vec2(w, h)) : abs(length(q) - r)) - t;
}
@ -79,7 +79,7 @@ vec2 map(in vec3 pos)
{
vec2 res = vec2(sdHorseshoe(pos - vec3(-1.0, 0.08, 1.0), vec2(cos(1.3), sin(1.3)), 0.2, 0.3, vec2(0.03,0.5)), 11.5);
res = opU(res, vec2(sdSixWayCutHollowSphere(pos-vec3(0.0, 1.0, 0.0), 4.0, 3.5, 0.5), 4.5));
return res;
}
@ -105,8 +105,8 @@ vec2 raycast(in vec3 ro, in vec3 rd)
if (t > tmax) break;
vec2 h = map(ro + rd*t);
if (abs(h.x )< (0.0001*t))
{
res = vec2(t, h.y);
{
res = vec2(t, h.y);
break;
}
t += h.x;
@ -131,9 +131,9 @@ float calcSoftshadow(in vec3 ro, in vec3 rd, in float mint, in float tmax)
t += clamp(h, 0.01, 0.2);
if ((res < 0.004) || (t > tmax)) break;
}
res = clamp(res, 0.0, 1.0);
return res*res*(3.0-2.0*res);
}
@ -141,9 +141,9 @@ float calcSoftshadow(in vec3 ro, in vec3 rd, in float mint, in float tmax)
vec3 calcNormal(in vec3 pos)
{
vec2 e = vec2(1.0, -1.0)*0.5773*0.0005;
return normalize(e.xyy*map(pos + e.xyy).x +
e.yyx*map(pos + e.yyx).x +
e.yxy*map(pos + e.yxy).x +
return normalize(e.xyy*map(pos + e.xyy).x +
e.yyx*map(pos + e.yyx).x +
e.yxy*map(pos + e.yxy).x +
e.xxx*map(pos + e.xxx).x);
}
@ -160,7 +160,7 @@ float calcAO(in vec3 pos, in vec3 nor)
sca *= 0.95;
if (occ>0.35) break;
}
return clamp(1.0 - 3.0*occ, 0.0, 1.0)*(0.5+0.5*nor.y);
}
@ -172,15 +172,15 @@ float checkersGradBox(in vec2 p)
// analytical integral (box filter)
vec2 i = 2.0*(abs(fract((p - 0.5*w)*0.5)-0.5) - abs(fract((p + 0.5*w)*0.5) - 0.5))/w;
// xor pattern
return (0.5 - 0.5*i.x*i.y);
return (0.5 - 0.5*i.x*i.y);
}
// https://www.shadertoy.com/view/tdS3DG
vec4 render(in vec3 ro, in vec3 rd)
{
{
// background
vec3 col = vec3(0.7, 0.7, 0.9) - max(rd.y,0.0)*0.3;
// raycast scene
vec2 res = raycast(ro,rd);
float t = res.x;
@ -190,11 +190,11 @@ vec4 render(in vec3 ro, in vec3 rd)
vec3 pos = ro + t*rd;
vec3 nor = (m<1.5) ? vec3(0.0,1.0,0.0) : calcNormal(pos);
vec3 ref = reflect(rd, nor);
// material
// material
col = 0.2 + 0.2*sin(m*2.0 + vec3(0.0,1.0,2.0));
float ks = 1.0;
if (m < 1.5)
{
float f = checkersGradBox(3.0*pos.xz);
@ -204,7 +204,7 @@ vec4 render(in vec3 ro, in vec3 rd)
// lighting
float occ = calcAO(pos, nor);
vec3 lin = vec3(0.0);
// sun
@ -245,7 +245,7 @@ vec4 render(in vec3 ro, in vec3 rd)
dif *= occ;
lin += col*0.25*dif*vec3(1.00,1.00,1.00);
}
col = lin;
col = mix(col, vec3(0.7,0.7,0.9), 1.0-exp(-0.0001*t*t*t));
@ -285,7 +285,7 @@ void main()
color = res.xyz;
depth = CalcDepth(rd,res.w);
}
finalColor = vec4(color , 1.0);
gl_FragDepth = depth;
}

View File

@ -54,7 +54,7 @@ void main()
float specCo = 0.0;
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewDir, reflect(-lightDir, normal))), specularExponent); // 16 refers to shine
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewDir, reflect(-lightDir, normal))), specularExponent);
specular += specCo;

View File

@ -24,7 +24,7 @@ void main()
// to the palette index by scaling up from [0..1] to [0..255]
int index = int(texelColor.r*255.0);
ivec3 color = palette[index];
//finalColor = texture(palette, texelColor.xy); // Alternative to ivec3
// Calculate final fragment color. Note that the palette color components

View File

@ -84,11 +84,11 @@ vec3 ComputePBR()
{
vec3 albedo = texture(albedoMap,vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z);
float metallic = clamp(metallicValue, 0.0, 1.0);
float roughness = clamp(roughnessValue, 0.0, 1.0);
float ao = clamp(aoValue, 0.0, 1.0);
if (useTexMRA == 1)
{
vec4 mra = texture(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y));
@ -100,7 +100,7 @@ vec3 ComputePBR()
vec3 N = normalize(fragNormal);
if (useTexNormal == 1)
{
N = texture(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb;
N = texture(normalMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
N = normalize(N*2.0 - 1.0);
N = normalize(N*TBN);
}
@ -133,18 +133,18 @@ vec3 ComputePBR()
vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance
vec3 spec = (D*G*F)/(4.0*nDotV*nDotL);
// Difuse and spec light can't be above 1.0
// kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent
vec3 kD = vec3(1.0) - F;
// Mult kD by the inverse of metallnes, only non-metals should have diffuse light
kD *= 1.0 - metallic;
lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*lights[i].enabled; // Angle of light has impact on result
}
vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5;
return (ambientFinal + lightAccum*ao + emissive);
}
@ -154,7 +154,7 @@ void main()
// HDR tonemapping
color = pow(color, color + vec3(1.0));
// Gamma correction
color = pow(color, vec3(1.0/2.2));

View File

@ -11,7 +11,7 @@ uniform mat4 mvp;
uniform mat4 matModel;
uniform mat4 matNormal;
uniform float time;
uniform float time;
uniform sampler2D perlinNoiseMap;

View File

@ -52,7 +52,7 @@ int main(void)
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 45.0f;
camera.projection = CAMERA_PERSPECTIVE;
// Load model
Model model = LoadModel("resources/models/old_car_new.glb");
@ -61,7 +61,7 @@ int main(void)
TextFormat("resources/shaders/glsl%i/cel.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/cel.fs", GLSL_VERSION));
celShader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(celShader, "viewPos");
// Apply cel shader to model, keep copy of default shader
Shader defaultShader = model.materials[0].shader;
model.materials[0].shader = celShader;
@ -134,16 +134,16 @@ int main(void)
// Outline pass: cull front faces, draw extruded back faces as silhouette
float thickness = 0.005f;
SetShaderValue(outlineShader, outlineThicknessLoc, &thickness, SHADER_UNIFORM_FLOAT);
rlSetCullFace(RL_CULL_FACE_FRONT);
model.materials[0].shader = outlineShader;
DrawModel(model, Vector3Zero(), 0.75f, WHITE);
if (celEnabled) model.materials[0].shader = celShader; // Apply cel shader to model
else model.materials[0].shader = defaultShader; // Apply default shader to model
rlSetCullFace(RL_CULL_FACE_BACK);
}
@ -167,7 +167,7 @@ int main(void)
UnloadModel(model);
UnloadShader(celShader);
UnloadShader(outlineShader);
CloseWindow();
//--------------------------------------------------------------------------------------

View File

@ -210,7 +210,7 @@ int main(void)
rlClearColor(0, 0, 0, 0);
rlClearScreenBuffers(); // Clear color and depth buffer
rlDisableColorBlend();
BeginMode3D(camera);
// NOTE: We have to use rlEnableShader here. `BeginShaderMode` or thus `rlSetShader`
// will not work, as they won't immediately load the shader program
@ -226,7 +226,7 @@ int main(void)
}
rlDisableShader();
EndMode3D();
rlEnableColorBlend();
// Go back to the default framebufferId (0) and draw our deferred shading

View File

@ -59,7 +59,7 @@ int main(void)
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - game of life");
const int menuWidth = 100;
@ -81,7 +81,7 @@ int main(void)
{ "Puffer train", { 0.1f, 0.5f } }, { "Glider Gun", { 0.2f, 0.2f } }, { "Breeder", { 0.1f, 0.5f } },
{ "Random", { 0.5f, 0.5f } }
};
const int numberOfPresets = sizeof(presetPatterns)/sizeof(presetPatterns[0]);
int zoom = 1;
@ -90,7 +90,7 @@ int main(void)
int framesPerStep = 1;
int frame = 0;
int preset = -1; // No button pressed for preset
int preset = -1; // No button pressed for preset
int mode = MODE_RUN; // Starting mode: running
bool buttonZoomIn = false; // Button states: false not pressed
bool buttonZomOut = false;
@ -185,7 +185,7 @@ int main(void)
EndTextureMode();
imageToDraw = (Image*)RL_MALLOC(sizeof(Image));
*imageToDraw = LoadImageFromTexture(worldOnScreen.texture);
UnloadRenderTexture(worldOnScreen);
}
@ -199,9 +199,9 @@ int main(void)
if (mouseY >= sizeInWorldY) mouseY = sizeInWorldY - 1;
if (firstColor == -1) firstColor = (GetImageColor(*imageToDraw, mouseX, mouseY).r < 5)? 0 : 1;
const int prevColor = (GetImageColor(*imageToDraw, mouseX, mouseY).r < 5)? 0 : 1;
ImageDrawPixel(imageToDraw, mouseX, mouseY, (firstColor) ? BLACK : RAYWHITE);
if (prevColor != firstColor) UpdateTextureRec(currentWorld->texture, (Rectangle){ floorf(offsetX), floorf(offsetY), (float)(sizeInWorldX), (float)(sizeInWorldY) }, imageToDraw->data);
}
else firstColor = -1;
@ -228,7 +228,7 @@ int main(void)
BeginTextureMode(*currentWorld);
ClearBackground(RAYWHITE);
EndTextureMode();
UpdateTextureRec(currentWorld->texture, (Rectangle){ worldWidth*presetPatterns[preset].position.x - pattern.width/2.0f,
worldHeight*presetPatterns[preset].position.y - pattern.height/2.0f,
(float)(pattern.width), (float)(pattern.height) }, pattern.data);
@ -256,7 +256,7 @@ int main(void)
}
UnloadImage(pattern);
mode = MODE_PAUSE;
offsetX = worldWidth*presetPatterns[preset].position.x - (float)windowWidth/zoom/2.0f;
offsetY = worldHeight*presetPatterns[preset].position.y - (float)windowHeight/zoom/2.0f;
@ -293,7 +293,7 @@ int main(void)
// Draw to screen
//----------------------------------------------------------------------------------
BeginDrawing();
DrawTexturePro(currentWorld->texture, textureSourceToScreen, textureOnScreen, (Vector2){ 0, 0 }, 0.0f, WHITE);
DrawLine(windowWidth, 0, windowWidth, screenHeight, (Color){ 218, 218, 218, 255 });

View File

@ -69,7 +69,7 @@ int main(void)
DrawText("USING DEFAULT SHADER", 20, 40, 10, RED);
DrawCircle(80, 120, 35, DARKBLUE);
DrawCircleGradient(80, 220, 60, GREEN, SKYBLUE);
DrawCircleGradient((Vector2){ 80.0f, 220.0f }, 60, GREEN, SKYBLUE);
DrawCircleLines(80, 340, 80, DARKBLUE);

View File

@ -56,6 +56,7 @@ int main(void)
// Set the texture tiling using a shader
float tiling[2] = { 3.0f, 3.0f };
Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/tiling.fs", GLSL_VERSION));
SetTextureWrap(texture, TEXTURE_WRAP_REPEAT);
SetShaderValue(shader, GetShaderLocation(shader, "tiling"), tiling, SHADER_UNIFORM_VEC2);
model.materials[0].shader = shader;

View File

@ -17,17 +17,23 @@
#include "raylib.h"
#include <stdlib.h>
#include <math.h>
#include "raymath.h"
#define MAX_BALLS 5000 // Maximum quantity of balls
#include <stdlib.h> // Required for: malloc(), free()
#include <math.h> // Required for: hypot()
#define MAX_BALLS 5000 // Maximum quantity of balls
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
// Ball data type
typedef struct Ball {
Vector2 pos; // Position
Vector2 vel; // Velocity
Vector2 ppos; // Previous position
Vector2 position;
Vector2 speed;
Vector2 prevPosition;
float radius;
float friction;
float friction;
float elasticity;
Color color;
bool grabbed;
@ -45,24 +51,29 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - ball physics");
Ball balls[MAX_BALLS] = {{
.pos = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f },
.vel = { 200, 200 },
.ppos = { 0 },
Ball *balls = (Ball*)RL_MALLOC(sizeof(Ball)*MAX_BALLS);
// Init first ball in the array
balls[0] = (Ball){
.position = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f },
.speed = { 200, 200 },
.prevPosition = { 0 },
.radius = 40,
.friction = 0.99f,
.elasticity = 0.9f,
.color = BLUE,
.grabbed = false
}};
};
int ballCount = 1;
Ball *grabbedBall = NULL; // A pointer to the current ball that is grabbed
Vector2 pressOffset = { 0 }; // Mouse press offset relative to the ball that grabbedd
Ball *grabbedBall = NULL; // A pointer to the current ball that is grabbed
Vector2 pressOffset = { 0 }; // Mouse press offset relative to the ball that grabbedd
float gravity = 100; // World gravity
float gravity = 100; // World gravity
Vector2 windowPosition = GetWindowPosition();
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//---------------------------------------------------------------------------------------
// Main game loop
@ -79,8 +90,8 @@ int main(void)
for (int i = ballCount - 1; i >= 0; i--)
{
Ball *ball = &balls[i];
pressOffset.x = mousePos.x - ball->pos.x;
pressOffset.y = mousePos.y - ball->pos.y;
pressOffset.x = mousePos.x - ball->position.x;
pressOffset.y = mousePos.y - ball->position.y;
// If the distance between the ball position and the mouse press position
// is less than or equal to the ball radius, the event occurred inside the ball
@ -109,9 +120,9 @@ int main(void)
if (ballCount < MAX_BALLS)
{
balls[ballCount++] = (Ball){
.pos = mousePos,
.vel = { (float)GetRandomValue(-300, 300), (float)GetRandomValue(-300, 300) },
.ppos = { 0 },
.position = mousePos,
.speed = { (float)GetRandomValue(-300, 300), (float)GetRandomValue(-300, 300) },
.prevPosition = { 0 },
.radius = 20.0f + (float)GetRandomValue(0, 30),
.friction = 0.99f,
.elasticity = 0.9f,
@ -121,12 +132,23 @@ int main(void)
}
}
// Get window position change for shaking
Vector2 windowPositionDelta = Vector2Subtract(windowPosition, GetWindowPosition());
if (Vector2Length(windowPositionDelta) > 5.0f)
{
for (int i = 0; i < ballCount; i++)
{
if (!balls[i].grabbed) balls[i].speed = Vector2Add(balls[i].speed, Vector2Scale(windowPositionDelta, 10.0f));
}
}
// Shake balls
if (IsMouseButtonPressed(MOUSE_BUTTON_MIDDLE))
{
for (int i = 0; i < ballCount; i++)
{
if (!balls[i].grabbed) balls[i].vel = (Vector2){ (float)GetRandomValue(-2000, 2000), (float)GetRandomValue(-2000, 2000) };
if (!balls[i].grabbed) balls[i].speed = (Vector2){ (float)GetRandomValue(-2000, 2000), (float)GetRandomValue(-2000, 2000) };
}
}
@ -142,51 +164,53 @@ int main(void)
if (!ball->grabbed)
{
// Ball repositioning using the velocity
ball->pos.x += ball->vel.x * delta;
ball->pos.y += ball->vel.y * delta;
ball->position.x += ball->speed.x * delta;
ball->position.y += ball->speed.y * delta;
// Does the ball hit the screen right boundary?
if ((ball->pos.x + ball->radius) >= screenWidth)
if ((ball->position.x + ball->radius) >= screenWidth)
{
ball->pos.x = screenWidth - ball->radius; // Ball repositioning
ball->vel.x = -ball->vel.x*ball->elasticity; // Elasticity makes the ball lose 10% of its velocity on hit
}
ball->position.x = screenWidth - ball->radius; // Ball repositioning
ball->speed.x = -ball->speed.x*ball->elasticity; // Elasticity makes the ball lose 10% of its velocity on hit
}
// Does the ball hit the screen left boundary?
else if ((ball->pos.x - ball->radius) <= 0)
{
ball->pos.x = ball->radius;
ball->vel.x = -ball->vel.x*ball->elasticity;
else if ((ball->position.x - ball->radius) <= 0)
{
ball->position.x = ball->radius;
ball->speed.x = -ball->speed.x*ball->elasticity;
}
// The same for y axis
if ((ball->pos.y + ball->radius) >= screenHeight)
if ((ball->position.y + ball->radius) >= screenHeight)
{
ball->pos.y = screenHeight - ball->radius;
ball->vel.y = -ball->vel.y*ball->elasticity;
}
else if ((ball->pos.y - ball->radius) <= 0)
{
ball->pos.y = ball->radius;
ball->vel.y = -ball->vel.y*ball->elasticity;
ball->position.y = screenHeight - ball->radius;
ball->speed.y = -ball->speed.y*ball->elasticity;
}
else if ((ball->position.y - ball->radius) <= 0)
{
ball->position.y = ball->radius;
ball->speed.y = -ball->speed.y*ball->elasticity;
}
// Friction makes the ball lose 1% of its velocity each frame
ball->vel.x = ball->vel.x*ball->friction;
ball->speed.x = ball->speed.x*ball->friction;
// Gravity affects only the y axis
ball->vel.y = ball->vel.y*ball->friction + gravity;
ball->speed.y = ball->speed.y*ball->friction + gravity;
}
else
{
// Ball repositioning using the mouse position
ball->pos.x = mousePos.x - pressOffset.x;
ball->pos.y = mousePos.y - pressOffset.y;
ball->position.x = mousePos.x - pressOffset.x;
ball->position.y = mousePos.y - pressOffset.y;
// While the ball is grabbed, recalculates its velocity
ball->vel.x = (ball->pos.x - ball->ppos.x)/delta;
ball->vel.y = (ball->pos.y - ball->ppos.y)/delta;
ball->ppos = ball->pos;
ball->speed.x = (ball->position.x - ball->prevPosition.x)/delta;
ball->speed.y = (ball->position.y - ball->prevPosition.y)/delta;
ball->prevPosition = ball->position;
}
}
windowPosition = GetWindowPosition();
//----------------------------------------------------------------------------------
// Draw
@ -197,8 +221,8 @@ int main(void)
for (int i = 0; i < ballCount; i++)
{
DrawCircleV(balls[i].pos, balls[i].radius, balls[i].color);
DrawCircleLinesV(balls[i].pos, balls[i].radius, BLACK);
DrawCircleV(balls[i].position, balls[i].radius, balls[i].color);
DrawCircleLinesV(balls[i].position, balls[i].radius, BLACK);
}
DrawText("grab a ball by pressing with the mouse and throw it by releasing", 10, 10, 10, DARKGRAY);
@ -214,8 +238,10 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
RL_FREE(balls);
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
}

View File

@ -50,7 +50,7 @@ int main(void)
// Circle shapes and lines
DrawCircle(screenWidth/5, 120, 35, DARKBLUE);
DrawCircleGradient(screenWidth/5, 220, 60, GREEN, SKYBLUE);
DrawCircleGradient((Vector2){ screenWidth/5.0f, 220.0f }, 60, GREEN, SKYBLUE);
DrawCircleLines(screenWidth/5, 340, 80, DARKBLUE);
DrawEllipse(screenWidth/5, 120, 25, 20, YELLOW);
DrawEllipseLines(screenWidth/5, 120, 30, 25, YELLOW);

Some files were not shown because too many files have changed in this diff Show More