Replace the savelightmap and deletelightmap ccmds with vktool

This commit is contained in:
Magnus Norddahl 2025-01-12 20:03:19 +01:00
commit 6ba2cff8cb
2 changed files with 30 additions and 16 deletions

View file

@ -110,8 +110,36 @@ LightmapDeleteCmdlet::LightmapDeleteCmdlet()
void LightmapDeleteCmdlet::OnCommand(FArgs args)
{
RunInGame([]() {
Printf("Deleting LIGHTMAP lump!\n");
// Pretty lame that we have to load the map here, but cba to figure out how to deal with map loading outside the engine...
RunInGame([&]() {
FString mapname;
if (args.NumArgs() > 0 && args.GetArg(0)[0] != '-')
mapname = args.GetArg(0);
else
mapname = "map01";
G_SetMap(mapname.GetChars(), 0);
for (int i = 0; i < 100; i++)
{
D_SingleTick();
if (gameaction == ga_nothing)
break;
}
if (!level.levelMesh)
{
Printf("No level mesh. Perhaps your level has no lightmap loaded?\n");
return;
}
if (!level.lightmaps)
{
Printf("Lightmap is not enabled in this level.\n");
}
level.levelMesh->DeleteLightmapLump(level);
});
}

View file

@ -127,20 +127,6 @@ CCMD(invalidatelightmap)
Printf("Marked %d out of %d tiles for update.\n", count, level.levelMesh->Lightmap.Tiles.Size());
}
CCMD(savelightmap)
{
if (!RequireLightmap()) return;
level.levelMesh->SaveLightmapLump(level);
}
CCMD(deletelightmap)
{
if (!RequireLightmap()) return;
level.levelMesh->DeleteLightmapLump(level);
}
CCMD(cpublasinfo)
{
if (!level.levelMesh || !level.levelMesh->Collision)