From 4d9fe01fe9fc2eaae779ad7792c5561c74125212 Mon Sep 17 00:00:00 2001 From: "yang.yongquan" <3395816735@qq.com> Date: Sat, 25 Feb 2023 17:08:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86ShortCutTree?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=9A=84=E7=BA=BF=E9=83=A8=E5=88=86=E7=B4=A2?= =?UTF-8?q?=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Renderer/Painting/ShortCutTree.cpp | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/ArchitectureColoredPainting/src/Renderer/Painting/ShortCutTree.cpp b/ArchitectureColoredPainting/src/Renderer/Painting/ShortCutTree.cpp index 7308c33..df50a92 100644 --- a/ArchitectureColoredPainting/src/Renderer/Painting/ShortCutTree.cpp +++ b/ArchitectureColoredPainting/src/Renderer/Painting/ShortCutTree.cpp @@ -112,10 +112,8 @@ void ShortCutTree::generateShortCutSegment(ShortCutNode& nowTreeNode) { } for (auto& iter : pointSet) { nowTreeNode.lineSet.push_back(numLine); - lineIndexs.push_back(iter.first); - lineIndexs.push_back(iter.first); - lineIndexs.push_back(iter.second); - lineIndexs.push_back(iter.second); + lineIndexs.push_back((iter.first << 16) + iter.first); + lineIndexs.push_back((iter.second << 16) + iter.second); numLine++; } } @@ -149,14 +147,28 @@ bool ShortCutTree::handleShortCutNode(ShortCutNode& fa, ShortCutNode& nowTreeNod } void ShortCutTree::simplifyLineVector() { + bool canPut = false; + GLuint index = 0; numLine = allLines.size(); for (auto& nowLine : allLines) { PointVector pointVector = nowLine->toPointVector(); + canPut = false; + index = 0; for (Point& p : pointVector) { int pointIndex = getPointIndex(p); - lineIndexs.push_back(pointIndex); - if (pointVector.size() == 2) - lineIndexs.push_back(pointIndex); + if (pointVector.size() == 2) { + index = (pointIndex << 16) + pointIndex; + lineIndexs.push_back(index); + } + else { + index <<= 16; + index += pointIndex; + if (canPut) { + lineIndexs.push_back(index); + index = 0; + } + canPut = !canPut; + } } } for (auto& nowTreeNode : restOfTreeNodes) {