mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 06:34:10 +00:00
It can start and load a map!
This commit is contained in:
parent
535e56f580
commit
1d93ad0a58
19 changed files with 81 additions and 66 deletions
|
@ -4,6 +4,7 @@
|
|||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2012-2014 Robert Beckebans
|
||||
Copyright (C) 2022 Stephen Pridham
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -36,6 +37,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "../sound/sound.h"
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
// RB begin
|
||||
#if defined(USE_DOOMCLASSIC)
|
||||
#include "../../doomclassic/doom/doomlib.h"
|
||||
|
@ -1324,15 +1330,19 @@ void idCommonLocal::Init( int argc, const char* const* argv, const char* cmdline
|
|||
splashScreen = declManager->FindMaterial( "guis/assets/splash/legal_english" );
|
||||
}
|
||||
|
||||
// SP: Load in the splash screen images.
|
||||
globalImages->LoadDeferredImages();
|
||||
|
||||
const int legalMinTime = 4000;
|
||||
const bool showVideo = ( !com_skipIntroVideos.GetBool() && fileSystem->UsingResourceFiles() );
|
||||
const bool showSplash = true;
|
||||
if( showVideo )
|
||||
{
|
||||
RenderBink( "video\\loadvideo.bik" );
|
||||
RenderSplash();
|
||||
RenderSplash();
|
||||
}
|
||||
else
|
||||
else if( showSplash )
|
||||
{
|
||||
idLib::Printf( "Skipping Intro Videos!\n" );
|
||||
// display the legal splash screen
|
||||
|
@ -1342,7 +1352,6 @@ void idCommonLocal::Init( int argc, const char* const* argv, const char* cmdline
|
|||
RenderSplash();
|
||||
}
|
||||
|
||||
|
||||
int legalStartTime = Sys_Milliseconds();
|
||||
declManager->Init2();
|
||||
|
||||
|
@ -1470,6 +1479,7 @@ void idCommonLocal::Init( int argc, const char* const* argv, const char* cmdline
|
|||
|
||||
com_fullyInitialized = true;
|
||||
|
||||
globalImages->LoadDeferredImages();
|
||||
|
||||
// No longer need the splash screen
|
||||
if( splashScreen != NULL )
|
||||
|
@ -1773,20 +1783,17 @@ idCommonLocal::LeaveGame
|
|||
*/
|
||||
void idCommonLocal::LeaveGame()
|
||||
{
|
||||
|
||||
const bool captureToImage = false;
|
||||
|
||||
UpdateScreen( captureToImage );
|
||||
|
||||
ResetNetworkingState();
|
||||
|
||||
|
||||
Stop( false );
|
||||
|
||||
CreateMainMenu();
|
||||
|
||||
StartMenu();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1810,7 +1817,6 @@ bool idCommonLocal::ProcessEvent( const sysEvent_t* event )
|
|||
{
|
||||
if( !game->Shell_IsActive() )
|
||||
{
|
||||
|
||||
// menus / etc
|
||||
if( MenuEvent( event ) )
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ const int MAX_EXPRESSION_REGISTERS = 4096;
|
|||
#elif defined(USE_VULKAN)
|
||||
#include "../renderer/Vulkan/qvk.h"
|
||||
#else
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// FIMXE remove GL with NVRHI
|
||||
|
|
|
@ -135,7 +135,7 @@ protected:
|
|||
#else
|
||||
vulkanAllocation_t allocation;
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined( USE_NVRHI )
|
||||
nvrhi::InputLayoutHandle inputLayout;
|
||||
nvrhi::BufferHandle bufferHandle;
|
||||
|
|
|
@ -896,7 +896,7 @@ int idImageManager::LoadLevelImages( bool pacifier )
|
|||
for( int i = 0 ; i < images.Num() ; i++ )
|
||||
{
|
||||
idImage* image = images[ i ];
|
||||
|
||||
|
||||
if( pacifier )
|
||||
{
|
||||
common->UpdateLevelLoadPacifier();
|
||||
|
|
|
@ -597,7 +597,7 @@ void idImage::FinalizeImage( bool fromBackEnd, nvrhi::ICommandList* commandList
|
|||
// clear the data so it's not left uninitialized
|
||||
idTempArray<byte> clear( opts.width * opts.height * 4 );
|
||||
memset( clear.Ptr(), 0, clear.Size() );
|
||||
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
const nvrhi::FormatInfo& info = nvrhi::getFormatInfo( texture->getDesc().format );
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "RenderCommon.h" // just for R_FreeWorldInteractions and R_CreateWorldInteractions
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include <sys/DeviceManager.h>
|
||||
#include <sys/DeviceManager.h>
|
||||
|
||||
extern DeviceManager* deviceManager;
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
idCVar binaryLoadRenderModels( "binaryLoadRenderModels", "1", 0, "enable binary load/write of render models" );
|
||||
|
@ -241,6 +241,13 @@ idRenderModelManagerLocal::Init
|
|||
*/
|
||||
void idRenderModelManagerLocal::Init()
|
||||
{
|
||||
#if defined( USE_NVRHI )
|
||||
if( !commandList )
|
||||
{
|
||||
commandList = deviceManager->GetDevice()->createCommandList();
|
||||
}
|
||||
#endif
|
||||
|
||||
cmdSystem->AddCommand( "listModels", ListModels_f, CMD_FL_RENDERER, "lists all models" );
|
||||
cmdSystem->AddCommand( "printModel", PrintModel_f, CMD_FL_RENDERER, "prints model info", idCmdSystem::ArgCompletion_ModelName );
|
||||
cmdSystem->AddCommand( "reloadModels", ReloadModels_f, CMD_FL_RENDERER | CMD_FL_CHEAT, "reloads models" );
|
||||
|
@ -645,7 +652,7 @@ void idRenderModelManagerLocal::CreateMeshBuffers( nvrhi::ICommandList* commandL
|
|||
for( int i = 0; i < models.Num(); i++ )
|
||||
{
|
||||
idRenderModel* model = models[i];
|
||||
|
||||
|
||||
// Upload vertices and indices and shadow vertices into the vertex cache.
|
||||
assert( false && "Stephen should implement me!" );
|
||||
}
|
||||
|
|
|
@ -883,9 +883,9 @@ void idRenderBackend::DBG_ShowSurfaceInfo( drawSurf_t** drawSurfs, int numDrawSu
|
|||
// R_AxisToModelMatrix( mt.entity->axis, mt.entity->origin, matrix );
|
||||
|
||||
tr.primaryWorld->DrawText( surfModelName, surfPoint + tr.primaryView->renderView.viewaxis[2] * 12,
|
||||
0.35f, colorRed, tr.primaryView->renderView.viewaxis );
|
||||
0.35f, colorRed, tr.primaryView->renderView.viewaxis );
|
||||
tr.primaryWorld->DrawText( surfMatName, surfPoint,
|
||||
0.35f, colorBlue, tr.primaryView->renderView.viewaxis );
|
||||
0.35f, colorBlue, tr.primaryView->renderView.viewaxis );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -40,12 +40,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "imgui/ImGui_Hooks.h"
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include "RenderPass.h"
|
||||
#include <sys/DeviceManager.h>
|
||||
#include <nvrhi/utils.h>
|
||||
#include "RenderPass.h"
|
||||
#include <sys/DeviceManager.h>
|
||||
#include <nvrhi/utils.h>
|
||||
|
||||
idCVar r_useNewSsaoPass( "r_useNewSSAOPass", "0", CVAR_RENDERER | CVAR_BOOL, "use the new ssao pass from donut" );
|
||||
extern DeviceManager* deviceManager;
|
||||
idCVar r_useNewSsaoPass( "r_useNewSSAOPass", "0", CVAR_RENDERER | CVAR_BOOL, "use the new ssao pass from donut" );
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
idCVar r_drawEyeColor( "r_drawEyeColor", "0", CVAR_RENDERER | CVAR_BOOL, "Draw a colored box, red = left eye, blue = right eye, grey = non-stereo" );
|
||||
|
@ -5670,7 +5670,7 @@ BACKEND COMMANDS
|
|||
*/
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
extern DeviceManager* deviceManager;
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -6078,9 +6078,9 @@ void idRenderBackend::DrawViewInternal( const viewDef_t* _viewDef, const int ste
|
|||
glBindFramebuffer( GL_READ_FRAMEBUFFER_EXT, globalFramebuffers.hdrFBO->GetFramebuffer() );
|
||||
glBindFramebuffer( GL_DRAW_FRAMEBUFFER_EXT, globalFramebuffers.hdr64FBO->GetFramebuffer() );
|
||||
glBlitFramebuffer( 0, 0, renderSystem->GetWidth(), renderSystem->GetHeight(),
|
||||
0, 0, 64, 64,
|
||||
GL_COLOR_BUFFER_BIT,
|
||||
GL_LINEAR );
|
||||
0, 0, 64, 64,
|
||||
GL_COLOR_BUFFER_BIT,
|
||||
GL_LINEAR );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -528,7 +528,7 @@ public:
|
|||
void SetCurrentImage( idImage* image );
|
||||
idImage* GetCurrentImage();
|
||||
idImage* GetImageAt( int index );
|
||||
|
||||
|
||||
#elif !defined( USE_VULKAN )
|
||||
int currenttmu;
|
||||
|
||||
|
|
|
@ -42,23 +42,23 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#if defined( USE_NVRHI )
|
||||
|
||||
#if USE_DX11 || USE_DX12
|
||||
#include <DXGI.h>
|
||||
#endif
|
||||
#if USE_DX11 || USE_DX12
|
||||
#include <DXGI.h>
|
||||
#endif
|
||||
|
||||
#if USE_DX11
|
||||
#include <d3d11.h>
|
||||
#endif
|
||||
#if USE_DX11
|
||||
#include <d3d11.h>
|
||||
#endif
|
||||
|
||||
#if USE_DX12
|
||||
#include <d3d12.h>
|
||||
#endif
|
||||
#if USE_DX12
|
||||
#include <d3d12.h>
|
||||
#endif
|
||||
|
||||
#if USE_VK
|
||||
#include <nvrhi/vulkan.h>
|
||||
#endif
|
||||
#if USE_VK
|
||||
#include <nvrhi/vulkan.h>
|
||||
#endif
|
||||
|
||||
#include <nvrhi/nvrhi.h>
|
||||
#include <nvrhi/nvrhi.h>
|
||||
#endif
|
||||
|
||||
// maximum texture units
|
||||
|
@ -967,7 +967,7 @@ public:
|
|||
#if defined( USE_NVRHI )
|
||||
nvrhi::CommandListHandle commandList;
|
||||
#endif
|
||||
|
||||
|
||||
bool registered; // cleared at shutdown, set at InitOpenGL
|
||||
|
||||
bool takingScreenshot;
|
||||
|
|
|
@ -36,8 +36,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#if defined( USE_NVRHI )
|
||||
|
||||
#include <sys/DeviceManager.h>
|
||||
#include <nvrhi/utils.h>
|
||||
#include <sys/DeviceManager.h>
|
||||
#include <nvrhi/utils.h>
|
||||
|
||||
#elif defined(USE_VULKAN)
|
||||
|
||||
|
@ -93,7 +93,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* _device )
|
|||
{
|
||||
builtinShaders[i] = -1;
|
||||
}
|
||||
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
device = _device;
|
||||
|
||||
|
|
|
@ -1049,7 +1049,7 @@ private:
|
|||
nvrhi::BindingLayoutHandle bindingLayout;
|
||||
nvrhi::BindingSetHandle bindingSet;
|
||||
renderProg_t* currentShader;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#if defined(USE_VULKAN)
|
||||
|
|
|
@ -1727,4 +1727,4 @@ void idRenderProgManager::ZeroUniforms()
|
|||
memset( uniforms.Ptr(), 0, uniforms.Allocated() );
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -36,8 +36,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "../imgui/BFGimgui.h"
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "RenderCommon.h"
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include "sys/DeviceManager.h"
|
||||
#include "sys/DeviceManager.h"
|
||||
#endif
|
||||
|
||||
// RB begin
|
||||
|
@ -336,7 +336,7 @@ const char* envDirection[6] = { "_px", "_nx", "_py", "_ny", "_pz", "_nz" };
|
|||
const char* skyDirection[6] = { "_forward", "_back", "_left", "_right", "_up", "_down" };
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
DeviceManager* deviceManager;
|
||||
DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -454,10 +454,12 @@ void R_SetNewMode( const bool fullInit )
|
|||
if( fullInit )
|
||||
{
|
||||
// create the context as well as setting up the window
|
||||
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
deviceManager = DeviceManager::Create( nvrhi::GraphicsAPI::D3D12 );
|
||||
#elif defined(VULKAN_USE_PLATFORM_SDL)
|
||||
#endif
|
||||
|
||||
#if defined( USE_VULKAN )
|
||||
if( VKimp_Init( parms ) )
|
||||
#else
|
||||
if( GLimp_Init( parms ) )
|
||||
|
@ -471,7 +473,7 @@ void R_SetNewMode( const bool fullInit )
|
|||
{
|
||||
// just rebuild the window
|
||||
|
||||
#if defined(VULKAN_USE_PLATFORM_SDL)
|
||||
#if defined( USE_VULKAN )
|
||||
if( VKimp_SetScreenParms( parms ) )
|
||||
#else
|
||||
if( GLimp_SetScreenParms( parms ) )
|
||||
|
@ -540,10 +542,10 @@ static void R_ReloadSurface_f( const idCmdArgs& args )
|
|||
|
||||
commandList->open();
|
||||
#endif
|
||||
|
||||
|
||||
// reload any images used by the decl
|
||||
mt.material->ReloadImages( false, commandList );
|
||||
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
commandList->close();
|
||||
deviceManager->GetDevice()->executeCommandList( commandList );
|
||||
|
@ -2272,7 +2274,7 @@ idRenderSystemLocal::LoadLevelImages
|
|||
void idRenderSystemLocal::LoadLevelImages()
|
||||
{
|
||||
globalImages->LoadLevelImages( false );
|
||||
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
deviceManager->GetDevice()->waitForIdle();
|
||||
deviceManager->GetDevice()->runGarbageCollection();
|
||||
|
@ -2381,10 +2383,10 @@ void idRenderSystemLocal::InitBackend()
|
|||
}
|
||||
|
||||
commandList->open();
|
||||
|
||||
|
||||
// Reloading images here causes the rendertargets to get deleted. Figure out how to handle this properly on 360
|
||||
globalImages->ReloadImages( true, commandList );
|
||||
|
||||
|
||||
commandList->close();
|
||||
deviceManager->GetDevice()->executeCommandList( commandList );
|
||||
#else
|
||||
|
|
|
@ -34,8 +34,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "RenderCommon.h"
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,8 +38,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "../framework/Common_local.h" // commonLocal.WaitGameThread();
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1157,7 +1157,7 @@ CONSOLE_COMMAND( bakeEnvironmentProbes, "Bake environment probes", NULL )
|
|||
|
||||
#if defined( USE_NVRHI )
|
||||
nvrhi::CommandListHandle commandList = deviceManager->GetDevice()->createCommandList();
|
||||
|
||||
|
||||
commandList->open();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "../framework/Common_local.h" // commonLocal.WaitGameThread();
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "../../renderer/RenderCommon.h"
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue