Commit graph

26 commits

Author SHA1 Message Date
A Thousand Ships a497a5cb3e
[Core] Codestyle improvements to math types 2024-03-04 18:17:10 +01:00
Hugo Locurcio 0437db0106
Display values in vector/quaternion math function errors
This can help track down the source of the error more easily.
2024-01-28 18:45:46 +01:00
lawnjelly 50c5ed4876 Make acos and asin safe
A common bug with using acos and asin is that input outside -1 to 1 range will result in Nan output. This can occur due to floating point error in the input.

The standard solution is to provide safe_acos function with clamped input. For Godot it may make more sense to make the standard functions safe.
2023-05-11 08:34:34 +01:00
Rémi Verschelde e5f6e03490
Merge pull request #70547 from TokageItLab/pingpong-wrap
Fix pingpong-loop with `loop_wrap` is not working & clean-up cubic interpolation key retrieve process
2023-01-06 00:10:18 +01:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Silc Renew 8745c206c4 Fix pingpong with loop wrap is not working 2022-12-25 18:16:38 +09:00
Aaron Franke 9e952c8386
Allow getting Quaternion rotation in different Euler orders 2022-11-02 19:20:10 -05:00
Aaron Franke 8556fdd4bc
Move EulerOrder enum to math_defs.h and global scope 2022-11-02 13:44:13 -05:00
Aaron Franke 83634119d4
Replace Quaternion Euler constructor with from_euler method 2022-11-01 09:28:12 -05:00
Haoyu Qiu 5da515773d Add is_finite method for checking built-in types 2022-10-08 13:25:08 +08:00
Aaron Franke 43722dbcbc
Use float literals for float calculations in Color 2022-10-07 11:28:47 -05:00
Rémi Verschelde b9919fd87d
Merge pull request #64678 from TokageItLab/implement-ease-baker
Fix Quaternion Tween and add Easing baker to AnimationTrackEditor
2022-08-23 09:19:21 +02:00
Silc Renew f7dd83ce60 Fix Quaternion Tween and implement ease baker 2022-08-22 19:04:58 +09:00
Silc Renew dded7c72c1 Make cubic_interpolate() consider key time in animation 2022-08-19 14:48:37 +09:00
Silc Renew 90dc2f961e Make spherical_cubic_interpolate() more stable 2022-07-29 17:39:22 +09:00
Silc Renew 4211e68d80 rename and unify notation for spherical interpolation 2022-07-27 23:22:50 +09:00
Silc 'Tokage' Renew e252d4e6fe Fix cubic_slerp
Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
Co-authored-by: Pasi Nuutinmaki <gnssstylist@sci.fi>
2022-07-25 22:44:39 +09:00
Silc 'Tokage' Renew b06d253920 Fix blend animation to solve TRS track bug & blend order inconsistency 2022-03-16 05:11:55 +09:00
lawnjelly 1485924a2b Float literals - fix main primitives to use real_t casting
Uses (real_t) casting to ensure appropriate calculations are done in 32 bit where real_t is compiled as 32 bit.
2022-02-24 08:15:10 +00:00
lawnjelly 5298e16e80 Float literals - fix main primitives to use .f
Converts float literals from double format (e.g. 0.0) to float format (e.g. 0.0f) where appropriate for 32 bit calculations.
2022-02-10 18:43:19 +00:00
Rémi Verschelde fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
reduz d03b7fbe09 Refactored Node3D rotation modes
* Made the Basis euler orders indexed via enum.
* Node3D has a new rotation_order property to choose Euler rotation order.
* Node3D has also a rotation_mode property to choose between Euler, Quaternion and Basis

Exposing these modes as well as the order makes Godot a lot friendlier for animators, which can choose the best way to interpolate rotations.
The new *Basis* mode makes the (exposed) transform property obsolete, so it was removed (can still be accessed by code of course).
2021-10-25 14:34:00 -03:00
reduz a69541da4c Implement Animation Compression
Roughly based on https://github.com/godotengine/godot-proposals/issues/3375 (used format is slightly different).

* Implement bitwidth based animation compression (see animation.h for format).
* Can compress imported animations up to 10 times.
* Compression format opens the door to streaming.
* Works transparently (happens all inside animation.h)
2021-10-21 18:27:34 -03:00
Aaron Franke 93b494d4ae
Add Quaternion angle_to method 2021-06-17 23:57:00 -04:00
Aaron Franke 554c776e08
Reformat structure string operators
The order of numbers is not changed except for Transform2D. All logic is done inside of their structures (and not in Variant).

For the number of decimals printed, they now use String::num_real which works best with real_t, except for Color which is fixed at 4 decimals (this is a reliable number of float digits when converting from 16-bpc so it seems like a good choice)
2021-06-11 10:53:20 -04:00
Marcel Admiraal 8acd13a456 Rename Quat to Quaternion 2021-06-04 18:14:32 +01:00
Renamed from core/math/quat.cpp (Browse further)