From f9960ee12c264c51e70aadf490eb333a0312ad5c Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 26 Oct 2018 13:16:44 +0200 Subject: [PATCH] - hook up lightmap builder --- src/level/level.h | 4 ++-- src/lightmap/common.h | 1 - src/lightmap/worker.cpp | 11 ----------- src/main.cpp | 13 ++++++++++++- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/level/level.h b/src/level/level.h index 67d11e0..a765e2a 100644 --- a/src/level/level.h +++ b/src/level/level.h @@ -38,6 +38,8 @@ public: void BuildNodes (); + FLevel Level; + private: void LoadUDMF(); void LoadThings (); @@ -64,8 +66,6 @@ private: void ParseMapProperties(); void ParseTextMap(int lump); - FLevel Level; - TArray PolyStarts; TArray PolyAnchors; diff --git a/src/lightmap/common.h b/src/lightmap/common.h index 12632c7..5457b18 100644 --- a/src/lightmap/common.h +++ b/src/lightmap/common.h @@ -160,4 +160,3 @@ void Error(const char *error, ...); char *Va(const char *str, ...); void Delay(int ms); const int64_t GetSeconds(); -const kexStr &FilePath(); diff --git a/src/lightmap/worker.cpp b/src/lightmap/worker.cpp index 4bfdf5f..501f9a8 100644 --- a/src/lightmap/worker.cpp +++ b/src/lightmap/worker.cpp @@ -140,8 +140,6 @@ void kexWorker::RunThreads(const int count, void *data, jobFunc_t jobFunc) ///////////////////////////////////////////////////////////////////////////// // Stuff from old main.cpp -static kexStr basePath; - void Error(const char *error, ...) { va_list argptr; @@ -179,15 +177,6 @@ const int64_t GetSeconds() return time(0); } -// -// FilePath -// - -const kexStr &FilePath() -{ - return basePath; -} - // // Main // diff --git a/src/main.cpp b/src/main.cpp index dfa0703..1a0876b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,11 +7,11 @@ #include "framework/zdray.h" #include "wad/wad.h" #include "level/level.h" +#include "lightmap/lightmap.h" static void ParseArgs(int argc, char **argv); static void ShowUsage(); static void ShowVersion(); -static bool CheckInOutNames(); const char *Map = nullptr; const char *InName = nullptr; @@ -71,6 +71,17 @@ int main(int argc, char **argv) FLevelLoader loader(inwad, lump); loader.BuildNodes(); + loader.Level.ParseConfigFile("lightconfig.txt"); + loader.Level.SetupDlight(); + Surface_AllocateFromMap(loader.Level); + loader.Level.CreateLights(); + + kexLightmapBuilder builder; + builder.CreateLightmaps(loader.Level); + builder.WriteTexturesToTGA(); + + loader.Level.CleanupThingLights(); + lump = inwad.LumpAfterMap(lump); } else