MCPcopy Create free account
hub / github.com/crownengine/crown / destroy

Method destroy

src/world/scene_graph.cpp:220–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void SceneGraph::destroy(TransformId transform)
221{
222 CE_ASSERT(transform.i < _data.size, "Index out of bounds");
223
224 // Unlink all children.
225 TransformId cur = _data.first_child[transform.i];
226 while (is_valid(cur)) {
227 TransformId next_sibling = _data.next_sibling[cur.i];
228 unlink(cur);
229 cur = next_sibling;
230 }
231 unlink(transform);
232
233 const u32 last = _data.size - 1;
234 const UnitId u = _data.unit[transform.i];
235 const UnitId last_u = _data.unit[last];
236
237 if (last != transform.i) {
238 scene_graph_swap(*this, transform, make_instance(last));
239 hash_map::set(_map, last_u, transform.i);
240 }
241 hash_map::remove(_map, u);
242
243 --_data.size;
244}
245
246TransformId SceneGraph::instance(UnitId unit)
247{

Callers 4

~WorldMethod · 0.45
destroy_unitMethod · 0.45
destroy_levelMethod · 0.45
reload_unitsMethod · 0.45

Calls 4

scene_graph_swapFunction · 0.85
setClass · 0.85
make_instanceFunction · 0.70
removeFunction · 0.70

Tested by

no test coverage detected