Fix Stamp Mode cursor shader. Add settings support for this mode's required directories.
This commit is contained in:
@@ -211,7 +211,7 @@ void main()
|
||||
vec2 topleft = cursor_position.xz;
|
||||
topleft.x -= outer_cursor_radius;
|
||||
topleft.y -= outer_cursor_radius;
|
||||
vec2 texcoord = (vary_position.xz - topleft) / (outer_cursor_radius * 2.0f) - 0.5;
|
||||
vec2 texcoord = (vary_position.xz - topleft) / outer_cursor_radius * 0.5 - 0.5;
|
||||
vec2 rotatedTexcoord;
|
||||
rotatedTexcoord.x = texcoord.x * cos(angle) + texcoord.y * sin(angle) + 0.5;
|
||||
rotatedTexcoord.y = texcoord.y * cos(angle) - texcoord.x * sin(angle) + 0.5;
|
||||
@@ -219,9 +219,8 @@ void main()
|
||||
, 1.0 * (int(length(vary_position.xz - cursor_position.xz) / outer_cursor_radius < 1.0))
|
||||
* (1.0 - length(vary_position.xz - cursor_position.xz) / outer_cursor_radius));*/
|
||||
out_color.rgb = mix(out_color.rgb, cursor_color.rgb, texture(stampBrush, rotatedTexcoord).r
|
||||
* (int(length(vary_position.xz - cursor_position.xz) / outer_cursor_radius < 1.0))
|
||||
* (1.0 - length(vary_position.xz - cursor_position.xz) / outer_cursor_radius));
|
||||
|
||||
* int(abs(vary_position.x - cursor_position.x) <= outer_cursor_radius
|
||||
|| abs(vary_position.z - cursor_position.z) <= outer_cursor_radius));
|
||||
/*vec2 posRel = vary_position.xz - cursor_position.xz;
|
||||
float pos_x = posRel.x * sin(angle) - posRel.y * cos(angle);
|
||||
float pos_z = posRel.y * sin(angle) + posRel.x * cos(angle);
|
||||
@@ -229,7 +228,6 @@ void main()
|
||||
float diff_z = abs(pos_z);
|
||||
float inner_radius = outer_cursor_radius * inner_cursor_ratio;
|
||||
float d = length(fw);
|
||||
|
||||
float alpha = 1.0 * (1 - int((diff_x < outer_cursor_radius && diff_z < outer_cursor_radius
|
||||
&& (outer_cursor_radius - diff_x <= d || outer_cursor_radius - diff_z <= d)) || (diff_x < inner_radius
|
||||
&& diff_z < inner_radius && (inner_radius - diff_x <= d || inner_radius - diff_z <= d))));
|
||||
|
||||
@@ -1445,7 +1445,7 @@ auto MapView::populateImageModel(QStandardItemModel* model) const -> void
|
||||
using namespace noggit::Red::StampMode::Ui::Model;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
for(auto& image : fs::directory_iterator{_settings->value("project/path").toString().toStdString() + "Images/"})
|
||||
for(auto& image : fs::directory_iterator{_settings->value("stamping/samples").toString().toStdString()})
|
||||
if(!image.is_directory())
|
||||
{
|
||||
auto item{new Item{image.path().string().c_str()}};
|
||||
@@ -1467,11 +1467,6 @@ auto MapView::setBrushTexture(QPixmap const* pixmap) -> void
|
||||
_data[i * img.width() + j] = img.pixel(j, i);
|
||||
}
|
||||
|
||||
auto MapView::getBrushTexture(void) -> opengl::texture*
|
||||
{
|
||||
return &_texBrush;
|
||||
}
|
||||
|
||||
void MapView::move_camera_with_auto_height (math::vector_3d const& pos)
|
||||
{
|
||||
makeCurrent();
|
||||
|
||||
@@ -209,7 +209,6 @@ public:
|
||||
void initMinimapSave() { saving_minimap = true; };
|
||||
auto populateImageModel(QStandardItemModel* model) const -> void;
|
||||
auto setBrushTexture(QPixmap const* pixmap) -> void;
|
||||
auto getBrushTexture(void) -> opengl::texture*;
|
||||
noggit::camera* getCamera() { return &_camera; };
|
||||
|
||||
void set_editing_mode (editing_mode);
|
||||
|
||||
@@ -14,11 +14,11 @@ namespace noggit::Red::StampMode::Ui::Model
|
||||
class Item : public QStandardItem
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
Item(QString const& filepath);
|
||||
auto data(int role) const -> QVariant override;
|
||||
explicit
|
||||
Item(QString const& filepath);
|
||||
auto data(int role) const -> QVariant override;
|
||||
private:
|
||||
QPixmap _pixmap;
|
||||
QPixmap _pixmap;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -16,19 +16,15 @@ namespace noggit::Red::StampMode::Ui
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit
|
||||
PaletteMain(MapView* parent);
|
||||
|
||||
auto contextMenuEvent(QContextMenuEvent* event) -> void override;
|
||||
|
||||
explicit
|
||||
PaletteMain(MapView* parent);
|
||||
auto contextMenuEvent(QContextMenuEvent* event) -> void override;
|
||||
signals:
|
||||
|
||||
void itemSelected(QPixmap const* pixmap) const;
|
||||
|
||||
void itemSelected(QPixmap const* pixmap) const;
|
||||
private:
|
||||
QGridLayout _layout;
|
||||
QStandardItemModel _model;
|
||||
QListView _view;
|
||||
QGridLayout _layout;
|
||||
QStandardItemModel _model;
|
||||
QListView _view;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ auto Tool::setPixmap(QPixmap const* pixmap) -> void
|
||||
}
|
||||
|
||||
Tool::Tool(bool_toggle_property* showPalette, float* cursorRotation, QWidget* parent)
|
||||
: QWidget{parent}, _cursorRotation{cursorRotation}, _radiusOuter{25.f}, _radiusInner{10.f}, _layout{this}, _label{this}
|
||||
, _btnPalette{"Open Palette", this}, _sliderRadiusOuter{Qt::Orientation::Horizontal, this}
|
||||
, _spinboxRadiusOuter{this}, _sliderRadiusInner{Qt::Orientation::Horizontal, this}
|
||||
, _spinboxRadiusInner{this}, _dialRotation{this}, _curPixmap{nullptr}
|
||||
: QWidget{parent}, _cursorRotation{cursorRotation}, _radiusOuter{25.f}, _radiusInner{10.f}, _layout{this}
|
||||
, _label{this}, _btnPalette{"Open Palette", this}
|
||||
, _sliderRadiusOuter{Qt::Orientation::Horizontal, this}, _spinboxRadiusOuter{this}
|
||||
, _sliderRadiusInner{Qt::Orientation::Horizontal, this}, _spinboxRadiusInner{this}
|
||||
, _dialRotation{this}, _curPixmap{nullptr}
|
||||
{
|
||||
_layout.addRow(&_label);
|
||||
_layout.addRow(&_btnPalette);
|
||||
@@ -92,13 +93,10 @@ Tool::Tool(bool_toggle_property* showPalette, float* cursorRotation, QWidget* pa
|
||||
QSignalBlocker blocker{&_sliderRadiusInner};
|
||||
_sliderRadiusInner.setValue(val);
|
||||
});
|
||||
auto label{new QLabel{this}};
|
||||
_layout.addRow(label);
|
||||
connect(&_dialRotation, &QDial::valueChanged, [this, label](int val) -> void
|
||||
connect(&_dialRotation, &QDial::valueChanged, [this](int val) -> void
|
||||
{
|
||||
_rotation = val;
|
||||
*_cursorRotation = _rotation / 360.0f;
|
||||
label->setText(QString::number(*_cursorRotation));
|
||||
});
|
||||
_dialRotation.setValue(0);
|
||||
}
|
||||
@@ -113,11 +111,6 @@ auto Tool::getInnerRadius(void) const -> float
|
||||
return _radiusInner;
|
||||
}
|
||||
|
||||
auto Tool::getRotation(void) const -> float
|
||||
{
|
||||
return _rotation;
|
||||
}
|
||||
|
||||
auto Tool::stamp(World* world, math::vector_3d const& pos, float dt, bool doAdd) const -> void
|
||||
{
|
||||
if(!_curPixmap)
|
||||
|
||||
@@ -27,28 +27,27 @@ namespace noggit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit
|
||||
Tool(bool_toggle_property* showPalette, float* cursorRotation, QWidget* parent = nullptr);
|
||||
auto stamp(World* world, math::vector_3d const& pos, float dt, bool doAdd) const -> void;
|
||||
auto getOuterRadius(void) const -> float;
|
||||
auto getInnerRadius(void) const -> float;
|
||||
auto getRotation(void) const -> float;
|
||||
public slots:
|
||||
void setPixmap(QPixmap const* pixmap);
|
||||
explicit
|
||||
Tool(bool_toggle_property* showPalette, float* cursorRotation, QWidget* parent = nullptr);
|
||||
auto getOuterRadius(void) const -> float;
|
||||
auto getInnerRadius(void) const -> float;
|
||||
auto stamp(World* world, math::vector_3d const& pos, float dt, bool doAdd) const -> void;
|
||||
public slots:
|
||||
void setPixmap(QPixmap const* pixmap);
|
||||
private:
|
||||
float* _cursorRotation;
|
||||
float _radiusOuter;
|
||||
float _radiusInner;
|
||||
float _rotation;
|
||||
QFormLayout _layout;
|
||||
QLabel _label;
|
||||
QPushButton _btnPalette;
|
||||
QPixmap const* _curPixmap;
|
||||
QSlider _sliderRadiusOuter;
|
||||
QDoubleSpinBox _spinboxRadiusOuter;
|
||||
QSlider _sliderRadiusInner;
|
||||
QDoubleSpinBox _spinboxRadiusInner;
|
||||
QDial _dialRotation;
|
||||
float* _cursorRotation;
|
||||
float _radiusOuter;
|
||||
float _radiusInner;
|
||||
float _rotation;
|
||||
QFormLayout _layout;
|
||||
QLabel _label;
|
||||
QPushButton _btnPalette;
|
||||
QPixmap const* _curPixmap;
|
||||
QSlider _sliderRadiusOuter;
|
||||
QDoubleSpinBox _spinboxRadiusOuter;
|
||||
QSlider _sliderRadiusInner;
|
||||
QDoubleSpinBox _spinboxRadiusInner;
|
||||
QDial _dialRotation;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,8 +90,9 @@ namespace noggit
|
||||
browse_row (&gamePathField, "Game Path", "project/game_path", util::file_line_edit::directories);
|
||||
browse_row (&projectPathField, "Project Path", "project/path", util::file_line_edit::directories);
|
||||
browse_row (&importPathField, "Import Path", "project/import_file", util::file_line_edit::files);
|
||||
browse_row (&wmvLogPathField, "WMV Log Path", "project/wmv_log_file", util::file_line_edit::files);
|
||||
|
||||
browse_row (&wmvLogPathField, "WMV Log Path", "project/wmv_log_file", util::file_line_edit::files);
|
||||
browse_row(&_stampingSamples, "Stamping samples root directory", "stamping/samples", util::file_line_edit::directories);
|
||||
browse_row(&_stampingBrushes, "Stamping brush configs root directory", "stamping/brushes", util::file_line_edit::directories);
|
||||
_mysql_box = new QGroupBox ("MySQL (uid storage)", this);
|
||||
_mysql_box->setToolTip ("Store the maps' max model unique id (uid) in a mysql database to sync your uids with different computers/users to avoid duplications");
|
||||
auto mysql_layout (new QFormLayout (_mysql_box));
|
||||
@@ -262,6 +263,8 @@ namespace noggit
|
||||
projectPathField->actual->setText (_settings->value ("project/path").toString());
|
||||
importPathField->actual->setText (_settings->value ("project/import_file", "import.txt").toString());
|
||||
wmvLogPathField->actual->setText (_settings->value ("project/wmv_log_file").toString());
|
||||
_stampingSamples->actual->setText(_settings->value("stamping/samples").toString());
|
||||
_stampingBrushes->actual->setText(_settings->value("stamping/brushes").toString());
|
||||
viewDistanceField->setValue (_settings->value ("view_distance", 1000.f).toFloat());
|
||||
farZField->setValue (_settings->value ("farZ", 2048.f).toFloat());
|
||||
tabletModeCheck->setChecked (_settings->value ("tablet/enabled", false).toBool());
|
||||
@@ -296,6 +299,8 @@ namespace noggit
|
||||
_settings->setValue ("project/path", projectPathField->actual->text());
|
||||
_settings->setValue ("project/import_file", importPathField->actual->text());
|
||||
_settings->setValue ("project/wmv_log_file", wmvLogPathField->actual->text());
|
||||
_settings->setValue("stamping/samples", _stampingSamples->actual->text());
|
||||
_settings->setValue("stamping/brushes", _stampingBrushes->actual->text());
|
||||
_settings->setValue ("farZ", farZField->value());
|
||||
_settings->setValue ("view_distance", viewDistanceField->value());
|
||||
_settings->setValue ("tablet/enabled", tabletModeCheck->isChecked());
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace noggit
|
||||
util::file_line_edit* projectPathField;
|
||||
util::file_line_edit* importPathField;
|
||||
util::file_line_edit* wmvLogPathField;
|
||||
util::file_line_edit* _stampingSamples;
|
||||
util::file_line_edit* _stampingBrushes;
|
||||
QDoubleSpinBox* viewDistanceField;
|
||||
QDoubleSpinBox* farZField;
|
||||
QSpinBox* _adt_unload_dist;
|
||||
|
||||
Reference in New Issue
Block a user