Commit graph

755 commits

Author SHA1 Message Date
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