Commit graph

2036 commits

Author SHA1 Message Date
Rémi Verschelde
2bd89ac249
Merge pull request #44695 from madmiraal/fix-44632
Remove all elements from monitored_bodies and monitored_areas when processed
2021-03-26 16:34:02 +01:00
Bastiaan Olij
a6c989bc1b Obtain supported Vulkan API 2021-03-26 12:06:57 +11:00
PouleyKetchoupp
c8dd3c7d80 Heightmap collision shape support in Godot Physics 2021-03-25 16:52:41 -07:00
lucicam
c98ca4e959 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.

Same fix was done in 3.x also and it seems to be present in master too.
2021-03-25 17:36:22 +02:00
Josh Jones
9aadd0cde7 [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:10:11 -07:00
Rémi Verschelde
992de9c053
Merge pull request #46917 from nekomatata/solver-kinematic-bug-fix
Fix GodotPhysics solver with kinematic body set to report contacts
2021-03-20 21:53:01 +01:00
Rémi Verschelde
900b28f6d8
Merge pull request #47130 from e344fde6bf/fix-angular-velocity-calculation
Fix kinematic angular velocity calculations
2021-03-20 21:46:02 +01:00
Rémi Verschelde
fa681d04b7
Merge pull request #46937 from nekomatata/soft-body-support
SoftBody support in GodotPhysics 3D
2021-03-20 21:45:20 +01:00
Rémi Verschelde
793000c6a9
Merge pull request #47139 from nekomatata/concave-backface-collision
Disable backface collision with ConcavePolygonShape by default
2021-03-20 21:43:57 +01:00
e344fde6bf
1c123aaf2b 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.

This fixes #47029.
2021-03-20 07:21:37 +10:00
PouleyKetchoupp
7bbd545432 Disable backface collision with ConcavePolygonShape by default
Helps a lot with soft bodies and generally useful to avoid shapes to go
through the ground in certain cases.

Added an option in ConcavePolygonShape to re-enable backface collision
on specific bodies if needed.
2021-03-18 11:30:22 -07:00
PouleyKetchoupp
d5ea4acd2d SoftBody support in GodotPhysics 3D
- Fixed SoftBody surface update with new rendering system
- Added GodotPhysics implementation for SoftBody
- Added support to get SoftBody rid to interact with the physics server
- Added support to get SoftBody bounds from the physics server
- Removed support for unused get_vertex_position and get_point_offset
from the physics server
- Removed SoftBody properties that are unused in both Bullet and
GodotPhysics (angular and volume stiffness, pose matching)
- Added RenderingServerHandler interface to PhysicsServer3D so the physics servers don't need to reference the class from SoftBody node directly
2021-03-18 09:04:17 -07:00
Rémi Verschelde
2fd445cc18
Merge pull request #47133 from groud/navigation_2d_bugfix
Make 2D navigation consider scale
2021-03-18 15:42:46 +01:00
Gilles Roudière
6249ebb9c8 Make 2D navigation consider scale 2021-03-18 15:17:23 +01:00
Rémi Verschelde
c097ce0c18
Merge pull request #47125 from BastiaanOlij/SCsub_compile_shaders
Changed SCsub for shaders to find shaders automatically
2021-03-18 11:20:57 +01:00
Bastiaan Olij
7f63c9e7c9 Changed SCsub for shaders to find shaders automatically and create dependencies with include files 2021-03-18 12:59:47 +11:00
jmb462
b588232b83 Fix AudioEffectCapture buffer length cannot be changed 2021-03-17 23:07:38 +01:00
Ignacio Abal
ccdd7ab890 Added validation when assigning heightfield_resolution (Fix #46281) 2021-03-17 12:03:52 -03:00
Rémi Verschelde
af0806722f
Merge pull request #47067 from nekomatata/cylinder-fix-margins
Fix Cylinder shape collision with margins when using GJK-EPA
2021-03-17 11:05:13 +01:00
Rémi Verschelde
3651406258
Merge pull request #47084 from nekomatata/cylinder-capsule-collision-fix
Fix capsule-cylinder collision in godot physics
2021-03-17 11:01:04 +01:00
Rémi Verschelde
08ca4184f4
Merge pull request #47024 from groud/navigation
Allow Navigation to be more flexible
2021-03-17 09:18:54 +01:00
PouleyKetchoupp
380f04fa0d 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:22:59 -07:00
Rémi Verschelde
9ca0d66a3b
Merge pull request #46984 from sboronczyk/fix-shader-issue
Vulkan: Fix crash when opening a ShaderMaterial with code saved as an external .shader file
2021-03-16 23:32:06 +01:00
PouleyKetchoupp
93076ef117 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:19:26 -07:00
Gilles Roudière
ac7073f586 Allow Navigation to be more flexible 2021-03-15 15:58:59 +01:00
Kongfa Waroros
916e576021 Check if an input image wasn't Image on several functions in CameraFeed 2021-03-14 16:47:21 +07:00
sboronczyk
3e7c5d2ca5 fix issue vulkan crash on open shader materials 2021-03-13 22:54:33 +01:00
PouleyKetchoupp
c5d2404a13 Fix GodotPhysics solver with kinematic body set to report contacts
In 3D, collision is disabled between kinematic/static bodies when
contacts are generated only to report them.

In 2D, this case was already fixed but the code is cleaned to make it
easier to follow.
2021-03-11 18:06:00 -07:00
Bastiaan Olij
f7cbeb0d1b Removed time duplicate from ForwardClustered. Just use the variable from its superclass 2021-03-11 18:08:10 +11:00
Bastiaan Olij
73b5eb2673 Combine init_gi and init_sdfgi into a single init 2021-03-11 18:07:33 +11:00
Bastiaan Olij
52ab369d5f Renamed one more Forward render struct and fixed typo 2021-03-11 14:18:05 +11:00
Bastiaan Olij
dfc41eb6f6 Moving RendererStorageRD *storage to protected, no sense duplicating it in forward_clustered 2021-03-11 13:24:23 +11:00
Bastiaan Olij
01851defb5
Merge pull request #46811 from BastiaanOlij/rename_forward_renderer
Renaming RendererSceneRenderForward to ...ForwardClustered
2021-03-10 23:36:08 +11:00
Bastiaan Olij
a895844c82 Renaming RendererSceneRenderForward to RendererSceneRenderForwardClustered so we can introduce RendererSceneRenderForwardMobile 2021-03-10 22:34:50 +11:00
Gilles Roudière
ba1344408f Implement Navigation layers 2021-03-10 11:23:06 +01:00
Kyle
554990992a Fixes division by zero when 3d body does not have valid shape
Fixes #46738 by setting the default inertia to a valid value when there are no valid shapes for a 3d body.
Changed the comment style for the update_inertias method as well.
2021-03-08 19:25:26 -05:00
Rémi Verschelde
3856bc5afe
Merge pull request #46642 from BastiaanOlij/sdfgi_rename_and_cleanup
Renamed SDGIShader to SDFGIShader and moved a bunch of things to private
2021-03-08 08:22:48 +01:00
Ev1lbl0w
1f0b60c47d
Fix negative VRAM values 2021-03-05 21:48:20 +00:00
Alex Hirsch
426ef4b1ee Fix canvas renderer line width
fix #46644
2021-03-04 21:37:06 +01:00
Bastiaan Olij
760be46a81 Renamed SDGIShader to SDFGIShader and moved a bunch of things to private 2021-03-04 11:53:09 +11:00
Rémi Verschelde
8c45b1d61c
Merge pull request #46594 from asheraryam/fix-clip-content-master
Fix rounding error in Clip Content [4.0]
2021-03-02 17:07:00 +01:00
Rémi Verschelde
5885381373
Merge pull request #46581 from Riteo/fix-capsule-shape
Change CapsuleShape3D's collision detection axis to vertical
2021-03-02 16:46:48 +01:00
asheraryam
c3d8538bb4 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-03-02 18:36:28 +03:00
Riteo Siuga
b24bba95d0 Change CapsuleShape3D's collision detection axis to vertical
This fixes an issue where its collision detection would actually work as if it had the old default orientation.
2021-03-02 08:33:44 +01:00
Rémi Verschelde
da8eef486b
Merge pull request #46046 from BastiaanOlij/cleanup_gi
Moving GI and Sky code from RendererSceneRenderRD into separate classes
2021-03-01 19:34:53 +01:00
Rémi Verschelde
e9cb64a8b5
Merge pull request #46522 from Ev1lbl0w/bugfix-shader_noret
Added missing returns on error scenarios
2021-03-01 09:36:15 +01:00
Yuri Roubinsky
19e0a1ec9d Fix parsing hexadecimal (lowercase e,f) in shaders 2021-03-01 09:08:44 +03:00
Ev1lbl0w
3d9ef1e4de
Added missing returns on error scenarios 2021-02-28 19:48:35 +00:00
Eryk Dwornicki
fb9d6fcc6d Refactor removal of constraints from bodies in 2D joints 2021-02-27 20:52:01 +01:00
Eryk Dwornicki
aa42e8920b Move removal of the constraints from bodies to Joint3DSW destructor
Joint3DSW instances are also destroyed without explicitly calling free()
for example when changing constrainted bodies at runtime using
set_node method.
2021-02-27 20:52:01 +01:00
booer
65975b9a08 Update Inspector when changing AudioEffectChorus voice_count
Fixes #31627.
2021-02-25 17:32:50 +01:00
Bastiaan Olij
1f96ba5141 Moving GI code into RendererServerGIRD
Moving Skyshader code into RendererServerSkyRD
2021-02-25 15:15:48 +11:00
Rémi Verschelde
a930472319
Merge pull request #45863 from nekomatata/physics-queries-disabled-shapes
Fix physics queries not filtering out disabled collision shapes
2021-02-24 13:05:28 +01:00
Rémi Verschelde
a527c6856b
Merge pull request #46045 from bruvzg/text_server_bmp_create
[TextServer] Restores bitmap font dynamic construction functions.
2021-02-24 12:55:36 +01:00
Yuri Roubinsky
571f4396ea Prevents shader crash if two struct with the same name are declared 2021-02-21 13:47:09 +03:00
Yuri Roubinsky
f91e7e3ba4 Prevents shader crash if passing invalid struct to the return statement 2021-02-21 07:55:40 +03:00
Rémi Verschelde
6d0c502ee4
Merge pull request #46086 from ellenhp/new_resampling
Implement a new resampling algorithm in AudioStreamPlaybackResampled
2021-02-19 16:17:04 +01:00
Rémi Verschelde
0d1d719178 doc: Sync classref with current source
And fix various bogus bindings following previous PRs.
2021-02-19 14:39:14 +01:00
Rémi Verschelde
5a9cab4fa4
Merge pull request #46199 from ellenhp/fix_distortion_filter
Prevent distortion filter from introducing NaNs in the audio buffer
2021-02-19 07:45:27 +01:00
Ellen Poe
b6b97b86ab Prevent distortion filter from introducing NaNs in the audio buffer. 2021-02-18 16:53:26 -08:00
Clay John
32dec4accd
Merge pull request #45326 from clayjohn/VULKAN-ign-shadows
Use Interleaved gradient noise for shadow samples
2021-02-18 13:17:41 -08:00
Rémi Verschelde
247b7e2448
Merge pull request #46131 from bruvzg/move_tablet_to_ds
Move tablet driver API from OS to DisplayServer
2021-02-18 20:36:46 +01:00
Rémi Verschelde
310496a89f
Merge pull request #45617 from RandomShaper/modernize_atomics
Modernize atomics (and fix `volatile`)
2021-02-18 19:40:31 +01:00
Pedro J. Estébanez
8e128726f0 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 bool` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 17:12:46 +01:00
bruvzg
3e0262509f
Move tablet driver API from OS to DisplayServer. 2021-02-18 17:12:24 +02:00
reduz
64140eaf42 Reorganize Project Settings
-Advanced Settings toggle also hides advanced properties when disabled
-Simplified Advanced Bar (errors were just plain redundant)
-Reorganized rendering quality settings.
-Reorganized miscelaneous settings for clean up.
2021-02-18 11:23:34 -03:00
Rémi Verschelde
5529fe5680
Merge pull request #46148 from nekomatata/fix-test-body-motion
Fix test_body_motion recovery and rest info
2021-02-18 14:15:30 +01:00
PouleyKetchoupp
cff7a69aa0 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 19:02:59 -07:00
Kayomn
fa8a47e1bf Fix math error in blend shape application tolerance 2021-02-17 10:30:29 +01:00
Ellen Poe
b2264cb48b Implement a new resampling algorithm in AudioStreamPlaybackResampled 2021-02-15 21:21:13 -08:00
bruvzg
bee718f1af
[Text Server] Restores bitmap font dynamic construction functions. 2021-02-15 10:46:49 +02:00
bruvzg
f4d095cdd3
[TextServer] Restore character and space extra spacing support. 2021-02-15 10:46:23 +02:00
Rémi Verschelde
4a0dbf9acf
Merge pull request #45931 from nekomatata/cylinder-contact-points-fix
Revised cylinder contact point generation in Godot Physics
2021-02-12 23:05:17 +01:00
PouleyKetchoupp
6d0898bf4c Revised cylinder contact point generation
Cylinder contact points generation is adjusted to make it more stable
when standing on triangle meshes.

Point-Circle:
Switched to simpler plane projection as it's done for Point-Face contact
points. It solves some cases where discrepancies between the two points
caused the cylinder to jump.

Edge-Circle:
Same as before, the case for edge has just been moved from Face-Circle
to a specific method.

Face-Circle:
The previous method was clipping edges against the circle, and then
tried to add contact points when there wasn't enough support and failed
in some cases.
Now using a different algorithm which adds proper contact points around
the circle more consistently.
First, by clipping edges against circle segments using Face-Face
algorithm.
Second, by clipping edges against the circle plane.
2021-02-12 12:25:58 -07:00
Rémi Verschelde
e9a25b8552
Merge pull request #45859 from Kayomn/master
Accomodate blend shape ranges of -1 to +1 for Vulkan
2021-02-12 09:26:14 +01:00
Yuri Roubinsky
dd0874e717 Allow passing varying from fragment to light shader function 2021-02-11 15:59:21 +03:00
PouleyKetchoupp
333f184734 Cylinder support in Godot Physics 3D
Cylinder collision detection uses a mix of SAT and GJKEPA.
GJKEPA is used to find the best separation axis in cases where finding
it analytically is too complex.

Changes in SAT solver:
Added support for generating separation axes for cylinder shape.
Added support for generating contact points with circle feature.

Changes in GJKEPA solver:
Updated from latest Bullet version which includes EPA fixes in some
scenarios.
Setting a lower EPA_ACCURACY to fix accuracy problems with cylinder vs.
cylinder in some cases.
2021-02-10 10:00:53 -07:00
reduz
8b19ffd810 Make Servers truly Thread Safe
-Rendering server now uses a split RID allocate/initialize internally, this allows generating RIDs immediately but initialization to happen later on the proper thread (as rendering APIs generally requiere to call on the right thread).
-RenderingServerWrapMT is no more, multithreading is done in RenderingServerDefault.
-Some functions like texture or mesh creation, when renderer supports it, can register and return immediately (so no waiting for server API to flush, and saving staging and command buffer memory).
-3D physics server changed to be made multithread friendly.
-Added PhysicsServer3DWrapMT to use 3D physics server from multiple threads.
-Disablet Bullet (too much effort to make multithread friendly, this needs to be fixed eventually).
2021-02-10 13:21:46 -03:00
PouleyKetchoupp
50501f2843 Fix physics queries not filtering out disabled collision shapes
This change allows collide_shape, intersect_shape, cast_motion and
rest_info in both 2D and 3D to ignore disabled shapes and make them
consistent with the physics simulation.

In some other cases, _cull_aabb_for_body is used and filters shapes out
internally, but whenever a physics query uses the broadphase directly
without calling _cull_aabb_for_body, disabled shapes can be returned
and need to be filtered out.
2021-02-09 19:14:17 -07:00
Kayomn
ca945421a0 Accomodate blend shape ranges of -1 to +1 2021-02-09 23:09:54 +00:00
reduz
3e2281a347 Improve SDFGI indirect light feedback loop
-Use occlusion for feedback, further reduces light leaking.
-More control on feedback, now its a slider.
2021-02-07 21:30:12 -03:00
jfons
99e1ce0690 Invert spotlight angle attenuation
Inverted the spotlight angle attenuation so a higher value results in
a dimmer light, this makes it more consistent with the distance
attenuation.

Also changed the way spotlighs are computed in SDFGI
and GIPorbes and GPU lightmapper, now it matches the falloff used in the scene rendering
code.
2021-02-07 20:10:33 +01:00
Rémi Verschelde
7a60c45671
Merge pull request #45786 from reduz/fix-sdfgi-radeon
Fixed an SDFGI reflections bug in Radeon
2021-02-07 12:24:07 +01:00
reduz
c4daf1c4ba Fixed a SDFGI reflections bug in Radeon
-Code was using too many conditionals.
-Rewrote it to use less and it now works fine.
2021-02-07 07:33:41 -03:00
jfons
9c6b081ab1 Fix volumetric fog for SpotLights
The code for spot lights was referencing the omni light list. Most
likely a copy-paste mistake :)
2021-02-07 03:38:09 +01:00
reduz
d0cc899398 Fix SDFGI bug after previous optimization.
Was causing arctifacts, should be good now.
2021-02-06 18:49:10 -03:00
reduz
8faf23b52b Simplify Volumetric Fog
-Always use temporal reproject, it just loos way better than any other filter.
-By always using termporal reproject, the shadowmap reduction can be done away with, massively improving performance.
-Disadvantage of temporal reproject is update latency so..
-Made sure a gaussian filter runs in XY after fog, this allows to keep stability and lower latency.
2021-02-06 15:08:21 -03:00
Lyuma
780e761dbc Fix mismatched define in scene_forward.glsl for POSITION override 2021-02-05 13:09:33 -08:00
reduz
7997544af5 Added temporal reprojection to Volumetric Fog
-It's an option, just enable it
-Just works, don't have to do anything else.
2021-02-05 10:52:54 -03:00
reduz
33278b0721 Fixes to get Godot running again on Intel IGP
-Fixed strange bug with shadowed instance_param (this should not have worked anywhere, odd..)
-Cleaned up barrier usage further.
2021-02-05 00:02:06 -03:00
reduz
f20999f6fe Rewrote how barriers work for faster rendering
-Added more finegrained control in RenderingDevice API
-Optimized barriers (use less ones for thee same)
-General optimizations
-Shadows render all together unbarriered
-GI can render together with shadows.
-SDFGI can render together with depth-preoass.
-General fixes
-Added GPU detection
2021-02-04 09:42:28 -03:00
Rémi Verschelde
3a3af0279b
Merge pull request #45658 from RandomShaper/fix_frozen_peak
Make audio bus channels' peak volume consistent
2021-02-03 10:05:34 +01:00
Lyuma
d800329d16 Add AudioEffectCapture
AudioEffectCapture allows access to the microphone and other audio on an audio bus in real-time.

Co-Authored-By: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2021-02-02 09:22:16 -08:00
Pedro J. Estébanez
a2b3a73e2d 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).
2021-02-02 11:30:32 +01:00
Rafał Mikrut
0c3febca06 Don't use trashy max_decals value to prevent crashes 2021-02-01 21:43:08 +01:00
Rémi Verschelde
d2e1216504
Merge pull request #37547 from aaronfranke/tau
Use Math_TAU and deg2rad/etc in more places and optimize code
2021-02-01 20:55:25 +01:00
Rémi Verschelde
5525cd85c6
Merge pull request #45315 from RandomShaper/modernize_thread
Modernize Thread
2021-01-31 15:24:56 +01:00
Pedro J. Estébanez
99fe462452 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-01-29 12:02:13 +01:00
Aaron Franke
cb9fc117d1
Use real_t in physics code 2021-01-28 18:15:42 -05:00
Aaron Franke
a3e3bf8227
Make hex_to_int and bin_to_int handle the prefix automatically
Also add BinToInt to C#
2021-01-28 07:43:53 -05:00