Commit graph

1513 commits

Author SHA1 Message Date
PouleyKetchoupp 9eb6a43cff Remove unused PhysicsShapeQueryResult & Physics2DShapeQueryResult 2021-07-05 11:21:15 -07:00
PouleyKetchoupp c89476ad41 Expose body_test_motion in 3D physics server
Results are exposed through PhysicsTestMotionResult, the same way it's
done for 2D.

Also cleaned a few things in the 2D version.
2021-07-02 18:04:39 -07:00
Rémi Verschelde cbf6d51d01
Merge pull request #49845 from nekomatata/physics-disabled-shapes-3.x
[3.x] Fix and clean disabled shapes handling in godot physics servers
2021-06-30 10:09:17 +02:00
Rafał Mikrut cb5faca39a
Prevent setting too big or too small Collision Mask and Layer 2021-06-27 17:40:07 +02:00
PouleyKetchoupp 10fdd196b7 Fix and clean disabled shapes handling in godot physics servers
In 3D, disabled shapes are now not added to the broadphase anymore.
Since they are removed right away when disabled, no need to check for
disabled shapes for any query that comes from the broadphase.
Also Fixes raycast queries returning disabled shapes.

In 2D, disabled shapes where already not added to the broadphase.
Remove the same unnecessary checks as in 3D.

Overall harmonized API for disabled shapes in the physics servers and
removed duplicate method.
2021-06-22 16:48:24 -07:00
Marcel Admiraal 8788472b8c Clear glErrors instead of crashing when initializing GLES3 2021-06-21 17:53:24 +01:00
Rémi Verschelde 2827d6be19
Merge pull request #49699 from nekomatata/mass-properties-disabled-shapes-3.x
[3.x] Ignore disabled shapes for mass property calculations
2021-06-18 18:37:56 +02:00
Marcel Admiraal 7e03bd1671 Remove duplicate WARN_PRINTS macro 2021-06-18 12:57:59 +01:00
PouleyKetchoupp c3107349a4 Ignore disabled shapes for mass property calculations 2021-06-17 17:17:05 -07:00
Marcel Admiraal 5a58516231 Remove duplicate ERR_PRINTS macro 2021-06-16 11:56:25 +01:00
Rémi Verschelde c45ce768b1
Merge pull request #47854 from mortarroad/3.x-lossless-webp
[3.x] Implement lossless WebP encoding
2021-06-11 19:35:47 +02:00
Morris Tabor 5de08ef1d6 Implement lossless WebP encoding 2021-06-11 18:48:04 +02:00
Marcel Admiraal 01dd6b0593 Apply infinite inertia checks to Godot physics 3D 2021-06-11 09:24:58 +01:00
PouleyKetchoupp c6bd0fd0f7 Fix uninitialized members in physics query results 2021-06-07 10:40:15 -07:00
Rémi Verschelde 80e1585a6e
Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.

(cherry picked from commit c1c76850cb)
2021-06-07 12:06:59 +02:00
Arkadiusz Marcin Kołek 7f14210a4c
Avoid division by zero when calculating inertias for bodies with colliders without areas.
(cherry picked from commit e347baddf3)
2021-06-01 12:53:31 +02:00
lawnjelly 6e022a382d Fix canvas rect bound calculation
It turns out the calculation of the bounding rect for canvas items has a nasty bug. When a transform is applied (especially in a custom draw), in the renderer this extra matrix is applied to all later commands in the canvas item. However in the calculation of the bound, the transform is only applied to the first command following the transform.

This PR fixes this inconsistency.
2021-05-28 08:44:59 +01:00
Hugo Locurcio a38b447413
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-25 00:31:39 +02:00
Rémi Verschelde 4100a80502
Merge pull request #43506 from QbieShay/fix-depth-sort
[3.x] VisualServer now sorts based on AABB position
2021-05-23 01:23:46 +02:00
Morris Tabor ba396caefc Replace QuickHull with Bullet's convex hull computer.
The code is based on the current version of thirdparty/vhacd and modified to use Godot's types and code style.

Additional changes:
- backported and extended PagedAllocator to allow leaked objects
- applied patch from https://github.com/bulletphysics/bullet3/pull/3037
2021-05-22 08:16:43 +02:00
Rémi Verschelde eb78f80f03
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:56:56 +02:00
Rémi Verschelde cca2a9d2d5
Merge pull request #38387 from Rhathe/set_iterations
[3.x] Enable setting of collision iterations in Physics2DServer
2021-05-19 19:48:08 +02:00
Yuri Roubinsky 2d1f8f2352 Prevents shader crash if two struct with the same name are declared 2021-05-14 11:28:49 -07:00
Yuri Roubinsky ac547031d5 Prevents shader crash if passing invalid struct to the return statement 2021-05-14 11:28:49 -07:00
Yuri Roubinsky ae8de1f2ce Fix shader crash if duplicated struct members created 2021-05-14 11:28:49 -07:00
Lyuma fba6b62054 Backport dd0874e "Allow passing varying from fragment to light shader function" to 3.4 2021-05-14 11:28:48 -07:00
Lyuma 0c028ad96e Backport bc0e8e7 "Fix using post-init shader array constructors" to 3.4 2021-05-14 11:28:48 -07:00
Lyuma 25016bf715 Backport 6b99bda "Added support for arrays as shader struct members" to 3.4 2021-05-14 11:28:48 -07:00
Lyuma fc6bee0750 Backport 6f16239 "Implementation of struct for shaders" to 3.4 2021-05-14 11:28:48 -07:00
Rémi Verschelde 140350d767
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
Bastiaan Olij 8f8c9c2f57 Add VIEW_INDEX variable in shader so we know which eye/view we're rendering for 2021-05-05 16:22:03 +10:00
PouleyKetchoupp 0dacc681b6 Fixed unnecessary bvh tree updates when calling set_pairable
Dynamic BVH doesn't update the tree anymore when calling set_pairable
with no parameter change.

Also modified Godot Physics broadphase to create objects directly with
pairable (static) set correctly to make use of this optimization for the
BVH broadphase.

Note: Octree broadphase doesn't use this optimization because it forces
an update on move, so passing the proper AABB and static parameters on
creation would cause the tree to update twice.
2021-05-04 12:24:31 -07:00
Rémi Verschelde 0c8b5b5c4d
Style: Remove redundant void argument lists
Using clang-tidy's `modernize-redundant-void-arg`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-redundant-void-arg.html
2021-05-04 16:40:33 +02:00
Rémi Verschelde b4af1eba0a
Style: Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2021-05-04 16:39:13 +02:00
Rémi Verschelde a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde 64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 6e600cb3f0
Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
Rémi Verschelde 32cc022267
Merge pull request #48314 from nekomatata/physics-2d-dynamic-bvh
[3.x] Support for Dynamic BVH as 2D Physics broadphase
2021-05-04 09:23:04 +02:00
PouleyKetchoupp d8f681029f Support for Dynamic BVH as 2D Physics broadphase
List of changes:
- Modified bvh class to handle 2D and 3D as a template
- Changes in Rect2, Vector2, Vector3 interface to uniformize template
calls
- New option in Project Settings to enable BVH for 2D Physics (enabled
by default like in 3D)
2021-04-30 15:53:15 -07:00
Rémi Verschelde 594764c2ec
Revert "make 2d constraint solving more deterministic by solving in push order"
This reverts commit 266314ba26.

There seems to be some performance concerns, so reverting the cherry-pick for
now and we'll revisit later (see https://github.com/godotengine/godot/pull/44112#issuecomment-829426790).
2021-04-29 19:12:19 +02:00
Rémi Verschelde e94161dada
SCons: Add explicit dependencies on thirdparty code in cloned env
Since we clone the environments to build thirdparty code, we don't get an
explicit dependency on the build objects produced by that environment.

So when we update thirdparty code, Godot code using it is not necessarily
rebuilt (I think it is for changed headers, but not for changed .c/.cpp files),
which can lead to an invalid compilation output (linking old Godot .o files
with a newer, potentially ABI breaking version of thirdparty code).

This was only seen as really problematic with bullet updates (leading to
crashes when rebuilding Godot after a bullet update without cleaning .o files),
but it's safer to fix it everywhere, even if it's a LOT of hacky boilerplate.

(cherry picked from commit c7b53c03ae)
2021-04-29 16:57:00 +02:00
Rémi Verschelde 70ae90e0e8
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.

Backport of #48239.
2021-04-29 12:34:11 +02:00
Jordan Schidlowsky 266314ba26
make 2d constraint solving more deterministic by solving in push order
(cherry picked from commit 043b6c2d93)
2021-04-29 11:27:56 +02:00
Rémi Verschelde a706fb11e5
Merge pull request #47943 from nekomatata/joint-check-body-types-3.x
[3.x] Fix errors related to joints setup with two non-dynamic bodies
2021-04-28 16:58:23 +02:00
Rémi Verschelde f85d59c97f
Merge pull request #47349 from nekomatata/heightmap-support-3.x
[3.x] Heightmap collision shape support in Godot Physics
2021-04-28 16:57:29 +02:00
Rémi Verschelde 80619a00d7
Merge pull request #47979 from HenryWConklin/3.x-optimize-hashgrid-layers
Optimize BroadPhase2dHashGrid to not pair elements on different layers
2021-04-28 16:57:19 +02:00
Rémi Verschelde 6cb61b67e6
Merge pull request #41471 from Calinou/giprobe-deprecate-compress-3.2 2021-04-28 12:01:55 +02:00
Maganty Rushyendra c5e8a81737
Fix AudioServer Crash when bus count equals 0
(cherry picked from commit ccc375f163)
2021-04-26 13:07:58 +02:00