mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fully implemented ConVar class so we could statically construct all SDK convars, this avoids a level of indirection, and allows for creating ConVar's everywhere in the project. This patch also removed the settings tab of the ImGui server browser, as it has threading issues, while it technically never caused a crash yet, it has been removed as there was no point keeping it vs the work required to make it thread save (it only managed 2 convars which are perfectly manageable through cfg's or the in-game console). Also temporarily disabled the creation of ConVar's in the mod system due to a memory leak, we would allocate and register a convar based on details parsed out of a mod file definition, but never unregister and free it.
55 lines
2.0 KiB
C++
55 lines
2.0 KiB
C++
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
||
//
|
||
// Purpose: render surface
|
||
//
|
||
// $NoKeywords: $
|
||
//===========================================================================//
|
||
#include "core/stdafx.h"
|
||
#include "tier1/cvar.h"
|
||
#include "windows/id3dx.h"
|
||
#include "geforce/reflex.h"
|
||
#include "engine/gl_rsurf.h"
|
||
#include <materialsystem/cmaterialsystem.h>
|
||
|
||
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).");
|
||
|
||
void* R_DrawDepthOfField(const float scalar)
|
||
{
|
||
GFX_SetLatencyMarker(D3D11Device(), RENDERSUBMIT_START, MaterialSystem()->GetCurrentFrameCount());
|
||
return V_DrawDepthOfField(scalar);
|
||
}
|
||
|
||
void* R_DrawWorldMeshes(void* baseEntity, void* renderContext, DrawWorldLists_t worldLists)
|
||
{
|
||
if (r_drawWorldMeshes.GetBool())
|
||
return V_DrawWorldMeshes(baseEntity, renderContext, worldLists);
|
||
else
|
||
return nullptr;
|
||
}
|
||
|
||
void* R_DrawWorldMeshesDepthOnly(void* renderContext, DrawWorldLists_t worldLists)
|
||
{
|
||
if (r_drawWorldMeshesDepthOnly.GetBool())
|
||
return V_DrawWorldMeshesDepthOnly(renderContext, worldLists);
|
||
else
|
||
return nullptr;
|
||
}
|
||
|
||
void* R_DrawWorldMeshesDepthAtTheEnd(void* ptr1, void* ptr2, void* ptr3, DrawWorldLists_t worldLists)
|
||
{
|
||
if (r_drawWorldMeshesDepthAtTheEnd.GetBool())
|
||
return V_DrawWorldMeshesDepthAtTheEnd(ptr1, ptr2, ptr3, worldLists);
|
||
else
|
||
return nullptr;
|
||
}
|
||
|
||
void VGL_RSurf::Detour(const bool bAttach) const
|
||
{
|
||
DetourSetup(&V_DrawDepthOfField, &R_DrawDepthOfField, bAttach);
|
||
DetourSetup(&V_DrawWorldMeshes, &R_DrawWorldMeshes, bAttach);
|
||
DetourSetup(&V_DrawWorldMeshesDepthOnly, &R_DrawWorldMeshesDepthOnly, bAttach);
|
||
DetourSetup(&V_DrawWorldMeshesDepthAtTheEnd, &R_DrawWorldMeshesDepthAtTheEnd, bAttach);
|
||
}
|