summaryrefslogtreecommitdiff
path: root/core/math
AgeCommit message (Collapse)Author
2020-07-27Make all String float conversion methods be 64-bitAaron Franke
2020-07-25GDScript: Clarified/fixed inaccuracies in the built-in function docs.Meriipu
The input to smoothstep is not actually a weight, and the decscription of smoothstep was pretty hard to understand and easy to misinterpret. Clarified what it means to be approximately equal. nearest_po2 does not do what the descriptions says it does. For one, it returns the same power if the input is a power of 2. Second, it returns 0 if the input is negative or 0, while the smallest possible integral power of 2 actually is 1 (2^0 = 1). Due to the implementation and how it is used in a lot of places, it does not seem wise to change such a core function however, and I decided it is better to alter the description of the built-in. Added a few examples/clarifications/edge-cases.
2020-07-21Update core documentation to match recent C# changesAaron Franke
Also a few minor API changes like adding AABB.abs() Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-07-01Merge pull request #38713 from aaronfranke/string-64bitRémi Verschelde
Make all String integer conversion methods be 64-bit
2020-06-26Addition of SDFGI for open world global illuminationJuan Linietsky
Move GI to a deferred pass
2020-06-25Style: Fix copyright headersRémi Verschelde
2020-06-17Simplify Transform2D get_rotationAaron Franke
2020-06-12- Added more euler rotation orders support.Andrea Catania
- Fixed floating point issue on the old one. - Fixed the equation on the get_euler_yxz function. - Added unit tests. This work has been kindly sponsored by IMVU.
2020-06-11Merge pull request #39230 from ntfshard/expression_string_singlequoteRémi Verschelde
Fix for Expression class: string inside an expression can't be single quoted
2020-06-09AStar: Make get_closest_point() deterministic for equidistant pointsRémi Verschelde
Closes godotengine/godot-docs#3667. Supersedes #39405.
2020-06-03Remove 32-bit String to_int methodAaron Franke
2020-06-02Fix for Expression class: inner string can be single quotedntfs.hard
2020-05-27Split `Geometry` singleton into `Geometry2D` and `Geometry3D`Andrii Doroshenko (Xrayez)
Extra `_2d` suffixes are removed from 2D methods accoringly.
2020-05-19Style: Remove unnecessary semicolons from `core`Rémi Verschelde
Semicolons are not necessary after function definitions or control flow blocks, and having some code use them makes things inconsistent (and occasionally can mess up `clang-format`'s formatting). Removing them is tedious work though, I had to do this manually (regex + manual review) as I couldn't find a tool for that. All other code folders would need to get the same treatment.
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-14Style: Fix missing/invalid copyright headersRémi Verschelde
2020-05-14Modernize remaining uses of 0/NULL instead of nullptr (C++11)Rémi Verschelde
Using clang-tidy's `modernize-use-nullptr`. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2020-05-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
2020-05-11thirdparty: Cleanup after #38386, document provenance and copyrightRémi Verschelde
Also renamed `delaunay.h` to `delaunay_2d.h` to match the class name.
2020-05-10New lightmapperJuan Linietsky
-Added LocalVector (needed it) -Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too) -Fixes and changes all around the place -Added library for 128 bits fixed point (required for Delaunay3D)
2020-05-10Revert "Renamed plane's d to distance"Rémi Verschelde
This reverts commit ec7b481170dcd6a7b4cf0e6c1221e204ff7945f3. This was wrong, `d` is not a distance but the `d` constant in the parametric equation `ax + by + cz = d` describing the plane.
2020-05-10Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde
Part of #33027.
2020-05-10Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde
Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10Renamed plane's d to distanceMarcus Elg
2020-05-04Check for empty vectors before trying to access a pointer to the firstMarcel Admiraal
element in Octree<T, use_pairs, AL>::cull_convex().
2020-05-01Implement Skew in Node2DJuan Linietsky
Skew is x-axis only, because it must be bidirectionally convertible to a 2x3 matrix, but you can subtract it to the rotation to get the effect on y-axis
2020-04-29Fixed false positives in the culling system.Kiri Jolly
This fixes numerous false positives coming out of the culling system. AABB checks are now a full separating-axis check against the frustum, with the points of the frustum being compared to the planes of the box just as the points of the box were being compared to the planes of the frustum. This fixes large objects behind the camera not being culled correctly. Some systems that used frustums that were (sometimes mistakenly?) unbounded on one or more side have been modified to be fully enclosed.
2020-04-29[Core] Rename linear_interpolate to lerpAaron Franke
2020-04-21Improve the Vector2 rotated codeAaron Franke
2020-04-14Remove unnecessary check for zero determinant in Basis::orthonormalize().Marcel Admiraal
2020-04-05Fix aspect ratio on hmd projection matrixBastiaan Olij
(cherry picked from commit a7438f0e61fca161b6324a230b8914e4f6c56b3f)
2020-04-02Replace NULL with nullptrlupoDharkael
2020-04-02Merge pull request #37504 from qarmin/out_of_bound_cursorRémi Verschelde
Fix array out of bounds access caused by uninitialised variables
2020-04-01Fix out of bound array access caused by unassigned variableRafał Mikrut
2020-03-30SCons: Format buildsystem files with psf/blackRémi Verschelde
Configured for a max line length of 120 characters. psf/black is very opinionated and purposely doesn't leave much room for configuration. The output is mostly OK so that should be fine for us, but some things worth noting: - Manually wrapped strings will be reflowed, so by using a line length of 120 for the sake of preserving readability for our long command calls, it also means that some manually wrapped strings are back on the same line and should be manually merged again. - Code generators using string concatenation extensively look awful, since black puts each operand on a single line. We need to refactor these generators to use more pythonic string formatting, for which many options are available (`%`, `format` or f-strings). - CI checks and a pre-commit hook will be added to ensure that future buildsystem changes are well-formatted.
2020-03-25Style: Harmonize header guards to style guide [Core]Rémi Verschelde
2020-03-19Merge pull request #37039 from Chaosus/astar2d_costRémi Verschelde
Implements estimate/compute_cost for AStar2D
2020-03-17Style: Set clang-format Standard to Cpp11Rémi Verschelde
For us, it practically only changes the fact that `A<A<int>>` is now used instead of the C++03 compatible `A<A<int> >`. Note: clang-format 10+ changed the `Standard` arguments to fully specified `c++11`, `c++14`, etc. versions, but we can't use `c++17` now if we want to preserve compatibility with clang-format 8 and 9. `Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-14Implements estimate/compute_cost for AStar2DYuri Roubinsky
2020-03-12Merge pull request #36994 from akien-mga/typedefs-cleanupRémi Verschelde
typedefs: Cleanup unused macros and unnecessary checks
2020-03-11typedefs: Cleanup unused macros and unnecessary checksRémi Verschelde
We now require a compiler with C++17 support, so we don't need to check for features added to GCC 5 or Clang 3.2. Clang builtin availability checks were unused anyway as Clang defines `__GNUC__` as it's also a GNU C implementation. Fixes #36986.
2020-03-11Fix various typosluz.paz
Found via `codespell`
2020-03-04Turn Rect2's 'intersects_touch()' into an extra argument of 'intersects()'Michael Alexsander
2020-02-25Merge pull request #36515 from reduz/packed-array-64-bitsRémi Verschelde
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
2020-02-25Expression: Fix parsing integers as 32-bitRémi Verschelde
2020-02-25Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky
- Renames PackedIntArray to PackedInt32Array. - Renames PackedFloatArray to PackedFloat32Array. - Adds PackedInt64Array and PackedFloat64Array. - Renames Variant::REAL to Variant::FLOAT for consistency. Packed arrays are for storing large amount of data and creating stuff like meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of memory. That said, many users requested the ability to have 64 bits packed arrays for their games, so this is just an optional added type. For Variant, the float datatype is always 64 bits, and exposed as `float`. We still have `real_t` which is the datatype that can change from 32 to 64 bits depending on a compile flag (not entirely working right now, but that's the idea). It affects math related datatypes and code only. Neither Variant nor PackedArray make use of real_t, which is only intended for math precision, so the term is removed from there to keep only float.
2020-02-22Add support for Vector2i, Rect2i and Vector3i to VariantJuan Linietsky
WARNING: Requires C++17 'guaranteed copy elision' to fix ambiguous operator problems in Variant. This was added for this commit (and future C++17 uses) in #36457.
2020-02-20Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky
objects and made them default.