Commit Graph

2714 Commits

Author SHA1 Message Date
Yuri Roubinsky e8a457ba89 Refactor render_mode in shaders, forbid declaring duplicates 2021-12-21 22:20:09 +03:00
Fabio Alessandrelli e880294d9f [Headless] Workaround texture load failure.
Some assets are loaded based on OS/server feature detection, namely
textures (but potentially others).
The ResourceImporter will fail to load a texture if the OS reports not
supporting it. The OS, in turn, checks texture format support via the
RenderingServer.
This commit makes the dummy rasterizer report known texture formats as
supported (although unused), so that scenes can be correctly loaded when
they include references to imported textures.
2021-12-20 09:18:26 +01:00
Rémi Verschelde be83968b6b
Merge pull request #55970 from Chaosus/shader_fix_struct_warning 2021-12-16 13:35:44 +01:00
Yuri Roubinsky 1414a7be91 Fix struct usage passing to shader warning system 2021-12-15 22:54:46 +03:00
Yuri Roubinsky f0a58af12f Rename shader hint `filter_anisotropy` to `filter_anisotropic` 2021-12-15 22:12:38 +03:00
Yuri Roubinsky 25a2241e7d Fix shader array parsing in variable declaration 2021-12-15 17:54:15 +03:00
Rémi Verschelde de8348a9b3
Merge pull request #55903 from Chaosus/shader_struct 2021-12-15 13:07:48 +01:00
Rémi Verschelde 864ccb5776
Merge pull request #55913 from Chaosus/fix_shader_crash 2021-12-15 13:07:34 +01:00
Yuri Roubinsky 09185d76ac Rename shader hint `filter_aniso` to `filter_anisotropy` 2021-12-15 13:18:32 +03:00
Yuri Roubinsky 3cbd8ef098 Fix shader crash when assigned array from struct to a variable by index 2021-12-13 21:19:13 +03:00
Yuri Roubinsky 31cc6ba622 Allow declaring multiple members in one expression in shader structs 2021-12-13 19:10:08 +03:00
Yuri Roubinsky 8862d1426d Restore shader parsing errors with lack of semicolon in a block 2021-12-11 17:30:40 +03:00
Camille Mohr-Daurat f1ca14cc8d
Merge pull request #55736 from nekomatata/physics-apply-forces
Improve RigidDynamicBody force and torque API
2021-12-10 17:16:28 -07:00
Camille Mohr-Daurat c6fe431a02
Merge pull request #55773 from nekomatata/fix-raycast-ccd
Fix rigid body ray cast CCD in 2D and 3D Godot Physics
2021-12-10 17:16:02 -07:00
PouleyKetchoupp 30a608b7b9 Fix rigid body ray cast CCD in 2D and 3D Godot Physics
For 2D:
Raycast CCD now works the same as in 3D, it changes the body's velocity
to place it at the impact position instead of generating a contact point
that causes a wrong push back.

For both 2D and 3D:
The raycast CCD process reads and modifies body velocities, so it needs
to be moved to pre_solve() instead of setup() to be processed linearly
on the main thread, otherwise multithreading can cause some CCD results
to be randomly lost when multiple collisions occur.
2021-12-10 16:25:14 -07:00
PouleyKetchoupp 940f3fde5c Improve RigidDynamicBody force and torque API
Makes the API for forces and impulses more flexible, easier to
understand and harmonized between 2D and 3D.

Rigid bodies now have 3 sets of methods for forces and impulses:
-apply_impulse() for impulses (one-shot and time independent)
-apply_force() for forces (time dependent) applied for the current step
-add_constant_force() for forces that keeps being applied each step

Also updated the documentation to clarify the different methods and
parameters in rigid body nodes, body direct state and physics servers.
2021-12-10 15:55:40 -07:00
Rémi Verschelde 0ba7103bea
Merge pull request #55702 from nekomatata/physics-solver-settings 2021-12-10 22:10:41 +01:00
Hugo Locurcio 92e9cca5be
Rename `hint_aniso` to `hint_anisotropy` in the shader language
The word "anisotropy" is used in full form in BaseMaterial3D's
anisotropy-related properties.
2021-12-10 17:41:17 +01:00
Yuri Roubinsky 85380c5207
Merge pull request #55623 from Chaosus/shader_refactor_const_suffix 2021-12-10 17:01:43 +03:00
Yuri Roubinsky bcbcf14469 Refactor constant suffix parsing in a shader 2021-12-10 15:38:27 +03:00
Rémi Verschelde 7e720b43ad
Merge pull request #55762 from nekomatata/body-motion-no-margin 2021-12-10 11:04:32 +01:00
Rémi Verschelde f455660e93
Merge pull request #55572 from aaronfranke/ci-double 2021-12-10 10:02:38 +01:00
Yuri Roubinsky dcf3594500
Merge pull request #55763 from Chaosus/shader_hint_completion 2021-12-10 11:44:01 +03:00
Rémi Verschelde bdf8340e59
Merge pull request #43181 from nathanfranke/string-empty
Replace String comparisons with "", String() to is_empty()
2021-12-10 08:56:31 +01:00
Yuri Roubinsky b66510d509 Added completion for uniform hints in a shader 2021-12-10 10:12:25 +03:00
PouleyKetchoupp 0c354047e1 Handle test body motion with 0 margin
Margin needs to have a high enough value for test body motion to work
properly (separate using the margin, move without then gather rest info
with the margin again).

Fixes issues with test motion returning no collision in some cases with
margin equal to 0.
2021-12-09 10:52:27 -07:00
Rémi Verschelde f0b5cd51b6
Merge pull request #55714 from Geometror/fix-fog-spotlight 2021-12-09 18:05:17 +01:00
Aaron Franke e9808e3d9a
Add a double-precision editor build to CI 2021-12-09 09:52:48 -06:00
Nathan Franke 49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Nathan Franke 41a20171eb
align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00
Hendrik Brucker 1da732af35 Fix volumetric fog in combination with spotlights 2021-12-08 22:17:09 +01:00
Yuri Roubinsky 76f6c0849c Make `compile` shader function to use struct instead long parameter list 2021-12-08 11:34:40 +03:00
PouleyKetchoupp 8682adcb87 Add physics solver settings to project settings
Helps with discovery and setup of physics solver settings, in a specific
project settings section for both 2D and 3D.

Other changes for cleanup:
-Removed unused space parameters in 3D
SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO
SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS
-Added custom solver bias for Shape3D (same as Shape2D)
-Improved documentation for solver settings
2021-12-07 12:08:04 -07:00
Rémi Verschelde 46d384060e
Merge pull request #35901 from nathanfranke/pool-byte-array-subarray-exclusive 2021-12-07 14:00:59 +01:00
Rémi Verschelde 7ac9ea75cc
Rename `VideoPlayer` to `VideoStreamPlayer` for consistency
It's a player for `VideoStream` resources, just like `AudioStreamPlayer` is a
player for `AudioStream` resources.

Closes https://github.com/godotengine/godot-proposals/issues/3624.
2021-12-06 19:01:28 +01:00
Rémi Verschelde 4bce5e302e
Merge pull request #55602 from nekomatata/improve-rigidbody-contacts 2021-12-06 16:49:42 +01:00
Hugo Locurcio 89ec3d3bc7
Remove or make verbose some debugging prints
The message about SpatialMaterial conversion was turned into a warning,
as it can potentially interfere with porting projects from Godot 3.x
(if there's a bug in the conversion code).
2021-12-05 23:22:23 +01:00
PouleyKetchoupp 2273a78af1 Update space parameters in 2D and 3D
Clarified space parameters for contacts and added missing ones.

List of changes:
-Add contact bias to space parameters
-Add solver iterations to space parameters, instead of a specific
physics server function
-Renamed BODY_MAX_ALLOWED_PENETRATION to CONTACT_MAX_ALLOWED_PENETRATION
to make it consistent with other contact parameters
2021-12-03 12:01:38 -07:00
PouleyKetchoupp 5cbc7149a1 Improve RigidDynamicBody contacts in 2D and 3D
Changed the algorithm for solving contacts to keep previous contacts as
long as they are under the max separation threshold to keep contact
impulses more consistent and contacts more stable.

Also made 2D consistent with 3D and changed some default parameters:
-Contact bias is now 0.8 instead of 0.3 to avoid springy contacts
-Solver iterations are 16 instead of 8 by default for better stability

Performance considerations:
Tested with stress tests that include lots of contacts from overlapping
bodies.
3D: There's no measurable difference in performance.
2D: Performance is a bit lower (close to 10% slower in extreme cases)
The benefit for 2D physics to be much more stable outweighs the slight
decrease in performance, and this could be alleviated by changing the
algorithm to use jacobians for contact solving to help with cache
efficiency and memory allocations.
2021-12-03 10:40:15 -07:00
Yuri Roubinsky 10b10ae1fa Fix `^=` operator in shaders 2021-12-03 10:20:44 +03:00
Rémi Verschelde 892a5a72cd
Merge pull request #55474 from akien-mga/copy-operators-no-reference 2021-12-02 17:34:45 +01:00
Rémi Verschelde 1398436ab8
Merge pull request #53904 from ChristopheClaustre/bugfix_shader_compile_spirv_from_source 2021-12-02 10:07:35 +01:00
Rémi Verschelde 81b7418013
Merge pull request #55402 from TokageItLab/fixed-immediatemesh-minimum-aabb
Fixed minimum size of `AABB` in `ImmediateMesh` to draw only one vertex
2021-12-02 08:05:56 +01:00
Silc 'Tokage' Renew ca2b7a87a5 Fixed minimum size of aabb in ImmediateMesh to draw only one vertex 2021-12-02 08:33:33 +09:00
Yuri Roubinsky 5ee73dc5a6 Fix shader crash when using existed constant name for struct 2021-12-01 18:11:45 +03:00
Yuri Roubinsky a48c205191 Fix declaring array size twice in global shader constant 2021-12-01 16:44:25 +03:00
Yuri Roubinsky 5ba93619fa Allow using empty statements in the shader, added formatting warning 2021-12-01 11:52:25 +03:00
Rémi Verschelde 5643f5e616
Merge pull request #55490 from Chaosus/fix_shader_crash 2021-11-30 20:13:12 +01:00
Rémi Verschelde bdd118e765
Merge pull request #55431 from Chaosus/shader_fix_constants 2021-11-30 19:40:52 +01:00
Yuri Roubinsky be7c03779a Fix shader crash when assigning array to non-array in global constant 2021-11-30 21:28:55 +03:00