mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-27 15:25:30 +03:00
Added Mapbase RT cameras to mat_showcamerarendertarget and fixed the command's materials not being referenced
This commit is contained in:
parent
f61b933ed3
commit
59825cb6c1
@ -29,6 +29,9 @@ static ConVar mat_wateroverlaysize( "mat_wateroverlaysize", "256" );
|
|||||||
static ConVar mat_showframebuffertexture( "mat_showframebuffertexture", "0", FCVAR_CHEAT );
|
static ConVar mat_showframebuffertexture( "mat_showframebuffertexture", "0", FCVAR_CHEAT );
|
||||||
static ConVar mat_framebuffercopyoverlaysize( "mat_framebuffercopyoverlaysize", "256" );
|
static ConVar mat_framebuffercopyoverlaysize( "mat_framebuffercopyoverlaysize", "256" );
|
||||||
static ConVar mat_showcamerarendertarget( "mat_showcamerarendertarget", "0", FCVAR_CHEAT );
|
static ConVar mat_showcamerarendertarget( "mat_showcamerarendertarget", "0", FCVAR_CHEAT );
|
||||||
|
#ifdef MAPBASE
|
||||||
|
static ConVar mat_showcamerarendertarget_all( "mat_showcamerarendertarget_all", "0", FCVAR_CHEAT );
|
||||||
|
#endif
|
||||||
static ConVar mat_camerarendertargetoverlaysize( "mat_camerarendertargetoverlaysize", "256", FCVAR_CHEAT );
|
static ConVar mat_camerarendertargetoverlaysize( "mat_camerarendertargetoverlaysize", "256", FCVAR_CHEAT );
|
||||||
static ConVar mat_hsv( "mat_hsv", "0", FCVAR_CHEAT );
|
static ConVar mat_hsv( "mat_hsv", "0", FCVAR_CHEAT );
|
||||||
static ConVar mat_yuv( "mat_yuv", "0", FCVAR_CHEAT );
|
static ConVar mat_yuv( "mat_yuv", "0", FCVAR_CHEAT );
|
||||||
@ -178,6 +181,11 @@ void OverlayCameraRenderTarget( const char *pszMaterialName, float flX, float fl
|
|||||||
pMaterial = materials->FindMaterial( pszMaterialName, TEXTURE_GROUP_OTHER, true );
|
pMaterial = materials->FindMaterial( pszMaterialName, TEXTURE_GROUP_OTHER, true );
|
||||||
if( !IsErrorMaterial( pMaterial ) )
|
if( !IsErrorMaterial( pMaterial ) )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// HACKHACK
|
||||||
|
pMaterial->IncrementReferenceCount();
|
||||||
|
#endif
|
||||||
|
|
||||||
CMatRenderContextPtr pRenderContext( materials );
|
CMatRenderContextPtr pRenderContext( materials );
|
||||||
pRenderContext->Bind( pMaterial );
|
pRenderContext->Bind( pMaterial );
|
||||||
IMesh* pMesh = pRenderContext->GetDynamicMesh( true );
|
IMesh* pMesh = pRenderContext->GetDynamicMesh( true );
|
||||||
@ -203,6 +211,11 @@ void OverlayCameraRenderTarget( const char *pszMaterialName, float flX, float fl
|
|||||||
|
|
||||||
meshBuilder.End();
|
meshBuilder.End();
|
||||||
pMesh->Draw();
|
pMesh->Draw();
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// HACKHACK
|
||||||
|
pMaterial->DecrementReferenceCount();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +227,11 @@ static void OverlayFrameBufferTexture( int nFrameBufferIndex )
|
|||||||
IMaterial *pMaterial;
|
IMaterial *pMaterial;
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
Q_snprintf( buf, MAX_PATH, "debug/debugfbtexture%d", nFrameBufferIndex );
|
Q_snprintf( buf, MAX_PATH, "debug/debugfbtexture%d", nFrameBufferIndex );
|
||||||
|
#ifdef MAPBASE
|
||||||
|
pMaterial = materials->FindMaterial( buf, NULL, true );
|
||||||
|
#else
|
||||||
pMaterial = materials->FindMaterial( buf, TEXTURE_GROUP_OTHER, true );
|
pMaterial = materials->FindMaterial( buf, TEXTURE_GROUP_OTHER, true );
|
||||||
|
#endif
|
||||||
if( !IsErrorMaterial( pMaterial ) )
|
if( !IsErrorMaterial( pMaterial ) )
|
||||||
{
|
{
|
||||||
CMatRenderContextPtr pRenderContext( materials );
|
CMatRenderContextPtr pRenderContext( materials );
|
||||||
@ -586,12 +603,52 @@ void CDebugViewRender::Draw2DDebuggingInfo( const CViewSetup &view )
|
|||||||
|
|
||||||
if ( mat_showcamerarendertarget.GetBool() )
|
if ( mat_showcamerarendertarget.GetBool() )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
float w = mat_camerarendertargetoverlaysize.GetFloat();
|
||||||
|
float h = mat_camerarendertargetoverlaysize.GetFloat();
|
||||||
|
#else
|
||||||
float w = mat_wateroverlaysize.GetFloat();
|
float w = mat_wateroverlaysize.GetFloat();
|
||||||
float h = mat_wateroverlaysize.GetFloat();
|
float h = mat_wateroverlaysize.GetFloat();
|
||||||
|
#endif
|
||||||
#ifdef PORTAL
|
#ifdef PORTAL
|
||||||
g_pPortalRender->OverlayPortalRenderTargets( w, h );
|
g_pPortalRender->OverlayPortalRenderTargets( w, h );
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
int iCameraNum = mat_showcamerarendertarget.GetInt();
|
||||||
|
|
||||||
|
if (iCameraNum == 1) // Display the default camera
|
||||||
|
{
|
||||||
OverlayCameraRenderTarget( "debug/debugcamerarendertarget", 0, 0, w, h );
|
OverlayCameraRenderTarget( "debug/debugcamerarendertarget", 0, 0, w, h );
|
||||||
|
}
|
||||||
|
else if (mat_showcamerarendertarget_all.GetBool()) // Display all cameras
|
||||||
|
{
|
||||||
|
OverlayCameraRenderTarget( "debug/debugcamerarendertarget", 0, 0, w, h );
|
||||||
|
|
||||||
|
// Already showed one camera
|
||||||
|
iCameraNum--;
|
||||||
|
|
||||||
|
// Show Mapbase's cameras
|
||||||
|
char szTextureName[48];
|
||||||
|
for (int i = 0; i < iCameraNum; i++)
|
||||||
|
{
|
||||||
|
V_snprintf( szTextureName, sizeof( szTextureName ), "debug/debugcamerarendertarget_camera%i", i );
|
||||||
|
|
||||||
|
// Show them vertically if the cvar is set to 2
|
||||||
|
if (mat_showcamerarendertarget_all.GetInt() == 2)
|
||||||
|
OverlayCameraRenderTarget( szTextureName, 0, h * (i + 1), w, h );
|
||||||
|
else
|
||||||
|
OverlayCameraRenderTarget( szTextureName, w * (i + 1), 0, w, h );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Display one of the new cameras
|
||||||
|
{
|
||||||
|
OverlayCameraRenderTarget( VarArgs( "debug/debugcamerarendertarget_camera%i", iCameraNum-2 ), 0, 0, w, h );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
OverlayCameraRenderTarget( "debug/debugcamerarendertarget", 0, 0, w, h );
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user