In the case where a ConcavePolygonShape is used as a shape for a RigidBody
in another mode than static, a configuration warning will appear in the
editor.
Those were problematic as they call a method of their parent class,
but callable_mp does not allow that unless it's public.
To solve it, we declare a local class that calls the parent class'
method, which now needs to be protected to be accessible in the
derived class.
It's tedious work...
Some can't be ported as they depend on private or protected methods
of different classes, which is not supported by callable_mp (even if
it's a class inherited by the current one).
Remove now unnecessary bindings of signal callbacks in the public API.
There might be some false positives that need rebinding if they were
meant to be public.
No regular expressions were harmed in the making of this commit.
(Nah, just kidding.)
Main:
- It's now implemented thanks to `<mutex>`. No more platform-specific implementations.
- `BinaryMutex` (non-recursive) is added, as an alternative for special cases.
- Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes.
- Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts.
- A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this.
- `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`.
- Thread-safe utilities are therefore simpler now.
Misc.:
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
- Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock).
- `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
This attribute is now part of the standard we target so we no longer
need compiler-specific hacks.
Also enables -Wimplicit-fallthrough for Clang now that we can properly
support it. It's already on by default for GCC's -Wextra.
Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
Fix -Wunused-variable, -Wunused-but-set-variable and -Wswitch warnings
raised by GCC 8 and 9.
Fix -Wunused-function, -Wunused-private-field and
-Wtautological-constant-out-of-range-compare raised by Clang.
Fix MSVC 2019 warning C4804 (unsafe use of type 'bool' in comparison
operation).
GCC -Wcpp warnings/Clang -W#warnings (`#warning`) are no longer raising
errors and will thus not abort compilation with `werror=yes`.
Treat glslang headers are system headers to avoid raising warnings.
Re-enables us to build with `werror=yes` on Linux and macOS, thus
catching warnings that would be introduced by new code.
Fixes#36132.
Lots of internal API changes and some docstrings were lost in the conversion.
I manually salvaged many of them but for all the rendering-related ones, an
additional pass is needed.
Added missing enum bindings in BaseMaterial3D and VisualServer.
-Texture renamed to Texture2D
-TextureLayered as base now inherits 2Darray, cubemap and cubemap array
-Removed all references to flags in textures (they will go in the shader)
-Texture3D gone for now (will come back later done properly)
-Create base rasterizer for RenderDevice, RasterizerRD
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.
When there is no collision with a floor the get_floor_normal() function
should return the zero vector to be consistent with get_floor_velocity().
Renames floor_normal to up_direction in all bindings.
Updates the documentation of get_floor_normal() and get_floor_velocity()
to make it clear when the values are valid. Updates the documentation for
move_and_slide() and move_and_slide_with_snap() to use the new up_direction
parameter name.
Updating the floor velocity with the body's current linear velocity
discards the velocity component provided by the body's angular
rotation. Without the current contact point there is no way to calculate
the current velocity component provided by the body's angular rotation
therefore we need to use the velocity calculated at the time of the
collision.
Fixes#34807.
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.
In the 3D version:
- Partially revert #20908 that was reverted in the 2D version as part
of #21653. This ensures that the Vector returned is always perpendicular
to the surface collided with; and not the floor_normal Vector passed to
the function when on a floor.
- Include an update of the floor velocity before multiplying by the time
delta, which was added to the 2D version as part of commit 13a8014.
In the 2D version:
- Use the Vector2.slide() function instead of Vector2.tangent() to adjust
the amount of motion the stop_on_slope undoes to ensure that it is in the
right direction. This is a implementation of the 3D approach from #30588.
- Combine the !found_collision and motion == Vector2() checks for break.
- Other minor formating changes to make the functions look identical.
Also renamed some variables to align with their use.
It was triggering a warning in bullet followed with a crash in some cases.
WARNING: assert_no_constraints: A body with a joints is destroyed. Please check the implementation in order to destroy the joint before the body.
At: modules/bullet/rigid_body_bullet.cpp:465
A z_depth of 0 returns the camera position, which is not really useful.
This also makes the API breakage from 3.1 clearer as 3.1 code will now
fail to compile, so users will have to adapt and use the new parameter.
For the reference, in 3.1, the z_depth was hardcoded to the near plane.
Closes#33493.
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
Particles were processed only on the next frame after the emission started, causing a one frame delay in rendering. Now the first process cycle is started during the same frame, which makes them consistent with Particles & Particles2D.
Fixes#32890
Adds a new NavigationMesh property to select which objects will be taken
into account for the generation.
By default it will use all the NavigationMeshInstance children to keep
compatibility. The new modes allow to build the NavigationMesh from
all the nodes belonging to a specific group, and optionally include
their children too.
When moving KinematicBody2D from one scene to another and not freeing
the old scene, the first call to move_and_slide() in the new scene will
generate an error because KinematicBody2D keeps internaly a
RID on_floor_body of a body resource in the old scene which no more has
a space assigned.
To fix this, on_floor_body is set to empty RID in response to
NOTIFICATION_ENTER_TREE notification of KinematicBody2D and
KinematicBody. Also all other data related to move_and_slide() is reset:
floor, ceiling, wall flags, colliders vector, floor_velocity.
This fixes#31416.
This was a regression in 3.1 and later from the new inspector, where
PROPERTY_HINT_SPRITE_FRAME was not fully re-implemented. It's meant to
be a normal PROPERTY_HINT_RANGE which also automatically increments its
value when keyed in the animation player.
To avoid code duplication, I made the frames properties use the actual
PROPERTY_HINT_RANGE and introduced a PROPERTY_USAGE_KEYING_INCREMENTS
usage flag instead.
Also added support for SCons project-absolute paths (starting with #) and
warning about duplicates in add_source_files(), and fixed
default_controller_mappings.gen.cpp being included twice after first build
due to *.cpp globbing.
Part of #30270.
With the default camera node settings, this makes directional shadows
look consistent between the editor and the running project.
The original issue occurs because the editor camera defaults to a
Z-far value of 500, whereas the Camera node defaults to a Z-far
value of 100. Since the directional shadow maximum distance is clamped
to the Z-far value, it caused the running project's effective shadow
distance to be lower compared to the editor (100 instead of 200).
This partially addresses #13575.
- Refer to properties explicitly when possible
- When multiple warnings are returned, always separate them by one
blank line to make them easier to distinguish
- Improve grammar and formatting
For clarity, assign-to-release idiom for PoolVector::Read/Write
replaced with a function call.
Existing uses replaced (or removed if already handled by scope)
The original shader code uses a phase (ratio from 0 to 1 for the particle
lifetime) for the randomness ratio computations, and this code was ported
over but converted to time computations.
The seeding/cycle logic was thus invalid, so we're going back to phase
for these computations, thus fixing the previous non-working time/emission
randomness property.
Part of #29692. Follow-up to #26859.
The tangential acceleration for both CPUParticles2D and CPUParticles had been
badly converted from their GPU counterpart (ParticlesMaterial).
This fixes it and ensures that both GPU and CPU particles behave the same with
regard to tangential acceleration.
It's not necessary, but the vast majority of calls of error macros
do have an ending semicolon, so it's best to be consistent.
Most WARN_DEPRECATED calls did *not* have a semicolon, but there's
no reason for them to be treated differently.
As mentioned in
https://github.com/godotengine/godot/pull/26897#issuecomment-491178089
the look-at scaling issue solved by PR #26897 happens also in another
look-at method.
Spatial::look_at_from_position() also does not have same input checking
Spatial::look_at() has. Therefore, I fixed it too at same time.
* Expose EditorNavigationMeshGenerator as an engine singleton so users
can generate navmesehes from `tool` scripts.
* Add support for generating navmeshes from static colliders. All
collision shapes are supported except for Plane (since Plane is an
infinite collider and navmeshes need to have finite geometry).
* When using static colliders as a geometry source, a layer mask can be
specified to ignore certain colliders.
* Don't rely on global transform. It still should give the exact same
results but allows for building navmeshes on nodes that are not in the
tree (useful in `tool` scripts).
* Update navigation gizmos after every new bake.
This work has been kindly sponsored by IMVU.
It always normalized basis after look_at() computation.
Now it applies previous scale back, in order to avoid
distortions when global scale was different of (1,1,1).
fix#10003 and #19000
Related to #17924
Adds the ability to directly add disabled shapes to a collision object. Before this commit a shape has always been assumed to be enabled and had to be disabled in an extra step.
The bake mode property of lights previously didn't affect GI probes.
This change makes the GI probe ignore lights that have their bake mode
set to disabled.