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
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
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
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
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
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
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
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
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
Rémi Verschelde
f2f48aaf36
Fix stringification of Projection
2024-11-25 21:10:32 +01:00
Thaddeus Crews
9b5c7e9efa
Merge pull request #99545 from KoBeWi/Vector4.0
...
Fix stringification of Vector4
2024-11-25 13:22:33 -06:00
kobewi
e210313045
Fix stringification of Vector4
2024-11-22 21:44:30 +01:00
Thaddeus Crews
e8a4b45ce4
Style: Add 19.1.0 LLVM options to `.clang-format`
2024-11-22 09:24:32 -06:00
Rémi Verschelde
23fc8e22a3
Merge pull request #95303 from EIREXE/inverted_composer
...
Fix `Projection::invert` for orthographic projection
2024-11-20 17:03:03 +01:00
Álex Román
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
Thaddeus Crews
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
A Thousand Ships
38f9769bc6
[Core] Improve error messages with `vformat`
2024-10-30 15:55:51 +01:00
Thaddeus Crews
b7a0971ad2
Merge pull request #97934 from adamscott/give-AThousandShips-a-break
...
[Codestyle] Set clang-format `RemoveSemicolon` rule to `true`
2024-10-29 19:25:36 -05:00
Adam Scott
0d350e7108
Set clang-format `RemoveSemicolon` rule to `true`
...
- Set clang-format `Standard` rule to `c++20`
2024-10-25 13:49:43 -04:00
Danil Alexeev
9f0ae21095
Expose `Geometry2D.bresenham_line()` method
...
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2024-10-25 10:27:55 +03:00
kobewi
5c0f2414cd
Always add decimal when printing float
2024-10-23 15:00:21 +02:00
Ricardo Buring
9652695f6f
Restore arc_tolerance value when using Clipper2's InflatePaths
...
This was missed when upgrading from Clipper to Clipper2.
2024-10-09 14:13:23 +02:00
detomon
eaea7c1065
Reduce allocations when solving path in `AStarGrid2D`
2024-10-05 12:17:50 +02:00
Lukas Tenbrink
e117ed9cd4
Rename Vector4.components -> coord
2024-09-26 14:02:00 +02:00
Rémi Verschelde
a4c1804cab
Merge pull request #97483 from akien-mga/clang-format-19.1.0
...
CI: Update `clang-format` pre-commit hook to 19.1.0
2024-09-26 12:46:04 +02:00
Rémi Verschelde
991e6c92ab
Merge pull request #96923 from Repiteo/style/warning-admonition
...
Style: Add `WARNING:` as new comment admonition
2024-09-26 12:45:38 +02:00
Rémi Verschelde
c92a6c7e27
CI: Update `clang-format` pre-commit hook to 19.1.0
2024-09-26 11:46:12 +02:00
Thaddeus Crews
32c83a228d
Style: Add `WARNING:` as new comment admonition
2024-09-25 09:44:42 -05:00
Thaddeus Crews
9f9ee0c813
SCons: Add unobtrusive type hints in SCons files
2024-09-25 09:34:35 -05:00
kleonc
3bfadeff25
Fix C# operator *(Transform3D, AABB)
2024-09-20 00:18:54 +02:00
allison
c46b5af06b
fix astar partial path destination can be solid/disabled
...
* AStar2D, AStar3D and AStarGrid2D will now return a path when allow_partial_path is true even if the destination is a solid/disabled point.
# Conflicts:
# core/math/a_star_grid_2d.cpp
# core/math/a_star_grid_2d.h
2024-09-12 20:09:41 -07:00
Rémi Verschelde
d1caac5e75
Merge pull request #93856 from timothyqiu/expression-period
...
Fix parsing of `4.` in Expression
2024-09-11 12:34:39 +02:00
Martijn
202e197717
Improve AStarGrid2D performance when jumping is enabled
2024-09-05 18:12:43 +02:00
Rémi Verschelde
52d1b0be4a
Merge pull request #96328 from object71/fix-animation-snap-96159
...
Add `modf` function and fix animation editor snap behavior
2024-08-30 23:38:02 +02:00
Hristo Iliev
fcc8518bce
Add modf function and fix snap behavior
...
Fixes #96159
2024-08-30 17:49:57 +03:00
Rémi Verschelde
2fadd095a7
Merge pull request #93893 from Togira123/fix-rand-weighted-return-value
...
Fix `rand_weighted` incorrectly returning -1
2024-08-28 00:11:35 +02:00
Rémi Verschelde
1e6b6eaf49
Merge pull request #92123 from timothyqiu/estimate-end
...
Change param name of AStar's `_estimate_cost` method
2024-08-28 00:10:47 +02:00
Rémi Verschelde
9c7cf5440c
Merge pull request #91868 from Chaosus/astargrid_get_point_positions_in_region
...
Add a method to retrieve all points within a region to `AStarGrid2D`
2024-08-28 00:10:42 +02:00
Aaron Franke
7db24a9ad5
Simplify and fix Rect2/AABB get_support function
2024-08-19 23:55:31 -07:00
Rémi Verschelde
886d5865a4
Merge pull request #95291 from BlueCube3310/hdr-optimizations
...
Optimize .hdr loading and RGB9E5 conversion
2024-08-16 10:35:32 +02:00
Rémi Verschelde
27f3dd8d01
Merge pull request #93149 from Malcolmnixon/smoothstep-degenerate-case
...
Handle the smoothstep degenerate case of empty range
2024-08-16 10:33:58 +02:00
Malcolm Nixon
23fc704cbc
This PR handles the smoothstep degenerate case where the range is empty.
...
It also updates the documentation to describe positive and negative ranges.
Co-Authored-By: Hugo Locurcio <hugo.locurcio@hugo.pro>
Co-Authored-By: kleonc <9283098+kleonc@users.noreply.github.com>
2024-08-15 19:08:05 -04:00
BlueCube3310
80cf6cbfe9
Optimize .hdr loading and RGB9E5 conversion
2024-08-09 22:39:30 +02:00
Ricardo Buring
2f8ab4a654
Fixed Timestep Interpolation (3D)
...
Adds 3D fixed timestep interpolation to the rendering server.
This does not yet include support for multimeshes or particles.
Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2024-07-07 22:15:23 +02:00
Yuri Rubinsky
453c8753a9
Add a check to prevent user to call `AStarGrid2D::update` when its not needed
2024-07-06 14:59:38 +03:00
Togira
ab13513403
Fix RandomPCG::rand_weighted incorrectly returning -1
2024-07-04 02:00:59 +02:00
Haoyu Qiu
ee9cea521d
Fix parsing of `4.` in Expression
2024-07-02 20:53:52 +08:00
lawnjelly
0ed71f3e0c
Physics Interpolation - Fix `interpolated_transform_2d`
...
Uses the skew correct `Transform2D::interpolate_with()` function rather than the bugged 3.x version.
2024-07-02 08:10:55 +01: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 +02:00
Danil Alexeev
49594d8c41
Optimize `Color::find_named_color()`
2024-05-23 15:19:19 +03:00
lawnjelly
331ecf3ca8
Clarify is_polygon_clockwise() coordinate system
...
The function assumes a normal Cartesian coordinate system.
2024-05-20 18:34:45 +01:00
Haoyu Qiu
ed61d41697
Change param name of AStar's _estimate_cost method
2024-05-19 22:08:36 +08:00
Yuri Rubinsky
db2e09e9cd
Add a method to retrieve all points within a region to `AStarGrid2D`
2024-05-12 18:14:13 +03:00
lawnjelly
b35264ad95
Fix AABB Ray intersection - return inside
...
* Separates find_intersects from test_intersects for rays, and wraps the former.
* Changes parameter name to "r_intersection_point".
* Fixes broken old version which returned per axis t.
* Returns whether the ray origin is within the AABB.
* Returns intersection point when origin outside.
* Returns "backtracking" intersection point when inside.
* Returns sensible normal when inside.
* Returns valid results on borders.
* Returns robust results dealing with floating point error.
Co-authored-by: Claire Blackshaw <evilkimau@gmail.com>
2024-05-09 20:41:19 +01:00
Jakub Marcowski
7699d678c4
Fix `builtin_embree=no` build linking the wrong version of Embree
2024-05-08 00:40:45 +02:00
K. S. Ernest (iFire) Lee
f9b488508c
Add PackedVector4Array Variant type
...
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-05-03 00:58:27 +02: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 +02:00
Rémi Verschelde
61d146c89e
Merge pull request #90748 from aaronfranke/fix-basis-scale-global
...
Fix incorrect name of internal Basis global scale getter
2024-04-22 12:52:52 +02:00
Rémi Verschelde
4b6629978e
Merge pull request #90701 from permelin/improve-delaunay3d-triangulation
...
Delaunay3D/LightmapGI: Improve triangulation
2024-04-22 12:52:12 +02:00
Ricardo Buring
8a28f816d0
Replace Clipper1 library by Clipper2 library
2024-04-20 13:37:59 +02:00
Aaron Franke
e83807ef85
Fix incorrect name of Basis global scale getter
2024-04-16 04:26:52 -07:00
Per Melin
89d0934f71
Delaunay3D: Improve triangulation
2024-04-15 18:48:21 +02:00
Thaddeus Crews
55a4836e5b
Core: Replace `_NO_DISCARD_` macro with attribute
2024-04-12 16:40:01 -05:00
Thaddeus Crews
bbb3eb3a1a
Update lingering `do/while(0)` defines
2024-04-04 14:17:22 -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
Rémi Verschelde
69a4ff8996
Merge pull request #88328 from Khasehemwy/reversed-z
...
Use Reverse Z for the depth buffer
2024-04-04 14:30:53 +02:00
Khasehemwy
d950f5f838
Use Reverse Z for the depth buffer
2024-04-04 13:54:15 +02:00
ashley
aa1bbe1542
add partial path return option for astar
...
* AStar2D, AStar3D and AStarGrid2D now can return a partial path if the destination point isn't reachable but still in the map. This option is available for both get_point_path and get_id_path
2024-04-03 22:27:33 -07:00
Aaron Franke
158fcf107c
Fix some uses of float and real_t in core/math
2024-03-29 16:44:12 -07:00
Rémi Verschelde
c258da378b
Merge pull request #89619 from AThousandShips/rand_fix
...
[Core] Fix `rand_weighted` not using the current state
2024-03-24 01:19:20 +01:00
Rémi Verschelde
cd4e4c0fcc
Merge pull request #89111 from AThousandShips/vec_use
...
Use `Vector*` component-wise `min/max/clamp` functions where applicable
2024-03-24 01:14:51 +01:00
Ricardo Buring
2ed2ccc2d8
Fixed Timestep Interpolation (2D)
...
Adds fixed timestep interpolation to the rendering server (2D only).
Switchable on and off with a project setting (default is off).
Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2024-03-23 12:28:36 +01:00
A Thousand Ships
79ba22a73f
Use `Vector*` component-wise `min/max/clamp` functions where applicable
2024-03-20 13:47:42 +01:00
A Thousand Ships
9c518d5f42
[Core] Fix `rand_weighted` not using the current state
...
The method incorrectly used `Math::randf` instead of `randf`
2024-03-17 19:21:16 +01: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