diff options
Diffstat (limited to 'scene/resources/world_3d.cpp')
-rw-r--r-- | scene/resources/world_3d.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/scene/resources/world_3d.cpp b/scene/resources/world_3d.cpp index dee00dd82a..d8ec7f507c 100644 --- a/scene/resources/world_3d.cpp +++ b/scene/resources/world_3d.cpp @@ -37,18 +37,15 @@ #include "scene/scene_string_names.h" struct SpatialIndexer { - Octree<VisibilityNotifier3D> octree; struct NotifierData { - AABB aabb; OctreeElementID id; }; Map<VisibilityNotifier3D *, NotifierData> notifiers; struct CameraData { - Map<VisibilityNotifier3D *, uint64_t> notifiers; }; @@ -65,7 +62,6 @@ struct SpatialIndexer { uint64_t last_frame; void _notifier_add(VisibilityNotifier3D *p_notifier, const AABB &p_rect) { - ERR_FAIL_COND(notifiers.has(p_notifier)); notifiers[p_notifier].aabb = p_rect; notifiers[p_notifier].id = octree.create(p_notifier, p_rect); @@ -73,7 +69,6 @@ struct SpatialIndexer { } void _notifier_update(VisibilityNotifier3D *p_notifier, const AABB &p_rect) { - Map<VisibilityNotifier3D *, NotifierData>::Element *E = notifiers.find(p_notifier); ERR_FAIL_COND(!E); if (E->get().aabb == p_rect) @@ -85,7 +80,6 @@ struct SpatialIndexer { } void _notifier_remove(VisibilityNotifier3D *p_notifier) { - Map<VisibilityNotifier3D *, NotifierData>::Element *E = notifiers.find(p_notifier); ERR_FAIL_COND(!E); @@ -94,7 +88,6 @@ struct SpatialIndexer { List<Camera3D *> removed; for (Map<Camera3D *, CameraData>::Element *F = cameras.front(); F; F = F->next()) { - Map<VisibilityNotifier3D *, uint64_t>::Element *G = F->get().notifiers.find(p_notifier); if (G) { @@ -104,7 +97,6 @@ struct SpatialIndexer { } while (!removed.empty()) { - p_notifier->_exit_camera(removed.front()->get()); removed.pop_front(); } @@ -113,7 +105,6 @@ struct SpatialIndexer { } void _add_camera(Camera3D *p_camera) { - ERR_FAIL_COND(cameras.has(p_camera)); CameraData vd; cameras[p_camera] = vd; @@ -121,7 +112,6 @@ struct SpatialIndexer { } void _update_camera(Camera3D *p_camera) { - Map<Camera3D *, CameraData>::Element *E = cameras.find(p_camera); ERR_FAIL_COND(!E); changed = true; @@ -131,7 +121,6 @@ struct SpatialIndexer { ERR_FAIL_COND(!cameras.has(p_camera)); List<VisibilityNotifier3D *> removed; for (Map<VisibilityNotifier3D *, uint64_t>::Element *E = cameras[p_camera].notifiers.front(); E; E = E->next()) { - removed.push_back(E->key()); } @@ -144,7 +133,6 @@ struct SpatialIndexer { } void _update(uint64_t p_frame) { - if (p_frame == last_frame) return; last_frame = p_frame; @@ -153,7 +141,6 @@ struct SpatialIndexer { return; for (Map<Camera3D *, CameraData>::Element *E = cameras.front(); E; E = E->next()) { - pass++; Camera3D *c = E->key(); @@ -168,12 +155,10 @@ struct SpatialIndexer { List<VisibilityNotifier3D *> removed; for (int i = 0; i < culled; i++) { - //notifiers in frustum Map<VisibilityNotifier3D *, uint64_t>::Element *H = E->get().notifiers.find(ptr[i]); if (!H) { - E->get().notifiers.insert(ptr[i], pass); added.push_back(ptr[i]); } else { @@ -182,7 +167,6 @@ struct SpatialIndexer { } for (Map<VisibilityNotifier3D *, uint64_t>::Element *F = E->get().notifiers.front(); F; F = F->next()) { - if (F->get() != pass) removed.push_back(F->key()); } @@ -202,7 +186,6 @@ struct SpatialIndexer { } SpatialIndexer() { - pass = 0; last_frame = 0; changed = false; @@ -211,60 +194,51 @@ struct SpatialIndexer { }; void World3D::_register_camera(Camera3D *p_camera) { - #ifndef _3D_DISABLED indexer->_add_camera(p_camera); #endif } void World3D::_update_camera(Camera3D *p_camera) { - #ifndef _3D_DISABLED indexer->_update_camera(p_camera); #endif } void World3D::_remove_camera(Camera3D *p_camera) { - #ifndef _3D_DISABLED indexer->_remove_camera(p_camera); #endif } void World3D::_register_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) { - #ifndef _3D_DISABLED indexer->_notifier_add(p_notifier, p_rect); #endif } void World3D::_update_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) { - #ifndef _3D_DISABLED indexer->_notifier_update(p_notifier, p_rect); #endif } void World3D::_remove_notifier(VisibilityNotifier3D *p_notifier) { - #ifndef _3D_DISABLED indexer->_notifier_remove(p_notifier); #endif } void World3D::_update(uint64_t p_frame) { - #ifndef _3D_DISABLED indexer->_update(p_frame); #endif } RID World3D::get_space() const { - return space; } RID World3D::get_scenario() const { - return scenario; } @@ -283,7 +257,6 @@ void World3D::set_environment(const Ref<Environment> &p_environment) { } Ref<Environment> World3D::get_environment() const { - return environment; } @@ -302,12 +275,10 @@ void World3D::set_fallback_environment(const Ref<Environment> &p_environment) { } Ref<Environment> World3D::get_fallback_environment() const { - return fallback_environment; } void World3D::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) { - camera_effects = p_camera_effects; if (camera_effects.is_valid()) RS::get_singleton()->scenario_set_camera_effects(scenario, camera_effects->get_rid()); @@ -316,24 +287,20 @@ void World3D::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) { } Ref<CameraEffects> World3D::get_camera_effects() const { - return camera_effects; } PhysicsDirectSpaceState3D *World3D::get_direct_space_state() { - return PhysicsServer3D::get_singleton()->space_get_direct_state(space); } void World3D::get_camera_list(List<Camera3D *> *r_cameras) { - for (Map<Camera3D *, SpatialIndexer::CameraData>::Element *E = indexer->cameras.front(); E; E = E->next()) { r_cameras->push_back(E->key()); } } void World3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_space"), &World3D::get_space); ClassDB::bind_method(D_METHOD("get_scenario"), &World3D::get_scenario); ClassDB::bind_method(D_METHOD("set_environment", "env"), &World3D::set_environment); @@ -352,7 +319,6 @@ void World3D::_bind_methods() { } World3D::World3D() { - space = PhysicsServer3D::get_singleton()->space_create(); scenario = RenderingServer::get_singleton()->scenario_create(); @@ -372,7 +338,6 @@ World3D::World3D() { } World3D::~World3D() { - PhysicsServer3D::get_singleton()->free(space); RenderingServer::get_singleton()->free(scenario); |