Adding CLIMB toggle
- Adding secondary toolbar that can be used for other toggle option - You can smooth or not the renderer climb area - You can setup the maximal value for climb
This commit is contained in:
@@ -1049,11 +1049,20 @@ void MapView::setupToolbars()
|
||||
right_toolbar_layout->setContentsMargins(0, 5, 0,5);
|
||||
connect (this, &QObject::destroyed, _toolbar, &QObject::deleteLater);
|
||||
|
||||
_view_toolbar = new Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar(this);
|
||||
auto top_toolbar_layout = new QHBoxLayout(_viewport_overlay_ui->upperToolbarHolder);
|
||||
top_toolbar_layout->addWidget( _view_toolbar);
|
||||
auto top_toolbar_layout = new QVBoxLayout(_viewport_overlay_ui->upperToolbarHolder);
|
||||
top_toolbar_layout->setContentsMargins(5, 0, 5, 0);
|
||||
auto sec_toolbar_layout = new QVBoxLayout(_viewport_overlay_ui->secondaryToolbarHolder);
|
||||
sec_toolbar_layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
_viewport_overlay_ui->secondaryToolbarHolder->hide();
|
||||
_secondary_toolbar = new Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar(this);
|
||||
connect (this, &QObject::destroyed, _secondary_toolbar, &QObject::deleteLater);
|
||||
|
||||
_view_toolbar = new Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar(this, _secondary_toolbar);
|
||||
connect (this, &QObject::destroyed, _view_toolbar, &QObject::deleteLater);
|
||||
|
||||
top_toolbar_layout->addWidget( _view_toolbar);
|
||||
sec_toolbar_layout->addWidget( _secondary_toolbar);
|
||||
}
|
||||
|
||||
void MapView::setupKeybindingsGui()
|
||||
@@ -1840,6 +1849,13 @@ void MapView::setupViewMenu()
|
||||
_world->renderer()->markTerrainParamsUniformBlockDirty();
|
||||
});
|
||||
|
||||
ADD_TOGGLE_POST(view_menu, "Climb", Qt::Key_F12, _draw_climb,
|
||||
[=]
|
||||
{
|
||||
_world->renderer()->getTerrainParamsUniformBlock()->draw_impassible_climb = _draw_climb.get();
|
||||
_world->renderer()->markTerrainParamsUniformBlockDirty();
|
||||
});
|
||||
|
||||
ADD_TOGGLE_POST (view_menu, "Wireframe", Qt::Key_F10, _draw_wireframe,
|
||||
[=]
|
||||
{
|
||||
@@ -2055,6 +2071,7 @@ void MapView::setupHotkeys()
|
||||
alloff_models = _draw_models.get();
|
||||
alloff_doodads = _draw_wmo_doodads.get();
|
||||
alloff_contour = _draw_contour.get();
|
||||
alloff_climb = _draw_climb.get();
|
||||
alloff_wmo = _draw_wmo.get();
|
||||
alloff_fog = _draw_fog.get();
|
||||
alloff_terrain = _draw_terrain.get();
|
||||
@@ -2062,6 +2079,7 @@ void MapView::setupHotkeys()
|
||||
_draw_models.set (false);
|
||||
_draw_wmo_doodads.set (false);
|
||||
_draw_contour.set (true);
|
||||
_draw_climb.set (false);
|
||||
_draw_wmo.set (false);
|
||||
_draw_terrain.set (true);
|
||||
_draw_fog.set (false);
|
||||
@@ -2071,6 +2089,7 @@ void MapView::setupHotkeys()
|
||||
_draw_models.set (alloff_models);
|
||||
_draw_wmo_doodads.set (alloff_doodads);
|
||||
_draw_contour.set (alloff_contour);
|
||||
_draw_climb.set(alloff_climb);
|
||||
_draw_wmo.set (alloff_wmo);
|
||||
_draw_terrain.set (alloff_terrain);
|
||||
_draw_fog.set (alloff_fog);
|
||||
@@ -4262,7 +4281,6 @@ void MapView::draw_map()
|
||||
doSelection(true);
|
||||
}
|
||||
|
||||
|
||||
_world->renderer()->draw (
|
||||
model_view()
|
||||
, projection()
|
||||
@@ -5221,6 +5239,11 @@ void MapView::unloadOpenglData()
|
||||
_gl_initialized = false;
|
||||
}
|
||||
|
||||
QWidget* MapView::getSecondaryToolBar()
|
||||
{
|
||||
return _viewport_overlay_ui->secondaryToolbarHolder;
|
||||
}
|
||||
|
||||
QWidget* MapView::getActiveStampModeItem()
|
||||
{
|
||||
auto item = stampTool->getActiveBrushItem();
|
||||
@@ -5237,6 +5260,9 @@ void MapView::onSettingsSave()
|
||||
params->wireframe_radius = _settings->value("wireframe/radius", 1.5f).toFloat();
|
||||
params->wireframe_width = _settings->value ("wireframe/width", 1.f).toFloat();
|
||||
|
||||
/* temporaryyyyyy */
|
||||
params->climb_value = 1.0f;
|
||||
|
||||
QColor c = _settings->value("wireframe/color").value<QColor>();
|
||||
glm::vec4 wireframe_color(c.redF(), c.greenF(), c.blueF(), c.alphaF());
|
||||
params->wireframe_color = wireframe_color;
|
||||
|
||||
@@ -136,6 +136,7 @@ private:
|
||||
void checkInputsSettings();
|
||||
|
||||
public:
|
||||
Noggit::BoolToggleProperty _draw_climb = {false};
|
||||
Noggit::BoolToggleProperty _draw_contour = {false};
|
||||
Noggit::BoolToggleProperty _draw_mfbo = {false};
|
||||
Noggit::BoolToggleProperty _draw_wireframe = {false};
|
||||
@@ -208,6 +209,7 @@ private:
|
||||
bool alloff_detailselect = false;
|
||||
bool alloff_fog = false;
|
||||
bool alloff_terrain = false;
|
||||
bool alloff_climb = false;
|
||||
|
||||
editing_mode terrainMode = editing_mode::ground;
|
||||
editing_mode saveterrainMode = terrainMode;
|
||||
@@ -224,6 +226,7 @@ private:
|
||||
|
||||
Noggit::Ui::toolbar* _toolbar;
|
||||
Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar* _view_toolbar;
|
||||
Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar* _secondary_toolbar;
|
||||
|
||||
void save(save_mode mode);
|
||||
|
||||
@@ -271,6 +274,9 @@ public:
|
||||
void set_editing_mode (editing_mode);
|
||||
editing_mode get_editing_mode() { return terrainMode; };
|
||||
|
||||
[[nodiscard]]
|
||||
QWidget *getSecondaryToolBar();
|
||||
|
||||
[[nodiscard]]
|
||||
QWidget* getActiveStampModeItem();
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ layout (std140) uniform overlay_params
|
||||
int draw_paintability_overlay;
|
||||
int draw_selection_overlay;
|
||||
vec4 wireframe_color;
|
||||
int draw_impassible_climb;
|
||||
int climb_use_output_angle;
|
||||
int climb_use_smooth_interpolation;
|
||||
float climb_value;
|
||||
};
|
||||
|
||||
struct ChunkInstanceData
|
||||
@@ -69,6 +73,7 @@ in vec2 vary_t3_uv;
|
||||
in vec3 vary_normal;
|
||||
in vec3 vary_mccv;
|
||||
flat in int instanceID;
|
||||
flat in vec3 triangle_normal;
|
||||
|
||||
out vec4 out_color;
|
||||
|
||||
@@ -356,6 +361,46 @@ void main()
|
||||
}
|
||||
}
|
||||
|
||||
if (draw_impassible_climb != 0)
|
||||
{
|
||||
vec4 color = vec4(out_color.r, out_color.g, out_color.b, 0.5);
|
||||
vec3 use_normal;
|
||||
|
||||
if (climb_use_smooth_interpolation != 0)
|
||||
{
|
||||
use_normal = vary_normal;
|
||||
}
|
||||
else
|
||||
{
|
||||
use_normal = triangle_normal;
|
||||
}
|
||||
|
||||
float d1 = use_normal.y;
|
||||
float d2 = sqrt(use_normal.x * use_normal.x +
|
||||
use_normal.y * use_normal.y +
|
||||
use_normal.z * use_normal.z);
|
||||
|
||||
if (d2 > 0.0)
|
||||
{
|
||||
float normal_angle = acos(d1/d2);
|
||||
|
||||
if (climb_use_output_angle != 0)
|
||||
{
|
||||
color.r = normal_angle;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (normal_angle > climb_value)
|
||||
{
|
||||
color.r = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
out_color.rgb = mix(out_color.rgb, color.rgb, color.a);
|
||||
}
|
||||
|
||||
if(draw_cursor_circle == 1)
|
||||
{
|
||||
float diff = length(vary_position.xz - cursor_position.xz);
|
||||
|
||||
@@ -45,6 +45,7 @@ out vec2 vary_t3_uv;
|
||||
out vec3 vary_mccv;
|
||||
out vec3 vary_normal;
|
||||
flat out int instanceID;
|
||||
flat out vec3 triangle_normal;
|
||||
|
||||
bool isHoleVertex(uint vertexId, uint hole)
|
||||
{
|
||||
@@ -176,6 +177,7 @@ void main()
|
||||
gl_Position = projection * model_view * vec4(pos_after_holecheck);
|
||||
|
||||
vary_normal = normal_pos.rgb;
|
||||
triangle_normal = normal_pos.rgb;
|
||||
vary_position = vec3(pos);
|
||||
vary_mccv = texelFetch(mccv, ivec2(gl_VertexID, instanceID), 0).rgb;
|
||||
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QWidget" name="upperToolbarHolder" native="true">
|
||||
<property name="sizePolicy">
|
||||
@@ -71,6 +73,12 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -88,6 +96,35 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QWidget" name="secondaryToolbarHolder" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
|
||||
@@ -15,29 +15,111 @@ ViewToolbar::ViewToolbar(MapView* mapView)
|
||||
setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
|
||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
|
||||
add_tool_icon(&mapView->_draw_models, tr("Doodads"), FontNoggit::VISIBILITY_DOODADS);
|
||||
add_tool_icon(&mapView->_draw_wmo, tr("WMOs"), FontNoggit::VISIBILITY_WMO);
|
||||
add_tool_icon(&mapView->_draw_wmo_doodads, tr("WMO doodads"), FontNoggit::VISIBILITY_WMO_DOODADS);
|
||||
add_tool_icon(&mapView->_draw_terrain, tr("Terrain"), FontNoggit::VISIBILITY_TERRAIN);
|
||||
add_tool_icon(&mapView->_draw_water, tr("Water"), FontNoggit::VISIBILITY_WATER);
|
||||
IconAction* climb_icon = new IconAction(FontNoggitIcon{FontNoggit::FAVORITE});
|
||||
|
||||
CheckBoxAction* climb_use_output_color_angle = new CheckBoxAction(tr("Display all angle color"));
|
||||
climb_use_output_color_angle->checkbox()->setChecked(false);
|
||||
connect(climb_use_output_color_angle->checkbox(), &QCheckBox::stateChanged, [mapView, climb_use_output_color_angle]()
|
||||
{
|
||||
mapView->getWorld()->renderer()->getTerrainParamsUniformBlock()->climb_use_output_angle = climb_use_output_color_angle->checkbox()->isChecked();
|
||||
mapView->getWorld()->renderer()->markTerrainParamsUniformBlockDirty();
|
||||
});
|
||||
|
||||
CheckBoxAction* climb_use_smooth_interpolation = new CheckBoxAction(tr("Smooth"));
|
||||
climb_use_smooth_interpolation->setChecked(false);
|
||||
connect(climb_use_smooth_interpolation->checkbox(), &QCheckBox::stateChanged, [mapView, climb_use_smooth_interpolation]()
|
||||
{
|
||||
mapView->getWorld()->renderer()->getTerrainParamsUniformBlock()->climb_use_smooth_interpolation = climb_use_smooth_interpolation->checkbox()->isChecked();
|
||||
mapView->getWorld()->renderer()->markTerrainParamsUniformBlockDirty();
|
||||
});
|
||||
|
||||
SliderAction* climb_value = new SliderAction(tr("Configure climb maximum value"));
|
||||
connect(climb_value->slider(), &QSlider::valueChanged, [mapView](int value)
|
||||
{
|
||||
float radian = float(value) / 1000.0f;
|
||||
mapView->getWorld()->renderer()->getTerrainParamsUniformBlock()->climb_value = radian;
|
||||
mapView->getWorld()->renderer()->markTerrainParamsUniformBlockDirty();
|
||||
});
|
||||
|
||||
PushButtonAction* climb_reset_slider = new PushButtonAction(tr("Reset"));
|
||||
connect(climb_reset_slider->pushbutton(), &QPushButton::clicked, [climb_value]()
|
||||
{
|
||||
climb_value->slider()->setValue(1000);
|
||||
});
|
||||
|
||||
_climb_secondary_tool.push_back(climb_icon);
|
||||
_climb_secondary_tool.push_back(climb_use_smooth_interpolation);
|
||||
_climb_secondary_tool.push_back(climb_use_output_color_angle);
|
||||
_climb_secondary_tool.push_back(climb_value);
|
||||
_climb_secondary_tool.push_back(climb_reset_slider);
|
||||
}
|
||||
|
||||
void ViewToolbar::add_tool_icon(MapView* mapView,
|
||||
Noggit::BoolToggleProperty* view_state,
|
||||
const QString& name,
|
||||
const FontNoggit::Icons& icon,
|
||||
ViewToolbar* sec_tool_bar,
|
||||
QVector<QWidgetAction*> sec_action_bar)
|
||||
{
|
||||
auto action = addAction(FontNoggitIcon{icon}, name);
|
||||
connect (action, &QAction::triggered, [action, view_state] () {
|
||||
action->setChecked(!view_state->get());
|
||||
view_state->set(!view_state->get());
|
||||
});
|
||||
|
||||
connect (action, &QAction::hovered, [mapView, sec_tool_bar, sec_action_bar] () {
|
||||
sec_tool_bar->clear();
|
||||
mapView->getSecondaryToolBar()->hide();
|
||||
|
||||
if (sec_action_bar.size() > 0)
|
||||
{
|
||||
sec_tool_bar->setupWidget(sec_action_bar);
|
||||
mapView->getSecondaryToolBar()->show();
|
||||
}
|
||||
});
|
||||
|
||||
connect (view_state, &Noggit::BoolToggleProperty::changed, [action, view_state] () {
|
||||
action->setChecked(view_state->get());
|
||||
});
|
||||
|
||||
action->setCheckable(true);
|
||||
action->setChecked(view_state->get());
|
||||
}
|
||||
|
||||
|
||||
ViewToolbar::ViewToolbar(MapView *mapView, ViewToolbar *tb)
|
||||
: _tool_group(this)
|
||||
{
|
||||
Q_UNUSED(tb);
|
||||
|
||||
setContextMenuPolicy(Qt::PreventContextMenu);
|
||||
setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
|
||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
|
||||
add_tool_icon(mapView, &mapView->_draw_models, tr("Doodads"), FontNoggit::VISIBILITY_DOODADS, tb);
|
||||
add_tool_icon(mapView, &mapView->_draw_wmo, tr("WMOs"), FontNoggit::VISIBILITY_WMO, tb);
|
||||
add_tool_icon(mapView, &mapView->_draw_wmo_doodads, tr("WMO doodads"), FontNoggit::VISIBILITY_WMO_DOODADS, tb);
|
||||
add_tool_icon(mapView, &mapView->_draw_terrain, tr("Terrain"), FontNoggit::VISIBILITY_TERRAIN, tb);
|
||||
add_tool_icon(mapView, &mapView->_draw_water, tr("Water"), FontNoggit::VISIBILITY_WATER, tb);
|
||||
|
||||
addSeparator();
|
||||
|
||||
add_tool_icon(&mapView->_draw_lines, tr("Lines"), FontNoggit::VISIBILITY_LINES);
|
||||
add_tool_icon(&mapView->_draw_hole_lines, tr("Hole lines"), FontNoggit::VISIBILITY_HOLE_LINES);
|
||||
add_tool_icon(&mapView->_draw_wireframe, tr("Wireframe"), FontNoggit::VISIBILITY_WIREFRAME);
|
||||
add_tool_icon(&mapView->_draw_contour, tr("Contours"), FontNoggit::VISIBILITY_CONTOURS);
|
||||
add_tool_icon(mapView, &mapView->_draw_lines, tr("Lines"), FontNoggit::VISIBILITY_LINES, tb);
|
||||
add_tool_icon(mapView, &mapView->_draw_hole_lines, tr("Hole lines"), FontNoggit::VISIBILITY_HOLE_LINES, tb);
|
||||
add_tool_icon(mapView, &mapView->_draw_wireframe, tr("Wireframe"), FontNoggit::VISIBILITY_WIREFRAME, tb);
|
||||
add_tool_icon(mapView, &mapView->_draw_contour, tr("Contours"), FontNoggit::VISIBILITY_CONTOURS, tb);
|
||||
add_tool_icon(mapView, &mapView->_draw_climb, tr("Climb"), FontNoggit::FAVORITE, tb, tb->_climb_secondary_tool);
|
||||
|
||||
addSeparator();
|
||||
|
||||
// Animation
|
||||
add_tool_icon(&mapView->_draw_fog, tr("Fog"), FontNoggit::VISIBILITY_FOG);
|
||||
add_tool_icon(&mapView->_draw_mfbo, tr("Flight bounds"), FontNoggit::VISIBILITY_FLIGHT_BOUNDS);
|
||||
add_tool_icon(mapView, &mapView->_draw_fog, tr("Fog"), FontNoggit::VISIBILITY_FOG, tb);
|
||||
add_tool_icon(mapView, &mapView->_draw_mfbo, tr("Flight bounds"), FontNoggit::VISIBILITY_FLIGHT_BOUNDS, tb);
|
||||
addSeparator();
|
||||
|
||||
// Hole lines always on
|
||||
add_tool_icon(&mapView->_draw_models_with_box, tr("Models with box"), FontNoggit::VISIBILITY_WITH_BOX);
|
||||
add_tool_icon(&mapView->_draw_hidden_models, tr("Hidden models"), FontNoggit::VISIBILITY_HIDDEN_MODELS);
|
||||
add_tool_icon(mapView, &mapView->_draw_models_with_box, tr("Models with box"), FontNoggit::VISIBILITY_WITH_BOX, tb);
|
||||
add_tool_icon(mapView, &mapView->_draw_hidden_models, tr("Hidden models"), FontNoggit::VISIBILITY_HIDDEN_MODELS, tb);
|
||||
addSeparator();
|
||||
/*
|
||||
auto tablet_sensitivity = new QSlider(this);
|
||||
@@ -81,23 +163,14 @@ ViewToolbar::ViewToolbar(MapView* mapView)
|
||||
undo_stack_popup->setWindowFlags(Qt::Popup);
|
||||
undo_stack_popup->show();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ViewToolbar::add_tool_icon(Noggit::BoolToggleProperty* view_state, const QString& name, const FontNoggit::Icons& icon)
|
||||
void ViewToolbar::setupWidget(QVector<QWidgetAction *> _to_setup)
|
||||
{
|
||||
auto action = addAction(FontNoggitIcon{icon}, name);
|
||||
|
||||
connect (action, &QAction::triggered, [this, action, view_state] () {
|
||||
action->setChecked(!view_state->get());
|
||||
view_state->set(!view_state->get());
|
||||
});
|
||||
|
||||
connect (view_state, &Noggit::BoolToggleProperty::changed, [this, action, view_state] () {
|
||||
action->setChecked(view_state->get());
|
||||
});
|
||||
|
||||
action->setCheckable(true);
|
||||
action->setChecked(view_state->get());
|
||||
clear();
|
||||
for (int i = 0; i < _to_setup.size(); ++i)
|
||||
{
|
||||
addAction(_to_setup[i]);
|
||||
(i == _to_setup.size() - 1) ? NULL : addSeparator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "qcheckbox.h"
|
||||
#include <functional>
|
||||
|
||||
#include <QtWidgets/QActionGroup>
|
||||
@@ -19,10 +20,128 @@ namespace Noggit
|
||||
{
|
||||
public:
|
||||
ViewToolbar(MapView* mapView);
|
||||
ViewToolbar(MapView* mapView, ViewToolbar* tb);
|
||||
|
||||
void setupWidget(QVector<QWidgetAction*> _to_setup);
|
||||
QVector<QWidgetAction*> _climb_secondary_tool;
|
||||
|
||||
private:
|
||||
QActionGroup _tool_group;
|
||||
void add_tool_icon(Noggit::BoolToggleProperty* view_state, const QString& name, const Noggit::Ui::FontNoggit::Icons& icon);
|
||||
void add_tool_icon(MapView* mapView,
|
||||
Noggit::BoolToggleProperty* view_state,
|
||||
const QString& name,
|
||||
const Noggit::Ui::FontNoggit::Icons& icon,
|
||||
ViewToolbar* sec_tool_bar,
|
||||
QVector<QWidgetAction*> sec_action_bar = QVector<QWidgetAction*>());
|
||||
|
||||
};
|
||||
|
||||
class SliderAction : public QWidgetAction
|
||||
{
|
||||
public:
|
||||
SliderAction (const QString &title)
|
||||
: QWidgetAction(NULL)
|
||||
{
|
||||
QWidget* _widget = new QWidget(NULL);
|
||||
QHBoxLayout* _layout = new QHBoxLayout();
|
||||
QLabel* _label = new QLabel(title);
|
||||
QLabel* _display = new QLabel(tr("57 degrees"));
|
||||
|
||||
_slider = new QSlider(NULL);
|
||||
_slider->setOrientation(Qt::Horizontal);
|
||||
_slider->setMinimum(0);
|
||||
_slider->setMaximum(1570);
|
||||
_slider->setValue(1000);
|
||||
|
||||
connect(_slider, &QSlider::valueChanged, [_display](int value)
|
||||
{
|
||||
float radian = float(value) / 1000.f;
|
||||
float degrees = radian * (180.0/3.141592653589793238463);
|
||||
_display->setText(QString::number(int(degrees)) + tr(" degrees"));
|
||||
});
|
||||
|
||||
_layout->addWidget(_label);
|
||||
_layout->addWidget(_slider);
|
||||
_layout->addWidget(_display);
|
||||
_widget->setLayout(_layout);
|
||||
|
||||
setDefaultWidget(_widget);
|
||||
}
|
||||
|
||||
QSlider* slider() { return _slider; }
|
||||
|
||||
private:
|
||||
QSlider *_slider;
|
||||
};
|
||||
|
||||
class PushButtonAction : public QWidgetAction
|
||||
{
|
||||
public:
|
||||
PushButtonAction (const QString& text)
|
||||
: QWidgetAction(NULL)
|
||||
{
|
||||
QWidget* _widget = new QWidget(NULL);
|
||||
QHBoxLayout* _layout = new QHBoxLayout();
|
||||
|
||||
_push = new QPushButton(text);
|
||||
|
||||
_layout->addWidget(_push);
|
||||
_widget->setLayout(_layout);
|
||||
|
||||
setDefaultWidget(_widget);
|
||||
}
|
||||
|
||||
QPushButton* pushbutton() { return _push; };
|
||||
|
||||
private:
|
||||
QPushButton *_push;
|
||||
};
|
||||
|
||||
class CheckBoxAction : public QWidgetAction
|
||||
{
|
||||
public:
|
||||
CheckBoxAction (const QString& text)
|
||||
: QWidgetAction(NULL)
|
||||
{
|
||||
QWidget* _widget = new QWidget(NULL);
|
||||
QHBoxLayout* _layout = new QHBoxLayout();
|
||||
|
||||
_checkbox = new QCheckBox(text);
|
||||
|
||||
_layout->addWidget(_checkbox);
|
||||
_widget->setLayout(_layout);
|
||||
|
||||
setDefaultWidget(_widget);
|
||||
}
|
||||
|
||||
QCheckBox* checkbox() { return _checkbox; };
|
||||
|
||||
private:
|
||||
QCheckBox *_checkbox;
|
||||
};
|
||||
|
||||
class IconAction : public QWidgetAction
|
||||
{
|
||||
public:
|
||||
IconAction (const QIcon& icon)
|
||||
: QWidgetAction(NULL)
|
||||
{
|
||||
QWidget* _widget = new QWidget(NULL);
|
||||
QHBoxLayout* _layout = new QHBoxLayout();
|
||||
|
||||
_icon = new QLabel();
|
||||
_icon->setPixmap(icon.pixmap(QSize(24,24)));
|
||||
|
||||
_layout->addWidget(_icon);
|
||||
_widget->setLayout(_layout);
|
||||
|
||||
setDefaultWidget(_widget);
|
||||
}
|
||||
|
||||
QLabel* icon() { return _icon; };
|
||||
|
||||
private:
|
||||
QLabel *_icon;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,10 @@ namespace OpenGL
|
||||
int draw_paintability_overlay = false;
|
||||
int draw_selection_overlay = false;
|
||||
glm::vec4 wireframe_color;
|
||||
|
||||
int draw_impassible_climb = false;
|
||||
int climb_use_output_angle = false;
|
||||
int climb_use_smooth_interpolation = false;
|
||||
float climb_value;
|
||||
};
|
||||
|
||||
struct ChunkInstanceDataUniformBlock
|
||||
|
||||
Reference in New Issue
Block a user