summaryrefslogtreecommitdiff
path: root/editor/import/resource_importer_scene.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/import/resource_importer_scene.cpp')
-rw-r--r--editor/import/resource_importer_scene.cpp120
1 files changed, 0 insertions, 120 deletions
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index ed7c6dba79..74f23cd052 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -515,127 +515,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
s->set_transform(Transform());
p_node = bv;
-#if 0
- } else if (_teststr(name, "room") && Object::cast_to<MeshInstance>(p_node)) {
- if (isroot)
- return p_node;
-
- MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
- PoolVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID);
-
- BSP_Tree bsptree(faces);
-
- Ref<RoomBounds> area = memnew(RoomBounds);
- //area->set_bounds(faces);
- //area->set_geometry_hint(faces);
-
- Room *room = memnew(Room);
- room->set_name(_fixstr(name, "room"));
- room->set_transform(mi->get_transform());
- room->set_room(area);
-
- p_node->replace_by(room);
- memdelete(p_node);
- p_node = room;
-
- } else if (_teststr(name, "room")) {
-
- if (isroot)
- return p_node;
-
- Spatial *dummy = Object::cast_to<Spatial>(p_node);
- ERR_FAIL_COND_V(!dummy, NULL);
-
- Room *room = memnew(Room);
- room->set_name(_fixstr(name, "room"));
- room->set_transform(dummy->get_transform());
-
- p_node->replace_by(room);
- memdelete(p_node);
- p_node = room;
-
- //room->compute_room_from_subtree();
-
- } else if (_teststr(name, "portal") && Object::cast_to<MeshInstance>(p_node)) {
-
- if (isroot)
- return p_node;
-
- MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
- PoolVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID);
-
- ERR_FAIL_COND_V(faces.size() == 0, NULL);
- //step 1 compute the plane
- Set<Vector3> points;
- Plane plane;
-
- Vector3 center;
-
- for (int i = 0; i < faces.size(); i++) {
-
- Face3 f = faces.get(i);
- Plane p = f.get_plane();
- plane.normal += p.normal;
- plane.d += p.d;
-
- for (int i = 0; i < 3; i++) {
-
- Vector3 v = f.vertex[i].snapped(Vector3(0.01, 0.01, 0.01));
- if (!points.has(v)) {
- points.insert(v);
- center += v;
- }
- }
- }
-
- plane.normal.normalize();
- plane.d /= faces.size();
- center /= points.size();
-
- //step 2, create points
-
- Transform t;
- t.basis.from_z(plane.normal);
- t.basis.transpose();
- t.origin = center;
-
- Vector<Point2> portal_points;
-
- for (Set<Vector3>::Element *E = points.front(); E; E = E->next()) {
-
- Vector3 local = t.xform_inv(E->get());
- portal_points.push_back(Point2(local.x, local.y));
- }
- // step 3 bubbly sort points
-
- int swaps = 0;
-
- do {
- swaps = 0;
-
- for (int i = 0; i < portal_points.size() - 1; i++) {
-
- float a = portal_points[i].angle();
- float b = portal_points[i + 1].angle();
-
- if (a > b) {
- SWAP(portal_points[i], portal_points[i + 1]);
- swaps++;
- }
- }
-
- } while (swaps);
-
- Portal *portal = memnew(Portal);
-
- portal->set_shape(portal_points);
- portal->set_transform(mi->get_transform() * t);
-
- p_node->replace_by(portal);
- memdelete(p_node);
- p_node = portal;
-#endif
} else if (Object::cast_to<MeshInstance>(p_node)) {
//last attempt, maybe collision inside the mesh data