2022-04-29 20:12:54 +02:00
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: render surface
//
// $NoKeywords: $
//===========================================================================//
# include "core/stdafx.h"
# include "tier1/cvar.h"
2024-04-05 16:45:05 +02:00
# include "windows/id3dx.h"
# include "geforce/reflex.h"
2022-04-29 20:12:54 +02:00
# include "engine/gl_rsurf.h"
2023-12-25 19:23:01 +01:00
# include <materialsystem/cmaterialsystem.h>
2022-04-29 20:12:54 +02:00
2024-02-24 02:15:09 +01:00
static ConVar r_drawWorldMeshes ( " r_drawWorldMeshes " , " 1 " , FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT , " Render world meshes. " ) ;
static ConVar r_drawWorldMeshesDepthOnly ( " r_drawWorldMeshesDepthOnly " , " 1 " , FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT , " Render world meshes (depth only) . " ) ;
static ConVar r_drawWorldMeshesDepthAtTheEnd ( " r_drawWorldMeshesDepthAtTheEnd " , " 1 " , FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT , " Render world meshes (depth at the end) . " ) ;
2023-12-25 19:36:59 +01:00
void * R_DrawDepthOfField ( const float scalar )
2024-04-05 16:45:05 +02:00
{
2023-12-25 19:23:01 +01:00
GFX_SetLatencyMarker ( D3D11Device ( ) , RENDERSUBMIT_START , MaterialSystem ( ) - > GetCurrentFrameCount ( ) ) ;
2023-12-25 19:36:59 +01:00
return V_DrawDepthOfField ( scalar ) ;
2024-04-05 16:45:05 +02:00
}
2022-04-29 20:12:54 +02:00
void * R_DrawWorldMeshes ( void * baseEntity , void * renderContext , DrawWorldLists_t worldLists )
{
2024-02-24 02:15:09 +01:00
if ( r_drawWorldMeshes . GetBool ( ) )
2022-04-29 20:12:54 +02:00
return V_DrawWorldMeshes ( baseEntity , renderContext , worldLists ) ;
else
return nullptr ;
}
void * R_DrawWorldMeshesDepthOnly ( void * renderContext , DrawWorldLists_t worldLists )
{
2024-02-24 02:15:09 +01:00
if ( r_drawWorldMeshesDepthOnly . GetBool ( ) )
2022-04-29 20:12:54 +02:00
return V_DrawWorldMeshesDepthOnly ( renderContext , worldLists ) ;
else
return nullptr ;
}
void * R_DrawWorldMeshesDepthAtTheEnd ( void * ptr1 , void * ptr2 , void * ptr3 , DrawWorldLists_t worldLists )
{
2024-02-24 02:15:09 +01:00
if ( r_drawWorldMeshesDepthAtTheEnd . GetBool ( ) )
2022-04-29 20:12:54 +02:00
return V_DrawWorldMeshesDepthAtTheEnd ( ptr1 , ptr2 , ptr3 , worldLists ) ;
else
return nullptr ;
}
2023-11-26 13:21:20 +01:00
void VGL_RSurf : : Detour ( const bool bAttach ) const
2022-04-29 20:12:54 +02:00
{
2024-04-05 16:45:05 +02:00
DetourSetup ( & V_DrawDepthOfField , & R_DrawDepthOfField , bAttach ) ;
2023-11-26 13:21:20 +01:00
DetourSetup ( & V_DrawWorldMeshes , & R_DrawWorldMeshes , bAttach ) ;
DetourSetup ( & V_DrawWorldMeshesDepthOnly , & R_DrawWorldMeshesDepthOnly , bAttach ) ;
DetourSetup ( & V_DrawWorldMeshesDepthAtTheEnd , & R_DrawWorldMeshesDepthAtTheEnd , bAttach ) ;
2022-04-29 20:12:54 +02:00
}