Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
yang.yongquan | 99d31f4db4 | |
yang.yongquan | fbfc5f2759 | |
yang.yongquan | c4281a444e | |
yang.yongquan | f5d487afec | |
yang.yongquan | 315794709e | |
wuyize | 2cf45455ba |
|
@ -149,7 +149,7 @@ QJsonArray LayerStyleContainer::toJson() const
|
|||
QStringList LayerStyleContainer::unusedStyleNames() const
|
||||
{
|
||||
QStringList result;
|
||||
for(const auto& name : unusedStyles | std::views::keys)
|
||||
for (const auto& name : unusedStyles | std::views::keys)
|
||||
{
|
||||
result << name;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
using Renderer::Painting;
|
||||
using Renderer::BaseElement;
|
||||
using Renderer::ElementTransform;
|
||||
using Renderer::BaseElement;
|
||||
using glm::bvec2;
|
||||
using std::max;
|
||||
using std::shared_ptr;
|
||||
|
|
|
@ -248,6 +248,14 @@ GLuint Renderer::Model::loadPainting(std::string path)
|
|||
if (auto file = QFileInfo(QString(path.c_str())); file.isFile())
|
||||
painting = PaintingUtil::transfromToPainting(file.filePath());
|
||||
else
|
||||
{
|
||||
qDebug() << path.c_str() << "Not Found, Using Default Painting";
|
||||
vector<std::pair<std::shared_ptr<Contour>, float>> contours;
|
||||
Painting painting;
|
||||
//if (auto file = QFileInfo(QString(path.c_str())); file.isFile())
|
||||
if (auto file = QFileInfo(QString("../test.json")); file.isFile())
|
||||
painting = PaintingUtil::transfromToPainting("../test.json");
|
||||
else
|
||||
{
|
||||
qDebug() << path.c_str() << "Not Found, Using Default Painting";
|
||||
vector<std::pair<std::shared_ptr<Contour>, float>> contours;
|
||||
|
@ -368,6 +376,7 @@ GLuint Renderer::Model::loadPainting(std::string path)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
painting.generateBuffers(glFunc);
|
||||
|
||||
auto index = vtManager->createVirtualTexture(painting);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "Line.h"
|
||||
#include <glm/detail/func_packing.hpp>
|
||||
#include <qDebug>
|
||||
using namespace Renderer;
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
|
@ -121,9 +122,10 @@ Point Line::getMinDistancePointOnSide(double xy, double l, double r, bool isY) {
|
|||
swap(pMidr.x, pMidr.y);
|
||||
}
|
||||
double mid, midr;
|
||||
//qDebug() << "Start" << xy << l << r << isY;
|
||||
while (fabs(r - l) > eps) {
|
||||
mid = (l + r) / 2;
|
||||
midr = (mid + r) / 2;
|
||||
mid = l + (r - l) / 3;
|
||||
midr = r - (r - l) / 3;
|
||||
if (isY) {
|
||||
pMid.x = mid;
|
||||
pMidr.x = midr;
|
||||
|
@ -139,6 +141,7 @@ Point Line::getMinDistancePointOnSide(double xy, double l, double r, bool isY) {
|
|||
r = midr;
|
||||
}
|
||||
}
|
||||
//qDebug() << " End" << xy << l << r << isY;
|
||||
Point ans = { xy, l };
|
||||
if (isY) swap(ans.x, ans.y);
|
||||
return ans;
|
||||
|
@ -155,9 +158,9 @@ int Line::getPointSideOfLine(Point p) {
|
|||
|
||||
bool Line::judgeOneSideIntersectionWithWidth(double xy, double l, double r, bool isY, double width, int type) {
|
||||
Point p = getMinDistancePointOnSide(xy, l, r, isY);
|
||||
if (type && getPointSideOfLine(p) != type) {
|
||||
return false;
|
||||
}
|
||||
//if (type && getPointSideOfLine(p) != type) {
|
||||
// return false;
|
||||
//}
|
||||
return getMinDistanceFromPoint(p) <= width;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <queue>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <qDebug>
|
||||
|
||||
using namespace Renderer;
|
||||
using std::set;
|
||||
|
@ -96,6 +97,7 @@ void LineTree::monotonization(vector<PointVector>& inLines, vector<std::shared_p
|
|||
}
|
||||
// 防止在首尾直线在与 X 轴平行上
|
||||
int siz = outLines.size();
|
||||
qWarning() << outLines.size();
|
||||
if (!(outLines[0]->getBegin() == outLines[siz - 1]->getEnd()))
|
||||
return;
|
||||
if (isOffset) {
|
||||
|
@ -141,8 +143,7 @@ bool LineTree::handleShortCutNode(LineTreeNode& fa, LineTreeNode& nowTreeNode, d
|
|||
nowTreeNode.lineSet.push_back(lineIndex);
|
||||
}
|
||||
}
|
||||
if (nowTreeNode.lineSet.size() <= requiredLineMin
|
||||
|| (nowTreeNode.bound.z()-nowTreeNode.bound.x())*sqrt(2) <= lineWidth) {
|
||||
if (nowTreeNode.lineSet.size() <= requiredLineMin || (nowTreeNode.bound.z()-nowTreeNode.bound.x()) *sqrt(2) <= lineWidth) {
|
||||
if (nowTreeNode.lineSet.empty())
|
||||
return false;
|
||||
restOfTreeNodes.push_back(nowTreeNode);
|
||||
|
@ -269,7 +270,7 @@ vector<BvhTreeData> LineTree::getPointLineAndBvhTree(vector<float>& resPoints, v
|
|||
oneData.leftSon = resLines.size();
|
||||
oneData.rightSon = 0;
|
||||
oneData.bound = nowTreeNode.bound;
|
||||
//std::cout << nowTreeNode.lineSet.size() << ' ';
|
||||
qDebug() << nowTreeNode.bound << nowTreeNode.lineSet.size() << ' ';
|
||||
resLines.push_back(nowTreeNode.lineSet.size());
|
||||
for (auto& lineIndex : nowTreeNode.lineSet) {
|
||||
resLines.push_back(lineIndex);
|
||||
|
|
Loading…
Reference in New Issue