- output dlight lumps

This commit is contained in:
Magnus Norddahl 2018-10-27 12:58:05 +02:00
parent dcf8fbae0a
commit 54e3e461c5
4 changed files with 24 additions and 12 deletions

View file

@ -603,8 +603,8 @@ void FProcessor::BuildLightmaps(const char *configFile)
LMBuilder.CreateLightmaps(Level);
LMBuilder.WriteTexturesToTGA();
LMBuilder.WriteMeshToOBJ();
//LMBuilder.WriteTexturesToTGA();
//LMBuilder.WriteMeshToOBJ();
LightmapsBuilt = true;
}
@ -803,6 +803,11 @@ void FProcessor::Write (FWadWriter &out)
out.CopyLump (Wad, Wad.FindMapLump ("BEHAVIOR", Lump));
out.CopyLump (Wad, Wad.FindMapLump ("SCRIPTS", Lump));
}
if (LightmapsBuilt)
{
LMBuilder.AddLightGridLump(out);
LMBuilder.AddLightmapLumps(out);
}
if (Level.GLNodes != NULL && !compressGL)
{
char glname[9];

View file

@ -602,5 +602,12 @@ void FProcessor::WriteUDMF(FWadWriter &out)
out.CopyLump(Wad, i);
}
}
if (LightmapsBuilt)
{
LMBuilder.AddLightGridLump(out);
LMBuilder.AddLightmapLumps(out);
}
out.CreateLabel("ENDMAP");
}

View file

@ -937,7 +937,7 @@ void kexLightmapBuilder::CreateLightGrid()
// kexLightmapBuilder::AddLightGridLump
//
void kexLightmapBuilder::AddLightGridLump(kexWadFile &wadFile)
void kexLightmapBuilder::AddLightGridLump(FWadWriter &wadFile)
{
kexBinFile lumpFile;
int lumpSize = 0;
@ -1040,14 +1040,14 @@ void kexLightmapBuilder::AddLightGridLump(kexWadFile &wadFile)
}
#endif
wadFile.AddLump("LM_CELLS", lumpFile.BufferAt() - lumpFile.Buffer(), data);
wadFile.WriteLump("LM_CELLS", data, lumpFile.BufferAt() - lumpFile.Buffer());
}
//
// kexLightmapBuilder::CreateLightmapLump
//
void kexLightmapBuilder::AddLightmapLumps(kexWadFile &wadFile)
void kexLightmapBuilder::AddLightmapLumps(FWadWriter &wadFile)
{
int lumpSize = 0;
unsigned int i;
@ -1073,7 +1073,7 @@ void kexLightmapBuilder::AddLightmapLumps(kexWadFile &wadFile)
lumpFile.SetBuffer(data);
lumpFile.WriteVector(map->GetSunDirection());
wadFile.AddLump("LM_SUN", sizeof(kexVec3), data);
wadFile.WriteLump("LM_SUN", data, sizeof(kexVec3));
offs = lumpFile.BufferAt() - lumpFile.Buffer();
surfs = data + offs;
@ -1095,7 +1095,7 @@ void kexLightmapBuilder::AddLightmapLumps(kexWadFile &wadFile)
}
offs = lumpFile.BufferAt() - lumpFile.Buffer();
wadFile.AddLump("LM_SURFS", size, data);
wadFile.WriteLump("LM_SURFS", data, size);
txcrd = data + offs;
size = 0;
@ -1111,7 +1111,7 @@ void kexLightmapBuilder::AddLightmapLumps(kexWadFile &wadFile)
}
offs = (lumpFile.BufferAt() - lumpFile.Buffer()) - offs;
wadFile.AddLump("LM_TXCRD", size, txcrd);
wadFile.WriteLump("LM_TXCRD", txcrd, size);
lmaps = txcrd + offs;
// begin writing LM_LMAPS lump
@ -1131,7 +1131,7 @@ void kexLightmapBuilder::AddLightmapLumps(kexWadFile &wadFile)
}
offs = (lumpFile.BufferAt() - lumpFile.Buffer()) - offs;
wadFile.AddLump("LM_LMAPS", size, lmaps);
wadFile.WriteLump("LM_LMAPS", lmaps, size);
}
//

View file

@ -32,7 +32,7 @@
#define LIGHTMAP_MAX_SIZE 1024
class kexTrace;
class kexWadFile;
class FWadWriter;
class kexLightmapBuilder
{
@ -48,8 +48,8 @@ public:
void LightGrid(const int gridid);
void WriteTexturesToTGA();
void WriteMeshToOBJ();
void AddLightGridLump(kexWadFile &wadFile);
void AddLightmapLumps(kexWadFile &wadFile);
void AddLightGridLump(FWadWriter &wadFile);
void AddLightmapLumps(FWadWriter &wadFile);
int samples;
float ambience;