diff --git a/LICENSE_EXCEPTIONS.md b/LICENSE_EXCEPTIONS.md index 382e0368..fa79e94d 100644 --- a/LICENSE_EXCEPTIONS.md +++ b/LICENSE_EXCEPTIONS.md @@ -690,7 +690,6 @@ Copyright (c) 2019 Maximiliano Ruben Viamonte aka 'Stradex' CC0 1.0 Universal (CC0 1.0) Public Domain Dedication - No Copyright The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index aabe7761..f1656495 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -33,7 +33,7 @@ You need to call exportImagesToTrenchBroom and exportModelsToTrenchBroom once an * Added new icons to TrenchBroom for certain entities like lights, speakers or particle emitters -* TrenchBroom allows to select the Quake 1 light style +* TrenchBroom offers a dropdown menu to select the Quake 1 light style for lights * Drastically improved loading time of textures for materials in TrenchBroom @@ -53,6 +53,8 @@ You need to call exportImagesToTrenchBroom and exportModelsToTrenchBroom once an * Added new Creative Commons CC0 textures/common/ and textures/editor/ replacement textures because they didn't ship with the BFG edition +* Added base/convert_maps_to_valve220.cfg which lets you convert all maps to the Valve 220 .map format in one shot + _______________________________________ 30 October 2021 - RBDOOM-3-BFG 1.3.0 - Download it from the [RBDOOM-3-BFG ModDB Page](https://www.moddb.com/mods/rbdoom-3-bfg) diff --git a/neo/framework/DeclManager.cpp b/neo/framework/DeclManager.cpp index f307dded..64940947 100644 --- a/neo/framework/DeclManager.cpp +++ b/neo/framework/DeclManager.cpp @@ -3,7 +3,7 @@ Doom 3 BFG Edition GPL Source Code Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. -Copyright (C) 2015-2021 Robert Beckebans +Copyright (C) 2015-2022 Robert Beckebans This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). @@ -32,6 +32,7 @@ If you have questions concerning this license or the applicable additional terms #include "../renderer/Image.h" #include "../renderer/DXT/DXTCodec.h" #include "../renderer/Color/ColorSpace.h" +#include "../renderer/CmdlineProgressbar.h" /* @@ -2823,12 +2824,17 @@ void idDeclManagerLocal::ExportImagesToTrenchBroom_f( const idCmdArgs& args ) idFileList* files = fileSystem->ListFilesTree( "generated", ".bimage", true, true ); + CommandlineProgressBar progressBar( files->GetList().Num(), renderSystem->GetWidth(), renderSystem->GetHeight() ); + progressBar.Start(); + int totalStart = Sys_Milliseconds(); for( int f = 0; f < files->GetList().Num(); f++ ) { idStr imageName = files->GetList()[ f ]; + progressBar.Increment( true ); + if( idStr::Icmpn( imageName, "generated/images/env/maps/game/", 31 ) == 0 ) { // skip HDR cache data @@ -2887,7 +2893,7 @@ void idDeclManagerLocal::ExportImagesToTrenchBroom_f( const idCmdArgs& args ) if( ( imgHeader.format == FMT_DXT5 || imgHeader.format == FMT_DXT1 ) && ( imgHeader.colorFormat != CFM_GREEN_ALPHA ) ) { - idLib::Printf( "Exporting image '%s'\n", imageName.c_str() ); + //idLib::Printf( "Exporting image '%s'\n", imageName.c_str() ); // RB: Images that are were DXT compressed and aren't multiples of 4 were padded out before compressing // however the idBinaryImageData stores the original input width and height. diff --git a/neo/renderer/CmdlineProgressbar.cpp b/neo/renderer/CmdlineProgressbar.cpp new file mode 100644 index 00000000..4dbc8c64 --- /dev/null +++ b/neo/renderer/CmdlineProgressbar.cpp @@ -0,0 +1,107 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 2018-2022 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "precompiled.h" +#pragma hdrstop + +#include "RenderCommon.h" +#include "CmdlineProgressbar.h" + + +void CommandlineProgressBar::Start() +{ + // restore the original resolution, same as "vid_restart" + glConfig.nativeScreenWidth = sysWidth; + glConfig.nativeScreenHeight = sysHeight; + R_SetNewMode( false ); + + common->Printf( "0%% 10 20 30 40 50 60 70 80 90 100%%\n" ); + common->Printf( "|----|----|----|----|----|----|----|----|----|----|\n" ); + + common->UpdateScreen( false ); +} + +void CommandlineProgressBar::Increment( bool updateScreen ) +{ + if( ( count + 1 ) >= nextTicCount ) + { + if( updateScreen ) + { + // restore the original resolution, same as "vid_restart" + glConfig.nativeScreenWidth = sysWidth; + glConfig.nativeScreenHeight = sysHeight; + R_SetNewMode( false ); + + // resize frame buffers (this triggers SwapBuffers) + tr.SwapCommandBuffers( NULL, NULL, NULL, NULL, NULL, NULL ); + } + + size_t ticsNeeded = ( size_t )( ( ( double )( count + 1 ) / expectedCount ) * 50.0 ); + + do + { + common->Printf( "*" ); + } + while( ++tics < ticsNeeded ); + + nextTicCount = ( size_t )( ( tics / 50.0 ) * expectedCount ); + if( count == ( expectedCount - 1 ) ) + { + if( tics < 51 ) + { + common->Printf( "*" ); + } + common->Printf( "\n" ); + } + + if( updateScreen ) + { + common->UpdateScreen( false ); + + // swap front / back buffers + tr.SwapCommandBuffers( NULL, NULL, NULL, NULL, NULL, NULL ); + } + } + + count++; +} + +void CommandlineProgressBar::Reset() +{ + count = 0; + tics = 0; + nextTicCount = 0; +} + +void CommandlineProgressBar::Reset( int expected ) +{ + expectedCount = expected; + count = 0; + tics = 0; + nextTicCount = 0; +} diff --git a/neo/renderer/CmdlineProgressbar.h b/neo/renderer/CmdlineProgressbar.h new file mode 100644 index 00000000..49c80bb4 --- /dev/null +++ b/neo/renderer/CmdlineProgressbar.h @@ -0,0 +1,59 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 2018-2022 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#ifndef __CMDLINE_PROGRESSBAR_H__ +#define __CMDLINE_PROGRESSBAR_H__ + +// CommandlineProgressBar draws a nice progressbar in the console like you would get with boost +class CommandlineProgressBar +{ +private: + size_t tics = 0; + size_t nextTicCount = 0; + int count = 0; + int expectedCount = 0; + + int sysWidth = 1280; + int sysHeight = 720; + +public: + CommandlineProgressBar( int _expectedCount, int width, int height ) + { + expectedCount = _expectedCount; + sysWidth = width; + sysHeight = height; + } + + void Start(); + void Increment( bool updateScreen ); + + void Reset(); + void Reset( int expected ); +}; + +#endif /* !__CMDLINE_PROGRESSBAR_H__ */ diff --git a/neo/renderer/RenderCommon.h b/neo/renderer/RenderCommon.h index 1b9c45c6..cbd0e14c 100644 --- a/neo/renderer/RenderCommon.h +++ b/neo/renderer/RenderCommon.h @@ -40,7 +40,6 @@ If you have questions concerning this license or the applicable additional terms #include "Framebuffer.h" - // maximum texture units const int MAX_PROG_TEXTURE_PARMS = 16; @@ -1410,99 +1409,6 @@ void R_SampleCubeMapHDR16F( const idVec3& dir, int size, halfFloat_t* buffers[6] idVec2 NormalizedOctCoord( int x, int y, const int probeSideLength ); -class CommandlineProgressBar -{ -private: - size_t tics = 0; - size_t nextTicCount = 0; - int count = 0; - int expectedCount = 0; - - int sysWidth = 1280; - int sysHeight = 720; - -public: - CommandlineProgressBar( int _expectedCount, int width, int height ) - { - expectedCount = _expectedCount; - sysWidth = width; - sysHeight = height; - } - - void Start() - { - // restore the original resolution, same as "vid_restart" - glConfig.nativeScreenWidth = sysWidth; - glConfig.nativeScreenHeight = sysHeight; - R_SetNewMode( false ); - - common->Printf( "0%% 10 20 30 40 50 60 70 80 90 100%%\n" ); - common->Printf( "|----|----|----|----|----|----|----|----|----|----|\n" ); - - common->UpdateScreen( false ); - } - - void Increment( bool updateScreen ) - { - if( ( count + 1 ) >= nextTicCount ) - { - if( updateScreen ) - { - // restore the original resolution, same as "vid_restart" - glConfig.nativeScreenWidth = sysWidth; - glConfig.nativeScreenHeight = sysHeight; - R_SetNewMode( false ); - - // resize frame buffers (this triggers SwapBuffers) - tr.SwapCommandBuffers( NULL, NULL, NULL, NULL, NULL, NULL ); - } - - size_t ticsNeeded = ( size_t )( ( ( double )( count + 1 ) / expectedCount ) * 50.0 ); - - do - { - common->Printf( "*" ); - } - while( ++tics < ticsNeeded ); - - nextTicCount = ( size_t )( ( tics / 50.0 ) * expectedCount ); - if( count == ( expectedCount - 1 ) ) - { - if( tics < 51 ) - { - common->Printf( "*" ); - } - common->Printf( "\n" ); - } - - if( updateScreen ) - { - common->UpdateScreen( false ); - - // swap front / back buffers - tr.SwapCommandBuffers( NULL, NULL, NULL, NULL, NULL, NULL ); - } - } - - count++; - } - - void Reset() - { - count = 0; - tics = 0; - nextTicCount = 0; - } - - void Reset( int expected ) - { - expectedCount = expected; - count = 0; - tics = 0; - nextTicCount = 0; - } -}; - /* ==================================================================== diff --git a/neo/renderer/RenderWorld_envprobes.cpp b/neo/renderer/RenderWorld_envprobes.cpp index 1f6e4199..050bde61 100644 --- a/neo/renderer/RenderWorld_envprobes.cpp +++ b/neo/renderer/RenderWorld_envprobes.cpp @@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms #include "../libs/mesa/format_r11g11b10f.h" #include "RenderCommon.h" +#include "CmdlineProgressbar.h" #include "../framework/Common_local.h" // commonLocal.WaitGameThread(); /* diff --git a/neo/renderer/RenderWorld_lightgrid.cpp b/neo/renderer/RenderWorld_lightgrid.cpp index ecb15ab9..69eb4ce3 100644 --- a/neo/renderer/RenderWorld_lightgrid.cpp +++ b/neo/renderer/RenderWorld_lightgrid.cpp @@ -31,6 +31,7 @@ If you have questions concerning this license or the applicable additional terms #pragma hdrstop #include "RenderCommon.h" +#include "CmdlineProgressbar.h" #include "../framework/Common_local.h" // commonLocal.WaitGameThread(); @@ -1443,196 +1444,3 @@ CONSOLE_COMMAND( bakeLightGrids, "Bake irradiance/vis light grid data", NULL ) common->Printf( "Baked light grid irradiance in %5.1f minutes\n\n", ( totalEnd - totalStart ) / ( 1000.0f * 60 ) ); } -#if 0 -// straight port of Quake 3 / XreaL -void idRenderWorldLocal::SetupEntityGridLighting( idRenderEntityLocal* def ) -{ - // lighting calculations -#if 0 - if( def->lightgridCalculated ) - { - return; - } - - def->lightgridCalculated = true; -#endif - - if( lightGridPoints.Num() > 0 ) - { - idVec3 lightOrigin; - int pos[3]; - int i, j; - int gridPointIndex; - lightGridPoint_t* gridPoint; - lightGridPoint_t* gridPoint2; - float frac[3]; - int gridStep[3]; - idVec3 direction; - idVec3 direction2; - float lattitude; - float longitude; - float totalFactor; - -#if 0 - if( forcedOrigin ) - { - VectorCopy( forcedOrigin, lightOrigin ); - } - else - { - if( ent->e.renderfx & RF_LIGHTING_ORIGIN ) - { - // seperate lightOrigins are needed so an object that is - // sinking into the ground can still be lit, and so - // multi-part models can be lit identically - VectorCopy( ent->e.lightingOrigin, lightOrigin ); - } - else - { - VectorCopy( ent->e.origin, lightOrigin ); - } - } -#else - // some models, like empty particles have no volume -#if 1 - lightOrigin = def->parms.origin; -#else - if( def->referenceBounds.IsCleared() ) - { - lightOrigin = def->parms.origin; - } - else - { - lightOrigin = def->volumeMidPoint; - } -#endif - -#endif - - lightOrigin -= lightGridOrigin; - for( i = 0; i < 3; i++ ) - { - float v; - - v = lightOrigin[i] * ( 1.0f / lightGridSize[i] ); - pos[i] = floor( v ); - frac[i] = v - pos[i]; - if( pos[i] < 0 ) - { - pos[i] = 0; - } - else if( pos[i] >= lightGridBounds[i] - 1 ) - { - pos[i] = lightGridBounds[i] - 1; - } - } - - def->ambientLight.Zero(); - def->directedLight.Zero(); - direction.Zero(); - - // trilerp the light value - gridStep[0] = 1; - gridStep[1] = lightGridBounds[0]; - gridStep[2] = lightGridBounds[0] * lightGridBounds[1]; - - gridPointIndex = pos[0] * gridStep[0] + pos[1] * gridStep[1] + pos[2] * gridStep[2]; - gridPoint = &lightGridPoints[ gridPointIndex ]; - - totalFactor = 0; - for( i = 0; i < 8; i++ ) - { - float factor; - - factor = 1.0; - gridPoint2 = gridPoint; - for( int j = 0; j < 3; j++ ) - { - if( i & ( 1 << j ) ) - { - factor *= frac[j]; - -#if 1 - gridPointIndex2 += gridStep[j]; - if( gridPointIndex2 < 0 || gridPointIndex2 >= area->lightGrid.lightGridPoints.Num() ) - { - // ignore values outside lightgrid - continue; - } - - gridPoint2 = &area->lightGrid.lightGridPoints[ gridPointIndex2 ]; -#else - if( pos[j] + 1 > area->lightGrid.lightGridBounds[j] - 1 ) - { - // ignore values outside lightgrid - break; - } - - gridPoint2 += gridStep[j]; -#endif - } - else - { - factor *= ( 1.0f - frac[j] ); - } - } - - if( !( gridPoint2->ambient[0] + gridPoint2->ambient[1] + gridPoint2->ambient[2] ) ) - { - continue; // ignore samples in walls - } - - totalFactor += factor; - - def->ambientLight[0] += factor * gridPoint2->ambient[0] * ( 1.0f / 255.0f ); - def->ambientLight[1] += factor * gridPoint2->ambient[1] * ( 1.0f / 255.0f ); - def->ambientLight[2] += factor * gridPoint2->ambient[2] * ( 1.0f / 255.0f ); - - def->directedLight[0] += factor * gridPoint2->directed[0] * ( 1.0f / 255.0f ); - def->directedLight[1] += factor * gridPoint2->directed[1] * ( 1.0f / 255.0f ); - def->directedLight[2] += factor * gridPoint2->directed[2] * ( 1.0f / 255.0f ); - - lattitude = DEG2RAD( gridPoint2->latLong[1] * ( 360.0f / 255.0f ) ); - longitude = DEG2RAD( gridPoint2->latLong[0] * ( 360.0f / 255.0f ) ); - - direction2[0] = idMath::Cos( lattitude ) * idMath::Sin( longitude ); - direction2[1] = idMath::Sin( lattitude ) * idMath::Sin( longitude ); - direction2[2] = idMath::Cos( longitude ); - - direction += ( direction2 * factor ); - - //direction += ( gridPoint2->dir * factor ); - } - -#if 1 - if( totalFactor > 0 && totalFactor < 0.99 ) - { - totalFactor = 1.0f / totalFactor; - def->ambientLight *= totalFactor; - def->directedLight *= totalFactor; - } -#endif - - def->ambientLight[0] = idMath::ClampFloat( 0, 1, def->ambientLight[0] ); - def->ambientLight[1] = idMath::ClampFloat( 0, 1, def->ambientLight[1] ); - def->ambientLight[2] = idMath::ClampFloat( 0, 1, def->ambientLight[2] ); - - def->directedLight[0] = idMath::ClampFloat( 0, 1, def->directedLight[0] ); - def->directedLight[1] = idMath::ClampFloat( 0, 1, def->directedLight[1] ); - def->directedLight[2] = idMath::ClampFloat( 0, 1, def->directedLight[2] ); - - def->lightDir = direction; - def->lightDir.Normalize(); - -#if 0 - if( VectorLength( ent->ambientLight ) < r_forceAmbient->value ) - { - ent->ambientLight[0] = r_forceAmbient->value; - ent->ambientLight[1] = r_forceAmbient->value; - ent->ambientLight[2] = r_forceAmbient->value; - } -#endif - } -} - -#endif \ No newline at end of file