pass in a settings, so BSP loading can use paths from light
This commit is contained in:
parent
f73d71a7ca
commit
228f2057a2
|
|
@ -350,15 +350,8 @@ void GLView::takeScreenshot(int w, int h)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::renderBSP(const QString &file, const mbsp_t &bsp, const bspxentries_t &bspx, const std::vector<entdict_t> &entities)
|
void GLView::renderBSP(const QString &file, const mbsp_t &bsp, const bspxentries_t &bspx, const std::vector<entdict_t> &entities, const settings::common_settings &settings)
|
||||||
{
|
{
|
||||||
// FIXME: move to a lightpreview_settings
|
|
||||||
settings::common_settings settings;
|
|
||||||
|
|
||||||
// FIXME: copy the -path args from light
|
|
||||||
settings.paths.copy_from(light_options.paths);
|
|
||||||
|
|
||||||
bsp.loadversion->game->init_filesystem(file.toStdString(), settings);
|
|
||||||
img::load_textures(&bsp, settings);
|
img::load_textures(&bsp, settings);
|
||||||
|
|
||||||
// build lightmap atlas
|
// build lightmap atlas
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ public:
|
||||||
GLView(QWidget *parent = nullptr);
|
GLView(QWidget *parent = nullptr);
|
||||||
~GLView();
|
~GLView();
|
||||||
|
|
||||||
void renderBSP(const QString &file, const mbsp_t &bsp, const bspxentries_t &bspx, const std::vector<entdict_t> &entities);
|
void renderBSP(const QString &file, const mbsp_t &bsp, const bspxentries_t &bspx, const std::vector<entdict_t> &entities, const settings::common_settings &settings);
|
||||||
void setCamera(const qvec3d &origin, const qvec3d &fwd);
|
void setCamera(const qvec3d &origin, const qvec3d &fwd);
|
||||||
void setLighmapOnly(bool lighmapOnly);
|
void setLighmapOnly(bool lighmapOnly);
|
||||||
void setFullbright(bool fullbright);
|
void setFullbright(bool fullbright);
|
||||||
|
|
|
||||||
|
|
@ -307,6 +307,8 @@ void MainWindow::loadFileInternal(const QString &file, bool is_reload)
|
||||||
|
|
||||||
bspdata_t d;
|
bspdata_t d;
|
||||||
|
|
||||||
|
settings::common_settings render_settings;
|
||||||
|
|
||||||
if (fs_path.extension().compare(".bsp") == 0) {
|
if (fs_path.extension().compare(".bsp") == 0) {
|
||||||
|
|
||||||
LoadBSPFile(fs_path, &d);
|
LoadBSPFile(fs_path, &d);
|
||||||
|
|
@ -321,26 +323,32 @@ void MainWindow::loadFileInternal(const QString &file, bool is_reload)
|
||||||
argPtrs.push_back(arg.data());
|
argPtrs.push_back(arg.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
settings::common_settings settings;
|
render_settings.preinitialize(argPtrs.size(), argPtrs.data());
|
||||||
|
render_settings.initialize(argPtrs.size() - 1, argPtrs.data() + 1);
|
||||||
|
render_settings.postinitialize(argPtrs.size(), argPtrs.data());
|
||||||
|
|
||||||
settings.preinitialize(argPtrs.size(), argPtrs.data());
|
d.version->game->init_filesystem(fs_path, render_settings);
|
||||||
settings.initialize(argPtrs.size(), argPtrs.data());
|
|
||||||
settings.postinitialize(argPtrs.size(), argPtrs.data());
|
|
||||||
|
|
||||||
d.version->game->init_filesystem(fs_path, settings);
|
|
||||||
|
|
||||||
ConvertBSPFormat(&d, &bspver_generic);
|
ConvertBSPFormat(&d, &bspver_generic);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
d = QbspVisLight_Common(
|
d = QbspVisLight_Common(
|
||||||
fs_path, ParseArgs(qbsp_options), ParseArgs(vis_options), ParseArgs(light_options), vis_checkbox->isChecked());
|
fs_path, ParseArgs(qbsp_options), ParseArgs(vis_options), ParseArgs(light_options), vis_checkbox->isChecked());
|
||||||
|
|
||||||
|
// FIXME: move to a lightpreview_settings
|
||||||
|
settings::common_settings settings;
|
||||||
|
|
||||||
|
// FIXME: copy the -path args from light
|
||||||
|
settings.paths.copy_from(::light_options.paths);
|
||||||
|
|
||||||
|
d.loadversion->game->init_filesystem(file.toStdString(), settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &bsp = std::get<mbsp_t>(d.bsp);
|
const auto &bsp = std::get<mbsp_t>(d.bsp);
|
||||||
|
|
||||||
auto ents = EntData_Parse(bsp);
|
auto ents = EntData_Parse(bsp);
|
||||||
|
|
||||||
glView->renderBSP(file, bsp, d.bspx.entries, ents);
|
glView->renderBSP(file, bsp, d.bspx.entries, ents, render_settings);
|
||||||
|
|
||||||
if (!is_reload && !glView->getKeepOrigin()) {
|
if (!is_reload && !glView->getKeepOrigin()) {
|
||||||
for (auto &ent : ents) {
|
for (auto &ent : ents) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue