Aaron Franke
43722dbcbc
Use float literals for float calculations in Color
2022-10-07 11:28:47 -05:00
bruvzg
0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4.
2022-10-07 11:32:33 +03:00
Aaron Franke
97d232c11d
Enhancements to includes in core data structures
2022-10-05 23:11:02 -05:00
Aaron Franke
2cea42cc7f
Rename Projection matrix
to columns
2022-10-04 12:34:19 -05:00
Rémi Verschelde
a377c5ca22
Merge pull request #66655 from MisterMX/feat/astargrid2d-vector2i
...
refactor(AStarGrid2D): Return `Vector2i` in `get_id_path`
2022-10-03 09:24:40 +02:00
Rémi Verschelde
d9a3888cea
Merge pull request #66133 from aaronfranke/set-all
...
Delete `set_all`, `set_axis`, and `get_axis` methods from Vector2/3/3i/4/4i
2022-10-03 09:23:46 +02:00
MisterMX
bf19a1d3b3
refactor(AStarGrid2D): Return Vector2i in get_id_path
...
Signed-off-by: MisterMX <mbxd12@web.de>
2022-09-30 12:02:28 +02:00
bruvzg
ea1848ce0a
Use constexpr
in the conditions with template parameters and sizeof
s to suppress C4127 warnings.
2022-09-29 10:38:21 +03:00
Rémi Verschelde
d9b251c95c
Merge pull request #66544 from lawnjelly/bvh_tree_sibling_warning
...
Fix false flag compiler warning in bvh tree
2022-09-28 20:47:38 +02:00
lawnjelly
d7c6993f58
Fix false flag compiler warning in bvh tree
...
Compiler wrongly warns that sibling_id may be used when uninitialized. This PR sets the value to silence the warning.
2022-09-28 15:33:41 +01:00
Rémi Verschelde
926c1127e9
Merge pull request #66435 from akien-mga/style-header-guards-cleanup
...
Cleanup header guards for consistency
2022-09-26 15:48:56 +02:00
Rémi Verschelde
49fcf4ffad
Style: Cleanup header guards for consistency
...
Fix file names for {Static,Lightmap}RaycasterEmbree.
2022-09-26 13:51:17 +02:00
Yuri Rubinsky
e7e1f84854
Fix processing of some types in math_fieldwise.cpp/fieldwise_assign
2022-09-26 13:22:49 +03:00
lawnjelly
91d252c697
Fix array-bounds warning in BVH
...
Provides a workaround to prevent tripping a compiler warning.
2022-09-22 16:06:25 +01:00
Rémi Verschelde
5408af1407
Style: Ensure consistent formatting with clang-format 15
...
When going from version 14 to 15 it would introduce a tiny change in
`websocket_macros.h` just before the comment re-enabling clang-format,
but this can be solved by just letting it do its work.
Bonus cosmetic change in `math_fieldwise.cpp` where clang-format isn't
used, and bump recommended versions for pre-commit hook to [13; 15].
2022-09-21 12:48:58 +02:00
Aaron Franke
50fb0220ca
Define AXIS_COUNT in all vector types
2022-09-19 17:50:35 -05:00
Aaron Franke
436dcb3286
Remove set_all methods from Vector2/3/4
2022-09-19 15:08:50 -05:00
Aaron Franke
fd8bd27657
Remove set_axis and get_axis methods from Vector2/2i/3/3i/4/4i
2022-09-19 15:08:50 -05:00
Aaron Franke
300fc5e39a
Spacing changes in math_funcs.h
2022-09-19 02:22:50 -05:00
fabriceci
9f1a57d48b
Test, refactor and fix a bug in Basis.get_axis_angle
2022-09-14 12:05:22 +02:00
Yuri Rubinsky
533e3669e7
Fix incorrect heuristic order in AStarGrid2D
2022-09-12 13:16:46 +03:00
Rémi Verschelde
5062aafc2d
Merge pull request #64417 from aaronfranke/has-space
...
Replace AABB/Rect2/Rect2i has_no_* methods with has_* methods
2022-09-06 17:00:44 +02:00
Micky
b6daad8d4b
Rename range_lerp
to remap
2022-09-06 07:19:20 +02:00
Aaron Franke
995b9f94e8
Replace Rect2(i) has_no_area with has_area
2022-09-04 23:03:36 -05:00
Aaron Franke
817ae95667
Replace AABB has_no_volume with has_volume
...
Also replace has_no_surface with has_surface
2022-09-04 23:03:36 -05:00
Aaron Franke
058ac331b0
Minor fixes to Vector4
2022-09-04 20:38:44 -05:00
Jonathan Nicholl
15d057c521
Add is_zero_approx
methods to Vector2
, 3
, and 4
2022-09-02 00:29:50 -04:00
Johan Aires Rastén
b7e2d45233
Replace Vector2(i) with Size2(i) for methods returning a size
2022-09-01 20:04:17 +02:00
Rémi Verschelde
f02134a8c0
Merge pull request #55617 from madmiraal/fix-55384
2022-09-01 18:20:01 +02:00
Rémi Verschelde
0c221f0284
Merge pull request #65124 from zhehangd/fix_basis
2022-09-01 09:36:11 +02:00
Zhehang Ding
69fe6336f1
Basis constructor: row vectors -> column vectors
2022-08-31 21:20:25 -07:00
Silc Renew
c139d9ef7d
Discontinued spherical_interpolate_with in Transform3D
2022-08-31 16:35:38 +09:00
Yuri Rubinsky
4d7c1b92e9
Implement AStarGrid2D
class with jump-point pathfinding
2022-08-30 17:29:23 +03:00
Marcel Admiraal
0046d320bb
Fix Geometry3D::get_closest_points_between_segments() returns NaN
...
Also fix:
- Geometry3D::get_closest_distance_between_segments() returning
incorrect values.
- Test for Geometry3D::get_closest_distance_between_segments() testing for
an incorrect value.
2022-08-30 12:13:11 +01:00
Silc Renew
931fb4dc11
Add linear/cubic angle interpolation to Animation interpolation type
2022-08-27 07:58:22 +09:00
Micky
59e11934d8
Rename str2var
to str_to_var
and similar
...
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.
- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`
- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
Rémi Verschelde
b9919fd87d
Merge pull request #64678 from TokageItLab/implement-ease-baker
...
Fix Quaternion Tween and add Easing baker to AnimationTrackEditor
2022-08-23 09:19:21 +02:00
kobewi
8be27dc59e
Replace Array return types with TypedArray
2022-08-22 22:42:36 +02:00
Rémi Verschelde
7b4927bb5f
Merge pull request #60309 from The-O-King/oct
2022-08-22 19:29:21 +02:00
Rémi Verschelde
944bfc6d00
Merge pull request #63602 from TokageItLab/cubic-interp-time
2022-08-22 17:32:47 +02:00
Silc Renew
f7dd83ce60
Fix Quaternion Tween and implement ease baker
2022-08-22 19:04:58 +09:00
rafallus
da7a5653f4
Expose Basis set_orthogonal_index
method as a GridMap function
2022-08-20 21:42:20 -05:00
Silc Renew
dded7c72c1
Make cubic_interpolate()
consider key time in animation
2022-08-19 14:48:37 +09:00
Omar El Sheikh
78881b3cc3
Octahedral Normal/Tangent Compression
...
Implementation of Octahedral normal compression into Godot 4.0
2022-08-13 08:09:32 -07:00
antonWetzel
40a1d6d100
vector4 distance_squared_to and update csharp
2022-08-09 01:59:17 +02:00
Hendrik Brucker
36061c5dca
Vector4/Vector4i: Add missing methods, tests and fix change of sign operator
2022-08-07 12:25:05 +02:00
Aaron Franke
88f5b0d563
Check if the axis is zero / vectors are colinear in Vector3 slerp
2022-08-04 14:32:54 -05:00
Fabian Keller
f242f9c738
Fix consistency of translated/scaled/rotated in Transform2D and Transform3D
2022-08-02 23:38:14 +02:00
Raul Santos
2e5cf62dee
Fix Vector4::min_axis_index
for equal components
...
The documentation says if all components are equal it must return AXIS_W but it was returning AXIS_X.
2022-08-01 04:50:17 +02:00
Silc Renew
90dc2f961e
Make spherical_cubic_interpolate()
more stable
2022-07-29 17:39:22 +09:00
Rémi Verschelde
a5f12f9c21
Merge pull request #63532 from TokageItLab/rename-cubic-slerp
2022-07-28 10:39:33 +02:00
Rémi Verschelde
199ea349f5
Merge pull request #57698 from bluenote10/feature/rename_translated_to_translated_local
2022-07-28 10:03:07 +02:00
Rémi Verschelde
13a9d5e3c0
Merge pull request #63378 from nathanfranke/t3d-errors
...
Add equal checks to Transform3D::looking_at and Transform3D::set_look_at, fixes misleading error.
2022-07-28 09:25:25 +02:00
Silc Renew
4211e68d80
rename and unify notation for spherical interpolation
2022-07-27 23:22:50 +09:00
Rémi Verschelde
89527db8d3
Merge pull request #63380 from V-Sekai/fix-cubic-slerp-dot
2022-07-27 13:20:02 +02:00
Rémi Verschelde
1c57d90e85
Merge pull request #63463 from KoBeWi/Vector5
...
Add some missing Vector4 methods
2022-07-27 10:45:39 +02:00
Rémi Verschelde
cda723d201
Color: Fix resetting alpha when setting H/S/V separately
...
Fixes #63487 .
2022-07-26 15:43:49 +02:00
kobewi
7006f7d693
Add some missing Vector4 methods
2022-07-26 02:35:42 +02:00
Nathan Franke
4b13a6dcb8
add equal checks to Transform3D::looking_at and Transform3D::set_look_at
2022-07-25 13:39:40 -05:00
Ricardo Buring
178405f7cb
Fixup BVH debugging statements
2022-07-25 18:21:53 +02:00
Silc 'Tokage' Renew
e252d4e6fe
Fix cubic_slerp
...
Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
Co-authored-by: Pasi Nuutinmaki <gnssstylist@sci.fi>
2022-07-25 22:44:39 +09:00
Rémi Verschelde
90019676b0
Code quality: Fix header guards consistency
...
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
reduz
455c06ecd4
Implement Vector4, Vector4i, Projection
...
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02:00
Yuri Rubinsky
ccc56cc6d4
Rename epsilon
to tolerance
in the Plane::has_point
method
2022-07-21 20:15:15 +03:00
fabriceci
db7c91e0ad
Fix the calculation of the angular velocity when the rotation speed is not high.
2022-07-19 10:27:13 +02:00
Fabian Keller
2bf9e6090c
rename translate(d) to translate(d)_local in Transform 2D/3D
2022-07-16 11:47:54 +02:00
lawnjelly
1f69666209
Remove Octree
...
Octree is no longer used in 4.x.
2022-07-06 14:10:05 +01:00
cdemirer
0ccde38668
Expression built-in functions can also be considered as identifiers in subscripts
2022-07-04 13:25:43 +03:00
Rémi Verschelde
b863c40356
Merge pull request #62468 from V-Sekai/core-const-expressions
...
Add a const call mode to Object, Variant and Script.
2022-06-28 01:08:24 +02:00
Rémi Verschelde
25baa32db0
Merge pull request #62458 from Geometror/interpolation-function-cleanup
...
Refactor Bezier interpolation functions
2022-06-27 23:25:33 +02:00
K. S. Ernest (iFire) Lee
9ddebc0c22
Add a const call mode to Object, Variant and Script.
...
For this to work safely (user not call queue_free or something in the expression), a const call mode was added to Object and Variant (and optionally Script).
This mode ensures only const functions can be called, making it safe to use from the editor.
Co-Authored-By: reduz <reduzio@gmail.com>
2022-06-27 13:33:06 -07:00
Hendrik Brucker
99ce0df3b1
Refactor bezier interpolation functions
2022-06-27 19:42:43 +02:00
reduz
7acf697479
Fix VECTOR/LOCAL transitions in Node3D
...
Fixes #62225 , supersedes #62227
2022-06-27 13:45:35 +02:00
reduz
3d1ab570b9
Add surface indices to TriangleMesh
...
Helps unblock #56597
2022-06-22 21:48:23 +02:00
reduz
141c375581
Clean up Hash Functions
...
Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934
* Clean up usage of murmur3
* Fixed usages of binary murmur3 on floats (this is invalid)
* Changed DJB2 to use xor (which seems to be better)
2022-06-20 12:54:19 +02:00
Marcel Admiraal
d3f0994572
Ensure AudioFrame variables l and r are always initialised
2022-06-17 17:36:11 +01:00
Yuri Rubinsky
4be41a9a97
Remove redundand header from a_star.h
2022-06-16 17:23:08 +03:00
Yuri Rubinsky
7da2a21425
Make AStar to use 64-bit logic
2022-06-16 16:43:41 +03:00
Rémi Verschelde
1ad6fade00
Merge pull request #58669 from theraot/ASar2Dbidirectional
...
AStar2D bidirectional
2022-06-16 12:46:51 +02:00
Yuri Rubinsky
09418afbc0
Fix wrapf
to correct wrap values with 0.1 stepping
2022-06-08 17:11:55 +03:00
Rémi Verschelde
c8ce7e34e2
i18n: Misc fixes translation strings
...
Adds some translator comments to solve some questions raised on Weblate.
2022-06-08 12:57:54 +02:00
Rémi Verschelde
5ebdfc31b2
Merge pull request #61319 from JFonS/taa_wip
...
Initial TAA implementation
2022-06-07 20:53:55 +02:00
K. S. Ernest (iFire) Lee
1b776a6e7a
Allow picking similar colours using OKHSL.
2022-06-07 05:53:27 -07:00
jfons
ba832d83b2
Initial TAA implementation
...
Initial TAA support based on the implementation in Spartan Engine.
Motion vectors are correctly generated for camera and mesh movement, but there is no support for other things like particles or skeleton deformations.
2022-06-07 13:14:44 +02:00
reduz
45af29da80
Add a new HashSet template
...
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
Aaron Record
900c676b02
Use range iterators for RBSet in most cases
2022-05-19 12:09:16 +02:00
reduz
746dddc067
Replace most uses of Map by HashMap
...
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
(order matters) but use is discouraged.
There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
Yuri Roubinsky
dbd7a31507
Implement exponential operator (**) to GDScript/Expressions
2022-05-11 16:30:37 +03:00
Rémi Verschelde
d8935b27a9
Fix warnings found by Emscripten 3.1.10
...
Fix `-Wunused-but-set-variable`, `-Wunqualified-std-cast-call`, and
`-Wliteral-range` warnings.
2022-05-10 13:03:13 +02:00
smix8
868fe4942c
Allow AStar2D/AStar3D zero point weight
...
Allow AStar2D/AStar3D zero point weight.
Limit was set to 1 which seemed like an arbitrary value as lower values down to zero can be useful for common gameplay navigation elements like teleports.
2022-05-06 02:33:10 +02:00
Rémi Verschelde
e7a58a7eb6
Core: Rename math 'phi' arguments to 'angle'
2022-05-05 14:17:39 +02:00
Aaron Franke
fa7a7795f0
Rename Basis get_axis to get_column, remove redundant methods
2022-05-03 09:37:47 -05:00
Rémi Verschelde
931838b330
Merge pull request #60627 from aaronfranke/rename-elements
...
Rename Transform2D and Basis `elements` to `columns` and `rows` respectively
2022-05-03 14:40:01 +02:00
Rémi Verschelde
c273ddc3ee
Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init
...
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.
Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.
Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
Aaron Franke
1bf94dff3a
Rename Basis "elements" to "rows"
2022-04-29 08:02:56 -05:00
Aaron Franke
b831fb0a54
Rename Transform2D "elements" to "columns"
2022-04-29 08:02:39 -05:00
bruvzg
de4c97758a
Fix more issues found by cppcheck.
2022-04-20 10:34:00 +03:00
Rémi Verschelde
46ef52162e
Color: Rename to_srgb
/to_linear
to include base color space
...
This helps reduce confusion around sRGB <> Linear conversions by making
both input and output color spaces explicit.
2022-04-13 11:45:52 +02:00
SaracenOne
8fbed3d582
Rearrange TriangleMesh stack level incrementation to fix MSVC compiler optimization bug
2022-04-13 05:48:49 +01:00
bruvzg
f851c4aa33
Fix some issues found by cppcheck.
2022-04-06 14:34:37 +03:00
Rémi Verschelde
099b024a2b
Fix DynamicBVH crash after #59867
...
I made a wrong assumption that initialization the other pointer in the
union would properly initialize the `childs` array.
2022-04-05 02:17:34 +02:00
Rémi Verschelde
f8ab79e68a
Zero initialize all pointer class and struct members
...
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
lawnjelly
109d08c84a
Add protective checks for invalid handle use in BVH
...
Adds DEV_ASSERTS that will halt at runtime if the BVH is misused with invalid IDs, and adds ERR_FAIL macros to prevent calling with invalid IDs.
Any such misuse is a bug in the physics, but this should flag any errors quickly.
2022-03-23 09:19:26 +00:00
Yuri Roubinsky
7913e04950
Rename AStar
to AStar3D
2022-03-20 17:34:40 +03:00
Rémi Verschelde
5c4de463fe
Merge pull request #59229 from taigi100/Bugfix-#59215-Standard-color-name-returns-non-standard-color-code
2022-03-17 11:38:06 +01:00
taigi100
bd247fa315
Update color constants to use HEX codes
2022-03-17 11:36:23 +02:00
Silc 'Tokage' Renew
b06d253920
Fix blend animation to solve TRS track bug & blend order inconsistency
2022-03-16 05:11:55 +09:00
reduz
21637dfc25
Remove VARIANT_ARG* macros
...
* Very old macros from the time Godot was created.
* Limited arguments to 5 (then later changed to 8) in many places.
* They were replaced by C++11 Variadic Templates.
* Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
* Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-09 18:39:13 +01:00
Rémi Verschelde
4e3d5a9a2c
VariantUtility: Unexpose Math::range_step_decimals
...
This method was meant only as a convenience for editor code
to allow using a step of 0 to disable snapping.
It was exposed by mistake when refactoring GlobalScope.
2022-03-07 22:13:49 +01:00
lawnjelly
0565676893
Protection for array operator for Vector2 / 3 in DEV builds
...
A previous PR had changed the array operator to give unbounded access. This could cause crashes where old code depended on this previous safe behaviour.
This PR adds DEV_ASSERT macros for out of bound access to DEV builds, allowing us to quickly identify bugs in calling code, without affecting performance in release or release_debug editor builds.
2022-03-07 11:15:45 +00:00
Rémi Verschelde
0d1e3893d9
Merge pull request #57630 from lawnjelly/bvh4_templated_checks
...
[4.x] BVH - Sync BVH with 3.x
2022-03-04 23:29:38 +01:00
Theraot
3590cdfd34
Added missing p_bidirectional to AStar2D methods
...
The methods disconnect_points and are_points_connected now have an optional p_bidirectional parameter matching AStar.
2022-03-01 17:01:32 -05:00
Rémi Verschelde
de9446186d
Merge pull request #58488 from lawnjelly/float_literals_casts
2022-03-01 01:32:07 +01:00
Aaron Franke
061ab30051
Use is_zero_approx and fix spelling in CameraMatrix invert
2022-02-26 12:19:54 -06:00
lawnjelly
1485924a2b
Float literals - fix main primitives to use real_t casting
...
Uses (real_t) casting to ensure appropriate calculations are done in 32 bit where real_t is compiled as 32 bit.
2022-02-24 08:15:10 +00:00
Rémi Verschelde
e031aa06ee
Core: Use forward declares for Vector3/Vector3i
...
Add add Vector3 operator in Vector3i.
2022-02-19 16:47:24 +01:00
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
...
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
Silc 'Tokage' Renew
865da09871
Implement cubic_interpolate() as MathFunc for refactoring
2022-02-12 18:11:17 +09:00
lawnjelly
5298e16e80
Float literals - fix main primitives to use .f
...
Converts float literals from double format (e.g. 0.0) to float format (e.g. 0.0f) where appropriate for 32 bit calculations.
2022-02-10 18:43:19 +00:00
Bartłomiej T. Listwon
51cac0709e
Fix Vector2 and Vector2i coord access via operator[]
2022-02-09 09:17:17 +01:00
Rémi Verschelde
8aa4ed8b5b
Merge pull request #57729 from TechnoPorg/astar-fix-invalid-include
...
Remove a cross include from a_star.cpp
2022-02-07 00:35:42 +01:00
TechnoPorg
5108af42ad
Remove a cross include from a_star.cpp
2022-02-06 15:05:17 -07:00
reduz
8c7268664d
Fix integer vector mul/div operators and bindings.
...
* Vector2i and Vector3i mul/div by a float results in Vector2 and Vector3 respectively.
* Create specializations to allow proper bindings.
This fixes #44408 and supersedes #44441 and keeps the same rule of int <op> float returnig float, like with scalars.
2022-02-06 13:34:41 +01:00
Rémi Verschelde
a0c87d4c11
Merge pull request #57620 from Haydoggo/expression-exp-fix
...
Fix Expression's parsing of positive exponent literals
2022-02-05 10:14:10 +01:00
Hayden
1305ff92f7
Make parser treat all exponent literals as float
2022-02-05 16:34:26 +13:00
Rémi Verschelde
84290fe4b1
Merge pull request #57623 from akien-mga/core-math-struct-em-all
2022-02-04 19:02:57 +01:00
lawnjelly
f8eaab5b47
BVH - Sync BVH with 3.x
...
Templated mask checks and generic NUM_TREES
Fix leaking leaves
2022-02-04 16:51:21 +00:00
Rémi Verschelde
5ddb518496
Core: Make all Variant math types structs
...
Some were declared as structs (public by default) and others as classes
(private by default) but in practice all these math types exposed as
Variants are all 100% public.
2022-02-04 16:48:24 +01:00
Rémi Verschelde
e223bad86d
Core: Move Vector2i to its own vector2i.h
header
...
Also reduce interdependencies and clean up a bit.
2022-02-04 16:32:21 +01:00
Rémi Verschelde
5f56d385b0
Core: Move Rect2i to its own rect2i.h
header
...
And take the opportunity to improve interdependencies a bit with forward
declares where possible.
2022-02-04 14:17:30 +01:00
bruvzg
244db37508
Cleanup and move char functions to the char_utils.h
header.
2022-02-04 11:35:01 +02:00
Hayden Leete
018de19eba
Added hex and bin literal support to Expression parser
...
fixed formatting
2022-02-04 10:49:19 +13:00
Anilforextra
fc27636999
Vectors: Use clear() and has().
...
Use clear() instead of resize(0).
Use has() instead of "find(p_val) != -1".
2022-02-02 00:11:09 +05:45
Rémi Verschelde
8c7cd904f5
Merge pull request #57469 from Sauermann/fix-rect2i-intersect
2022-02-01 00:05:02 +01:00
Markus Sauermann
23a4fe5b27
Fix incorrect Rect2i calculations: intersects and encloses
...
Clarify expand documentation
2022-01-31 19:03:57 +01:00
bruvzg
8e79c5fb8d
Add support for the escaped UTF-16 and UTF-32 Unicode characters in the scripts and expressions.
2022-01-30 20:16:04 +02:00
Omar Polo
bd448e5535
Rename or refactor macros to avoid leading underscores
...
These are not used consistently and some can conflict with
system-specific defines. While here, also delete some unused macros.
2022-01-20 20:29:15 +01:00
lawnjelly
b411a731fe
Add nodiscard to core math classes to catch c++ errors.
...
A common source of errors is to call functions (such as round()) expecting them to work in place, but them actually being designed only to return the processed value. Not using the return value in this case in indicative of a bug, and can be flagged as a warning by using the [[nodiscard]] attribute.
2022-01-20 13:07:49 +00:00
Aaron Franke
252c803d94
Remove zero size checks from Rect2 grow methods
2022-01-14 00:45:05 -06:00
Rémi Verschelde
dbab0a9487
Merge pull request #56740 from AnilBK/camera-pre-allocate
2022-01-13 11:13:31 +01:00
Anilforextra
8a9c9a67ef
CameraMatrix: Pre-allocate Vector in get_projection_planes().
2022-01-13 10:14:59 +05:45
Rémi Verschelde
585231a172
Merge pull request #56492 from akien-mga/remove-author-docstrings
2022-01-12 15:24:17 +01:00
Anilforextra
6c3a0460a8
Use List Initializations for Vectors.
2022-01-12 10:15:12 +05:45
Rémi Verschelde
e1766da4bd
Merge pull request #53618 from aaronfranke/signed-angle-vec3i
...
Add length and length_squared to Vector2i/3i
2022-01-07 01:14:29 +01:00
Rémi Verschelde
b008cb8df6
Merge pull request #55877 from aaronfranke/slerp-same-len
2022-01-07 00:44:26 +01:00
Rémi Verschelde
a01b18a476
Fix typos with codespell
...
Using codespell 2.1.0.
Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
ans
ba
curvelinear
dof
doubleclick
fave
findn
gird
inout
leapyear
lod
merchantibility
nd
numer
ois
ony
que
readded
seeked
statics
2022-01-07 00:12:09 +01:00
Aaron Franke
064036d786
Allow Vector2/3 slerp values to have any length
2022-01-06 11:12:59 -08:00
Aaron Franke
2c52f16464
Add length and length_squared to Vector2i/3i
2022-01-06 10:06:56 -08:00
Rémi Verschelde
6af77c7b09
Merge pull request #53684 from TokageItLab/orthogonal-mode
2022-01-05 16:05:40 +01:00
Rémi Verschelde
ba2bdc478b
Style: Remove inconsistently used @author
docstrings
...
Each file in Godot has had multiple contributors who co-authored it over the
years, and the information of who was the original person to create that file
is not very relevant, especially when used so inconsistently.
`git blame` is a much better way to know who initially authored or later
modified a given chunk of code, and most IDEs now have good integration to
show this information.
2022-01-04 20:42:50 +01:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
...
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Silc 'Tokage' Renew
61759da5b3
Fix some gizmo behavior to make more consistent
2021-12-25 03:24:04 +09:00
great90
10c91f8116
Fix variable name 'max_size' to 'min_size' in aabb
2021-12-19 11:51:14 +08:00
Haoyu Qiu
1fb59d13c2
Fix font preview text color on light background
2021-12-18 00:34:28 +08:00
Nathan Franke
41a20171eb
align to horizontal_alignment, valign to vertical_alignment, related
2021-12-09 01:38:46 -06:00
Aaron Franke
24f57886d0
Expose max_axis_index and max_axis_index for Vector2(i)
...
Some cleanup with Vector3(i)'s methods so that it is consistent with Vector2, for example it returns enums internally (GDScript still gets ints).
2021-12-02 23:45:41 -06:00
Rémi Verschelde
892a5a72cd
Merge pull request #55474 from akien-mga/copy-operators-no-reference
2021-12-02 17:34:45 +01:00
Max Hilbrunner
837e6bdf18
Merge pull request #37626 from aaronfranke/rect2-warnings
...
Print warnings when using a Rect2 or AABB with a negative size
2021-12-02 14:41:02 +01:00
Rémi Verschelde
49d8925713
Merge pull request #47294 from sebastian-heinz/patch-1
2021-12-02 10:04:17 +01:00
Rémi Verschelde
02d6cbfd8c
Merge pull request #38604 from Calinou/astar-rename-get-point-ids
2021-12-02 09:35:57 +01:00
sebastian-heinz
be90aadbcd
allow variant construction in expressions
2021-12-02 15:30:10 +08:00
Raul Santos
a367378f9e
Rename Vector parameters to be consistent
...
Renames parameters that were named differently across different
scripting languages or their documentation to use the same name
everywhere.
2021-12-01 21:14:46 +01:00
Aaron Franke
9687f6fca3
Warn when using an AABB or Rect2 with a negative size
2021-11-30 18:27:58 -06:00
Hugo Locurcio
89849a9ed9
Rename AStar.get_points()
to AStar.get_point_ids()
for clarity
...
The same has been done for AStar2D as well.
2021-11-30 22:14:39 +01:00
Rémi Verschelde
7da392bcc5
Don't return reference on copy assignment operators
...
We prefer to prevent using chained assignment (`T a = b = c = T();`) as this
can lead to confusing code and subtle bugs.
According to https://en.wikipedia.org/wiki/Assignment_operator_(C%2B%2B) , C++
allows any arbitrary return type, so this is standard compliant.
This could be re-assessed if/when we have an actual need for a behavior more
akin to that of the C++ STL, for now this PR simply changes a handful of
cases which were inconsistent with the rest of the codebase (`void` return
type was already the most common case prior to this commit).
2021-11-30 16:26:29 +01:00
Lightning_A
e078f970db
Rename remove()
to remove_at()
when removing by index
2021-11-23 18:58:57 -07:00
Rémi Verschelde
2b24629847
Merge pull request #55042 from nekomatata/fix-segment-intersection
2021-11-17 17:33:56 +01:00
Yuri Roubinsky
a74acca858
Expose randfn
to global scope
2021-11-17 14:29:19 +03:00
PouleyKetchoupp
6d0c93dccf
Fix segment intersection in Geometry2D
...
Doing a multiplication to reduce the amount of tests was causing
precision which lead to 2D raycast detecting false positive contacts
in some cases with convex polygons.
2021-11-16 18:09:33 -07:00
Hugo Locurcio
8fb7e622a6
Rename built-in SGN()
macro to SIGN()
...
This matches the name of the GDScript function (except it's uppercase
here).
2021-11-16 20:40:49 +01:00
Rémi Verschelde
d975b1bc37
Merge pull request #43072 from KoBeWi/point_to_angle
2021-11-15 09:56:21 +01:00
Rémi Verschelde
e2e9b08cc7
Color: Bind from_hsv
as static method
2021-11-11 11:50:02 +01:00
Rémi Verschelde
06a33e590f
Merge pull request #53819 from TokageItLab/re-implement-ping-pong
...
Reimplement ping-pong animation and reverse playback
2021-11-09 22:11:04 +01:00
Tomasz Chabora
606cfa9a47
Fix Vector2.angle_to_point() being reversed
2021-11-09 16:59:58 +01:00
Brian Semrau
dc11e73bf0
Rename AABB get_area
to get_volume
2021-11-05 18:22:42 -04:00
Aaron Franke
744b43b527
Fix Quaternion multiplication operator
2021-11-04 11:24:46 -05:00
Silc 'Tokage' Renew
953a7bce7e
reimplement ping-pong
2021-11-03 13:39:33 +09:00
Rémi Verschelde
0ae65472e7
clang-format: Enable BreakBeforeTernaryOperators
...
clang-format keeps breaking the way it handles break *after* ternary operators,
so I give up and go with the only style they seem to actually test.
2021-10-28 15:57:41 +02:00
Rémi Verschelde
3a6be64c12
clang-format: Various fixes to comments alignment from clang-format
13
...
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 15:43:36 +02:00
Rémi Verschelde
3b11e33a09
clang-format: Disable alignment of operands, too unreliable
...
Sets `AlignOperands` to `DontAlign`.
`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 15:19:35 +02:00
reduz
d03b7fbe09
Refactored Node3D rotation modes
...
* Made the Basis euler orders indexed via enum.
* Node3D has a new rotation_order property to choose Euler rotation order.
* Node3D has also a rotation_mode property to choose between Euler, Quaternion and Basis
Exposing these modes as well as the order makes Godot a lot friendlier for animators, which can choose the best way to interpolate rotations.
The new *Basis* mode makes the (exposed) transform property obsolete, so it was removed (can still be accessed by code of course).
2021-10-25 14:34:00 -03:00
Rémi Verschelde
24fdedfe94
Merge pull request #54050 from reduz/animation-compression
2021-10-25 14:27:58 +02:00
reduz
a69541da4c
Implement Animation Compression
...
Roughly based on https://github.com/godotengine/godot-proposals/issues/3375 (used format is slightly different).
* Implement bitwidth based animation compression (see animation.h for format).
* Can compress imported animations up to 10 times.
* Compression format opens the door to streaming.
* Works transparently (happens all inside animation.h)
2021-10-21 18:27:34 -03:00
Marcel Admiraal
87a4ba492e
Remove unimplemented methods
2021-10-21 18:44:25 +01:00
mennomax
b4eeeb315a
Swap args of Plane(point, normal) constructor
...
Now (normal, point)
2021-10-15 20:49:42 -05:00
Juan Linietsky
610de0974d
Revert "Implement reverse playback and ping-pong loop in AnimationPlayer and NodeAnimation"
2021-10-11 19:27:50 -03:00
Tokage
372ba76663
implement ping-pong loop in animation
...
Co-authored-by: Chaosus <chaosus89@gmail.com>
2021-10-09 18:08:43 +09:00
Hugo Locurcio
bcf4a56c74
Replace references to VisualServer in code comments with RenderingServer
...
VisualServer no longer exists in the `master` branch.
2021-10-07 15:49:41 +02:00
Lightning_A
c63b18507d
Use range iterators for Map
2021-09-30 15:09:12 -06:00
Juan Linietsky
c370b4c4d0
Merge pull request #52544 from JFonS/lod_fixes
...
Auto LOD fixes and improvements
2021-09-30 14:49:11 -03:00
PouleyKetchoupp
d3c6395dcd
Fix buffer overflow in 2D BVH
...
Some areas of code were missed and assumed Vector3.
2021-09-29 12:10:23 -07:00
jfons
9e1810695c
Auto LOD fixes and improvements
...
* Fixed LODs for shadow meshes.
* Added a merging step before simplification. This helps with tesselated
meshes that were previously left untouched. The angle difference at
wich edges ar considered "hard" can be tweaked as an import setting.
* LODs will now start with the highest decimation possible and keep
doubling (approximately) the number of triangles from there. This
makes sure that very low triangle counts are included when possible.
* Given more weight to normal preservation.
* Modified MeshOptimizer to report distance-based error instead of
including attributes in the reported metrics.
* Added attribute transference between the original mesh and the
various LODs. Right now only normals are taken into account,
but it could be expanded to other attributes in the future.
2021-09-27 17:04:56 +02:00
John Wigg
ccf05aeb9a
Fix Face3::get_random_point_inside()
...
Use correct overload of Math::random(from, to) to return floating point values within the correct range.
2021-09-24 21:41:17 +02:00
Rémi Verschelde
32ab77ef8f
Merge pull request #52430 from AnilBK/vector2-replacements
2021-09-24 13:04:42 +02:00
Anilforextra
cc51b045da
Construct values only when necessary.
2021-09-23 22:26:07 +05:45
Rémi Verschelde
ba57252bd8
Merge pull request #52878 from AnilBK/add-get-center
2021-09-21 21:30:30 +02:00
Anilforextra
90908cd67d
Add Get Center Method for Rect2/Rect2i and AABB.
2021-09-21 21:14:17 +05:45
Rémi Verschelde
89417ba75b
Merge pull request #52398 from deakcor/dev-transform
2021-09-20 08:46:51 +02:00
Vincent D
aa82cb6f35
Expose get_skew for transform2d and add new constructor
...
Expose set_scale and set_skew for transform2d
Replacing float by real_t
Adding const parameters
Updated transform2d doc
2021-09-19 17:10:05 +02:00
Aaron Franke
bf0213470c
Replace Vector3.to_diagonal_matrix with Basis.from_scale
2021-09-17 10:30:30 -05:00