Ejemplo n.º 1
0
	void PostEffect_SSAO::Render(RenderSystemPtr pRenderer, RenderTargetPtr pInput, RenderTargetPtr pOutput)
	{
		pRenderer->SetRenderTarget(m_pGBlurTarget);
		pRenderer->ClearRenderTarget(m_pGBlurTarget, 0, math::Color4(0, 0, 0,0));

		m_pMaterial->SetGBuffer(pRenderer->GetGBuffer());
		m_pMaterial->SetVectorByName("g_screen_size", math::Vector2(pRenderer->GetFrameBufferWidth(), pRenderer->GetFrameBufferHeight()));

		m_pMaterial->SetFloatByName("g_scale", m_scale);
		m_pMaterial->SetFloatByName("g_random_size", m_randomTexSize);
		m_pMaterial->SetFloatByName("g_sample_rad", m_sampleRad);
		m_pMaterial->SetFloatByName("g_bias", m_bias);
		m_pMaterial->SetFloatByName("g_intensity", m_intensity);


		pRenderer->DrawFullScreenQuad(m_pMaterial);

		pRenderer->SetRenderTarget(pOutput);
		pRenderer->ClearRenderTarget(pOutput, 0, math::Color4(0, 0, 0,0));
		
		m_pGBlurMaterial->SetGBuffer(pRenderer->GetGBuffer());
		m_pGBlurMaterial->SetTextureByName("tex_ao", m_pGBlurTarget->AsTexture(0));
		m_pGBlurMaterial->SetVectorByName("g_input_size", math::Vector2(pRenderer->GetFrameBufferWidth(), pRenderer->GetFrameBufferHeight()));
		m_pGBlurMaterial->SetTextureByName("tex_input", pInput->AsTexture(0));
		pRenderer->DrawFullScreenQuad(m_pGBlurMaterial);
	}
Ejemplo n.º 2
0
	void D3D11EffectMaterial::SetABuffer(RenderTargetPtr pABuffer)
	{
		if(m_semantics.m_pABuffer == nullptr)
		{
			return;
		}
		D3D11Texture* pTex1 = (D3D11Texture*)(pABuffer->AsTexture(0).get());

		m_semantics.m_pABuffer->SetResource(pTex1->GetShaderResourceView());
	}
Ejemplo n.º 3
0
void PostEffect_GaussianBlur::Render(RenderSystemPtr pRenderer, RenderTargetPtr pInput, RenderTargetPtr pOutput)
{
    pRenderer->SetRenderTarget(pOutput);
    pRenderer->ClearRenderTarget(pOutput, 0, math::Color4(0, 0, 0,0));

    m_pMaterial->SetTextureByName("tex_input", pInput->AsTexture(0));
    m_pMaterial->SetVectorByName("g_input_size", math::Vector2(pRenderer->GetFrameBufferWidth(), pRenderer->GetFrameBufferHeight()));

    pRenderer->DrawFullScreenQuad(m_pMaterial);
}
Ejemplo n.º 4
0
	void D3D11EffectMaterial::SetGBuffer(RenderTargetPtr pGBuffer)
	{
		if(m_semantics.m_pGBuffer == nullptr)
		{
			return;
		}
		D3D11Texture* pTex1 = (D3D11Texture*)(pGBuffer->AsTexture(0).get());
		D3D11Texture* pTex2 = (D3D11Texture*)(pGBuffer->AsTexture(1).get());
		D3D11Texture* pTex3 = (D3D11Texture*)(pGBuffer->AsTexture(2).get());


		ID3D11ShaderResourceView* pBuffers[3] = {
			pTex1->GetShaderResourceView(),
			pTex2->GetShaderResourceView(),
			pTex3->GetShaderResourceView(),
		};

		m_semantics.m_pGBuffer->SetResourceArray(pBuffers, 0, 3);

	}