summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/math/dynamic_bvh.cpp9
-rw-r--r--doc/classes/ConeTwistJoint3D.xml4
-rw-r--r--doc/classes/HingeJoint3D.xml4
-rw-r--r--doc/classes/Joint3D.xml2
-rw-r--r--doc/classes/PinJoint3D.xml4
-rw-r--r--doc/classes/SliderJoint3D.xml4
-rw-r--r--servers/rendering/renderer_scene_cull.cpp10
-rw-r--r--servers/rendering/rendering_server_default.cpp9
-rw-r--r--servers/rendering/rendering_server_default.h4
-rw-r--r--servers/rendering/rendering_server_wrap_mt.h4
-rw-r--r--servers/rendering_server.cpp3
-rw-r--r--servers/rendering_server.h2
12 files changed, 47 insertions, 12 deletions
diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp
index 5f87f75b61..a53f8d1eb8 100644
--- a/core/math/dynamic_bvh.cpp
+++ b/core/math/dynamic_bvh.cpp
@@ -354,10 +354,17 @@ void DynamicBVH::_update(Node *leaf, int lookahead) {
void DynamicBVH::update(const ID &p_id, const AABB &p_box) {
ERR_FAIL_COND(!p_id.is_valid());
Node *leaf = p_id.node;
- Node *base = _remove_leaf(leaf);
+
Volume volume;
volume.min = p_box.position;
volume.max = p_box.position + p_box.size;
+
+ if ((leaf->volume.min == volume.min) && (leaf->volume.max == volume.max)) {
+ // noop
+ return;
+ }
+
+ Node *base = _remove_leaf(leaf);
if (base) {
if (lkhd >= 0) {
for (int i = 0; (i < lkhd) && base->parent; ++i) {
diff --git a/doc/classes/ConeTwistJoint3D.xml b/doc/classes/ConeTwistJoint3D.xml
index e86e95bec3..bd6e24dafd 100644
--- a/doc/classes/ConeTwistJoint3D.xml
+++ b/doc/classes/ConeTwistJoint3D.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ConeTwistJoint3D" inherits="Joint3D" version="4.0">
<brief_description>
- A twist joint between two 3D bodies.
+ A twist joint between two 3D PhysicsBodies.
</brief_description>
<description>
The joint can rotate the bodies across an axis defined by the local x-axes of the [Joint3D].
The twist axis is initiated as the X axis of the [Joint3D].
- Once the Bodies swing, the twist axis is calculated as the middle of the x-axes of the Joint3D in the local space of the two Bodies.
+ Once the Bodies swing, the twist axis is calculated as the middle of the x-axes of the Joint3D in the local space of the two Bodies. See also [Generic6DOFJoint3D].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/HingeJoint3D.xml b/doc/classes/HingeJoint3D.xml
index 2d4480cb20..f2c652d51a 100644
--- a/doc/classes/HingeJoint3D.xml
+++ b/doc/classes/HingeJoint3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="HingeJoint3D" inherits="Joint3D" version="4.0">
<brief_description>
- A hinge between two 3D bodies.
+ A hinge between two 3D PhysicsBodies.
</brief_description>
<description>
- A HingeJoint3D normally uses the Z axis of body A as the hinge axis, another axis can be specified when adding it manually though.
+ A HingeJoint3D normally uses the Z axis of body A as the hinge axis, another axis can be specified when adding it manually though. See also [Generic6DOFJoint3D].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Joint3D.xml b/doc/classes/Joint3D.xml
index 107c638b9e..94cdda586c 100644
--- a/doc/classes/Joint3D.xml
+++ b/doc/classes/Joint3D.xml
@@ -4,7 +4,7 @@
Base class for all 3D joints.
</brief_description>
<description>
- Joints are used to bind together two physics bodies. They have a solver priority and can define if the bodies of the two attached nodes should be able to collide with each other.
+ Joints are used to bind together two physics bodies. They have a solver priority and can define if the bodies of the two attached nodes should be able to collide with each other. See also [Generic6DOFJoint3D].
</description>
<tutorials>
<link title="3D Truck Town Demo">https://godotengine.org/asset-library/asset/524</link>
diff --git a/doc/classes/PinJoint3D.xml b/doc/classes/PinJoint3D.xml
index 0af1e60839..267ea38873 100644
--- a/doc/classes/PinJoint3D.xml
+++ b/doc/classes/PinJoint3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PinJoint3D" inherits="Joint3D" version="4.0">
<brief_description>
- Pin joint for 3D shapes.
+ Pin joint for 3D PhysicsBodies.
</brief_description>
<description>
- Pin joint for 3D rigid bodies. It pins 2 bodies (rigid or static) together.
+ Pin joint for 3D rigid bodies. It pins 2 bodies (rigid or static) together. See also [Generic6DOFJoint3D].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/SliderJoint3D.xml b/doc/classes/SliderJoint3D.xml
index efd6353e3c..ef9c9a48b6 100644
--- a/doc/classes/SliderJoint3D.xml
+++ b/doc/classes/SliderJoint3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="SliderJoint3D" inherits="Joint3D" version="4.0">
<brief_description>
- Piston kind of slider between two bodies in 3D.
+ Slider between two PhysicsBodies in 3D.
</brief_description>
<description>
- Slides across the X axis of the pivot object.
+ Slides across the X axis of the pivot object. See also [Generic6DOFJoint3D].
</description>
<tutorials>
</tutorials>
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp
index 1db678a441..8bb9e6b8b0 100644
--- a/servers/rendering/renderer_scene_cull.cpp
+++ b/servers/rendering/renderer_scene_cull.cpp
@@ -1070,9 +1070,15 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
if (!p_instance->indexer_id.is_valid()) {
if ((1 << p_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) {
- p_instance->indexer_id = p_instance->scenario->indexers[Scenario::INDEXER_GEOMETRY].insert(p_instance->aabb, p_instance);
+ p_instance->indexer_id = p_instance->scenario->indexers[Scenario::INDEXER_GEOMETRY].insert(p_instance->transformed_aabb, p_instance);
} else {
- p_instance->indexer_id = p_instance->scenario->indexers[Scenario::INDEXER_VOLUMES].insert(p_instance->aabb, p_instance);
+ p_instance->indexer_id = p_instance->scenario->indexers[Scenario::INDEXER_VOLUMES].insert(p_instance->transformed_aabb, p_instance);
+ }
+ } else {
+ if ((1 << p_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) {
+ p_instance->scenario->indexers[Scenario::INDEXER_GEOMETRY].update(p_instance->indexer_id, p_instance->transformed_aabb);
+ } else {
+ p_instance->scenario->indexers[Scenario::INDEXER_VOLUMES].update(p_instance->indexer_id, p_instance->transformed_aabb);
}
}
diff --git a/servers/rendering/rendering_server_default.cpp b/servers/rendering/rendering_server_default.cpp
index 8c7c25c19b..da6c3ef6f4 100644
--- a/servers/rendering/rendering_server_default.cpp
+++ b/servers/rendering/rendering_server_default.cpp
@@ -101,11 +101,16 @@ void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) {
TIMESTAMP_BEGIN()
+ uint64_t time_usec = OS::get_singleton()->get_ticks_usec();
+
RSG::scene->update(); //update scenes stuff before updating instances
+ frame_setup_time = double(OS::get_singleton()->get_ticks_usec() - time_usec) / 1000.0;
+
RSG::storage->update_particles(); //need to be done after instances are updated (colliders and particle transforms), and colliders are rendered
RSG::scene->render_probes();
+
RSG::viewport->draw_viewports();
RSG::canvas_render->update();
@@ -159,6 +164,10 @@ void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) {
frame_profile_frame = RSG::storage->get_captured_timestamps_frame();
}
+float RenderingServerDefault::get_frame_setup_time_cpu() const {
+ return frame_setup_time;
+}
+
void RenderingServerDefault::sync() {
}
diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h
index 11220dcf79..922cf08f3b 100644
--- a/servers/rendering/rendering_server_default.h
+++ b/servers/rendering/rendering_server_default.h
@@ -72,6 +72,8 @@ class RenderingServerDefault : public RenderingServer {
uint64_t frame_profile_frame;
Vector<FrameProfileArea> frame_profile;
+ float frame_setup_time = 0;
+
public:
//if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed()
//#define DEBUG_CHANGES
@@ -845,6 +847,8 @@ public:
/* TESTING */
+ virtual float get_frame_setup_time_cpu() const;
+
virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true);
virtual void set_default_clear_color(const Color &p_color);
diff --git a/servers/rendering/rendering_server_wrap_mt.h b/servers/rendering/rendering_server_wrap_mt.h
index ec71178dae..1e6c3b8f71 100644
--- a/servers/rendering/rendering_server_wrap_mt.h
+++ b/servers/rendering/rendering_server_wrap_mt.h
@@ -776,6 +776,10 @@ public:
return rendering_server->get_frame_profile();
}
+ virtual float get_frame_setup_time_cpu() const {
+ return rendering_server->get_frame_setup_time_cpu();
+ }
+
virtual void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) {
rendering_server->sdfgi_set_debug_probe_select(p_position, p_dir);
}
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index dedca4b09f..e9bfb7ecf5 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -1817,6 +1817,9 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_render_loop_enabled"), &RenderingServer::is_render_loop_enabled);
ClassDB::bind_method(D_METHOD("set_render_loop_enabled", "enabled"), &RenderingServer::set_render_loop_enabled);
+
+ ClassDB::bind_method(D_METHOD("get_frame_setup_time_cpu"), &RenderingServer::get_frame_setup_time_cpu);
+
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_loop_enabled"), "set_render_loop_enabled", "is_render_loop_enabled");
BIND_CONSTANT(NO_INDEX_ARRAY);
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index 4dc4f332fa..f403264a96 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -1409,6 +1409,8 @@ public:
virtual Vector<FrameProfileArea> get_frame_profile() = 0;
virtual uint64_t get_frame_profile_frame() = 0;
+ virtual float get_frame_setup_time_cpu() const = 0;
+
/* TESTING */
virtual RID get_test_cube() = 0;