summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-04-30 10:06:18 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-04-30 10:06:18 -0300
commit21939ce08b042b8cfcff16da780a4595aac500cd (patch)
tree6a6f8dd85426de1863e2802a725e6dc7b2e648bb /scene
parent7773d70f449ae8dd66691661fe3ed86d1cabf219 (diff)
-some cleanups
-added tesselation function to curve and curve2d
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/camera_2d.cpp2
-rw-r--r--scene/2d/navigation2d.cpp8
-rw-r--r--scene/resources/curve.cpp2
3 files changed, 9 insertions, 3 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 2ebf34d34b..27a512845c 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -216,6 +216,7 @@ void Camera2D::_notification(int p_what) {
} break;
case NOTIFICATION_ENTER_TREE: {
+
viewport = NULL;
Node *n=this;
while(n){
@@ -526,6 +527,7 @@ Camera2D::Camera2D() {
drag_margin[MARGIN_RIGHT]=0.2;
drag_margin[MARGIN_BOTTOM]=0.2;
camera_pos=Vector2();
+ first=true;
smoothing=0.0;
zoom = Vector2(1, 1);
diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp
index e4d10cad12..d427bf4bc3 100644
--- a/scene/2d/navigation2d.cpp
+++ b/scene/2d/navigation2d.cpp
@@ -516,7 +516,8 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2& p_start, const Vect
apex_poly=p;
portal_left=apex_point;
portal_right=apex_point;
- path.push_back(apex_point);
+ if (path[path.size()-1].distance_to(apex_point)>CMP_EPSILON)
+ path.push_back(apex_point);
skip=true;
}
}
@@ -536,7 +537,8 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2& p_start, const Vect
apex_poly=p;
portal_right=apex_point;
portal_left=apex_point;
- path.push_back(apex_point);
+ if (path[path.size()-1].distance_to(apex_point)>CMP_EPSILON)
+ path.push_back(apex_point);
}
}
@@ -547,7 +549,7 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2& p_start, const Vect
}
- if (path[path.size()-1]!=begin_point)
+ if (path[path.size()-1].distance_to(begin_point)>CMP_EPSILON)
path.push_back(begin_point);
path.invert();
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index 32949c32b7..c1a389942f 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -798,6 +798,7 @@ void Curve2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_baked_length"),&Curve2D::get_baked_length);
ObjectTypeDB::bind_method(_MD("interpolate_baked","offset","cubic"),&Curve2D::interpolate_baked,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_baked_points"),&Curve2D::get_baked_points);
+ ObjectTypeDB::bind_method(_MD("tesselate","max_stages","tolerance_degrees"),&Curve2D::tesselate,DEFVAL(5),DEFVAL(4));
ObjectTypeDB::bind_method(_MD("_get_data"),&Curve2D::_get_data);
ObjectTypeDB::bind_method(_MD("_set_data"),&Curve2D::_set_data);
@@ -1330,6 +1331,7 @@ void Curve3D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("interpolate_baked","offset","cubic"),&Curve3D::interpolate_baked,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_baked_points"),&Curve3D::get_baked_points);
ObjectTypeDB::bind_method(_MD("get_baked_tilts"),&Curve3D::get_baked_tilts);
+ ObjectTypeDB::bind_method(_MD("tesselate","max_stages","tolerance_degrees"),&Curve3D::tesselate,DEFVAL(5),DEFVAL(4));
ObjectTypeDB::bind_method(_MD("_get_data"),&Curve3D::_get_data);
ObjectTypeDB::bind_method(_MD("_set_data"),&Curve3D::_set_data);