Beispiel #1
0
	void CLightmapDebugView::Draw()
	{
		extern bool s_bCanAccessCurrentView;
		s_bCanAccessCurrentView = true;
		Frustum frustum;
		render->Push3DView( *this, 0, NULL, frustum );
		BuildWorldRenderLists( this, true, true );
		render->PopView( frustum );
		s_bCanAccessCurrentView = false;

		render->DrawLightmaps( m_pWorldRenderList, mat_showlightmappage.GetInt() );
	}
Beispiel #2
0
	void Draw()
	{
		extern bool s_bCanAccessCurrentView;
		AllowCurrentViewAccess( true );
		Frustum frustum;
		render->Push3DView( *this, 0, NULL, frustum );
		BuildWorldRenderLists( true, -1, true, true );
		render->PopView( frustum );
		AllowCurrentViewAccess( false );

		render->DrawLightmaps( m_pWorldRenderList, mat_showlightmappage.GetInt() );
	}
void CGodRaysView::Draw()
{
	
		CMatRenderContextPtr pRenderContext(materials);

		extern bool s_bCanAccessCurrentView;
		s_bCanAccessCurrentView = true;

		// Setup the view.
		const CViewSetup* pViewSetup = view->GetViewSetup();
		Setup(*pViewSetup);

		// Build a list of all the shit to render.
		BuildWorldRenderLists(true);
		BuildRenderableRenderLists(VIEW_MAIN);

		// Save off the current view information and create a
		// new 'blank' view.
		Frustum frustum;
		render->Push3DView(*this, 0, NULL, frustum);

		// Pass 1: Draw the sun glow overlays first.
		pRenderContext->ClearBuffers(true, true, true);
		if (m_pSun)
		{
			DrawSunGlowOverlay(m_pSun->m_GlowOverlay);
			DrawSunGlowOverlay(m_pSun->m_Overlay);
		}

		// Clear off the stencil buffer since we want the skybox
		// to persist.
		pRenderContext->ClearBuffers(false, false, true);

		// Enable the stencil buffer.
		SetupStencilBuffer(pRenderContext);

		// Disallow all writes except stencil.
		pRenderContext->OverrideAlphaWriteEnable(true, false);
		pRenderContext->OverrideColorWriteEnable(true, false);
		pRenderContext->OverrideDepthEnable(true, false);

		//Pass 2: Draw both the world geometry AND entities.
		m_DrawFlags = DF_RENDER_ABOVEWATER | DF_DRAW_ENTITITES;
		DrawWorld(0.0f);
		DrawOpaqueRenderables(DEPTH_MODE_NORMAL);

		// Enable writes again.
		pRenderContext->OverrideAlphaWriteEnable(false, true);
		pRenderContext->OverrideColorWriteEnable(false, true);
		pRenderContext->OverrideDepthEnable(false, true);

		// Pass 3: Clear stenciled area.
		pRenderContext->SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL);
		pRenderContext->SetStencilPassOperation(STENCILOPERATION_KEEP);
		pRenderContext->ClearBuffersObeyStencil(true, false);

		// Restore the previous view's settings.
		render->PopView(frustum);
		s_bCanAccessCurrentView = false;

		// Disable the stencil buffer now.
		pRenderContext->SetStencilEnable(false);

		// Release the render context.
		pRenderContext->Release();
}