Commit graph

3199 commits

Author SHA1 Message Date
Pedro J. Estébanez ae215451fc Make audio bus channels' peak volume consistent
Channels that are inactive -or when playback has not started yet- will report -200 dB as their peak value (which is also the lowest value possible during playback).

(cherry picked from commit a2b3a73e2d)
2021-02-05 09:26:09 +01:00
lawnjelly 00bd087d82 BVH add support for visibility (activation)
A major feature lacking in the octree was proper support for setting visibility / activation. This meant that invisible objects were still causing lots of processing in the tree unnecessarily.

This PR adds proper support for activation, items are temporarily removed from the tree and collision detection when inactive.
2021-01-30 13:21:40 +00:00
Rémi Verschelde 19ff78c528
Merge pull request #45530 from lawnjelly/bvh_pair_aabb_fix
BVH fix pairing AABB init and mask checks
2021-01-29 15:44:49 +01:00
Aaron Franke 226528097e
[3.2] Backport hex_to_int/bin_to_int zero check and C# changes 2021-01-28 09:24:44 -05:00
lawnjelly df18f72384 BVH fix pairing AABB init and mask checks
Fix bug whereby AABBs were reused from previous items due to use of a pool, resulting in missed collisions.
Also use full mask collision checks for all cases except generic update.
2021-01-28 14:01:03 +00:00
lawnjelly ba5e4d8baa BVH fix stale changed items, causing dangling pairs
In the octree collisions are flushed as objects are moved, whereas in the BVH they are usually flushed once per frame.

This was causing problems in the render tree in some rare situations where objects were being created (perhaps deleted and recreated using the same handle in the same frame). This PR flushes the collisions before creating objects, and set_pairable.

set_pairable may not be necessary but it is done for safety until proven not necessary.

Also a small potential for a bug is closed in remove_unordered use.
2021-01-27 16:14:32 +00:00
Hugo Locurcio eb0ca31ac1
Add an OS.get_thread_caller_id() method
This can be used to print thread IDs in logs. This can make it easier
to debug multi-threaded applications.

Co-authored-by: Khaos <khaos@khaos-coders.org>
(cherry picked from commit 35b046ddf7)
2021-01-26 22:10:30 +01:00
Vedat Günel 39cf22a9c7
Fix String.ends_with() for empty string arguments
(cherry picked from commit 1d0437c95b)
2021-01-26 17:00:17 +01:00
Rémi Verschelde 6d5daac3e4
Merge pull request #45312 from qarmin/remove_thread_lightmapper
Remove thread after use to prevent memory leak
2021-01-20 10:43:03 +01:00
Rafał Mikrut d025194602 Remove thread after use to prevent memory leak 2021-01-20 09:37:25 +01:00
lawnjelly 4954a869bb BVH render tree new updating scheme
Change render BVH update scheme from once per update_dirty_instances to a new update_scenarios function called once per draw.

Fix lights not being properly unpaired.
Fixed bug in add_changed_item where AABBs were not being updated due to more than one update per tick.
2021-01-19 14:24:32 +00:00
lawnjelly a241aeb289 Fix BVH set_pairable and masks.
Calling set_pairable now will update collisions (rather than waiting for the next item_move).

Mask behaviour used for pairing now (hopefully) matches octree.
2021-01-17 15:00:49 +00:00
Andrii Doroshenko (Xrayez) b124c0c466
Expose Resource.emit_changed() to script
Also known as `emit_signal("changed")`.

(cherry picked from commit e94f46dcdb)
2021-01-15 16:49:46 +01:00
JFonS 7d7d7ef16d CPU lightmapper formatting and minor fixes. 2021-01-14 18:08:33 +01:00
JFonS 112b416056 Implement new CPU lightmapper
Completely re-write the lightmap generation code:
- Follow the general lightmapper code structure from 4.0.
- Use proper path tracing to compute the global illumination.
- Use atlassing to merge all lightmaps into a single texture (done by @RandomShaper)
- Use OpenImageDenoiser to improve the generated lightmaps.
- Take into account alpha transparency in material textures.
- Allow baking environment lighting.
- Add bicubic lightmap filtering.

There is some minor compatibility breakage in some properties and methods
in BakedLightmap, but lightmaps generated in previous engine versions
should work fine out of the box.

The scene importer has been changed to generate `.unwrap_cache` files
next to the imported scene files. These files *SHOULD* be added to any
version control system as they guarantee there won't be differences when
re-importing the scene from other OSes or engine versions.

This work started as a Google Summer of Code project; Was later funded by IMVU for a good amount of progress;
Was then finished and polished by me on my free time.

Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
2021-01-14 18:05:56 +01:00
lawnjelly 7b33050b3d BVH - fix physics expecting plus one based IDs.
Godot physics relies on ID zero being invalid, whereas BVH 0 is a valid ID.
2021-01-14 13:26:44 +00:00
Rémi Verschelde b9c5e2f9eb
doc: Sync classref with current source
And fix copyright headers in new code.
2021-01-13 16:55:27 +01:00
Rémi Verschelde 49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde 188609e5ab
CI: Update to clang-format 11 and apply ternary operator changes
(cherry picked from commit af878716f2)
2021-01-13 16:14:35 +01:00
lawnjelly 690e07b509 Dynamic BVH for rendering and godot physics
Complete rewrite of spatial partitioning using a bounding volume hierarchy rather than octree.

Switchable in project settings between using octree or BVH for rendering and physics.
2021-01-12 12:12:10 +00:00
Andrii Doroshenko (Xrayez) 47899e67c5 Add ability to restore RandomNumberGenerator state
3.2 version of b5107715f1.

`get_seed()` still returns the previous state and not the initial seed,
because users may rely on this behavior for resetting the state in 3.2.
Documented this is going to be fixed in 4.0.

Co-authored-by: MidZik <matt.idzik1@gmail.com>
2021-01-08 15:02:02 +02:00
Rémi Verschelde d6fecf7686
Main: Create user data dir in setup()
Custom backport of #39563 with preliminary change to make
`OS::ensure_user_data_dir()` public as done in f8a79a9.

Fixes #32488.
2021-01-08 10:24:48 +01:00
Mai Lavelle 43910510e0
Fix xform_inv of Plane, intermediate results were ignored
(cherry picked from commit 4cb070e590)
2021-01-05 21:33:33 +01:00
Rémi Verschelde 66bfe855a8
Revert "Add a project setting to enable stdout flushing in release builds"
This reverts commit 341b9cf15a.

This makes the logger crash when used during cleanup: #44850.
2021-01-05 21:33:33 +01:00
Joshua Dahl 0239337475
Remove Unnecessary Double List
_OS::print_resources_by_type had two of the exact same list, one of which was never used.

(cherry picked from commit 453ef0ba89)
2021-01-05 21:33:32 +01:00
Maganty Rushyendra bc564cd661
Issue more precise error when disconnecting a nonexistent connection
Checks whether the signal exists when issuing an error message when
disconnecting a nonexistent connection. Also prints the callable name.

(cherry picked from commit 6c026a6814)
2021-01-05 21:33:28 +01:00
Rémi Verschelde 3032b38b52
Merge pull request #44690 from lawnjelly/transform_snap2
[3.2] Improve 2d snapping
2021-01-05 17:19:44 +01:00
Andy Savage d097c0213c
Quick fix to incorrect error messages when writing to compressed or encrypted files.
(cherry picked from commit c65f097ebd)
2020-12-29 16:02:00 +01:00
Hugo Locurcio f5f04a10f5
Add a project setting to enable stdout flushing in release builds
This can be used in server builds for journalctl compatibility.

(cherry picked from commit 341b9cf15a)
2020-12-29 16:02:00 +01:00
Alf Kraus 70fc0d45f7
wrong double quote output with .csv fixed
(cherry picked from commit 68fdd753a7)
2020-12-29 15:12:10 +01:00
Andrii Doroshenko (Xrayez) e95c24d783
Make property_list_changed_notify protected in Object
Alternative to `_change_notify()` to be called from within C++ classes.

Achieves low-level consistency with scripting, where this method is
exposed for updating the editor (inspector) with new values.

(cherry picked from commit 9aa06c3e65)
2020-12-29 13:52:13 +01:00
lawnjelly a237c671bb Improve 2d snapping
Partially revert change allowing sprite get_rect snapping to be controlled by `pixel_snap` again rather than `transform_snap` (to prevent breaking compatibility). Adds a final `use_camera_snap` project setting to allow snapping viewports as in reduz original PR.
2020-12-25 18:53:00 +00:00
Fredia Huya-Kouadio 94aa09a854 Fix the String::get_base_dir() logic to properly check for top level directories on Windows. 2020-12-23 00:43:03 -08:00
Rémi Verschelde 9c3293b844
Merge pull request #44306 from Demindiro/fix-conv-to-32bit-float
Fix Variant conversion to float instead of double
2020-12-21 01:36:18 +01:00
Theogen Ratkin 8f6a6ac8d0 Add interpolation parameter to resize_to_po2()
Image::resize_to_po2() now takes an optional p_interpolation parameter
that it passes directly to resize() with default value INTERPOLATE_BILINEAR.

GLES2: call resize_to_po2() with interpolate argument

Call resize_to_po2() in GLES2 rasterizer storage with either
INTERPOLATE_BILINEAR or INTERPOLATE_NEAREST depending on TEXTURE_FLAG_FILTER.

This avoids filtering issues with non power of two pixel art textures.
See #44379
2020-12-18 14:02:38 -04:00
Pedro J. Estébanez 4dafa5b21e Fix crash parsing a serialized Reference 2020-12-17 12:24:55 +01:00
Marcel Admiraal e21adf2bc6 Don't handle BaseException in build scripts 2020-12-12 10:10:23 +00:00
David Hoppenbrouwers 708336531c
Fix Variant conversion to float instead of double
Closes #44303
2020-12-11 23:19:30 +01:00
Fabio Alessandrelli f73c9e555f
Remove now unused FileAccessBuffered.
(cherry picked from commit 781efc26e0)
2020-12-09 11:36:58 +01:00
Hugo Locurcio 8542d6ecd5
Tweak log file names for consistency between Mono and non-Mono logs
- Avoid spaces in Mono log file names.
- Use a `.log` extension for Mono logs, just like non-Mono logs.
- Use periods to separate hours/minutes/seconds for non-Mono logs.

(cherry picked from commit 4d81776fc9)
2020-12-09 11:22:05 +01:00
bruvzg cc86b11858
Fix .pck lookup for extensionless binary in macOS resources.
(cherry picked from commit 7be8759991)
2020-12-02 16:08:29 +01:00
Jummit deda90bad7
add root_node as property of MultiplayerAPI
(cherry picked from commit d4c4d2db4c)
2020-12-01 09:00:54 +01:00
Fabio Alessandrelli f6cca77d8f
Disable SO_REUSEADDR for UDP.
It allows binding multiple sockets to the same ADDR:PORT (unlike TCP,
which still requires different ADDR:PORT combinations).

(cherry picked from commit 4b6a35c74a)
2020-12-01 09:00:52 +01:00
Rémi Verschelde 94c31175de
Merge pull request #43152 from Chaosus/color_autocompletion_3.2
[3.2] Shows ColorRect in Color constants autocompletion
2020-11-26 09:32:32 +01:00
Pedro J. Estébanez 8ec5ffe17e Make warning about Reference singletons more accurate 2020-11-23 10:42:50 +01:00
Pedro J. Estébanez 9df6edc7d7
Warn about singleton being a Reference
(cherry picked from commit e1150bd912)
2020-11-19 17:15:28 +01:00
Pedro J. Estébanez ebdcf1cc60
Fix crash duplicating local-to-scene resources
(cherry picked from commit e99cf6bfe5)
2020-11-19 17:15:27 +01:00
Pedro J. Estébanez 58e9bf494d
Fix crash in resoure duplicate
(cherry picked from commit 9450717571)
2020-11-17 12:07:02 +01:00
Hugo Locurcio 3a46e01af3
Remove property groups for Pause Mode and Script
Each of those only grouped 1 property, making them useless.

This closes https://github.com/godotengine/godot-proposals/issues/1840.

(cherry picked from commit 5770e08c2a)
2020-11-17 12:07:02 +01:00
Haoyu Qiu 8361caad86
Allows HTTPClient to talk to proxy server
* Makes request uri accept absolute URL and authority
* Adds Host header only when missing

(cherry picked from commit d92ca6fbb1)
2020-11-17 12:07:01 +01:00