| 364 | } |
| 365 | |
| 366 | bool DynamicBVH::update(const ID &p_id, const AABB &p_box) { |
| 367 | ERR_FAIL_COND_V(!p_id.is_valid(), false); |
| 368 | Node *leaf = p_id.node; |
| 369 | |
| 370 | Volume volume; |
| 371 | volume.min = p_box.position; |
| 372 | volume.max = p_box.position + p_box.size; |
| 373 | |
| 374 | if (leaf->volume.min.is_equal_approx(volume.min) && leaf->volume.max.is_equal_approx(volume.max)) { |
| 375 | // noop |
| 376 | return false; |
| 377 | } |
| 378 | |
| 379 | Node *base = _remove_leaf(leaf); |
| 380 | if (base) { |
| 381 | if (lkhd >= 0) { |
| 382 | for (int i = 0; (i < lkhd) && base->parent; ++i) { |
| 383 | base = base->parent; |
| 384 | } |
| 385 | } else { |
| 386 | base = bvh_root; |
| 387 | } |
| 388 | } |
| 389 | leaf->volume = volume; |
| 390 | _insert_leaf(base, leaf); |
| 391 | return true; |
| 392 | } |
| 393 | |
| 394 | void DynamicBVH::remove(const ID &p_id) { |
| 395 | ERR_FAIL_COND(!p_id.is_valid()); |
nothing calls this directly
no test coverage detected