From: divverent Date: Sat, 25 Jul 2009 10:48:53 +0000 (+0000) Subject: fix smooth operator on cylinders X-Git-Tag: svn-r421~28 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d9e57a87b9d157ffe13d93f33c9570592c9fe506;p=xonotic%2Fnetradiant.git fix smooth operator on cylinders git-svn-id: svn://svn.icculus.org/netradiant/trunk@392 61c419a2-8eb2-4b30-bcec-8cead039b335 --- diff --git a/radiant/patch.cpp b/radiant/patch.cpp index 1c314c17..a9e452d9 100644 --- a/radiant/patch.cpp +++ b/radiant/patch.cpp @@ -399,7 +399,8 @@ void Patch::Redisperse(EMatrixMajor mt) void Patch::Smooth(EMatrixMajor mt) { std::size_t w, h, width, height, row_stride, col_stride; - PatchControl* p1, * p2, * p3; + bool wrap; + PatchControl* p1, * p2, * p3, * p2b; undoSave(); @@ -422,6 +423,20 @@ void Patch::Smooth(EMatrixMajor mt) return; } + wrap = true; + for(h=0;hm_vertex << " and " << p2->m_vertex << "\n"; + if(vector3_length_squared(vector3_subtracted(p1->m_vertex, p2->m_vertex)) > 1.0) + { + //globalErrorStream() << "too far\n"; + wrap = false; + break; + } + } + for(h=0;hm_vertex = vector3_mid(p1->m_vertex, p3->m_vertex); p1 = p3; } + if(wrap) + { + p1 = m_ctrl.data()+(h*row_stride)+(2*width-1)*col_stride; + p2 = m_ctrl.data()+(h*row_stride); + p2b = m_ctrl.data()+(h*row_stride)+(2*width)*col_stride; + p3 = m_ctrl.data()+(h*row_stride)+col_stride; + p2->m_vertex = p2b->m_vertex = vector3_mid(p1->m_vertex, p3->m_vertex); + } } controlPointsChanged();