1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00
Commit Graph

18 Commits

Author SHA1 Message Date
Lukas Tenbrink
ed836df150 Make conversions from math types to String explicit, to avoid accidental conversions. 2025-06-09 01:58:18 +02:00
Thaddeus Crews
ea62170dac Core: Add constexpr constructors/operators to math structs
• Begin integrating `constexpr` on math tests; use `static_assert` where appropriate
2025-03-17 12:15:31 -05:00
Aaron Franke
ced61da848 Add missing Projection constructor with 16 real_t values 2025-03-14 02:57:19 -07:00
Thaddeus Crews
a13067e61f Merge pull request #97553 from AThousandShips/semantic_equal
[Core] Add `is_same` to types that have float components
2025-03-10 10:01:05 -05:00
Thaddeus Crews
324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
A Thousand Ships
e825085978 [Core] Add is_same to types that have float components
Compares `NaN` as equal.

Added to:
* `AABB`
* `Basis`
* `Color`
* `Plane`
* `Projection`
* `Quaternion`
* `Rect2`
* `Transform2D`
* `Transform3D`
* `Vector2`
* `Vector3`
* `Vector4`

And added as a method in `Math`
2025-02-03 19:25:50 +01:00
Thaddeus Crews
55a4836e5b Core: Replace _NO_DISCARD_ macro with attribute 2024-04-12 16:40:01 -05:00
Rémi Verschelde
c5ac5d2308 Merge pull request #90063 from aaronfranke/really-floaty
Fix some uses of `float` and `real_t` in `core/math`
2024-04-04 14:36:57 +02:00
Khasehemwy
d950f5f838 Use Reverse Z for the depth buffer 2024-04-04 13:54:15 +02:00
Aaron Franke
158fcf107c Fix some uses of float and real_t in core/math 2024-03-29 16:44:12 -07:00
Thaddeus Crews
9903e6779b Enforce template syntax typename over class 2024-03-07 22:39:09 -06:00
A Thousand Ships
a497a5cb3e [Core] Codestyle improvements to math types 2024-03-04 18:17:10 +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
Aaron Franke
97d232c11d Enhancements to includes in core data structures 2022-10-05 23:11:02 -05:00
Aaron Franke
2cea42cc7f Rename Projection matrix to columns 2022-10-04 12:34:19 -05:00
Micky
59e11934d8 Rename str2var to str_to_var and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
Rémi Verschelde
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
reduz
455c06ecd4 Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.

* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.

These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.

**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02:00