feat: glyphShape configurable
This commit is contained in:
parent
23359f9f54
commit
efeed7fcb9
|
|
@ -178,10 +178,10 @@ void MainWindow::on_SquareButton_clicked(bool checked) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_HexagonButton_clicked(bool checked) {
|
void MainWindow::on_CrossButton_clicked(bool checked) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
for (Technique *t : ui->program->getTechniques()) {
|
for (Technique *t : ui->program->getTechniques()) {
|
||||||
t->setGlyphStyle(HEXAGON);
|
t->setGlyphStyle(CROSS);
|
||||||
}
|
}
|
||||||
ui->program->requestRender();
|
ui->program->requestRender();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ private slots:
|
||||||
void on_CircleButton_clicked(bool checked);
|
void on_CircleButton_clicked(bool checked);
|
||||||
void on_TriangleButton_clicked(bool checked);
|
void on_TriangleButton_clicked(bool checked);
|
||||||
void on_SquareButton_clicked(bool checked);
|
void on_SquareButton_clicked(bool checked);
|
||||||
void on_HexagonButton_clicked(bool checked);
|
void on_CrossButton_clicked(bool checked);
|
||||||
void on_FullySampledButton_clicked(bool checked);
|
void on_FullySampledButton_clicked(bool checked);
|
||||||
void on_RegularlySubsampledButton_clicked(bool checked);
|
void on_RegularlySubsampledButton_clicked(bool checked);
|
||||||
void on_IregularlySubsampledButton_clicked(bool checked);
|
void on_IregularlySubsampledButton_clicked(bool checked);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public:
|
||||||
QRadioButton *CircleButton;
|
QRadioButton *CircleButton;
|
||||||
QRadioButton *TriangleButton;
|
QRadioButton *TriangleButton;
|
||||||
QRadioButton *SquareButton;
|
QRadioButton *SquareButton;
|
||||||
QRadioButton *HexagonButton;
|
QRadioButton *CrossButton;
|
||||||
QGroupBox *GlyphBox_2;
|
QGroupBox *GlyphBox_2;
|
||||||
QVBoxLayout *verticalLayout_16;
|
QVBoxLayout *verticalLayout_16;
|
||||||
QRadioButton *FullySampledButton;
|
QRadioButton *FullySampledButton;
|
||||||
|
|
@ -188,10 +188,10 @@ public:
|
||||||
|
|
||||||
verticalLayout_14->addWidget(SquareButton);
|
verticalLayout_14->addWidget(SquareButton);
|
||||||
|
|
||||||
HexagonButton = new QRadioButton(GlyphBox);
|
CrossButton = new QRadioButton(GlyphBox);
|
||||||
HexagonButton->setObjectName(QString::fromUtf8("HexagonButton"));
|
CrossButton->setObjectName(QString::fromUtf8("CrossButton"));
|
||||||
|
|
||||||
verticalLayout_14->addWidget(HexagonButton);
|
verticalLayout_14->addWidget(CrossButton);
|
||||||
|
|
||||||
GlyphBox_2 = new QGroupBox(ChannelBox);
|
GlyphBox_2 = new QGroupBox(ChannelBox);
|
||||||
GlyphBox_2->setObjectName(QString::fromUtf8("GlyphBox_2"));
|
GlyphBox_2->setObjectName(QString::fromUtf8("GlyphBox_2"));
|
||||||
|
|
@ -260,11 +260,11 @@ public:
|
||||||
CircleButton->setText(QCoreApplication::translate("MainWindow", "Circle", nullptr));
|
CircleButton->setText(QCoreApplication::translate("MainWindow", "Circle", nullptr));
|
||||||
TriangleButton->setText(QCoreApplication::translate("MainWindow", "Triangle", nullptr));
|
TriangleButton->setText(QCoreApplication::translate("MainWindow", "Triangle", nullptr));
|
||||||
SquareButton->setText(QCoreApplication::translate("MainWindow", "Square", nullptr));
|
SquareButton->setText(QCoreApplication::translate("MainWindow", "Square", nullptr));
|
||||||
HexagonButton->setText(QCoreApplication::translate("MainWindow", "Hexagon", nullptr));
|
CrossButton->setText(QCoreApplication::translate("MainWindow", "Cross", nullptr));
|
||||||
GlyphBox_2->setTitle(QCoreApplication::translate("MainWindow", "Glyph count", nullptr));
|
GlyphBox_2->setTitle(QCoreApplication::translate("MainWindow", "Glyph count", nullptr));
|
||||||
FullySampledButton->setText(QCoreApplication::translate("MainWindow", "Fully sampled", nullptr));
|
FullySampledButton->setText(QCoreApplication::translate("MainWindow", "Fully sampled", nullptr));
|
||||||
RegularlySubsampledButton->setText(QCoreApplication::translate("MainWindow", "Regularly subsampled", nullptr));
|
RegularlySubsampledButton->setText(QCoreApplication::translate("MainWindow", "Regularly subsampled", nullptr));
|
||||||
IregularlySubsampledButton->setText(QCoreApplication::translate("MainWindow", "Irregularly sampled", nullptr));
|
IregularlySubsampledButton->setText(QCoreApplication::translate("MainWindow", "Irregularly subsampled", nullptr));
|
||||||
} // retranslateUi
|
} // retranslateUi
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -59,13 +59,13 @@ LGlyphLayer::LGlyphLayer(std::shared_ptr<UVGrid> uvGrid, std::unique_ptr<Advecti
|
||||||
vtkSmartPointer<vtkTransformFilter> transformFilter = createCartographicTransformFilter(uvGrid);
|
vtkSmartPointer<vtkTransformFilter> transformFilter = createCartographicTransformFilter(uvGrid);
|
||||||
transformFilter->SetInputData(data);
|
transformFilter->SetInputData(data);
|
||||||
|
|
||||||
vtkNew<vtkGlyphSource2D> circleSource;
|
this->glyphSource = vtkSmartPointer<vtkGlyphSource2D>::New();
|
||||||
circleSource->SetGlyphTypeToCircle();
|
this->glyphSource->SetGlyphTypeToCircle();
|
||||||
circleSource->SetScale(0.02);
|
this->glyphSource->SetScale(0.02);
|
||||||
circleSource->Update();
|
this->glyphSource->Update();
|
||||||
|
|
||||||
vtkNew<vtkGlyph2D> glyph2D;
|
vtkNew<vtkGlyph2D> glyph2D;
|
||||||
glyph2D->SetSourceConnection(circleSource->GetOutputPort());
|
glyph2D->SetSourceConnection(this->glyphSource->GetOutputPort());
|
||||||
glyph2D->SetInputConnection(transformFilter->GetOutputPort());
|
glyph2D->SetInputConnection(transformFilter->GetOutputPort());
|
||||||
glyph2D->SetScaleModeToDataScalingOff();
|
glyph2D->SetScaleModeToDataScalingOff();
|
||||||
glyph2D->Update();
|
glyph2D->Update();
|
||||||
|
|
@ -202,6 +202,23 @@ void LGlyphLayer::setSaturationMode(SaturationMode mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LGlyphLayer::setGlyphStyle(GlyphStyle style) {
|
||||||
|
switch (style) {
|
||||||
|
case CIRCLE:
|
||||||
|
this->glyphSource->SetGlyphTypeToCircle();
|
||||||
|
break;
|
||||||
|
case SQUARE:
|
||||||
|
this->glyphSource->SetGlyphTypeToSquare();
|
||||||
|
break;
|
||||||
|
case TRIANGLE:
|
||||||
|
this->glyphSource->SetGlyphTypeToTriangle();
|
||||||
|
break;
|
||||||
|
case CROSS:
|
||||||
|
this->glyphSource->SetGlyphTypeToCross();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LGlyphLayer::setDt(int dt) {
|
void LGlyphLayer::setDt(int dt) {
|
||||||
this->dt = dt;
|
this->dt = dt;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "../advection/kernel/AdvectionKernel.h"
|
#include "../advection/kernel/AdvectionKernel.h"
|
||||||
#include "../commands/SpawnPointCallback.h"
|
#include "../commands/SpawnPointCallback.h"
|
||||||
|
#include <vtkGlyphSource2D.h>
|
||||||
#include <vtkPolyData.h>
|
#include <vtkPolyData.h>
|
||||||
#include <vtkInteractorStyle.h>
|
#include <vtkInteractorStyle.h>
|
||||||
|
|
||||||
|
|
@ -18,6 +19,7 @@ private:
|
||||||
vtkSmartPointer<vtkIntArray> particlesAge;
|
vtkSmartPointer<vtkIntArray> particlesAge;
|
||||||
vtkSmartPointer<vtkIntArray> lutIdx;
|
vtkSmartPointer<vtkIntArray> lutIdx;
|
||||||
vtkSmartPointer<vtkPolyDataMapper> mapper;
|
vtkSmartPointer<vtkPolyDataMapper> mapper;
|
||||||
|
vtkSmartPointer<vtkGlyphSource2D> glyphSource;
|
||||||
std::unique_ptr<AdvectionKernel> advector;
|
std::unique_ptr<AdvectionKernel> advector;
|
||||||
std::shared_ptr<UVGrid> uvGrid;
|
std::shared_ptr<UVGrid> uvGrid;
|
||||||
int dt = 3600;
|
int dt = 3600;
|
||||||
|
|
@ -54,6 +56,7 @@ public:
|
||||||
|
|
||||||
void setColourMode(ColourMode mode) override;
|
void setColourMode(ColourMode mode) override;
|
||||||
void setSaturationMode(SaturationMode mode) override;
|
void setSaturationMode(SaturationMode mode) override;
|
||||||
|
void setGlyphStyle(GlyphStyle style) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a custom DT value, needed for advect calls to the simulation logic.
|
* Sets a custom DT value, needed for advect calls to the simulation logic.
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ enum GlyphStyle {
|
||||||
CIRCLE = 0,
|
CIRCLE = 0,
|
||||||
TRIANGLE = 1,
|
TRIANGLE = 1,
|
||||||
SQUARE = 2,
|
SQUARE = 2,
|
||||||
HEXAGON = 3,
|
CROSS = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SamplingMode {
|
enum SamplingMode {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue