Commit graph

1675 commits

Author SHA1 Message Date
lawnjelly
036bace9e9 BVH - Fix area-area collision regression
Minimal approach to fixing regression whereby static areas where not detect dynamic areas.
2022-02-26 11:36:27 +00:00
Rémi Verschelde
6ca309e058
Merge pull request #58531 from rburing/area_call_queries_fix_premature_return
[3.x] Godot Physics `AreaSW` and `Area2DSW`: fix premature return in `call_queries`
2022-02-26 09:36:14 +01:00
Ricardo Buring
89ce63a84f AreaSW and Area2DSW: fix premature return in call_queries 2022-02-25 14:41:34 +01:00
Ricardo Buring
e6f1a44b4d In final phase of test_body_motion, move and cull AABB for body once instead of for every shape 2022-02-21 15:03:09 +01:00
Hugo Locurcio
cfba65fa23 Expose AudioServer.capture_device as a property
This is more consistent with `AudioServer.device` (for output),
which is already exposed as a property.

(cherry picked from commit 1d35b37499)
2022-02-19 15:57:36 +01:00
Rémi Verschelde
2dd545b512
Merge pull request #58141 from lawnjelly/occluder_shared_resources 2022-02-16 13:29:55 +01:00
lawnjelly
3c2df49832 Fix Occluder to properly share resources
In order to properly support the resource sharing paradigm, Occluders are split into Instances and Resources in the VisualServer. Instances are owned by a Scenario, and Resources are global. OccluderShape resources can now correctly be shared by multiple OccluderInstances.
2022-02-16 09:55:11 +00:00
lawnjelly
522bce1159 Fixed Timestep Interpolation (3D)
Adds fixed timestep interpolation to the visual server.
Switchable on and off with project setting.

This version does not add new API for set_transform etc, when nodes have the interpolated flag set they will always use interpolation.
2022-02-16 09:41:23 +00:00
Bartłomiej T. Listwon
51d028fce0
Audio quality improvements in PitchShift
(cherry picked from commit 29b6ed9283)
2022-02-15 12:30:17 +01:00
Bartłomiej T. Listwon
6471d0a57a
Pass audio samples untouched for pitch_scale around 1.0f
(cherry picked from commit c02e979dbf)
2022-02-15 12:28:31 +01:00
Rémi Verschelde
7a16bb2ee4
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.

(cherry picked from commit 1bdb82c64e)
2022-02-11 09:50:59 +01:00
Jérémy Zurcher
f9fdd526d5 fix portal_occlusion_culler compilation with target=debug tools=no 2022-02-06 13:22:33 +01:00
Rémi Verschelde
689f59dca0
Merge pull request #53463 from lawnjelly/vital_redraws
Add editor vital redraws only option
2022-02-04 21:42:49 +01:00
Pawel Lampe
6c6e50bf0c Fix navigation merge errors, fixes #56786
- improved `detail/sample_max_error` default value
- improved floating point precision handling in cell key calculations
- improved `merge error` error message
- exposed `cell_height` of `nav_map` to the `Navigation`
- fixed cell key `y` calculation
2022-02-02 23:52:29 +01:00
lawnjelly
a0c6d16c90 Add editor vital redraws only option
When editor continuous redraws is switched off, the editor only redraws when a redraw_request was issued by an element in the scene. This works well in most situations, but when scenes have dynamic content they will continuously issue redraw_requests.

This can be fine on high power desktops but can be an annoyance on lower power machines.

This PR splits redraw requests into high and low priority requests, defaulting to high priority. Requests due to e.g. shaders using TIME are assigned low priority.

An extra editor setting is used to record the user preference and an extra option is added to the editor spinner menu, to allow the user to select between 3 modes:

* Continuous
* Update all changes
* Update vital changes
2022-02-02 11:26:45 +00:00
lawnjelly
8ea20f5fdd Add OccluderShapePolygon
Add OccluderShapePolygon, glue to Occluder and gizmos etc.
2022-02-01 11:31:06 +00:00
Rémi Verschelde
d62166f68f
Merge pull request #57186 from lawnjelly/gameplay_fix_ticks 2022-01-25 11:39:26 +01:00
lawnjelly
38240fd0c8 Portals - Fix gameplay monitor ticking
Due to an optimization to prevent processing except when camera rooms changed, the ticking synchronization and updating of previous and current lists could get out of sync for affected objects, leading to missing gameplay notifications.

This PR adds new paths to properly support and synchronize objects in this "room based" path.
2022-01-25 10:07:50 +00:00
Yuri Roubinsky
85deed9207 Backport some changes to 3.x shaders 2022-01-25 10:34:57 +03:00
Rémi Verschelde
6c0c0c4b29
Merge pull request #54165 from Calinou/directional-shadow-runtime-change-3.x
Allow changing directional shadow size at run-time
2022-01-22 15:25:09 +01:00
Rémi Verschelde
c6480e2166
Merge pull request #57033 from lawnjelly/gameplay_monitor_unload
Portals - fix gameplay monitor unloading
2022-01-21 18:33:50 +01:00
lawnjelly
dc14636e68 BVH templated mask checks and generic NUM_TREES
Refactors the BVH to make it more generic and customizable. Instead of hard coding the system of pairable_mask and pairable_type into the BVH, this information is no longer stored internally, and instead the BVH uses callbacks both for determining whether pairs of objects can pair with each other, and for filtering cull / intersection tests.

In addition, instead of hard coding the number of trees, the BVH now supports up to 32 trees, and each object can supply a tree collision mask to determine which trees it can collide against.

This enables the BVH to scale to either the two or 3 trees needed in physics, and the single tree used without pairing in Godot 4 render tree.
2022-01-21 10:08:29 +00:00
lawnjelly
6c1e243fa2 Portals - fix gameplay monitor unloading
The gameplay monitor wasn't being unloaded correctly in between levels. This meant that exit signals were not being sent, and entered signals for the new level were being missed.

This PR sends appropriate exit signals on unloading, and clear the data.
2022-01-21 09:38:48 +00:00
Haoyu Qiu
ac144e7e8c
Fix invalid read when using LightOccluder2D
(cherry picked from commit 7870cf24f2)
2022-01-19 16:02:54 +01:00
Rémi Verschelde
a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
Rémi Verschelde
b197de6f5f
Fix typos with codespell
Using codespell 2.1.0.

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

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2022-01-07 00:14:54 +01:00
Jake Young
09bc9eb101
Backport NavigationServer with RVO2 to 3.x
Change the entire navigation system.
Remove editor prefix from nav mesh generator class. It is now used for baking
at runtime as well.
Navigation supports obstacle avoidance now with the RVO2 library.
Nav system will also automatically link all nav meshes together to form one
overall complete nav map.
2022-01-05 16:00:56 +01:00
Rémi Verschelde
25369acff9
Merge pull request #51708 from Calinou/viewport-add-32bpc-color-depth 2022-01-04 14:30:24 +01:00
Yuri Roubinsky
0c449befbf Allow pass varyings as out param to the function, when it's possible 2022-01-04 10:22:39 +03:00
Bastiaan Olij
4e4de3430e Fix size issue for ARVR managed viewport 2021-12-19 14:51:10 +11:00
Yuri Roubinsky
25e24f2d05 [3.x] Prevent writing incorrect shader hints 2021-12-16 10:22:01 +03:00
lawnjelly
cbb6dc35a1 Fix add_line width being too wide
The line width of thick lines was being applied on both sides of the line, resulting in a line that was twice as thick as requested.

This PR fixes this embarrassing oversight.
2021-12-14 12:35:02 +00:00
Rémi Verschelde
4ebee76370
Merge pull request #55822 from Chaosus/shader_fix_semicolon_3.x 2021-12-12 21:10:38 +01:00
Yuri Roubinsky
933fd6be75 [3.x] Restore shader parsing errors with lack of semicolon in a block 2021-12-11 18:05:49 +03:00
lawnjelly
26e93dc5c6 Fix lighting_dirty flag bug
In rare circumstances, changing the geometry data attached to an instance, there was the opporunity for the lighting_dirty flag to get out of sync, which could lead to access to a stale light RID, and warnings or worse.

This PR fixes the problem by ensuring the lighting is always updated on the instance when first adding GeometryData.
2021-12-11 11:27:21 +00:00
PouleyKetchoupp
e11662ad77
Handle test body motion with 0 margin
Margin needs to have a high enough value for test body motion to work
properly (separate using the margin, move without then gather rest info
with the margin again).

Fixes issues with test motion returning no collision in some cases with
margin equal to 0.

(cherry picked from commit 0c354047e1)
2021-12-10 11:16:35 +01:00
lawnjelly
3d981b8265 Add option to use handles to RID
Adds an option to compile an alternative implementation for RIDs, which allows checks for erroneous usage patterns as well as providing leak tests.
2021-12-06 14:43:34 +00:00
Yuri Roubinsky
de9205f72d Fix ^= operator in shaders 2021-12-03 10:34:56 +03:00
Rémi Verschelde
3be0f85e91
Merge pull request #54377 from lawnjelly/faster_editor_lines 2021-11-30 13:30:02 +01:00
Aaron Franke
1d8cef8236
[3.x] Backport some APIs in math structs 2021-11-27 01:19:45 -06:00
Yuri Roubinsky
5928cc90f8 [3.x] Prevent return statement from using in block in shader main func 2021-11-23 10:40:47 +03:00
Camille Mohr-Daurat
3970f28f67
Merge pull request #55096 from lawnjelly/bvh_expanded_leaf
BVH - add option for expanded AABBs in leaves
2021-11-22 09:37:16 -07:00
Rémi Verschelde
393c7959ef
Merge pull request #42929 from madmiraal/fix-42877-3.2 2021-11-20 10:23:06 +01:00
Marcel Admiraal
702529d63e Give each RigidBody its own DirectBodyState wrapper. 2021-11-20 08:17:04 +00:00
Marcel Admiraal
e900bac80b Add area to moved list when changing monitorable,
and only remove area from query when deleting pair if it was monitorable.
2021-11-20 06:54:36 +00:00
lawnjelly
211dc8cd2d BVH - add option for expanded AABBs in leaves
This PR adds a define BVH_EXPAND_LEAF_AABBS which is set, which stores expanded AABBs in the tree instead of exact AABBs.

This makes the logic less error prone when considering reciprocal collisions in the pairing, as all collision detect is now taking place between expanded AABB against expanded AABB, rather than expanded AABB against exact AABB.

The flip side of this is that the intersection tests will now be less exact when expanded margins are set.

All margins are now user customizable via project settings, and take account of collision pairing density to adjust the margin dynamically.
2021-11-20 06:45:12 +00:00
Hugo Locurcio
d7d35e4f73
Add const qualifier support for function arguments in shaders
This prevents the function argument from being reassigned within
the function.

Example:

    void test(const int t) {}
2021-11-19 21:20:23 +01:00
Marcel Admiraal
4d3690eba5 Remove unimplemented methods 2021-11-18 12:47:36 +00:00
Rémi Verschelde
45088780be
Merge pull request #54925 from nekomatata/bvh-fix-update-3.x 2021-11-16 21:23:11 +01:00
PouleyKetchoupp
e9fdf3e61f Fix physics BVH pairing for teleported or fast moving objects
Updating the broadphase to find new collision pairs was done after
checking for collision islands, so it was working in most cases due to
the pairing margin used in the BVH, but in case of teleported objects
the narrowphase collision could be skipped.

Now it's done before checking for collision islands, so we can ensure
that broadphase pairing has been done at the same time as objects are
marked as moved so their collision can be checked properly.

This issue didn't happen in the Octree/HashGrid because they do nothing
on update and trigger pairs directly when objects move instead.
2021-11-16 12:01:57 -07:00