Browse Source

Merge pull request #82482 from Rindbee/fix-bugs-in-bvh

Fix not refitting upward from leaf nodes
Yuri Sizov 1 year ago
parent
commit
fbe611e45e
2 changed files with 2 additions and 2 deletions
  1. 1 1
      core/math/bvh_refit.inc
  2. 1 1
      core/math/bvh_structs.inc

+ 1 - 1
core/math/bvh_refit.inc

@@ -134,7 +134,7 @@ void refit_branch(uint32_t p_node_id) {
 			TLeaf &leaf = _node_get_leaf(tnode);
 			if (leaf.is_dirty()) {
 				leaf.set_dirty(false);
-				refit_upward(p_node_id);
+				refit_upward(rp.node_id);
 			}
 		}
 	} // while more nodes to pop

+ 1 - 1
core/math/bvh_structs.inc

@@ -83,7 +83,7 @@ public:
 
 	void clear() {
 		num_items = 0;
-		set_dirty(true);
+		set_dirty(false);
 	}
 	bool is_full() const { return num_items >= MAX_ITEMS; }