Update MapView.cpp, MapView.h, and 8 more files...
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
#include <noggit/ui/tools/UiCommon/ImageBrowser.hpp>
|
||||
#include <noggit/ui/tools/BrushStack/BrushStack.hpp>
|
||||
#include <noggit/ui/tools/LightEditor/LightEditor.hpp>
|
||||
#include <noggit/ui/tools/ChunkManipulator/ChunkManipulator.hpp>
|
||||
#include <noggit/ui/tools/ChunkManipulator/ChunkManipulatorPanel.hpp>
|
||||
#include <external/imguipiemenu/PieMenu.hpp>
|
||||
#include <external/tracy/Tracy.hpp>
|
||||
#include <noggit/ui/object_palette.hpp>
|
||||
@@ -838,7 +838,7 @@ void MapView::setupLightEditorUi()
|
||||
|
||||
void MapView::setupChunkManipulatorUi()
|
||||
{
|
||||
_chunk_manipulator = new Noggit::Ui::Tools::ChunkManipulator(this, this);
|
||||
_chunk_manipulator = new Noggit::Ui::Tools::ChunkManipulator::ChunkManipulatorPanel(this, this);
|
||||
_tool_panel_dock->registerTool("Chunk Manipulator", _chunk_manipulator);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,11 @@ namespace Noggit
|
||||
{
|
||||
class BrushStack;
|
||||
class LightEditor;
|
||||
class ChunkManipulator;
|
||||
|
||||
namespace ChunkManipulator
|
||||
{
|
||||
class ChunkManipulatorPanel;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Scripting
|
||||
@@ -394,7 +398,7 @@ private:
|
||||
Noggit::Ui::MinimapCreator* minimapTool;
|
||||
Noggit::Ui::Tools::BrushStack* stampTool;
|
||||
Noggit::Ui::Tools::LightEditor* lightEditor;
|
||||
Noggit::Ui::Tools::ChunkManipulator* _chunk_manipulator;
|
||||
Noggit::Ui::Tools::ChunkManipulator::ChunkManipulatorPanel* _chunk_manipulator;
|
||||
Noggit::Scripting::scripting_tool* scriptingTool;
|
||||
|
||||
OpenGL::texture* const _texBrush;
|
||||
|
||||
@@ -13,6 +13,11 @@ struct TileIndex
|
||||
return std::tie (lhs.x, lhs.z) == std::tie (rhs.x, rhs.z);
|
||||
}
|
||||
|
||||
friend bool operator< (TileIndex const& lhs, TileIndex const& rhs)
|
||||
{
|
||||
return std::tie (lhs.x, lhs.z) < std::tie (rhs.x, rhs.z);
|
||||
}
|
||||
|
||||
bool is_valid() const
|
||||
{
|
||||
// x and z are unsigned so negative signed int value are positive and > 63
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <noggit/Alphamap.hpp>
|
||||
#include <noggit/MapHeaders.h>
|
||||
#include <noggit/ContextObject.hpp>
|
||||
#include <noggit/TextureManager.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "ChunkClipboard.hpp"
|
||||
#include <noggit/World.h>
|
||||
#include <noggit/World.inl>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -23,19 +24,22 @@ void ChunkClipboard::selectRange(glm::vec3 const& cursor_pos, float radius, Chun
|
||||
{
|
||||
case ChunkSelectionMode::SELECT:
|
||||
{
|
||||
_world->for_all_chunks_in_range(cursor_pos, radius, [this](MapChunk* chunk)
|
||||
_world->for_all_chunks_in_range(cursor_pos, radius, [this](MapChunk* chunk) -> bool
|
||||
{
|
||||
_selected_chunks.emplace(SelectedChunkIndex{TileIndex{glm::vec3{chunk->xbase, 0.f, chunk->zbase}},
|
||||
static_cast<unsigned>(chunk->px), static_cast<unsigned>(chunk->py)});
|
||||
});
|
||||
return true;
|
||||
}
|
||||
);
|
||||
break;
|
||||
}
|
||||
case ChunkSelectionMode::DESELECT:
|
||||
{
|
||||
_world->for_all_chunks_in_range(cursor_pos, radius, [this](MapChunk* chunk)
|
||||
_world->for_all_chunks_in_range(cursor_pos, radius, [this](MapChunk* chunk) -> bool
|
||||
{
|
||||
_selected_chunks.erase(SelectedChunkIndex{TileIndex{glm::vec3{chunk->xbase, 0.f, chunk->zbase}},
|
||||
static_cast<unsigned>(chunk->px), static_cast<unsigned>(chunk->py)});
|
||||
return true;
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -52,19 +56,21 @@ void ChunkClipboard::selectChunk(glm::vec3 const& pos, ChunkSelectionMode mode)
|
||||
{
|
||||
case ChunkSelectionMode::SELECT:
|
||||
{
|
||||
_world->for_chunk_at(pos, [this](MapChunk* chunk)
|
||||
_world->for_chunk_at(pos, [this](MapChunk* chunk) -> bool
|
||||
{
|
||||
_selected_chunks.emplace(SelectedChunkIndex{TileIndex{glm::vec3{chunk->xbase, 0.f, chunk->zbase}},
|
||||
static_cast<unsigned>(chunk->px), static_cast<unsigned>(chunk->py)});
|
||||
return true;
|
||||
});
|
||||
break;
|
||||
}
|
||||
case ChunkSelectionMode::DESELECT:
|
||||
{
|
||||
_world->for_chunk_at(pos, [this](MapChunk* chunk)
|
||||
_world->for_chunk_at(pos, [this](MapChunk* chunk) -> bool
|
||||
{
|
||||
_selected_chunks.erase(SelectedChunkIndex{TileIndex{glm::vec3{chunk->xbase, 0.f, chunk->zbase}},
|
||||
static_cast<unsigned>(chunk->px), static_cast<unsigned>(chunk->py)});
|
||||
return true;
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <tuple>
|
||||
|
||||
#include <noggit/TileIndex.hpp>
|
||||
#include <noggit/Alphamap.hpp>
|
||||
@@ -81,7 +82,12 @@ namespace Noggit::Ui::Tools::ChunkManipulator
|
||||
unsigned x;
|
||||
unsigned z;
|
||||
|
||||
SelectedChunkIndex(TileIndex tile_index_, unsigned x_, unsigned z_) : tile_index(tile_index_), x(x_), z(z_) {}
|
||||
SelectedChunkIndex(TileIndex tile_index_, unsigned x_, unsigned z_) : tile_index(tile_index_), x(x_), z(z_) {};
|
||||
|
||||
friend bool operator<(SelectedChunkIndex const& lhs, SelectedChunkIndex const& rhs)
|
||||
{
|
||||
return std::tie(lhs.tile_index, lhs.x, lhs.z) < std::tie(rhs.tile_index, rhs.x, rhs.z);
|
||||
}
|
||||
};
|
||||
|
||||
struct ChunkCache
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
#include "ChunkManipulator.hpp"
|
||||
|
||||
using namespace Noggit::Ui::Tools;
|
||||
|
||||
ChunkManipulator::ChunkManipulator(MapView* map_view, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, _map_view(map_view)
|
||||
{
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
|
||||
#ifndef NOGGIT_CHUNKMANIPULATOR_HPP
|
||||
#define NOGGIT_CHUNKMANIPULATOR_HPP
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class MapView;
|
||||
|
||||
namespace Noggit::Ui::Tools
|
||||
{
|
||||
class ChunkManipulator : public QWidget
|
||||
{
|
||||
public:
|
||||
ChunkManipulator(MapView* map_view, QWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
MapView* _map_view;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //NOGGIT_CHUNKMANIPULATOR_HPP
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
#include "ChunkManipulatorPanel.hpp"
|
||||
|
||||
using namespace Noggit::Ui::Tools::ChunkManipulator;
|
||||
|
||||
ChunkManipulatorPanel::ChunkManipulatorPanel(MapView* map_view, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, _map_view(map_view)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
|
||||
#ifndef NOGGIT_CHUNKMANIPULATORPANEL_HPP
|
||||
#define NOGGIT_CHUNKMANIPULATORPANEL_HPP
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class MapView;
|
||||
|
||||
namespace Noggit::Ui::Tools::ChunkManipulator
|
||||
{
|
||||
class ChunkManipulatorPanel : public QWidget
|
||||
{
|
||||
public:
|
||||
ChunkManipulatorPanel(MapView* map_view, QWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
MapView* _map_view;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //NOGGIT_CHUNKMANIPULATORPANEL_HPP
|
||||
Reference in New Issue
Block a user