void CPixelVisibilitySystem::LevelShutdownPostEntity()
{
	m_pProxyMaterial->DecrementReferenceCount();
	m_pProxyMaterial = NULL;
	m_pDrawMaterial->DecrementReferenceCount();
	m_pDrawMaterial = NULL;
	DeleteUnusedSets(true);
	m_setList.Purge();
	m_queryList.Purge();
	m_freeQueriesList = m_queryList.InvalidIndex();
	m_activeSetsList = m_setList.InvalidIndex();
	m_freeSetsList = m_setList.InvalidIndex();
}
Пример #2
0
//-----------------------------------------------------------------------------
// Set the material to draw
//-----------------------------------------------------------------------------
void CMaterialViewPanel::SetMaterial( IMaterial *pMaterial )
{
	if (m_pMaterial)
	{
		m_pMaterial->DecrementReferenceCount();
	}
	m_pMaterial = pMaterial;
	if (m_pMaterial)
	{
		m_pMaterial->IncrementReferenceCount();
	}
	InvalidateLayout();
}
Пример #3
0
void UpdateFullScreenDepthTexture( void )
{
	if( !g_pMaterialSystemHardwareConfig->SupportsPixelShaders_2_b() )
		return;

	ITexture *pDepthTex = GetFullFrameDepthTexture();
	CMatRenderContextPtr pRenderContext( materials );

	if( IsX360() )
	{	
		pRenderContext->CopyRenderTargetToTextureEx( pDepthTex, -1, NULL, NULL );
	}
	else
	{
		pRenderContext->CopyRenderTargetToTextureEx( pDepthTex, 0, NULL, NULL );
	}

	pRenderContext->SetFullScreenDepthTextureValidityFlag( true );

	if( r_depthoverlay.GetBool() )
	{
		IMaterial *pMaterial = materials->FindMaterial( "debug/showz", TEXTURE_GROUP_OTHER, true );
		pMaterial->IncrementReferenceCount();
		IMaterialVar *BaseTextureVar = pMaterial->FindVar( "$basetexture", NULL, false );
		IMaterialVar *pDepthInAlpha = NULL;
		if( IsPC() )
		{
			pDepthInAlpha = pMaterial->FindVar( "$ALPHADEPTH", NULL, false );
			pDepthInAlpha->SetIntValue( 1 );
		}
		
		BaseTextureVar->SetTextureValue( pDepthTex );

		pRenderContext->OverrideDepthEnable( true, false ); //don't write to depth, or else we'll never see translucents
		pRenderContext->DrawScreenSpaceQuad( pMaterial );
		pRenderContext->OverrideDepthEnable( false, true );
		pMaterial->DecrementReferenceCount();
	}
}
Пример #4
0
//-----------------------------------------------------------------------------
// Draws all the debugging info
//-----------------------------------------------------------------------------
void CDebugViewRender::Draw2DDebuggingInfo(const CViewSetup &view)
{
    if (IsX360() && IsRetail())
        return;

    // HDRFIXME: Assert NULL rendertarget
    if (mat_yuv.GetInt() && (engine->GetDXSupportLevel() >= 80))
    {
        IMaterial *pMaterial;
        pMaterial = materials->FindMaterial("debug/yuv", TEXTURE_GROUP_OTHER, true);
        if (!IsErrorMaterial(pMaterial))
        {
            pMaterial->IncrementReferenceCount();
            DrawScreenEffectMaterial(pMaterial, view.x, view.y, view.width, view.height);
            pMaterial->DecrementReferenceCount();
        }
    }

    if (mat_hsv.GetInt() && (engine->GetDXSupportLevel() >= 90))
    {
        IMaterial *pMaterial;
        pMaterial = materials->FindMaterial("debug/hsv", TEXTURE_GROUP_OTHER, true);
        if (!IsErrorMaterial(pMaterial))
        {
            pMaterial->IncrementReferenceCount();
            DrawScreenEffectMaterial(pMaterial, view.x, view.y, view.width, view.height);
            pMaterial->DecrementReferenceCount();
        }
    }

    // Draw debugging lightmaps
    if (mat_showlightmappage.GetInt() != -1)
    {
        CLightmapDebugView clientView(assert_cast<CViewRender *>(::view));
        clientView.Setup(view);
        clientView.Draw();
    }

    if (cl_drawshadowtexture.GetInt())
    {
        int nSize = cl_shadowtextureoverlaysize.GetInt();
        g_pClientShadowMgr->RenderShadowTexture(nSize, nSize);
    }

    const char *pDrawMaterial = cl_drawmaterial.GetString();
    if (pDrawMaterial && pDrawMaterial[0])
    {
        RenderMaterial(pDrawMaterial);
    }

    if (mat_showwatertextures.GetBool())
    {
        OverlayWaterTextures();
    }

    if (mat_showcamerarendertarget.GetBool())
    {
        float w = mat_wateroverlaysize.GetFloat();
        float h = mat_wateroverlaysize.GetFloat();
        OverlayCameraRenderTarget("debug/debugcamerarendertarget", 0, 0, w, h);
    }

    if (mat_showframebuffertexture.GetBool())
    {
        // HDRFIXME: Get rid of these rendertarget sets assuming that the assert at the top of this function is true.
        CMatRenderContextPtr pRenderContext(materials);
        pRenderContext->PushRenderTargetAndViewport(NULL);
        OverlayFrameBufferTexture(0);
        OverlayFrameBufferTexture(1);
        pRenderContext->PopRenderTargetAndViewport();
    }

    const char *pDrawTexture = mat_drawTexture.GetString();
    if (pDrawTexture && pDrawTexture[0])
    {
        OverlayShowTexture(pDrawTexture, mat_drawTextureScale.GetFloat());
    }

    if (r_flashlightdrawdepth.GetBool())
    {
        shadowmgr->DrawFlashlightDepthTexture();
    }
}