Commit Graph

109 Commits

Author SHA1 Message Date
951ae7b11d Backported from godot4: Add the ability to look-at in model-space.
This is a much simpler attempt to solve the same problem as #76060, but
without breaking any compatibility.

* Adds a description of what model space is in the Vector3 enums
(MODEL_* constants). This has the proper axes laid out for imported 3D
assets.
* Adds the option to `look_at` using model_space, which uses
Vector3.MODEL_FRONT as forward vector.

The attempt of this PR is to still break the assumption that there is a
single direction of forward (which is not the case in Godot)
and make it easier to understand where 3D models are facing, as well as
orienting them via look_at.

- reduz

5fdc1232ef

Also bound the new Basis helper methods.
2024-09-30 17:04:00 +02:00
422314a8fd Added set_look_at helper method to Basis. 2024-09-30 16:41:20 +02:00
6f53257e05 Transform now uses Basis::create_looking_at. 2024-09-30 16:41:05 +02:00
010e1b51a8 Added non-static looking_at and from_scale helper methods to Basis. 2024-09-30 16:27:21 +02:00
ee1e40f1b0 Renamed looking_at to create_looking_at, and from_scale to create_from_scale in Basis. 2024-09-30 16:17:19 +02:00
Haoyu Qiu
fabd5c32f5 Fix parsing of 4. in Expression 2024-09-20 09:01:03 +02:00
lawnjelly
08f4960b23 Verify GLTF indices to prevent crash with corrupt files
Also verify prior to vertex optimization.
2024-09-07 09:24:37 +02:00
c7ac1db971 Clang format everything. 2024-07-16 21:23:54 +02:00
lawnjelly
131880d444 Physics Interpolation - Fix Transform2D::interpolate_with()
Ports the `interpolate_with()` routine from 4.x which works correctly with skew.
2024-07-14 08:08:05 +02:00
ed224298e5 Also add is_zero_approx() to Vector4. 2024-04-14 16:59:12 +02:00
Haoyu Qiu
441bb29fd3 Add is_zero_approx methods to Vector{2,3} 2024-04-14 16:44:38 +02:00
ececc7991c Backported dome of the codestyle improvements to math types from 3fb36bf395 . 2024-04-06 13:05:32 +02:00
e17cc864bc Added exp2 to the Math singleton. 2024-03-18 11:04:37 +01:00
27b73fa9f9 Removed Vector2i(Vector2) constructor, added a Vector2i conversion operator to Vector2 instead. This solves ambigous Variant to Vector2i conversion errors. 2024-03-07 18:56:55 +01:00
4abb1a23e9 Work on layered tile maps. 2024-03-04 22:15:59 +01:00
3e533b33bb Fix typo. 2024-03-04 21:15:00 +01:00
cf7b59b6c8 Fix small formatting inconsistencies. 2024-03-01 16:25:19 +01:00
66c2b12fc0 Added a new method to Expression so it can be used with multiple threads simultenously. 2024-02-25 10:25:46 +01:00
a5d8696021 Ported: Vertex cache optimizer
Optimizes indices to make good use of vertex cache on GPU.
- lawnjelly
0aa22b8f13
2024-02-08 21:35:01 +01:00
A Thousand Ships
8341ddc450 Fix AABB.encloses failing on shared upper bound
This differs from `Rect2` and was fixed for those classes in the past
2024-02-08 14:00:08 +01:00
Bastien JAUNY
15cccb331f Fix unitialized variables in core 2024-02-08 13:43:25 +01:00
22ec1be9b3 File copyright header updates pt3. 2023-12-17 22:42:34 +01:00
337c99e52f File copyright header updates pt1. 2023-12-17 22:29:33 +01:00
3902cf1924 Moved ScneeStringNames and PropertyUtils into scene/main. 2023-12-10 18:01:51 +01:00
7ec207ba27 Fix abs call. 2023-12-10 14:58:37 +01:00
风青山
f7f7c17962 BVH - fix axis getting mixed up when split leaf
Split preferentially on longest axis, rather than shortest axis.
2023-10-02 16:56:12 +02:00
风青山
1813300d53 BVH - fix not refitting upward from leaf nodes
Fix leaf node possibly not updating aabb due to wrong node id.

Additionally, when requesting a new leaf, mark `dirty` as `false` in `clear()`.
2023-10-02 16:55:52 +02:00
d977ed360e Ported: 2D Fixed Timestep Interpolation
Adds support to canvas items and Camera2D.
- lawnjelly
5162efbfe9
2023-08-27 18:48:25 +02:00
834cbe8cef Ported: Single Compilation Unit build.
Adds support for simple SCU build.
This speeds up compilation by compiling multiple cpp files within a single translation unit.
- lawnjelly
43e181a00a
2023-07-11 16:07:36 +02:00
d3f2e0e4fe Fixed SkeletonModification3DFABRIK. 2023-06-22 09:43:55 +02:00
6c9843e5cb Ported: Test, refactor and fix a bug in Basis.get_axis_angle
- fabriceci
9f1a57d48b
2023-06-11 09:45:23 +02:00
e21a020b86 Add unsafe version from asin and acos. 2023-06-11 08:45:19 +02:00
lawnjelly
22d90711da Make acos and asin safe
A common bug with using acos and asin is that input outside -1 to 1 range will result in Nan output. This can occur due to floating point error in the input.

The standard solution is to provide safe_acos function with clamped input. For Godot it may make more sense to make the standard functions safe.
2023-06-11 08:41:42 +02:00
2e1e153bc3 Make MultiMeshInstance2DNavigationGeometryParser2D use the Geometry singleton. And by proxy clipper 1. 2023-06-07 15:25:32 +02:00
6eb37ff901 Ported clipper2 usage to clipper1 in PandemoniumNavigationMeshGenerator. Also moved them to the Geometry singleton. 2023-06-07 09:20:36 +02:00
59933a9e60 Added grow_by and to_rect2 helper method to Rect2i. 2023-05-30 19:33:12 +02:00
0f6fb760ad Now Basis::get_uniform_scale() returns a real_t instead of a float. 2023-05-29 16:08:59 +02:00
47e637b2b8 Mark the parameters of Basis::rotate_to_align as const ref. 2023-05-29 13:03:26 +02:00
9e326c3000 Apparently Basis::rotate_to_align had a bug. Ported the fix by lyuma from: 6dfa6fc50e 2023-05-28 07:26:04 +02:00
96d1c2d69c Fix small inconsistencies in Vector3/3i/4/4i apis. 2023-05-27 13:26:52 +02:00
33b0d2da34 Added set_all() to Vector3i. 2023-05-27 11:53:16 +02:00
2b24871814 Made the parameter of snap and snapped in Vector3 const reference. 2023-05-27 11:12:31 +02:00
25e57a4268 Added erf to Math. 2023-04-22 13:00:28 +02:00
e80dfcee2e Added a Math singleton exposing math functions directly to scripts. The idea is to make the disrepancies between scripts and engine side code smaller. 2023-04-22 12:47:56 +02:00
4ab9936fc8 Added log10 to the Math class. 2023-04-22 11:00:24 +02:00
d6442bc57c Added Size and Point typedefs for Vector3i and Vector4i. 2023-04-16 16:16:56 +02:00
9118798036 Fix include. 2023-03-12 16:05:58 +01:00
Rémi Verschelde
f3e1aab267 Math: Prevent division by zero in posmod
Fixes #43932.

Co-authored-by: David Hoppenbrouwers <david@salt-inc.org>
(cherry picked from commit f011d8ca9ca25232fb335eead1c8eeaf5c7f2c54)
2023-03-12 15:43:52 +01:00
lawnjelly
4684c72b92 BVH - fix lockguards for multithread mode
Due to a lack of variable name, the BVH lock guards lifetimes previously did not cover the whole function call.
2023-03-12 14:20:02 +01:00
2cd4e4d828 Renamed Set to RBSet. 2023-01-15 19:42:08 +01:00