初步实现了编辑器中的StrokeStyle
[style/stroke] 实现了行删除 [style/stroke] 基本稳定了strokeStyle的修改 [paint] 令drawElement时会应用style [style] 修改了LayerStyle [editor] 新增了ColorPicker类和StrokeStyleListView类dev-LayerStyle
parent
73e63f3817
commit
073f68e360
|
@ -104,6 +104,7 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="src\Editor\EditorWidgetComponent\ColorPicker.cpp" />
|
||||||
<ClCompile Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.cpp" />
|
<ClCompile Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.cpp" />
|
||||||
<ClCompile Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.cpp" />
|
<ClCompile Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.cpp" />
|
||||||
<ClCompile Include="src\Editor\EditorWidget.cpp" />
|
<ClCompile Include="src\Editor\EditorWidget.cpp" />
|
||||||
|
@ -152,6 +153,7 @@
|
||||||
<ClCompile Include="src\Renderer\Painting\StraightLine.cpp" />
|
<ClCompile Include="src\Renderer\Painting\StraightLine.cpp" />
|
||||||
<ClCompile Include="src\Renderer\VirtualTextureManager.cpp" />
|
<ClCompile Include="src\Renderer\VirtualTextureManager.cpp" />
|
||||||
<ClCompile Include="src\SvgParser.cpp" />
|
<ClCompile Include="src\SvgParser.cpp" />
|
||||||
|
<ClCompile Include="src\Editor\EditorWidgetComponent\StrokeStyleListView.cpp" />
|
||||||
<QtUic Include="EditorWidget.ui" />
|
<QtUic Include="EditorWidget.ui" />
|
||||||
<QtUic Include="EditorWidgetItem.ui" />
|
<QtUic Include="EditorWidgetItem.ui" />
|
||||||
<QtUic Include="MainWindow.ui" />
|
<QtUic Include="MainWindow.ui" />
|
||||||
|
@ -187,12 +189,14 @@
|
||||||
<None Include="res\Shaders\ssgi.comp" />
|
<None Include="res\Shaders\ssgi.comp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<QtMoc Include="src\Editor\EditorWidgetComponent\StrokeStyleListView.h" />
|
||||||
<QtMoc Include="src\Editor\RightBar\LayerTreeWidget.h" />
|
<QtMoc Include="src\Editor\RightBar\LayerTreeWidget.h" />
|
||||||
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h" />
|
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h" />
|
||||||
<QtMoc Include="src\MainWindow.h" />
|
<QtMoc Include="src\MainWindow.h" />
|
||||||
<QtMoc Include="src\Editor\EditorWidget.h" />
|
<QtMoc Include="src\Editor\EditorWidget.h" />
|
||||||
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.h" />
|
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.h" />
|
||||||
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.h" />
|
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.h" />
|
||||||
|
<QtMoc Include="src\Editor\EditorWidgetComponent\ColorPicker.h" />
|
||||||
<ClInclude Include="src\Editor\ElementManager.h" />
|
<ClInclude Include="src\Editor\ElementManager.h" />
|
||||||
<QtMoc Include="src\Editor\ElementPoolWidget.h" />
|
<QtMoc Include="src\Editor\ElementPoolWidget.h" />
|
||||||
<ClInclude Include="src\Editor\GraphicElement.h" />
|
<ClInclude Include="src\Editor\GraphicElement.h" />
|
||||||
|
|
|
@ -65,6 +65,12 @@
|
||||||
<Filter Include="Header Files\Renderer\Preview">
|
<Filter Include="Header Files\Renderer\Preview">
|
||||||
<UniqueIdentifier>{7ead1a66-586a-4584-ae80-9e7a4e667364}</UniqueIdentifier>
|
<UniqueIdentifier>{7ead1a66-586a-4584-ae80-9e7a4e667364}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Header Files\Editor\Style">
|
||||||
|
<UniqueIdentifier>{be3f4585-c8ba-410f-8619-2adcd4349f02}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\Editor\Style">
|
||||||
|
<UniqueIdentifier>{b9732a33-aa2e-4f8d-886f-1b1730c66519}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtUic Include="MainWindow.ui">
|
<QtUic Include="MainWindow.ui">
|
||||||
|
@ -111,9 +117,6 @@
|
||||||
<ClCompile Include="src\Renderer\RendererWidget.cpp">
|
<ClCompile Include="src\Renderer\RendererWidget.cpp">
|
||||||
<Filter>Source Files\Renderer</Filter>
|
<Filter>Source Files\Renderer</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\NavigationBarWidget.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\Renderer\Painting\BvhTree.cpp">
|
<ClCompile Include="src\Renderer\Painting\BvhTree.cpp">
|
||||||
<Filter>Source Files\Renderer\Painting</Filter>
|
<Filter>Source Files\Renderer\Painting</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -156,12 +159,6 @@
|
||||||
<ClCompile Include="src\Renderer\Painting\CubicBezierSignedDistance.cpp">
|
<ClCompile Include="src\Renderer\Painting\CubicBezierSignedDistance.cpp">
|
||||||
<Filter>Source Files\Renderer\Painting</Filter>
|
<Filter>Source Files\Renderer\Painting</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\Editor\RightBar\LayerTreeWidget.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\Editor\RightBar\InfoDisplayWidget.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\Renderer\Painting\ElementStyle.cpp">
|
<ClCompile Include="src\Renderer\Painting\ElementStyle.cpp">
|
||||||
<Filter>Source Files\Renderer\Painting</Filter>
|
<Filter>Source Files\Renderer\Painting</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -189,9 +186,6 @@
|
||||||
<ClCompile Include="src\Renderer\Preview\ElementRenderer.cpp">
|
<ClCompile Include="src\Renderer\Preview\ElementRenderer.cpp">
|
||||||
<Filter>Source Files\Renderer\Preview</Filter>
|
<Filter>Source Files\Renderer\Preview</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\Editor\LayerStyle.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\Renderer\IblUtils.cpp">
|
<ClCompile Include="src\Renderer\IblUtils.cpp">
|
||||||
<Filter>Source Files\Renderer</Filter>
|
<Filter>Source Files\Renderer</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -216,11 +210,29 @@
|
||||||
<ClCompile Include="src\Editor\util\PaintingUtil.cpp">
|
<ClCompile Include="src\Editor\util\PaintingUtil.cpp">
|
||||||
<Filter>Source Files\Editor\util</Filter>
|
<Filter>Source Files\Editor\util</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.cpp">
|
<ClCompile Include="src\Editor\LayerStyle.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files\Editor\Style</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.cpp">
|
<ClCompile Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files\Editor\Style</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\Editor\EditorWidgetComponent\StrokeStyleListView.cpp">
|
||||||
|
<Filter>Source Files\Editor\Style</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\Editor\RightBar\InfoDisplayWidget.cpp">
|
||||||
|
<Filter>Source Files\Editor</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.cpp">
|
||||||
|
<Filter>Source Files\Editor</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\Editor\RightBar\LayerTreeWidget.cpp">
|
||||||
|
<Filter>Source Files\Editor</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\NavigationBarWidget.cpp">
|
||||||
|
<Filter>Source Files\Editor</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\Editor\EditorWidgetComponent\ColorPicker.cpp">
|
||||||
|
<Filter>Source Files\Editor</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -233,35 +245,41 @@
|
||||||
<QtMoc Include="src\Renderer\RendererWidget.h">
|
<QtMoc Include="src\Renderer\RendererWidget.h">
|
||||||
<Filter>Header Files\Renderer</Filter>
|
<Filter>Header Files\Renderer</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="src\NavigationBarWidget.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="src\MainWindow.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="src\Editor\PreviewWindow.h">
|
<QtMoc Include="src\Editor\PreviewWindow.h">
|
||||||
<Filter>Header Files\Editor</Filter>
|
<Filter>Header Files\Editor</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="src\Editor\RightBar\LayerTreeWidget.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="src\Editor\EditorWidget.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="src\Editor\ElementPoolWidget.h">
|
<QtMoc Include="src\Editor\ElementPoolWidget.h">
|
||||||
<Filter>Header Files\Editor</Filter>
|
<Filter>Header Files\Editor</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="src\FluentMenu.h">
|
<QtMoc Include="src\FluentMenu.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.h">
|
<QtMoc Include="src\Editor\EditorWidgetComponent\StrokeStyleListView.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\Editor\Style</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.h">
|
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\Editor\Style</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h">
|
||||||
|
<Filter>Header Files\Editor</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.h">
|
||||||
|
<Filter>Header Files\Editor</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="src\Editor\EditorWidget.h">
|
||||||
|
<Filter>Header Files\Editor</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="src\Editor\RightBar\LayerTreeWidget.h">
|
||||||
|
<Filter>Header Files\Editor</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="src\MainWindow.h">
|
||||||
|
<Filter>Header Files\Editor</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="src\NavigationBarWidget.h">
|
||||||
|
<Filter>Header Files\Editor</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="src\Editor\EditorWidgetComponent\ColorPicker.h">
|
||||||
|
<Filter>Header Files\Editor</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -457,7 +475,7 @@
|
||||||
<Filter>Header Files\Editor\util</Filter>
|
<Filter>Header Files\Editor\util</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\Editor\LayerStyle.h">
|
<ClInclude Include="src\Editor\LayerStyle.h">
|
||||||
<Filter>Header Files\Editor</Filter>
|
<Filter>Header Files\Editor\Style</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
#include "ColorPicker.h"
|
||||||
|
#include <QColorDialog>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
#pragma once
|
||||||
|
#include <QPushButton>
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ LayerStyleDialog::LayerStyleDialog(
|
||||||
|
|
||||||
if (existedStyle)
|
if (existedStyle)
|
||||||
{
|
{
|
||||||
this->modifyingStyle = existedStyle->clonePtr();
|
this->modifyingStyle = existedStyle->clone();
|
||||||
|
|
||||||
this->styleContainer = nullptr;
|
this->styleContainer = nullptr;
|
||||||
this->styleWidget = modifyingStyle->getInputWidget();
|
this->styleWidget = modifyingStyle->getInputWidget();
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
#include "StrokeStyleListView.h"
|
||||||
|
#include "ColorPicker.h"
|
||||||
|
#include <qtmaterialraisedbutton.h>
|
||||||
|
|
||||||
|
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<Renderer::StrokeRadialGradient> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
#pragma once
|
||||||
|
#include "LayerStyle.h"
|
||||||
|
#include "../Renderer/Painting/MaterialStyleStroke.h"
|
||||||
|
#include <QListView>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QTableWidget>
|
||||||
|
class StrokeStyleListView : public QTableWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
private:
|
||||||
|
QString currentItemValue;
|
||||||
|
|
||||||
|
public:
|
||||||
|
StrokeStyleListView(std::shared_ptr<Renderer::StrokeRadialGradient> stroke, QWidget* parent = nullptr);
|
||||||
|
std::shared_ptr<Renderer::StrokeRadialGradient> stroke;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void onCurrentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
|
||||||
|
void onCellChanged(int row, int column);
|
||||||
|
};
|
||||||
|
|
|
@ -45,9 +45,22 @@ PixelPath GroupElement::getPaintObject() const
|
||||||
//TODO: apply styles and send back
|
//TODO: apply styles and send back
|
||||||
PixelPath SimpleElement::getPaintObject(std::vector<std::shared_ptr<LayerStyle>>* styles) const {
|
PixelPath SimpleElement::getPaintObject(std::vector<std::shared_ptr<LayerStyle>>* styles) const {
|
||||||
PixelPath result;
|
PixelPath result;
|
||||||
Renderer::ElementStyleStrokeDemo demo(2);
|
std::shared_ptr<Renderer::ElementStyle> style;
|
||||||
auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0);
|
if ((*styles).empty())
|
||||||
//qDebug() << mov;
|
{
|
||||||
|
style = std::make_shared<Renderer::ElementStyleStrokeDemo>(2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
style = (*styles)[0];
|
||||||
|
/*qDebug() << std::dynamic_pointer_cast<Renderer::StrokePlain>(
|
||||||
|
std::dynamic_pointer_cast<StrokeElementLayerStyle>(style)->materialStyles[0]->materialStroke
|
||||||
|
)->material.color.name();*/
|
||||||
|
/*qDebug() << std::dynamic_pointer_cast<Renderer::StrokeRadialGradient>(
|
||||||
|
std::dynamic_pointer_cast<StrokeElementLayerStyle>(style)->materialStyles[0]->materialStroke
|
||||||
|
)->materialMap[1.0].color;*/
|
||||||
|
}
|
||||||
|
auto [img, mov] = renderer->drawElement(painterPath, *style, 1.0);
|
||||||
//qDebug() << img << " ------";
|
//qDebug() << img << " ------";
|
||||||
result.addImage(img, mov);
|
result.addImage(img, mov);
|
||||||
//result.addPath(painterPath);
|
//result.addPath(painterPath);
|
||||||
|
@ -85,7 +98,7 @@ QJsonObject GraphicElement::toJson() const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleElement::paint(QPainter* painter, QTransform transform, vector<std::shared_ptr<LayerStyle>> styles)
|
void SimpleElement::paint(QPainter* painter, QTransform transform, const vector<std::shared_ptr<LayerStyle>> &styles)
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setTransform(transform);
|
painter->setTransform(transform);
|
||||||
|
@ -95,16 +108,30 @@ void SimpleElement::paint(QPainter* painter, QTransform transform, vector<std::s
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO:Ó¦ÓÃstyle
|
|
||||||
Renderer::ElementStyleStrokeDemo demo(2);
|
Renderer::ElementStyleStrokeDemo demo(2);
|
||||||
auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0);
|
std::shared_ptr<Renderer::ElementStyle> style;
|
||||||
|
if (styles.empty())
|
||||||
|
{
|
||||||
|
style = std::make_shared<Renderer::ElementStyleStrokeDemo>(2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
style = styles[0];
|
||||||
|
/*qDebug() << std::dynamic_pointer_cast<Renderer::StrokePlain>(
|
||||||
|
std::dynamic_pointer_cast<StrokeElementLayerStyle>(style)->materialStyles[0]->materialStroke
|
||||||
|
)->material.color.name();*/
|
||||||
|
/*qDebug() << std::dynamic_pointer_cast<Renderer::StrokeRadialGradient>(
|
||||||
|
std::dynamic_pointer_cast<StrokeElementLayerStyle>(style)->materialStyles[0]->materialStroke
|
||||||
|
)->materialMap[1.0].color;*/
|
||||||
|
}
|
||||||
|
auto [img, mov] = renderer->drawElement(painterPath, *style, 1.0);
|
||||||
painter->drawImage(mov, img);
|
painter->drawImage(mov, img);
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupElement::paint(QPainter* painter, QTransform transform, vector<std::shared_ptr<LayerStyle>> styles)
|
void GroupElement::paint(QPainter* painter, QTransform transform, const vector<std::shared_ptr<LayerStyle>> &styles)
|
||||||
{
|
{
|
||||||
sourceLayer->paint(painter, transform);
|
sourceLayer->paint(painter, transform);
|
||||||
}
|
}
|
|
@ -28,7 +28,7 @@ public:
|
||||||
virtual QJsonObject toJson() const;
|
virtual QJsonObject toJson() const;
|
||||||
virtual PixelPath getPaintObject() const = 0;
|
virtual PixelPath getPaintObject() const = 0;
|
||||||
virtual PixelPath getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*) const = 0;
|
virtual PixelPath getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*) const = 0;
|
||||||
virtual void paint(QPainter* painter, QTransform transform, std::vector<std::shared_ptr<LayerStyle>> styles) = 0;
|
virtual void paint(QPainter* painter, QTransform transform, const std::vector<std::shared_ptr<LayerStyle>> &styles) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SimpleElement : public GraphicElement
|
class SimpleElement : public GraphicElement
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
~SimpleElement() = default;
|
~SimpleElement() = default;
|
||||||
PixelPath getPaintObject() const override;
|
PixelPath getPaintObject() const override;
|
||||||
PixelPath getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*) const override;
|
PixelPath getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*) const override;
|
||||||
void paint(QPainter* painter, QTransform transform, std::vector<std::shared_ptr<LayerStyle>> styles) override;
|
void paint(QPainter* painter, QTransform transform, const std::vector<std::shared_ptr<LayerStyle>> &styles) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GroupElement : public GraphicElement
|
class GroupElement : public GraphicElement
|
||||||
|
@ -60,7 +60,7 @@ public:
|
||||||
PixelPath getPaintObject() const override;
|
PixelPath getPaintObject() const override;
|
||||||
PixelPath getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*) const override;
|
PixelPath getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*) const override;
|
||||||
void setSourceLayer(FolderLayerWrapper* sourceLayer);
|
void setSourceLayer(FolderLayerWrapper* sourceLayer);
|
||||||
void paint(QPainter* painter, QTransform transform, std::vector<std::shared_ptr<LayerStyle>> styles) override;
|
void paint(QPainter* painter, QTransform transform, const std::vector<std::shared_ptr<LayerStyle>> &styles) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************** BitmapPath ********************************//
|
//******************************** BitmapPath ********************************//
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
#include "LayerStyle.h"
|
#include "LayerStyle.h"
|
||||||
|
#include "./EditorWidgetComponent/StrokeStyleListView.h"
|
||||||
|
#include <qtmaterialcheckbox.h>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
const std::vector<std::pair<QString, std::function<std::unique_ptr<LayerStyle>()>>> LayerStyle::types = {
|
const std::vector<std::pair<QString, std::function<std::unique_ptr<LayerStyle>()>>> LayerStyle::types = {
|
||||||
{
|
{
|
||||||
|
@ -18,7 +22,22 @@ const std::vector<std::pair<QString, std::function<std::unique_ptr<LayerStyle>()
|
||||||
|
|
||||||
std::vector<Renderer::BaseStyle> StrokeElementLayerStyle::toBaseStyles() const
|
std::vector<Renderer::BaseStyle> StrokeElementLayerStyle::toBaseStyles() const
|
||||||
{
|
{
|
||||||
return std::vector<Renderer::BaseStyle>();
|
std::vector<Renderer::BaseStyle> baseStyles;
|
||||||
|
if (enableEachSideIndependent)
|
||||||
|
{
|
||||||
|
baseStyles.push_back(Renderer::BaseStyle(std::make_shared<Renderer::TransformStyle>(),
|
||||||
|
strokePair.first));
|
||||||
|
baseStyles.push_back(Renderer::BaseStyle(std::make_shared<Renderer::TransformStyle>(),
|
||||||
|
strokePair.second));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto material = std::shared_ptr<MaterialStyle>(std::move(strokePair.first->clone()));
|
||||||
|
std::dynamic_pointer_cast<MaterialStyleStroke>(material)->strokeType = Renderer::StrokeType::kBothSides;
|
||||||
|
|
||||||
|
baseStyles.push_back(Renderer::BaseStyle(std::make_shared<Renderer::TransformStyle>(), material));
|
||||||
|
}
|
||||||
|
return baseStyles;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString StrokeElementLayerStyle::getStyleName() const
|
QString StrokeElementLayerStyle::getStyleName() const
|
||||||
|
@ -26,12 +45,61 @@ QString StrokeElementLayerStyle::getStyleName() const
|
||||||
return QStringLiteral("Ãè±ß");
|
return QStringLiteral("Ãè±ß");
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* StrokeElementLayerStyle::getInputWidget() const
|
QWidget* StrokeElementLayerStyle::getInputWidget()
|
||||||
{
|
{
|
||||||
// TODO
|
if (this->strokePair.first == nullptr)
|
||||||
QLabel* le = new QLabel;
|
{
|
||||||
le->setText(QStringLiteral("Ãè±ß"));
|
auto materialMap = std::map<float, Renderer::Material>();
|
||||||
return le;
|
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<Renderer::MaterialStyleStroke>(new Renderer::MaterialStyleStroke(
|
||||||
|
15,
|
||||||
|
Renderer::StrokeType::kLeftSide, Renderer::StrokeEndType::kFlat,
|
||||||
|
std::shared_ptr<Renderer::MaterialStroke>(new Renderer::StrokeRadialGradient(
|
||||||
|
materialMap, false
|
||||||
|
))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if (this->strokePair.second == nullptr)
|
||||||
|
{
|
||||||
|
auto materialMap = std::map<float, Renderer::Material>();
|
||||||
|
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<Renderer::MaterialStyleStroke>(new Renderer::MaterialStyleStroke(
|
||||||
|
15,
|
||||||
|
Renderer::StrokeType::kRightSide, Renderer::StrokeEndType::kFlat,
|
||||||
|
std::shared_ptr<Renderer::MaterialStroke>(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<Renderer::StrokeRadialGradient>(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<Renderer::StrokeRadialGradient>(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
|
QWidget* StrokeElementLayerStyle::getListDisplayWidget() const
|
||||||
|
@ -47,14 +115,16 @@ QWidget* StrokeElementLayerStyle::getListDisplayWidget() const
|
||||||
|
|
||||||
StrokeElementLayerStyle::StrokeElementLayerStyle(const StrokeElementLayerStyle& other)
|
StrokeElementLayerStyle::StrokeElementLayerStyle(const StrokeElementLayerStyle& other)
|
||||||
{
|
{
|
||||||
materialStyles = std::vector<std::shared_ptr<Renderer::MaterialStyleStroke>>(other.materialStyles.size());
|
strokePair.first = std::dynamic_pointer_cast<MaterialStyleStroke>(
|
||||||
for (size_t i = 0; i < other.materialStyles.size(); i++)
|
std::shared_ptr<Renderer::MaterialStyle>(std::move(other.strokePair.first->clone()))
|
||||||
{
|
);
|
||||||
materialStyles[i] = std::make_shared<Renderer::MaterialStyleStroke>(*other.materialStyles[i]);
|
strokePair.second = std::dynamic_pointer_cast<MaterialStyleStroke>(
|
||||||
}
|
std::shared_ptr<Renderer::MaterialStyle>(std::move(other.strokePair.second->clone()))
|
||||||
|
);
|
||||||
|
enableEachSideIndependent = other.enableEachSideIndependent;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<LayerStyle> StrokeElementLayerStyle::clonePtr() const
|
std::unique_ptr<LayerStyle> StrokeElementLayerStyle::clone() const
|
||||||
{
|
{
|
||||||
return std::make_unique<StrokeElementLayerStyle>(StrokeElementLayerStyle(*this));
|
return std::make_unique<StrokeElementLayerStyle>(StrokeElementLayerStyle(*this));
|
||||||
}
|
}
|
||||||
|
@ -69,7 +139,7 @@ QString FillElementLayerStyle::getStyleName() const
|
||||||
return QStringLiteral("Ìî³ä");
|
return QStringLiteral("Ìî³ä");
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* FillElementLayerStyle::getInputWidget() const
|
QWidget* FillElementLayerStyle::getInputWidget()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
QLineEdit* name = new QLineEdit;
|
QLineEdit* name = new QLineEdit;
|
||||||
|
@ -97,7 +167,7 @@ FillElementLayerStyle::FillElementLayerStyle(const FillElementLayerStyle& other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<LayerStyle> FillElementLayerStyle::clonePtr() const
|
std::unique_ptr<LayerStyle> FillElementLayerStyle::clone() const
|
||||||
{
|
{
|
||||||
return std::make_unique<FillElementLayerStyle>(FillElementLayerStyle(*this));
|
return std::make_unique<FillElementLayerStyle>(FillElementLayerStyle(*this));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
#include "../Renderer/Painting/MaterialStyleStroke.h"
|
#include "../Renderer/Painting/MaterialStyleStroke.h"
|
||||||
#include "../Renderer/Painting/MaterialStyleFill.h"
|
#include "../Renderer/Painting/MaterialStyleFill.h"
|
||||||
|
|
||||||
|
using Renderer::MaterialStyle;
|
||||||
|
using Renderer::MaterialStyleStroke;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在进行Style的添加时,首先创建空对象,然后直接调用getInputWidget()方法
|
* 在进行Style的添加时,首先创建空对象,然后直接调用getInputWidget()方法
|
||||||
* 在进行Style的修改时,直接调用getInputWidget()方法
|
* 在进行Style的修改时,直接调用getInputWidget()方法
|
||||||
|
@ -16,41 +19,45 @@
|
||||||
* 对于LayerStyle的实现类,应该同时实现ElementStyle,并将相同种类的(如描边或填充)的style整合成一个类,
|
* 对于LayerStyle的实现类,应该同时实现ElementStyle,并将相同种类的(如描边或填充)的style整合成一个类,
|
||||||
* 对于相同的类,一个图层应该只拥有一个
|
* 对于相同的类,一个图层应该只拥有一个
|
||||||
*/
|
*/
|
||||||
class LayerStyle
|
class LayerStyle : public Renderer::ElementStyle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const static std::vector<std::pair<QString, std::function<std::unique_ptr<LayerStyle>()>>> types;
|
const static std::vector<std::pair<QString, std::function<std::unique_ptr<LayerStyle>()>>> types;
|
||||||
virtual QString getStyleName() const = 0;
|
virtual QString getStyleName() const = 0;
|
||||||
virtual QWidget* getInputWidget() const = 0;
|
virtual QWidget* getInputWidget() = 0;
|
||||||
virtual QWidget* getListDisplayWidget() const = 0;
|
virtual QWidget* getListDisplayWidget() const = 0;
|
||||||
virtual ~LayerStyle() {};
|
virtual ~LayerStyle() {};
|
||||||
virtual std::unique_ptr<LayerStyle> clonePtr() const = 0;
|
virtual std::unique_ptr<LayerStyle> clone() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class StrokeElementLayerStyle : public Renderer::ElementStyle, public LayerStyle
|
class StrokeElementLayerStyle : public LayerStyle
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
std::pair<std::shared_ptr<MaterialStyleStroke>, std::shared_ptr<MaterialStyleStroke>> strokePair;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector<Renderer::BaseStyle> toBaseStyles() const override;
|
std::vector<Renderer::BaseStyle> toBaseStyles() const override;
|
||||||
QString getStyleName() const override;
|
QString getStyleName() const override;
|
||||||
QWidget* getInputWidget() const override;
|
QWidget* getInputWidget() override;
|
||||||
QWidget* getListDisplayWidget() const override;
|
QWidget* getListDisplayWidget() const override;
|
||||||
StrokeElementLayerStyle() = default;
|
StrokeElementLayerStyle() = default;
|
||||||
StrokeElementLayerStyle(const StrokeElementLayerStyle& other);
|
StrokeElementLayerStyle(const StrokeElementLayerStyle& other);
|
||||||
~StrokeElementLayerStyle() = default;
|
~StrokeElementLayerStyle() = default;
|
||||||
std::vector<std::shared_ptr<Renderer::MaterialStyleStroke>> materialStyles;
|
std::unique_ptr<LayerStyle> clone() const override;
|
||||||
std::unique_ptr<LayerStyle> clonePtr() const override;
|
|
||||||
|
bool enableEachSideIndependent = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FillElementLayerStyle : public Renderer::ElementStyle, public LayerStyle
|
class FillElementLayerStyle : public LayerStyle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::vector<Renderer::BaseStyle> toBaseStyles() const override;
|
std::vector<Renderer::BaseStyle> toBaseStyles() const override;
|
||||||
QString getStyleName() const override;
|
QString getStyleName() const override;
|
||||||
QWidget* getInputWidget() const override;
|
QWidget* getInputWidget() override;
|
||||||
QWidget* getListDisplayWidget() const override;
|
QWidget* getListDisplayWidget() const override;
|
||||||
FillElementLayerStyle() = default;
|
FillElementLayerStyle() = default;
|
||||||
FillElementLayerStyle(const FillElementLayerStyle& other);
|
FillElementLayerStyle(const FillElementLayerStyle& other);
|
||||||
~FillElementLayerStyle() = default;
|
~FillElementLayerStyle() = default;
|
||||||
std::vector<std::shared_ptr<Renderer::MaterialStyleFill>> materialStyles;
|
std::vector<std::shared_ptr<Renderer::MaterialStyleFill>> materialStyles;
|
||||||
std::unique_ptr<LayerStyle> clonePtr() const override;
|
std::unique_ptr<LayerStyle> clone() const override;
|
||||||
};
|
};
|
|
@ -25,6 +25,7 @@ std::unique_ptr<MaterialStroke> Renderer::StrokePlain::clone() const
|
||||||
|
|
||||||
std::vector<GLfloat> Renderer::StrokePlain::encoded() const
|
std::vector<GLfloat> Renderer::StrokePlain::encoded() const
|
||||||
{
|
{
|
||||||
|
qDebug() << material.color;
|
||||||
return { glm::uintBitsToFloat(glm::packUnorm4x8(glm::vec4(material.toVec().second, 0.f, 0.f))),
|
return { glm::uintBitsToFloat(glm::packUnorm4x8(glm::vec4(material.toVec().second, 0.f, 0.f))),
|
||||||
glm::uintBitsToFloat(glm::packUnorm4x8(material.toVec().first)) };
|
glm::uintBitsToFloat(glm::packUnorm4x8(material.toVec().first)) };
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ std::vector<GLfloat> generateStyleBuffer(const std::vector<BaseStyle>& styles)
|
||||||
styleBuffer.push_back(style.transform->scale.y);
|
styleBuffer.push_back(style.transform->scale.y);
|
||||||
styleBuffer.push_back(style.transform->rotation);
|
styleBuffer.push_back(style.transform->rotation);
|
||||||
styleBuffer.push_back(glm::uintBitsToFloat(glm::packUnorm2x16(style.transform->flip)));
|
styleBuffer.push_back(glm::uintBitsToFloat(glm::packUnorm2x16(style.transform->flip)));
|
||||||
|
|
||||||
auto encoded = style.material->encoded();
|
auto encoded = style.material->encoded();
|
||||||
styleBuffer.insert(styleBuffer.end(), encoded.begin(), encoded.end());
|
styleBuffer.insert(styleBuffer.end(), encoded.begin(), encoded.end());
|
||||||
qDebug() << "style size" << styleBuffer.size();
|
qDebug() << "style size" << styleBuffer.size();
|
||||||
|
|
Loading…
Reference in New Issue