diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.rc b/ArchitectureColoredPainting/ArchitectureColoredPainting.rc
new file mode 100644
index 0000000..ae1f3fe
Binary files /dev/null and b/ArchitectureColoredPainting/ArchitectureColoredPainting.rc differ
diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
index ff05038..368ffbe 100644
--- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
+++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
@@ -151,9 +151,7 @@
-
-
@@ -188,6 +186,7 @@
+
@@ -243,6 +242,9 @@
{8f360763-a045-3808-87a9-3fae38e69819}
+
+
+
diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
index 107068b..3aed4a1 100644
--- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
+++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
@@ -70,12 +70,6 @@
Form Files
-
- Form Files
-
-
- Form Files
-
@@ -447,10 +441,16 @@
Header Files\Renderer
+
+ Header Files
+
Resource Files
+
+
+
\ No newline at end of file
diff --git a/ArchitectureColoredPainting/FramelessWindow.ui b/ArchitectureColoredPainting/FramelessWindow.ui
deleted file mode 100644
index cf43485..0000000
--- a/ArchitectureColoredPainting/FramelessWindow.ui
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
- FramelessWindow
-
-
-
- 0
- 0
- 560
- 544
-
-
-
-
-
-
- false
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
- false
-
-
-
-
-
-
- 0
-
-
- 1
-
-
- 1
-
-
- 1
-
-
- 1
-
-
-
-
-
- false
-
-
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ArchitectureColoredPainting/MainWindow.ui b/ArchitectureColoredPainting/MainWindow.ui
index 647adb8..f661869 100644
--- a/ArchitectureColoredPainting/MainWindow.ui
+++ b/ArchitectureColoredPainting/MainWindow.ui
@@ -120,8 +120,6 @@
-
-
-
+
diff --git a/ArchitectureColoredPainting/NavigationBarWidget.ui b/ArchitectureColoredPainting/NavigationBarWidget.ui
deleted file mode 100644
index 32061cf..0000000
--- a/ArchitectureColoredPainting/NavigationBarWidget.ui
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
- NavigationBarWidgetClass
-
-
-
- 0
- 0
- 612
- 41
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 40
-
-
-
-
- 0
- 0
-
-
-
- NavigationBarWidget
-
-
- QRadioButton::indicator {
- width: 0px;
- border: 0px;
- background-color: rgba(0, 0, 0, 0);
-}
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
- 纹理编辑
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 场景渲染
-
-
- true
-
-
-
-
-
-
-
-
-
diff --git a/ArchitectureColoredPainting/RendererWidget.ui b/ArchitectureColoredPainting/RendererWidget.ui
index e7ae4e5..6986ddc 100644
--- a/ArchitectureColoredPainting/RendererWidget.ui
+++ b/ArchitectureColoredPainting/RendererWidget.ui
@@ -35,16 +35,16 @@
QLayout::SetDefaultConstraint
-
-
+
-
+
0
0
- 0
+ 80
40
@@ -180,6 +180,11 @@
QOpenGLWidget
+
+ QtMaterialFlatButton
+ QPushButton
+
+
diff --git a/ArchitectureColoredPainting/resource.h b/ArchitectureColoredPainting/resource.h
new file mode 100644
index 0000000..9375764
--- /dev/null
+++ b/ArchitectureColoredPainting/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by ArchitectureColoredPainting.rc
+
+// ¶һĬֵ
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/ArchitectureColoredPainting/src/MainWindow.cpp b/ArchitectureColoredPainting/src/MainWindow.cpp
index f861fd9..f671133 100644
--- a/ArchitectureColoredPainting/src/MainWindow.cpp
+++ b/ArchitectureColoredPainting/src/MainWindow.cpp
@@ -11,98 +11,6 @@
FRAMELESSHELPER_USE_NAMESPACE
-inline void fontTheme()
-{
- QFont defaultFont = qApp->font();
- defaultFont.setPointSize(defaultFont.pointSize() + 2);
- qApp->setFont(defaultFont);
-}
-
-inline void setThemeStyleSheet(bool dark)
-{
- QFile file(dark ? ":/darkstyle.qss" : ":/lightstyle.qss");
-
- if (!file.open(QFile::ReadOnly))
- return;
-
- const QString style_sheet = QLatin1String(file.readAll());
-
- file.close();
-
- qApp->setStyleSheet(style_sheet);
-}
-
-inline void darkTheme()
-{
- QPalette darkPalette = qApp->palette();
-
- darkPalette.setColor(QPalette::Window, QColor(53, 53, 53));
- darkPalette.setColor(QPalette::WindowText, QColor(255, 255, 255));
- darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor(127, 127, 127));
- darkPalette.setColor(QPalette::Base, QColor(42, 42, 42));
- darkPalette.setColor(QPalette::AlternateBase, QColor(66, 66, 66));
- darkPalette.setColor(QPalette::ToolTipBase, QColor(255, 255, 255));
- darkPalette.setColor(QPalette::ToolTipText, QColor(255, 255, 255));
- darkPalette.setColor(QPalette::Text, QColor(255, 255, 255));
- darkPalette.setColor(QPalette::Disabled, QPalette::Text, QColor(127, 127, 127));
- darkPalette.setColor(QPalette::Dark, QColor(35, 35, 35));
- darkPalette.setColor(QPalette::Shadow, QColor(20, 20, 20));
- darkPalette.setColor(QPalette::Button, QColor(53, 53, 53));
- darkPalette.setColor(QPalette::ButtonText, QColor(255, 255, 255));
- darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(127, 127, 127));
- darkPalette.setColor(QPalette::BrightText, QColor(255, 0, 0));
- darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
- darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
- darkPalette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(80, 80, 80));
- darkPalette.setColor(QPalette::HighlightedText, QColor(255, 255, 255));
- darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(127, 127, 127));
-
- qApp->setPalette(darkPalette);
-
- setThemeStyleSheet(true /*dark*/);
-}
-
-
-inline void lightTheme()
-{
- QPalette lightPalette = qApp->palette();
-
- lightPalette.setColor(QPalette::Window, QColor(240, 240, 240));
- lightPalette.setColor(QPalette::WindowText, QColor(0, 0, 0));
- lightPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor(120, 120, 120));
- lightPalette.setColor(QPalette::Base, QColor(255, 255, 255));
- lightPalette.setColor(QPalette::AlternateBase, QColor(233, 231, 227));
- lightPalette.setColor(QPalette::ToolTipBase, QColor(255, 255, 220));
- lightPalette.setColor(QPalette::ToolTipText, QColor(0, 0, 0));
- lightPalette.setColor(QPalette::Text, QColor(0, 0, 0));
- lightPalette.setColor(QPalette::Disabled, QPalette::Text, QColor(120, 120, 120));
- lightPalette.setColor(QPalette::Dark, QColor(160, 160, 160));
- lightPalette.setColor(QPalette::Shadow, QColor(105, 105, 105));
- lightPalette.setColor(QPalette::Button, QColor(240, 240, 240));
- lightPalette.setColor(QPalette::ButtonText, QColor(0, 0, 0));
- lightPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(120, 120, 120));
- lightPalette.setColor(QPalette::BrightText, QColor(0, 0, 255));
- lightPalette.setColor(QPalette::Link, QColor(51, 153, 255));
- lightPalette.setColor(QPalette::Highlight, QColor(0, 0, 255));
- lightPalette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(51, 153, 255));
- lightPalette.setColor(QPalette::HighlightedText, QColor(255, 255, 255));
- lightPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(255, 255, 255));
-
- qApp->setPalette(lightPalette);
-
- setThemeStyleSheet(false /*dark*/);
-}
-
-FramelessWindow::FramelessWindow(QWidget* parent) : QWidget(parent), ui(new Ui::FramelessWindow)
-{
- ui->setupUi(this);
-}
-
-FramelessWindow::~FramelessWindow()
-{
- delete ui;
-}
-
CentralWidget::CentralWidget(QWidget* parent) : QMainWindow(parent)
{
ui.setupUi(this);
@@ -136,34 +44,25 @@ MainWindow::MainWindow(QWidget* parent, const Qt::WindowFlags flags)
m_titleBar->chromePalette()->setTitleBarActiveBackgroundColor(QColor(0,0,0,0));
m_titleBar->chromePalette()->setTitleBarInactiveBackgroundColor(QColor(0, 0, 0, 0));
- m_window = new FramelessWindow(this);
- m_central_widget = new CentralWidget(this);
- m_window->ui->windowContent->layout()->addWidget(m_central_widget);
+ m_central_widget = new CentralWidget();
setMenuWidget(m_titleBar);
- setCentralWidget(m_window);
+ setCentralWidget(m_central_widget);
FramelessWidgetsHelper* helper = FramelessWidgetsHelper::get(this);
helper->setTitleBarWidget(m_titleBar);
-#ifndef Q_OS_MACOS
helper->setSystemButton(m_titleBar->minimizeButton(), Global::SystemButtonType::Minimize);
helper->setSystemButton(m_titleBar->maximizeButton(), Global::SystemButtonType::Maximize);
helper->setSystemButton(m_titleBar->closeButton(), Global::SystemButtonType::Close);
-#endif // Q_OS_MACOS
- connect(helper, &FramelessWidgetsHelper::ready, this, [this, helper]() {
+ /*connect(helper, &FramelessWidgetsHelper::ready, this, [this, helper]() {
helper->moveWindowToDesktopCenter();
-
- });
-
+ });*/
setWindowIcon(QIcon(":/images/icon.png"));
setWindowTitle("ArchitectureColoredPainting");
-
resize(m_central_widget->size());
- //setCentralWidget(m_window);
-
//move(QGuiApplication::primaryScreen()->availableGeometry().center() - rect().center());
}
@@ -179,5 +78,3 @@ void MainWindow::closeEvent(QCloseEvent* event)
if (result != QMessageBox::Yes)
event->ignore();*/
}
-
-
diff --git a/ArchitectureColoredPainting/src/MainWindow.h b/ArchitectureColoredPainting/src/MainWindow.h
index cfcc888..6d8bd54 100644
--- a/ArchitectureColoredPainting/src/MainWindow.h
+++ b/ArchitectureColoredPainting/src/MainWindow.h
@@ -2,7 +2,6 @@
#include
#include "ui_MainWindow.h"
-#include "ui_FramelessWindow.h"
#include
@@ -10,19 +9,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class StandardTitleBar;
FRAMELESSHELPER_END_NAMESPACE
-
-class FramelessWindow : public QWidget
-{
- Q_OBJECT
-public:
- explicit FramelessWindow(QWidget* parent = nullptr);
-
- ~FramelessWindow();
-
- Ui::FramelessWindow* ui;
-};
-
-
class CentralWidget : public QMainWindow
{
Q_OBJECT
@@ -46,10 +32,7 @@ public:
private:
FRAMELESSHELPER_PREPEND_NAMESPACE(StandardTitleBar)* m_titleBar = nullptr;
Ui::MainWindowClass ui;
+ CentralWidget* m_central_widget = nullptr;
-
- void closeEvent(QCloseEvent* event);
-
- FramelessWindow* m_window;
- CentralWidget* m_central_widget;
+ void closeEvent(QCloseEvent * event);
};
diff --git a/ArchitectureColoredPainting/src/NavigationBarWidget.cpp b/ArchitectureColoredPainting/src/NavigationBarWidget.cpp
index 2c8cde6..b4286b4 100644
--- a/ArchitectureColoredPainting/src/NavigationBarWidget.cpp
+++ b/ArchitectureColoredPainting/src/NavigationBarWidget.cpp
@@ -1,5 +1,6 @@
#include "NavigationBarWidget.h"
#include
+#include
#include
NavigationBarWidget::NavigationBarWidget(QWidget *parent)
diff --git a/ArchitectureColoredPainting/src/NavigationBarWidget.h b/ArchitectureColoredPainting/src/NavigationBarWidget.h
index 47aa853..2fb43f1 100644
--- a/ArchitectureColoredPainting/src/NavigationBarWidget.h
+++ b/ArchitectureColoredPainting/src/NavigationBarWidget.h
@@ -3,7 +3,6 @@
#include
#include
#include
-#include "ui_NavigationBarWidget.h"
class NavigationBarWidget : public QWidget
{
diff --git a/ArchitectureColoredPainting/src/Renderer/RendererWidget.cpp b/ArchitectureColoredPainting/src/Renderer/RendererWidget.cpp
index b478df7..244f3c9 100644
--- a/ArchitectureColoredPainting/src/Renderer/RendererWidget.cpp
+++ b/ArchitectureColoredPainting/src/Renderer/RendererWidget.cpp
@@ -1,14 +1,16 @@
#include "RendererWidget.h"
#include "RendererGLWidget.h"
-using namespace Renderer;
-RendererWidget::RendererWidget(QWidget *parent)
+
+Renderer::RendererWidget::RendererWidget(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
+ ui.openButton->setHaloVisible(false);
+ ui.openButton->setOverlayStyle(::Material::TintedOverlay);
QObject::connect(ui.horizontalSlider, &QSlider::valueChanged,
- ui.openGLWidget, &RendererGLWidget::setMainLightPitch);
+ ui.openGLWidget, &Renderer::RendererGLWidget::setMainLightPitch);
QObject::connect(ui.horizontalSlider_2, &QSlider::valueChanged,
- ui.openGLWidget, &RendererGLWidget::setMainLightYaw);
+ ui.openGLWidget, &Renderer::RendererGLWidget::setMainLightYaw);
QObject::connect(ui.exposureSlider, &QSlider::valueChanged, [&](int value) {
ui.openGLWidget->setExposure(value/100.f);
});
@@ -17,13 +19,13 @@ RendererWidget::RendererWidget(QWidget *parent)
ui.horizontalSlider_2->setValue(80);
ui.exposureSlider->setValue(60);
QObject::connect(ui.openButton, &QPushButton::clicked,
- ui.openGLWidget, &RendererGLWidget::setModel);
+ ui.openGLWidget, &Renderer::RendererGLWidget::setModel);
}
-RendererWidget::~RendererWidget()
+Renderer::RendererWidget::~RendererWidget()
{}
-void RendererWidget::currentTabChanged(int index)
+void Renderer::RendererWidget::currentTabChanged(int index)
{
if (index == 1)
{
diff --git a/UnitTest/ElementRendererTest.cpp b/UnitTest/ElementRendererTest.cpp
index e6afb0c..2ff2e88 100644
--- a/UnitTest/ElementRendererTest.cpp
+++ b/UnitTest/ElementRendererTest.cpp
@@ -12,14 +12,20 @@ namespace UnitTest
{
TEST_CLASS(ElementRendererStokeTypeTest)
{
+ private:
+ char* argv[1];
+ int argc;
public:
- TEST_METHOD(TestBothSidesRound)
+ ElementRendererStokeTypeTest() :argv{ (char*)"" }, argc(1) {}
+
+ TEST_METHOD_INITIALIZE(initialize)
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
- char* argv[] = { (char*)"" };
- int argc = 1;
+ }
+ TEST_METHOD(TestBothSidesRound)
+ {
QApplication a(argc, argv);
class StyleStrokeRadialGradient : public Renderer::ElementStyle
{
@@ -41,11 +47,6 @@ namespace UnitTest
}
TEST_METHOD(TestBothSidesFlat)
{
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
- QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
- char* argv[] = { (char*)"" };
- int argc = 1;
QApplication a(argc, argv);
class StyleStrokeRadialGradient : public Renderer::ElementStyle
{
@@ -67,11 +68,6 @@ namespace UnitTest
}
TEST_METHOD(TestLeftSideRound)
{
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
- QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
- char* argv[] = { (char*)"" };
- int argc = 1;
QApplication a(argc, argv);
class StyleStrokeRadialGradient : public Renderer::ElementStyle
{
@@ -93,11 +89,6 @@ namespace UnitTest
}
TEST_METHOD(TestLeftSideFlat)
{
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
- QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
- char* argv[] = { (char*)"" };
- int argc = 1;
QApplication a(argc, argv);
class StyleStrokeRadialGradient : public Renderer::ElementStyle
{
@@ -121,14 +112,13 @@ namespace UnitTest
TEST_CLASS(ElementRendererStokeMaterialTest)
{
+ private:
+ char* argv[1];
+ int argc;
public:
+ ElementRendererStokeMaterialTest() :argv{ (char*)"" }, argc(1) {}
TEST_METHOD(TestStrokePlain)
{
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
- QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
- char* argv[] = { (char*)"" };
- int argc = 1;
QApplication a(argc, argv);
class StyleStrokePlain : public Renderer::ElementStyle
{
@@ -145,11 +135,6 @@ namespace UnitTest
}
TEST_METHOD(TestStrokeRadialGradient1)
{
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
- QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
- char* argv[] = { (char*)"" };
- int argc = 1;
QApplication a(argc, argv);
class StyleStrokeRadialGradient : public Renderer::ElementStyle
{
@@ -171,11 +156,6 @@ namespace UnitTest
}
TEST_METHOD(TestStrokeRadialGradient2)
{
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
- QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
- char* argv[] = { (char*)"" };
- int argc = 1;
QApplication a(argc, argv);
class StyleStrokeRadialGradient : public Renderer::ElementStyle
{
diff --git a/UnitTest/PaintingTest.cpp b/UnitTest/PaintingTest.cpp
new file mode 100644
index 0000000..29ae33a
--- /dev/null
+++ b/UnitTest/PaintingTest.cpp
@@ -0,0 +1,53 @@
+#include "CppUnitTest.h"
+#include "PaintingTest.h"
+#include
+#include "Renderer/Painting/Painting.h"
+#include "Renderer/Painting/MaterialStyleStroke.h"
+
+using namespace Microsoft::VisualStudio::CppUnitTestFramework;
+using namespace Renderer;
+
+namespace UnitTest
+{
+ TEST_CLASS(PaintingTest)
+ {
+ private:
+ char* argv[1];
+ int argc;
+ public:
+ PaintingTest() :argv{ (char*)"" }, argc(1) {}
+
+ TEST_METHOD_INITIALIZE(initialize)
+ {
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+ QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
+ }
+ TEST_METHOD(TestBothSidesRound)
+ {
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+ QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
+ QApplication a(argc, argv);
+ class StyleStrokeRadialGradient : public Renderer::ElementStyle
+ {
+ virtual std::vector toBaseStyles() const override
+ {
+ std::map materialMap = {
+ {0.20, Material{QColor(255,255,255)}},
+ {0.60, Material{QColor(165,176,207)}},
+ {1.00, Material{QColor(58,64,151)}}
+ };
+ return { BaseStyle(std::make_shared(),
+ std::make_shared(60, StrokeType::kBothSides, StrokeEndType::kRound,
+ std::make_shared(materialMap, false))) };
+ }
+ } style;
+ TestPaintingGLWidget w(style);
+ w.show();
+ a.exec();
+ }
+ };
+
+
+}
diff --git a/UnitTest/PaintingTest.h b/UnitTest/PaintingTest.h
new file mode 100644
index 0000000..7141342
--- /dev/null
+++ b/UnitTest/PaintingTest.h
@@ -0,0 +1,66 @@
+#pragma once
+
+#include
+#include
+#include "Renderer/Painting/ElementStyle.h"
+#include
+#include
+#include
+
+namespace UnitTest
+{
+ class TestPaintingGLWidget : public QOpenGLWidget, protected QOpenGLFunctions_4_5_Core
+ {
+ Q_OBJECT
+ private:
+ Renderer::ElementStyle& style;
+
+ public:
+ TestPaintingGLWidget(Renderer::ElementStyle& style, QWidget* parent = nullptr)
+ : QOpenGLWidget(parent), style(style) {};
+ void initializeGL() override
+ {
+ initializeOpenGLFunctions();
+ /*std::vector, float>> contours;
+
+ QPainterPath painterPaths[3];
+ QQuickSvgParser::parsePathDataFast("M100,100C-.5,100,0,100.5,0,0L40,.07C40,59.5,39.5,60,100,60Z",
+ painterPaths[0]);
+ if (!SvgFileLoader().loadSvgFile("../svg/2.svg", painterPaths[1]))
+ qCritical() << "load error";
+ QQuickSvgParser::parsePathDataFast("M377,459.61a11.26,11.26,0,0,1,11.27-11.27H696.12a11.27,11.27,0,0,0,11-8.62A359.84,359.84,0,0,0,708,280.56a11.26,11.26,0,0,0-11-8.73H388.27A11.26,11.26,0,0,1,377,260.57h0a11.26,11.26,0,0,1,11.27-11.26H683.71A11.32,11.32,0,0,0,694.28,234C649.8,113.69,542.57,23.85,412.3,4.12a11.22,11.22,0,0,0-12.76,11.17v158.9a11.26,11.26,0,0,0,11.26,11.27H583.12a11.32,11.32,0,0,0,9.26-17.75c-31.67-46.59-78.51-75.2-109.11-90.07a11.25,11.25,0,0,0-16.13,10.17V115.2a11.24,11.24,0,0,0,6.22,10.07l7.51,3.76a11.28,11.28,0,0,1,5,15.12h0a11.27,11.27,0,0,1-15.11,5l-20-10a11.27,11.27,0,0,1-6.22-10.07V54a11.27,11.27,0,0,1,14.62-10.75c5.11,1.59,125.66,40.35,172.24,149A11.27,11.27,0,0,1,621.11,208H388.27A11.26,11.26,0,0,1,377,196.73V11.36A11.32,11.32,0,0,0,365.89.08C363.34,0,360.79,0,358.22,0s-5.11,0-7.66.08a11.32,11.32,0,0,0-11.11,11.28V196.74A11.26,11.26,0,0,1,328.18,208H95.35A11.27,11.27,0,0,1,85,192.3c46.57-108.67,167.12-147.42,172.23-149A11.26,11.26,0,0,1,271.86,54v75.11a11.25,11.25,0,0,1-6.23,10.07l-20,10a11.27,11.27,0,0,1-15.11-5h0a11.26,11.26,0,0,1,5-15.11l7.52-3.76a11.27,11.27,0,0,0,6.22-10.07V87.82a11.25,11.25,0,0,0-16.14-10.16c-30.6,14.87-77.45,43.48-109.1,90.07a11.3,11.3,0,0,0,9.25,17.74H305.66a11.26,11.26,0,0,0,11.27-11.26V15.31A11.22,11.22,0,0,0,304.17,4.14C173.88,23.86,66.66,113.71,22.17,234a11.32,11.32,0,0,0,10.56,15.29H328.18a11.26,11.26,0,0,1,11.27,11.26v0a11.26,11.26,0,0,1-11.27,11.26H19.52a11.26,11.26,0,0,0-11,8.72,359.84,359.84,0,0,0,.83,159.16,11.26,11.26,0,0,0,11,8.61H328.18a11.26,11.26,0,0,1,11.27,11.27h0a11.26,11.26,0,0,1-11.27,11.26h-294a11.32,11.32,0,0,0-10.53,15.4C69,604.65,175.3,692.78,304.16,712.3a11.21,11.21,0,0,0,12.76-11.16V542.22A11.26,11.26,0,0,0,305.66,531h-166c-9.53,0-14.89,11.22-8.69,18.47,34.09,39.77,74.45,65.66,101.77,80.18a11.25,11.25,0,0,0,16.53-10V591a11.26,11.26,0,0,1,11.26-11.26h0A11.26,11.26,0,0,1,271.85,591v63.85A11.27,11.27,0,0,1,256.8,665.5c-4.45-1.59-109.58-40-171-139.9a11.27,11.27,0,0,1,9.59-17.17H328.18a11.26,11.26,0,0,1,11.27,11.26V705.08a11.32,11.32,0,0,0,11.11,11.28q3.82.07,7.66.08c2.57,0,5.12,0,7.67-.08A11.32,11.32,0,0,0,377,705.08V519.69a11.25,11.25,0,0,1,11.27-11.26H621.1a11.26,11.26,0,0,1,9.59,17.16c-61.46,99.87-166.59,138.3-171,139.9a11.27,11.27,0,0,1-15-10.61V591a11.26,11.26,0,0,1,11.26-11.26h0A11.26,11.26,0,0,1,467.14,591v28.6a11.25,11.25,0,0,0,16.53,10c27.33-14.53,67.68-40.42,101.77-80.19,6.2-7.23.85-18.46-8.69-18.46h-166a11.26,11.26,0,0,0-11.26,11.26V701.12a11.21,11.21,0,0,0,12.76,11.17c128.86-19.51,235.14-107.66,280.48-226a11.33,11.33,0,0,0-10.53-15.41h-294A11.25,11.25,0,0,1,377,459.61ZM35.27,399.53V316.9a11.26,11.26,0,0,1,11.27-11.26H669.92a11.25,11.25,0,0,1,11.26,11.26v82.63a11.25,11.25,0,0,1-11.26,11.26H46.54a11.27,11.27,0,0,1-11.27-11.26Z",
+ painterPaths[2]);
+
+ for (auto& i : painterPaths)
+ {
+ auto [contour, ratio] = PainterPathUtil::toNormalizedLines(i);
+ contours.emplace_back(std::make_shared(contour), ratio);
+ }
+
+ std::vector> style = {
+ std::make_shared(),
+ std::make_shared(0.02),
+ std::make_shared(0.2)
+ };
+
+ std::vector> element = {
+ std::make_shared(Element{ contours[0].first, style[0], contours[0].second}),
+ std::make_shared(Element{ contours[1].first, style[2], contours[1].second}),
+ std::make_shared(Element{ contours[2].first, style[0], contours[2].second}),
+ };
+ Painting painting;
+ painting.addElement(*element[0], ElementTransform{ glm::vec2(-0.45,-0.45), glm::vec2(0.5,0.5) / 2.f, 0, glm::bvec2(false), 0 });
+ painting.addElement(*element[1], ElementTransform{ glm::vec2(-0.45, 0.45), glm::vec2(0.5,0.5) / 2.f, 0, glm::bvec2(false), 0 });
+ painting.addElement(*element[2], ElementTransform{ glm::vec2(0.50,-0.45), glm::vec2(0.6,0.7) / 2.f, 0, glm::bvec2(false), 0 });
+ painting.generateBuffers(this);*/
+
+ //auto index = vtManager->createVirtualTexture(painting);
+ };
+ void paintGL() override
+ {
+ glClearColor(219 / 255., 78 / 255., 32 / 255., 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ };
+ void resizeGL(int w, int h) override {};
+ };
+}
\ No newline at end of file
diff --git a/UnitTest/UnitTest.vcxproj b/UnitTest/UnitTest.vcxproj
index 9ea033b..402f061 100644
--- a/UnitTest/UnitTest.vcxproj
+++ b/UnitTest/UnitTest.vcxproj
@@ -65,11 +65,11 @@
stdcpp20
- $(VCInstallDir)UnitTest\include;$(SolutionDIr)ArchitectureColoredPainting;$(SolutionDIr)ArchitectureColoredPainting\include;$(SolutionDIr)ArchitectureColoredPainting\src;$(SolutionDir)ArchitectureColoredPainting\src\Editor\RightBar;$(SolutionDir)ArchitectureColoredPainting\src\Editor\;$(SolutionDIr)ArchitectureColoredPainting\x64\Debug\uic;$(SolutionDir)FramelessHelper\include;$(SolutionDir)FramelessHelper\qmake\inc\core;$(SolutionDir)FramelessHelper\include\FramelessHelper\Core;%(AdditionalIncludeDirectories)
+ $(VCInstallDir)UnitTest\include;$(SolutionDIr)ArchitectureColoredPainting;$(SolutionDIr)ArchitectureColoredPainting\include;$(SolutionDIr)ArchitectureColoredPainting\src;$(SolutionDir)ArchitectureColoredPainting\src\Editor\RightBar;$(SolutionDir)ArchitectureColoredPainting\src\Editor\;$(SolutionDIr)ArchitectureColoredPainting\x64\Debug\uic;$(SolutionDir)FramelessHelper\include;$(SolutionDir)FramelessHelper\qmake\inc\core;$(SolutionDir)FramelessHelper\include\FramelessHelper\Core;$(SolutionDir)qt-material-widgets\components;%(AdditionalIncludeDirectories)
FRAMELESSHELPER_WIDGETS_STATIC;_DEBUG;%(PreprocessorDefinitions)
- $(SolutionDIr)ArchitectureColoredPainting\x64\Debug\*.obj;$(SolutionDIr)FramelessHelper\qmake\FramelessHelperCore\debug\FramelessHelperCore.lib;$(SolutionDIr)FramelessHelper\qmake\FramelessHelperWidgets\debug\FramelessHelperWidgets.lib;opengl32.lib;%(AdditionalDependencies)
+ $(SolutionDIr)ArchitectureColoredPainting\x64\Debug\*.obj;$(SolutionDIr)FramelessHelper\qmake\FramelessHelperCore\debug\FramelessHelperCore.lib;$(SolutionDIr)FramelessHelper\qmake\FramelessHelperWidgets\debug\FramelessHelperWidgets.lib;$(SolutionDIr)qt-material-widgets\components\debug\components.lib;opengl32.lib;%(AdditionalDependencies)
@@ -111,6 +111,12 @@
input
%(Filename).moc
+
+ input
+ %(Filename).moc
+ input
+ %(Filename).moc
+
@@ -125,6 +131,9 @@
+
+
+
diff --git a/UnitTest/UnitTest.vcxproj.filters b/UnitTest/UnitTest.vcxproj.filters
index 7460244..2a74cbc 100644
--- a/UnitTest/UnitTest.vcxproj.filters
+++ b/UnitTest/UnitTest.vcxproj.filters
@@ -37,10 +37,16 @@
Header Files
+
+ Header Files
+
Source Files
+
+ Source Files
+
\ No newline at end of file