Commit graph

2052 commits

Author SHA1 Message Date
Rémi Verschelde
7fa84d8bd3
Merge pull request #47675 from madmiraal/fix-47436
Check ConvexPolygonShape2D point count before calcuating moment of inertia
2021-04-06 22:35:01 +02:00
Rémi Verschelde
0485a0d8b2
Merge pull request #47668 from madmiraal/fix-47438
Ensure ConvexPolygonShape3D support count variable is initialised
2021-04-06 22:30:07 +02:00
Marcel Admiraal
2abfc0518f Check for empty ConcavePolygonShape2D before checking for intersection 2021-04-06 20:05:10 +01:00
Marcel Admiraal
25593a481a Check ConvexPolygonShape2D point count before calcuating moment of inertia 2021-04-06 19:15:09 +01:00
Marcel Admiraal
6544f8422f Ensure ConvexPolygonShape3D support count variable is initialised 2021-04-06 16:46:15 +01:00
Marcel Admiraal
0d4d8925b7 Ensure ConvexPolygonShape support count variable is initialised 2021-04-06 16:18:49 +01:00
Bastiaan Olij
dad40fa2df Move clustered renderer functionality 2021-04-05 23:11:38 +10:00
Rémi Verschelde
d83761ba80
Style: Apply clang-tidy's readability-braces-around-statements 2021-04-05 14:09:59 +02:00
Rémi Verschelde
9bbe51dc27
Style: Apply clang-tidy's modernize-use-nullptr 2021-04-05 14:05:07 +02:00
Rémi Verschelde
65a2888057
Style: Apply clang-tidy's modernize-use-default-member-init 2021-04-05 13:37:27 +02:00
Rémi Verschelde
ed2f51b15f
Merge pull request #47452 from BastiaanOlij/xr_positional_tracker_ref
Change XRPositionalTracker to a reference (master)
2021-04-03 10:13:23 +02:00
lucicam
c158a63a8a 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.
2021-04-02 17:11:30 +03:00
Rémi Verschelde
9cd1e50969
Merge pull request #47250 from BastiaanOlij/check_vulkan_version
Obtain supported Vulkan API
2021-03-31 13:45:43 +02:00
Bastiaan Olij
e93c9fc4ed As GLSLang seems to be all or nothing, added our own defines 2021-03-31 21:47:25 +11:00
bruvzg
0d3fa2a125
[Complex Text Layouts] Provide access to glyph contour points. 2021-03-31 09:32:14 +03:00
Bastiaan Olij
454c889e61 Change XRPositionalTracker to a reference and better expose it to GDNative 2021-03-29 23:01:47 +11:00
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