Commit graph

1532 commits

Author SHA1 Message Date
Rémi Verschelde
801205b2c1
Merge pull request #48892 from lawnjelly/bvh_robust
BVH - thread safety option
2021-07-22 12:41:42 +02:00
Rémi Verschelde
8cb25a581d
Merge pull request #50724 from Chaosus/varying_fixes_3.x
Backport latest varying fixes to 3.x
2021-07-22 09:29:43 +02:00
Yuri Roubinsky
1e128c80c6 Backport latest varying fixes to 3.x 2021-07-22 08:43:12 +03:00
Cory Petkovsek
096417905b Calculate instance depth after shadow calculation in VisualServer 2021-07-22 08:06:02 +08:00
Rémi Verschelde
f131a77f46
Merge pull request #46574 from The-O-King/split_stream_3.2
[3.4] Split Vertex Buffer Stream in Positions and Attributes
2021-07-20 10:48:37 +02:00
Omar El Sheikh
7f8487a900 Split Vertex Position and Attribute Streams
Implemented splitting of vertex positions and attributes in the vertex
buffer

Positions are sequential at the start of the buffer, followed by the
additional attributes which are interleaved

Made a project setting which enables/disabled the buffer formatting
throughout the project

Implemented in both GLES2 and GLES3

This improves performance particularly on tile-based GPUs as well as
cache performance for something like shadow mapping which only needs
position data

Updated Docs and Project Setting
2021-07-19 13:23:46 -07:00
PouleyKetchoupp
beeebb4c2f More accurate unsafe motion calculation
* Safe and unsafe motion are calculated by dichotomy with a limited
number of steps. It's good for performance, but on long motions that
either collide near the beginning or near the end, the result can be
very imprecise.
* Now a factor 0.25 or 0.75 is used to converge faster when this case
happens, which allows longer motions to get more accurate collision
detection.
* Makes snap collision more precise, and helps with cases where diagonal collision on the border of a platform can lead to the character being stuck.

Additional improvements to move_and_slide:
* Handle slide canceling in move_and_collide with 0 velocity instead of
not applying it.
* Better handling of snap with custom logic to cancel sliding.
* Remove small jittering when using stop on slope, by canceling the
motion completely when the resulting motion is less than margin instead
of always projecting to the up direction (in both body motion and snap).

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-07-19 08:09:17 -07:00
PouleyKetchoupp
2fbb6fff4e Fix move_and_collide causing sliding on slopes
Make sure the direction of the motion is preserved, unless the depth is
higher than the margin, which means the body needs depenetration in any
direction.

Also changed move_and_slide to avoid sliding on the first motion, in
order to avoid issues with unstable position on ground when jumping.

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-07-19 08:09:16 -07:00
Rémi Verschelde
26d0c90370
Merge pull request #50477 from lawnjelly/portals_autolink_order
Portals - fix autolink sprawling, refine logs
2021-07-15 15:22:53 +02:00
lawnjelly
44f9a0f961 Portals - fix autolink sprawling, refine logs
It turned out the new autolinking feature was linking portals AFTER the static meshes had been added to rooms in the PortalRenderer. This meant that large meshes weren't being sprawled across these portals. The fix involves doing the autolinking BEFORE adding the static meshes.

Fixes a bug in the warning for portals being in the wrong direction, they should have only been checkout for outgoing portals. This was resulting in erroneous warnings.

Also the room conversion logs are refined to be more compact and informative.

A warning icon is also added in the gizmo for portals where autolink fails.
2021-07-15 13:04:05 +01:00
fabriceci
fba4c9d552 Fixing 2D moving platform logic
Fixing by applying the movement in two steps, first the platform
movement, and then the body movement. Plus, add the platform movement
when we are on_wall.
2021-07-15 11:57:58 +02:00
Rémi Verschelde
a3310c1da2
Merge pull request #46130 from lawnjelly/portals
Portal occlusion culling [3.4]
2021-07-14 13:38:01 +02:00
lawnjelly
eb6f98ec55 Portal occlusion culling
Adds support for occlusion culling via rooms and portals.
2021-07-14 11:43:23 +01:00
Rémi Verschelde
aa3a5c9f6a
Merge pull request #50184 from JFonS/cpu_lightmapper_soft_shadows
[3.x] Add soft shadows to the CPU lightmapper
2021-07-14 12:18:08 +02:00
Rémi Verschelde
b0b2b7df31
Merge pull request #50257 from Calinou/physicsserver3d-add-set-iterations-3.x
Add a method to set the number of physics solver iterations in 3D (3.x)
2021-07-14 07:56:57 +02:00
TaskManagerCZ
b444bec1f3
Explicit error message when setting active a Viewport that is already active.
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
(cherry picked from commit e3be0913d7)
2021-07-13 10:20:03 +02:00
Hugo Locurcio
9259b4adc4
Add a method to set the number of physics solver iterations in 3D
This is only for GodotPhysics, and adds a 3D counterpart to the 2D
method that was recently added.
2021-07-10 16:29:41 +02:00
PouleyKetchoupp
9eb6a43cff Remove unused PhysicsShapeQueryResult & Physics2DShapeQueryResult 2021-07-05 11:21:15 -07:00
JFonS
a2ba7910ba Add soft shadows to the CPU lightmapper
Adds the "light_size" property to Lights. It's only considered in baked
lightmaps for soft shadowing purposes.
2021-07-05 19:02:35 +02: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
lawnjelly
14ce176f10 BVH - thread safety option
Added optional thread safe version through template argument and runtime switch, that wraps access with a mutex.
2021-05-25 10:47:32 +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