Commit Graph

1159 Commits

Author SHA1 Message Date
10799d0b44 Merge pull request #104389 from Ivorforce/color-string-append
Optimize `Color::to_html` by allocating less.
2025-03-28 14:32:54 +01:00
22b5ec17fb Using iterator pattern instead of List::Element *.
Co-authored-by: Adam Scott <ascott.ca@gmail.com>
2025-03-28 13:29:15 +08:00
2eec0fc526 Merge pull request #94441 from Repiteo/core/math-namespace
Core: Convert `Math` class to namespace
2025-03-23 19:03:55 -05:00
f09ee0171a Style: Begin integrating simple .clangd fixes 2025-03-22 13:24:35 -05:00
581d675eeb Core: Convert Math class to namespace 2025-03-21 10:29:18 -05:00
143f8e933e Optimize Color::to_html by allocating less. 2025-03-20 13:42:03 +01:00
10f6c01b9c Remove ABS in favor of Math::abs 2025-03-19 13:52:40 +01:00
85258ec1a5 Merge pull request #102662 from groud/chunk_tilemap_physics
Chunk tilemap physics
2025-03-17 16:03:29 -05:00
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
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
24c11dea16 Simplify and optimize absf implementation to use std::fabs. 2025-03-17 14:50:15 +01:00
a9745aac5c Optimize reverb by removing stray volatile from the undenormalize function signature. 2025-03-16 15:50:50 +01:00
ced61da848 Add missing Projection constructor with 16 real_t values 2025-03-14 02:57:19 -07:00
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
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
5c66129e62 Allow to select multiple remote nodes at runtime 2025-03-11 12:35:41 -03:00
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
331a43a9d8 Add String::remove_char(s) methods for performance and convenience 2025-03-10 13:19:28 +01:00
324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
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
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
1d416fc2ba Simplify and fix Projection's getter functions 2025-03-06 16:48:01 +01:00
4765bc883c Chunk tilemap physics 2025-02-11 16:28:58 +01:00
e34f1f504c Use std::size instead of sizeof(a) / sizeof(a[0]) pattern throughout the codebase. 2025-02-07 14:57:48 +01:00
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
3be46a69c4 Fix uppercase B and X parsing in the integer literals. 2025-02-05 16:02:06 +02:00
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
d56cbd374b Fix Basis::get_euler incorrectly simplifying rotations in some cases. 2025-01-29 16:13:29 -06:00
27e23280c5 Fix Quaternion arc constructor to check dot & Add test for same vec3s 2025-01-20 18:16:53 +09:00
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
d47fef15b8 Merge pull request #100991 from TokageItLab/180deg-arc
Fix looking at with 180 degree arc
2025-01-03 00:49:59 +01:00
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
4e48b19e1f Add Color.from_rgba8 and deprecate Color8 2024-12-27 11:26:59 +01:00
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
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
bf9ef5f8a5 Merge pull request #100564 from YYF233333/iwyu
Remove unused headers in core
2024-12-19 19:59:55 -06:00
be86ce3103 Apply iwyu suggestion in core. 2024-12-19 00:43:47 +08:00
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
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
bdf24924e6 [Codestyle] Merge identical code piece. 2024-12-11 00:48:00 +08:00
d58b2e879f Get rid of easily removable uses of const_cast 2024-12-01 17:50:13 -08:00
bd1a35ce9e Core: Fix JSON.{from,to}_native() issues 2024-11-29 12:43:06 +03:00
f2f48aaf36 Fix stringification of Projection 2024-11-25 21:10:32 +01:00
9b5c7e9efa Merge pull request #99545 from KoBeWi/Vector4.0
Fix stringification of Vector4
2024-11-25 13:22:33 -06:00
e210313045 Fix stringification of Vector4 2024-11-22 21:44:30 +01:00
e8a4b45ce4 Style: Add 19.1.0 LLVM options to .clang-format 2024-11-22 09:24:32 -06:00
23fc8e22a3 Merge pull request #95303 from EIREXE/inverted_composer
Fix `Projection::invert` for orthographic projection
2024-11-20 17:03:03 +01:00
02b2efc668 Fix Projection::invert on orthogonal projections and others.
Fixes #68878, specially when using orthographic projection.

Also adds some tests.
2024-11-18 16:13:04 +01:00
363c0b5fec Merge pull request #47502 from KoBeWi/add_0
Always add decimal when converting float to string
2024-10-31 20:14:39 -05:00
38f9769bc6 [Core] Improve error messages with vformat 2024-10-30 15:55:51 +01:00