1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00
Commit Graph

82 Commits

Author SHA1 Message Date
Thaddeus Crews
274ed34ac4 Merge pull request #93836 from aaronfranke/capsule-mid-height
Add mid height property to CapsuleShape2D/3D
2025-05-23 09:46:13 -05:00
Arseny Kapoulkine
6190d412d3 Adjust LOD selection metrics to use attribute error
- Revert meshoptimizer patch; the metric used for LOD selection now
incorporates attribute error
- Since LOD selection is now aware of attribute deviation, we don't
need to use a higher normal weight
- To prevent normal creases from creating input triangles with very
large normal deviation, reduce default normal merge threshold
- Since we now use combined metric to select LODs, we never need LODs
with error>1 as these should not be selected if the mesh is visible.
2025-05-18 17:38:54 +03:00
Arseny Kapoulkine
9a8348cc2c Use vertex colors (if present) as attributes during simplification
When importing meshes with vertex colors, we will now supply them to the
simplifier as attributes with weight=1 (in addition to normals). This will
guide the simplification to preserve regions where vertex colors change.

For this change to take full effect, it is also necessary to respect the
full error when selecting LODs; this change does not do that yet, so there
are going to still be cases where vertex colors change abruptly during LOD
switch in a visible manner.
2025-05-15 21:48:12 +03:00
kobewi
34b485d62b Remove empty constructors and destructors from scene/ 2025-05-06 14:46:54 +02:00
Aaron Franke
9f38cfe3ca Add mid height property to CapsuleShape2D/3D 2025-05-01 15:45:51 -07:00
lawnjelly
f8f350a32a Add GLOBAL_GET cached macros.
GLOBAL_GET is an expensive operation which should not be used each frame / tick.
This PR adds macros which do a cheaper revision check, and only call the expensive GLOBAL_GET when project settings have changed.

Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-04-30 15:08:50 +01:00
Thaddeus Crews
dc9c34f0c6 SCons: Add enum conversion warning 2025-04-26 12:06:20 -05:00
clayjohn
6fede0b951 Optimize SkyMaterials by removing uses of acos and simplifying logic
The results looks almost the same and run much faster.
2025-04-17 22:50:11 -07:00
Thaddeus Crews
866d59d216 Merge pull request #105264 from clayjohn/primitive-mesh-optimize
Optimize PrimitiveMesh creation by avoiding CoW behavior and dynamic memory allocations
2025-04-14 19:39:46 -05:00
clayjohn
9b6f9e5701 Optimize PrimitiveMesh _create_mesh_array function by avoiding CoW behavior and dynamic memory allocations 2025-04-11 09:04:44 -07:00
Thaddeus Crews
94282d88f9 Core: Use Math namespace for constants 2025-04-10 16:29:30 -05:00
A Thousand Ships
889410dcda Add String::replace_char(s) methods for performance and convenience 2025-04-10 13:08:45 +02:00
Yufeng Ying
7a1a970c25 size() <= 0 and size() < 1. 2025-04-02 19:18:44 +08:00
Yufeng Ying
4f4031a675 Replace size() == 0 with is_empty(). 2025-04-02 19:18:43 +08:00
Michael Alexsander
556933306a Allow to compile templates without navigation features 2025-04-01 11:53:35 -03:00
Michael Alexsander
5ad414d046 Allow to compile templates without physics servers 2025-03-28 11:00:44 -03:00
Yyf2333
22b5ec17fb Using iterator pattern instead of List::Element *.
Co-authored-by: Adam Scott <ascott.ca@gmail.com>
2025-03-28 13:29:15 +08:00
Thaddeus Crews
f09ee0171a Style: Begin integrating simple .clangd fixes 2025-03-22 13:24:35 -05:00
Thaddeus Crews
c1b7865ae9 Merge pull request #103557 from aaronfranke/godot-version-defines
Rename version defines to `GODOT_VERSION_*` to match GDExtension godot-cpp
2025-03-13 08:57:42 -05:00
Aaron Franke
97ee05e9b7 Rename version defines to GODOT_VERSION_* to match GDExtension godot-cpp 2025-03-12 11:11:38 -07:00
Yufeng Ying
bebe037abf Add ConstIterator to Dictionary. 2025-03-13 01:28:46 +08:00
Thaddeus Crews
324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
Thaddeus Crews
bacf8d198d Merge pull request #101014 from BattyBovine/cs3d-separation-ray-fix-2
Prevent errors when drawing debug meshes with no mesh data.
2025-01-20 16:25:48 -06:00
Aarni Koskela
f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +02:00
BattyBovine
6dc6ad2b86 Prevent errors when drawing debug meshes when surface count is zero.
Adds a few checks to ensure a debug collision mesh contains mesh data before
attempting to add it to the gizmo draw list. This prevents errors when using
SeparationRayShape3D, which is only intended to draw a single line, and
contains no mesh data.

Closes #100665
2025-01-06 21:35:52 -05:00
Thaddeus Crews
df2b117ec2 Merge pull request #100317 from TCROC/fix-collision-shape-debug-color-breaks-gdextension
Fix collision shape debug color breaking GDExtension
2024-12-30 08:58:41 -06:00
A Thousand Ships
a1846b27ea Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
2024-12-23 16:35:02 -05:00
Travis Lange
f0c077deb8 fix collision shape debug color breaking gdextension 2024-12-23 15:02:54 -05:00
Yufeng Ying
73d85f46c9 Remove unused headers in scene.
Co-authored-by: Thaddeus Crews <repiteo@outlook.com>

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-12-24 00:40:09 +08:00
Rémi Verschelde
46c8f8c5c5 Merge pull request #100093 from dalexeev/fix-collision-shape-2d-3d-debug-color
Fix `CollisionShape{2D,3D}.debug_color` inconsistencies
2024-12-18 18:23:54 +01:00
Florent Guiocheau
4c34813b32 Fix very large radius SphereMesh and CapsuleMesh normals 2024-12-13 09:26:59 +01:00
Hei
b4c6f9b3d9 Mend gaps in meshes caused by trigonometric funcs. 2024-12-06 17:10:12 +02:00
Danil Alexeev
8bf2afd341 Fix CollisionShape{2D,3D}.debug_color inconsistencies 2024-12-06 15:12:20 +03:00
Rémi Verschelde
ab08876e5c Merge pull request #89566 from AThousandShips/range_val_fix
Fix some invalid `int` property ranges
2024-11-29 22:45:35 +01:00
smix8
612981c1ea Add ShadowCastingSetting to MeshLibrary / GridMap items
Adds ShadowCastingSetting to MeshLibrary / GridMap items.
2024-11-27 01:06:21 +01:00
Jamie Greunbaum
0fc082e1ee Add CollisionShape3D custom debug colours
This allows changing the display colour of a CollisionShape3D node on a per-shape basis.
It also adds the ability to display a solid coloured preview of a CollisionShape3D.

Closes https://github.com/godotengine/godot-proposals/issues/906
2024-11-26 16:28:13 +01:00
A Thousand Ships
f6ea6cdb67 Fix some invalid int property ranges
* `HeightMapShape3D` had ranges configured for `float` instead of `int`
* Particles had `amount` that used `exp` which is not supported, added
  note
2024-11-23 19:17:29 +01:00
Carson Bates
c874e284eb Optimize mesh generation by preventing unneeded shape recalculations
Co-authored-by: Sequoia Haynes <supersequoia11@gmail.com>
2024-11-21 19:49:21 -08:00
Thaddeus Crews
925b690c98 Core: Integrate Ref::instantiate where possible 2024-11-10 12:41:26 -06:00
Arseny Kapoulkine
260287b3a1 Rewrite index optimization code for maximum efficiency
While all the previous fixes to optimizeVertexCache invocation fixed the
vertex transform efficiency, the import code still was missing two
crucial recommendations from meshoptimizer documentation:

- All meshes should be optimized for vertex cache (this reorders
  vertices for maximum fetch efficiency)
- When LODs are used with a shared vertex buffer, the vertex order
  should be generated by doing a vertex fetch optimization on the
  concatenated index buffer from coarse to fine LODs; this maximizes
  fetch efficiency for coarse LODs

The last point is especially crucial for Mali GPUs; unlike other GPUs
where vertex order affects fetch efficiency but not shading, these GPUs
have various shading quirks (depending on the GPU generation) that
really require consecutive index ranges for each LOD, which requires the
second optimization mentioned above. However all of these also help
desktop GPUs and other mobile GPUs as well.

Because this optimization is "global" in the sense that it affects all
LODs and all vertex arrays in concert, I've taken this opportunity to
isolate all optimization code in this function and pull it out of
generate_lods and create_shadow_mesh; this doesn't change the vertex
cache efficiency, but makes the code cleaner. Consequently,
optimize_indices should be called after other functions like
create_shadow_mesh / generate_lods.

This required exposing meshopt_optimizeVertexFetchRemap; as a drive-by,
meshopt_simplifySloppy was never used so it's not exposed anymore - this
will simplify future meshopt upgrades if they end up changing the
function's interface.
2024-11-04 06:58:06 -08:00
Thaddeus Crews
7982030b25 Merge pull request #69197 from aaronfranke/fix-tiny-convex
Fix debug line drawing with tiny convex hull mesh colliders
2024-10-31 20:14:37 -05:00
Clay John
7187c251da Merge pull request #98620 from zeux/lodgen-cleanup
LOD: Remove "Raycast Normals" and associated "Normal Split Angle" settings
2024-10-30 17:13:57 -07:00
Aaron Franke
96ec117d19 Fix debug line drawing with tiny convex hull mesh colliders 2024-10-30 00:47:56 -07:00
Thaddeus Crews
b7a0971ad2 Merge pull request #97934 from adamscott/give-AThousandShips-a-break
[Codestyle] Set clang-format `RemoveSemicolon` rule to `true`
2024-10-29 19:25:36 -05:00
Arseny Kapoulkine
494fe2fe21 LOD: Remove "Raycast Normals" and associated "Normal Split Angle" settings
"Raycast Normals" was introduced in 4.4 dev and defaulted to "false".
The limited testing results at the time suggested that raycasting
generally reduces normal quality compared to native simplifier results,
at the same time increasing vertex memory and import time.

To play it safe, we introduced a setting that defaulted to false, with
the goal of removing it later in 4.4 development cycle if no regressions
are noticed. Since we already had three dev snapshots and no reports,
this change removes the setting and associated code.

"Normal Split Angle" was only used when raycast normals were enabled;
this change removes it from the settings, but keeps it in the script
binding for compatibility.

Existing meshes import exactly the same after this change (unless they
chose to override raycasting which would be surprising).

split_normals helper was only used in this code path and is also removed
for simplicity; it is unlikely that this code will be useful as is, as
it can only regenerate normals without fixing tangents or updating
positions.
2024-10-28 10:14:04 -07:00
Arseny Kapoulkine
e2cc0e484e Update meshoptimizer to 0.22
The Godot-specific patch is just a single line now; removing this patch
will likely require adjusting Godot importer code to handle error limits
better.

This also adds new SIMPLIFY_ options; Godot is currently not using any
of these but might use SIMPLIFY_PRUNE and SIMPLIFY_SPARSE in the future.
2024-10-26 07:26:07 -07:00
Adam Scott
0d350e7108 Set clang-format RemoveSemicolon rule to true
- Set clang-format `Standard` rule to `c++20`
2024-10-25 13:49:43 -04:00
Dario
e2c6daf7ef Implement asynchronous transfer queues, thread guards on RenderingDevice. Add ubershaders and rework pipeline caches for Forward+ and Mobile.
- Implements asynchronous transfer queues from PR #87590.
- Adds ubershaders that can run with specialization constants specified as push constants.
- Pipelines with specialization constants can compile in the background.
- Added monitoring for pipeline compilations.
- Materials and shaders can now be created asynchronously on background threads.
- Meshes that are loaded on background threads can also compile pipelines as part of the loading process.
2024-10-02 15:11:58 -03:00
Thaddeus Crews
9f9ee0c813 SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
Thaddeus Crews
b37fc1014a Style: Apply new clang-format changes 2024-09-20 08:09:48 -05:00