From 5823f90c53dee251f2edfcbde6c8bb3a0c943e11 Mon Sep 17 00:00:00 2001 From: quabug Date: Fri, 16 Jan 2015 14:25:14 +0800 Subject: [PATCH 1/2] fix bug running into infinite loop if distance between two adjacent points in curve are too short. --- scene/resources/curve.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index 6c27ffc6d98..1228e7e857e 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -553,7 +553,7 @@ void Curve2D::_bake() const { if (divs>1) divs=1; - float step = divs*0.1; // 10 substeps ought to be enough? + float step = 0.1; // 10 substeps ought to be enough? float p = 0; while(p<1.0) { @@ -1026,7 +1026,7 @@ void Curve3D::_bake() const { if (divs>1) divs=1; - float step = divs*0.1; // 10 substeps ought to be enough? + float step = 0.1; // 10 substeps ought to be enough? float p = 0; while(p<1.0) { From 341ea429db6be0179fc3d9f4fcfcf3dd1c660b03 Mon Sep 17 00:00:00 2001 From: quabug Date: Fri, 16 Jan 2015 14:39:11 +0800 Subject: [PATCH 2/2] remove useless code --- scene/resources/curve.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index 1228e7e857e..7c2fa4d6f41 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -541,19 +541,12 @@ void Curve2D::_bake() const { Vector2 pos=points[0].pos; - int point=0; - float ofs=0; List pointlist; for(int i=0;i1) - divs=1; - - float step = 0.1; // 10 substeps ought to be enough? + float step = 0.1; // at least 10 substeps ought to be enough? float p = 0; while(p<1.0) { @@ -1014,19 +1007,12 @@ void Curve3D::_bake() const { Vector3 pos=points[0].pos; - int point=0; - float ofs=0; List pointlist; pointlist.push_back(Plane(pos,points[0].tilt)); for(int i=0;i1) - divs=1; - - float step = 0.1; // 10 substeps ought to be enough? + float step = 0.1; // at least 10 substeps ought to be enough? float p = 0; while(p<1.0) {