minimap generator: add progress bar and adt selection overlay, hide shadows from render

This commit is contained in:
Skarn
2020-10-22 03:25:20 +03:00
parent 9d0f627cc9
commit 2407bc0937
7 changed files with 47 additions and 10 deletions

View File

@@ -20,6 +20,8 @@ uniform bool draw_impassible_flag;
uniform bool draw_terrain_height_contour; uniform bool draw_terrain_height_contour;
uniform bool draw_lines; uniform bool draw_lines;
uniform bool draw_hole_lines; uniform bool draw_hole_lines;
uniform bool draw_selection;
uniform bool draw_shadows;
uniform bool draw_wireframe; uniform bool draw_wireframe;
uniform int wireframe_type; uniform int wireframe_type;
@@ -120,9 +122,16 @@ void main()
out_color.rgb = mix(vec3(1.0), out_color.rgb, 0.5); out_color.rgb = mix(vec3(1.0), out_color.rgb, 0.5);
} }
float shadow_alpha = texture(shadow_map, vary_texcoord / 8.0).r; if(draw_selection)
{
out_color.rgb = mix(vec3(1.0), out_color.rgb, 0.5);
}
out_color = vec4 (out_color.rgb * (1.0 - shadow_alpha), 1.0); if (draw_shadows)
{
float shadow_alpha = texture(shadow_map, vary_texcoord / 8.0).r;
out_color = vec4 (out_color.rgb * (1.0 - shadow_alpha), 1.0);
}
if (draw_terrain_height_contour) if (draw_terrain_height_contour)
{ {

View File

@@ -1665,6 +1665,8 @@ void MapView::saveMinimap(MinimapRenderSettings* settings)
} }
} }
minimapTool->progressUpdate(mmap_render_index);
} }
@@ -2596,6 +2598,7 @@ void MapView::draw_map()
, _draw_hole_lines.get() || terrainMode == editing_mode::holes , _draw_hole_lines.get() || terrainMode == editing_mode::holes
, _draw_models_with_box.get() , _draw_models_with_box.get()
, _draw_hidden_models.get() , _draw_hidden_models.get()
, minimapTool->getMinimapRenderSettings()
, _area_id_colors , _area_id_colors
, _draw_fog.get() , _draw_fog.get()
, terrainTool->_edit_type , terrainTool->_edit_type

View File

@@ -201,6 +201,7 @@ public:
void change_selected_wmo_doodadset(int set); void change_selected_wmo_doodadset(int set);
void saveMinimap(MinimapRenderSettings* settings); void saveMinimap(MinimapRenderSettings* settings);
void initMinimapSave() { saving_minimap = true; }; void initMinimapSave() { saving_minimap = true; };
noggit::camera* getCamera() { return &_camera; };
void set_editing_mode (editing_mode); void set_editing_mode (editing_mode);

View File

@@ -664,6 +664,7 @@ void World::draw ( math::matrix_4x4 const& model_view
, bool draw_hole_lines , bool draw_hole_lines
, bool draw_models_with_box , bool draw_models_with_box
, bool draw_hidden_models , bool draw_hidden_models
, MinimapRenderSettings* minimap_render_settings
, std::map<int, misc::random_color>& area_id_colors , std::map<int, misc::random_color>& area_id_colors
, bool draw_fog , bool draw_fog
, eTerrainType ground_editing_brush , eTerrainType ground_editing_brush
@@ -909,6 +910,7 @@ void World::draw ( math::matrix_4x4 const& model_view
mcnk_shader.uniform("tex1", 2); mcnk_shader.uniform("tex1", 2);
mcnk_shader.uniform("tex2", 3); mcnk_shader.uniform("tex2", 3);
mcnk_shader.uniform("tex3", 4); mcnk_shader.uniform("tex3", 4);
mcnk_shader.uniform("draw_shadows", 1);
mcnk_shader.uniform("shadow_map", 5); mcnk_shader.uniform("shadow_map", 5);
mcnk_shader.uniform("tex_anim_0", math::vector_2d()); mcnk_shader.uniform("tex_anim_0", math::vector_2d());
@@ -918,6 +920,17 @@ void World::draw ( math::matrix_4x4 const& model_view
for (MapTile* tile : mapIndex.loaded_tiles()) for (MapTile* tile : mapIndex.loaded_tiles())
{ {
if (terrainMode == editing_mode::minimap
&& minimap_render_settings->selected_tiles.at(64 * tile->index.x + tile->index.z))
{
mcnk_shader.uniform("draw_selection", 1);
}
else
{
mcnk_shader.uniform("draw_selection", 0);
}
tile->draw ( frustum tile->draw ( frustum
, mcnk_shader , mcnk_shader
, detailtexcoords , detailtexcoords
@@ -1856,6 +1869,8 @@ void World::drawMinimap ( MapTile *tile
mcnk_shader.uniform("tex1", 2); mcnk_shader.uniform("tex1", 2);
mcnk_shader.uniform("tex2", 3); mcnk_shader.uniform("tex2", 3);
mcnk_shader.uniform("tex3", 4); mcnk_shader.uniform("tex3", 4);
mcnk_shader.uniform("draw_shadows", 0);
mcnk_shader.uniform("shadow_map", 5); mcnk_shader.uniform("shadow_map", 5);
mcnk_shader.uniform("tex_anim_0", math::vector_2d()); mcnk_shader.uniform("tex_anim_0", math::vector_2d());

View File

@@ -121,6 +121,7 @@ public:
, bool draw_hole_lines , bool draw_hole_lines
, bool draw_models_with_box , bool draw_models_with_box
, bool draw_hidden_models , bool draw_hidden_models
, MinimapRenderSettings* minimap_render_settings
, std::map<int, misc::random_color>& area_id_colors , std::map<int, misc::random_color>& area_id_colors
, bool draw_fog , bool draw_fog
, eTerrainType ground_editing_brush , eTerrainType ground_editing_brush

View File

@@ -17,6 +17,7 @@
#include <QWheelEvent> #include <QWheelEvent>
#include <QApplication> #include <QApplication>
#include <QComboBox> #include <QComboBox>
#include <QProgressBar>
namespace noggit namespace noggit
@@ -50,7 +51,8 @@ namespace noggit
_minimap_widget->world(world); _minimap_widget->world(world);
_minimap_widget->draw_boundaries(true); _minimap_widget->draw_boundaries(true);
_minimap_widget->use_selection(&_selected_tiles); _minimap_widget->use_selection(&_render_settings.selected_tiles);
_minimap_widget->camera(mapView->getCamera());
// Right side // Right side
@@ -123,6 +125,10 @@ namespace noggit
draw_elevation->setChecked(_render_settings.draw_elevation); draw_elevation->setChecked(_render_settings.draw_elevation);
render_settings_box_layout->addRow (draw_elevation); render_settings_box_layout->addRow (draw_elevation);
_progress_bar = new QProgressBar(this);
_progress_bar->setRange(0, 4096);
generate_layout->addRow (_progress_bar);
// Connections // Connections
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged) connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
@@ -210,7 +216,7 @@ namespace noggit
{ {
if (world->mapIndex.hasTile(tile_index(x + i, y + j))) if (world->mapIndex.hasTile(tile_index(x + i, y + j)))
{ {
_selected_tiles[64 * (x + i) + (y + j)] = !QApplication::keyboardModifiers().testFlag( _render_settings.selected_tiles[64 * (x + i) + (y + j)] = !QApplication::keyboardModifiers().testFlag(
Qt::ControlModifier); Qt::ControlModifier);
} }
@@ -221,7 +227,7 @@ namespace noggit
{ {
if (world->mapIndex.hasTile(tile_index(tile.x(), tile.y()))) if (world->mapIndex.hasTile(tile_index(tile.x(), tile.y())))
{ {
_selected_tiles[64 * tile.x() + tile.y()] = !QApplication::keyboardModifiers().testFlag( _render_settings.selected_tiles[64 * tile.x() + tile.y()] = !QApplication::keyboardModifiers().testFlag(
Qt::ControlModifier); Qt::ControlModifier);
} }
} }

View File

@@ -4,9 +4,9 @@
#include <QLabel> #include <QLabel>
#include <QWidget> #include <QWidget>
#include <QSettings>
#include <QtWidgets/QDoubleSpinBox>
#include <QtWidgets/QSlider> #include <QtWidgets/QSlider>
#include <QDoubleSpinBox>
#include <QProgressBar>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <string> #include <string>
@@ -43,6 +43,7 @@ struct MinimapRenderSettings
std::vector<uint32_t> m2_instance_filter_include; // include specific M2 instances std::vector<uint32_t> m2_instance_filter_include; // include specific M2 instances
std::vector<std::string> wmo_model_filter_exclude; // exclude WMOs by filename std::vector<std::string> wmo_model_filter_exclude; // exclude WMOs by filename
std::vector<uint32_t> wmo_instance_filter_exclude; // exclude specific WMO instances std::vector<uint32_t> wmo_instance_filter_exclude; // exclude specific WMO instances
std::array<bool, 4096> selected_tiles = {false};
}; };
@@ -60,21 +61,22 @@ namespace noggit
float brushRadius() const { return _radius; } float brushRadius() const { return _radius; }
std::array<bool, 4096>* getSelectedTiles() { return &_selected_tiles; }; std::array<bool, 4096>* getSelectedTiles() { return &_render_settings.selected_tiles; };
MinimapRenderSettings* getMinimapRenderSettings() { return &_render_settings; }; MinimapRenderSettings* getMinimapRenderSettings() { return &_render_settings; };
QSize sizeHint() const override; QSize sizeHint() const override;
void wheelEvent(QWheelEvent* event) override; void wheelEvent(QWheelEvent* event) override;
void progressUpdate(int value) { _progress_bar->setValue(value); };
private: private:
float _radius = 0.01f; float _radius = 0.01f;
MinimapRenderSettings _render_settings; MinimapRenderSettings _render_settings;
QSlider* _radius_slider; QSlider* _radius_slider;
QDoubleSpinBox* _radius_spin; QDoubleSpinBox* _radius_spin;
minimap_widget* _minimap_widget; minimap_widget* _minimap_widget;
QProgressBar* _progress_bar;
std::array<bool, 4096> _selected_tiles = {false};
}; };
} }