| 290 | } |
| 291 | |
| 292 | void SceneGraph::LinkObject(Object* new_object) { |
| 293 | for (auto& i : destruction_sanity) { |
| 294 | if (i == new_object) { |
| 295 | i = NULL; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | for (int& destruction_memory_id : destruction_memory_ids) { |
| 300 | if (destruction_memory_id == new_object->GetID()) { |
| 301 | destruction_memory_id = 0; |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | objects_.push_back(new_object); |
| 306 | if (new_object->collidable) { |
| 307 | collide_objects_.push_back(new_object); |
| 308 | } |
| 309 | if (new_object->GetType() != _light_probe_object || new_object->GetType() != _dynamic_light_object) { |
| 310 | visible_objects_.push_back(new_object); |
| 311 | if (new_object->GetType() == _env_object) { |
| 312 | visible_static_meshes_.push_back((EnvObject*)new_object); |
| 313 | ShadowCacheObjectLightBounds env_object_light_bounds = {0}; |
| 314 | visible_static_meshes_shadow_cache_bounds_.push_back(env_object_light_bounds); |
| 315 | visible_static_mesh_indices_.push_back(visible_static_mesh_indices_.size()); |
| 316 | visible_objects_need_sort = true; |
| 317 | } |
| 318 | } |
| 319 | switch (new_object->GetType()) { |
| 320 | case _terrain_type: { |
| 321 | terrain_objects_.push_back((TerrainObject*)new_object); |
| 322 | ShadowCacheObjectLightBounds terrain_light_bounds = {0}; |
| 323 | terrain_objects_shadow_cache_bounds_.push_back(terrain_light_bounds); |
| 324 | break; |
| 325 | } |
| 326 | case _movement_object: |
| 327 | movement_objects_.push_back(new_object); |
| 328 | break; |
| 329 | case _item_object: |
| 330 | item_objects_.push_back(new_object); |
| 331 | break; |
| 332 | case _decal_object: |
| 333 | decal_objects_.push_back(new_object); |
| 334 | break; |
| 335 | case _hotspot_object: |
| 336 | hotspots_.push_back((Hotspot*)(new_object)); |
| 337 | hotspots_modified_ = true; |
| 338 | break; |
| 339 | case _navmesh_hint_object: |
| 340 | navmesh_hints_.push_back((NavmeshHintObject*)(new_object)); |
| 341 | break; |
| 342 | case _navmesh_connection_object: |
| 343 | navmesh_connections_.push_back((NavmeshConnectionObject*)(new_object)); |
| 344 | break; |
| 345 | case _path_point_object: |
| 346 | path_points_.push_back(new_object); |
| 347 | break; |
| 348 | case _light_volume_object: |
| 349 | light_volume_objects_.push_back((LightVolumeObject*)new_object); |
no test coverage detected