material debug info overlay (#70)

* material debug info overlay

* add x/y offset convars

* change flags to signature

flags is static?

* Update vgui_debugpanel.cpp

Co-authored-by: PixieCore <41352111+IcePixelx@users.noreply.github.com>
This commit is contained in:
rexx 2022-07-01 22:33:48 +01:00 committed by GitHub
parent 3efd7ece3b
commit bd79e805b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 0 deletions

View File

@ -119,6 +119,10 @@ void ConVar::Init(void) const
cl_gpustats_offset_x = new ConVar("cl_gpustats_offset_x" , "650", FCVAR_DEVELOPMENTONLY, "X offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr); cl_gpustats_offset_x = new ConVar("cl_gpustats_offset_x" , "650", FCVAR_DEVELOPMENTONLY, "X offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
cl_gpustats_offset_y = new ConVar("cl_gpustats_offset_y" , "105", FCVAR_DEVELOPMENTONLY, "Y offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr); cl_gpustats_offset_y = new ConVar("cl_gpustats_offset_y" , "105", FCVAR_DEVELOPMENTONLY, "Y offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
cl_showmaterialinfo = new ConVar("cl_showmaterialinfo", "0", FCVAR_DEVELOPMENTONLY, "Draw info for the material under the crosshair on screen", false, 0.f, false, 0.f, nullptr, nullptr);
cl_materialinfo_offset_x = new ConVar("cl_materialinfo_offset_x", "0", FCVAR_DEVELOPMENTONLY, "X offset for material debug info overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
cl_materialinfo_offset_y = new ConVar("cl_materialinfo_offset_y", "420", FCVAR_DEVELOPMENTONLY, "Y offset for material debug info overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
con_max_size_logvector = new ConVar("con_max_size_logvector" , "1000", FCVAR_DEVELOPMENTONLY, "Maximum number of logs in the console until cleanup starts.", false, 0.f, false, 0.f, nullptr, nullptr); con_max_size_logvector = new ConVar("con_max_size_logvector" , "1000", FCVAR_DEVELOPMENTONLY, "Maximum number of logs in the console until cleanup starts.", false, 0.f, false, 0.f, nullptr, nullptr);
con_suggestion_limit = new ConVar("con_suggestion_limit" , "120" , FCVAR_DEVELOPMENTONLY, "Maximum number of suggestions the autocomplete window will show for the console.", false, 0.f, false, 0.f, nullptr, nullptr); con_suggestion_limit = new ConVar("con_suggestion_limit" , "120" , FCVAR_DEVELOPMENTONLY, "Maximum number of suggestions the autocomplete window will show for the console.", false, 0.f, false, 0.f, nullptr, nullptr);
con_suggestion_showhelptext = new ConVar("con_suggestion_showhelptext" , "1" , FCVAR_DEVELOPMENTONLY, "Show CommandBase help text in autocomplete window.", false, 0.f, false, 0.f, nullptr, nullptr); con_suggestion_showhelptext = new ConVar("con_suggestion_showhelptext" , "1" , FCVAR_DEVELOPMENTONLY, "Show CommandBase help text in autocomplete window.", false, 0.f, false, 0.f, nullptr, nullptr);

View File

@ -97,6 +97,10 @@ ConVar* cl_gpustats_invert_rect_y = nullptr;
ConVar* cl_gpustats_offset_x = nullptr; ConVar* cl_gpustats_offset_x = nullptr;
ConVar* cl_gpustats_offset_y = nullptr; ConVar* cl_gpustats_offset_y = nullptr;
ConVar* cl_showmaterialinfo = nullptr;
ConVar* cl_materialinfo_offset_x = nullptr;
ConVar* cl_materialinfo_offset_y = nullptr;
ConVar* con_max_size_logvector = nullptr; ConVar* con_max_size_logvector = nullptr;
ConVar* con_suggestion_limit = nullptr; ConVar* con_suggestion_limit = nullptr;
ConVar* con_suggestion_showhelptext = nullptr; ConVar* con_suggestion_showhelptext = nullptr;

View File

@ -94,6 +94,10 @@ extern ConVar* cl_gpustats_invert_rect_y;
extern ConVar* cl_gpustats_offset_x; extern ConVar* cl_gpustats_offset_x;
extern ConVar* cl_gpustats_offset_y; extern ConVar* cl_gpustats_offset_y;
extern ConVar* cl_showmaterialinfo;
extern ConVar* cl_materialinfo_offset_x;
extern ConVar* cl_materialinfo_offset_y;
extern ConVar* con_max_size_logvector; extern ConVar* con_max_size_logvector;
extern ConVar* con_suggestion_limit; extern ConVar* con_suggestion_limit;
extern ConVar* con_suggestion_showhelptext; extern ConVar* con_suggestion_showhelptext;

View File

@ -16,6 +16,7 @@
#include <engine/debugoverlay.h> #include <engine/debugoverlay.h>
#include <engine/client/clientstate.h> #include <engine/client/clientstate.h>
#include <engine/server/server.h> #include <engine/server/server.h>
#include <materialsystem/cmaterialglue.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
@ -42,6 +43,10 @@ void CLogSystem::Update(void)
{ {
DrawHostStats(); DrawHostStats();
} }
if (cl_showmaterialinfo->GetBool())
{
DrawCrosshairMaterial();
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -174,6 +179,24 @@ void CLogSystem::DrawGPUStats(void) const
CMatSystemSurface_DrawColoredText(g_pMatSystemSurface, 0x13, m_nFontHeight, nWidth, nHeight, c.r(), c.g(), c.b(), c.a(), (char*)szLogbuf); CMatSystemSurface_DrawColoredText(g_pMatSystemSurface, 0x13, m_nFontHeight, nWidth, nHeight, c.r(), c.g(), c.b(), c.a(), (char*)szLogbuf);
} }
void CLogSystem::DrawCrosshairMaterial(void) const
{
CMaterialGlue* material = GetMaterialAtCrossHair();
if (material)
return;
static Color c = { 255, 255, 255, 255 };
static const char* szLogbuf[4096]{};
snprintf((char*)szLogbuf, 4096, "name: %s\nguid: %llx\ndimensions: %d x %d\nsurface: %s/%s\nsig: %i",
material->m_pszName,
material->m_GUID,
material->m_iWidth, material->m_iHeight,
material->m_pszSurfaceName1, material->m_pszSurfaceName2,
material->m_UnknownSignature);
CMatSystemSurface_DrawColoredText(g_pMatSystemSurface, 0x13, m_nFontHeight, cl_materialinfo_offset_x->GetInt(), cl_materialinfo_offset_y->GetInt(), c.r(), c.g(), c.b(), c.a(), (char*)szLogbuf);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -42,6 +42,7 @@ public:
void DrawHostStats(void) const; void DrawHostStats(void) const;
void DrawSimStats(void) const; void DrawSimStats(void) const;
void DrawGPUStats(void) const; void DrawGPUStats(void) const;
void DrawCrosshairMaterial(void) const;
private: private:
Color GetLogColorForType(LogType_t type) const; Color GetLogColorForType(LogType_t type) const;