Commit graph

857 commits

Author SHA1 Message Date
Rémi Verschelde
b8ff6190a8
Merge pull request #80176 from lawnjelly/fti_2d_particles
[3.x] Physics Interpolation - add support for CPUParticles2D
2023-08-08 14:27:38 +02:00
lawnjelly
a117a3307a Physics Interpolation - add support for CPUParticles2D
Similar to the existing 3D CPUParticles physics interpolation.
2023-08-03 14:44:08 +01:00
lawnjelly
ad577e3c7e Fix 2D MultiMesh hierarchical culling
Fixes updating local bounds for MultiMeshes used in canvas items by introducing a back link.
2023-08-03 06:49:01 +01:00
lawnjelly
61e41cc9a1 Add debug_canvas_item_get_local_bound() function to VisualServer
Useful for debugging hierarchical culling.
2023-08-02 17:05:13 +01:00
Rémi Verschelde
078e1b9f45
Merge pull request #79498 from lawnjelly/multirect_fix_flushing
[3.x] MultiRect - Fix flushing in TextEdit
2023-08-02 17:27:35 +02:00
lawnjelly
5162efbfe9 2D Fixed Timestep Interpolation
Adds support to canvas items and Camera2D.
2023-08-01 16:07:48 +01:00
lawnjelly
8814578ceb MultiRect - Fix flushing in TextEdit
The FontDrawer used in TextEdit was previously not being flushed before drawing auto-completion boxes. This was causing rendering artifacts.
This PR also increases the backward compatibility of the MultiRect OFF mode, by forcing a flush after each character.
2023-07-15 14:02:21 +01:00
lawnjelly
b777a9e5f9 Canvas item hierarchical culling
Adds optional hierarchical culling to the 2D rendering (within VisualServer).

Each canvas item maintains a bound in local space of the item itself and all child / grandchild items. This allows branches to be culled at once when they don't intersect a viewport.
2023-04-25 20:17:33 +01:00
Rémi Verschelde
bfb6877b3c
Merge pull request #75612 from lawnjelly/fix_skele2d_bounds2
[3.x] Fix Polygon2D skinned bounds (for culling)
2023-04-25 16:24:59 +02:00
Rémi Verschelde
4c5a934408
Merge pull request #68960 from lawnjelly/multirect
Batching - Add MultiRect command
2023-04-17 17:25:20 +02:00
lawnjelly
dd6c213dac Fix Polygon2D skinned bounds (for culling)
The bound Rect2 was previously incorrect because bone transforms need to be applied to verts in bone space, rather than local space. This was previously resulting in skinned Polygon2Ds being incorrectly culled.
2023-04-12 10:17:02 +01:00
lawnjelly
910ddd13c4 Batching - Add MultiRect command
Large groups of similar rects can be processed more efficiently using the MultiRect command. Processing common to the group can be done as a one off, instead of per rect.

Adds the new API to VisualServerCanvas, and uses the new functionality from Font, BitmapFont, DynamicFont and TileMap, via the VisualServerCanvasHelper class.
2023-03-10 10:58:04 +00:00
lawnjelly
18d7d36b63 Eliminate collision checks between geometry in rendering BVH.
Later logic using the `pairable_mask` would catch cases preventing pairing callbacks between geometry. However the collision checks were still taking place, wasting performance.

Here we utilize the `tree_mask` feature of BVH to totally eliminate unnecessary collision checks between geometry.
2023-03-09 11:16:30 +00:00
Rémi Verschelde
1426cd3b3a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".

Backported from #70885.
2023-01-10 15:26:54 +01:00
dzil123
aa0b91ca52 [3.x] Fix shader compiler asan out of bounds 2022-11-17 19:24:15 -08:00
clayjohn
7e840ae883 Properly initialize use_aabb_center in visual server 2022-10-11 09:53:59 -07:00
Haoyu Qiu
f33dfe8236 Fix crash executing MultiMesh.reset_instance_physics_interpolation 2022-10-02 15:30:55 +08:00
Rémi Verschelde
24ebc32126
Merge pull request #61841 from markusneg/cull-masked-shadows 2022-09-23 09:43:20 +02:00
Rémi Verschelde
2ee933bb77
Merge pull request #64920 from lawnjelly/bind_physics_interpolation
Bind Physics Interpolation functions in VisualServer
2022-08-30 22:02:58 +02:00
lawnjelly
96a1b86717 Bind Physics Interpolation functions in VisualServer
To allow maximum flexibility in the initial rollout, VisualServer functions were not bound in order to prevent compatibility issues if the API changed.

These functions are now bound to allow direct use from the VisualServer.
2022-08-30 18:06:12 +01:00
QbieShay
acdcbefa4e added options for sorting transparent objects
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Co-authored-by: Clay John <claynjohn@gmail.com>
2022-08-30 13:39:32 +02:00
Cory Petkovsek
d7ba3b73a9 Clarify invalid RID errors in Server free() functions. 2022-08-12 23:02:09 +08:00
Rémi Verschelde
36fc99158d
Merge pull request #63971 from paddy-exe/spatial-shader-built-ins 2022-08-08 15:50:25 +02:00
Manuel Moos
9fbdace917 Remove redundant thread sync counter draw_pending
The functions that used it already use a threadsafe FIFO queue
to communicate between threads and a sync to have the main thread
wait for the render thread.

Fixes #35718
2022-08-06 14:09:25 +02:00
Rémi Verschelde
d9d3861f76
Merge pull request #55764 from tinmanjuggernaut/validate_rid
[3.x] Validate RIDs before freeing
2022-08-05 22:38:49 +02:00
Rémi Verschelde
144f3ec94e
Merge pull request #51676 from Calinou/shader-add-hint-transparent-texture-3.x
Add `hint_transparent` to use a transparent black placeholder texture (3.x)
2022-08-05 22:34:05 +02:00
Patrick Exner
be3d331f26 Backport spatial shader built-ins
Backport of this PR: https://github.com/godotengine/godot/pull/63597
This adds these as new Built-Ins to Spatial Shaders
* Object's Position in World Space
* Camera Position in World Space
* Camera Direction in World Space
* Object's Position in View Space
2022-08-05 21:19:15 +02:00
Rémi Verschelde
ccbe083949
Merge pull request #63071 from lawnjelly/skinning2d_bounds 2022-08-05 19:34:48 +02:00
Hugo Locurcio
ab9a95f266
Add hint_transparent to use a transparent black placeholder texture 2022-08-02 23:32:07 +02:00
Rémi Verschelde
818f1eed31 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 14:53:37 +02:00
Rémi Verschelde
270f5a3bd1
Merge pull request #63384 from lawnjelly/portals_room_hint_invalid
Portals - Fix invalid room hint when reconverting room graph
2022-07-24 20:10:25 +02:00
lawnjelly
d4dc7c4b32 Portals - Allow more logging to be disabled
Some logging messages were still being issued when portals/debug/logging was false. This could be annoying in games that stream in parts of levels and repeatedly call `rooms_convert()`.

This PR allows all but essential logging to be disabled.
2022-07-24 13:44:59 +01:00
lawnjelly
88b7d928c5 Portals - Fix invalid room hint when reconverting room graph
In situations where rooms are converted multiple times, the previous room hint ID can reference a room number that is out of range of the new number of rooms. This fixes the bug by checking the room hint ID is within range.
2022-07-24 11:46:38 +01:00
lawnjelly
18bb668a2e Fix skeleton 2D stale bounding rect
Adds special logic for handling skeleton bounding rect updates. Previously these were never being updated because the canvas item is never set to "rect_dirty".
2022-07-18 19:47:23 +01:00
lawnjelly
e4f252d94f Physics Interpolation - fix continuous updating in unmoving objects
Adds instances to the transform update list as well as the interpolate update list when unhiding them. This ensures that the system auto-detects non-moving objects, and removes them from the interpolate update list on the next tick, preventing unnecessary updates.
2022-06-19 11:26:13 +01:00
lawnjelly
991687cc10 Physics Interpolation - fix stale interpolation data when unhiding
A previous optimization prevented instances being added to the interpolation lists when hidden to save processing. This caused a regression when unhiding nodes outside of the physics tick - the interpolated transforms would be stale until the next physics tick, causing a glitch.

This PR readds instances immediately to the interpolation lists when they are unhidden, preventing this glitch.
2022-06-14 10:25:23 +01:00
lawnjelly
f8df04ed50 More low priority redraw request cases
Some more cases of textures etc causing continuous updates in vital updates only mode are fixed.
2022-06-12 06:44:59 +01:00
Markus Grafen
16517ecb3d visual instance layers are regarded during shadow culling
todo: setting Camera cull_mask should mark affected shadows dirty somehow
2022-06-09 09:02:43 +02:00
lawnjelly
e7a73579e3 Portals - force full check on adding moving object
Moving objects being added during instance_moving_create() were incorrectly not forcing a full check to find which room they were within. This could result in moving objects being re-added not correctly identifying their current room, and thus culling incorrectly. This PR forces a full check on calling instance_moving_create.
2022-05-29 15:53:25 +01:00
Haoyu Qiu
067e738cb8 Fix various typos 2022-05-19 19:07:45 +08:00
Rémi Verschelde
5e693b6d84 Fix warnings found by Emscripten 3.1.10
Fix `-Wunused-but-set-variable`, `-Wunqualified-std-cast-call`, and
`-Wliteral-range` warnings.

(cherry picked from commit d8935b27a9)
2022-05-16 16:38:26 +02:00
lawnjelly
ec9a17cfad Physics Interpolation - optimize hidden nodes
In order to prevent glitches when unhiding nodes, set_transform() is still called to the VisualServer even for hidden nodes when the node is interpolated. This activates a lot of logic which is not necessary just to keep the previous transform updated.

This PR adds an early out which misses out on the unnecessary logic when instances are invisible.
2022-05-10 08:59:34 +01:00
Cory Petkovsek
2be0738304 Visual/Physics/Navigation Servers validate RIDs with documentation update 2022-05-06 03:39:06 +08:00
lawnjelly
f1bef3c592 Physics Interpolation - improve warnings with NodePath
It has been pointed out to me that it is far more useful to display the NodePath in the warning than the name of the node, as there may be lots of nodes sharing the same name in a project. This PR fixes this.
2022-05-04 18:46:14 +01:00
Rémi Verschelde
4cfc96fea7
Merge pull request #60531 from lawnjelly/fti_usage_warnings 2022-04-28 12:00:49 +02:00
lawnjelly
ad9b2b3794 Physics Interpolation - add helper warnings
When physics interpolation is active on a node, it is essential that transforms are updated during "_physics_process()" rather than "_process()" calls, for the interpolation to give the correct result.

This PR adds optional warnings for instances, cameras and multimeshes which can flag updates being incorrectly called, and thus make these problems much easier to fix.
2022-04-26 13:56:02 +01:00
Rémi Verschelde
d063bc4277
Merge pull request #60381 from clayjohn/3.x-sorting
[3.x] Sort based on camera position when using perspective camera
2022-04-26 12:26:31 +02:00
Rémi Verschelde
24307bd074 MultiMesh: Fix potential crash found by fuzzing
Fixes #58293.
2022-04-25 16:55:54 +02:00
clayjohn
76ff41cad1 Sort based on camera position when using perspective camera 2022-04-19 14:54:51 -07:00
lawnjelly
d2b1d29634 Physics interpolation - Move out of Scenario
Move VisualServer interpolation data out of Scenario and into VisualServerScene, so the interpolation data and enabled status is now common to all Scenarios.

Fix physics interpolation in multithreaded mode by ensuring tick and pre-draw are called.
2022-04-11 15:04:24 +01:00