Commit Graph

1179 Commits

Author SHA1 Message Date
Thaddeus Crews
2eec0fc526 Merge pull request #94441 from Repiteo/core/math-namespace
Core: Convert `Math` class to namespace
2025-03-23 19:03:55 -05:00
Thaddeus Crews
f09ee0171a Style: Begin integrating simple .clangd fixes 2025-03-22 13:24:35 -05:00
Thaddeus Crews
581d675eeb Core: Convert Math class to namespace 2025-03-21 10:29:18 -05:00
Lukas Tenbrink
143f8e933e Optimize Color::to_html by allocating less. 2025-03-20 13:42:03 +01:00
kobewi
10f6c01b9c Remove ABS in favor of Math::abs 2025-03-19 13:52:40 +01:00
Thaddeus Crews
85258ec1a5 Merge pull request #102662 from groud/chunk_tilemap_physics
Chunk tilemap physics
2025-03-17 16:03:29 -05:00
Thaddeus Crews
06f0c6369e Merge pull request #104273 from Ivorforce/fabs-absf
Simplify and optimize `Math::absf` implementation to use `::fabs` and `::fabsf`.
2025-03-17 16:03:24 -05: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
Lukas Tenbrink
24c11dea16 Simplify and optimize absf implementation to use std::fabs. 2025-03-17 14:50:15 +01:00
Lukas Tenbrink
a9745aac5c Optimize reverb by removing stray volatile from the undenormalize function signature. 2025-03-16 15:50:50 +01:00
Aaron Franke
ced61da848 Add missing Projection constructor with 16 real_t values 2025-03-14 02:57:19 -07:00
Thaddeus Crews
74907876d3 Merge pull request #103759 from Ivorforce/zero-constructible
Optimize `Array.resize` by using `memset` (through new `is_zero_constructible` type trait)
2025-03-12 10:31:55 -05: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 +01:00
Michael Alexsander
5c66129e62 Allow to select multiple remote nodes at runtime 2025-03-11 12:35:41 -03: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
A Thousand Ships
331a43a9d8 Add String::remove_char(s) methods for performance and convenience 2025-03-10 13:19:28 +01:00
Thaddeus Crews
324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
Thaddeus Crews
c937b6d180 Merge pull request #102419 from Ivorforce/std-size
Use `std::size` instead of `sizeof(a) / sizeof(a[0])` pattern throughout the codebase.
2025-03-07 15:12:25 -06:00
Thaddeus Crews
3d816853e5 Merge pull request #100209 from Flarkk/simplify_fix_projection
Simplify and fix `Projection`'s getter functions
2025-03-06 16:36:19 -06:00
Florent Guiocheau
1d416fc2ba Simplify and fix Projection's getter functions 2025-03-06 16:48:01 +01:00
Spartan322
e2d0cc2ded Merge commit godotengine/godot@ad9abe841d 2025-02-11 21:06:34 -05:00
Gilles Roudière
4765bc883c Chunk tilemap physics 2025-02-11 16:28:58 +01:00
Lukas Tenbrink
e34f1f504c Use std::size instead of sizeof(a) / sizeof(a[0]) pattern throughout the codebase. 2025-02-07 14:57:48 +01:00
Pāvels Nadtočajevs
b50d9742c2 Fix is_valid_float, Variant parser, Expression parser, script highlighter, and TextServer not handing capital E in scientific notation. 2025-02-05 18:39:40 +02:00
bruvzg
3be46a69c4 Fix uppercase B and X parsing in the integer literals. 2025-02-05 16:02:06 +02:00
Spartan322
35e289fa5e Merge commit godotengine/godot@0b6a717ac1 2025-02-04 11:38:32 -05: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
Adam
d56cbd374b Fix Basis::get_euler incorrectly simplifying rotations in some cases. 2025-01-29 16:13:29 -06:00
Spartan322
94949a2769 Merge commit godotengine/godot@a7146ef807 2025-01-21 17:08:38 -05:00
Silc Lizard (Tokage) Renew
27e23280c5 Fix Quaternion arc constructor to check dot & Add test for same vec3s 2025-01-20 18:16:53 +09:00
George L. Albany
178fda85a7 Merge pull request #148 from NickUfer/sigmoid_funcs
Add sigmoid(), sigmoid_approx(), sigmoid_affine() and sigmoid_affine_approx() functions
2025-01-12 18:52:04 +00:00
Spartan322
5e6a04e752 Merge commit godotengine/godot@5b52b4b5c4 2025-01-12 13:06:53 -05:00
Aarni Koskela
f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +02:00
Spartan322
4ffc9ac18b Merge commit godotengine/godot@bdf625bd54 2025-01-04 00:55:26 -05:00
Rémi Verschelde
d47fef15b8 Merge pull request #100991 from TokageItLab/180deg-arc
Fix looking at with 180 degree arc
2025-01-03 00:49:59 +01:00
Silc Lizard (Tokage) Renew
d0c421976c Fix looking at with 180 degree arc
Co-authored-by: Fruitsalad <949631+fruitsalad@users.noreply.github.com>
2025-01-02 15:47:01 +09:00
kobewi
4e48b19e1f Add Color.from_rgba8 and deprecate Color8 2024-12-27 11:26:59 +01:00
Spartan322
fa0b4af786 Merge commit godotengine/godot@a7a2a12bfd 2024-12-21 05:32:01 -05:00
Rémi Verschelde
dac0b67c4d Merge pull request #100659 from clayjohn/color-srgb-precision
Increase precision in `linear_to_srgb()` and `srgb_to_linear()`
2024-12-20 23:57:35 +01:00
clayjohn
46ce499b6f Increase precision in linear_to_srgb and srgb_to_linear
This avoids the situation where white stops being white after conversion. While maintaining as much floating point ops as possible
2024-12-20 10:49:43 -07:00
Thaddeus Crews
bf9ef5f8a5 Merge pull request #100564 from YYF233333/iwyu
Remove unused headers in core
2024-12-19 19:59:55 -06:00
Yufeng Ying
be86ce3103 Apply iwyu suggestion in core. 2024-12-19 00:43:47 +08:00
HP van Braam
240f510fa7 Core ubsan fixes
This fixes UBSAN errors reported by running our testsuite, importing the
TPS demo, and running the TPS demo. I have tried, wherever possible, to
fix issues related to reported issues but not directly reported by UBSAN
because thse code paths just happened to not have been exercised in
these cases.

These fixes apply only to errors reported, and caused by, core/

The following things have been changed:

* Make sure there are no implicit sign changing casts in core.
* Explicitly type enums that are part of a public API such that users of
  the API cannot pass in wrongly-sized values leading to potential stack
  corruption.
* Ensure that memcpy is never called with invalid or null pointers as
  this is undefined behavior, and when the engine is built with
  optimizations turned on leads to memory corruption and hard to debug
  crashes.
* Replace enum values only used as static values with constexpr static
  const values instead. This has no runtime overhead. This makes it so
  that the size of the enums is explicit.
* Make sure that nan and inf is handled consistently in String.
* Implement a _to_int template to ensure that all of the paths use the
  same algorhithm, and correct the negative integer case.
* Changed the way the json serializer precision work, and added tests to
  verify the new behavior. The behavior doesn't quite match master in
  particulary for negative doubles as the original code tried to cast -inf
  to an int. This then led to negative doubles losing all but one of
  their decimal points when serializing. Behavior in GDScript remains
  unchanged.
2024-12-18 14:31:12 +01:00
Spartan322
9d47e1e39e Merge commit godotengine/godot@b9437c3938 2024-12-15 09:24:31 -05:00
Thaddeus Crews
8f16f864a6 Merge pull request #99765 from dalexeev/core-fix-json-from-to-native
Core: Fix `JSON.{from,to}_native()` issues
2024-12-10 14:15:53 -06:00
Yufeng Ying
bdf24924e6 [Codestyle] Merge identical code piece. 2024-12-11 00:48:00 +08:00
Spartan322
c3314b0ab0 Merge commit godotengine/godot@1f47e4c4e3 2024-12-04 20:11:58 -05:00
rune-scape
d58b2e879f Get rid of easily removable uses of const_cast 2024-12-01 17:50:13 -08:00
Danil Alexeev
bd1a35ce9e Core: Fix JSON.{from,to}_native() issues 2024-11-29 12:43:06 +03:00
Spartan322
721f53fde4 Merge commit godotengine/godot@f128f383e8 2024-11-27 13:52:25 -05:00