diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
index bc422d1..a0e5563 100644
--- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
+++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
@@ -104,6 +104,7 @@
+
@@ -152,6 +153,7 @@
+
@@ -187,12 +189,14 @@
+
+
diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
index f7e8d97..e019bc3 100644
--- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
+++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
@@ -65,6 +65,12 @@
{7ead1a66-586a-4584-ae80-9e7a4e667364}
+
+ {be3f4585-c8ba-410f-8619-2adcd4349f02}
+
+
+ {b9732a33-aa2e-4f8d-886f-1b1730c66519}
+
@@ -111,9 +117,6 @@
Source Files\Renderer
-
- Source Files
-
Source Files\Renderer\Painting
@@ -156,12 +159,6 @@
Source Files\Renderer\Painting
-
- Source Files
-
-
- Source Files
-
Source Files\Renderer\Painting
@@ -189,9 +186,6 @@
Source Files\Renderer\Preview
-
- Source Files
-
Source Files\Renderer
@@ -216,11 +210,29 @@
Source Files\Editor\util
-
- Source Files
+
+ Source Files\Editor\Style
- Source Files
+ Source Files\Editor\Style
+
+
+ Source Files\Editor\Style
+
+
+ Source Files\Editor
+
+
+ Source Files\Editor
+
+
+ Source Files\Editor
+
+
+ Source Files\Editor
+
+
+ Source Files\Editor
@@ -233,35 +245,41 @@
Header Files\Renderer
-
- Header Files
-
-
- Header Files
-
Header Files\Editor
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
Header Files\Editor
Header Files
-
- Header Files
+
+ Header Files\Editor\Style
- Header Files
+ Header Files\Editor\Style
+
+
+ Header Files\Editor
+
+
+ Header Files\Editor
+
+
+ Header Files\Editor
+
+
+ Header Files\Editor
+
+
+ Header Files\Editor
+
+
+ Header Files\Editor
+
+
+ Header Files\Editor
@@ -457,7 +475,7 @@
Header Files\Editor\util
- Header Files\Editor
+ Header Files\Editor\Style
diff --git a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/ColorPicker.cpp b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/ColorPicker.cpp
new file mode 100644
index 0000000..7010ae4
--- /dev/null
+++ b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/ColorPicker.cpp
@@ -0,0 +1,38 @@
+#include "ColorPicker.h"
+#include
+
+QString getStyleSheet(const QColor& color)
+{
+ return
+ "QPushButton#colorPicker {"
+ " border-style: solid;"
+ " border-width: 1px;"
+ " border-color: black;"
+ " background-color: " + color.name() + ";"
+ "}";
+}
+
+ColorPicker::ColorPicker(const QColor& color, QWidget* parent) : QPushButton(parent), color(color)
+{
+ this->setObjectName("colorPicker");
+ this->setStyleSheet(getStyleSheet(color));
+ connect(this, &QPushButton::clicked, this, &ColorPicker::onClicked);
+}
+
+QColor ColorPicker::getColor() const
+{
+ return color;
+}
+
+void ColorPicker::onClicked()
+{
+ QColorDialog dialog(this->color, this);
+ dialog.exec();
+ QColor newColor = dialog.selectedColor();
+ if (newColor.isValid() && this->color != newColor)
+ {
+ this->color = newColor;
+ this->setStyleSheet(getStyleSheet(newColor));
+ emit colorChanged(newColor);
+ }
+}
\ No newline at end of file
diff --git a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/ColorPicker.h b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/ColorPicker.h
new file mode 100644
index 0000000..aca00ea
--- /dev/null
+++ b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/ColorPicker.h
@@ -0,0 +1,16 @@
+#pragma once
+#include
+class ColorPicker : public QPushButton
+{
+ Q_OBJECT
+private:
+ QColor color;
+public:
+ ColorPicker(const QColor& color, QWidget* parent = nullptr);
+ QColor getColor() const;
+public slots:
+ void onClicked();
+signals:
+ void colorChanged(QColor newColor);
+};
+
diff --git a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/LayerStyleDialog.cpp b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/LayerStyleDialog.cpp
index 7a7db8d..478301a 100644
--- a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/LayerStyleDialog.cpp
+++ b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/LayerStyleDialog.cpp
@@ -18,7 +18,7 @@ LayerStyleDialog::LayerStyleDialog(
if (existedStyle)
{
- this->modifyingStyle = existedStyle->clonePtr();
+ this->modifyingStyle = existedStyle->clone();
this->styleContainer = nullptr;
this->styleWidget = modifyingStyle->getInputWidget();
diff --git a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleListView.cpp b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleListView.cpp
new file mode 100644
index 0000000..5b011a7
--- /dev/null
+++ b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleListView.cpp
@@ -0,0 +1,108 @@
+#include "StrokeStyleListView.h"
+#include "ColorPicker.h"
+#include
+
+constexpr int COLUMN_WIDTH = 0;
+constexpr int COLUMN_COLOR = 1;
+constexpr int COLUMN_METALLIC = 2;
+constexpr int COLUMN_ROUGHNESS = 3;
+constexpr int COLUMN_OPERATIONS = 4;
+
+// TODO: 将这个类改为继承QWidget,把table转为其中的一个元素,加上新增行按钮和宽度设置
+StrokeStyleListView::StrokeStyleListView(
+ std::shared_ptr stroke,
+ QWidget* parent
+) : QTableWidget(parent), stroke(stroke)
+{
+ this->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContentsOnFirstShow);
+ this->setColumnCount(5);
+ this->setRowCount(stroke->materialMap.size());
+ QStringList headers;
+ headers.append(QStringLiteral("离心距离占比"));
+ headers.append(QStringLiteral("颜色"));
+ headers.append(QStringLiteral("金属度"));
+ headers.append(QStringLiteral("粗糙度"));
+ headers.append(QStringLiteral("其他操作"));
+ this->setHorizontalHeaderLabels(headers);
+ for (int row = 0; auto& strokePair : stroke->materialMap)
+ {
+ QTableWidgetItem* widthItem = new QTableWidgetItem;
+ widthItem->setData(Qt::EditRole, strokePair.first);
+ this->setItem(row, COLUMN_WIDTH, widthItem);
+
+ QColor* colorPtr = &(strokePair.second.color);
+ QTableWidgetItem* colorItem = new QTableWidgetItem;
+ colorItem->setData(Qt::DisplayRole, *colorPtr);
+ this->setItem(row, COLUMN_COLOR, colorItem);
+ ColorPicker* colorPicker = new ColorPicker(*colorPtr, this);
+ this->setCellWidget(row, COLUMN_COLOR, colorPicker);
+ connect(colorPicker, &ColorPicker::colorChanged, [this, colorPtr](QColor color) {
+ *colorPtr = color;
+ this->update();
+ });
+
+ QTableWidgetItem* metallicItem = new QTableWidgetItem;
+ metallicItem->setData(Qt::EditRole, strokePair.second.metallic);
+ this->setItem(row, COLUMN_METALLIC, metallicItem);
+
+ QTableWidgetItem* roughnessItem = new QTableWidgetItem;
+ roughnessItem->setData(Qt::EditRole, strokePair.second.roughness);
+ this->setItem(row, COLUMN_ROUGHNESS, roughnessItem);
+
+ QtMaterialRaisedButton* removeButton = new QtMaterialRaisedButton("-", this);
+ removeButton->setFixedSize(20, 20);
+ this->setCellWidget(row, COLUMN_OPERATIONS, removeButton);
+ connect(removeButton, &QtMaterialRaisedButton::clicked, [this, row]() {
+ this->stroke->materialMap.erase(this->item(row, COLUMN_WIDTH)->text().toFloat());
+ this->removeRow(row);
+ });
+
+ row++;
+ }
+ connect(this, &StrokeStyleListView::currentItemChanged, this, &StrokeStyleListView::onCurrentItemChanged);
+ connect(this, &StrokeStyleListView::cellChanged, this, &StrokeStyleListView::onCellChanged);
+ this->adjustSize();
+}
+
+void StrokeStyleListView::onCurrentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous)
+{
+ if (!current) return;
+ int column = current->column();
+ if (column != COLUMN_COLOR && column != COLUMN_OPERATIONS)
+ {
+ this->currentItemValue = current->text();
+ }
+}
+
+void StrokeStyleListView::onCellChanged(int row, int column)
+{
+ auto changedItem = this->item(row, column);
+ auto changedItemValue = changedItem->text().toFloat();
+ if (changedItemValue < 0 || 1 < changedItemValue)
+ {
+ changedItem->setData(Qt::EditRole, this->currentItemValue.toFloat());
+ return;
+ }
+ auto changedWidth = this->item(row, COLUMN_WIDTH)->text().toFloat();
+ switch (row)
+ {
+ case COLUMN_WIDTH:
+ {
+ float oldWidth = this->currentItemValue.toFloat();
+ auto node = stroke->materialMap.extract(oldWidth);
+ node.key() = changedWidth;
+ stroke->materialMap.insert(std::move(node));
+ break;
+ }
+ case COLUMN_METALLIC:
+ {
+ stroke->materialMap[changedWidth].metallic = changedItemValue;
+ break;
+ }
+ case COLUMN_ROUGHNESS:
+ {
+ stroke->materialMap[changedWidth].roughness = changedItemValue;
+ break;
+ }
+ }
+}
\ No newline at end of file
diff --git a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleListView.h b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleListView.h
new file mode 100644
index 0000000..f12e400
--- /dev/null
+++ b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleListView.h
@@ -0,0 +1,21 @@
+#pragma once
+#include "LayerStyle.h"
+#include "../Renderer/Painting/MaterialStyleStroke.h"
+#include
+#include
+#include
+class StrokeStyleListView : public QTableWidget
+{
+ Q_OBJECT
+private:
+ QString currentItemValue;
+
+public:
+ StrokeStyleListView(std::shared_ptr stroke, QWidget* parent = nullptr);
+ std::shared_ptr stroke;
+
+protected slots:
+ void onCurrentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
+ void onCellChanged(int row, int column);
+};
+
diff --git a/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp b/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp
index 9602f2d..2775fe5 100644
--- a/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp
+++ b/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp
@@ -45,9 +45,22 @@ PixelPath GroupElement::getPaintObject() const
//TODO: apply styles and send back
PixelPath SimpleElement::getPaintObject(std::vector>* styles) const {
PixelPath result;
- Renderer::ElementStyleStrokeDemo demo(2);
- auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0);
- //qDebug() << mov;
+ std::shared_ptr style;
+ if ((*styles).empty())
+ {
+ style = std::make_shared(2);
+ }
+ else
+ {
+ style = (*styles)[0];
+ /*qDebug() << std::dynamic_pointer_cast(
+ std::dynamic_pointer_cast(style)->materialStyles[0]->materialStroke
+ )->material.color.name();*/
+ /*qDebug() << std::dynamic_pointer_cast(
+ std::dynamic_pointer_cast(style)->materialStyles[0]->materialStroke
+ )->materialMap[1.0].color;*/
+ }
+ auto [img, mov] = renderer->drawElement(painterPath, *style, 1.0);
//qDebug() << img << " ------";
result.addImage(img, mov);
//result.addPath(painterPath);
@@ -85,7 +98,7 @@ QJsonObject GraphicElement::toJson() const
return result;
}
-void SimpleElement::paint(QPainter* painter, QTransform transform, vector> styles)
+void SimpleElement::paint(QPainter* painter, QTransform transform, const vector> &styles)
{
painter->save();
painter->setTransform(transform);
@@ -95,16 +108,30 @@ void SimpleElement::paint(QPainter* painter, QTransform transform, vectordrawElement(painterPath, demo, 1.0);
+ std::shared_ptr style;
+ if (styles.empty())
+ {
+ style = std::make_shared(2);
+ }
+ else
+ {
+ style = styles[0];
+ /*qDebug() << std::dynamic_pointer_cast(
+ std::dynamic_pointer_cast(style)->materialStyles[0]->materialStroke
+ )->material.color.name();*/
+ /*qDebug() << std::dynamic_pointer_cast(
+ std::dynamic_pointer_cast(style)->materialStyles[0]->materialStroke
+ )->materialMap[1.0].color;*/
+ }
+ auto [img, mov] = renderer->drawElement(painterPath, *style, 1.0);
painter->drawImage(mov, img);
}
painter->restore();
}
-void GroupElement::paint(QPainter* painter, QTransform transform, vector> styles)
+void GroupElement::paint(QPainter* painter, QTransform transform, const vector> &styles)
{
sourceLayer->paint(painter, transform);
}
\ No newline at end of file
diff --git a/ArchitectureColoredPainting/src/Editor/GraphicElement.h b/ArchitectureColoredPainting/src/Editor/GraphicElement.h
index 577f7db..ce54ad7 100644
--- a/ArchitectureColoredPainting/src/Editor/GraphicElement.h
+++ b/ArchitectureColoredPainting/src/Editor/GraphicElement.h
@@ -28,7 +28,7 @@ public:
virtual QJsonObject toJson() const;
virtual PixelPath getPaintObject() const = 0;
virtual PixelPath getPaintObject(std::vector>*) const = 0;
- virtual void paint(QPainter* painter, QTransform transform, std::vector> styles) = 0;
+ virtual void paint(QPainter* painter, QTransform transform, const std::vector> &styles) = 0;
};
class SimpleElement : public GraphicElement
@@ -45,7 +45,7 @@ public:
~SimpleElement() = default;
PixelPath getPaintObject() const override;
PixelPath getPaintObject(std::vector>*) const override;
- void paint(QPainter* painter, QTransform transform, std::vector> styles) override;
+ void paint(QPainter* painter, QTransform transform, const std::vector> &styles) override;
};
class GroupElement : public GraphicElement
@@ -60,7 +60,7 @@ public:
PixelPath getPaintObject() const override;
PixelPath getPaintObject(std::vector>*) const override;
void setSourceLayer(FolderLayerWrapper* sourceLayer);
- void paint(QPainter* painter, QTransform transform, std::vector> styles) override;
+ void paint(QPainter* painter, QTransform transform, const std::vector> &styles) override;
};
//******************************** BitmapPath ********************************//
diff --git a/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp b/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp
index c76432f..e44e855 100644
--- a/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp
+++ b/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp
@@ -1,9 +1,13 @@
#include "LayerStyle.h"
+#include "./EditorWidgetComponent/StrokeStyleListView.h"
+#include
#include
#include
#include
#include
#include
+#include
+#include
const std::vector()>>> LayerStyle::types = {
{
@@ -18,7 +22,22 @@ const std::vector()
std::vector StrokeElementLayerStyle::toBaseStyles() const
{
- return std::vector();
+ std::vector baseStyles;
+ if (enableEachSideIndependent)
+ {
+ baseStyles.push_back(Renderer::BaseStyle(std::make_shared(),
+ strokePair.first));
+ baseStyles.push_back(Renderer::BaseStyle(std::make_shared(),
+ strokePair.second));
+ }
+ else
+ {
+ auto material = std::shared_ptr(std::move(strokePair.first->clone()));
+ std::dynamic_pointer_cast(material)->strokeType = Renderer::StrokeType::kBothSides;
+
+ baseStyles.push_back(Renderer::BaseStyle(std::make_shared(), material));
+ }
+ return baseStyles;
}
QString StrokeElementLayerStyle::getStyleName() const
@@ -26,12 +45,61 @@ QString StrokeElementLayerStyle::getStyleName() const
return QStringLiteral("描边");
}
-QWidget* StrokeElementLayerStyle::getInputWidget() const
+QWidget* StrokeElementLayerStyle::getInputWidget()
{
- // TODO
- QLabel* le = new QLabel;
- le->setText(QStringLiteral("描边"));
- return le;
+ if (this->strokePair.first == nullptr)
+ {
+ auto materialMap = std::map();
+ materialMap[0.3] = Renderer::Material{ QColor(0,255,255), 0.f, .8f };
+ materialMap[1.0] = Renderer::Material{ QColor(80,25,255), 0.f, .8f };
+ this->strokePair.first = std::shared_ptr(new Renderer::MaterialStyleStroke(
+ 15,
+ Renderer::StrokeType::kLeftSide, Renderer::StrokeEndType::kFlat,
+ std::shared_ptr(new Renderer::StrokeRadialGradient(
+ materialMap, false
+ ))
+ ));
+ }
+ if (this->strokePair.second == nullptr)
+ {
+ auto materialMap = std::map();
+ materialMap[0.3] = Renderer::Material{ QColor(0,255,255), 0.f, .8f };
+ materialMap[1.0] = Renderer::Material{ QColor(80,25,255), 0.f, .8f };
+ this->strokePair.second = std::shared_ptr(new Renderer::MaterialStyleStroke(
+ 15,
+ Renderer::StrokeType::kRightSide, Renderer::StrokeEndType::kFlat,
+ std::shared_ptr(new Renderer::StrokeRadialGradient(
+ materialMap, false
+ ))
+ ));
+ }
+ QWidget* w = new QWidget;
+ QListView* materialList = new QListView;
+
+ QVBoxLayout* layout = new QVBoxLayout(w);
+ layout->setMargin(0);
+
+ StrokeStyleListView* leftStrokeView = new StrokeStyleListView(
+ std::dynamic_pointer_cast(this->strokePair.first->materialStroke), w
+ );
+ layout->addWidget(leftStrokeView);
+
+ QtMaterialCheckBox* checkEachSideIndependent = new QtMaterialCheckBox(w);
+ checkEachSideIndependent->setText(QStringLiteral("启用两侧独立描边"));
+ checkEachSideIndependent->setChecked(enableEachSideIndependent);
+ layout->addWidget(checkEachSideIndependent);
+
+ StrokeStyleListView* rightStrokeView = new StrokeStyleListView(
+ std::dynamic_pointer_cast(this->strokePair.second->materialStroke), w
+ );
+ layout->addWidget(rightStrokeView);
+ rightStrokeView->setDisabled(!this->enableEachSideIndependent);
+
+ QObject::connect(checkEachSideIndependent, &QtMaterialCheckBox::toggled, [this, rightStrokeView](bool toggled) {
+ this->enableEachSideIndependent = toggled;
+ rightStrokeView->setDisabled(!toggled);
+ });
+ return w;
}
QWidget* StrokeElementLayerStyle::getListDisplayWidget() const
@@ -47,14 +115,16 @@ QWidget* StrokeElementLayerStyle::getListDisplayWidget() const
StrokeElementLayerStyle::StrokeElementLayerStyle(const StrokeElementLayerStyle& other)
{
- materialStyles = std::vector>(other.materialStyles.size());
- for (size_t i = 0; i < other.materialStyles.size(); i++)
- {
- materialStyles[i] = std::make_shared(*other.materialStyles[i]);
- }
+ strokePair.first = std::dynamic_pointer_cast(
+ std::shared_ptr(std::move(other.strokePair.first->clone()))
+ );
+ strokePair.second = std::dynamic_pointer_cast(
+ std::shared_ptr(std::move(other.strokePair.second->clone()))
+ );
+ enableEachSideIndependent = other.enableEachSideIndependent;
}
-std::unique_ptr StrokeElementLayerStyle::clonePtr() const
+std::unique_ptr StrokeElementLayerStyle::clone() const
{
return std::make_unique(StrokeElementLayerStyle(*this));
}
@@ -69,7 +139,7 @@ QString FillElementLayerStyle::getStyleName() const
return QStringLiteral("填充");
}
-QWidget* FillElementLayerStyle::getInputWidget() const
+QWidget* FillElementLayerStyle::getInputWidget()
{
// TODO
QLineEdit* name = new QLineEdit;
@@ -97,7 +167,7 @@ FillElementLayerStyle::FillElementLayerStyle(const FillElementLayerStyle& other)
}
}
-std::unique_ptr FillElementLayerStyle::clonePtr() const
+std::unique_ptr FillElementLayerStyle::clone() const
{
return std::make_unique(FillElementLayerStyle(*this));
}
diff --git a/ArchitectureColoredPainting/src/Editor/LayerStyle.h b/ArchitectureColoredPainting/src/Editor/LayerStyle.h
index 79a49ec..7d5fb25 100644
--- a/ArchitectureColoredPainting/src/Editor/LayerStyle.h
+++ b/ArchitectureColoredPainting/src/Editor/LayerStyle.h
@@ -9,6 +9,9 @@
#include "../Renderer/Painting/MaterialStyleStroke.h"
#include "../Renderer/Painting/MaterialStyleFill.h"
+using Renderer::MaterialStyle;
+using Renderer::MaterialStyleStroke;
+
/**
* 在进行Style的添加时,首先创建空对象,然后直接调用getInputWidget()方法
* 在进行Style的修改时,直接调用getInputWidget()方法
@@ -16,41 +19,45 @@
* 对于LayerStyle的实现类,应该同时实现ElementStyle,并将相同种类的(如描边或填充)的style整合成一个类,
* 对于相同的类,一个图层应该只拥有一个
*/
-class LayerStyle
+class LayerStyle : public Renderer::ElementStyle
{
public:
const static std::vector()>>> types;
virtual QString getStyleName() const = 0;
- virtual QWidget* getInputWidget() const = 0;
+ virtual QWidget* getInputWidget() = 0;
virtual QWidget* getListDisplayWidget() const = 0;
virtual ~LayerStyle() {};
- virtual std::unique_ptr clonePtr() const = 0;
+ virtual std::unique_ptr clone() const = 0;
};
-class StrokeElementLayerStyle : public Renderer::ElementStyle, public LayerStyle
+class StrokeElementLayerStyle : public LayerStyle
{
+private:
+ std::pair, std::shared_ptr> strokePair;
+
public:
std::vector toBaseStyles() const override;
QString getStyleName() const override;
- QWidget* getInputWidget() const override;
+ QWidget* getInputWidget() override;
QWidget* getListDisplayWidget() const override;
StrokeElementLayerStyle() = default;
StrokeElementLayerStyle(const StrokeElementLayerStyle& other);
~StrokeElementLayerStyle() = default;
- std::vector> materialStyles;
- std::unique_ptr clonePtr() const override;
+ std::unique_ptr clone() const override;
+
+ bool enableEachSideIndependent = false;
};
-class FillElementLayerStyle : public Renderer::ElementStyle, public LayerStyle
+class FillElementLayerStyle : public LayerStyle
{
public:
std::vector toBaseStyles() const override;
QString getStyleName() const override;
- QWidget* getInputWidget() const override;
+ QWidget* getInputWidget() override;
QWidget* getListDisplayWidget() const override;
FillElementLayerStyle() = default;
FillElementLayerStyle(const FillElementLayerStyle& other);
~FillElementLayerStyle() = default;
std::vector> materialStyles;
- std::unique_ptr clonePtr() const override;
+ std::unique_ptr clone() const override;
};
\ No newline at end of file
diff --git a/ArchitectureColoredPainting/src/Renderer/Painting/MaterialStyleStroke.cpp b/ArchitectureColoredPainting/src/Renderer/Painting/MaterialStyleStroke.cpp
index 8af376d..371cb86 100644
--- a/ArchitectureColoredPainting/src/Renderer/Painting/MaterialStyleStroke.cpp
+++ b/ArchitectureColoredPainting/src/Renderer/Painting/MaterialStyleStroke.cpp
@@ -25,6 +25,7 @@ std::unique_ptr Renderer::StrokePlain::clone() const
std::vector Renderer::StrokePlain::encoded() const
{
+ qDebug() << material.color;
return { glm::uintBitsToFloat(glm::packUnorm4x8(glm::vec4(material.toVec().second, 0.f, 0.f))),
glm::uintBitsToFloat(glm::packUnorm4x8(material.toVec().first)) };
}
diff --git a/ArchitectureColoredPainting/src/Renderer/Preview/ElementRenderer.cpp b/ArchitectureColoredPainting/src/Renderer/Preview/ElementRenderer.cpp
index 471d931..45b700a 100644
--- a/ArchitectureColoredPainting/src/Renderer/Preview/ElementRenderer.cpp
+++ b/ArchitectureColoredPainting/src/Renderer/Preview/ElementRenderer.cpp
@@ -75,6 +75,7 @@ std::vector generateStyleBuffer(const std::vector& styles)
styleBuffer.push_back(style.transform->scale.y);
styleBuffer.push_back(style.transform->rotation);
styleBuffer.push_back(glm::uintBitsToFloat(glm::packUnorm2x16(style.transform->flip)));
+
auto encoded = style.material->encoded();
styleBuffer.insert(styleBuffer.end(), encoded.begin(), encoded.end());
qDebug() << "style size" << styleBuffer.size();