make all async render objects context aware!
This commit is contained in:
@@ -7,7 +7,10 @@ namespace noggit
|
||||
{
|
||||
MAP_VIEW,
|
||||
ASSET_BROWSER,
|
||||
ASSET_BROWSER_PREVIEW
|
||||
ASSET_BROWSER_PREVIEW,
|
||||
PRESET_EDITOR,
|
||||
PRESET_EDITOR_PREVIEW,
|
||||
BLP_RENDERER
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
#include <QPixmap>
|
||||
#include <QImage>
|
||||
|
||||
MapChunk::MapChunk(MapTile *maintile, MPQFile *f, bool bigAlpha, tile_mode mode, bool init_empty, int chunk_idx)
|
||||
MapChunk::MapChunk(MapTile *maintile, MPQFile *f, bool bigAlpha,
|
||||
tile_mode mode, noggit::NoggitRenderContext context, bool init_empty, int chunk_idx)
|
||||
: _mode(mode)
|
||||
, mt(maintile)
|
||||
, use_big_alphamap(bigAlpha)
|
||||
, _context(context)
|
||||
{
|
||||
|
||||
if (init_empty)
|
||||
@@ -138,7 +140,8 @@ MapChunk::MapChunk(MapTile *maintile, MPQFile *f, bool bigAlpha, tile_mode mode,
|
||||
vmax = math::vector_3d(-9999999.0f, -9999999.0f, -9999999.0f);
|
||||
}
|
||||
|
||||
texture_set = std::make_unique<TextureSet>(header, f, base, maintile, bigAlpha, !!header_flags.flags.do_not_fix_alpha_map, mode == tile_mode::uid_fix_all);
|
||||
texture_set = std::make_unique<TextureSet>(header, f, base, maintile, bigAlpha,
|
||||
!!header_flags.flags.do_not_fix_alpha_map, mode == tile_mode::uid_fix_all, _context);
|
||||
|
||||
// - MCVT ----------------------------------------------
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <noggit/WMOInstance.h>
|
||||
#include <noggit/texture_set.hpp>
|
||||
#include <noggit/tool_enums.hpp>
|
||||
#include <noggit/ContextObject.hpp>
|
||||
#include <opengl/scoped.hpp>
|
||||
#include <opengl/texture.hpp>
|
||||
#include <noggit/Misc.h>
|
||||
@@ -89,7 +90,8 @@ private:
|
||||
opengl::scoped::deferred_upload_buffers<4> lod_indices;
|
||||
|
||||
public:
|
||||
MapChunk(MapTile* mt, MPQFile* f, bool bigAlpha, tile_mode mode, bool init_empty = false, int chunk_idx = 0);
|
||||
MapChunk(MapTile* mt, MPQFile* f, bool bigAlpha, tile_mode mode, noggit::NoggitRenderContext context
|
||||
, bool init_empty = false, int chunk_idx = 0);
|
||||
|
||||
MapTile *mt;
|
||||
math::vector_3d vmin, vmax, vcenter;
|
||||
@@ -123,6 +125,9 @@ private:
|
||||
bool _need_visibility_update = true;
|
||||
boost::optional<int> _lod_level = boost::none; // none = no lod
|
||||
size_t _lod_level_indice_count = 0;
|
||||
|
||||
noggit::NoggitRenderContext _context;
|
||||
|
||||
public:
|
||||
|
||||
void draw ( math::frustum const& frustum
|
||||
|
||||
@@ -34,6 +34,7 @@ MapTile::MapTile( int pX
|
||||
, bool use_mclq_green_lava
|
||||
, bool reloading_tile
|
||||
, World* world
|
||||
, noggit::NoggitRenderContext context
|
||||
, tile_mode mode
|
||||
)
|
||||
: AsyncObject(pFilename)
|
||||
@@ -47,6 +48,7 @@ MapTile::MapTile( int pX
|
||||
, mBigAlpha(pBigAlpha)
|
||||
, _load_models(pLoadModels)
|
||||
, _world(world)
|
||||
, _context(context)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -284,14 +286,16 @@ void MapTile::finishLoading()
|
||||
|
||||
for (auto const& object : lWMOInstances)
|
||||
{
|
||||
add_model(_world->add_wmo_instance(WMOInstance(mWMOFilenames[object.nameID], &object), _tile_is_being_reloaded));
|
||||
add_model(_world->add_wmo_instance(WMOInstance(mWMOFilenames[object.nameID],
|
||||
&object, _context), _tile_is_being_reloaded));
|
||||
}
|
||||
|
||||
// - Load M2s ------------------------------------------
|
||||
|
||||
for (auto const& model : lModelInstances)
|
||||
{
|
||||
add_model(_world->add_model_instance(ModelInstance(mModelFilenames[model.nameID], &model), _tile_is_being_reloaded));
|
||||
add_model(_world->add_model_instance(ModelInstance(mModelFilenames[model.nameID],
|
||||
&model, _context), _tile_is_being_reloaded));
|
||||
}
|
||||
|
||||
_world->need_model_updates = true;
|
||||
@@ -302,7 +306,7 @@ void MapTile::finishLoading()
|
||||
for (int nextChunk = 0; nextChunk < 256; ++nextChunk)
|
||||
{
|
||||
theFile.seek(lMCNKOffsets[nextChunk]);
|
||||
mChunks[nextChunk / 16][nextChunk % 16] = std::make_unique<MapChunk> (this, &theFile, mBigAlpha, _mode);
|
||||
mChunks[nextChunk / 16][nextChunk % 16] = std::make_unique<MapChunk> (this, &theFile, mBigAlpha, _mode, _context);
|
||||
}
|
||||
|
||||
theFile.close();
|
||||
@@ -952,6 +956,6 @@ void MapTile::initEmptyChunks()
|
||||
{
|
||||
for (int nextChunk = 0; nextChunk < 256; ++nextChunk)
|
||||
{
|
||||
mChunks[nextChunk / 16][nextChunk % 16] = std::make_unique<MapChunk> (this, nullptr, mBigAlpha, _mode, true, nextChunk);
|
||||
mChunks[nextChunk / 16][nextChunk % 16] = std::make_unique<MapChunk> (this, nullptr, mBigAlpha, _mode, _context, true, nextChunk);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <noggit/tile_index.hpp>
|
||||
#include <noggit/tool_enums.hpp>
|
||||
#include <opengl/shader.fwd.hpp>
|
||||
#include <noggit/ContextObject.hpp>
|
||||
#include <noggit/Misc.h>
|
||||
|
||||
#include <map>
|
||||
@@ -36,6 +37,7 @@ public:
|
||||
, bool use_mclq_green_lava
|
||||
, bool reloading_tile
|
||||
, World*
|
||||
, noggit::NoggitRenderContext context
|
||||
, tile_mode mode = tile_mode::edit
|
||||
);
|
||||
~MapTile();
|
||||
@@ -163,6 +165,8 @@ private:
|
||||
bool _load_models;
|
||||
World* _world;
|
||||
|
||||
noggit::NoggitRenderContext _context;
|
||||
|
||||
friend class MapChunk;
|
||||
friend class TextureSet;
|
||||
};
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <noggit/Red/StampMode/Ui/PaletteMain.hpp>
|
||||
#include <noggit/Red/ViewToolbar/Ui/ViewToolbar.hpp>
|
||||
#include <noggit/Red/AssetBrowser/Ui/AssetBrowser.hpp>
|
||||
#include <noggit/Red/PresetEditor/Ui/PresetEditor.hpp>
|
||||
|
||||
#include "revision.h"
|
||||
|
||||
@@ -212,6 +213,9 @@ void MapView::createGUI()
|
||||
_asset_browser = new noggit::Red::AssetBrowser::Ui::AssetBrowserWidget(this);
|
||||
_asset_browser->show();
|
||||
|
||||
auto preset_editor = new noggit::Red::PresetEditor::Ui::PresetEditorWidget(this);
|
||||
preset_editor->show();
|
||||
|
||||
// create tool widgets
|
||||
_terrain_tool_dock = new QDockWidget("Raise / Lower", this);
|
||||
terrainTool = new noggit::ui::terrain_tool(_terrain_tool_dock);
|
||||
@@ -330,7 +334,7 @@ void MapView::createGUI()
|
||||
makeCurrent();
|
||||
opengl::context::scoped_setter const _(::gl, context());
|
||||
|
||||
noggit::ui::selected_texture::set(filename);
|
||||
noggit::ui::selected_texture::set({filename, _context});
|
||||
}
|
||||
);
|
||||
connect(texturingTool->_current_texture, &noggit::ui::current_texture::clicked
|
||||
@@ -345,7 +349,7 @@ void MapView::createGUI()
|
||||
makeCurrent();
|
||||
opengl::context::scoped_setter const _(::gl, context());
|
||||
|
||||
noggit::ui::selected_texture::set(filename);
|
||||
noggit::ui::selected_texture::set({filename, _context});
|
||||
texturingTool->_current_texture->set_texture(filename);
|
||||
}
|
||||
);
|
||||
@@ -361,7 +365,7 @@ void MapView::createGUI()
|
||||
makeCurrent();
|
||||
opengl::context::scoped_setter const _(::gl, context());
|
||||
|
||||
noggit::ui::selected_texture::set(filename);
|
||||
noggit::ui::selected_texture::set({filename, _context});
|
||||
texturingTool->_current_texture->set_texture(filename);
|
||||
}
|
||||
);
|
||||
@@ -3043,13 +3047,13 @@ void MapView::selectModel(std::string const& model)
|
||||
{
|
||||
if (boost::ends_with (model, ".m2"))
|
||||
{
|
||||
ModelInstance mi(model);
|
||||
ModelInstance mi(model, _context);
|
||||
_world->set_current_selection(boost::get<selected_model_type>(&mi));
|
||||
|
||||
}
|
||||
else if (boost::ends_with (model, ".wmo"))
|
||||
{
|
||||
WMOInstance wi(model);
|
||||
WMOInstance wi(model, _context);
|
||||
_world->set_current_selection(boost::get<selected_wmo_type>(&wi));
|
||||
}
|
||||
|
||||
|
||||
@@ -220,6 +220,8 @@ public:
|
||||
|
||||
void set_editing_mode (editing_mode);
|
||||
|
||||
noggit::NoggitRenderContext getRenderContext() { return _context; };
|
||||
|
||||
private:
|
||||
enum Modifier
|
||||
{
|
||||
@@ -340,5 +342,6 @@ private:
|
||||
|
||||
noggit::Red::AssetBrowser::Ui::AssetBrowserWidget* _asset_browser;
|
||||
|
||||
noggit::NoggitRenderContext _context = noggit::NoggitRenderContext::MAP_VIEW;
|
||||
|
||||
};
|
||||
|
||||
@@ -212,7 +212,7 @@ public:
|
||||
return std::vector<T>(start, start + count);
|
||||
}
|
||||
|
||||
Model(const std::string& name, noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW);
|
||||
Model(const std::string& name, noggit::NoggitRenderContext context );
|
||||
|
||||
void draw( math::matrix_4x4 const& model_view
|
||||
, ModelInstance& instance
|
||||
|
||||
@@ -39,12 +39,9 @@ public:
|
||||
// longest side of an AABB transformed model's bounding box from the M2 header
|
||||
float size_cat;
|
||||
|
||||
explicit ModelInstance(std::string const& filename,
|
||||
noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW);
|
||||
explicit ModelInstance(std::string const& filename, noggit::NoggitRenderContext context);
|
||||
|
||||
explicit ModelInstance(std::string const& filename,
|
||||
ENTRY_MDDF const*d,
|
||||
noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW);
|
||||
explicit ModelInstance(std::string const& filename, ENTRY_MDDF const*d, noggit::NoggitRenderContext context);
|
||||
|
||||
ModelInstance(ModelInstance const& other) = default;
|
||||
ModelInstance& operator= (ModelInstance const& other) = default;
|
||||
@@ -128,7 +125,7 @@ public:
|
||||
|
||||
explicit wmo_doodad_instance(std::string const& filename
|
||||
, MPQFile* f
|
||||
, noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW);
|
||||
, noggit::NoggitRenderContext context );
|
||||
|
||||
wmo_doodad_instance(wmo_doodad_instance const& other) = default;
|
||||
wmo_doodad_instance& operator= (wmo_doodad_instance const& other) = default;
|
||||
|
||||
@@ -29,8 +29,7 @@ private:
|
||||
struct scoped_model_reference
|
||||
{
|
||||
scoped_model_reference (
|
||||
std::string const& filename
|
||||
, noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW)
|
||||
std::string const& filename, noggit::NoggitRenderContext context)
|
||||
|
||||
: _valid(true)
|
||||
, _filename(filename)
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
using namespace noggit::Red::AssetBrowser;
|
||||
|
||||
|
||||
ModelViewer::ModelViewer(QWidget* parent)
|
||||
: PreviewRenderer(0, 0, noggit::NoggitRenderContext::ASSET_BROWSER, parent)
|
||||
ModelViewer::ModelViewer(QWidget* parent, noggit::NoggitRenderContext context)
|
||||
: PreviewRenderer(0, 0, context, parent)
|
||||
, look(false)
|
||||
, mousedir(-1.0f)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,9 @@ namespace noggit
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ModelViewer(QWidget* parent = nullptr);
|
||||
explicit ModelViewer(QWidget* parent = nullptr
|
||||
, noggit::NoggitRenderContext context = noggit::NoggitRenderContext::ASSET_BROWSER);
|
||||
|
||||
void setModel(std::string const& filename) override;
|
||||
void setMoveSensitivity(float s) { _move_sensitivity = s / 30.0f; };
|
||||
float getMoveSensitivity() { return _move_sensitivity; };
|
||||
|
||||
@@ -40,7 +40,6 @@ AssetBrowserWidget::AssetBrowserWidget(QWidget *parent)
|
||||
_sort_model->setFilterRole(Qt::UserRole);
|
||||
_sort_model->setRecursiveFilteringEnabled(true);
|
||||
|
||||
// test
|
||||
auto overlay = new QWidget(ui->viewport);
|
||||
viewport_overlay_ui = new ::Ui::AssetBrowserOverlay();
|
||||
viewport_overlay_ui->setupUi(overlay);
|
||||
@@ -131,71 +130,81 @@ AssetBrowserWidget::AssetBrowserWidget(QWidget *parent)
|
||||
|
||||
);
|
||||
|
||||
// Handle search
|
||||
setupConnectsCommon();
|
||||
|
||||
_wmo_group_and_lod_regex = QRegularExpression(".+_\\d{3}(_lod.+)*.wmo");
|
||||
|
||||
updateModelData();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void AssetBrowserWidget::setupConnectsCommon()
|
||||
{
|
||||
connect(ui->searchButton, &QPushButton::clicked
|
||||
,[this]()
|
||||
{
|
||||
_sort_model->setFilterFixedString(ui->searchField->text());
|
||||
}
|
||||
{
|
||||
_sort_model->setFilterFixedString(ui->searchField->text());
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
connect(viewport_overlay_ui->lightDirY, &QDial::valueChanged
|
||||
,[this]()
|
||||
{
|
||||
ui->viewport->setLightDirection(viewport_overlay_ui->lightDirY->value(),
|
||||
viewport_overlay_ui->lightDirZ->value());
|
||||
}
|
||||
{
|
||||
ui->viewport->setLightDirection(viewport_overlay_ui->lightDirY->value(),
|
||||
viewport_overlay_ui->lightDirZ->value());
|
||||
}
|
||||
);
|
||||
|
||||
connect(viewport_overlay_ui->lightDirZ, &QSlider::valueChanged
|
||||
,[this]()
|
||||
{
|
||||
ui->viewport->setLightDirection(viewport_overlay_ui->lightDirY->value(),
|
||||
viewport_overlay_ui->lightDirZ->value());
|
||||
}
|
||||
{
|
||||
ui->viewport->setLightDirection(viewport_overlay_ui->lightDirY->value(),
|
||||
viewport_overlay_ui->lightDirZ->value());
|
||||
}
|
||||
);
|
||||
|
||||
connect(viewport_overlay_ui->moveSensitivitySlider, &QSlider::valueChanged
|
||||
,[this]()
|
||||
{
|
||||
ui->viewport->setMoveSensitivity(static_cast<float>(viewport_overlay_ui->moveSensitivitySlider->value()));
|
||||
}
|
||||
{
|
||||
ui->viewport->setMoveSensitivity(static_cast<float>(viewport_overlay_ui->moveSensitivitySlider->value()));
|
||||
}
|
||||
);
|
||||
|
||||
connect(ui->viewport, &ModelViewer::sensitivity_changed
|
||||
,[this]()
|
||||
{
|
||||
viewport_overlay_ui->moveSensitivitySlider->setValue(ui->viewport->getMoveSensitivity() * 30.0f);
|
||||
}
|
||||
{
|
||||
viewport_overlay_ui->moveSensitivitySlider->setValue(ui->viewport->getMoveSensitivity() * 30.0f);
|
||||
}
|
||||
);
|
||||
|
||||
connect(viewport_overlay_ui->cameraXButton, &QPushButton::clicked
|
||||
,[this]()
|
||||
{
|
||||
ui->viewport->resetCamera(0.f, 0.f, 0.f, 0.f, -90.f, 0.f);
|
||||
}
|
||||
{
|
||||
ui->viewport->resetCamera(0.f, 0.f, 0.f, 0.f, -90.f, 0.f);
|
||||
}
|
||||
);
|
||||
|
||||
connect(viewport_overlay_ui->cameraYButton, &QPushButton::clicked
|
||||
,[this]()
|
||||
{
|
||||
ui->viewport->resetCamera(0.f, 0.f, 0.f, 0.f, 0, 90.f);
|
||||
}
|
||||
{
|
||||
ui->viewport->resetCamera(0.f, 0.f, 0.f, 0.f, 0, 90.f);
|
||||
}
|
||||
);
|
||||
|
||||
connect(viewport_overlay_ui->cameraZButton, &QPushButton::clicked
|
||||
,[this]()
|
||||
{
|
||||
ui->viewport->resetCamera(0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
|
||||
}
|
||||
{
|
||||
ui->viewport->resetCamera(0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
|
||||
}
|
||||
);
|
||||
|
||||
connect(viewport_overlay_ui->cameraResetButton, &QPushButton::clicked
|
||||
,[this]()
|
||||
{
|
||||
ui->viewport->resetCamera();
|
||||
}
|
||||
{
|
||||
ui->viewport->resetCamera();
|
||||
}
|
||||
);
|
||||
|
||||
connect(viewport_overlay_ui->doodadSetSelector, qOverload<int>(&QComboBox::currentIndexChanged)
|
||||
@@ -232,12 +241,6 @@ AssetBrowserWidget::AssetBrowserWidget(QWidget *parent)
|
||||
[this](bool state) {ui->viewport->_draw_animated.set(state);});
|
||||
connect(&ui->viewport->_draw_grid, &bool_toggle_property::changed,
|
||||
[this](bool state) {ui->viewport->_draw_grid.set(state);});
|
||||
|
||||
_wmo_group_and_lod_regex = QRegularExpression(".+_\\d{3}(_lod.+)*.wmo");
|
||||
|
||||
updateModelData();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Add WMOs and M2s from project directory recursively
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace noggit
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
void setupConnectsCommon();
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ void PreviewRenderer::draw()
|
||||
|
||||
if (!_liquid_render)
|
||||
{
|
||||
_liquid_render.emplace();
|
||||
_liquid_render.emplace(_context);
|
||||
}
|
||||
|
||||
gl.enable(GL_DEPTH_TEST);
|
||||
|
||||
@@ -21,7 +21,8 @@ SkyColor::SkyColor(int t, int col)
|
||||
color.x = ((col & 0xff0000) >> 16) / 255.0f;
|
||||
}
|
||||
|
||||
Sky::Sky(DBCFile::Iterator data)
|
||||
Sky::Sky(DBCFile::Iterator data, noggit::NoggitRenderContext context)
|
||||
: _context(context)
|
||||
{
|
||||
pos = math::vector_3d(data->getFloat(LightDB::PositionX) / skymul, data->getFloat(LightDB::PositionY) / skymul, data->getFloat(LightDB::PositionZ) / skymul);
|
||||
r1 = data->getFloat(LightDB::RadiusInner) / skymul;
|
||||
@@ -92,7 +93,7 @@ Sky::Sky(DBCFile::Iterator data)
|
||||
|
||||
if (skybox_id)
|
||||
{
|
||||
skybox.emplace(gLightSkyboxDB.getByID(skybox_id).getString(LightSkyboxDB::filename));
|
||||
skybox.emplace(gLightSkyboxDB.getByID(skybox_id).getString(LightSkyboxDB::filename), _context);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
@@ -164,14 +165,15 @@ const int cnum = 7;
|
||||
const int hseg = 32;
|
||||
|
||||
|
||||
Skies::Skies(unsigned int mapid)
|
||||
: stars (ModelInstance("Environments\\Stars\\Stars.mdx"))
|
||||
Skies::Skies(unsigned int mapid, noggit::NoggitRenderContext context)
|
||||
: stars (ModelInstance("Environments\\Stars\\Stars.mdx", context))
|
||||
, _context(context)
|
||||
{
|
||||
for (DBCFile::Iterator i = gLightDB.begin(); i != gLightDB.end(); ++i)
|
||||
{
|
||||
if (mapid == i->getUInt(LightDB::Map))
|
||||
{
|
||||
Sky s(i);
|
||||
Sky s(i, _context);
|
||||
skies.push_back(s);
|
||||
numSkies++;
|
||||
}
|
||||
@@ -183,7 +185,7 @@ Skies::Skies(unsigned int mapid)
|
||||
{
|
||||
if (0 == i->getUInt(LightDB::Map))
|
||||
{
|
||||
Sky s(i);
|
||||
Sky s(i, _context);
|
||||
skies.push_back(s);
|
||||
numSkies++;
|
||||
break;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <noggit/DBCFile.h>
|
||||
#include <noggit/MPQ.h>
|
||||
#include <noggit/ModelInstance.h>
|
||||
#include <noggit/ContextObject.hpp>
|
||||
#include <opengl/scoped.hpp>
|
||||
#include <opengl/shader.fwd.hpp>
|
||||
|
||||
@@ -58,7 +59,7 @@ public:
|
||||
math::vector_3d pos;
|
||||
float r1, r2;
|
||||
|
||||
explicit Sky(DBCFile::Iterator data);
|
||||
explicit Sky(DBCFile::Iterator data, noggit::NoggitRenderContext context);
|
||||
|
||||
std::vector<SkyColor> colorRows[36];
|
||||
int mmin[36];
|
||||
@@ -87,6 +88,8 @@ private:
|
||||
float _river_deep_alpha;
|
||||
float _ocean_shallow_alpha;
|
||||
float _ocean_deep_alpha;
|
||||
|
||||
noggit::NoggitRenderContext _context;
|
||||
};
|
||||
|
||||
enum SkyColorNames
|
||||
@@ -130,7 +133,7 @@ public:
|
||||
std::vector<Sky> skies;
|
||||
std::vector<math::vector_3d> color_set = std::vector<math::vector_3d>(NUM_SkyColorNames);
|
||||
|
||||
explicit Skies(unsigned int mapid);
|
||||
explicit Skies(unsigned int mapid, noggit::NoggitRenderContext context);
|
||||
|
||||
void findSkyWeights(math::vector_3d pos);
|
||||
void update_sky_colors(math::vector_3d pos, int time);
|
||||
@@ -171,4 +174,6 @@ private:
|
||||
GLuint const& _indices_vbo = _buffers[2];
|
||||
|
||||
std::unique_ptr<opengl::program> _program;
|
||||
|
||||
noggit::NoggitRenderContext _context;
|
||||
};
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace noggit
|
||||
opengl::context::scoped_setter const context_set (::gl, &_context);
|
||||
|
||||
opengl::texture::set_active_texture(0);
|
||||
blp_texture texture(blp_filename);
|
||||
blp_texture texture(blp_filename, noggit::NoggitRenderContext::BLP_RENDERER);
|
||||
texture.finishLoading();
|
||||
|
||||
width = width == -1 ? texture.width() : width;
|
||||
|
||||
@@ -26,7 +26,7 @@ struct BLPHeader;
|
||||
struct scoped_blp_texture_reference;
|
||||
struct blp_texture : public opengl::texture, AsyncObject
|
||||
{
|
||||
blp_texture (std::string const& filename, noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW);
|
||||
blp_texture (std::string const& filename, noggit::NoggitRenderContext context);
|
||||
void finishLoading();
|
||||
|
||||
void loadFromUncompressedData(BLPHeader const* lHeader, char const* lData);
|
||||
@@ -72,8 +72,7 @@ private:
|
||||
struct scoped_blp_texture_reference
|
||||
{
|
||||
scoped_blp_texture_reference() = delete;
|
||||
scoped_blp_texture_reference (std::string const& filename,
|
||||
noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW);
|
||||
scoped_blp_texture_reference (std::string const& filename, noggit::NoggitRenderContext context);
|
||||
scoped_blp_texture_reference (scoped_blp_texture_reference const& other);
|
||||
scoped_blp_texture_reference (scoped_blp_texture_reference&&) = default;
|
||||
scoped_blp_texture_reference& operator= (scoped_blp_texture_reference const&) = delete;
|
||||
|
||||
@@ -436,7 +436,7 @@ bool WMO::draw_skybox ( math::matrix_4x4 const& model_view
|
||||
|
||||
if (camera_pos.is_inside_of(extent.first, extent.second))
|
||||
{
|
||||
ModelInstance sky(skybox.get()->filename);
|
||||
ModelInstance sky(skybox.get()->filename, _context);
|
||||
sky.pos = camera_pos;
|
||||
sky.scale = 2.f;
|
||||
sky.recalcExtents();
|
||||
|
||||
@@ -250,7 +250,7 @@ static_assert ( sizeof (mohd_flags) == sizeof (std::uint16_t)
|
||||
class WMO : public AsyncObject
|
||||
{
|
||||
public:
|
||||
explicit WMO(const std::string& name, noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW);
|
||||
explicit WMO(const std::string& name, noggit::NoggitRenderContext context );
|
||||
|
||||
void draw ( opengl::scoped::use_program& wmo_shader
|
||||
, math::matrix_4x4 const& model_view
|
||||
@@ -337,8 +337,7 @@ private:
|
||||
|
||||
struct scoped_wmo_reference
|
||||
{
|
||||
scoped_wmo_reference (std::string const& filename
|
||||
, noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW)
|
||||
scoped_wmo_reference (std::string const& filename, noggit::NoggitRenderContext context)
|
||||
: _valid(true)
|
||||
, _filename(filename)
|
||||
, _context(context)
|
||||
|
||||
@@ -43,11 +43,9 @@ private:
|
||||
math::matrix_4x4 _transform_mat_transposed = math::matrix_4x4::uninitialized;
|
||||
|
||||
public:
|
||||
WMOInstance(std::string const& filename, ENTRY_MODF const* d
|
||||
, noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW);
|
||||
WMOInstance(std::string const& filename, ENTRY_MODF const* d, noggit::NoggitRenderContext context);
|
||||
|
||||
explicit WMOInstance(std::string const& filename
|
||||
, noggit::NoggitRenderContext context = noggit::NoggitRenderContext::MAP_VIEW);
|
||||
explicit WMOInstance(std::string const& filename, noggit::NoggitRenderContext context);
|
||||
|
||||
WMOInstance(WMOInstance const& other) = default;
|
||||
WMOInstance& operator=(WMOInstance const& other) = default;
|
||||
|
||||
@@ -96,10 +96,10 @@ bool World::IsEditableWorld(int pMapId)
|
||||
return false;
|
||||
}
|
||||
|
||||
World::World(const std::string& name, int map_id, bool create_empty)
|
||||
World::World(const std::string& name, int map_id, noggit::NoggitRenderContext context, bool create_empty)
|
||||
: _model_instance_storage(this)
|
||||
, _tile_update_queue(this)
|
||||
, mapIndex (name, map_id, this, create_empty)
|
||||
, mapIndex (name, map_id, this, context, create_empty)
|
||||
, horizon(name, &mapIndex)
|
||||
, mWmoFilename("")
|
||||
, mWmoEntry(ENTRY_MODF())
|
||||
@@ -116,6 +116,7 @@ World::World(const std::string& name, int map_id, bool create_empty)
|
||||
, _current_selection()
|
||||
, _settings (new QSettings())
|
||||
, _view_distance(_settings->value ("view_distance", 1000.f).toFloat())
|
||||
, _context(context)
|
||||
{
|
||||
LogDebug << "Loading world \"" << name << "\"." << std::endl;
|
||||
}
|
||||
@@ -626,7 +627,7 @@ void World::initDisplay()
|
||||
|
||||
if (mapIndex.hasAGlobalWMO())
|
||||
{
|
||||
WMOInstance inst(mWmoFilename, &mWmoEntry);
|
||||
WMOInstance inst(mWmoFilename, &mWmoEntry, _context);
|
||||
|
||||
_model_instance_storage.add_wmo_instance(std::move(inst), false);
|
||||
}
|
||||
@@ -635,7 +636,7 @@ void World::initDisplay()
|
||||
_horizon_render = std::make_unique<noggit::map_horizon::render>(horizon);
|
||||
}
|
||||
|
||||
skies = std::make_unique<Skies> (mapIndex._map_id);
|
||||
skies = std::make_unique<Skies> (mapIndex._map_id, _context);
|
||||
|
||||
ol = std::make_unique<OutdoorLighting> ("World\\dnc.db");
|
||||
}
|
||||
@@ -755,7 +756,7 @@ void World::draw ( math::matrix_4x4 const& model_view
|
||||
}
|
||||
if (!_liquid_render)
|
||||
{
|
||||
_liquid_render.emplace();
|
||||
_liquid_render.emplace(_context);
|
||||
}
|
||||
if (!_wmo_program)
|
||||
{
|
||||
@@ -1813,7 +1814,7 @@ void World::drawMinimap ( MapTile *tile
|
||||
|
||||
if (!_liquid_render_mini)
|
||||
{
|
||||
_liquid_render_mini.emplace();
|
||||
_liquid_render_mini.emplace(_context);
|
||||
}
|
||||
if (!_wmo_program_mini)
|
||||
{
|
||||
@@ -2296,7 +2297,7 @@ void World::addM2 ( std::string const& filename
|
||||
, noggit::object_paste_params* paste_params
|
||||
)
|
||||
{
|
||||
ModelInstance model_instance = ModelInstance(filename);
|
||||
ModelInstance model_instance = ModelInstance(filename, _context);
|
||||
|
||||
model_instance.uid = mapIndex.newGUID();
|
||||
model_instance.pos = newPos;
|
||||
@@ -2339,7 +2340,7 @@ void World::addWMO ( std::string const& filename
|
||||
, math::vector_3d rotation
|
||||
)
|
||||
{
|
||||
WMOInstance wmo_instance(filename);
|
||||
WMOInstance wmo_instance(filename, _context);
|
||||
|
||||
wmo_instance.mUniqueID = mapIndex.newGUID();
|
||||
wmo_instance.pos = newPos;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <noggit/world_tile_update_queue.hpp>
|
||||
#include <noggit/world_model_instances_storage.hpp>
|
||||
#include <noggit/ui/MinimapCreator.hpp>
|
||||
#include <noggit/ContextObject.hpp>
|
||||
#include <opengl/primitives.hpp>
|
||||
#include <opengl/shader.fwd.hpp>
|
||||
|
||||
@@ -85,7 +86,7 @@ public:
|
||||
|
||||
OutdoorLightStats outdoorLightStats;
|
||||
|
||||
explicit World(const std::string& name, int map_id, bool create_empty = false);
|
||||
explicit World(const std::string& name, int map_id, noggit::NoggitRenderContext context, bool create_empty = false);
|
||||
|
||||
void setBasename(const std::string& name);
|
||||
|
||||
@@ -137,6 +138,8 @@ public:
|
||||
unsigned int getAreaID (math::vector_3d const&);
|
||||
void setAreaID(math::vector_3d const& pos, int id, bool adt, float radius = -1.0f);
|
||||
|
||||
noggit::NoggitRenderContext getRenderContext() { return _context; };
|
||||
|
||||
selection_result intersect ( math::matrix_4x4 const& model_view
|
||||
, math::ray const&
|
||||
, bool only_map
|
||||
@@ -379,4 +382,6 @@ private:
|
||||
|
||||
boost::optional<liquid_render> _liquid_render = boost::none;
|
||||
boost::optional<liquid_render> _liquid_render_mini = boost::none;
|
||||
|
||||
noggit::NoggitRenderContext _context;
|
||||
};
|
||||
|
||||
@@ -105,7 +105,7 @@ void liquid_render::add_liquid_id(int liquid_id)
|
||||
{
|
||||
try
|
||||
{
|
||||
textures.emplace_back(boost::str(boost::format(filename) % i));
|
||||
textures.emplace_back(boost::str(boost::format(filename) % i), _context);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ void liquid_render::add_liquid_id(int liquid_id)
|
||||
// make sure there's at least one texture
|
||||
if (textures.empty())
|
||||
{
|
||||
textures.emplace_back ("textures/shanecube.blp");
|
||||
textures.emplace_back ("textures/shanecube.blp", _context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <noggit/MPQ.h>
|
||||
#include <noggit/TextureManager.h>
|
||||
#include <noggit/ContextObject.hpp>
|
||||
#include <opengl/shader.hpp>
|
||||
|
||||
#include <string>
|
||||
@@ -14,7 +15,7 @@
|
||||
class liquid_render
|
||||
{
|
||||
public:
|
||||
liquid_render() = default;
|
||||
liquid_render(noggit::NoggitRenderContext context) : _context(context) {};
|
||||
void prepare_draw ( opengl::scoped::use_program& water_shader
|
||||
, int liquid_id
|
||||
, int animtime
|
||||
@@ -42,4 +43,6 @@ private:
|
||||
std::map<int, int> _liquid_id_types;
|
||||
std::map<int, math::vector_2d> _float_param_by_liquid_id;
|
||||
std::map<int, std::vector<scoped_blp_texture_reference>> _textures_by_liquid_id;
|
||||
|
||||
noggit::NoggitRenderContext _context;
|
||||
};
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
#include <forward_list>
|
||||
#include <cstdlib>
|
||||
|
||||
MapIndex::MapIndex (const std::string &pBasename, int map_id, World* world, bool create_empty)
|
||||
MapIndex::MapIndex (const std::string &pBasename, int map_id, World* world,
|
||||
noggit::NoggitRenderContext context, bool create_empty)
|
||||
: basename(pBasename)
|
||||
, _map_id (map_id)
|
||||
, _last_unload_time((clock() / CLOCKS_PER_SEC)) // to not try to unload right away
|
||||
@@ -35,6 +36,7 @@ MapIndex::MapIndex (const std::string &pBasename, int map_id, World* world, bool
|
||||
, _sort_models_by_size_class(false)
|
||||
, highestGUID(0)
|
||||
, _world (world)
|
||||
, _context(context)
|
||||
{
|
||||
|
||||
QSettings settings;
|
||||
@@ -365,7 +367,8 @@ MapTile* MapIndex::loadTile(const tile_index& tile, bool reloading)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
mTiles[tile.z][tile.x].tile = std::make_unique<MapTile> (tile.x, tile.z, filename.str(), mBigAlpha, true, use_mclq_green_lava(), reloading, _world);
|
||||
mTiles[tile.z][tile.x].tile = std::make_unique<MapTile> (tile.x, tile.z, filename.str(),
|
||||
mBigAlpha, true, use_mclq_green_lava(), reloading, _world, _context);
|
||||
|
||||
MapTile* adt = mTiles[tile.z][tile.x].tile.get();
|
||||
|
||||
@@ -867,11 +870,11 @@ uid_fix_status MapIndex::fixUIDs (World* world, bool cancel_on_model_loading_err
|
||||
|
||||
for (ENTRY_MDDF& entry : modelEntries)
|
||||
{
|
||||
models.emplace_front(modelFilenames[entry.nameID], &entry);
|
||||
models.emplace_front(modelFilenames[entry.nameID], &entry, _context);
|
||||
}
|
||||
for (ENTRY_MODF& entry : wmoEntries)
|
||||
{
|
||||
wmos.emplace_front(wmoFilenames[entry.nameID], &entry);
|
||||
wmos.emplace_front(wmoFilenames[entry.nameID], &entry, _context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -958,7 +961,7 @@ uid_fix_status MapIndex::fixUIDs (World* world, bool cancel_on_model_loading_err
|
||||
filename << "World\\Maps\\" << basename << "\\" << basename << "_" << x << "_" << z << ".adt";
|
||||
|
||||
// load the tile without the models
|
||||
MapTile tile(x, z, filename.str(), mBigAlpha, false, use_mclq_green_lava(), false, world, tile_mode::uid_fix_all);
|
||||
MapTile tile(x, z, filename.str(), mBigAlpha, false, use_mclq_green_lava(), false, world, _context, tile_mode::uid_fix_all);
|
||||
tile.finishLoading();
|
||||
|
||||
// add the uids to the tile to be able to save the models
|
||||
@@ -1130,7 +1133,7 @@ void MapIndex::addTile(const tile_index& tile)
|
||||
filename << "World\\Maps\\" << basename << "\\" << basename << "_" << tile.x << "_" << tile.z << ".adt";
|
||||
|
||||
mTiles[tile.z][tile.x].tile = std::make_unique<MapTile> (tile.x, tile.z, filename.str(),
|
||||
mBigAlpha, true, use_mclq_green_lava(), false, _world);
|
||||
mBigAlpha, true, use_mclq_green_lava(), false, _world, _context);
|
||||
|
||||
mTiles[tile.z][tile.x].flags |= 0x1;
|
||||
mTiles[tile.z][tile.x].tile->changed = true;
|
||||
@@ -1145,7 +1148,7 @@ void MapIndex::removeTile(const tile_index &tile)
|
||||
std::stringstream filename;
|
||||
filename << "World\\Maps\\" << basename << "\\" << basename << "_" << tile.x << "_" << tile.z << ".adt";
|
||||
mTiles[tile.z][tile.x].tile = std::make_unique<MapTile> (tile.x, tile.z, filename.str(),
|
||||
mBigAlpha, true, use_mclq_green_lava(), false, _world);
|
||||
mBigAlpha, true, use_mclq_green_lava(), false, _world, _context);
|
||||
|
||||
mTiles[tile.z][tile.x].tile->changed = true;
|
||||
mTiles[tile.z][tile.x].onDisc = false;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <noggit/MapTile.h>
|
||||
#include <noggit/Misc.h>
|
||||
#include <noggit/tile_index.hpp>
|
||||
#include <noggit/ContextObject.hpp>
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
@@ -149,7 +150,7 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
MapIndex(const std::string& pBasename, int map_id, World*, bool create_empty = false);
|
||||
MapIndex(const std::string& pBasename, int map_id, World*, noggit::NoggitRenderContext context, bool create_empty = false);
|
||||
|
||||
void set_basename(const std::string& pBasename);
|
||||
|
||||
@@ -259,5 +260,7 @@ private:
|
||||
//! \todo REMOVE!
|
||||
World* _world;
|
||||
|
||||
noggit::NoggitRenderContext _context;
|
||||
|
||||
std::mutex _mutex;
|
||||
};
|
||||
|
||||
@@ -14,9 +14,12 @@
|
||||
|
||||
#include <boost/utility/in_place_factory.hpp>
|
||||
|
||||
TextureSet::TextureSet (MapChunkHeader const& header, MPQFile* f, size_t base, MapTile* tile, bool use_big_alphamaps, bool do_not_fix_alpha_map, bool do_not_convert_alphamaps)
|
||||
TextureSet::TextureSet (MapChunkHeader const& header, MPQFile* f, size_t base, MapTile* tile
|
||||
, bool use_big_alphamaps, bool do_not_fix_alpha_map, bool do_not_convert_alphamaps
|
||||
, noggit::NoggitRenderContext context)
|
||||
: nTextures(header.nLayers)
|
||||
, _do_not_convert_alphamaps(do_not_convert_alphamaps)
|
||||
, _context(context)
|
||||
{
|
||||
for (int i = 0; i < 64; ++i)
|
||||
{
|
||||
@@ -36,7 +39,7 @@ TextureSet::TextureSet (MapChunkHeader const& header, MPQFile* f, size_t base, M
|
||||
{
|
||||
f->read (&_layers_info[i], sizeof(ENTRY_MCLY));
|
||||
|
||||
textures.emplace_back (tile->mTextureFilenames[_layers_info[i].textureID]);
|
||||
textures.emplace_back (tile->mTextureFilenames[_layers_info[i].textureID], _context);
|
||||
}
|
||||
|
||||
size_t alpha_base = base + header.ofsAlpha + 8;
|
||||
@@ -114,7 +117,7 @@ void TextureSet::replace_texture (scoped_blp_texture_reference const& texture_to
|
||||
if (replacement_texture_level != -1 && replacement_texture_level != texture_to_replace_level)
|
||||
{
|
||||
std::string fallback_tex_name = (boost::format("error_%d.blp") % replacement_texture_level).str();
|
||||
auto fallback = scoped_blp_texture_reference(fallback_tex_name);
|
||||
auto fallback = scoped_blp_texture_reference(fallback_tex_name, _context);
|
||||
|
||||
textures[replacement_texture_level] = std::move(fallback);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <noggit/MPQ.h>
|
||||
#include <noggit/alphamap.hpp>
|
||||
#include <noggit/MapHeaders.h>
|
||||
#include <noggit/ContextObject.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
@@ -28,7 +29,9 @@ class TextureSet
|
||||
{
|
||||
public:
|
||||
TextureSet() = delete;
|
||||
TextureSet(MapChunkHeader const& header, MPQFile* f, size_t base, MapTile* tile, bool use_big_alphamaps, bool do_not_fix_alpha_map, bool do_not_convert_alphamaps);
|
||||
TextureSet(MapChunkHeader const& header, MPQFile* f, size_t base, MapTile* tile
|
||||
, bool use_big_alphamaps, bool do_not_fix_alpha_map, bool do_not_convert_alphamaps
|
||||
, noggit::NoggitRenderContext context);
|
||||
|
||||
math::vector_2d anim_uv_offset(int id, int animtime) const;
|
||||
|
||||
@@ -101,4 +104,6 @@ private:
|
||||
void create_temporary_alphamaps_if_needed();
|
||||
|
||||
bool _do_not_convert_alphamaps;
|
||||
|
||||
noggit::NoggitRenderContext _context;
|
||||
};
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace noggit
|
||||
, _copy_model_stats (true)
|
||||
, selected()
|
||||
, pasteMode(PASTE_ON_TERRAIN)
|
||||
, _map_view(mapView)
|
||||
{
|
||||
auto layout = new QFormLayout (this);
|
||||
|
||||
@@ -537,7 +538,7 @@ namespace noggit
|
||||
|
||||
if (boost::ends_with (filename, ".m2"))
|
||||
{
|
||||
ModelInstance* mi = new ModelInstance(filename);
|
||||
ModelInstance* mi = new ModelInstance(filename, _map_view->getRenderContext());
|
||||
|
||||
_model_instance_created.push_back(mi);
|
||||
|
||||
@@ -546,7 +547,7 @@ namespace noggit
|
||||
}
|
||||
else if (boost::ends_with (filename, ".wmo"))
|
||||
{
|
||||
WMOInstance* wi = new WMOInstance(filename);
|
||||
WMOInstance* wi = new WMOInstance(filename, _map_view->getRenderContext());
|
||||
|
||||
_model_instance_created.push_back(wi);
|
||||
|
||||
@@ -572,7 +573,7 @@ namespace noggit
|
||||
if (selection.which() == eEntry_Model)
|
||||
{
|
||||
auto original = boost::get<selected_model_type>(selection);
|
||||
auto clone = new ModelInstance(original->model->filename);
|
||||
auto clone = new ModelInstance(original->model->filename, _map_view->getRenderContext());
|
||||
|
||||
clone->scale = original->scale;
|
||||
clone->dir = original->dir;
|
||||
@@ -584,7 +585,7 @@ namespace noggit
|
||||
else if (selection.which() == eEntry_WMO)
|
||||
{
|
||||
auto original = boost::get<selected_wmo_type>(selection);
|
||||
auto clone = new WMOInstance(original->wmo->filename);
|
||||
auto clone = new WMOInstance(original->wmo->filename, _map_view->getRenderContext());
|
||||
clone->dir = original->dir;
|
||||
clone->pos = pivot ? original->pos - pivot.get() : math::vector_3d();
|
||||
|
||||
|
||||
@@ -86,6 +86,8 @@ namespace noggit
|
||||
private:
|
||||
float _radius = 0.01f;
|
||||
|
||||
MapView* _map_view;
|
||||
|
||||
QSlider* _radius_slider;
|
||||
QDoubleSpinBox* _radius_spin;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <noggit/DBCFile.h>
|
||||
#include <noggit/Log.h>
|
||||
#include <noggit/World.h>
|
||||
#include <noggit/ContextObject.hpp>
|
||||
#include <noggit/ui/About.h>
|
||||
#include <noggit/MapView.h>
|
||||
#include <noggit/ui/SettingsPanel.h>
|
||||
@@ -189,7 +190,8 @@ namespace noggit
|
||||
{
|
||||
if (it->getInt(MapDB::MapID) == mapID)
|
||||
{
|
||||
_world = std::make_unique<World> (it->getString(MapDB::InternalName), mapID);
|
||||
_world = std::make_unique<World> (it->getString(MapDB::InternalName), mapID,
|
||||
noggit::NoggitRenderContext::MAP_VIEW);
|
||||
_minimap->world (_world.get());
|
||||
emit map_selected(mapID);
|
||||
|
||||
@@ -263,7 +265,8 @@ namespace noggit
|
||||
{
|
||||
if (it->getInt(MapDB::MapID) == entry.mapID)
|
||||
{
|
||||
_world = std::make_unique<World> (it->getString(MapDB::InternalName), entry.mapID);
|
||||
_world = std::make_unique<World> (it->getString(MapDB::InternalName),
|
||||
entry.mapID, noggit::NoggitRenderContext::MAP_VIEW);
|
||||
check_uid_then_enter_map ( entry.pos
|
||||
, math::degrees (entry.camera_pitch)
|
||||
, math::degrees (entry.camera_yaw)
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace noggit
|
||||
: QWidget (parent)
|
||||
, _texture_to_swap()
|
||||
, _radius(15.f)
|
||||
, _world(world)
|
||||
{
|
||||
setWindowTitle ("Swap");
|
||||
setWindowFlags (Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||
@@ -102,7 +103,7 @@ namespace noggit
|
||||
|
||||
void texture_swapper::set_texture(std::string const& filename)
|
||||
{
|
||||
_texture_to_swap = std::move(scoped_blp_texture_reference(filename));
|
||||
_texture_to_swap = std::move(scoped_blp_texture_reference(filename, _world->getRenderContext()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace noggit
|
||||
QGroupBox* _brush_mode_group;
|
||||
QSlider* _radius_slider;
|
||||
QDoubleSpinBox* _radius_spin;
|
||||
World* _world;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user