Skip to content

Commit

Permalink
Update fix crash bug etc
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Feb 20, 2024
1 parent 7851172 commit 3560fb4
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 184 deletions.
6 changes: 4 additions & 2 deletions src/bsp/Bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8654,7 +8654,9 @@ void Bsp::ExportToObjWIP(const std::string& path, int iscale, bool lightmapmode)

BspRenderer* bsprend = renderer;

bsprend->reload();
//g_app->reloading = true;
//bsprend->reload();
//g_app->reloading = false;

createDir(path + "textures");
std::vector<std::string> materials;
Expand Down Expand Up @@ -9637,7 +9639,7 @@ void Bsp::ExportToMapWIP(const std::string& path)

BspRenderer* bsprend = renderer;

bsprend->reload();
//bsprend->reload();

for (size_t entIdx = 0; entIdx < ents.size(); entIdx++)
{
Expand Down
12 changes: 6 additions & 6 deletions src/editor/BspRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,10 @@ void BspRenderer::reload()
{
map->update_lump_pointers();
loadLightmaps();
reloadTextures();
calcFaceMaths();
preRenderFaces();
preRenderEnts();
reloadTextures();
reloadClipnodes();
}

Expand Down Expand Up @@ -2164,7 +2164,7 @@ void BspRenderer::highlightFace(size_t faceIdx, int highlight, bool reupload)

if (highlight == 1)
{
r = rgroup->special ? 2.0f : 0.86f;
r = rgroup->special ? 2.0f : 0.15f;
g = 0.0f;
b = 0.0f;
}
Expand All @@ -2173,14 +2173,14 @@ void BspRenderer::highlightFace(size_t faceIdx, int highlight, bool reupload)
{
r = rgroup->special ? 3.0f : 0.0f;
g = 0.0f;
b = 0.86f;
b = 0.15f;
}

if (highlight == 3)
{
r = rgroup->special ? 4.0f : 0.0f;
g = 0.2f;
b = 0.2f;
g = 0.15f;
b = 0.15f;
}

auto verts = ((lightmapVert*)rgroup->buffer->get_data());
Expand Down Expand Up @@ -3358,7 +3358,7 @@ void BspRenderer::pushModelUndoState(const std::string& actionDesc, unsigned int
pushUndoCommand(editCommand);

// entity origin edits also update the ent origin (TODO: this breaks when moving + scaling something)
saveEntityState((int)entIdx[0]);
// saveEntityState((int)entIdx[0]);
}

void BspRenderer::pushUndoCommand(Command* cmd)
Expand Down
6 changes: 6 additions & 0 deletions src/editor/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,20 @@ void CreateBspModelCommand::execute()
//renderer->refreshModel(modelIdx);
//

map->save_undo_lightmaps();
map->resize_all_lightmaps();

renderer->loadLightmaps();
if (NeedreloadTextures)
renderer->reuploadTextures();
renderer->calcFaceMaths();
renderer->preRenderFaces();
renderer->preRenderEnts();
renderer->addClipnodeModel(modelIdx);
renderer->refreshModel(modelIdx);
//g_app->reloading = true;
//renderer->reload();
//g_app->reloading = false;

g_app->gui->refresh();
}
Expand Down
Loading

0 comments on commit 3560fb4

Please sign in to comment.