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);
|
right_toolbar_layout->setContentsMargins(0, 5, 0,5);
|
||||||
connect (this, &QObject::destroyed, _toolbar, &QObject::deleteLater);
|
connect (this, &QObject::destroyed, _toolbar, &QObject::deleteLater);
|
||||||
|
|
||||||
_view_toolbar = new Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar(this);
|
auto top_toolbar_layout = new QVBoxLayout(_viewport_overlay_ui->upperToolbarHolder);
|
||||||
auto top_toolbar_layout = new QHBoxLayout(_viewport_overlay_ui->upperToolbarHolder);
|
|
||||||
top_toolbar_layout->addWidget( _view_toolbar);
|
|
||||||
top_toolbar_layout->setContentsMargins(5, 0, 5, 0);
|
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);
|
connect (this, &QObject::destroyed, _view_toolbar, &QObject::deleteLater);
|
||||||
|
|
||||||
|
top_toolbar_layout->addWidget( _view_toolbar);
|
||||||
|
sec_toolbar_layout->addWidget( _secondary_toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::setupKeybindingsGui()
|
void MapView::setupKeybindingsGui()
|
||||||
@@ -1840,6 +1849,13 @@ void MapView::setupViewMenu()
|
|||||||
_world->renderer()->markTerrainParamsUniformBlockDirty();
|
_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,
|
ADD_TOGGLE_POST (view_menu, "Wireframe", Qt::Key_F10, _draw_wireframe,
|
||||||
[=]
|
[=]
|
||||||
{
|
{
|
||||||
@@ -2055,6 +2071,7 @@ void MapView::setupHotkeys()
|
|||||||
alloff_models = _draw_models.get();
|
alloff_models = _draw_models.get();
|
||||||
alloff_doodads = _draw_wmo_doodads.get();
|
alloff_doodads = _draw_wmo_doodads.get();
|
||||||
alloff_contour = _draw_contour.get();
|
alloff_contour = _draw_contour.get();
|
||||||
|
alloff_climb = _draw_climb.get();
|
||||||
alloff_wmo = _draw_wmo.get();
|
alloff_wmo = _draw_wmo.get();
|
||||||
alloff_fog = _draw_fog.get();
|
alloff_fog = _draw_fog.get();
|
||||||
alloff_terrain = _draw_terrain.get();
|
alloff_terrain = _draw_terrain.get();
|
||||||
@@ -2062,6 +2079,7 @@ void MapView::setupHotkeys()
|
|||||||
_draw_models.set (false);
|
_draw_models.set (false);
|
||||||
_draw_wmo_doodads.set (false);
|
_draw_wmo_doodads.set (false);
|
||||||
_draw_contour.set (true);
|
_draw_contour.set (true);
|
||||||
|
_draw_climb.set (false);
|
||||||
_draw_wmo.set (false);
|
_draw_wmo.set (false);
|
||||||
_draw_terrain.set (true);
|
_draw_terrain.set (true);
|
||||||
_draw_fog.set (false);
|
_draw_fog.set (false);
|
||||||
@@ -2071,6 +2089,7 @@ void MapView::setupHotkeys()
|
|||||||
_draw_models.set (alloff_models);
|
_draw_models.set (alloff_models);
|
||||||
_draw_wmo_doodads.set (alloff_doodads);
|
_draw_wmo_doodads.set (alloff_doodads);
|
||||||
_draw_contour.set (alloff_contour);
|
_draw_contour.set (alloff_contour);
|
||||||
|
_draw_climb.set(alloff_climb);
|
||||||
_draw_wmo.set (alloff_wmo);
|
_draw_wmo.set (alloff_wmo);
|
||||||
_draw_terrain.set (alloff_terrain);
|
_draw_terrain.set (alloff_terrain);
|
||||||
_draw_fog.set (alloff_fog);
|
_draw_fog.set (alloff_fog);
|
||||||
@@ -4262,7 +4281,6 @@ void MapView::draw_map()
|
|||||||
doSelection(true);
|
doSelection(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_world->renderer()->draw (
|
_world->renderer()->draw (
|
||||||
model_view()
|
model_view()
|
||||||
, projection()
|
, projection()
|
||||||
@@ -5221,6 +5239,11 @@ void MapView::unloadOpenglData()
|
|||||||
_gl_initialized = false;
|
_gl_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget* MapView::getSecondaryToolBar()
|
||||||
|
{
|
||||||
|
return _viewport_overlay_ui->secondaryToolbarHolder;
|
||||||
|
}
|
||||||
|
|
||||||
QWidget* MapView::getActiveStampModeItem()
|
QWidget* MapView::getActiveStampModeItem()
|
||||||
{
|
{
|
||||||
auto item = stampTool->getActiveBrushItem();
|
auto item = stampTool->getActiveBrushItem();
|
||||||
@@ -5237,6 +5260,9 @@ void MapView::onSettingsSave()
|
|||||||
params->wireframe_radius = _settings->value("wireframe/radius", 1.5f).toFloat();
|
params->wireframe_radius = _settings->value("wireframe/radius", 1.5f).toFloat();
|
||||||
params->wireframe_width = _settings->value ("wireframe/width", 1.f).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>();
|
QColor c = _settings->value("wireframe/color").value<QColor>();
|
||||||
glm::vec4 wireframe_color(c.redF(), c.greenF(), c.blueF(), c.alphaF());
|
glm::vec4 wireframe_color(c.redF(), c.greenF(), c.blueF(), c.alphaF());
|
||||||
params->wireframe_color = wireframe_color;
|
params->wireframe_color = wireframe_color;
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ private:
|
|||||||
void checkInputsSettings();
|
void checkInputsSettings();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Noggit::BoolToggleProperty _draw_climb = {false};
|
||||||
Noggit::BoolToggleProperty _draw_contour = {false};
|
Noggit::BoolToggleProperty _draw_contour = {false};
|
||||||
Noggit::BoolToggleProperty _draw_mfbo = {false};
|
Noggit::BoolToggleProperty _draw_mfbo = {false};
|
||||||
Noggit::BoolToggleProperty _draw_wireframe = {false};
|
Noggit::BoolToggleProperty _draw_wireframe = {false};
|
||||||
@@ -208,6 +209,7 @@ private:
|
|||||||
bool alloff_detailselect = false;
|
bool alloff_detailselect = false;
|
||||||
bool alloff_fog = false;
|
bool alloff_fog = false;
|
||||||
bool alloff_terrain = false;
|
bool alloff_terrain = false;
|
||||||
|
bool alloff_climb = false;
|
||||||
|
|
||||||
editing_mode terrainMode = editing_mode::ground;
|
editing_mode terrainMode = editing_mode::ground;
|
||||||
editing_mode saveterrainMode = terrainMode;
|
editing_mode saveterrainMode = terrainMode;
|
||||||
@@ -224,6 +226,7 @@ private:
|
|||||||
|
|
||||||
Noggit::Ui::toolbar* _toolbar;
|
Noggit::Ui::toolbar* _toolbar;
|
||||||
Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar* _view_toolbar;
|
Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar* _view_toolbar;
|
||||||
|
Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar* _secondary_toolbar;
|
||||||
|
|
||||||
void save(save_mode mode);
|
void save(save_mode mode);
|
||||||
|
|
||||||
@@ -271,6 +274,9 @@ public:
|
|||||||
void set_editing_mode (editing_mode);
|
void set_editing_mode (editing_mode);
|
||||||
editing_mode get_editing_mode() { return terrainMode; };
|
editing_mode get_editing_mode() { return terrainMode; };
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
QWidget *getSecondaryToolBar();
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
QWidget* getActiveStampModeItem();
|
QWidget* getActiveStampModeItem();
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ layout (std140) uniform overlay_params
|
|||||||
int draw_paintability_overlay;
|
int draw_paintability_overlay;
|
||||||
int draw_selection_overlay;
|
int draw_selection_overlay;
|
||||||
vec4 wireframe_color;
|
vec4 wireframe_color;
|
||||||
|
int draw_impassible_climb;
|
||||||
|
int climb_use_output_angle;
|
||||||
|
int climb_use_smooth_interpolation;
|
||||||
|
float climb_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ChunkInstanceData
|
struct ChunkInstanceData
|
||||||
@@ -69,6 +73,7 @@ in vec2 vary_t3_uv;
|
|||||||
in vec3 vary_normal;
|
in vec3 vary_normal;
|
||||||
in vec3 vary_mccv;
|
in vec3 vary_mccv;
|
||||||
flat in int instanceID;
|
flat in int instanceID;
|
||||||
|
flat in vec3 triangle_normal;
|
||||||
|
|
||||||
out vec4 out_color;
|
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)
|
if(draw_cursor_circle == 1)
|
||||||
{
|
{
|
||||||
float diff = length(vary_position.xz - cursor_position.xz);
|
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_mccv;
|
||||||
out vec3 vary_normal;
|
out vec3 vary_normal;
|
||||||
flat out int instanceID;
|
flat out int instanceID;
|
||||||
|
flat out vec3 triangle_normal;
|
||||||
|
|
||||||
bool isHoleVertex(uint vertexId, uint hole)
|
bool isHoleVertex(uint vertexId, uint hole)
|
||||||
{
|
{
|
||||||
@@ -176,6 +177,7 @@ void main()
|
|||||||
gl_Position = projection * model_view * vec4(pos_after_holecheck);
|
gl_Position = projection * model_view * vec4(pos_after_holecheck);
|
||||||
|
|
||||||
vary_normal = normal_pos.rgb;
|
vary_normal = normal_pos.rgb;
|
||||||
|
triangle_normal = normal_pos.rgb;
|
||||||
vary_position = vec3(pos);
|
vary_position = vec3(pos);
|
||||||
vary_mccv = texelFetch(mccv, ivec2(gl_VertexID, instanceID), 0).rgb;
|
vary_mccv = texelFetch(mccv, ivec2(gl_VertexID, instanceID), 0).rgb;
|
||||||
|
|
||||||
|
|||||||
@@ -62,29 +62,66 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="upperToolbarHolder" native="true">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
<widget class="QWidget" name="upperToolbarHolder" native="true">
|
||||||
<horstretch>0</horstretch>
|
<property name="sizePolicy">
|
||||||
<verstretch>0</verstretch>
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
</sizepolicy>
|
<horstretch>0</horstretch>
|
||||||
</property>
|
<verstretch>0</verstretch>
|
||||||
</widget>
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<property name="orientation">
|
<item>
|
||||||
<enum>Qt::Horizontal</enum>
|
<widget class="QWidget" name="secondaryToolbarHolder" native="true">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<property name="sizeHint" stdset="0">
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
<size>
|
<horstretch>0</horstretch>
|
||||||
<width>0</width>
|
<verstretch>0</verstretch>
|
||||||
<height>20</height>
|
</sizepolicy>
|
||||||
</size>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</spacer>
|
</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>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -15,89 +15,162 @@ ViewToolbar::ViewToolbar(MapView* mapView)
|
|||||||
setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
|
setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
add_tool_icon(&mapView->_draw_models, tr("Doodads"), FontNoggit::VISIBILITY_DOODADS);
|
IconAction* climb_icon = new IconAction(FontNoggitIcon{FontNoggit::FAVORITE});
|
||||||
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);
|
|
||||||
|
|
||||||
addSeparator();
|
|
||||||
|
|
||||||
add_tool_icon(&mapView->_draw_lines, tr("Lines"), FontNoggit::VISIBILITY_LINES);
|
CheckBoxAction* climb_use_output_color_angle = new CheckBoxAction(tr("Display all angle color"));
|
||||||
add_tool_icon(&mapView->_draw_hole_lines, tr("Hole lines"), FontNoggit::VISIBILITY_HOLE_LINES);
|
climb_use_output_color_angle->checkbox()->setChecked(false);
|
||||||
add_tool_icon(&mapView->_draw_wireframe, tr("Wireframe"), FontNoggit::VISIBILITY_WIREFRAME);
|
connect(climb_use_output_color_angle->checkbox(), &QCheckBox::stateChanged, [mapView, climb_use_output_color_angle]()
|
||||||
add_tool_icon(&mapView->_draw_contour, tr("Contours"), FontNoggit::VISIBILITY_CONTOURS);
|
|
||||||
|
|
||||||
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);
|
|
||||||
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);
|
|
||||||
addSeparator();
|
|
||||||
/*
|
|
||||||
auto tablet_sensitivity = new QSlider(this);
|
|
||||||
tablet_sensitivity->setOrientation(Qt::Horizontal);
|
|
||||||
addWidget(tablet_sensitivity);
|
|
||||||
*/
|
|
||||||
|
|
||||||
auto undo_stack_btn = new QPushButton(this);
|
|
||||||
undo_stack_btn->setIcon(FontAwesomeIcon(FontAwesome::undo));
|
|
||||||
undo_stack_btn->setToolTip("History");
|
|
||||||
addWidget(undo_stack_btn);
|
|
||||||
|
|
||||||
|
|
||||||
auto undo_stack_popup = new QWidget(this);
|
|
||||||
undo_stack_popup->setMinimumWidth(160);
|
|
||||||
undo_stack_popup->setMinimumHeight(300);
|
|
||||||
auto layout = new QVBoxLayout(undo_stack_popup);
|
|
||||||
auto action_navigator = new Noggit::Ui::Tools::ActionHistoryNavigator(undo_stack_popup);
|
|
||||||
action_navigator->setMinimumWidth(160);
|
|
||||||
action_navigator->setMinimumHeight(300);
|
|
||||||
layout->addWidget(undo_stack_popup);
|
|
||||||
|
|
||||||
undo_stack_popup->updateGeometry();
|
|
||||||
undo_stack_popup->adjustSize();
|
|
||||||
undo_stack_popup->update();
|
|
||||||
undo_stack_popup->repaint();
|
|
||||||
undo_stack_popup->setVisible(false);
|
|
||||||
|
|
||||||
connect(undo_stack_btn, &QPushButton::clicked,
|
|
||||||
[=]()
|
|
||||||
{
|
{
|
||||||
QPoint new_pos = mapToGlobal(
|
mapView->getWorld()->renderer()->getTerrainParamsUniformBlock()->climb_use_output_angle = climb_use_output_color_angle->checkbox()->isChecked();
|
||||||
QPoint(undo_stack_btn->pos().x(),
|
mapView->getWorld()->renderer()->markTerrainParamsUniformBlockDirty();
|
||||||
undo_stack_btn->pos().y() + 30));
|
|
||||||
|
|
||||||
undo_stack_popup->setGeometry(new_pos.x(),
|
|
||||||
new_pos.y(),
|
|
||||||
undo_stack_popup->width(),
|
|
||||||
undo_stack_popup->height());
|
|
||||||
|
|
||||||
undo_stack_popup->setWindowFlags(Qt::Popup);
|
|
||||||
undo_stack_popup->show();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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(Noggit::BoolToggleProperty* view_state, const QString& name, const FontNoggit::Icons& icon)
|
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);
|
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::triggered, [this, action, view_state] () {
|
connect (action, &QAction::hovered, [mapView, sec_tool_bar, sec_action_bar] () {
|
||||||
action->setChecked(!view_state->get());
|
sec_tool_bar->clear();
|
||||||
view_state->set(!view_state->get());
|
mapView->getSecondaryToolBar()->hide();
|
||||||
});
|
|
||||||
|
|
||||||
connect (view_state, &Noggit::BoolToggleProperty::changed, [this, action, view_state] () {
|
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());
|
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, &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, &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, &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);
|
||||||
|
tablet_sensitivity->setOrientation(Qt::Horizontal);
|
||||||
|
addWidget(tablet_sensitivity);
|
||||||
|
*/
|
||||||
|
|
||||||
|
auto undo_stack_btn = new QPushButton(this);
|
||||||
|
undo_stack_btn->setIcon(FontAwesomeIcon(FontAwesome::undo));
|
||||||
|
undo_stack_btn->setToolTip("History");
|
||||||
|
addWidget(undo_stack_btn);
|
||||||
|
|
||||||
|
|
||||||
|
auto undo_stack_popup = new QWidget(this);
|
||||||
|
undo_stack_popup->setMinimumWidth(160);
|
||||||
|
undo_stack_popup->setMinimumHeight(300);
|
||||||
|
auto layout = new QVBoxLayout(undo_stack_popup);
|
||||||
|
auto action_navigator = new Noggit::Ui::Tools::ActionHistoryNavigator(undo_stack_popup);
|
||||||
|
action_navigator->setMinimumWidth(160);
|
||||||
|
action_navigator->setMinimumHeight(300);
|
||||||
|
layout->addWidget(undo_stack_popup);
|
||||||
|
|
||||||
|
undo_stack_popup->updateGeometry();
|
||||||
|
undo_stack_popup->adjustSize();
|
||||||
|
undo_stack_popup->update();
|
||||||
|
undo_stack_popup->repaint();
|
||||||
|
undo_stack_popup->setVisible(false);
|
||||||
|
|
||||||
|
connect(undo_stack_btn, &QPushButton::clicked,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
QPoint new_pos = mapToGlobal(
|
||||||
|
QPoint(undo_stack_btn->pos().x(),
|
||||||
|
undo_stack_btn->pos().y() + 30));
|
||||||
|
|
||||||
|
undo_stack_popup->setGeometry(new_pos.x(),
|
||||||
|
new_pos.y(),
|
||||||
|
undo_stack_popup->width(),
|
||||||
|
undo_stack_popup->height());
|
||||||
|
|
||||||
|
undo_stack_popup->setWindowFlags(Qt::Popup);
|
||||||
|
undo_stack_popup->show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewToolbar::setupWidget(QVector<QWidgetAction *> _to_setup)
|
||||||
|
{
|
||||||
|
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
|
#pragma once
|
||||||
|
|
||||||
|
#include "qcheckbox.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include <QtWidgets/QActionGroup>
|
#include <QtWidgets/QActionGroup>
|
||||||
@@ -19,10 +20,128 @@ namespace Noggit
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ViewToolbar(MapView* mapView);
|
ViewToolbar(MapView* mapView);
|
||||||
|
ViewToolbar(MapView* mapView, ViewToolbar* tb);
|
||||||
|
|
||||||
|
void setupWidget(QVector<QWidgetAction*> _to_setup);
|
||||||
|
QVector<QWidgetAction*> _climb_secondary_tool;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QActionGroup _tool_group;
|
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_paintability_overlay = false;
|
||||||
int draw_selection_overlay = false;
|
int draw_selection_overlay = false;
|
||||||
glm::vec4 wireframe_color;
|
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
|
struct ChunkInstanceDataUniformBlock
|
||||||
|
|||||||
Reference in New Issue
Block a user