- more reloadable settings
- implement loading radius, default to 2 8051842364
This commit is contained in:
@@ -6014,12 +6014,19 @@ void MapView::onSettingsSave()
|
|||||||
params->wireframe_color = wireframe_color;
|
params->wireframe_color = wireframe_color;
|
||||||
|
|
||||||
_world->renderer()->markTerrainParamsUniformBlockDirty();
|
_world->renderer()->markTerrainParamsUniformBlockDirty();
|
||||||
|
|
||||||
|
_world->renderer()->setViewDistance(_settings->value("view_distance", 1000.f).toFloat());
|
||||||
|
|
||||||
|
_world.get()->mapIndex.setLoadingRadius(_settings->value("loading_radius", 2).toInt());
|
||||||
|
_world.get()->mapIndex.setUnloadDistance(_settings->value("unload_dist", 5).toInt());
|
||||||
|
_world.get()->mapIndex.setUnloadInterval(_settings->value("unload_interval", 30).toInt());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::ShowContextMenu(QPoint pos)
|
void MapView::ShowContextMenu(QPoint pos)
|
||||||
{
|
{
|
||||||
// QApplication::startDragDistance() is 10
|
// QApplication::startDragDistance() is 10
|
||||||
auto mouse_moved = QApplication::startDragDistance() / 3 < (_right_click_pos - pos).manhattanLength();
|
auto mouse_moved = (QApplication::startDragDistance() / 5) < (_right_click_pos - pos).manhattanLength();
|
||||||
|
|
||||||
// don't show context menu if dragging mouse
|
// don't show context menu if dragging mouse
|
||||||
if (mouse_moved || ImGuizmo::IsUsing())
|
if (mouse_moved || ImGuizmo::IsUsing())
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ MapIndex::MapIndex (const std::string &pBasename, int map_id, World* world,
|
|||||||
, _last_unload_time((clock() / CLOCKS_PER_SEC)) // to not try to unload right away
|
, _last_unload_time((clock() / CLOCKS_PER_SEC)) // to not try to unload right away
|
||||||
, mBigAlpha(false)
|
, mBigAlpha(false)
|
||||||
, mHasAGlobalWMO(false)
|
, mHasAGlobalWMO(false)
|
||||||
, noadt(false)
|
|
||||||
, changed(false)
|
, changed(false)
|
||||||
, _sort_models_by_size_class(false)
|
, _sort_models_by_size_class(false)
|
||||||
, highestGUID(0)
|
, highestGUID(0)
|
||||||
@@ -41,8 +40,9 @@ MapIndex::MapIndex (const std::string &pBasename, int map_id, World* world,
|
|||||||
{
|
{
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
_unload_interval = settings.value("unload_interval", 5).toInt();
|
_unload_interval = settings.value("unload_interval", 30).toInt();
|
||||||
_unload_dist = settings.value("unload_dist", 5).toInt();
|
_unload_dist = settings.value("unload_dist", 5).toInt();
|
||||||
|
_loading_radius = settings.value("loading_radius", 2).toInt();
|
||||||
|
|
||||||
if (create_empty)
|
if (create_empty)
|
||||||
{
|
{
|
||||||
@@ -277,17 +277,15 @@ void MapIndex::enterTile(const TileIndex& tile)
|
|||||||
{
|
{
|
||||||
if (!hasTile(tile))
|
if (!hasTile(tile))
|
||||||
{
|
{
|
||||||
noadt = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
noadt = false;
|
|
||||||
int cx = static_cast<int>(tile.x);
|
int cx = static_cast<int>(tile.x);
|
||||||
int cz = static_cast<int>(tile.z);
|
int cz = static_cast<int>(tile.z);
|
||||||
|
|
||||||
for (int pz = std::max(cz - 1, 0); pz < std::min(cz + 2, 63); ++pz)
|
for (int pz = std::max(cz - _loading_radius, 0); pz <= std::min(cz + _loading_radius, 63); ++pz)
|
||||||
{
|
{
|
||||||
for (int px = std::max(cx - 1, 0); px < std::min(cx + 2, 63); ++px)
|
for (int px = std::max(cx - _loading_radius, 0); px <= std::min(cx + _loading_radius, 63); ++px)
|
||||||
{
|
{
|
||||||
loadTile(TileIndex(px, pz));
|
loadTile(TileIndex(px, pz));
|
||||||
}
|
}
|
||||||
@@ -552,16 +550,6 @@ bool MapIndex::tileLoaded(const TileIndex& tile) const
|
|||||||
return hasTile(tile) && mTiles[tile.z][tile.x].tile && mTiles[tile.z][tile.x].tile->finishedLoading();
|
return hasTile(tile) && mTiles[tile.z][tile.x].tile && mTiles[tile.z][tile.x].tile->finishedLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MapIndex::hasAdt()
|
|
||||||
{
|
|
||||||
return noadt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapIndex::setAdt(bool value)
|
|
||||||
{
|
|
||||||
noadt = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
MapTile* MapIndex::getTile(const TileIndex& tile) const
|
MapTile* MapIndex::getTile(const TileIndex& tile) const
|
||||||
{
|
{
|
||||||
return (tile.is_valid() ? mTiles[tile.z][tile.x].tile.get() : nullptr);
|
return (tile.is_valid() ? mTiles[tile.z][tile.x].tile.get() : nullptr);
|
||||||
|
|||||||
@@ -218,9 +218,6 @@ public:
|
|||||||
bool tileAwaitingLoading(const TileIndex& tile) const;
|
bool tileAwaitingLoading(const TileIndex& tile) const;
|
||||||
bool tileLoaded(const TileIndex& tile) const;
|
bool tileLoaded(const TileIndex& tile) const;
|
||||||
|
|
||||||
bool hasAdt();
|
|
||||||
void setAdt(bool value);
|
|
||||||
|
|
||||||
void save();
|
void save();
|
||||||
void saveall (World*);
|
void saveall (World*);
|
||||||
|
|
||||||
@@ -275,17 +272,32 @@ public:
|
|||||||
std::unordered_map<std::string, std::unordered_map<std::string, std::string>> _minimap_md5translate;
|
std::unordered_map<std::string, std::unordered_map<std::string, std::string>> _minimap_md5translate;
|
||||||
std::string globalWMOName;
|
std::string globalWMOName;
|
||||||
ENTRY_MODF wmoEntry;
|
ENTRY_MODF wmoEntry;
|
||||||
|
public:
|
||||||
|
// reloadable settings
|
||||||
|
void setLoadingRadius(int value)
|
||||||
|
{
|
||||||
|
if (value < _unload_dist)
|
||||||
|
_loading_radius = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setUnloadDistance(int value)
|
||||||
|
{
|
||||||
|
if (value > _loading_radius)
|
||||||
|
_unload_dist = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setUnloadInterval(int value) { _unload_interval = value; };
|
||||||
private:
|
private:
|
||||||
int _last_unload_time;
|
int _last_unload_time;
|
||||||
int _unload_interval;
|
int _unload_interval;
|
||||||
int _unload_dist;
|
int _unload_dist;
|
||||||
|
int _loading_radius;
|
||||||
unsigned _n_loaded_tiles = 0; // to be loaded, not necessarily already loaded
|
unsigned _n_loaded_tiles = 0; // to be loaded, not necessarily already loaded
|
||||||
int _n_existing_tiles = -1;
|
int _n_existing_tiles = -1;
|
||||||
|
|
||||||
// Is the WDT telling us to use a different alphamap structure.
|
// Is the WDT telling us to use a different alphamap structure.
|
||||||
bool mBigAlpha;
|
bool mBigAlpha;
|
||||||
bool mHasAGlobalWMO;
|
bool mHasAGlobalWMO;
|
||||||
bool noadt;
|
|
||||||
bool changed;
|
bool changed;
|
||||||
|
|
||||||
bool _sort_models_by_size_class;
|
bool _sort_models_by_size_class;
|
||||||
|
|||||||
@@ -1078,7 +1078,6 @@ void WorldRender::draw (glm::mat4x4 const& model_view
|
|||||||
void WorldRender::upload()
|
void WorldRender::upload()
|
||||||
{
|
{
|
||||||
ZoneScoped;
|
ZoneScoped;
|
||||||
_world->mapIndex.setAdt(false);
|
|
||||||
|
|
||||||
if (_world->mapIndex.hasAGlobalWMO())
|
if (_world->mapIndex.hasAGlobalWMO())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ namespace Noggit::Rendering
|
|||||||
|
|
||||||
[[nodiscard]] std::unique_ptr<Skies>& skies() { return _skies; };
|
[[nodiscard]] std::unique_ptr<Skies>& skies() { return _skies; };
|
||||||
|
|
||||||
|
void setViewDistance(float distance) { _view_distance = distance; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void drawMinimap ( MapTile *tile
|
void drawMinimap ( MapTile *tile
|
||||||
|
|||||||
@@ -147,6 +147,20 @@ namespace Noggit
|
|||||||
QString(tr("FPS limitation, current : %1")).arg(value));
|
QString(tr("FPS limitation, current : %1")).arg(value));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(ui->_adt_unload_dist, qOverload<int>(&QSpinBox::valueChanged)
|
||||||
|
, [&](int v)
|
||||||
|
{
|
||||||
|
QSignalBlocker const blocker(ui->_adt_loading_radius);
|
||||||
|
ui->_adt_loading_radius->setMaximum(v - 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->_adt_loading_radius, qOverload<int>(&QSpinBox::valueChanged)
|
||||||
|
, [&](int v)
|
||||||
|
{
|
||||||
|
QSignalBlocker const blocker(ui->_adt_unload_dist);
|
||||||
|
ui->_adt_unload_dist->setMinimum(v + 1);
|
||||||
|
});
|
||||||
|
|
||||||
ui->_wireframe_color->setColor(Qt::white);
|
ui->_wireframe_color->setColor(Qt::white);
|
||||||
|
|
||||||
connect(ui->saveButton, &QPushButton::clicked, [this]
|
connect(ui->saveButton, &QPushButton::clicked, [this]
|
||||||
@@ -174,6 +188,9 @@ namespace Noggit
|
|||||||
|
|
||||||
// load the values in the fields
|
// load the values in the fields
|
||||||
discard_changes();
|
discard_changes();
|
||||||
|
|
||||||
|
// ui->_adt_loading_radius->setMaximum(ui->_adt_unload_dist->value() - 1);
|
||||||
|
// ui->_adt_unload_dist->setMinimum(ui->_adt_loading_radius->value() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings::discard_changes()
|
void settings::discard_changes()
|
||||||
@@ -192,7 +209,8 @@ namespace Noggit
|
|||||||
ui->_background_fps_limit_cb->setChecked(_settings->value("background_fps_limit", true).toBool());
|
ui->_background_fps_limit_cb->setChecked(_settings->value("background_fps_limit", true).toBool());
|
||||||
ui->_directional_light_cb->setChecked(_settings->value("directional_lightning", true).toBool());
|
ui->_directional_light_cb->setChecked(_settings->value("directional_lightning", true).toBool());
|
||||||
ui->_adt_unload_dist->setValue(_settings->value("unload_dist", 5).toInt());
|
ui->_adt_unload_dist->setValue(_settings->value("unload_dist", 5).toInt());
|
||||||
ui->_adt_unload_check_interval->setValue(_settings->value("unload_interval", 5).toInt());
|
ui->_adt_unload_check_interval->setValue(_settings->value("unload_interval", 30).toInt());
|
||||||
|
ui->_adt_loading_radius->setValue(_settings->value("loading_radius", 2).toInt());
|
||||||
ui->_uid_cb->setChecked(_settings->value("uid_startup_check", true).toBool());
|
ui->_uid_cb->setChecked(_settings->value("uid_startup_check", true).toBool());
|
||||||
ui->_load_fav_cb->setChecked(_settings->value("auto_load_fav_project", true).toBool());
|
ui->_load_fav_cb->setChecked(_settings->value("auto_load_fav_project", true).toBool());
|
||||||
ui->_systemWindowFrame->setChecked(_settings->value("systemWindowFrame", true).toBool());
|
ui->_systemWindowFrame->setChecked(_settings->value("systemWindowFrame", true).toBool());
|
||||||
@@ -279,6 +297,7 @@ namespace Noggit
|
|||||||
_settings->setValue("directional_lightning", ui->_directional_light_cb->isChecked());
|
_settings->setValue("directional_lightning", ui->_directional_light_cb->isChecked());
|
||||||
_settings->setValue("unload_dist", ui->_adt_unload_dist->value());
|
_settings->setValue("unload_dist", ui->_adt_unload_dist->value());
|
||||||
_settings->setValue("unload_interval", ui->_adt_unload_check_interval->value());
|
_settings->setValue("unload_interval", ui->_adt_unload_check_interval->value());
|
||||||
|
_settings->setValue("loading_radius", ui->_adt_loading_radius->value());
|
||||||
_settings->setValue("uid_startup_check", ui->_uid_cb->isChecked());
|
_settings->setValue("uid_startup_check", ui->_uid_cb->isChecked());
|
||||||
_settings->setValue("auto_load_fav_project", ui->_load_fav_cb->isChecked());
|
_settings->setValue("auto_load_fav_project", ui->_load_fav_cb->isChecked());
|
||||||
_settings->setValue("additional_file_loading_log", ui->_additional_file_loading_log->isChecked());
|
_settings->setValue("additional_file_loading_log", ui->_additional_file_loading_log->isChecked());
|
||||||
|
|||||||
@@ -414,13 +414,13 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="_adt_unload_dist">
|
<widget class="QSpinBox" name="_adt_unload_dist">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>64</number>
|
<number>64</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>2</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -447,6 +447,43 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_22">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_15">
|
||||||
|
<property name="text">
|
||||||
|
<string>Adt loading radius</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_26">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="_adt_loading_radius">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>64</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@@ -526,7 +563,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_11">
|
<widget class="QLabel" name="label_11">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>180</string>
|
<string>240</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user