Commit Graph

1159 Commits

Author SHA1 Message Date
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
158fcf107c Fix some uses of float and real_t in core/math 2024-03-29 16:44:12 -07:00
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
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
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
79ba22a73f Use Vector* component-wise min/max/clamp functions where applicable 2024-03-20 13:47:42 +01:00
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
9903e6779b Enforce template syntax typename over class 2024-03-07 22:39:09 -06:00
a497a5cb3e [Core] Codestyle improvements to math types 2024-03-04 18:17:10 +01:00
981883d041 Fix RandomNumberGenerator::rand_weighted return type 2024-03-02 20:56:01 -06:00
bd7637248c Merge pull request #88883 from joaoh82/add-weighted-random-method
Add `RandomNumberGenerator::rand_weighted` method
2024-03-01 15:00:32 +01:00
88df5ea8ac Add RandomNumberGenerator::rand_weighted method 2024-02-29 13:29:53 +01:00
3a08c646ee Pre-commit: Update to clang-format 17.0.6 and black 24.2.0 2024-02-28 14:25:35 +01:00
13e82094ee Remove word duplicates in comments and strings, and fix casing and punctuation 2024-02-23 17:28:28 -05:00
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
d8b29efe66 Fix member names of AudioFrame to match extension 2024-02-13 15:37:09 +01:00
67e38709fd Avoid unqualified-id "near" and "far" in Node3DEditor/Viewport 2024-02-13 18:53:21 +09:00
684752e75b Replace error checks against size with is_empty 2024-02-09 12:50:15 +01:00
fa48a51183 Merge pull request #87688 from AThousandShips/what_is_this
Remove unnecessary `this->` expressions
2024-01-29 13:18:09 +01:00
15369fdb1d Remove unnecessary this-> expressions 2024-01-29 09:59:18 +01:00
0437db0106 Display values in vector/quaternion math function errors
This can help track down the source of the error more easily.
2024-01-28 18:45:46 +01:00
9d7c2978f4 Rework GraphEdit connections (drawing, API, optimizations)
- GraphEdit now uses Line2D nodes to draw connection lines and uses a dedicated canvas item shader for them
2024-01-18 16:53:15 +01:00
b4191bf8f6 [Core] Fix AABB.encloses failing on shared upper bound
This differs from `Rect2(i)` and was fixed for those classes in the past
2024-01-12 17:58:42 +01:00
acd37f98c0 Merge pull request #83353 from Chubercik/expose_delaunay_3d
Expose 3D Delaunay tetrahedralization in `Geometry3D`
2024-01-04 16:39:23 +01:00
18e9133d5a Merge pull request #86364 from aaronfranke/basis-divide
Add and expose Basis/Transform2D/3D division by float operator
2024-01-04 14:26:16 +01:00
bbfcfe50da Merge pull request #81267 from Chaosus/astargrid_isometric_mode
Add isometric cell shape mode to `AStarGrid2D`.
2024-01-04 14:25:00 +01:00
22e880ad20 Merge pull request #83163 from Chubercik/vectorXi_dist_methods
Implement `Vector2i/3i/4i` methods: `distance_to` and `distance_squared_to`
2024-01-03 09:58:36 +01:00
8317b459df Merge pull request #86590 from rune-scape/rune-uninitialized-astar
Initialize pointers in a_star.cpp
2024-01-02 18:05:48 +01:00
8747c67d9e Fix potential integer underflow in rounded up divisions
A new `Math::division_round_up()` function was added, allowing for easy
and correct computation of integer divisions when the result needs to
be rounded up.

Fixes #80358.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-01-02 14:14:47 +01:00
b6a53e62bc Initialize pointers in a_star.cpp 2023-12-28 13:58:11 -08:00
c77ae051d5 Add and expose Basis/Transform2D/3D division by float operator 2023-12-20 18:24:03 -06:00
46531964d0 Improve DynamicBVH code to make it clearer how the stack/heap works.
Inspired by a Coverity issue about possible memcpy usage and overlapping memory.
2023-12-13 09:03:19 +11:00
7ee273723d Fix Basis is_orthogonal and is_rotation methods, add is_orthonormal 2023-12-06 13:12:05 -06:00
fe4850c0d0 Use mingw-std-threads in MinGW builds 2023-11-18 11:56:05 +01:00
80c9533810 Rework blending method in Variant animation for Int/Array/String 2023-11-16 21:37:18 +09:00
c33e291474 Update triangulate_delaunay() to avoid needless reallocations 2023-10-16 12:37:57 +02:00
bc78c832e9 Expose 3D Delaunay tetrahedralization in Geometry3D 2023-10-16 11:48:49 +02:00
cb954c6bab Implement Vector2i/3i/4i methods: distance_to and distance_squared_to 2023-10-12 13:46:49 +02:00
034c0f1624 Replace sanity with safety for checks 2023-10-08 16:22:24 +02:00
04bb89c0bd Add isometric cell shape mode to AStarGrid2D. 2023-10-03 21:04:03 +03:00
3a39de4e2f Add rotate_toward and angle_difference to GDScript and C# 2023-10-01 22:19:42 +02:00
e705aa4550 Fix not refitting upward from leaf nodes.
Previously, the wrong node id (root node id) was used. Dirty leaf nodes
do not actually recalculate aabb.

Additionally, when requesting a new leaf, mark `dirty` as `false` in `clear()`.

Make sure to only mark the leaf as **dirty** when shrinking the border of
the leaf when removing items.

In other cases, the leaf node's aabb will get the correct result immediately.
1. When adding an item, the leaf nodes will be calculated immediately.
2. Removing the item within the border of the leaf node has no effect on the
original aabb.
2023-09-28 20:27:51 +08:00
0156860ad5 Fix axis getting mixed up when split leaf 2023-09-27 17:56:12 +08:00
3ec673085b Merge pull request #79523 from aaronfranke/is-conformal
Add `is_conformal` method to Basis and Transform2D
2023-09-26 13:44:41 +02:00
a8ff5f086d Fix typo in heuristic_euclidian helper in AStarGrid2D 2023-09-25 14:33:22 +03:00
9f21dfbafd Remove unnecessary line from Projection::get_z_far
Removes a line from Projection::get_z_far that flips the normal of a plane.
While this may be required for similar code elsewhere in the file, this is
unnecessary here, as only the length of the normal is used and not the
direction. Flipping the normal does not change its magnitude and therefore is
unnecessary in this case.
2023-09-20 10:48:37 -04:00
1621110e2d Core: Some code style improvements to AStarGrid2D 2023-09-19 17:20:38 +03:00
56806ffeed Add is_conformal method to Basis and Transform2D 2023-09-13 17:20:30 -05:00
893f889d74 [Core] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-11 19:45:49 +02:00
d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00