Commit graph

1447 commits

Author SHA1 Message Date
lucicam 1cd13d22c2
Fix crash caused by null parameter passed to CameraServer.add_feed()
Fixes #46181

CameraServer.add_feed() takes a CameraFeed object type as parameter.
Passing in another type of data while binding the method it will make
tha parameter null.
Added a check for null which returns from function and does not make the
engine crash anymore.

(cherry picked from commit c158a63a8a)
2021-04-05 11:58:48 +02:00
Rémi Verschelde ab4c73604d
Merge pull request #44696 from madmiraal/fix-44632-3.2
[3.x] Remove all elements from monitored_bodies and monitored_areas when processed
2021-03-26 16:34:27 +01:00
Rémi Verschelde acbd1e8b02
Merge pull request #46781 from BastiaanOlij/gdn_set_interface
Add set_interface for access by GDNative
2021-03-26 11:27:27 +01:00
lucicam 7c0255695d Fix failure in set_primary_interface when parameter is null
The program would fail if the parameter is passed as null in set_primary_interface because
in the print_verbose, the get_namea) method is called on the parameter and this causes a
failure if the parameter that was passed is null.
2021-03-25 15:29:16 +02:00
Bastiaan Olij 717f3227ec ARVR GDNative enhancements:
- add set_interface function
- add access to depth buffer
- add supplying a depth buffer from an ARVR plugin
2021-03-25 22:37:47 +11:00
Rémi Verschelde 7c82092b41
Merge pull request #47286 from DarkKilauea/fix-moment-of-inertia-3.x
[3.x] [Godot Physics]: Correct typo in moment of inertia calculations.
2021-03-23 10:31:26 +01:00
Rémi Verschelde 1ed0280de7
Merge pull request #47160 from puchik/shadow-filter-resolution
[3.x] Take resolution into account when setting the max shadow cubemap size (omni light shadow jaggies fix)
2021-03-23 09:45:14 +01:00
Arman 8d156d9e5c Take resolution into account when setting the max shadow cubemap size
Co-authored-by: Clay John <clayjohn@gmail.com>
2021-03-22 23:11:38 -07:00
Josh Jones 9327052bed [Godot Physics]: Correct typo in moment of inertia calculations.
The moment of inertia calculation for BoxShape is:

```
Vector3(
    (p_mass / 3.0) * (ly * ly + lz * lz), 
    (p_mass / 3.0) * (lx * lx + lz * lz), 
    (p_mass / 3.0) * (lx * lx + ly * ly));
```

where the final line includes both the x and y extents.

However, for CapsuleShape3D, CylinderShape3D, ConvexPolygonShape3D, ConcavePolygonShape3D, and HeightMapShape3D, the final line read `(p_mass / 3.0) * (extents.y * extents.y + extents.y * extents.y)`.  I believe this is a mistake, considering the comment in each case mentions using an AABB approximation, which should follow the same approach as BoxShape.

This change corrects the final line to include both the x and y components of the shape's extent.
2021-03-22 20:23:39 -07:00
e344fde6bf 9671f8ff4b [3.3] Fix some angular velocity calculations
The angular velocity estimate for kinematic bodies was calculated
incorrectly. Also, fixes its use in some kinematic/rigid collision
calculations.

3.3 version of #47130
2021-03-20 16:58:04 +10:00
jmb462 a5bcacb115
Fix AudioEffectCapture buffer length cannot be changed
(cherry picked from commit b588232b83)
2021-03-19 10:50:18 +01:00
Rémi Verschelde dae319355f
Merge pull request #47068 from nekomatata/cylinder-fix-margins-3.2
[3.3] Fix Cylinder shape collision with margins when using GJK-EPA
2021-03-17 11:05:46 +01:00
PouleyKetchoupp 27a01d054d Fix capsule-cylinder collision in godot physics
Test specific axes before falling back to GJK-EPA algorithm to get more
accurate separation axes for common cases, the same way it's done for
cylinder-cylinder collision.
2021-03-16 19:14:51 -07:00
PouleyKetchoupp abb5660925 Fix Cylinder shape collision with margins when using GJK-EPA
In the case of falling back to GJK-EPA algorithm to generate cylinder
contact points, margins were never taken into account.

This fixes the depenetration phase for kinematic bodies and allows
consistent floor detection for cylinder shapes.
2021-03-16 10:20:19 -07:00
Kongfa Waroros 5f4ac65251
Check if an input image wasn't Image on several functions in CameraFeed
(cherry picked from commit 916e576021)
2021-03-14 12:03:22 +01:00
Rémi Verschelde 3f246ebeed
Merge pull request #46932 from JFonS/fix_lm_capture_env
[3.2] Batch of lightmapper fixes and minor improvements
2021-03-12 12:30:36 +01:00
JFonS e2c28675ef Batch of lightmapper fixes and minor improvements
- Fix objects with no material being considered as fully transparent by the lightmapper.
- Added "environment_min_light" property: gives artistic control over the shadow color.
- Fixed "Custom Color" environment mode, it was ignored before.
- Added "interior" property to BakedLightmapData: controls whether dynamic capture objects receive environment light or not.
- Automatically update dynamic capture objects when the capture data changes (also works for "energy" which used to require object movement to trigger the update).
- Added "use_in_baked_light" property to GridMap: controls whether the GridMap will be included in BakedLightmap bakes.
- Set "flush zero" and "denormal zero" mode for SSE2 instructions in the Embree raycaster. According to Embree docs it should give a performance improvement.
2021-03-12 12:00:53 +01:00
lawnjelly d3930b1af2 Change default ninepatch mode to scaling
Changes default ninepatch mode to preserve compatibility, and renames default mode to 'fixed'.

Also adds an editor restart to changing ninepatch mode and software skinning, which will be more user friendly.
2021-03-10 09:30:23 +00:00
Ev1lbl0w bae4b0c952
Fix negative VRAM values 2021-03-09 09:51:17 +00:00
Kyle 1c208d6baa Fixes division by zero when 3d body does not have valid shape (3.2 only)
Fixes #46738 by setting the default inertia to a valid value when there are no valid shapes for a 3d body.
2021-03-08 20:32:16 -05:00
Rémi Verschelde 118567ca28
Merge pull request #46657 from lawnjelly/revert_snapping
Revert backport of 2D transform and camera snapping options
2021-03-08 14:49:41 +01:00
Hugo Locurcio 0c6873b13e
Tweak shader errors for features only usable in GLES3
See https://github.com/godotengine/godot/issues/42719#issuecomment-792168504.
2021-03-07 13:27:13 +01:00
lawnjelly bf1de6bbfa Revert backport of 2D transform and camera snapping options
More work is needed to make sure that those options actually solve users' issues, so we prefer to remove the options for 3.2.4 and revisit for a future release.
2021-03-05 14:20:31 +00:00
Rémi Verschelde 9fa85b343c
Merge pull request #46495 from asheraryam/fix-clip-content-error
Fix rounding error in Clip Content [3.2]
2021-03-02 17:07:06 +01:00
Rémi Verschelde 11ee43647b
Merge pull request #46590 from JFonS/fix_gridmap_lightmaps
[3.2] Properly disable dynamic lights on baked instances.
2021-03-02 15:05:29 +01:00
JFonS 62f344f448 Properly disable dynamic lights on baked instances.
Automatically set the `baked_light` bool when applying a lightmap to an
instance. This ensures the disabling of dynamic lights when the
bake mode is set to ALL.
2021-03-02 14:49:01 +01:00
Ev1lbl0w 3fe851accc Added missing returns on error scenarios
(cherry picked from commit 3d9ef1e4de)
2021-03-02 10:26:14 +01:00
Yuri Roubinsky 29616f4a35 Fix parsing hexadecimal (lowercase e,f) in shaders
(cherry picked from commit 19e0a1ec9d)
2021-03-02 10:26:14 +01:00
lawnjelly b1e24597e7 Renaming rendering/2d project settings.
The rendering/quality/2d section of project settings is becoming considerably expanded in 3.2.4, and arguably was not the correct place for settings that were not really to do with quality.

3.2.4 is the last sensible opportunity we will have to move these settings, as the only existing one likely to break compatibility in a small way is `pixel_snap`, and given that the whole snapping area is being overhauled we can draw attention to the fact it has changed in the release notes.

Class reference is also updated and slightly improved.

`pixel_snap` is renamed to `gpu_pixel_snap` in the project settings and code to help differentiate from CPU side transform snapping.
2021-03-01 11:38:46 +00:00
lawnjelly 847a37b196 Change 2d transform snapping from floor to round
Two common problems have emerged as a result of transform snapping:
1) Camera jitter with a camera following a snapped object
2) Pixel gaps between e.g. a platform and a player, where a platform rounds down and a player rounds up

Using round seems to greatly reduce problems due to camera jitter. It also may prove better for  pixel gaps because pixel art is often designed on a grid, so whole numbers are too expected, which are unstable with floor().
2021-02-28 14:34:39 +00:00
asheraryam 31a0f7fb0f Fix rounding error in Clip Content
Rounds the position and size of the final clip rect to avoid flickering issues.

Fixes https://github.com/godotengine/godot/issues/46493
2021-02-28 02:51:14 +03:00
booer b8354a45bd Update Inspector when changing AudioEffectChorus voice_count
Fixes #31627.

(cherry picked from commit 65975b9a08)
2021-02-25 22:36:42 +01:00
Lyuma 069c08e155 Backport d800329 AudioEffectCapture to 3.2 2021-02-21 20:14:58 -08:00
Ellen Poe 3f2cfe9b07 Implement a new resampling algorithm in AudioStreamPlaybackResampled
(cherry picked from commit b2264cb48b)
2021-02-19 16:17:25 +01:00
Ellen Poe 9178f694ea Prevent distortion filter from introducing NaNs in the audio buffer.
(cherry picked from commit b6b97b86ab)
2021-02-19 15:55:12 +01:00
Hein-Pieter van Braam 220f24c191
Merge pull request #45618 from RandomShaper/modernize_mt_3.2
Backport of all the multi-threading modernization (3.2)
2021-02-18 20:47:24 +01:00
Rémi Verschelde 418a08d678
Merge pull request #46175 from lawnjelly/gles_sanitizer_fixes
GLES - fix some sanitizer warnings
2021-02-18 20:36:56 +01:00
Rémi Verschelde 7af8da32b1
Merge pull request #45933 from nekomatata/cylinder-support-3.2
[3.2] Cylinder support in Godot Physics 3D
2021-02-18 19:36:42 +01:00
lawnjelly e7d1735bff GLES - fix some sanitizer warnings
These are benign but worth fixing as it clears the log to find more important errors.

A common problem with the sanitizer is that enums are often used to represent bits (e.g. 1, 2, 4, 8 etc) but without specifying the enum type, the compiler is free to use unsigned or signed int. In this case it uses int, and when it performs bitwise operations on the int type, the sanitizer complains.

This is probably because a bitshift with negative signed value can give undefined behaviour - the sanitizer can't know ahead of time that you are using the enum for sensible bitflags.
2021-02-18 15:45:38 +00:00
PouleyKetchoupp c6fbd55ca9 Cylinder support in Godot Physics 3D
Backport of cylinder support from Master.
2021-02-18 08:44:23 -07:00
Pedro J. Estébanez 4485b43a57 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 12:23:25 +01:00
Pedro J. Estébanez 6d89f675b1 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez 8f6a636ae7 Modernize Semaphore
- Based on C++11's `mutex` and `condition_variable`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez 4ddcdc031b Modernize Mutex
- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
2021-02-18 11:58:08 +01:00
PouleyKetchoupp 9cefab24e0 Fix test_body_motion recovery
This change makes test_body_motion more reliable when the kinematic body
recovers from being stuck.

- When recovery occurs, the rest information is generated, in order to
make sure collision results from test_move, move_and_collide and
move_and_slide are consistent and return a collision in case of overlap.

- The new calculation for recovery vector makes sure the recovery is
never more than the overlap depth between shapes.
This can help with cases where the kinematic body overlaps with several
shapes.
Recovery is made iteratively, without forcing a full overlap at each
step. This helps with getting proper rest information when recovery
occurs.

- One Way Collision:
When attempting motion, contact direction is checked against motion
before skipping in order to solve cases where kinematic bodies can sink
into one-way collision shapes.
Rest info now sets max contact depth in order to properly handle one-way
collision.

- Low speed motion is now handled in the rest info, by never setting
min_allowed_depth lower than motion length.
Separation is always applied with full margin, otherwise contact is lost
when low speed motion occurs right after higher speed motion.

- Similar changes are applied to 3D in order to make 2D and 3D
consistent.
2021-02-17 18:27:38 -07:00
lawnjelly a814dda2ae BVH - fix deferred visible mesh collision check
When making items visible from the visual server, the collision check is deferred to prevent two identical collision checks when set_pairable is called shortly after.

It turns out that for some items (especially meshes), set_pairable is never called. This PR detects this occurrence and forces a collision check at the end of the routine.
2021-02-14 09:03:26 +00:00
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
Rémi Verschelde 3115ac4b60
Merge pull request #45663 from akien-mga/3.2-cherrypicks
Cherry-picks for the 3.2 branch (future 3.2.4) - 19th batch
2021-02-02 19:19:31 +01:00
Rémi Verschelde 24cb60893f
Merge pull request #45654 from furrykef/3.2
Add anisotropic filtering to GLES2 backend
2021-02-02 18:12:52 +01:00
Pablo Escobar 407c6d3a9c
Add METALLIC to light() built-ins
(cherry picked from commit 1300fc7307)
2021-02-02 13:02:46 +01:00