Commit graph

1650 commits

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

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

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

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

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

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

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

Also adds an editor restart to changing ninepatch mode and software skinning, which will be more user friendly.
2021-03-10 09:30:23 +00:00
Ev1lbl0w
bae4b0c952
Fix negative VRAM values 2021-03-09 09:51:17 +00:00
Kyle
1c208d6baa Fixes division by zero when 3d body does not have valid shape (3.2 only)
Fixes #46738 by setting the default inertia to a valid value when there are no valid shapes for a 3d body.
2021-03-08 20:32:16 -05:00
Rémi Verschelde
118567ca28
Merge pull request #46657 from lawnjelly/revert_snapping
Revert backport of 2D transform and camera snapping options
2021-03-08 14:49:41 +01:00
Hugo Locurcio
0c6873b13e
Tweak shader errors for features only usable in GLES3
See https://github.com/godotengine/godot/issues/42719#issuecomment-792168504.
2021-03-07 13:27:13 +01:00
lawnjelly
bf1de6bbfa Revert backport of 2D transform and camera snapping options
More work is needed to make sure that those options actually solve users' issues, so we prefer to remove the options for 3.2.4 and revisit for a future release.
2021-03-05 14:20:31 +00:00
QbieShay
b239c6706e visual server now sorts based on aabb position
this was causing issues with scenes where the origin of the objects
was set for all objects to the center of the scene, making transparent
objects sort improperly

This work was kindly sponsored by IMVU

Co-authored-by: RevoluPowered <gordon@gordonite.tech>
2021-03-05 11:06:11 +01:00
Rémi Verschelde
9fa85b343c
Merge pull request #46495 from asheraryam/fix-clip-content-error
Fix rounding error in Clip Content [3.2]
2021-03-02 17:07:06 +01:00
Rémi Verschelde
11ee43647b
Merge pull request #46590 from JFonS/fix_gridmap_lightmaps
[3.2] Properly disable dynamic lights on baked instances.
2021-03-02 15:05:29 +01:00
JFonS
62f344f448 Properly disable dynamic lights on baked instances.
Automatically set the `baked_light` bool when applying a lightmap to an
instance. This ensures the disabling of dynamic lights when the
bake mode is set to ALL.
2021-03-02 14:49:01 +01:00
Ev1lbl0w
3fe851accc Added missing returns on error scenarios
(cherry picked from commit 3d9ef1e4de)
2021-03-02 10:26:14 +01:00
Yuri Roubinsky
29616f4a35 Fix parsing hexadecimal (lowercase e,f) in shaders
(cherry picked from commit 19e0a1ec9d)
2021-03-02 10:26:14 +01:00
lawnjelly
b1e24597e7 Renaming rendering/2d project settings.
The rendering/quality/2d section of project settings is becoming considerably expanded in 3.2.4, and arguably was not the correct place for settings that were not really to do with quality.

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

Class reference is also updated and slightly improved.

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

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

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

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

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

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

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

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

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

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

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

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

It turns out that for some items (especially meshes), set_pairable is never called. This PR detects this occurrence and forces a collision check at the end of the routine.
2021-02-14 09:03:26 +00:00
Pedro J. Estébanez
ae215451fc Make audio bus channels' peak volume consistent
Channels that are inactive -or when playback has not started yet- will report -200 dB as their peak value (which is also the lowest value possible during playback).

(cherry picked from commit a2b3a73e2d)
2021-02-05 09:26:09 +01:00
Rémi Verschelde
3115ac4b60
Merge pull request #45663 from akien-mga/3.2-cherrypicks
Cherry-picks for the 3.2 branch (future 3.2.4) - 19th batch
2021-02-02 19:19:31 +01:00
Rémi Verschelde
24cb60893f
Merge pull request #45654 from furrykef/3.2
Add anisotropic filtering to GLES2 backend
2021-02-02 18:12:52 +01:00
Pablo Escobar
407c6d3a9c
Add METALLIC to light() built-ins
(cherry picked from commit 1300fc7307)
2021-02-02 13:02:46 +01:00
Kef Schecter
09a156ea15 Add anisotropic filtering to GLES2 backend
Move definition of rendering/quality/filters/anisotropic_filter_level to
servers/visual_server.cpp, since both GLES2 and GLES3 now use it

rasterizer_storage_gles3.cpp: Remove a spurious variable write (the
value gets overwritten soon after)
2021-02-02 01:40:58 -06:00
lawnjelly
00bd087d82 BVH add support for visibility (activation)
A major feature lacking in the octree was proper support for setting visibility / activation. This meant that invisible objects were still causing lots of processing in the tree unnecessarily.

This PR adds proper support for activation, items are temporarily removed from the tree and collision detection when inactive.
2021-01-30 13:21:40 +00:00
Sean LaPlante
2ed700d2da
Fixes #45025 - Protects _last_mix_time and _last_frame_time with the AudioDriver lock() and unlock() methods
(cherry picked from commit 17ac012728)
2021-01-26 17:00:14 +01:00
lawnjelly
2527067c4d Partially revert change to BVH render tree update method
Leaves in the bug fixes, but reverts the change to the update method.

Turns out the new update method of getting the scenarios was causing problems, I will need to consult with reduz on the best way of getting access to the scenarios for a single update per frame.

Doing multiple updates isn't terrible but it should be nicer to get a single update working, as it should be more efficient, and give a single point for pairing callbacks.
2021-01-20 19:15:07 +00:00
Rémi Verschelde
bcbbb6a30c
Merge pull request #45319 from nekomatata/bvh-create-aabb-3.2
BVH broadphase creates objects with updated AABB to avoid extra checks
2021-01-20 10:37:36 +01:00
PouleyKetchoupp
10868e76e6 BVH broadphase creates objects with updated AABB to avoid extra checks
When set_static is called on a newly added object, the forced collision
check in BVH set_pairable was using an empty AABB, which caused
unnecessary collision checks at the origin, then a call to move was
checking again at the right position.

These changes ensure broadphase objects are added to the BVH tree with
proper AABB so collision checks are correctly done right away.

Octree & Basic broadphase trees are not affected by these changes.
2021-01-19 12:22:33 -07:00
lawnjelly
4954a869bb BVH render tree new updating scheme
Change render BVH update scheme from once per update_dirty_instances to a new update_scenarios function called once per draw.

Fix lights not being properly unpaired.
Fixed bug in add_changed_item where AABBs were not being updated due to more than one update per tick.
2021-01-19 14:24:32 +00:00
Rémi Verschelde
497653ab53
Merge pull request #44628 from JFonS/new_cpu_lightmapper_3.2
[3.2] New CPU lightmapper
2021-01-15 13:25:46 +01:00
JFonS
b1ca82c43a CPU lightmapper fixes.
- Fix Embree runtime when using MinGW (patch by @RandomShaper).
- Fix baking of lightmaps on GridMaps.
- Fix some GLSL errors.
- Fix overflow in the number of shader variants (GLES2).
2021-01-15 12:32:54 +01:00
Rémi Verschelde
152415a006
Merge pull request #43924 from madmiraal/fix-43588-3.2
[3.2] Fix cast_motion sometimes failing
2021-01-14 20:44:40 +01:00
JFonS
112b416056 Implement new CPU lightmapper
Completely re-write the lightmap generation code:
- Follow the general lightmapper code structure from 4.0.
- Use proper path tracing to compute the global illumination.
- Use atlassing to merge all lightmaps into a single texture (done by @RandomShaper)
- Use OpenImageDenoiser to improve the generated lightmaps.
- Take into account alpha transparency in material textures.
- Allow baking environment lighting.
- Add bicubic lightmap filtering.

There is some minor compatibility breakage in some properties and methods
in BakedLightmap, but lightmaps generated in previous engine versions
should work fine out of the box.

The scene importer has been changed to generate `.unwrap_cache` files
next to the imported scene files. These files *SHOULD* be added to any
version control system as they guarantee there won't be differences when
re-importing the scene from other OSes or engine versions.

This work started as a Google Summer of Code project; Was later funded by IMVU for a good amount of progress;
Was then finished and polished by me on my free time.

Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
2021-01-14 18:05:56 +01:00
lawnjelly
7b33050b3d BVH - fix physics expecting plus one based IDs.
Godot physics relies on ID zero being invalid, whereas BVH 0 is a valid ID.
2021-01-14 13:26:44 +00:00
Rémi Verschelde
b9c5e2f9eb
doc: Sync classref with current source
And fix copyright headers in new code.
2021-01-13 16:55:27 +01:00
Rémi Verschelde
49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde
188609e5ab
CI: Update to clang-format 11 and apply ternary operator changes
(cherry picked from commit af878716f2)
2021-01-13 16:14:35 +01:00
lawnjelly
690e07b509 Dynamic BVH for rendering and godot physics
Complete rewrite of spatial partitioning using a bounding volume hierarchy rather than octree.

Switchable in project settings between using octree or BVH for rendering and physics.
2021-01-12 12:12:10 +00:00
Marcel Admiraal
1061bb364e Fix multiple issues with one-way collisions
For RigidBodies, uses the collision normal determined by relative motion
to determine whether or not a one-way collision has occurred.

For KinematicBodies, performs additional checks to ensure a one-way
collision has occurred, and averages the recovery step over all collision
shapes.

Co-authored-by:    Sergej Gureev <sergej.gureev@relex.fi>
2021-01-07 09:23:17 +00:00
Marcel Admiraal
03cddd36db Remove all elements from monitored_bodies and monitored_areas when processed 2020-12-26 09:24:43 +00:00
lawnjelly
a237c671bb Improve 2d snapping
Partially revert change allowing sprite get_rect snapping to be controlled by `pixel_snap` again rather than `transform_snap` (to prevent breaking compatibility). Adds a final `use_camera_snap` project setting to allow snapping viewports as in reduz original PR.
2020-12-25 18:53:00 +00:00
Rémi Verschelde
4436f95dce
Merge pull request #44458 from dedm0zaj/3.2_lightmap_capture_data_energy
[3.2] Lightness of dynamic objects from Energy BakedLightmapData
2020-12-25 15:07:31 +01:00
lawnjelly
15e57a0235 Remove buffer orphaning options project settings
These were only put in for the betas, in order to test hypotheses for stalling on Macs. It seems that most of the problems in the Mac editor have been solved by fixing the excessive redraw_requests.

As a result no one has reported any results from these options, but in future we will be able to refer users to try the beta versions, so there is no need to include them in the stable release. Indeed they are only likely to cause confusion.
2020-12-23 15:23:02 +00:00
dedm0zaj
96e2887945 Lightness of dynamic objects from Energy Lightmap Capture Data 2020-12-17 22:02:08 +07:00
Marcel Admiraal
825ad65fc4 Remove Generic6DOFJoint precision property 2020-12-15 10:15:42 +00:00
Marcel Admiraal
634a14844e Fix inconsistent Joint3DSW copy constructor and assignment declarations 2020-12-07 16:31:16 +00:00
Marcel Admiraal
2e99b5b137 Fix cast_motion sometimes failing
- Fixes Godot physics failing when the cast Shape is inside of, or
already colliding with another Shape.
- Fixes Bullet physics failing when there is no motion.
- Ensures Godot and Bullet physics behave the same.
- Updates the documentation to exclude the caveats for the failures and
differences.
2020-11-27 15:32:25 +00:00
Rémi Verschelde
4d667dadb9
Merge pull request #43554 from lawnjelly/refactor_pixel_snap
Add 2d snap transforms option
2020-11-16 18:24:10 +01:00
Rémi Verschelde
fc5b106369
Merge pull request #42168 from madmiraal/fix-42108-3.2
[3.2]  Remove the unnecessary sync() and the restrictions it imposes on 3D Physics.
2020-11-16 09:33:17 +01:00
lawnjelly
a79293e0fc Add 2d snap transforms option
This is a cut back backport of reduz snapping PR #43194.

It just offers a global project setting for transform snapping.
2020-11-15 09:40:07 +00:00
Michael Alexsander
5dafeb94e3
Disallow setting the AudioServer's 'global_rate_scale' to a value equal or inferior to 0
(cherry picked from commit d7f2c31a05)
2020-11-11 15:30:56 +01:00
lawnjelly
5c8f497a24 Add project settings to manually specify API usage
As a result of the GLES specifications being vague about best practice for how buffers should be used dynamically, different GPUs / platforms appear to have different preferences.

Mac in particular seems to have a number of problems in this area, and none of the rendering team uses Macs. So far we have relied on guesswork to choose the best usage, but in an attempt to pin this down, this PR begins to introduce manual selection of options for users to test their configurations.
2020-10-31 18:33:55 +00:00
Rémi Verschelde
c43b2ab603
Merge pull request #42942 from Calinou/add-viewport-debanding-3.2
Add a debanding property to Viewport for GLES3
2020-10-30 11:47:57 +01:00
Rémi Verschelde
2e073ecbea
Merge pull request #42927 from lawnjelly/octree_default
Change render octree balance default
2020-10-21 10:19:34 +02:00
Hugo Locurcio
2dbc329704
Add a debanding property to Viewport for GLES3
It can be enabled in the Project Settings
(`rendering/quality/filters/use_debanding`). It's disabled
by default as it has a small performance impact and can make
PNG screenshots much larger (due to how dithering works).

As a result, it should be enabled only when banding is noticeable enough.

Since debanding requires a HDR viewport to work, it's only supported
in the GLES3 backend.
2020-10-20 19:07:15 +02:00
Hugo Locurcio
af45c97652
Add fast approximate antialiasing (FXAA) to Viewport
This backports FXAA from the `master` branch.

Co-authored-by: Clay John <claynjohn@gmail.com>
2020-10-20 14:54:52 +02:00
lawnjelly
10cdfda894 Change render octree balance default
Another bug in the octree has been discovered which can cause flickering in rare circumstances : #42895

For safety until this is fixed properly this PR reverts the default state of the octree to match the old behaviour, which doesn't appear exhibit the bug (or at least not as readily).
2020-10-20 08:49:52 +01:00
Rémi Verschelde
a239894827
Merge pull request #42902 from akien-mga/3.2-cherrypicks
Cherry-picks for the 3.2 branch (future 3.2.4) - 5th batch
2020-10-19 22:14:05 +02:00
Juan Linietsky
388ebfb498
Merge pull request #41629 from JFonS/disable_baked_lights
Disable lights for objects with baked lighting
2020-10-19 14:12:50 -03:00
Pedro J. Estébanez
aea87e9353
Fix application of window in FFT
(cherry picked from commit 257ba4a7fb)
2020-10-19 16:10:00 +02:00
Hugo Locurcio
34ac0387d6
Deprecate the GIProbe Compress property due to known bugs
This property introduced green artifacts in GI and didn't improve
performance.

The new GIProbe in `master` no longer has a Compress property.
2020-10-19 14:51:23 +02:00
lawnjelly
c2290dbedd Unified GLES2 / GLES3 Batching
Batching is mostly separated into a common template which can be used with multiple backends (GLES2 and GLES3 here). Only necessary specifics are in the backend files.

Batching is extended to cover more primitives.
2020-10-16 10:34:47 +01:00
JFonS
fcb00ca048 Disable lights for objects with baked lighting
Don't apply lighting to objects when they have a lightmap texture and
the light is set to BAKE_ALL. This prevents applying the same direct
light twice on the same object and makes setting up scenes with mixed
lighting much easier.
2020-10-11 20:41:40 +02:00
PouleyKetchoupp
f9544716f4 Option for software skinning in MeshInstance
Option in MeshInstance to enable software skinning, in order to test
against the current USE_SKELETON_SOFTWARE path which causes problems
with bad performance.

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2020-10-08 16:14:55 +02:00
Marcel Admiraal
6c4a02479d
Fix how Line2D obtains the other object's supports
Measure the distance from the line against the rotated object, not the
rotated line, when obtaining the object's supports against a line.

(cherry picked from commit 7e44682c03)
2020-10-04 20:54:35 +02:00
Rémi Verschelde
0845fbb51b
Merge pull request #32475 from lawnjelly/hideshadow
Showing and hiding geometry updates shadows (3.2)
2020-10-02 11:39:47 +02:00
Rémi Verschelde
66cbcc1b7e
Merge pull request #41123 from lawnjelly/octree_fix
Optimize octree and fix leak
2020-09-30 23:11:31 +02:00
John Pennycook
f8cc7893d0
Make YSort stable
Keeps track of the order in which items are collected by
_collect_ysort_children, and uses that order to break
ties between items with similar Y positions.

(cherry picked from commit 8d3afa985b)
2020-09-29 13:57:57 +02:00
Marcel Admiraal
e7d779dbb3 Increment index when populating PhysicsShapeQueryParameters exclude array. 2020-09-27 10:33:35 +01:00
Fabio Alessandrelli
6dffc1ef46
Ignore thread models when compiling with NO_THREAD
The thread model option for physics (2D) and rendering (single-unsafe,
single-safe, multithread), was causing crashes/locks when set as
multithreaded and exported for a platform that does not support threads
(namely HTML5).

This commit ensures that when threads support is not available, that
option is ignored, and the equivalent of "single-unsafe" is always used
instead.

(cherry picked from commit f3c6ac1d71)
2020-09-24 14:43:08 +02:00
Keegan Owsley
777d90d7a1
Wrap angles to (-pi, pi) in momentum calculation.
Fixes a bug that causes KinematicBody2Ds to produce too much angular
momentum when rotating beyond 180 degrees.

(cherry picked from commit e148338d42)
2020-09-24 14:43:06 +02:00
Markus Sauermann
d2636cd30f
Wake up RigidBody 2D after applying torque
(cherry picked from commit 8335f00949)
2020-09-24 14:43:05 +02:00
Rémi Verschelde
c8859f0463
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
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
```
2020-09-18 14:09:51 +02:00
Marcel Admiraal
fc72c3fdf5 Remove the unnecessary sync() and the restrictions it imposes on 3D Physics. 2020-09-18 10:42:59 +01:00
Fredia Huya-Kouadio
0af5cded1e Fix the update logic for user-added custom defines.
The previous logic was causing the (unintentional) removal of custom defines automatically added by the engine.
2020-09-06 21:31:09 -07:00
lawnjelly
667c970b77 Optimize octree and fix octree leak
Prevents adding new octants until a limiting number of elements have been added to the current octant. This enables balancing the benefits of brute force against the benefits of spatial partitioning. The limit can be set per octree.

Project settings are added for rendering octree to set the best balance per project depending on number of tests per frame / tick, and the amount of editing of the octree.

Fixes octants being leaked when removing elements.

Optimize octree with cached linear lists

Storing elements in octants using linked lists is efficient for housekeeping but very slow for testing. This optimization stores additional local_vectors with Element pointers and AABBs which are cached and only updated when a dirty flag is set on the octant.

This is selectable with 2 versions of Octree : Octree and Octree_CL, Octree being the old behaviour. At present the cached list version is only used for the visual server octree (rendering) as it has only been demonstrated to be faster there so far.

This uses slightly more memory (probably a few kb in most cases) but can be significantly faster during testing (culling etc).

Co-authored-by: Sergey Minakov <naithar@icloud.com>
2020-08-18 11:02:21 +01:00
clayjohn
8571f7b041 Check arrays before generating Polygon2D AABBs 2020-08-16 21:08:52 -07:00
Rémi Verschelde
f4d6830949
Merge pull request #40869 from clayjohn/3.2-polygon-aabb
Properly calculate polygon2D AABB with skeleton
2020-07-31 12:55:47 +02:00
clayjohn
32928c2112 Properly calculate polygon2D AABB with skeleton 2020-07-30 16:40:05 -07:00
Holger Dammertz
efe6b50f17 Added option to enable high precision float in GLES2
An additional project setting under rendering/gles2/compatibility with the name
enable_high_float.Android is introduced that enables #define USE_HIGHP_PRECISION
in GLES2 shader on Android when it is supported by the shader compiler.
This fixes #33633 and #32813 and also https://github.com/GodotVR/godot_oculus_mobile/issues/60
and https://github.com/GodotVR/godot_oculus_mobile/issues/68 on devices that
support the highp (high precision) modifier.
2020-07-30 05:40:15 +02:00
Rémi Verschelde
400a780050 Revert "Allow Area2D and 3D mouse events without a collision layer"
This reverts commit 15850687a8.
2020-07-27 22:46:04 +02:00
Juan Linietsky
ceeb690476 Properly pass safe margin on initialization.
Fixes jitter.

(cherry picked from commit 13e0385702)
2020-07-15 12:48:18 +02:00
Rémi Verschelde
d2be483e96
Merge pull request #40406 from Chaosus/fix_shader_3.2
[3.2] Fix some incorrect conversions which lead to crash in shaders
2020-07-15 09:13:41 +02:00
Yuri Roubinsky
ecd54630ef [3.2] Fix some incorrect conversions which lead to crash in shaders 2020-07-15 06:36:24 +03:00
Tomasz Chabora
15850687a8 Allow Area2D and 3D mouse events without a collision layer
Co-authored-by:    Tomasz Chabora <kobewi4e@gmail.com>
2020-07-11 11:14:12 +01:00
Marcel Admiraal
ccdfaf2491 Remove elements from monitored_bodies and monitored_areas as they are
processed before calling the callback, instead of after they have all
been processed, because the callbacks may readd them.
2020-07-04 10:08:33 +01:00
Cevantime
6206f4439d fix laxist collision detection on one way shapes
(cherry picked from commit 23f7d2c29d)
2020-07-03 15:34:30 +02:00
Fabio Alessandrelli
d06ad40757 Add default 50ms output_latency web override.
Hopefully a good tradeoff between latency and performance on most
browsers.
2020-07-02 14:30:23 +02:00
Rémi Verschelde
63fd0d37ed
Merge pull request #39895 from madmiraal/fix-39768-3.2
[3.2] Trigger broadphase update when changing collision layer/mask.
2020-06-29 21:34:56 +02:00
Marcel Admiraal
de284ea5d2 Trigger broadphase update when changing collision layer/mask, and
check for collision layer/mask changes in 2D hash grid broadphase update.
2020-06-27 18:11:21 +01:00
Yuri Roubinsky
891b84a833 [3.2] Prevents usage of return in main shader functions 2020-06-27 17:38:22 +03:00
Yuri Roubinsky
474b178534 [3.2] Fix shader crash if pass const argument to 'out/inout' parameter 2020-06-25 10:27:37 +03:00
Marcel Admiraal
b006f5402d Check for motion in cast_motion() before doing Bullet convexSweepTest().
Also ensure that default closest_safe and closest_unsafe values are
defined in cast_motion() and before cast_motion() is called.
2020-06-21 16:28:01 +01:00
Ev1lbl0w
17c87d2ec1
Expose disable_render_loop property to GDScript 2020-06-18 11:59:29 +01:00
Marcel Admiraal
a48e13101d Ensure pair callback data is set to null when it's null. 2020-06-13 14:37:40 +01:00
Rémi Verschelde
3fb9c776ff
Merge pull request #39437 from akien-mga/3.2-cherrypicks
Cherry-picks for the 3.2 branch (future 3.2.2) - 8th batch
2020-06-10 17:33:50 +02:00
Rémi Verschelde
3c7e03510c
Merge pull request #39256 from lawnjelly/tilemap_pixel2
GLES2 batching - Add UV precision adjustment for tilemaps
2020-06-10 15:52:00 +02:00
Rémi Verschelde
7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
Rémi Verschelde
c9a8309e73
Merge pull request #39169 from lawnjelly/light2d_layer_fix
3.2 Make Light2D respect CanvasLayer layer_min and layer_max
2020-06-10 13:35:37 +02:00
Rémi Verschelde
9901eac9f5
Merge pull request #39400 from madmiraal/fix-39374-3.2
[3.2] Test collision mask before creating constraint pair in Godot physics broadphase 2D and 3D.
2020-06-09 13:38:11 +02:00
Marcel Admiraal
5794a4e11e Test collision mask before creating constraint pair in Godot physics
broadphase 2D and 3D.
2020-06-08 17:43:41 +01:00
lawnjelly
1b5c4bc5b7 Make Light2D respect CanvasLayer layer_min and layer_max
As the masked light list takes no account of layer_min and layer_max, the canvas_layed_id is passed to the _light_mask_canvas_items function where it can be used to reject lights outside the layer range.
2020-06-08 05:41:18 +01:00
lawnjelly
275183ef15 GLES2 batching - Add UV precision adjustment for tilemaps
Scaling tilemaps can cause border artifacts around the edges of tiles. This has been traced to precision issues in the GPU. This PR adds an adjustment to allow a minor contraction of the UVs of rects in order to compensate for the incorrect classification of texels across the UV border.
2020-06-07 16:29:40 +01:00
Rémi Verschelde
6e1af78df4
Merge pull request #39068 from lawnjelly/kessel_settings_rename
Rename batching project settings in preparation for GLES3
2020-06-07 14:25:50 +02:00
Pedro J. Estébanez
1ff7b0a0a9 Add shader time scaling
Shaders' `TIME` will be affected by the new shader time scale, that is set via the also new `VisualServer::set_time_scale()`.
2020-06-06 23:59:48 +02:00
lawnjelly
bf54fa5a62 Light2D shadow mask construction fix
When using the default setting (layer 1 set only) nothing is stored in the tscn file for a Light2D, hence it relies on the value in the constructor.

The problem is the constructed value is 1 in Light2D, and -1 in RasterizerCanvas::Light. -1 results in all bits being set so all occluders are shown, rather than just those in layer 1.

This PR changes Rasterizer::Canvas constructor to set to 1. An alternative is to have -1 as the value for layer 1 throughout.
2020-05-30 09:29:38 +01:00
lawnjelly
c7d18dec70 Rename batching project settings in preparation for GLES3
As it now seems like we will soon have GLES3 batching working using the same intermediate layer as GLES2, it makes more sense to reuse the same batching settings for both renderers rather than duplicate project settings for GLES2 and GLES3.
2020-05-26 18:15:35 +01:00
Fabio Alessandrelli
92031098bf Move mixrate and latency definition to AudioServer
Each driver used to define the (same) project settings value, but the
setting names are not driver specific. Ovverriding is still possible via
platform tags.

(cherry picked from commit 90c7102b51)
2020-05-18 16:40:33 +02:00
Marcel Admiraal
253d211102 Silence EQ::Band::c1, c2 and c3 may be used uninitialized warnings.
(cherry picked from commit d02143905f)
2020-05-13 16:12:37 +02:00
Rémi Verschelde
d20485039c
Merge pull request #38453 from lawnjelly/ios_halffloat_hacky
GLES2 disable half-float project setting
2020-05-04 16:29:27 +02:00
lawnjelly
30a3f16e34 GLES2 disable half-float project setting
It seems that particles (and some other features) do not work correctly on iOS in GLES2 because either many of the devices do not support half float compression, or the GL constant used to reference it from Godot is incorrect.

This PR adds a project setting in rendering/gles2/ to disable half-float compression on iOS.
2020-05-04 13:11:23 +01:00
Pedro J. Estébanez
d8be5a9986 Add MODULATE builtin to canvas item shaders 2020-05-04 00:10:24 +02:00
Rémi Verschelde
01a085d05f
Merge pull request #38320 from lawnjelly/kessel_pr_light_join
GLES2 2D batching - item reordering, light joining and light modulate fix
2020-05-01 15:03:03 +02:00
Rhathe
768f4e684c Enable setting of collision iterations in Physics2DServer
This allows fine-tuning of collision iterations for more
accurate collision physics with a performance cost.
2020-05-01 03:49:21 -04:00
lawnjelly
451c3fc0fb GLES2 2D batching - item reordering, light joining and light modulate fix
Although 2D draws in painters order with strict ordering, in certain circumstances items can be reordered to increase batching / decrease state changes, without affecting the end result. This can be determined by an overlap test.

In situation with item:
A-B-A
providing the third item does not overlap the second, they can be reordered:
A-A-B

Items already contain an AABB which can be used for this overlap test.

1)
To utilise this, I have implemented item reordering (only for single rects for now), with the lookahead adjustable in project settings. This can increase performance in situations where items may not be grouped in the scene tree by texture. It can also be switched off (by setting lookahead to 0).

2)
This same trick can be used to help join items that are lit. Lit items previously would prevent joining completely, thus missing out on performance gains other than multi-command items such as tilemaps.

In this PR, lights are assigned as bits in a bitfield (up to 64, the optimization is disabled above this), and on each try_item (for joining), the bitfield for lights and shadows is constructed and compared with the previous items. If these match the 2 items can potentially be joined. However, this can only be done without changing the rendered result if an overlap test is successful.

This overlap test can be adjusted to join items up to a specific number of item references, selectable in project settings, or turned off.

3)
The legacy uniform single rect drawing routine seems to have been identified as the source of flicker, particularly on nvidia. However, it can also be up to 2x as fast. Because of the speed the batching contains a fallback where it can use the legacy single rect method, but I have now added a project setting to make this switchable. In most cases with batching it should not be necessary (as single rects are drawn less frequently) and thus the flickering can be totally avoided.

4)
This PR also fixes a color modulate bug when drawing light passes, in certain situations (particularly custom _draw routines with multiple rects).

5)
This PR also fixes #38291, a bug in the legacy renderer where light passes could draw rects in wrong position.
2020-05-01 07:47:33 +01:00
Rémi Verschelde
da68cece7f
Merge pull request #38338 from RandomShaper/time_rollback_3.2
Improve shader time roll over (3.2)
2020-04-30 09:07:34 +02:00
Rémi Verschelde
8d93303483
Merge pull request #37863 from ExpiredPopsicle/culling5
Fixed false positives in the culling system.
2020-04-30 08:05:11 +02:00
Pedro J. Estébanez
7cc0f181c9 Improve shader time roll over
- Resurrect it for GL ES 2
- Apply roll over with `fmod()` instead of resetting it to 0
- Expose the setting from the `VisualServer`, since it does not belong in any specific rasterizer
2020-04-29 22:33:03 +02:00
Rémi Verschelde
f2150d1766
Merge pull request #37462 from Chaosus/shader_fix_const_order
[3.2] Fix shader constant sorting
2020-04-29 09:41:49 +02:00
Kiri Jolly
2c6e859c2d Fixed unbounded dual-paraboloid shadow map culling.
Dual paraboloid shadowmaps were ending up with infinitely large volumes of area behind the hemisphere un-culled.

This change just adds a back plane to the convex shape used for the culling volume.
2020-04-28 17:13:36 -07:00
Rémi Verschelde
008e0748c1
Merge pull request #37349 from lawnjelly/kessel32_1
GLES2 2d Batch rendering (across items)
2020-04-17 12:55:33 +02:00
lawnjelly
72adefa5cf Add frame diagnostics for GLES2 Batch renderer
Added project setting to enable / disable print frame diagnostics every 10 seconds. This prints out a list of batches and info, which is useful to optimize games and identify performance problems.
2020-04-17 08:54:33 +01:00
Marcel Admiraal
3e71992eda Assign zero to range when ConvexPolygonShape2D is empty.
(cherry picked from commit 88d307df14)
2020-04-16 12:57:22 +02:00
lawnjelly
b6d652367b Items and draw calls added to IDE Monitor in '2d' section
This adds 2 new values (items and draw calls) to the performance monitor in a '2d' section, rather than reusing the 3d values in the 'raster' section.

This makes it far easier to optimize games to minimize drawcalls.
2020-04-16 11:52:22 +01:00
lawnjelly
93af8e7d1b Batching across z_indices
Extra functions canvas_render_items_begin and canvas_render_items_end are added to RasterizerCanvas, with noop stubs for non-GLES2 renderers. This enables batching to be spready over multiple z_indices, and multiple calls to canvas_render_items.

It does this by only performing item joining within canvas_render_items, and deferring rendering until canvas_render_items_end().
2020-04-12 13:52:25 +01:00
lawnjelly
45b0b8bff8 GLES2 2d Batch rendering (across items)
2d rendering is currently bottlenecked by drawing primitives one at a time, limiting OpenGL efficiency. This PR batches primitives and renders in fewer drawcalls, resulting in significant performance improvements. This also speeds up text rendering.

This PR batches across canvas items as well as within items.

The code dynamically chooses between a vertex format with and without color, depending on the input data for a frame, in order to optimize throughput and maximize batch size. It also adds an option to use glScissor to reduce fillrate in light passes.
2020-04-04 17:13:58 +01:00
Yuri Roubinsky
ee93c85ef1 Fix shader constant sorting 2020-03-31 14:32:33 +03:00
Rémi Verschelde
acd14e645a Remove unused classes and stray headers
Found by reviewing headers with 1 or less matching includes:
```
find -name thirdparty -prune -o -name "*.h" -exec basename {} \; | sort -u > headers
for header in $(cat headers); do echo "$header: "; rg -l "#include \"(.*/)?$header\"" | wc -l; done > list-includes
```

(cherry picked from commit 9d24541597)
2020-03-25 11:38:54 +01:00
Yuri Roubinsky
4dd1eee769 Enables passing out built-in parameter from parent function in shaders
(cherry picked from commit 7a2c6a8c0e)
2020-03-25 11:38:53 +01:00
Rémi Verschelde
cc70b2fa0a
Merge pull request #36342 from m4gr3d/external_texture_support_for_godot_3_2
Add support for opengl external textures
2020-03-17 16:29:14 +01:00
Michael Alexsander
bd2a2a7e40 Turn Rect2's 'intersects_touch()' into an extra argument of 'intersects()'
(cherry picked from commit 8c8c48a7ad)
2020-03-06 23:51:26 +01:00
fhuya
30d738eda7 Add support for opengl external textures as defined by https://www.khronos.org/registry/OpenGL/extensions/OES/OES_EGL_image_external.txt 2020-03-05 13:09:49 -08:00
Bastiaan Olij
0ab8889c0d Exposing get_tracker_id for ARVRPositionalTracker to GDScript
(cherry picked from commit f0b1edef8b)
2020-03-04 12:52:47 +01:00
Rémi Verschelde
ac63e5d613 Workaround WebM playback bug after AudioServer latency fixes
af9bb0ea15 fixed AudioServer's
`get_output_delay()` (which used to always return 0) while renaming it
to `get_output_latency()`. It now returns the latency from the
AudioDriver, which can be non-0.

While this was a clear bugfix, it broke playback for WebM files without
audio track. It seems like the playback code, even though it queried
the output delay to calculate a time compensation, was designed to work
even though the delay value was actually bogus. Now that it's correct,
it's not working.

As a workaround we comment out uses of the output latency, restoring
the behavior of Godot 3.1.

This code should still be reviewed by someone more versed in video
playback and fixed to properly account for the non-0 driver latency.

Fixes #35760.

(cherry picked from commit da411d1625)
2020-02-14 16:02:34 +01:00
Yuri Roubinsky
3b2490f19c Prevent shader crash if invalid builtin used after array member accessor
(cherry picked from commit 3a70566b15)
2020-02-14 16:02:21 +01:00
nathanwfranke
2d8289579a Fix bug where Control at origin with 0 size not rendered
Make a new method instead to make the code more elegant


Move Function down a bit


(cherry picked from commit e5cb557b73)
2020-02-14 15:56:12 +01:00
Yuri Roubinsky
0995696e08 Prevent shader crash when name conflict with "dus" and "__" occured
(cherry picked from commit 2c4367441c)
2020-02-06 13:02:07 +01:00
Rémi Verschelde
bb6c0d3e8b doc: Complete documentation for VideoStreams
Also quick clean up of the matching C++ files.
2020-01-26 11:29:07 +01:00
clayjohn
eb5cb5d016 Add project setting for max irradiance size 2020-01-25 13:27:13 -08:00
Yuri Roubinsky
3473a195fc Hides high-level functions from GLES2 shader autocompletion 2020-01-23 12:41:21 +03:00
Rémi Verschelde
46820527de
Merge pull request #35360 from Chaosus/restrict_uint_gles2
Disallow uint/uvec usage on GLES2 platform
2020-01-23 10:12:30 +01:00
Rémi Verschelde
37897dba80
Merge pull request #35406 from lawnjelly/ortho-shadow
Replace CameraMatrix::get_viewport_size with get_viewport_half_extents, shadow culling with ortho camera and other affected issues
2020-01-22 22:02:09 +01:00
lawnjelly
eaf8e5ce52 Change CameraMatrix::get_viewport_size to get_viewport_half_extents
Fixes #26637.
Fixes #19900.

The viewport_size returned by get_viewport_size was previously incorrect, being half the correct value. The function is renamed to get_viewport_half_extents, and now returns a Vector2.

Code which called this function has also been modified accordingly.

This PR also fixes shadow culling when using ortho cameras, because the correct input for CameraMatrix::set_orthogonal should be the full HEIGHT from get_viewport_half_extents, and not half the width.

It also fixes state.ubo_data.viewport_size in rasterizer_scene_gles3.cpp to be the width and the height of the viewport in pixels as stated in the documentation, rather than the current value which is half the viewport extents in worldspace, presumed to be a bug.
2020-01-22 18:22:00 +00:00
Rémi Verschelde
4faaf6089a Remove unused #if 0'ed code 2020-01-21 21:41:54 +01:00
Yuri Roubinsky
4c456ef979 Disallow uint/uvec usage on GLES2 platform 2020-01-20 18:59:35 +03:00
Rémi Verschelde
837adb30fd Revert "Exposes capture methods to AudioServer + documentation" #30468
Reverts the following commits:

- c81ec6f26d:
  "Exposes capture methods to AudioServer, variable renames for
  consistency, added documentation."
- 47c558b98a:
  "Expose audio callbacks as signals."
- dabaa11b3c:
  "Fix to make sure the capture buffers are deallocated at shutdown.
  Silences warnings."

Some documentation improvements were kept for pre-existing methods.

See rationale for reverting these changes in #30468.
2020-01-20 13:18:01 +01:00
Yuri Roubinsky
3dea1c725e Clears completion_class in shaders (may cause troubles if not). 2020-01-19 16:35:54 +03:00
Yuri Roubinsky
1eb8d5e142 Added missing form of array constructor in shaders 2020-01-18 11:41:55 +03:00
Rémi Verschelde
669cd46495
Merge pull request #35215 from clayjohn/multimesh-error
Add multimesh format max for proper error checking
2020-01-16 23:06:20 +01:00
Rémi Verschelde
6fd4afa96b
Merge pull request #33615 from raphael10241024/fix_shape_change
refresh area2d collision when shape changes
2020-01-16 22:56:16 +01:00
clayjohn
041fa57a88 Add multimesh format max for proper error checking 2020-01-16 13:31:17 -08:00
Yuri Roubinsky
5098232ee6 Disabled array initialization, const array and arr.length in shaders 2020-01-16 11:46:11 +03:00
clayjohn
3579187f90 Make texture_debug_usage thread safe 2020-01-12 15:22:54 -08:00
Yuri Roubinsky
1e154e0947 Fix nested break/return in shader switch statement 2020-01-10 11:57:56 +03:00
Rémi Verschelde
5edd1a27d2
Merge pull request #34671 from Chaosus/shader_hex_support
Support for hex numbers in shaders
2020-01-08 10:01:49 +01:00
Hugo Locurcio
0cad2c0cd1
Add VisualServer methods to get the video adapter name and vendor
These methods can be used in scripts to retrieve the OpenGL
`GL_RENDERER` and `GL_VENDOR` strings (respectively).

This closes #28404.
2020-01-06 00:37:56 +01:00
Rémi Verschelde
fa82664419
Merge pull request #34726 from nekomatata/polygon2d-antialiasing-fix
Fixed antialiasing option for Polygon2D with concave/hollow shapes
2020-01-03 14:17:05 +01:00
PouleyKetchoupp
1591677eb8 Fixed antialiasing option for Polygon2D
Some cases were not handled properly for Polygon2D after making changes in common code to fix Line2D antialiasing. Added an option for drawing polygons to differentiate the two use cases.

Fixes #34568
2020-01-01 11:40:14 +01:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Yuri Roubinsky
99b92c885f Support for hex numbers in shaders 2019-12-29 12:19:10 +03:00
Catchawink
86096313be Fixed an issue with recording audio.
Prior to this fix, AudioEffectRecordInstance::init() was called before recording_active is set to true in AudioEffectRecord::set_recording_active(). This was setting is_recording to false in AudioEffectRecordInstance, because is_recording updates to the value of recording_active in AudioEffectRecordInstance::_io_thread_process(). To fix this issue, AudioEffectRecordInstance::init() is now called after recording_active is set to true.
2019-12-12 10:28:46 -05:00
Rémi Verschelde
2845e6a21a
Merge pull request #34040 from qarmin/unused_variable_more_precise_numbers
Removed unused variables, add some constants numbers
2019-12-10 08:25:31 +01:00
Rafał Mikrut
ed1c4bc77d Removed unused variables, add some constants numbers 2019-12-10 05:13:02 +01:00
Rémi Verschelde
4eff13d768 doc: Markup fixes for enums and constants 2019-12-06 23:09:20 +01:00
Rémi Verschelde
99b81aa1b9
Merge pull request #34039 from Eoin-ONeill-Yokai/multimeshfix
Added Missing Binding for `multimesh_create` to VisualServer
2019-12-05 06:49:43 +01:00
Eoin O'Neill
f7f7544997 Added method binding for multimesh_create that was missing from VisualServer class. 2019-12-04 16:00:18 -08:00
Rémi Verschelde
e77c34ab4a
Merge pull request #34061 from Chaosus/fix_shader_const
Fix expressions for global constants in shaders
2019-12-03 08:53:55 +01:00
Rémi Verschelde
10bae7c05b
Merge pull request #33857 from nekomatata/polygon-2d-antialiasing
Fixed antialiased option for Polygon2D
2019-12-03 07:51:16 +01:00
Yuri Roubinsky
8b8faf03d5 Fix expressions for global constants in shaders 2019-12-02 19:00:21 +03:00
bruvzg
2ef8c5fac5
iOS modular build and export implementation. 2019-12-01 21:57:18 +02:00
PouleyKetchoupp
e6ebc43d72 Fixed antialiased option for Polygon2D / Line2D
Polygon2D:
The property wasn't used anymore after switching from canvas_item_add_polygon() to canvas_item_add_triangle_array() for drawing.

Line2D:
Added the same property as for Polygon2D & fixed smooth line drawing to use indices correctly.

Fixes #26823
2019-11-28 22:57:27 +01:00
Bojidar Marinov
2952dc3fe2
Fix crash when disabling a YSort node
Fixes #33932
2019-11-27 10:47:11 +02:00
Marcel Admiraal
6c3be2ca74 Fix Visual Studio throwing C4146 warning. 2019-11-18 15:14:04 +00:00
RaphaelHunter
8330e70e2c refresh area2d collision when shape changes, close #33369 2019-11-14 15:48:41 +08:00
Rémi Verschelde
4b8feff594
Merge pull request #33518 from BastiaanOlij/msaa_ext_modes
Add MSAA mode for Quest
2019-11-11 11:46:50 +01:00
Bastiaan Olij
4e2343160c Add special external MSAA modes for GLES2 Rift S/Quest and OpenXR optimisation 2019-11-11 21:02:06 +11:00
Rémi Verschelde
2143f46df2
Merge pull request #33516 from qarmin/small_fixes
Memory leaks and crash fixes
2019-11-10 10:17:19 +01:00
Rafał Mikrut
7dda9309f9 Memory leak and crash fixes 2019-11-10 09:49:13 +01:00
PouleyKetchoupp
530665197f Fixed Particles restart after visibility has been set to off and on again
Make sure particles are processed during the same frame when visibility is set to on, in case they are still active from before and need to be restarted.

Fixed #33476
2019-11-09 09:51:17 +01:00
Rémi Verschelde
621dc7022f
Merge pull request #27742 from rxlecky/camera-replication
Game camera override
2019-11-08 10:02:18 +01:00
Marcel Admiraal
fea58321e6 Fix 'r1' (and r2) may be used uninitialized warning in eq.cpp. 2019-11-08 08:37:06 +01:00
Rémi Verschelde
341f37aaed
Merge pull request #33153 from raphael10241024/fix_occluder
fix occluders positions error under canvas_layer
2019-11-05 14:41:28 +01:00
Yuri Roubinsky
5e44b5be81 Prevents usage of unsupported texture shader types in GLES2 2019-11-03 13:41:15 +03:00
Rémi Verschelde
d89f24b6c9
Merge pull request #33259 from Chaosus/remove_gles2_switch_op
Removed switch operator from GLES2 shader back-end
2019-11-02 19:28:18 +01:00
Yuri Roubinsky
6b7f8558d9 Removed switch operator from GLES2 shader back-end 2019-11-02 12:43:32 +03:00
Rémi Verschelde
af4fd9de9c
Merge pull request #33238 from qarmin/other_fixes
Fix some crashes, overflows and using variables without  values
2019-11-01 22:12:47 +01:00
Rafał Mikrut
9ddb3265e1 Fix some crashes, overflows and using variables without values 2019-11-01 16:16:31 +01:00
Yuri Roubinsky
1b003f3d64 Prevents shader crash on GLES2 if unsupported built-in has been used 2019-10-31 09:21:44 +03:00
Yuri Roubinsky
76eb486413 Added check if field name in the shader is equal to builtin 2019-10-29 15:37:19 +03:00
RaphaelHunter
c4cea10402 fix occluders positions error under canvas_layer, close #32880 2019-10-29 14:51:58 +08:00
Yuri Roubinsky
ef6161532d Fix shader crash if non-boolean expression inserted into "if" 2019-10-28 08:35:33 +03:00
Hugo Locurcio
701581d1d3
Improve error messages related to shader_type
The list of allowed shader types is now displayed if any
`shader_type`-related error is emitted.

This makes it easier to remember which shader types are allowed
when creating a new shader.
2019-10-26 17:43:14 +02:00
Rémi Verschelde
5cdecb8227
Merge pull request #32845 from madmiraal/rigidbody-mode-change
Activate Body(2D)SW when switching to rigid or character mode.
2019-10-25 23:36:17 +02:00
Rafał Mikrut
d468e28874 Fix leak in Physics2DServerSW 2019-10-24 20:12:46 +02:00
Erik
8b0546d93b Implement game camera override
Implemented uniform API in Viewport class to override 2D and/or
3D camera.

Added buttons in 2D and 3D editor viewport toolbars that override
the running game camera transform with the editor viewport camera
transform. Implemented via remote debugger protocol and camera
override API.

Removed LiveEditFuncs function pointers from ScriptDebugger class.
Since the debugger got access to the SceneTree instance (if one
exists), there is no need to store the function pointers. The live
edit functions in SceneTree are used directly instead. Also removed
the static version of live edit functions in SceneTree for the same
reason. This reduced the SceneTree -> Debugger coupling too since
the function pointers don't need to be set from SceneTree anymore.

Moved script_debugger_remote.h/cpp from 'core/' to 'scene/debugger/'.
This is because the remote debugger is now using SceneTree directly
and 'core/' classes should not depend on 'scene/' classes.
2019-10-23 02:51:32 +01:00
Marcel Admiraal
13798746e7 Activate Body(2D)SW when switching to rigid or character mode. 2019-10-15 07:41:13 +02:00
Rémi Verschelde
d0628180ae
Merge pull request #32799 from clayjohn/free_pools
Properly free sky and lightmap caches in multithreaded server
2019-10-13 19:44:04 +02:00
clayjohn
62fb462165 Properly free sky and lightmap caches in multithreaded server 2019-10-13 09:31:00 -07:00
Rémi Verschelde
5d63cf1610
Merge pull request #32767 from madmiraal/body2d-can_sleep-default
Fix mismatch between RigidBody2D and Body2DSW can_sleep defaults.
2019-10-12 14:06:46 +02:00
Marcel Admiraal
42a9ae7a82 Fix mismatch between RigidBody(2D) and Body(2D)SW can_sleep defaults.
- Set Body2DSW can_sleep default to true.

- Set Body2D can_sleep default to true.
2019-10-12 12:11:11 +02:00
Saracen
dabaa11b3c Fix to make sure the capture buffers are deallocated at shutdown. Silences warnings. 2019-10-11 23:40:43 +01:00
Yuri Roubinsky
ada4bcbe30 Fix invalid autocompletion pasting of shader param name 2019-10-08 18:33:22 +03:00
Rémi Verschelde
45577e4233
Merge pull request #32571 from DavidSichma/rect_flip
Correctly flip texture src region
2019-10-08 16:15:45 +02:00
Yuri Roubinsky
76324bec8d Prevent shader crash if name of variable overrides function name 2019-10-06 20:35:41 +03:00
Yuri Roubinsky
d9087e1b44 Prevent shader crash if function call been used on constant 2019-10-06 18:20:05 +03:00
Yuri Roubinsky
5a5a062d61 Fix few redefinition name errors for variable/param/function in shaders 2019-10-06 17:27:28 +03:00
David Sichma
f73e1fae37 Correctly flip texture src region 2019-10-05 16:51:06 +02:00
Yuri Roubinsky
1472fca951 Removed unnecessary shader error log messages 2019-10-02 12:37:22 +03:00
lawnjelly
236ce550c0 Showing and hiding geometry updates shadows
Showing and hiding geometry nodes was not showing or hiding their respective shadows. This fixes this by marking any affected lights as dirty.
Fixes #29856
2019-10-01 19:09:03 +01:00
Rémi Verschelde
dec10dd776
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
qarmin
17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
Rémi Verschelde
4f294b958f doc: Sync classref with current source
Fix a few missing bindings or unspecified argument names and default values.
2019-09-24 11:52:06 +02:00
Rémi Verschelde
159470df08
Merge pull request #32275 from godotengine/skin_support
Added skin support and simplified APIs to override bone position + glTF 2.0 import fixes
2019-09-23 15:02:15 +02:00
qarmin
50be65bf43 Changed some code found by Clang Tidy and Coverity 2019-09-22 18:45:08 +02:00
Rémi Verschelde
fdc2463a1b
Merge pull request #32150 from luzpaz/typos
Fix misc. source comment typos
2019-09-20 17:09:05 +02:00
luz.paz
91ecd7b6a6 Fix misc. source comment typos
Found using `codespell -q 3 -S ./thirdparty,*.po -L ang,ba,cas,dof,doubleclick,fave,hist,leapyear,lod,nd,numer,ois,paket,seeked,sinc,switchs,te,uint -D ~/Projects/codespell/codespell_lib/data/dictionary.txt `
2019-09-19 14:36:52 -04:00
Rémi Verschelde
28265fb526
Merge pull request #31202 from azagaya/light-data
Create shadow_vec for altering shadow computation
2019-09-19 20:03:04 +02:00
Juan Linietsky
d81ddaf33e Added skin support and simplified APIs to override bone position. 2019-09-18 19:46:32 -03:00
Chaosus
1333ea2a2d Implement shader array support for varyings 2019-09-14 18:23:25 +03:00
azagaya
b835868067 Create shadow_vec for altering shadow computation
In 2.1 and 3.0, light_vec could be modified for altering shadow_computations.
But it broke shadows when rotating light. shadow_vec would do the same, but without breaking
shadows in rotated lights if not used.

Add inverse light transformation to shadow vec, so it's not affected when rotating lights;

Added usage define for shadow vec.

For shadow vec working properly when rotating a light, it's needed to multiply it by light_matrix normalized. Added usage define in order to don't do that if shadow_vec not used.
2019-09-06 13:55:49 -03:00
Yuri Roubinsky
96ea1e6fb0
Merge pull request #31600 from Chaosus/shader_func_return_fix
Fix shader crash when users miss the return statement
2019-08-28 16:39:33 +03:00
Yuri Roubinski
38601dd3e9 Fix shader crash when users miss the return statement 2019-08-28 11:32:33 +03:00