MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / update

Method update

core/math/dynamic_bvh.cpp:366–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366bool 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
394void DynamicBVH::remove(const ID &p_id) {
395 ERR_FAIL_COND(!p_id.is_valid());

Callers

nothing calls this directly

Calls 2

is_validMethod · 0.45
is_equal_approxMethod · 0.45

Tested by

no test coverage detected