Commit Graph

233 Commits

Author SHA1 Message Date
Thaddeus Crews 7812067644 Merge pull request #119595 from nikitalita/fix-v3-meshes
Fix converting v3 mesh normals and tangents
2026-06-23 07:01:04 -05:00
nikitalita 328c65b233 Fix converting v3 mesh normals and tangents 2026-06-19 13:46:47 -07:00
Thaddeus Crews fcfc285774 Merge pull request #119145 from zeux/surfacetool-tangent-vector4
Use Vector4 storage for tangents in SurfaceTool for consistency
2026-06-19 12:05:57 -05:00
Kotob M 7cbebab1d0 Expose ArrayMesh surface RD buffer RIDs to GDExtensions
Adds Mesh equivalents of `multimesh_get_buffer_rd_rid` so GPU-driven mesh
workflows in a GDExtension can write directly into a surface's vertex,
attribute, skin, or index buffer from a compute pipeline, avoiding the
CPU round-trip through `mesh_surface_update_*_region`.

A new `ARRAY_FLAG_USE_STORAGE_BUFFER` surface format flag opts the backing
buffers into storage-buffer usage so they can be bound in compute shaders.

Vulkan/D3D12/Metal only, OpenGL returns an invalid RID.
2026-05-25 18:35:01 +03:00
Arseny Kapoulkine d00e574657 Use Vector4 storage for tangents in SurfaceTool for consistency
The interface SurfaceTool presents for tangents and all its usages work
with tangent frames represented as 4 values: tangent direction and
scalar orientation (+1 or -1).

However, internally it was represented as tangent+bitangent (mistakenly
called binormal), which introduces additional conversions back & forth
and is problematic for replacing the tangent space generation algorithm.

This change converts the internal storage and adjusts the calling code
accordingly. Note that since SurfaceTool::set_tangent is exposed to
scripts, I've kept the Plane interface there even though it's misleading
to use this type here.
2026-05-01 09:16:43 -07:00
Thaddeus Crews e380a41752 Style: Add class_db.h includes explicitly 2026-02-26 15:50:28 -06:00
Rémi Verschelde cb9b4cff90 Decouple MeshStorage from RenderingServer
By moving RS::SurfaceData and RS::MeshInfo to RenderingServerTypes.

This notably allows removing RS dependency from `mesh.h`.
2026-02-25 20:17:28 +01:00
Rémi Verschelde f5a290ac46 Move RenderingServer enums to a dedicated RenderingServerEnums (RSE) namespace
A number of headers in the codebase included `rendering_server.h` just for
some enum definitions. This means that any change to `rendering_server.h` or
one of its dependencies would trigger a massive incremental rebuild.

With this change, we decouple a number of classes from `rendering_server.h`,
greatly speeding up incremental rebuilds for that area.

On my machine, this reduces incremental compilation time after an edit of
`rendering_server.h` by 60s (from 2m57s).
2026-02-25 19:43:03 +01:00
kobewi f7b9703cbd Use actual class names in resource type hints 2026-01-29 21:07:56 +01:00
Aaron Franke 9fbf5808a0 Rename server "free" functions to "free_rid" to match exposed API 2025-09-30 16:52:25 -07:00
Lukas Tenbrink abe3b481ae Make conversions from LocalVector to Vector explicit. 2025-09-16 21:41:28 +02:00
あるる / きのもと 結衣 6e39808ed7 Fixed generate_triangle_mesh when using PRIMITIVE_TRIANGLE_STRIP 2025-06-27 13:52:53 +09:00
kobewi 652de74ac4 Clear cache when setting Mesh's surfaces 2025-06-16 11:27:23 +02:00
Thaddeus Crews dc9c34f0c6 SCons: Add enum conversion warning 2025-04-26 12:06:20 -05:00
Lukas Tenbrink 91fe434a86 Always use String as StringName backing internally. 2025-04-23 14:57:03 +02:00
Yufeng Ying 4f4031a675 Replace size() == 0 with is_empty(). 2025-04-02 19:18:43 +08:00
Michael Alexsander 5ad414d046 Allow to compile templates without physics servers 2025-03-28 11:00:44 -03: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
Thaddeus Crews b715fabd70 Merge pull request #76371 from ze2j/array_mesh_surface_remove
Add `ArrayMesh::surface_remove`
2024-12-19 19:59:56 -06:00
HP van Braam 6f7525c396 Improve Scene Tree editor performance
We now cache the Node*<>TreeItem* mapping in the SceneTreeEditor. This
allows us to make targeted updates to the Tree used to display the scene
tree in the editor.

Previously on almost all changes to the scene tree the editor would
rebuild the entire widget, causing a large number of deallocations an
allocations. We now carefully manipulate the Tree widget in-situ saving
a large number of these allocations.

In order to know what Nodes need to be updated we add a
editor_state_changed signal to Node, this is a TOOLS_ENABLED,
editor-only signal fired when changes to Node happen that are relevant
to editor state.

We also now make sure that when nodes are moved/renamed we don't check
expensive properties that cannot contain NodePaths. This saves a lot of
time when SceneTreeDock renames a node in a scene with a lot of
MeshInstances. This makes renaming nodes go from ~27 seconds to ~2
seconds on large scenes.

SceneTreeEditor instances will now also not do all of the potentially
expensive update work if they are invisible. This behavior is turned off
by default so it won't affect existing users. This change allows the
editor to only update SceneTreeEditors that actually in view. In
practice this means that for most changes instead of updating 6
SceneTreeEditors we only update 1 instantly, and the others only when
they become visible.

There is definitely more that could be done, but this is already a
massive improvement. In complex scenes we see an improvement of 10x,
things that used to take ~30 seconds now only take 2.

This fixes #83460

I want to thank KoBeWi, TokisanGames, a-johnston, aniel080400 for
their tireless testing. And AeioMuch for their testing and providing a
fix for the hover issue.
2024-12-12 22:47:05 +01:00
ze2j 97e0b43faa Add ArrayMesh::surface_remove 2024-11-27 13:46:15 +01:00
A Thousand Ships 68f638cf02 Use (r)find_char instead of (r)find for single characters 2024-11-17 10:02:18 +01:00
Thaddeus Crews 925b690c98 Core: Integrate Ref::instantiate where possible 2024-11-10 12:41:26 -06: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
David Snopek c2af6bcb59 GDExtension: Mark virtual function as is_required in extension_api.json
Co-authored-by: Jovan Gerodetti <jovan.gerodetti@titannano.de>
2024-09-11 16:48:14 -05:00
Radiant 70860aafd8 Fix shadow mesh recursion. 2024-08-31 22:31:43 +03:00
A Thousand Ships a0dbdcc3ab Replace find with contains/has where applicable
* Replaces `find(...) != -1` with `contains` for `String`
* Replaces `find(...) == -1` with `!contains` for `String`
* Replaces `find(...) != -1` with `has` for containers
* Replaces `find(...) == -1` with `!has` for containers
2024-05-08 12:37:42 +02:00
Lyuma a99756a07f Expose create_from_arrays in SurfaceTool and cleanup some naming 2024-04-19 18:45:06 -07:00
Aaron Franke 6aac3e4a16 Disable all 3D nodes, physics, and resources when compiling without 3D 2024-03-11 01:00:55 -07:00
Aaron Franke c399424db9 Move 3D-only resources to their own folder 2024-02-26 05:23:04 -06:00
A Thousand Ships 3a707b1f54 Fix some additional errors with 3D disabled
* Disabled 2D navigation tests as they do not work
* Disabled tests for primitive meshes
* Unbound some `Mesh` methods that rely on 3D resources
* Unexposed `World3D` as it depends on physics (and isn't useful)
* Unexposed some `Viewport` vrs related properties that had unexposed
  methods
2024-02-23 20:58:56 +01:00
clayjohn ead36fdcc4 Store ArrayMesh path in RenderingServer for use in error messages 2023-11-14 16:27:10 +01:00
clayjohn 3f5c16dd9e Fix multiple issues with UV compression 2023-10-30 23:11:34 +01:00
Rémi Verschelde e65459294c Merge pull request #84054 from AThousandShips/mesh_fix
Fix invalid return from some `_get/_set`
2023-10-27 17:45:48 +02:00
A Thousand Ships b04cf8486d Fix invalid return from some _get/_set
Invalidly returned `true` on the non-matched path
2023-10-27 15:49:19 +02:00
clayjohn 1e3408c5b7 Fix crash when upgrading meshes from 3.x format 2023-10-27 12:21:00 +02:00
clayjohn 8f9cd4e1e3 Some more fixes for compressed meshes
This cleans up a few more cases of uint32_t->uint64_t

Importantly this fixes an edge case in the axis-angle compression by
using the pre-existing Basis methods instead
2023-10-24 09:38:12 +02:00
clayjohn 318ef8461f Implementation of tool to automatically upgrade and re-save meshes 2023-10-23 22:39:48 +02:00
clayjohn e3d31837eb Sanitize tangents when creating mesh surfaces to avoid triggering the compressed mesh path in the shader 2023-10-13 08:54:49 -06:00
clayjohn 51ed3aef63 Vertex and attribute compression to reduce the size of the vertex format.
This allows Godot to automatically compress meshes to save a lot of bandwidth.

In general, this requires no interaction from the user and should result in
no noticable quality loss.

This scheme is not backwards compatible, so we have provided an upgrade
mechanism, and a mesh versioning mechanism.

Existing meshes can still be used as a result, but users can get a
performance boost by reimporting assets.
2023-10-05 12:02:23 -06:00
Ninni Pipping dcd2b883eb Use NULL instead of COND checks when appropriate
Restricted to scene
2023-06-10 08:56:30 +02:00
Juan Linietsky 1c93606e47 Add ValidatedCall to MethodBind
* This should optimize GDScript function calling _enormously_.
* It also should simplify the GDScript VM considerably.

NOTE: GDExtension calling performance has most likely been affected until going via ptrcall is fixed.
2023-04-30 20:01:26 +02:00
smix8 1549aeaef8 Add Mesh ConvexDecompositionSettings wrapper
Adds wrapper MeshConvexDecompositionSettings to control parameters for Mesh ConvexDecomposition operations.
2023-04-07 22:39:25 +02:00
Chris Hutchinson d842d215df Prevent crash in ImmediateMesh.create_outline by ensuring
that when no indices are specified, the number of vertices is
at least a factor of 3. Fixes #73201
2023-02-14 22:42:07 -05:00
Rémi Verschelde 1dfd236f15 Merge pull request #70377 from dsnopek/server-export-mk2
Add "dedicated server" export mode which can strip unneeded visual resources
2023-01-23 22:13:28 +01:00
David Snopek 74458b6e9b Add "dedicated server" export mode which can strip unneeded visual resources 2023-01-23 13:24:54 -06:00
Rémi Verschelde 69a981fc62 Merge pull request #71214 from SekoiaTree/remove_mesh_surface_compat
Remove compatibility code for Mesh surfaces
2023-01-23 10:24:19 +01:00
Rémi Verschelde 5432bad36f Merge pull request #69619 from m4gr3d/address_android_editor_crashes_main
Address Android editor crashes
2023-01-22 17:52:31 +01:00
RedworkDE be4eb3bbdd Fix LOD sort order; checks in add_surface; and document all parameters of ArrayMesh::add_surface_from_arrays
Also clarify some related documentation and expose the misssing `ArrayFormat::ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY`
2023-01-19 10:30:25 +01:00
SekoiaTree 05aaae747b Remove compatibility code for Mesh surfaces 2023-01-11 13:02:08 +01:00