texture replace tool : fix ui bug and net setting to replace entire tile

This commit is contained in:
T1ti
2024-05-07 06:51:12 +02:00
parent 999a572b07
commit 3d0e3471f4
8 changed files with 33 additions and 17 deletions

View File

@@ -112,7 +112,7 @@ public:
protected:
bool _need_recalc_extents = true;
bool _need_gpu_transform_update = true;
std::uint32_t _gpu_transform_uid;
std::uint32_t _gpu_transform_uid = 0;
};

View File

@@ -73,7 +73,7 @@ public:
std::string mWmoFilename;
ENTRY_MODF mWmoEntry;
unsigned int getMapID();
unsigned int getMapID() const;
// Time of the day.
float animtime;
@@ -180,7 +180,7 @@ public:
bool GetVertex(float x, float z, glm::vec3 *V) const;
// check if the cursor is under map or in an unloaded tile
bool isUnderMap(glm::vec3 const& pos);
bool isUnderMap(glm::vec3 const& pos) const;
template<typename Fun>
bool for_all_chunks_in_range ( glm::vec3 const& pos
@@ -236,7 +236,7 @@ public:
bool paintTexture(glm::vec3 const& pos, Brush *brush, float strength, float pressure, scoped_blp_texture_reference texture);
bool stampTexture(glm::vec3 const& pos, Brush *brush, float strength, float pressure, scoped_blp_texture_reference texture, QImage* img, bool paint);
bool sprayTexture(glm::vec3 const& pos, Brush *brush, float strength, float pressure, float spraySize, float sprayPressure, scoped_blp_texture_reference texture);
bool replaceTexture(glm::vec3 const& pos, float radius, scoped_blp_texture_reference const& old_texture, scoped_blp_texture_reference new_texture, bool entire_chunk = false);
bool replaceTexture(glm::vec3 const& pos, float radius, scoped_blp_texture_reference const& old_texture, scoped_blp_texture_reference new_texture, bool entire_chunk = false, bool entire_tile = false);
void eraseTextures(glm::vec3 const& pos);
void overwriteTextureAtCurrentChunk(glm::vec3 const& pos, scoped_blp_texture_reference const& oldTexture, scoped_blp_texture_reference newTexture);
@@ -428,10 +428,10 @@ protected:
Noggit::Rendering::WorldRender _renderer;
// Debug metrics
unsigned _n_loaded_tiles;
unsigned _n_rendered_tiles;
unsigned _n_loaded_tiles = 0;
unsigned _n_rendered_tiles = 0;;
// unsigned _n_loaded_objects; // done from instance storage size currently
unsigned _n_rendered_objects;
unsigned _n_rendered_objects = 0;
};

View File

@@ -39,7 +39,7 @@ private:
bool onDisc;
MapTileEntry() : flags(0), tile(nullptr) {}
MapTileEntry() : flags(0), tile(nullptr), onDisc(false) {}
friend class MapIndex;
};

View File

@@ -283,6 +283,8 @@ namespace Noggit::Project
project->ClientDatabase = std::make_shared<BlizzardDatabaseLib::BlizzardDatabase>(dbd_file_directory, client_build);
Log << "Loading Client Path : " << project->ClientPath << std::endl;
try
{
project->ClientData = std::make_shared<BlizzardArchive::ClientData>(

View File

@@ -869,7 +869,7 @@ bool TextureSet::replace_texture( float xbase
{
float dist = misc::getShortestDist(x, z, xbase, zbase, CHUNKSIZE);
if (dist > radius)
if (!entire_chunk && dist > radius)
{
return false;
}

View File

@@ -46,27 +46,35 @@ namespace Noggit
layout->addRow(swap_global);
layout->addRow(remove_text_adt);
_brush_mode_group = new QGroupBox("Brush mode", this);
auto brush_widget (new QWidget(this));
auto brush_layout (new QFormLayout(brush_widget));
_brush_mode_group = new QGroupBox("Brush mode", brush_widget);
// _brush_mode_group->setAlignment(Qt::AlignLeft);
_brush_mode_group->setCheckable(true);
_brush_mode_group->setChecked(false);
layout->addRow(_brush_mode_group);
auto brush_content (new QWidget(_brush_mode_group));
auto brush_layout (new QFormLayout(brush_content));
layout->addRow(_brush_mode_group);
_brush_mode_group->setLayout(brush_layout);
_swap_entire_chunk = new QCheckBox(brush_content);
_swap_entire_chunk = new QCheckBox(_brush_mode_group);
_swap_entire_chunk->setText(tr("Entire chunk"));
_swap_entire_chunk->setCheckState(Qt::CheckState::Unchecked);
brush_layout->addRow(_swap_entire_chunk);
_radius_spin = new QDoubleSpinBox(brush_content);
_swap_entire_tile = new QCheckBox(_brush_mode_group);
_swap_entire_tile->setText(tr("Entire tile"));
_swap_entire_tile->setCheckState(Qt::CheckState::Unchecked);
brush_layout->addRow(_swap_entire_tile);
_radius_spin = new QDoubleSpinBox(_brush_mode_group);
_radius_spin->setRange (0.f, 100.f);
_radius_spin->setDecimals (2);
_radius_spin->setValue (_radius);
brush_layout->addRow ("Radius:", _radius_spin);
_radius_slider = new QSlider (Qt::Orientation::Horizontal, brush_content);
_radius_slider = new QSlider (Qt::Orientation::Horizontal, _brush_mode_group);
_radius_slider->setRange (0, 100);
_radius_slider->setSliderPosition (_radius);
brush_layout->addRow (_radius_slider);

View File

@@ -41,6 +41,11 @@ namespace Noggit
return _swap_entire_chunk->isChecked();
}
bool entireTile() const
{
return _swap_entire_tile->isChecked();
}
void change_radius(float change);
bool brush_mode() const
@@ -67,6 +72,7 @@ namespace Noggit
QGroupBox* _brush_mode_group;
QSlider* _radius_slider;
QCheckBox* _swap_entire_chunk;
QCheckBox* _swap_entire_tile;
QDoubleSpinBox* _radius_spin;
World* _world;
};

View File

@@ -540,7 +540,7 @@ namespace Noggit
if (_texture_switcher->brush_mode())
{
std::cout << _texture_switcher->radius() << std::endl;
world->replaceTexture(pos, _texture_switcher->radius(), to_swap.value(), texture, _texture_switcher->entireChunk());
world->replaceTexture(pos, _texture_switcher->radius(), to_swap.value(), texture, _texture_switcher->entireChunk(), _texture_switcher->entireTile());
}
else
{