Commit Graph

328 Commits

Author SHA1 Message Date
oscujic
e809face7b [rmodels] DrawSphereWires(), code optimization (#6000)
* Fix DrawSphereWires (Less aggressively) 

Summary:
- Eliminated some redundancies
- Fixed a bug(?) where the sphere would have 1 more "ring" (latitude division) than expected
- Fixed a bug where the top ring was double-covered
- Added comments denoting which code draws which lines

* DrawSphereWires + DrawSphereEx parity

Summary:
- Replaced DrawSphereWires algorithm with one based on the much faster algorithm from DrawSphereEx
- Fixed +1 ring quirk on DrawSphereEx to match the change made to DrawSphereWires
2026-07-21 17:48:07 +02:00
Ray
8805ab3ee2 Update rmodels.c 2026-07-11 16:57:49 +02:00
Ray
c85cd07db0 Update rmodels.c 2026-07-11 12:22:03 +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
Laurentino
2e03c9c266 Change boneCount field type from int to unsigned int (#5955) 2026-07-06 18:33:01 +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
87a6e9693c Format tweaks 2026-06-19 12:27:02 +02:00
Ray
15d25242be REVIEWED: Comments to be more descriptive 2026-06-07 18:41:44 +02:00
Luis
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
fyl2xp1
ca46387b64 use inverse bind matrices for bind pose in gltf loader (#5832) 2026-06-05 09:27:05 +02:00
Luis
fd79b81918 Fix memory leak in UnloadModel() (#5907) 2026-06-04 23:32:52 +02:00
Ray
2c690425c9 Reviewed comments, remove article usage 2026-06-03 21:02:59 +02:00
Ray
cef7718468 RENAMED: Some Rectangle parameters with more descriptive names 2026-06-03 20:16:12 +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
Jeffery Myers
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
Caleb Seelhoff
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
Ray
361dcb2a1f WARNING: REVIEWED: DrawCapsule()/DrawCapsuleWires() parameter order
for consistency with `DrawSphere*()`
2026-04-27 11:42:53 +02:00
Ray
06621eb3b7 REVIEWED: Comments for consistency and spelling 2026-04-27 11:34:58 +02:00
Ray
4cae4ba9d5 REVIEWED: IsModelValid() #5780 2026-04-24 14:03:59 +02:00
Ray
cc752037b9 Update rmodels.c 2026-04-19 13:54:39 +02:00
Maicon Santana
90e9145978 Making it similar to CheckCollisionSpheres to remove pow function (#5776) 2026-04-19 13:51:52 +02:00
Ray
96e30549f5 Align default values on comments for config variables 2026-04-16 00:05:23 +02:00
Thomas Anderson
0decdcd497 update defines for new format etc (#5760) 2026-04-15 12:20:51 +02:00
Thomas Anderson
4628915787 Update typos/grammar (#5759) 2026-04-15 09:18:30 +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
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
Le Juez Victor
ba83bd33f3 simplify CheckCollisionSpheres using Vector3DistanceSqr (#5695) 2026-03-27 09:26:53 +01:00
Antonio Jose Ramos Marquez
51f4741912 [rmodel] fix for devices without VAO support (#5692) 2026-03-27 09:25:26 +01:00
Maicon Santana
a693365bf2 Move DrawModelPoints methods to example - point rendering (#5697) 2026-03-26 18:29:05 +01:00
Ray
18756bb79d REVIEWED: Software renderer flag, renamed to GRAPHICS_API_OPENGL_SOFTWARE
Dropped the `11` relative to OpenGL 1.1 because latest `rlsw 1.5` also includes support for FBOs and could potentially implemented other higher level features in the feature, discerning from OpenGL 1.1 limitations
2026-03-17 18:33:15 +01:00
Ray
6ba6df3af3 Remove trailing spaces 2026-03-13 18:50:26 +01:00
Ray
d604cd7f65 Update rmodels.c 2026-03-09 12:52:27 +01:00
victorberdugo1
78023ffca5 Fix memory leak in LoadGLTF when model has no bones (#5629)
Co-authored-by: Victor <victor@localhost.localdomain>
2026-03-09 12:50:19 +01:00
Ray
eb1e85e400 Update rmodels.c 2026-03-04 19:17:41 +01:00
Maicon Santana
2eaac95df0 Check if locs is not null before try to access (#5622) 2026-03-04 19:16:22 +01:00
Ray
faf42366ec Code gardening 2026-03-04 01:14:26 +01:00
Ray
b4746469d4 Formating review, using imperative mode in comments 2026-03-03 22:40:34 +01:00
Ray
5361265a7d WARNING: BREAKING: REDESIGNED: raylib build features config system #4411 #4554
Redesigned to support disabling features on compilation with `-DSUPPORT_FEATURE=0`
REMOVED: `SUPPORT_DEFAULT_FONT`, always supported
REMOVED: `SUPPORT_IMAGE_MANIPULATION `, always supported
REMOVED: `SUPPORT_TEXT_MANIPULATION`, always supported
REDESIGNED: `SUPPORT_FONT_ATLAS_WHITE_REC` to `FONT_ATLAS_CORNER_REC_SIZE`
REVIEWED: Config values (other than 0-1) are already defined on respective modules
Other config tweaks here and there
2026-02-26 08:19:28 +01:00
Ray
ecaa1d3d18 REVIEWED: Attribute name and location, for consistency 2026-02-25 23:22:48 +01:00
Ray
d4dc038e2e WARNING: BREAKING: REDESIGNED: **Animation System** #4606
REVIEWED: Reorganized structures for a clearer distinction between "skeleton", "skin" and "skinning" data
ADDED: New structures: `ModelSkeleton`, `ModelAnimPose` (alias `Transform*`)
ADDED: Runtime data `currentPose` and `boneMatrices` to `Model` structure
ADDED: Support animation frames-blending, for timing control
ADDED: Support animations blending, between two animations
REVIEWED: All models animation loading functions
ADDED: `UpdateModelAnimationEx()` for two animations blending
REMOVED: `UpdateModelAnimationBones*()`, simplified API
REVIEWED: Shader attributes/uniforms names for animations, for consistency
REVIEWED: Multiple tweaks on animations loading for consistency between formats
ADDED: example: `models_animation_timing`
ADDED: example: `models_animation_blending`
REVIEWED: example: `models_animation_gpu_skinning`
REVIEWED: example: `models_animation_blend_custom`
REVIEWED: All animated models loading examples
2026-02-24 01:18:57 +01:00
Kirandeep-Singh-Khehra
0e6cb0993d [rmodels] Added implementation of UpdateModelAnimationBonesWithBlending() function (#4578)
* [rmodels] Added implementation of `UpdateModelAnimationBonesWithBlending()` function

Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>

* [rmodels] Added example for animation blending and fixed wrap issue for blend factor

Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>

* [rmodels] Updated build information for animation blending example

Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>

* [rmodels] Fixed typos in anmation blending example

Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>

* [rmodels] Updated blend function signature and added function to update verts from bones

Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>

* [rmodels] Updated documentation

Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>

* rlparser: update raylib_api.* by CI

* rlparser: update raylib_api.* by CI

---------

Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>
Co-authored-by: Ray <raysan5@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-19 12:57:05 +01:00
Ray
e8ce00dc0b REVIEWED: LoadGLTF(), log warning about draco compression not supported #5567 2026-02-17 17:02:19 +01:00
Yui Kinomoto / きのもと 結衣
6564cea6a3 Fixed doesn't property load when 1 frame animation. (#5561) 2026-02-15 20:15:25 +01:00
Ray
3aced1fd7c Update rmodels.c 2026-02-10 18:02:42 +01:00
Ross Martin
a6fa8b9ff4 Fix out of bound Memory read in Material.maps (#5534)
* Fix out of bounds Memory read in Material.Maps by using the MATERIAL_MAP_SPECULAR define instead of the SHADER_LOG_SPECULAR enum

* Fix out of bounds Memory read in Material.Maps by using the MATERIAL_MAP_SPECULAR define instead of the SHADER_LOG_SPECULAR enum
2026-02-06 13:58:27 +01:00
Maicon Santana
af37fa2a96 Refactoring based on Coding Style Conventions (#5517)
Co-authored-by: maiconpintoabreu <maicon@thinkpad02.exads.com>
2026-01-28 19:27:03 +01:00
Ray
29896a2403 REVIEWED: Some comments (Code Gardening) 2026-01-19 12:40:32 +01:00