Commit graph

2324 commits

Author SHA1 Message Date
Hendrik Brucker 56a8d3f30c Improvements to Label's layout options
- Added options to trim the text in case it overruns
- Added more autowrap modes
- Improved line breaking, which ignores trailing spaces
2021-07-04 16:43:55 +02:00
Rémi Verschelde 5c3055e0fe
Merge pull request #50137 from reduz/fix-boot-splash
Fix Boot Splash
2021-07-04 09:40:36 +02:00
Rémi Verschelde 67c08e27a5
Merge pull request #50138 from Calinou/debug-overdraw-lower-opacity
Decrease opacity of the overdraw debug draw mode
2021-07-04 09:39:36 +02:00
Rémi Verschelde 8838e3d3d4
Merge pull request #50144 from reduz/fix-ssr
Fix SSR
2021-07-04 09:20:22 +02:00
reduz 0e366dc7ac Fix SSR
* Was broken at some point long time ago, this restores it.
2021-07-03 23:32:34 -03:00
reduz ab3314e955 Fix SDFGI
* Broken by 7513b73902, fixes #49631
2021-07-03 21:24:37 -03:00
Hugo Locurcio 27aa8dc68e
Decrease opacity of the overdraw debug draw mode
This allows distinguishing higher amounts of overlapping objects.
2021-07-04 00:19:14 +02:00
reduz 6e1c5e346a Fix Boot Splash
* Implements the code to show the boot splash on load using RenderingDevice
* Does not work on X11 when maximized, some platform specific hack will be needed there.
2021-07-03 18:09:19 -03:00
reduz fe17a6c907 Fix render debug modes.
* Ovedraw debug works again
* Lighting debug works again
2021-07-03 14:50:36 -03:00
reduz 6c55d2aad2 Fix Render Info
* Fixed and redone the process to obtain render information from a viewport
* Some stats, such as material changes are too difficult to guess on Vulkan, were removed.
* Separated visible and shadow stats, which causes confusion.
* Texture, buffer and general video memory can be queried now.
* Fixed the performance metrics too.
2021-07-03 10:15:04 -03:00
Bastiaan Olij e86aeb85ce Properly override virtual functions in render_scene_render_rd and subclasses 2021-07-03 20:32:40 +10:00
Rémi Verschelde b9b128cb1d
Merge pull request #50102 from nekomatata/expose-body-test-motion-3d
Expose body_test_motion in 3D physics server
2021-07-03 09:29:46 +02:00
PouleyKetchoupp 62e577267f Expose body_test_motion in 3D physics server
Results are exposed through PhysicsTestMotionResult3D, the same way it's
done for 2D.

Also cleaned a few things in the 2D version.
2021-07-02 18:03:44 -07:00
Hugo Locurcio 5370f4876e
Remove leftovers from the DirectionalLight3D Optimized shadow depth range
The Optimized shadow depth range was removed in late 2020 in favor
of the Stable shadow depth range, but it still had a (broken) property
that allowed to enable it.
2021-07-02 20:32:43 +02:00
PouleyKetchoupp cf1ddfdb90 Make move_and_slide collision detection more accurate
More accurate unsafe motion calculation
* Safe and unsafe motion are calculated by dichotomy with a limited
number of steps. It's good for performance, but on long motions that
either collide near the beginning or near the end, the result can be
very imprecise.
* Now a factor 0.25 or 0.75 is used to converge faster when this case
happens, which allows longer motions to get more accurate collision
detection.
* Makes snap collision more precise, and helps with cases where diagonal collision on the border of a platform can lead to the character being stuck.

Additional improvements to move_and_slide:
* Handle slide canceling in move_and_collide with 0 velocity instead of
not applying it.
* Better handling of snap with custom logic to cancel sliding.
* Remove small jittering when using stop on slope, by canceling the
motion completely when the resulting motion is less than margin instead
of always projecting to the up direction (in both body motion and snap).

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-07-01 15:15:42 -07:00
Juan Linietsky eefe276a82
Merge pull request #50058 from reduz/fix-surface-from-arrays
Fix surface from array creation
2021-07-01 17:50:02 -03:00
reduz 8cf812fba1 Fix surface from array creation
* The debug check was not updated to the new format.
* Bug introduced by #50037
2021-07-01 16:51:55 -03:00
Aaron Franke 2508fd0533
Use PROPERTY_USAGE_NONE instead of 0 for no property usage
Also use const more often.
2021-07-01 14:13:27 -04:00
Rémi Verschelde ad8a2b3d52
Merge pull request #50040 from reduz/fix-renderingserver-bindings
Clean up RenderingServer and its bindings
2021-07-01 15:17:33 +02:00
reduz 37776b2867 Clean up RenderingServer and its bindings
* Rewrote bindings for RenderingServer.
* They are now all up to date.
* Several unused methods and deprecated features were cleaned up.
2021-07-01 09:07:36 -03:00
reduz 9ad0c6cde7 Import mesh colors in 8BPP.
* Colors were imported as 16BPP (half float)
* Far most common use cases only require 8BPP
* If you need higher data precision, use a custom array, which are supported now.

**WARNING**: 3D Scenes imported in 4.0 no longer compatible with this new format. You need to re-import them (erase them from .godot/import)
2021-06-30 23:33:25 -03:00
Rémi Verschelde 270f9d4c88
Merge pull request #50014 from reduz/remove-immediate
Deprecate ImmediateGeometry
2021-06-30 20:18:59 +02:00
reduz 85cf99f28e Deprecate ImmediateGeometry
* Removed entirely from RenderingServer.
* Replaced by ImmediateMesh resource.
* ImmediateMesh replaces ImmediateGeometry, but could use more optimization in the future.
* Sprite3D and AnimatedSprite3D work again, ported from Godot 3.x (though a lot of work was needed to adapt them to Godot 4).
* RootMotionView works again.
* Polygon3D editor works again.
2021-06-30 14:14:41 -03:00
Rémi Verschelde 24c6ee9f56
Merge pull request #49844 from nekomatata/physics-disabled-shapes
Fix and clean disabled shapes handling in godot physics servers
2021-06-30 10:08:52 +02:00
Rémi Verschelde bcd1fc832f
Merge pull request #49901 from nekomatata/move-and-collide-fix-slide
Fix move_and_collide causing sliding on slopes
2021-06-30 02:18:01 +02:00
reduz d07f7c8d25 Fixes to 2D viewport
* Editor 2D viewport now uses embedded subwindows (windows no longer pop up)
* Restored the ability to disable 3D on the 2D viewport (makes 3D not display on 2D when there is a camera on the scene)
2021-06-29 17:40:45 -03:00
reduz 64c925cca6 Improve RID_Owner memory usage
* Ability to allocate empty objects in RID_Owner, so RID_PtrOwner is not needed in most cases.
* Improves cache usage, as objects are now allocated together
* Should improve performance in 2D rendering
2021-06-29 12:28:08 -03:00
reduz d55ebc3a5d Fix non uniform scaling in 3D objects
* Flag was there, but not implemented.
* Fixed issue with base flags not being initialized.
2021-06-29 11:45:59 -03:00
Yuri Roubinsky 5100eed012 Added a shader warning about unused local variable 2021-06-29 15:39:37 +03:00
PouleyKetchoupp 9758a75221 Fix move_and_collide causing sliding on slopes
Make sure the direction of the motion is preserved, unless the depth is
higher than the margin, which means the body needs depenetration in any
direction.

Also changed move_and_slide to avoid sliding on the first motion, in
order to avoid issues with unstable position on ground when jumping.

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-06-28 17:17:52 -07:00
Bastiaan Olij a9604b425f Move render_sky logic from effects into our sky object, and some minor cleanup 2021-06-26 18:46:47 +10:00
reduz b1d15c51bc Implement native extension system
* Deprecates GDNative in favor of a simpler, lower level interface.
* New extension system allows registering core engine classes.
* Simple header interface in gdnative_interace.h
2021-06-25 17:32:45 -03:00
Rémi Verschelde e4430771db
Merge pull request #49885 from reduz/implement-render-pass-support
Implement Framebuffer Subpass support
2021-06-25 15:00:01 +02:00
reduz bde6f5eed1 Implement Framebuffer Subpass support
* Required for better optimizing mobile platforms
* Will be used by the Vulkan mobile renderer.
2021-06-24 15:59:15 -03:00
Rémi Verschelde a01ea509f5
Merge pull request #49826 from groud/fix_mesh_transform
Keep the drawing transform when drawing meshing in CanvasItem
2021-06-24 19:38:56 +02:00
Gilles Roudière ccbf31685d Fixes Mesh2D drawn without modulation 2021-06-23 17:38:31 +02:00
PouleyKetchoupp a65cdca894 Fix and clean disabled shapes handling in godot physics servers
In 3D, disabled shapes are now not added to the broadphase anymore.
Since they are removed right away when disabled, no need to check for
disabled shapes for any query that comes from the broadphase.
Also Fixes raycast queries returning disabled shapes.

In 2D, disabled shapes where already not added to the broadphase.
Remove the same unnecessary checks as in 3D.

Overall harmonized API for disabled shapes in the physics servers and
removed duplicate method.
2021-06-22 16:51:47 -07:00
Gilles Roudière e8476c994d Keep the drawing transform when drawing meshing in CanvasItem 2021-06-22 11:41:28 +02:00
Aaron Franke 0ce49800ac
Use mouse and joypad enums instead of plain integers
Also MIDIMessage
2021-06-20 11:54:24 -04:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Rémi Verschelde 76fd91c084
Merge pull request #49737 from JFonS/fix_vis_range
Fix crash in visibility range system.
2021-06-20 00:32:42 +02:00
Bastiaan Olij 0a6a71973e
Merge pull request #49615 from BastiaanOlij/inverse_xr_camera_offset
Inverse XR camera offset for stereoscopic rendering
2021-06-19 20:19:53 +10:00
jfons 2c0819992c Fix crash in visibility range system. 2021-06-19 11:43:41 +02:00
Bastiaan Olij b1bbbb4439 Inverse XR camera offset for stereoscopic rendering 2021-06-19 19:33:40 +10:00
jfons a0b19d2561 Fix "Ignore Occlusion Culling" flag. 2021-06-18 21:42:03 +02:00
Rémi Verschelde 92f20fd70e
Merge pull request #49659 from LightningAA/string-valid-integer-to-int 2021-06-18 16:14:14 +02:00
reduz 94d31ac327 Implement animation slice drawing in CanvasItem
* Added a function to ignore subsequent commands if they don't fall within the slice.
* This will be used by the new TileMap to properly provide animated tiles.
2021-06-17 12:42:27 -03:00
reduz 6e98c4cd50 Refactor VisibilityNotifier3D
* This is the 3D counterpart to #49632
* Implemented a bit different as 3D works using instancing

After merged, both 2D and 3D classes will most likely be renamed in a separate PR to DisplayNotifier2D/3D.
2021-06-16 18:50:39 -03:00
Lightning_A b6af2a29eb Rename is_valid_integer() to is_valid_int()
Method from `String`
2021-06-16 10:32:22 -06:00
reduz 38d164c74b Refactor VisibilityNotifier
* Works from RenderinServer
* Accurately tells when on or off-scren, its no longer approximate.
* VisibilityEnabler also simplified to use the process mode instead.
2021-06-16 10:48:57 -03:00
Rémi Verschelde c2ba45fcc8
Merge pull request #49630 from kodiwills/fix-custom-irradiance-typo
Fix typo in `CUSTOM_IRRADIANCE` calculations
2021-06-15 22:37:54 +02:00
Kodi 69e1f25299 Fix typo in CUSTOM_IRRADIANCE calculations 2021-06-15 15:17:00 -04:00
Rémi Verschelde ec323f0ef4
Merge pull request #49584 from timothyqiu/shader-data-null-check
Add missing null check for ShaderData
2021-06-14 19:18:20 +02:00
Rémi Verschelde 3f613236e0
Merge pull request #49576 from clayjohn/VULKAN-SSAO-uniform-sets
Store SSAO uniform sets per viewport
2021-06-14 19:05:19 +02:00
Rémi Verschelde 0610c559ec
Merge pull request #49585 from timothyqiu/oh-unsigned
Fix invalid read when using MultiMesh
2021-06-14 18:35:36 +02:00
Rémi Verschelde 6c1445bfea
Merge pull request #48847 from JFonS/vis_deps
Implement visibility range and dependencies
2021-06-14 17:22:59 +02:00
jfons 3a53ae5d9f Implement visibility range and dependencies.
This commit adds the following properties to GeometryInstance3D: `visibility_range_begin`,
`visibility_range_begin_margin`, `visibility_range_end`, `visibility_range_end_margin`.

Together they define a range in which the GeometryInstance3D will be visible from the camera,
taking hysteresis into account for state changes. A begin or end value of 0 will be ignored,
so the visibility range can be open-ended in both directions.

This commit also adds the `visibility_parent` property to 'Node3D'.
Which defines the visibility parents of the node and its subtree (until
another parent is defined).

Visual instances with a visibility parent will only be visible when the parent, and all of its
ancestors recursively, are hidden because they are closer to the camera than their respective
`visibility_range_begin` thresholds.

Combining visibility ranges and visibility parents users can set-up a quick HLOD system
that shows high detail meshes when close (i.e buildings, trees) and merged low detail meshes
for far away groups (i.e. cities, woods).
2021-06-14 12:17:11 +02:00
Haoyu Qiu 1b122345c2 Fix invalid read when using MultiMesh 2021-06-14 13:19:40 +08:00
Haoyu Qiu fa907ce829 Add missing null check for ShaderData 2021-06-14 13:00:35 +08:00
Bastiaan Olij 3eae812331 Fixed error spam when XR mode is not enabled and a missed setting rename 2021-06-14 11:05:16 +10:00
clayjohn fc93e10092 Store SSAO uniform sets per viewport 2021-06-13 10:42:10 -07:00
Bastiaan Olij 15c1a76361 Add stereoscopic rendering through multiview 2021-06-13 22:52:20 +10:00
reduz ce783689f8 Make shader compiler again after roughness limiter fix
Fix shader compilation error after merging #49549
2021-06-12 21:40:51 -03:00
Juan Linietsky bb94344937
Merge pull request #49549 from clayjohn/VULKAN-roughness-limiter
Fix roughness limiter derivative
2021-06-12 21:29:34 -03:00
clayjohn 9a5e00be6f Fix roughness limiter derivative 2021-06-12 17:02:05 -07:00
reduz 7513b73902 Fix VoxelGI (works again).
It was broken due to #46046, this makes it work again.
2021-06-12 20:37:56 -03:00
Rémi Verschelde 2787ee634a
Merge pull request #49520 from pfertyk/issue-46278-empty-texture-crashes-godot
Validate texture in RendererStorageRD::free
2021-06-12 22:27:14 +02:00
Paweł Fertyk 31cd42373b Validate texture in RendererStorageRD::free 2021-06-11 20:12:23 +02:00
Rémi Verschelde 530e069bc3
Merge pull request #49312 from RandomShaper/reference_to_ref_count
Rename `Reference` to `RefCounted`
2021-06-11 19:46:25 +02:00
Rémi Verschelde 50d1e0ea99
Merge pull request #47835 from mortarroad/master-lossless-webp
Implement lossless WebP encoding
2021-06-11 19:34:36 +02:00
reduz c2138bdc87 Fix tangent importing
* Binormal compression was wrong.
2021-06-11 14:13:58 -03:00
Pedro J. Estébanez 04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
Morris Tabor 1bc1e94208 Implement lossless WebP encoding 2021-06-11 18:46:04 +02:00
Rémi Verschelde 9e328bb5b7
Core: Move DirAccess and FileAccess to core/io
File handling APIs are typically considered part of I/O, and we did have most
`FileAccess` implementations in `core/io` already.
2021-06-11 14:52:39 +02:00
Rémi Verschelde 9aedc020c3
Merge pull request #42636 from madmiraal/fix-infinite-inertia 2021-06-11 13:00:31 +02:00
Yuri Roubinsky 9539e4e39e
Merge pull request #49456 from Chaosus/fix_shader_length
Fix `length()` array function usage in shader
2021-06-10 11:07:59 +03:00
Yuri Roubinsky 7dd65a066e Fix length() array function usage in shader 2021-06-10 10:04:28 +03:00
reduz c66b2651a6 Refactor CommandQueueMT
* RingBuffer had no reason to be in this context
* A single buffer is used that can grow as much as the game needs.

This should make thread loading entirely reliable.
2021-06-09 13:10:49 -03:00
Yuri Roubinsky 5d5400a3b1 Fix shader compilation with render_mode: specular_phong 2021-06-09 08:38:03 +03:00
Yuri Roubinsky 4daca0b580 Removes deleted OrenNayar mode from shaders and materials 2021-06-08 15:50:40 +03:00
PouleyKetchoupp 19dee4702a Fix uninitialized members in physics query results 2021-06-07 10:46:24 -07:00
Rémi Verschelde c1c76850cb
Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.
2021-06-07 11:03:08 +02:00
Yuri Roubinsky eec82d9f75 Prevent shader crash when returning array when return type is scalar 2021-06-06 14:59:52 +03:00
reduz 32625145c8 Rename GI Classes
* GIProbe is now VoxelGI
* BakedLightmap is now LightmapGI

As godot adds more ways to provide GI (as an example, SDFGI in 4.0), the different techniques (which have different pros/cons) need to be properly named to avoid confusion.
2021-06-05 09:28:56 -03:00
Rémi Verschelde 6f7d45d210
Merge pull request #45364 from madmiraal/rename-quat
Rename Quat to Quaternion
2021-06-05 13:32:08 +02:00
andriyDev 9f4bf5ec80 Deleted YSort, moved its functionality directly into Node2D.
YSort now has a compatibility alias to Node2D.
Updated TileMap to use the existing Node2D y_sort_enabled property instead
of its own property.
Updated Node2D doc to include the new y_sort_enabled member.
Updated TileMap doc to remove its mention of cell_y_sort.
Deleted YSort doc.
2021-06-05 00:55:25 -07:00
PouleyKetchoupp b2bd9f4e51 Safe margin cleanup
Safe margin property on CharacterBody only, used as argument in
move_and_collide.

Removed kinematic_safe_margin in 3D physics server, not really useful
and now harmonized with 2D.
2021-06-04 11:40:36 -07:00
PouleyKetchoupp ee4b756a51 More explanatory names for RigidBody modes
MODE_DYNAMIC instead of MODE_RIGID
MODE_DYNAMIC_LOCKED instead of MODE_CHARACTER

No more special case for sleeping behavior for MODE_DYNAMIC_LOCKED
(MODE_CHARACTER was forcing the body not to sleep, which is redundant
with can_sleep and wasn't done in Bullet).
2021-06-04 11:40:36 -07:00
PouleyKetchoupp ba13d23140 KinematicBody split between new CharacterBody and PhysicsBody
PhysicsBody now has methods move_and_collide/test_move and needed
properties for these methods: safe margin, locked axes (3D only).

Moved collision_exceptions from StaticBody to PhysicsBody for 3D
(same as 2D, and conforms to documentation).

RigidBody doesn't have test_motion method anymore, it's now redundant
with PhysicsBody.test_move.
2021-06-04 11:40:36 -07:00
Marcel Admiraal 8acd13a456 Rename Quat to Quaternion 2021-06-04 18:14:32 +01:00
Rémi Verschelde 5d9cab3aeb
Merge pull request #38430 from aaronfranke/transform3d 2021-06-03 23:07:21 +02:00
Rémi Verschelde ea2a0b5455
Merge pull request #43450 from aaronfranke/mouse-mode-bitwise
Add MOUSE_MODE_CONFINED_HIDDEN to MouseMode enum
2021-06-03 22:00:15 +02:00
Aaron Franke 94bc0bd919
Rename Vector2 clamped to limit_length and add limit_length to Vector3 2021-06-03 12:04:57 -04:00
Aaron Franke 98aa3b669e
Add MOUSE_MODE_CONFINED_HIDDEN
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-06-03 11:44:28 -04:00
Aaron Franke a3c29ed899
Rename files and the exposed name for Transform3D 2021-06-03 07:30:01 -04:00
Aaron Franke 08a85352fb
Rename Variant TRANSFORM to TRANSFORM3D
Also _transform to _transform3d
2021-06-03 07:30:01 -04:00
Aaron Franke de3f6699a5
Rename Transform to Transform3D in core 2021-06-03 07:30:01 -04:00
Fabio Alessandrelli 8cdef21d6c Move remaining dummy drivers to servers. 2021-06-01 16:50:32 +02:00
Rémi Verschelde 59b524ae4c
Merge pull request #49067 from JFonS/fix_gcc_warnings
Fix some warnings raised by GCC-11.1
2021-06-01 10:47:37 +02:00
Rémi Verschelde da23f99123
Merge pull request #49185 from DrRevert/inertia_nan_fix
GodotPhysics: Avoid NaNs when calculating inertias for bodies without mass/area
2021-05-31 12:56:36 +02:00
Rémi Verschelde 52ab531a56
Merge pull request #49161 from lawnjelly/fix_canvas_rect_bound4
[4.x] Fix canvas rect bound calculation
2021-05-31 11:34:46 +02:00
reduz 0d2e02945b Implement shader caching
* Shader compilation is now cached. Subsequent loads take less than a millisecond.
* Improved game, editor and project manager startup time.
* Editor uses .godot/shader_cache to store shaders.
* Game uses user://shader_cache
* Project manager uses $config_dir/shader_cache
* Options to tweak shader caching in project settings.
* Editor path configuration moved from EditorSettings to new class, EditorPaths, so it can be available early on (before shaders are compiled).
* Reworked ShaderCompilerRD to ensure deterministic shader code creation (else shader may change and cache will be invalidated).
* Added shader compression with SMOLV: https://github.com/aras-p/smol-v
2021-05-31 10:13:09 +02:00
Arkadiusz Marcin Kołek e347baddf3 Avoid division by zero when calculating inertias for bodies with colliders without areas. 2021-05-29 14:11:59 +02:00
lawnjelly 07ca9cd263 [4] Fix canvas rect bound calculation
It turns out the calculation of the bounding rect for canvas items has a nasty bug. When a transform is applied (especially in a custom draw), in the renderer this extra matrix is applied to all later commands in the canvas item. However in the calculation of the bound, the transform is only applied to the first command following the transform.

This PR fixes this inconsistency.
2021-05-28 09:04:24 +01:00
Yuri Roubinsky 897fc09bac Makes few shader built-ins constant to prevent changing them 2021-05-26 15:58:35 +03:00
Rémi Verschelde f1abfbbeb1
Merge pull request #48837 from Soupstraw/shader-pi
Added constants PI, TAU and E to the shader language
2021-05-25 18:07:15 +02:00
jfons f8e34209af Fix some warnings raised by GCC-11.1 2021-05-25 17:23:53 +02:00
Rémi Verschelde f050719da8
Merge pull request #48933 from Chaosus/shader_array_params
Allow shader arrays to be passed as parameters and return value in functions
2021-05-25 11:47:08 +02:00
Rémi Verschelde 9bc2ba3b64
Merge pull request #48955 from Calinou/editor-tweak-property-hints
Tweak dozens of editor property hints for consistency
2021-05-25 11:44:43 +02:00
Joosep Jääger 16567321ba Added constants PI, TAU and E to the shader language 2021-05-25 12:15:08 +03:00
Hugo Locurcio 87f503310b
Tweak dozens of editor property hints for consistency
- Update Viewport MSAA property hints to match the currently
  exposed values.
- Add some performance hints to property hints.
2021-05-25 02:50:35 +02:00
Rémi Verschelde af03e9c830
Merge pull request #48939 from Calinou/screen-orientation-use-enum
Use an enum to represent screen orientation in the Project Settings
2021-05-24 19:53:19 +02:00
Hugo Locurcio 660952a857
Use an enum to represent screen orientation in the Project Settings
- Tweak the setting property hint to be more informative.
- Make the setting a "basic" setting so it appears when Advanced Settings
  is disabled.
- Remove redundant orientation setting in the iOS export preset.
  The project setting is now used (like on Android).

Projects upgrading from a previous version will have to set the
screen orientation again in the Project Settings if it wasn't set
to the default value ("landscape").
2021-05-24 18:53:10 +02:00
reduz 789713b008 Support for 2D particles to collide against SDF
-Added SDF collision support for 2D particles
-Changed the SDF generation to be fully signed
2021-05-23 16:43:36 -03:00
Rémi Verschelde de4c17f716
Merge pull request #48916 from mortarroad/master-convex-hull-ported
Replace QuickHull with Bullet's convex hull computer.
2021-05-22 23:22:48 +02:00
Morris Tabor d1bc88d426 Replace QuickHull with Bullet's convex hull computer.
The code is based on the current version of thirdparty/vhacd and modified to use Godot's types and code style.

Additional changes:
- extended PagedAllocator to allow leaked objects
- applied patch from https://github.com/bulletphysics/bullet3/pull/3037
2021-05-22 22:35:42 +02:00
Yuri Roubinsky 5874b7a29c Allow shader arrays to be passed as parameters and return value 2021-05-22 20:15:03 +03:00
Yuri Roubinsky 084648bd18 Basic warning support implementation for the Godot Shading Language. 2021-05-22 19:24:31 +03:00
Winston Hartnett 96fa2ee2a0 Fix instance uniform typo 2021-05-20 21:11:40 -05:00
Rémi Verschelde 342f3efc7e
Merge pull request #48882 from aaronfranke/approx-use-double
Make is_equal_approx have explicit float and double versions
2021-05-20 14:17:58 +02:00
Rémi Verschelde 4219a4cb6f
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:38:56 +02:00
Aaron Franke b5b6d3a8ec
Make is_equal_approx have explicit float and double versions 2021-05-20 06:18:11 -04:00
Rémi Verschelde 7f6ee00b4e
Merge pull request #48855 from Chaosus/shader_array_length_in_structs
Implements length() shader function for arrays in structs
2021-05-20 09:04:50 +02:00
Yuri Roubinsky 6135744786 Implements length() shader function for arrays in structs 2021-05-19 21:50:11 +03:00
Rhathe 88b1802132 Enable setting of collision iterations in PhysicsServer2D
This allows fine-tuning of collision iterations for more
accurate collision physics with a performance cost.
2021-05-19 10:54:10 -04:00
Yuri Roubinsky 96b2e54c70 Fix typo in shader_language.cpp 2021-05-18 19:01:02 +03:00
Rémi Verschelde 66f40f74c3
Merge pull request #48640 from BastiaanOlij/blit_shader 2021-05-13 15:02:26 +02:00
Hugo Locurcio 5895479a5e
Rename the audio FFT_Size enum to FFTSize for consistency 2021-05-13 02:42:49 +02:00
Bastiaan Olij 02980be834 Implementing blit shader with versions 2021-05-12 22:52:28 +10:00
Rémi Verschelde 0c693f8781
Merge pull request #48472 from BastiaanOlij/render_state
Make better use of our render_state struct
2021-05-12 13:44:03 +02:00
reduz 479391ef54 Fixes missng 2D engine bits
-Mesh2D now works
-MultiMesh2D now works
-Polygon2D now works
-Added hooks for processing 2D particles
-Skeleton2D now works

2D particles still not working, but stuff needed for it is now implemented.
2021-05-11 11:21:36 -03:00
PouleyKetchoupp 3877ed73d0 Dynamic BVH broadphase in 2D & 3D Godot Physics
Port lawnjelly's dynamic BVH implementation from 3.x to be used in
both 2D and 3D broadphases.

Removed alternative broadphase implementations which are not meant to be
used anymore since they are much slower.

Includes changes in Rect2, Vector2, Vector3 that help with the template
implementation of the dynamic BVH by uniformizing the interface between
2D and 3D math.

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2021-05-10 16:28:55 -07:00
Bastiaan Olij 308b26762b Split RenderDataRD struct from RenderState struct to simplify passing our render data around the renderer. 2021-05-10 21:52:15 +10:00
Rémi Verschelde 35ec0e9be7
OS: Remove native video API only implemented on iOS
See discussion in #43811, it was only implemented on iOS and even that
implementation was fairly limited. This would best be provided as plugins
for Android and iOS without cluttering the shared OS API.
2021-05-07 20:40:24 +02:00
Rémi Verschelde 8962d36bb1
Merge pull request #33577 from Calinou/highlight-control-flow-keywords
Highlight control flow keywords with a different color
2021-05-07 00:52:50 +02:00
Bastiaan Olij 90ef5d73c4 Cleanup vulkan capabilities check and add multiview check 2021-05-06 12:06:07 +10:00
Hugo Locurcio e905e8f145
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-05 22:38:12 +02:00
Rémi Verschelde 7449d6c752
Merge pull request #48435 from BastiaanOlij/no_repeat_mobile_renderer
Remove repeat from forward mobile renderer
2021-05-05 16:19:03 +02:00
Rémi Verschelde 508fbf4abe
Merge pull request #48221 from nekomatata/solver-multithreaded
Godot Physics collisions and solver processed on threads
2021-05-04 09:22:20 +02:00
Bastiaan Olij cc45ed448b Remove repeat from forward mobile renderer 2021-05-04 11:37:58 +10:00
jfons 6995b0429c Assorted fixes to UV unwrapping and GPU lightmapper
Various fixes to UV2 unwrapping and the GPU lightmapper. Listed here for
context in case of git blame/bisect:

* Fix UV2 unwrapping on import, also cleaned up the unwrap cache code.
* Fix saving of RGBA images in EXR format.
* Fixes to the GPU lightmapper:
	- Added padding between atlas elements, avoids bleeding.
	- Remove old SDF generation code.
	- Fix baked attenuation for Omni/Spot lights.
	- Fix baking of material properties onto UV2 (wireframe was
	  wrongly used before).
	- Disable statically baked lights for objects that have a
	  lightmap texture to avoid applying the same light twice.
	- Fix lightmap pairing in RendererSceneCull.
	- Fix UV2 array generated from `RenderingServer::mesh_surface_get_arrays()`.
	- Port autoexposure fix for OIDN from 3.x.
	- Save debug textures as EXR when using floating point format.
2021-05-03 18:10:34 +02:00
Bastiaan Olij 58ff0dac1a Create mobile renderer 2021-05-03 21:54:11 +10:00
Rémi Verschelde dea84c9d28
Merge pull request #48341 from sboron/fix-tangent-issue
Fix broken tangents in vulkan rendering server on godot 4
2021-05-01 13:37:43 +02:00
Stefan Boronczyk 7571348a5f fix-tangents-on-rendering-server 2021-05-01 06:19:40 +02:00
reduz 90056460ad Implement Particle Trails
-Enable the trails and set the length in seconds
-Provide a mesh with a skeleton and a skin
-Or, alternatively use one of the built-in TubeTrailMesh/RibbonTrailMesh
-Works deterministically
-Fixed particle collisions (were broken)
-Not working in 2D yet (that will happen next)
2021-04-30 17:38:02 -03:00
Rafał Mikrut efcb097674 Prevent setting too big or too small Collision Mask and Layer 2021-04-30 17:19:04 +02:00
Rémi Verschelde 305b2a15bf
Merge pull request #48239 from akien-mga/goodbye-copymem
Core: Drop custom `copymem`/`zeromem` defines
2021-04-28 11:04:05 +02:00
Rémi Verschelde 95cfce661b
Merge pull request #48050 from JFonS/occlusion_culling 2021-04-27 19:07:12 +02:00
Rémi Verschelde 8247667a3e
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
2021-04-27 16:26:27 +02:00
Yuri Roubinsky 3c82f01134 Fix shader handle constant expressions in function call 2021-04-27 15:23:01 +03:00
Rémi Verschelde 83cc6bcf55
Merge pull request #48187 from brakhane/remove-dupe-comments
Remove duplicate comments
2021-04-27 09:42:09 +02:00
PouleyKetchoupp 448c41a3e4 Godot Physics collisions and solver processed on threads
Use ThreadWorkPool to process physics step tasks in multiple threads. Collisions are all processed in parallel and solving impulses is
processed in parallel for rigid body islands.

Additional changes:
- Proper islands for soft bodies linked to active bodies
- All moving areas are on separate islands (can be parallelized)
- Fix inconsistencies with body islands (Kinematic bodies could link
bodies together or not depending on the processing order)
- Completely prevent static bodies to be active (it could cause islands
to be wrongly created and cause dangerous multi-threading operations as
well as inconsistencies in created islands)
- Apply impulses only on dynamic bodies to avoid unsafe multi-threaded
operations (static bodies can be on multiple islands)
- Removed inverted iterations when populating body islands, it's now
faster in regular order (maybe after fixing inconsistencies)
2021-04-26 18:26:00 -07:00
Dennis Brakhane 31d41d83c3 Remove duplicate comments
A few single line comments were duplicated, probably due to bad merges.

This commit removes the obviously duplicate ones.
2021-04-25 20:03:52 +02:00
Maganty Rushyendra ccc375f163 Fix AudioServer Crash when bus count equals 0 2021-04-24 11:22:19 -04:00
jfons 4d9d99bb82 Implement occlusion culling
Added an occlusion culling system with support for static occluder meshes.
It can be enabled via `Project Settings > Rendering > Occlusion Culling > Use Occlusion Culling`.

Occluders are defined via the new `Occluder3D` resource and instanced using the new
`OccluderInstance3D` node. The occluders can also be automatically baked from a
scene using the built-in editor plugin.
2021-04-23 21:45:23 +02:00
rafallus cfa06f0f76 Unexpose _direct_state_changed in PhysicsBody
Removed _direct_state_changed bindings
Affects 2D and 3D nodes
Callbacks now use Callable
Tests were changed accordingly
2021-04-22 23:20:58 -05:00
Rémi Verschelde f6d5b2f3c2
Merge pull request #48046 from BastiaanOlij/fix_reflection_probe
Fix reflection probe
2021-04-21 16:12:58 +02:00
Bastiaan Olij ebf10fe736 Fix reflection probe 2021-04-21 23:42:29 +10:00
Rémi Verschelde fdf041a466
Merge pull request #47347 from nekomatata/heightmap-support
Heightmap collision shape support in Godot Physics
2021-04-20 17:40:28 +02:00
reduz 906882ee66 Split particle shader entry points
* Particle shaders now have start() and process()
* Particle collision happens between them.
* The RESTART property is kept, so porting an old shader is still possible.

This fixes the problem of particle collisions not functioning on the first particle frame.
2021-04-17 12:22:55 -03:00
Rémi Verschelde c022582c1e
Merge pull request #47942 from nekomatata/joint-check-body-types
Fix errors related to joints setup with two non-dynamic bodies
2021-04-16 08:51:19 +02:00
PouleyKetchoupp 60ae264db1 Fix errors related to joints setup with two non-dynamic bodies 2021-04-15 17:37:45 -07:00
Henry Conklin 9b65b00296 Optimize BroadPhase2dHashGrid to not pair elements on different layers
Clean up logic in _check_motion

Closes 45824
2021-04-15 17:20:07 -04:00
Rémi Verschelde c7a4e2196e
Merge pull request #47878 from clayjohn/rename-get_surface_material
Rename get_surface_material to get_surface_override_material
2021-04-15 07:57:15 +02:00
clayjohn 92731d292c Rename get_surface_material to get_surface_override_material 2021-04-14 20:24:03 -07:00
Rémi Verschelde 9e0f87359b
Merge pull request #47846 from nekomatata/solver-optimization
Godot Physics solver optimization
2021-04-14 18:04:30 +02:00
reduz d3b49c416a Refactor GLSL shader compilation
-Used a more consistent set of keywords for the shader
-Remove all harcoded entry points
-Re-wrote the GLSL shader parser, new system is more flexible. Allows any entry point organization.
-Entry point for sky shaders is now sky().
-Entry point for particle shaders is now process().
2021-04-14 11:37:52 -03:00
PouleyKetchoupp b65d6b56fb Godot Physics solver optimization
Several optimizations in the way solver islands are processed in both
2D and 3D physics:
- Use LocalVector instead of linked list to avoid cache misses (with
persistent storage based on worst case scenario)
- Remove pairs when setup fails (no valid contact) to avoid unnecessary
solving of non-colliding rigid bodies just to return immediately
2021-04-12 18:59:49 -07:00
PouleyKetchoupp 70aa39d127 Fix SoftBody contact impulses applied on rigid bodies
Parameters were inverted in `apply_impulse` and `apply_bias_impulse` due
to a modification on master.
2021-04-12 17:38:14 -07:00
Bastiaan Olij 71c5d73b5e Remove low_end option from renderer, being replaced by separate implementation 2021-04-09 22:04:56 +10:00
Rémi Verschelde 68b28c6cd4
Merge pull request #47678 from madmiraal/fix-47436.1
Check for empty ConcavePolygonShape2D before checking for intersection
2021-04-06 22:35:49 +02:00
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