Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2482,6 +2482,12 @@
[b]Dummy[/b] is a 3D physics server that does nothing and returns only dummy values, effectively disabling all 3D physics functionality.
Third-party extensions and modules can add other physics engines to select with this setting.
</member>
<member name="physics/3d/physics_interpolation/scene_traversal" type="String" setter="" getter="" default="&quot;DEFAULT&quot;">
The approach used for 3D scene traversal when physics interpolation is enabled.
- [code]DEFAULT[/code]: The default optimized method.
- [code]Legacy[/code]: The previous reference method used for scene tree traversal, which is slower.
- [code]Debug[/code]: Swaps between [code]DEFAULT[/code] and [code]Legacy[/code] methods on alternating frames, and provides logging information (which in turn makes it slower). Intended for debugging only; you should use the [code]DEFAULT[/code] method in most cases.
</member>
<member name="physics/3d/run_on_separate_thread" type="bool" setter="" getter="" default="false">
If [code]true[/code], the 3D physics server runs on a separate thread, making better use of multi-core CPUs. If [code]false[/code], the 3D physics server runs on the main thread. Running the physics server on a separate thread can increase performance, but restricts API access to only physics process.
[b]Note:[/b] When [member physics/3d/physics_engine] is set to [code]Jolt Physics[/code], enabling this setting will prevent the 3D physics server from being able to provide any context when reporting errors and warnings, and will instead always refer to nodes as [code]&lt;unknown&gt;[/code].
Expand Down
6 changes: 6 additions & 0 deletions scene/3d/node_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ void Node3D::_notification(int p_what) {
// unless they need to perform specific tasks (like changing process modes).
fti_pump_xform();
fti_pump_property();

// Detect whether we are using an identity transform.
// This is an optimization for faster tree transform concatenation.
data.fti_is_identity_xform = data.local_transform == Transform3D();
} break;
case NOTIFICATION_SUSPENDED:
case NOTIFICATION_PAUSED: {
Expand Down Expand Up @@ -1448,6 +1452,8 @@ Node3D::Node3D() :
data.fti_on_tick_property_list = false;
data.fti_global_xform_interp_set = false;
data.fti_frame_xform_force_update = false;
data.fti_is_identity_xform = false;
data.fti_processed = false;

#ifdef TOOLS_ENABLED
data.gizmos_disabled = false;
Expand Down
3 changes: 3 additions & 0 deletions scene/3d/node_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Node3D : public Node {
GDCLASS(Node3D, Node);

friend class SceneTreeFTI;
friend class SceneTreeFTITests;

public:
// Edit mode for the rotation.
Expand Down Expand Up @@ -143,6 +144,8 @@ class Node3D : public Node {
bool fti_on_tick_property_list : 1;
bool fti_global_xform_interp_set : 1;
bool fti_frame_xform_force_update : 1;
bool fti_is_identity_xform : 1;
bool fti_processed : 1;

RID visibility_parent;

Expand Down
3 changes: 2 additions & 1 deletion scene/main/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class Node : public Object {
mutable int internal_children_back_count_cache = 0;
mutable int external_children_count_cache = 0;
mutable int index = -1; // relative to front, normal or back.
int depth = -1;
int32_t depth = -1;
int blocked = 0; // Safeguard that throws an error when attempting to modify the tree in a harmful way while being traversed.
StringName name;
SceneTree *tree = nullptr;
Expand Down Expand Up @@ -379,6 +379,7 @@ class Node : public Object {

void _set_use_identity_transform(bool p_enable) { data.use_identity_transform = p_enable; }
bool _is_using_identity_transform() const { return data.use_identity_transform; }
int32_t _get_scene_tree_depth() const { return data.depth; }

//call from SceneTree
void _call_input(const Ref<InputEvent> &p_event);
Expand Down
Loading