Commit Graph

187 Commits

Author SHA1 Message Date
smix8 c9c572204d Fix CSG performance regression from autosmoothing
Fixes CSG performance regression from autosmoothing.
2026-05-18 18:19:21 +02:00
ryevdokimov c375f0b6b3 Add vertex snap to collision shape vertices in 3D editor 2026-04-10 13:33:31 -04:00
Thaddeus Crews fcb7c06646 Merge pull request #109680 from ryevdokimov/preserve-children-transform
Add ability to transform parent nodes without affecting global transform of its children
2026-03-12 09:03:36 -05:00
Rémi Verschelde e015e8bde4 Remove unused includes in core with clangd-tidy 2026-03-11 06:41:36 +01:00
Robert Yevdokimov e8e3cf1fdb Add ability to transform parent nodes without affecting global transform of its children
Revert
2026-03-07 09:23:50 -05:00
Rémi Verschelde 2dd1f4ef60 Decouple node.h from scene_tree.h, minimize its other includes 2026-03-05 13:54:46 +01:00
Thaddeus Crews 66a96d92c6 Merge pull request #116749 from Jesusemora/testing-changes
Add automatic smoothing for CSG nodes
2026-03-04 14:32:27 -06:00
Jesusemora 6114c6a266 autosmooth
added properties

update inspector

UX improvements

and minor optimizations

deg_to_rad

moved methods

move variables

performance and cleanup

Faster

Compare the angles/smooth of faces instead of vertices, skipping for loop.
Using a LocalVector instead of Vector, this simplifies the code while making it faster, and I don't think we need COW.

all done and working

Optimizations and cleanup

Clarifying and expanding the description of autosmooth and smoothing_angle properties.
Optimizations to skip steps in the loops:
Split loops to be able to skip vertices better and replace division with multiplication.
Suggestions for future changes.
Skip loop if smoothing_angle is lower than 0.1, as a more performant alternative to default smoothing.
Do not compare vertices that belong to the same triangle.
Remove has_smooth. Use a check at the start of the loop instead. This allows us to skip faces.
Perform normalize() at the end of the loop as we don't need the normal of the vertex afterwards, as we use the normal of the face for smoothing.  This way we skip normalizing flat faces.
If one vertex of a triangle is connected to the current vertex, the other 2 can never physically connect, so we skip them (break;). This isn't as reliable but it could add a slight performance increase.
I calculate a decrease of at least 80% of calculations in the for loops compared to the previous code.

Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2026-03-04 15:30:33 -03:00
Rémi Verschelde eabb9a63d4 Rename callable_method_pointer.h to callable_mp.h and include it explicitly
This allows removing it from `class_db.h`, significantly reducing the amount of files
that include it transitively.

Also includes some include cleanup in `control.h` and `rich_text_label.h` done while
ensure they don't depend on `callable_mp`.
2026-03-04 16:23:23 +01:00
Rémi Verschelde 765362b033 Explicitly include core/config/engine.h where used 2026-03-04 10:17:10 +01:00
Thaddeus Crews e380a41752 Style: Add class_db.h includes explicitly 2026-02-26 15:50:28 -06:00
Rémi Verschelde f0a448540e Misc dependency improvements for files depending on rendering_server.h
On my machine, this reduces incremental compilation time after an edit of
`rendering_server.h` by 3s.
2026-02-25 20:17:27 +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
Aaron Franke 3d1c9fd5de Move server files into their subfolders 2025-09-30 19:39:39 -07:00
Aaron Franke 9fbf5808a0 Rename server "free" functions to "free_rid" to match exposed API 2025-09-30 16:52:25 -07:00
Thaddeus Crews 33c257c081 Merge pull request #95414 from jsjtxietian/inside-tree
Fix `!is_inside_tree` in csg node when reloading a scene
2025-07-30 09:03:45 -05:00
smix8 c2f8e70aa0 Revert "Create more optimized CSGShape3D baked static mesh"
This reverts commit 28875459d9.
2025-07-04 20:43:28 +02:00
smix8 28875459d9 Create more optimized CSGShape3D baked static mesh
Creates more optimized CSGShape3D baked static mesh by adding indices and cache optimization.
2025-06-13 21:43:28 +02:00
LuoZhihao 8ba4656ea3 Compile out editor-only logic within validate_property in games 2025-06-12 12:54:19 +08:00
Lukas Tenbrink 963c20565b Remove OAHashMap, in favour of AHashMap.
The two types had (mostly) the same decisions, but `AHashMap` is a faster implementation, and is more consistent with `HashMap`.
2025-05-31 15:50:10 +02:00
Thaddeus Crews 94282d88f9 Core: Use Math namespace for constants 2025-04-10 16:29:30 -05: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
kobewi e64a07cc57 Unbind CSGShape::_update_shape() and make it public 2025-03-16 00:36:50 +01:00
Robert Yevdokimov 6f0a0ba408 Fix collision reposition with CSGShape3D 2025-02-13 19:31:58 +04:00
Juan Pablo Arce dd7bbcc837 Add flag to enable use of accurate path tangents for polygon rotation in CSGPolygon3D
The new property is called `path_rotation_accurate`.
2025-01-17 08:18:21 -03:00
smix8 0ed2cb0439 Make nodes handle their respective navigation source geometry
Makes nodes handle their respective navigation source geometry.
2025-01-12 13:14:46 +01:00
Hilderin 055b418e4d Fix Selection Game View 2025-01-10 09:53:17 -05:00
Thaddeus Crews 77eb92f8f3 Merge pull request #100826 from Lielay9/csg-spin-360
Fix gaps in CSGPolygon3D spin mode at 360 degrees
2024-12-30 08:58:35 -06:00
Hei d310d9f975 Fix gaps in CSGPolygon3D spin mode at 360 degrees 2024-12-26 13:59:24 +02: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
Rémi Verschelde 32c634a381 Merge pull request #100526 from fire/vsk-csg-warnings-update
Update the warnings for CSGShape3D.
2024-12-17 23:00:17 +01:00
Hugo Locurcio 7a04d85ec3 Only allow valid types in Decal, Light3D projector, PointLight2D texture and CSGMesh3D mesh
If an invalid type is supplied (which can still be done from a script),
a warning is printed (along with a workaround for ViewportTexture).

This also adds support for "negative" resource hints such as
"Texture2D,-ViewportTexture" to exclude one or more subclasses
from a class hint.

Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
2024-12-17 20:41:12 +01:00
K. S. Ernest (iFire) Lee 46b02f08c6 Update the warnings for CSGShape3D. 2024-12-17 11:02:38 -08:00
K. S. Ernest (iFire) Lee 441c440bf4 Push some warnings for CSG non manifold and other errors.
In the scene tree add warnings.
2024-12-16 12:49:51 -08:00
smix8 20c519d0fa Fix 3D CSG not reacting to child node order changes
Fixes 3D CSG not reacting to child node order changes.
2024-12-13 00:28:42 +01:00
Hei b4c6f9b3d9 Mend gaps in meshes caused by trigonometric funcs. 2024-12-06 17:10:12 +02:00
K. S. Ernest (iFire) Lee 6cf1d3c13e Print better manifold errors and avoid crash on non manifold csg input.
* Manifold does not have a snap property.
* Tolerance means simplification amount.
* CSG snap has been removed
* Add better error messages.
* Verbose print manifold meshgl64 properties as json.
* Update manifold for error fixes
2024-12-03 20:19:47 -08:00
K. S. Ernest (iFire) Lee fda444bb01 Add csg boolean operators using elalish/manifold.
Uses MeshGL64 for more floating point precision.

Co-Authored-By: 31 <31eee384@gmail.com>
Co-Authored-By: Claudio Z <120678869+cloudofoz@users.noreply.github.com>
2024-11-28 06:26:52 -08:00
Zi Ye a9e51c3aab Fixed CSG debug collision shapes being visible in editor. Also undid an old, incorrect fix which made debug collision visibility depend on CSG visibility. 2024-09-09 14:11:10 -05:00
Rémi Verschelde b39df869c7 Merge pull request #93252 from smix8/csg_bake
Add CSG options to bake to static mesh and collision shape
2024-08-19 16:04:59 +02:00
jsjtxietian a630744b9f Fix !is_inside_tree in csg node when reloading a scene 2024-08-12 12:58:06 +08:00
jsjtxietian 5e4dafb0d9 Fix CSGShape3D's _mesh_changed thread unsafe call to update_gizmos 2024-07-30 10:57:28 +08:00
smix8 6455810db8 Add CSG options to bake to static mesh and collision shape
Adds API to bake a CSG root node operation to either a static ArrayMesh or a ConcavePolygonShape3D physics collision shape. Adds menu options to the editor plugin when selecting a CSG root node to add baked sibling nodes.
2024-06-19 22:54:25 +02:00
31 649c87b957 Make CSG shape dirty after changing Snap, update doc
Update doc to mention that Snap only takes effect at the top level.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2024-06-16 14:33:48 -07:00
kobewi 413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
Rémi Verschelde 4859f8090f Merge pull request #85455 from xiongyaohua/fix_CSGPolygon_not_following_Path3D
Notify CSGPolygon about transform changes in Path3D
2024-02-15 15:44:39 +01:00
A Thousand Ships 684752e75b Replace error checks against size with is_empty 2024-02-09 12:50:15 +01:00
kobewi 0e8f90f4c8 Update deferred calls to use Callables 2024-01-09 16:11:47 +01:00