예제 #1
0
//-----------------------------------------------------------------------------
// Draws the panel using a 3D transform...
//-----------------------------------------------------------------------------
int	C_VGuiScreen::DrawModel( int flags )
{
	vgui::Panel *pPanel = m_PanelWrapper.GetPanel();
	if (!pPanel || !IsActive())
		return 0;
	
	// Don't bother drawing stuff not visible to me...
	C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
	if (!pLocalPlayer || !IsVisibleToTeam(pLocalPlayer->GetTeamNumber()) )
		return 0;
	
	// Backface cull the entire panel here...
	if (IsBackfacing(CurrentViewOrigin()))
		return 0;

	// Recompute the panel-to-world center
	// FIXME: Can this be cached off?
	ComputePanelToWorld();

	g_pMatSystemSurface->DrawPanelIn3DSpace( pPanel->GetVPanel(), m_PanelToWorld, 
		m_nPixelWidth, m_nPixelHeight, m_flWidth, m_flHeight );

	// Finally, a pass to set the z buffer...
	DrawScreenOverlay();

	return 1;
}
예제 #2
0
//-----------------------------------------------------------------------------
// Draws the panel using a 3D transform...
//-----------------------------------------------------------------------------
int	C_VGuiScreen::DrawModel( int flags )
{
	vgui::Panel *pPanel = m_PanelWrapper.GetPanel();
	if (!pPanel || !IsActive())
		return 0;

	// Don't bother drawing stuff not visible to me...
	C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
	if (!pLocalPlayer || !IsVisibleToTeam(pLocalPlayer->GetTeamNumber()) )
		return 0;

	if ( !IsVisibleToPlayer( pLocalPlayer ) )
	{
		return 0;
	}
	
	// Backface cull the entire panel here...
	if (IsBackfacing(CurrentViewOrigin()))
		return 0;

	// Recompute the panel-to-world center
	// FIXME: Can this be cached off?
	ComputePanelToWorld();

	/*if( m_fScreenFlags & VGUI_SCREEN_ATTACHED_TO_VIEWMODEL )
	{
		Msg("Rendering to view model \n ");

		CMatRenderContextPtr pRenderContext( materials );
		pRenderContext->MatrixMode( MATERIAL_PROJECTION );
		pRenderContext->PushMatrix();
		CViewSetup vmView( *view->GetPlayerViewSetup() );
		vmView.zNear = vmView.zNearViewmodel;
		vmView.zFar  = vmView.zFarViewmodel;
		vmView.fov   = vmView.fovViewmodel;
		render->Push3DView( vmView, 0, NULL, view->GetFrustum() );
		pRenderContext->DepthRange( 0.0f, 0.1f );
		pRenderContext.SafeRelease();
	}*/
	

	g_pMatSystemSurface->DrawPanelIn3DSpace( pPanel->GetVPanel(), m_PanelToWorld, 
		m_nPixelWidth, m_nPixelHeight, m_flWidth, m_flHeight );

	// Finally, a pass to set the z buffer...
	DrawScreenOverlay();

	
	/*if( m_fScreenFlags & VGUI_SCREEN_ATTACHED_TO_VIEWMODEL )
	{
		CMatRenderContextPtr pRenderContext( materials );
		pRenderContext->DepthRange( 0.0, 1.0 );
		render->PopView( view->GetFrustum() );
		pRenderContext->MatrixMode( MATERIAL_PROJECTION );
		pRenderContext->PopMatrix();
		pRenderContext.SafeRelease();
	}*/

	return 1;
}