diff options
author | Kiri Jolly <expiredpopsicle@gmail.com> | 2020-04-28 17:14:06 -0700 |
---|---|---|
committer | Kiri Jolly <expiredpopsicle@gmail.com> | 2020-04-29 19:33:42 -0700 |
commit | 87ba4daf4bd627af033b4fbd784f783d9c58988b (patch) | |
tree | 4801d52559c362a7d6f51909727a49730a26cddb /editor/plugins | |
parent | 459cab99f47a3c761129abdc94f2325aaa23e129 (diff) |
Fixed false positives in the culling system.
This fixes numerous false positives coming out of the culling system.
AABB checks are now a full separating-axis check against the frustum, with the points of the frustum being compared to the planes of the box just as the points of the box were being compared to the planes of the frustum. This fixes large objects behind the camera not being culled correctly.
Some systems that used frustums that were (sometimes mistakenly?) unbounded on one or more side have been modified to be fully enclosed.
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 17eaa06d57..723898ba6a 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -674,17 +674,13 @@ void Node3DEditorViewport::_select_region() { } } - if (!orthogonal) { - Plane near(cam_pos, -_get_camera_normal()); - near.d -= get_znear(); + Plane near(cam_pos, -_get_camera_normal()); + near.d -= get_znear(); + frustum.push_back(near); - frustum.push_back(near); - - Plane far = -near; - far.d += get_zfar(); - - frustum.push_back(far); - } + Plane far = -near; + far.d += get_zfar(); + frustum.push_back(far); Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world()->get_scenario()); Vector<Node *> selected; |