summaryrefslogtreecommitdiff
path: root/core/math
AgeCommit message (Collapse)Author
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.
2020-02-18PoolVector is gone, replaced by VectorJuan Linietsky
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
2020-02-13Remove more deprecated methods and codeRémi Verschelde
2020-02-12Remove deprecated decimals builtinRémi Verschelde
Replaced by 'step_decimals' in 3.2 via #21425.
2020-02-11Vulkan: Move thirdparty code out of drivers, style fixesRémi Verschelde
- `vk_enum_string_helper.h` is a generated file taken from the SDK (Vulkan-ValidationLayers). - `vk_mem_alloc.h` is a library from GPUOpen: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
2020-02-11Modified rendering to use cluster instead of fowardJuan Linietsky
2020-02-11Fix code formatting issues and VS compilationRémi Verschelde
Also temporarily disable multicheck build so that we get a full build even when there are style issues on Vulkan. Fixes #33356.
2020-02-11Several fixes to GIProbesJuan Linietsky
2020-02-11Fix Vector3 ambiguities and out of bounds init.bruvzg
2020-02-11GIProbes working.Juan Linietsky
2020-02-11Reflection probes workingJuan Linietsky
2020-02-11Rewrote large part of rendering, omni and spot shadows now work.Juan Linietsky
2020-02-11Yay very basic 3D (only white) finally shows.Juan Linietsky
2020-02-08Merge pull request #35682 from nathanwfranke/canvas-cull-control-fixRémi Verschelde
Fix bug where canvas culls things at origin with size 0
2020-02-07Fix bug where Control at origin with 0 size not renderednathanwfranke
Make a new method instead to make the code more elegant Move Function down a bit
2020-02-05Add do..while(0) wrappers to macros without one.Marcel Admiraal
- Add do..while(0) wrapper to ERR_FAIL_NULL macros. - Add do..while(0) wrapper to ERR_FAIL_COND macros. - Add do..while(0) wrapper to ERR_CONTINUE macros. - Add do..while(0) wrapper to ERR_BREAK macros. - Add do..while(0) wrapper to CRASH_COND macros. - Add do..while(0) wrapper to ERR_FAIL macros. - Add do..while(0) wrapper to ERR_PRINT macros. - Add do..while(0) wrapper to WARN_PRINT macros. - Add do..while(0) wrapper to WARN_DEPRECATED macros. - Add do..while(0) wrapper to CRASH_NOW macros.
2020-01-24Add explanations for errors related to Vector/Quat normalizationHugo Locurcio
2020-01-22Change CameraMatrix::get_viewport_size to get_viewport_half_extentslawnjelly
Fixes #26637. Fixes #19900. The viewport_size returned by get_viewport_size was previously incorrect, being half the correct value. The function is renamed to get_viewport_half_extents, and now returns a Vector2. Code which called this function has also been modified accordingly. This PR also fixes shadow culling when using ortho cameras, because the correct input for CameraMatrix::set_orthogonal should be the full HEIGHT from get_viewport_half_extents, and not half the width. It also fixes state.ubo_data.viewport_size in rasterizer_scene_gles3.cpp to be the width and the height of the viewport in pixels as stated in the documentation, rather than the current value which is half the viewport extents in worldspace, presumed to be a bug.
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-12-29Add ord() function to Expression classDanil Alexeev
The ord() function was recently added in GDScript and VisualScript, but was missed in the Expression class.
2019-12-13Drop b2d_convexdecomp. no longer necessary.Rémi Verschelde
We now use `thirdparty/misc/triangulator.h` for all physics-related (collision, navigation) triangulation needs. Follow-up to #34293.
2019-12-10Merge pull request #34040 from qarmin/unused_variable_more_precise_numbersRémi Verschelde
Removed unused variables, add some constants numbers
2019-12-10Removed unused variables, add some constants numbersRafał Mikrut
2019-12-03Fix severe performance drop while deflating polylinesAndrii Doroshenko (Xrayez)
Underscaled arc tolerance produced very small values so that changes to this parameter were negligible when scaled internally, hence significant performance drop (lots of intermediate points inserted in an arc). Now the performance is mostly the same compared to other types of offsetting (SQUARE, MITER).
2019-11-20Merge pull request #33583 from qarmin/fix_overflows_unitializedRémi Verschelde
Fix some overflows and unitialized variables
2019-11-20Fix some overflows and unitialized variablesRafał Mikrut
2019-11-19Fixed bug caused by a copy/paste error in Face3::get_closest_point_tostoofin
s * edge0 = -d / a * edge0 = -edge0⋅v0 / (edge0⋅edge0) * edge0 = vector projection of -v0 onto edge0 By incorrectly using -e/c instead of -d/a, Face3::get_closest_point_to was returning the wrong point in certain cases. Specifically, I noticed it returning vertex[0] when it should have been returning vertex[1].