diff --git a/game/bin/x64/steam_api64.dll b/game/bin/x64/steam_api64.dll deleted file mode 100644 index 2b4281209..000000000 Binary files a/game/bin/x64/steam_api64.dll and /dev/null differ diff --git a/game/mod_hl2mp/gameinfo.txt b/game/mod_hl2mp/gameinfo.txt index 2246f2530..6e6ffc7fd 100644 --- a/game/mod_hl2mp/gameinfo.txt +++ b/game/mod_hl2mp/gameinfo.txt @@ -8,12 +8,17 @@ nohimodel 1 nocrosshair 1 supportsvr 1 + hidden_maps { "test_speakers" 1 "test_hardware" 1 } - + + GameData "hl2mp.fgd" + GameExecutableName32bits mod_hl2mp + GameExecutableName64bits mod_hl2mp_win64 + InstancePath "maps/instances/" FileSystem { @@ -92,4 +97,25 @@ game+download mod_hl2mp/download } } + + CubemapBuilder + { + SetGameToMaximunGraphic 1 + BuildDefaultCubemap 1 + + Hdr + { + +sv_cheats 1 + +mat_specular 0 + +mat_hdr_level 2 + +building_cubemaps 1 + } + + Ldr + { + +sv_cheats 1 + +mat_specular 0 + +mat_hdr_level 0 + } + } } diff --git a/game/mod_tf/gameinfo.txt b/game/mod_tf/gameinfo.txt index 40b8994d4..b62b47de6 100644 --- a/game/mod_tf/gameinfo.txt +++ b/game/mod_tf/gameinfo.txt @@ -5,13 +5,18 @@ nomodels 1 nohimodel 1 nocrosshair 0 + hidden_maps { "test_speakers" 1 "test_hardware" 1 } + nodegraph 0 GameData "tf.fgd" + GameExecutableName32bits tf + GameExecutableName64bits tf_win64 + AdditionalLocalization "tf" InstancePath "maps/instances/" advcrosshair 1 @@ -78,4 +83,25 @@ game+download mod_tf/download } } + + CubemapBuilder + { + SetGameToMaximunGraphic 1 + BuildDefaultCubemap 1 + + Hdr + { + +sv_cheats 1 + +mat_specular 0 + +mat_hdr_level 2 + +building_cubemaps 1 + } + + Ldr + { + +sv_cheats 1 + +mat_specular 0 + +mat_hdr_level 0 + } + } } \ No newline at end of file diff --git a/src/public/filesystem_init.cpp b/src/public/filesystem_init.cpp index 4fe72d40c..299abe6ec 100644 --- a/src/public/filesystem_init.cpp +++ b/src/public/filesystem_init.cpp @@ -1416,6 +1416,37 @@ void FileSystem_ClearSteamEnvVars() envVars.SetRestoreOriginalValue_ALL( false ); } +//----------------------------------------------------------------------------- +// Returns a string where the app dir is instaled +//----------------------------------------------------------------------------- +void FileSystem_GetAppInstallDir(char* string, size_t bufferSize) +{ + if (!SteamAPI_Init()) + { + Error("SteamAPI_Init() failed! Possible causes:\n" + " - Steam is not open.\n" + " - Could not find steam_appid.txt\n" +#ifdef PLATFORM_64BITS + " - Could not find steam_api64.dll\n" +#else + " - Could not find steam_api.dll\n" +#endif + ); + } + + AppId_t appID = SteamUtils()->GetAppID(); + if (appID == 0) + { + Error("Failed to get AppID!"); + } + + uint32 result = SteamApps()->GetAppInstallDir(appID, string, bufferSize); + if (result == 0) + { + Error("Failed to get App Install Directory!"); + } +} + //----------------------------------------------------------------------------- // Adds the platform folder to the search path. //----------------------------------------------------------------------------- diff --git a/src/public/filesystem_init.h b/src/public/filesystem_init.h index 9274a5cb1..7631a089e 100644 --- a/src/public/filesystem_init.h +++ b/src/public/filesystem_init.h @@ -211,7 +211,10 @@ FSReturnCode_t GetSteamCfgPath( char *steamCfgPath, int steamCfgPathLen ); // Returns the last error. const char *FileSystem_GetLastErrorString(); +void FileSystem_GetAppInstallDir(char* string, size_t bufferSize); void Q_getwd( char *out, int outSize ); +KeyValues* ReadKeyValuesFile(const char* pFilename); + #endif // FILESYSTEM_INIT_H diff --git a/src/utils/captioncompiler/captioncompiler.vpc b/src/utils/captioncompiler/captioncompiler.vpc index 34cd64e48..7cbdaef59 100644 --- a/src/utils/captioncompiler/captioncompiler.vpc +++ b/src/utils/captioncompiler/captioncompiler.vpc @@ -56,5 +56,7 @@ $Project "Caption Compiler" $Lib mathlib $Lib tier2 $Lib tier3 + $Lib steam_api64 [$WIN64] + $Lib steam_api [$WIN32] } } diff --git a/src/utils/glview/glview.vpc b/src/utils/glview/glview.vpc index fb83d5e48..33009d968 100644 --- a/src/utils/glview/glview.vpc +++ b/src/utils/glview/glview.vpc @@ -50,5 +50,7 @@ $Project "GL View" { $Lib mathlib $Lib tier2 + $Lib steam_api64 [$WIN64] + $Lib steam_api [$WIN32] } } diff --git a/src/utils/motionmapper/motionmapper.vpc b/src/utils/motionmapper/motionmapper.vpc index 3bf86d928..f068fc769 100644 --- a/src/utils/motionmapper/motionmapper.vpc +++ b/src/utils/motionmapper/motionmapper.vpc @@ -83,5 +83,7 @@ $Project "Motion Mapper" { $Lib mathlib $Lib tier2 + $Lib steam_api64 [$WIN64] + $Lib steam_api [$WIN32] } } diff --git a/src/utils/qc_eyes/qc_eyes.vpc b/src/utils/qc_eyes/qc_eyes.vpc index a5f9da740..76392b8e7 100644 --- a/src/utils/qc_eyes/qc_eyes.vpc +++ b/src/utils/qc_eyes/qc_eyes.vpc @@ -71,4 +71,10 @@ $Project "QC Eyes" $File "res\QC_Eyes.ico" $File "res\QC_Eyes.rc2" } + + $Folder "Link Libraries" + { + $Lib steam_api64 [$WIN64] + $Lib steam_api [$WIN32] + } } diff --git a/src/utils/vbsp/vbsp.cpp b/src/utils/vbsp/vbsp.cpp index 7b8c05936..f40814457 100644 --- a/src/utils/vbsp/vbsp.cpp +++ b/src/utils/vbsp/vbsp.cpp @@ -19,6 +19,7 @@ #include "loadcmdline.h" #include "byteswap.h" #include "worldvertextransitionfixup.h" +#include "tier1/KeyValues.h" extern float g_maxLightmapDimension; @@ -26,6 +27,7 @@ char source[1024]; char mapbase[ 64 ]; char name[1024]; char materialPath[1024]; +char GameInfoPath[MAX_PATH]; vec_t microvolume = 1.0; qboolean noprune; @@ -819,7 +821,7 @@ ProcessModels */ void ProcessModels (void) { - BeginBSPFile (); + BeginBSPFile(); // Mark sides that have no dynamic shadows. MarkNoDynamicShadowSides(); @@ -829,7 +831,7 @@ void ProcessModels (void) // Clip occluder brushes against each other, // Remove them from the list of models to process below - EmitOccluderBrushes( ); + EmitOccluderBrushes(); for ( entity_num=0; entity_num < num_entities; ++entity_num ) { @@ -858,8 +860,21 @@ void ProcessModels (void) } } - // Turn the skybox into a cubemap in case we don't build env_cubemap textures. - Cubemap_CreateDefaultCubemaps(); + KeyValues* GameInfoKVCubemap = ReadKeyValuesFile(GameInfoPath); + if(!GameInfoKVCubemap) + { + Error("Could not get KeyValues from %s!\n", GameInfoPath); + } + + KeyValues* CubemapBuilder = GameInfoKVCubemap->FindKey("CubemapBuilder",true); + const char* BuildDefaultCubemap = CubemapBuilder->GetString("BuildDefaultCubemap","1"); + + if (atoi(BuildDefaultCubemap) == 1) + { + // Turn the skybox into a cubemap in case we don't build env_cubemap textures. + Cubemap_CreateDefaultCubemaps(); + } + EndBSPFile (); } @@ -903,6 +918,7 @@ int RunVBSP( int argc, char **argv ) char mapFile[1024]; V_strncpy( mapFile, source, sizeof( mapFile ) ); V_strncat( mapFile, ".bsp", sizeof( mapFile ) ); + g_pFullFileSystem->RelativePathToFullPath("gameinfo.txt", "GAME", GameInfoPath, sizeof(GameInfoPath)); LoadCmdLineFromFile( argc, argv, mapbase, "vbsp" ); @@ -1417,7 +1433,7 @@ int RunVBSP( int argc, char **argv ) char str[512]; GetHourMinuteSecondsString( (int)( end - start ), str, sizeof( str ) ); - Msg( "%s elapsed\n", str ); + Msg( "--> Geometry complete in %s\n", str ); DeleteCmdLine( argc, argv ); ReleasePakFileLumps(); diff --git a/src/utils/vbsp/vbsp.vpc b/src/utils/vbsp/vbsp.vpc index d76a844ad..747c7c9dd 100644 --- a/src/utils/vbsp/vbsp.vpc +++ b/src/utils/vbsp/vbsp.vpc @@ -180,6 +180,8 @@ $Project "VBSP" $Lib tier2 $Lib vtf $Lib "$LIBCOMMON/lzma" + $Lib steam_api64 [$WIN64] + $Lib steam_api [$WIN32] } $File "notes.txt" diff --git a/src/utils/vice/vice.vpc b/src/utils/vice/vice.vpc index 3e8532a71..718cfe777 100644 --- a/src/utils/vice/vice.vpc +++ b/src/utils/vice/vice.vpc @@ -37,5 +37,7 @@ $Project "Vice" { $Lib tier2 $Lib mathlib + $Lib steam_api64 [$WIN64] + $Lib steam_api [$WIN32] } } diff --git a/src/utils/vrad/cubemapbuilder.cpp b/src/utils/vrad/cubemapbuilder.cpp new file mode 100644 index 000000000..1edfbc2d8 --- /dev/null +++ b/src/utils/vrad/cubemapbuilder.cpp @@ -0,0 +1,270 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#include "vrad.h" +#include "filesystem_init.h" +#include "KeyValues.h" +#include +#include "cubemapbuilder.h" + +/* +To enable CubemapBuilder in VRAD you have to setup your gameinfo.txt, lets take for example Half-Life 2 (hl2) +Inside the "GameInfo" KeyValue put this code (Note: Vrad if compiled on 32 bits, vrad will call the 32 bits launcher, same for 64 bits): + + // Name of the game launcher without extension. + GameExecutableName32bits hl2 + // Name of the 64 bits game launcher without extension. + GameExecutableName64bits hl2_win64 + + // CubemapBuilder KeyValue controls cubemap building inside the compile tools, it is used to pass commandline/convars to the engine. + CubemapBuilder + { + // Sets up the game at maximun graphics + SetGameToMaximunGraphic 1 + //VBSP option: Build the default cubemap + BuildDefaultCubemap 1 + + // These are mounted in the command line when VRAD initiates the game launcher. + // They can be either a convar or a commandline argument. + // If '-BuildHdrCubemaps' is enabled, VRAD will load these commandline arguments/convars. + Hdr + { + +mat_specular 0 + +mat_hdr_level 2 + +building_cubemaps 1 + } + + // If '-BuildLdrCubemaps' is enabled, VRAD will load these commandline arguments/convars + Ldr + { + +mat_hdr_level 0 + +mat_specular 0 + } + } + +*/ + + +void CopyBspToGameDir() +{ + char mapdir[MAX_PATH], mapgamedir[MAX_PATH], mapgamedir_file[MAX_PATH]; + float start = Plat_FloatTime(); + + V_snprintf(mapdir, sizeof(mapdir), "%s", source); + V_snprintf(mapgamedir, sizeof(mapgamedir), "%s\maps", gamedir); + V_snprintf(mapgamedir_file, sizeof(mapgamedir_file), "%s\maps\\%s.bsp", gamedir, level_name); + + Msg("Map original directory: %s\n", mapdir); + Msg("Map game folder: %s\n", mapgamedir); + Msg("Map game directory: %s\n", mapgamedir_file); + + Msg("Copying source %s.bsp to game directory... ", level_name); + + // Ensure the "maps" directory exists before copying + CreateDirectory(mapgamedir, NULL); + + // Set attributes to normal in case of restrictions + SetFileAttributes(mapgamedir_file, FILE_ATTRIBUTE_NORMAL); + SetFileAttributes(mapdir, FILE_ATTRIBUTE_NORMAL); + + if (!CopyFile(mapdir, mapgamedir_file, FALSE)) + { + DWORD error = GetLastError(); + Error("\nCould not copy to game directory %s\n" + "Error CopyFile() : %lu, %s\n", + mapgamedir_file, error, + error == ERROR_ACCESS_DENIED ? "Access denied! Check permissions and file attributes.\n" : ""); + } + else + { + float end = Plat_FloatTime(); + Msg("done (%f)\n", end - start); + } +} + + +void CopyGameDirBspToOrignalBspDir() +{ + char mapdir[MAX_PATH], mapgamedir[MAX_PATH], mapgamedir_file[MAX_PATH]; + float start = Plat_FloatTime(); + + V_snprintf(mapdir, sizeof(mapdir), "%s", source); + V_snprintf(mapgamedir, sizeof(mapgamedir), "%s\maps", gamedir); + V_snprintf(mapgamedir_file, sizeof(mapgamedir_file), "%s\maps\\%s.bsp", gamedir, level_name); + + Msg("Copying game %s.bsp to source directory... ", level_name); + + // Ensure the "maps" directory exists before copying + CreateDirectory(mapgamedir, NULL); + + // Set attributes to normal in case of restrictions + SetFileAttributes(mapgamedir_file, FILE_ATTRIBUTE_NORMAL); + SetFileAttributes(mapdir, FILE_ATTRIBUTE_NORMAL); + + if (!CopyFile(mapgamedir_file, mapdir, FALSE)) + { + DWORD error = GetLastError(); + Error("\nCould not copy to source directory %s\n" + "Error CopyFile() : %lu, %s\n", + mapgamedir_file, error, + error == ERROR_ACCESS_DENIED ? "Access denied! Check permissions and file attributes.\n" : ""); + } + else + { + float end = Plat_FloatTime(); + Msg("done (%f)\n", end - start); + } +} + + +void LoadGameInfoConvar(const char* GameInfoPath,char* Convar, std::size_t ConvarSize, bool bHdrMode) +{ + float start, end; + start = Plat_FloatTime(); + + Msg("Loading Convars from gameinfo.txt... "); + + KeyValues* GameInfoKVCubemap = ReadKeyValuesFile(GameInfoPath); + KeyValues* CubemapBuilder = GameInfoKVCubemap->FindKey("CubemapBuilder"); + + if(CubemapBuilder == NULL) + { + Warning("\nCould not load KeyValues for CubemapBuilder!" + "\nCubemaps might not look right!\n" ); + return; + } + + const char* SetGameToMaximunGraphic = CubemapBuilder->GetString("SetGameToMaximunGraphic", "0"); + bool bSetGameToMaximunGraphic = atoi(SetGameToMaximunGraphic) == 1 ? true : false; + + KeyValues* LightingMode = CubemapBuilder->FindKey(bHdrMode ? "Hdr" : "Ldr"); + + if (LightingMode == NULL) + { + Warning("\nCould not load KeyValues for %s!" + "\nCubemap compile might not look right!\n" + ,bHdrMode ? "Hdr" : "Ldr"); + return; + } + + char GameInfoConvar[4096] = " "; + + for (KeyValues* subKey = LightingMode->GetFirstSubKey(); subKey; subKey = subKey->GetNextKey()) + { + V_snprintf(GameInfoConvar, sizeof(GameInfoConvar), "%s %s %s", GameInfoConvar, subKey->GetName(), subKey->GetString()); + } + + V_snprintf(Convar, ConvarSize, "%s %s", GameInfoConvar, bSetGameToMaximunGraphic ? + " +r_lightmap_bicubic 1" + " +r_waterforceexpensive 1" + " +mat_antialias 8" + " +mat_picmip -10" + " +mat_forceaniso 16" : "" + ); + + end = Plat_FloatTime(); + Msg("done (%f)\n", end - start); +} + + +void BuildCubemaps(bool bHdrMode) +{ + float start, end; + start = Plat_FloatTime(); + Msg("\n\nBuilding %s.bsp cubemaps on %s mode\n", level_name, bHdrMode ? "Hdr" : "Ldr"); + + CopyBspToGameDir(); + + // We want to get the name of the .exe, this is done through a keyvalue in gameinfo.txt, the target will depend of the arquitecture. + // e.g (Half-Life 2): if on 32 bits, vrad will read GameExecutableName32bits and execute hl2.exe + // GameExecutableName32bits hl2 + // GameExecutableName64bits hl2_win64 + char GameInfoPath[MAX_PATH], gameexecutablename[MAX_PATH], gamexecutablepath[MAX_PATH*8], KVconvars[1024], _gamedir[MAX_PATH]; + g_pFullFileSystem->RelativePathToFullPath("gameinfo.txt", "GAME", GameInfoPath, sizeof(GameInfoPath)); + KeyValues* GameInfoKVCubemap = ReadKeyValuesFile(GameInfoPath); + + if (!GameInfoKVCubemap) + { + Error("Could not locate gameinfo.txt for Cubemap building at %s\n", GameInfoPath); + } + + // Generates the game executable name, e.g: hl2_win64.exe + const char* GameExecutableName = GameInfoKVCubemap->GetString(PLATFORM_64BITS ? "GameExecutableName64bits" : "GameExecutableName32bits", NULL); + + if (!GameExecutableName) + { + Error("Could not locate '%s' key %s in %s\n", PLATFORM_64BITS ? "GameExecutableName64bits" : "GameExecutableName32bits", GameExecutableName, GameInfoPath); + } + + V_snprintf(gameexecutablename, sizeof(gameexecutablename), "%s.exe", GameExecutableName); + + // Setup the commandline strings for (game).exe + strcpy(_gamedir, gamedir); + if (strlen(_gamedir) > 0 && _gamedir[strlen(_gamedir) - 1] == '\\') + _gamedir[strlen(_gamedir) - 1] = '\0'; + + char buildcubemapscommandline[MAX_PATH*8]; + + LoadGameInfoConvar(GameInfoPath, KVconvars, sizeof(GameInfoPath), bHdrMode); + + V_snprintf(buildcubemapscommandline, sizeof(buildcubemapscommandline), + " -sw -w %d -h %d -dev -novid -insecure -console -buildcubemaps -game \"%s\" +map %s %s ", + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + _gamedir, + level_name, + KVconvars + ); + + // Excecute (game).exe to build the cubemaps. + Msg("Starting the executable (%s), Comamnd line:%s \n", gameexecutablename, buildcubemapscommandline); + FileSystem_GetAppInstallDir(gamexecutablepath, sizeof(gamexecutablepath)); + V_snprintf(gamexecutablepath, sizeof(gamexecutablepath), "%s\\%s %s", gamexecutablepath, gameexecutablename, buildcubemapscommandline); + + STARTUPINFO si; + PROCESS_INFORMATION pi; + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + ZeroMemory(&pi, sizeof(pi)); + + if (!CreateProcess(NULL, gamexecutablepath, NULL, NULL, false, 0x00000000, NULL, NULL, &si, &pi)) + { + Error("%s could not start!\n", gameexecutablename); + } + + // Wait until child process exits. + WaitForSingleObject(pi.hProcess, INFINITE); + + // Close process and thread handles. + CloseHandle(pi.hProcess); + + CloseHandle(pi.hThread); + + DWORD exitCode = 0; + if (!GetExitCodeProcess(pi.hProcess, &exitCode)) + { + if (exitCode > 0) + { + Error("%s cubemaps compile failed: %d!\n", gameexecutablename, exitCode); + } + else + { + Msg("%s cubemaps compile complete!\n", gameexecutablename); + } + } + else + { + Error("GetExitCodeProcess() failed!\n"); + } + + // Once the cubemap compile is complete we will copy the file again to the original bsp dir. This is done + // to not break older workflows (e.g: if the user wants use bspzip, vbspinfo or a postcompiler) + CopyGameDirBspToOrignalBspDir(); + + end = Plat_FloatTime(); + printf("--> Cubemap builder complete in %f\n\n\n", end - start); +} \ No newline at end of file diff --git a/src/utils/vrad/cubemapbuilder.h b/src/utils/vrad/cubemapbuilder.h new file mode 100644 index 000000000..971006783 --- /dev/null +++ b/src/utils/vrad/cubemapbuilder.h @@ -0,0 +1,16 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + + +#ifndef CUBEMAPBUILDER_H +#define CUBEMAPBUILDER_H + + +void BuildCubemaps(bool bHdrMode); + + +#endif //CUBEMAPBUILDER_H \ No newline at end of file diff --git a/src/utils/vrad/vrad.cpp b/src/utils/vrad/vrad.cpp index 241771524..4df6ed9f8 100644 --- a/src/utils/vrad/vrad.cpp +++ b/src/utils/vrad/vrad.cpp @@ -19,6 +19,7 @@ #include "tools_minidump.h" #include "loadcmdline.h" #include "byteswap.h" +#include "cubemapbuilder.h" #define ALLOWDEBUGOPTIONS (0 || _DEBUG) @@ -119,6 +120,9 @@ bool g_bStaticPropLighting = false; bool g_bStaticPropPolys = false; bool g_bTextureShadows = false; bool g_bDisablePropSelfShadowing = false; +bool g_bBuildOnlyCubemaps = false; +bool g_bBuildHdrCubemaps = false; +bool g_bBuildLdrCubemaps = false; CUtlVector g_FacesVisibleToLights; @@ -2255,7 +2259,7 @@ void VRAD_LoadBSP( char const *pFilename ) // // TODO: change the maxes to the amount from the bsp!! // -// g_Patches.EnsureCapacity( MAX_PATCHES ); + // g_Patches.EnsureCapacity( MAX_PATCHES ); g_FacePatches.SetSize( MAX_MAP_FACES ); faceParents.SetSize( MAX_MAP_FACES ); @@ -2324,8 +2328,10 @@ void VRAD_ComputeOtherLighting() } } + extern void CloseDispLuxels(); + void VRAD_Finish() { Msg( "Ready to Finish\n" ); @@ -2361,9 +2367,18 @@ void VRAD_Finish() char str[512]; GetHourMinuteSecondsString( (int)( end - g_flStartTime ), str, sizeof( str ) ); - Msg( "%s elapsed\n", str ); + Msg( "--> Bake lighting complete in %s.\n\n", str ); ReleasePakFileLumps(); + + if(g_bBuildHdrCubemaps && g_bHDR) + { + BuildCubemaps(g_bHDR); + } + if(g_bBuildLdrCubemaps && !g_bHDR) + { + BuildCubemaps(g_bHDR); + } } @@ -2629,6 +2644,23 @@ int ParseCommandLine( int argc, char **argv, bool *onlydetail ) { SetHDRMode( false ); } + else if (!Q_stricmp(argv[i], "-BuildOnlyCubemaps")) + { + g_bBuildOnlyCubemaps = true; + } + else if (!Q_stricmp(argv[i], "-BuildLdrCubemaps")) + { + g_bBuildLdrCubemaps = true; + } + else if (!Q_stricmp(argv[i], "-BuildHdrCubemaps")) + { + g_bBuildHdrCubemaps = true; + } + else if (!Q_stricmp(argv[i], "-BuildBothCubemaps")) + { + g_bBuildHdrCubemaps = true; + g_bBuildLdrCubemaps = true; + } else if (!Q_stricmp(argv[i],"-maxchop")) { if ( ++i < argc ) @@ -2823,6 +2855,12 @@ void PrintUsage( int argc, char **argv ) " -final : High quality processing. equivalent to -extrasky 16.\n" " -extrasky n : trace N times as many rays for indirect light and sky ambient.\n" " -low : Run as an idle-priority process.\n" + " -BuildOnlyCubemaps : Only builds cubemaps, skips vrad compilation.\n" + " -BuildLdrCubemaps : Run the game to build cubemaps in LDR mode.\n" + " -BuildHdrCubemaps : Run the game to build cubemaps in HDR mode. -hdr or -both needs to be enabled in order to work.\n" + " -BuildBothCubemaps : Run the game to build cubemaps in both LDR and HDR modes.\n" + " equivalent to -BuildLdrCubemaps -BuildHdrCubemaps.\n" + #ifdef MPI " -mpi : Use VMPI to distribute computations.\n" #endif @@ -2932,18 +2970,31 @@ int RunVRAD( int argc, char **argv ) Q_StripExtension( argv[ i ], source, sizeof( source ) ); CmdLib_InitFileSystem( argv[ i ] ); Q_FileBase( source, source, sizeof( source ) ); + + VRAD_LoadBSP(argv[i]); - VRAD_LoadBSP( argv[i] ); - - if ( (! onlydetail) && (! g_bOnlyStaticProps ) ) + if (!g_bBuildOnlyCubemaps) { - RadWorld_Go(); + if ((!onlydetail) && (!g_bOnlyStaticProps)) + { + RadWorld_Go(); + } + + VRAD_ComputeOtherLighting(); + + VRAD_Finish(); + } + else + { + if (g_bBuildHdrCubemaps && g_bHDR) + { + BuildCubemaps(g_bHDR); + } + if (g_bBuildLdrCubemaps && !g_bHDR) + { + BuildCubemaps(g_bHDR); + } } - - VRAD_ComputeOtherLighting(); - - VRAD_Finish(); - #ifdef MPI VMPI_SetCurrentStage( "master done" ); #endif @@ -2980,9 +3031,4 @@ int VRAD_Main(int argc, char **argv) } return RunVRAD( argc, argv ); -} - - - - - +} \ No newline at end of file diff --git a/src/utils/vrad/vrad.h b/src/utils/vrad/vrad.h index e741ee6b4..58788b4d2 100644 --- a/src/utils/vrad/vrad.h +++ b/src/utils/vrad/vrad.h @@ -346,6 +346,7 @@ extern float g_flMaxDispSampleSize; extern float g_SunAngularExtent; extern char source[MAX_PATH]; +extern char level_name[MAX_PATH]; // Used by incremental lighting to trivial-reject faces. // There is a bit in here for each face telling whether or not any of the diff --git a/src/utils/vrad/vrad_dll.vpc b/src/utils/vrad/vrad_dll.vpc index 723c7103c..b087d0752 100644 --- a/src/utils/vrad/vrad_dll.vpc +++ b/src/utils/vrad/vrad_dll.vpc @@ -41,7 +41,7 @@ $Project "VRAD" $File "macro_texture.cpp" $File "..\common\mpi_stats.cpp" [$WIN32] $File "mpivrad.cpp" [$WIN32] - $File "$SRCDIR\public\filesystem_init.cpp" [!$WIN32] + $File "$SRCDIR\public\filesystem_init.cpp" $File "..\common\filesystem_tools.cpp" [!$WIN32] $File "..\common\MySqlDatabase.cpp" $File "..\common\pacifier.cpp" @@ -60,6 +60,7 @@ $Project "VRAD" $File "vraddll.cpp" $File "VRadStaticProps.cpp" $File "$SRCDIR\public\zip_utils.cpp" + $File "cubemapbuilder.cpp" $Folder "Common Files" { @@ -103,6 +104,7 @@ $Project "VRAD" $File "VRAD_DispColl.h" $File "vraddetailprops.h" $File "vraddll.h" + $File "cubemapbuilder.h" $Folder "Common Header Files" { @@ -127,6 +129,7 @@ $Project "VRAD" $File "..\vmpi\vmpi_dispatch.h" [$WIN32] $File "..\vmpi\vmpi_distribute_work.h" [$WIN32] $File "..\vmpi\vmpi_filesystem.h" [$WIN32] + $File "$SRCDIR\public\filesystem_init.h" } $Folder "Public Header Files" @@ -221,6 +224,8 @@ $Project "VRAD" $Lib raytrace $Lib tier2 $Lib vmpi [$WIN32] + $Lib steam_api64 [$WIN64] + $Lib steam_api [$WIN32] $Lib vtf $Lib "$LIBCOMMON/lzma" $File "$SRCDIR\thirdparty\libcurl\lib\win32\libcurl.lib" [$WIN32] diff --git a/src/utils/vvis/vvis.cpp b/src/utils/vvis/vvis.cpp index a544c7682..aaa0cbeac 100644 --- a/src/utils/vvis/vvis.cpp +++ b/src/utils/vvis/vvis.cpp @@ -1206,7 +1206,7 @@ int RunVVis( int argc, char **argv ) Warning("Can't compile trace in MPI mode\n"); } #endif - CalcVisTrace (); + CalcVisTrace(); WritePortalTrace(source); } @@ -1214,7 +1214,7 @@ int RunVVis( int argc, char **argv ) char str[512]; GetHourMinuteSecondsString( (int)( end - start ), str, sizeof( str ) ); - Msg( "%s elapsed\n", str ); + Msg( "--> Visibility complete in %s.\n", str ); ReleasePakFileLumps(); DeleteCmdLine( argc, argv ); diff --git a/src/utils/vvis/vvis_dll.vpc b/src/utils/vvis/vvis_dll.vpc index 1618d6cdc..9db6b093e 100644 --- a/src/utils/vvis/vvis_dll.vpc +++ b/src/utils/vvis/vvis_dll.vpc @@ -102,5 +102,7 @@ $Project "VVIS" $Lib vmpi [$WIN32] $Lib "$LIBCOMMON/lzma" $File "$SRCDIR\thirdparty\libcurl\lib\win32\libcurl.lib" [$WIN32] + $Lib steam_api64 [$WIN64] + $Lib steam_api [$WIN32] } }