Commit Graph

19 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
Lukas Tenbrink ad600125df Rewrite `HashMapHasherDefault` based on type traits - it is now possible to declare a default hashing function for any type.
Remove cross-project includes from `hashfuncs.h`.
Improve hashing function for `Color` (based on values instead of `String`).
Move `Variant` comparison from `hash_map.h` to `dictionary.cpp` (`VariantComparatorDictionary`), where it's used.
Remove now unnecessary `HashableHasher`.
2025-10-05 01:49:11 +07:00
Thaddeus Crews 84c0ec04f3
Core: Integrate semantic constants in math structs
- Excludes self-explanatory constants (ZERO, ONE, etc)
2025-08-19 10:15:08 +07:00
Lukas Tenbrink ed836df150 Make conversions from math types to `String` explicit, to avoid accidental conversions. 2025-06-09 01:58:18 +07: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 +07:00
Lukas Tenbrink 75bc471965 Add `is_zero_constructible` to denote if a type can be semi-trivially constructed with all 0 bytes.
Optimize `CowData` and `LocalVector` resize for zero constructible types.
Mark several compatible types as `is_zero_constructible`.
2025-03-12 09:49:24 +07:00
Thaddeus Crews 324512e11c
Style: Replace header guards with `#pragma once` 2025-03-07 17:33:47 +07:00
Rémi Verschelde b9038501db
Merge pull request #90582 from Repiteo/core/remove-macro-_NO_DISCARD_
Core: Replace `_NO_DISCARD_` macro with `[[nodiscard]]`
2024-06-25 10:01:39 +07:00
A Thousand Ships 308dbb8c63
[Core] Add scalar versions of `Vector*` `min/max/clamp/snap(ped)`
Convenience for a number of cases operating on single values
2024-05-02 10:31:13 +07:00
Thaddeus Crews 55a4836e5b
Core: Replace `_NO_DISCARD_` macro with attribute 2024-04-12 16:40:01 +07:00
A Thousand Ships a497a5cb3e
[Core] Codestyle improvements to math types 2024-03-04 18:17:10 +07:00
Jakub Marcowski cb954c6bab Implement `Vector2i/3i/4i` methods: `distance_to` and `distance_squared_to` 2023-10-12 13:46:49 +07: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 +07:00
VolTer e26f0906f2 Implement snappedi, snappedf, and Vector[2/3/4]i.snapped 2022-11-19 06:18:55 +07:00
Aaron Franke 50fb0220ca
Define AXIS_COUNT in all vector types 2022-09-19 17:50:35 +07:00
Aaron Franke 058ac331b0
Minor fixes to Vector4 2022-09-04 20:38:44 +07:00
lawnjelly 0565676893 Protection for array operator for Vector2 / 3 in DEV builds
A previous PR had changed the array operator to give unbounded access. This could cause crashes where old code depended on this previous safe behaviour.

This PR adds DEV_ASSERT macros for out of bound access to DEV builds, allowing us to quickly identify bugs in calling code, without affecting performance in release or release_debug editor builds.
2022-03-07 11:15:45 +07:00
Bartłomiej T. Listwon 51cac0709e Fix Vector2 and Vector2i coord access via operator[] 2022-02-09 09:17:17 +07:00
reduz 8c7268664d
Fix integer vector mul/div operators and bindings.
* Vector2i and Vector3i mul/div by a float results in Vector2 and Vector3 respectively.
* Create specializations to allow proper bindings.

This fixes #44408 and supersedes #44441 and keeps the same rule of int <op> float returnig float, like with scalars.
2022-02-06 13:34:41 +07:00
Rémi Verschelde e223bad86d
Core: Move Vector2i to its own `vector2i.h` header
Also reduce interdependencies and clean up a bit.
2022-02-04 16:32:21 +07:00