mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-05-31 08:50:54 +00:00
Render SSAO to offscreen FBO
This commit is contained in:
parent
9f83e84f6f
commit
8a861c7914
10 changed files with 111 additions and 43 deletions
|
@ -144,16 +144,28 @@ void Framebuffer::Init()
|
|||
|
||||
// BLOOM
|
||||
|
||||
for( int i = 0; i < 2; i++ )
|
||||
for( int i = 0; i < MAX_BLOOM_BUFFERS; i++ )
|
||||
{
|
||||
globalFramebuffers.bloomRenderFBO[i] = new Framebuffer( va( "_bloomRender%i", i ), glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
globalFramebuffers.bloomRenderFBO[i]->Bind();
|
||||
globalFramebuffers.bloomRenderFBO[i]->AddColorBuffer( GL_RGBA8, 0 );
|
||||
globalFramebuffers.bloomRenderFBO[i]->AttachImage2D( GL_TEXTURE_2D, globalImages->bloomRender[i], 0 );
|
||||
globalFramebuffers.bloomRenderFBO[i]->AttachImage2D( GL_TEXTURE_2D, globalImages->bloomRenderImage[i], 0 );
|
||||
globalFramebuffers.bloomRenderFBO[i]->Check();
|
||||
}
|
||||
|
||||
// SMSAA
|
||||
// AMBIENT OCCLUSION
|
||||
|
||||
for( int i = 0; i < MAX_SSAO_BUFFERS; i++ )
|
||||
{
|
||||
globalFramebuffers.ambientOcclusionFBO[i] = new Framebuffer( va( "_aoRender%i", i ), glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
globalFramebuffers.ambientOcclusionFBO[i]->Bind();
|
||||
globalFramebuffers.ambientOcclusionFBO[i]->AddColorBuffer( GL_RGBA8, 0 );
|
||||
globalFramebuffers.ambientOcclusionFBO[i]->AttachImage2D( GL_TEXTURE_2D, globalImages->ambientOcclusionImage[i], 0 );
|
||||
globalFramebuffers.ambientOcclusionFBO[i]->Check();
|
||||
}
|
||||
|
||||
// SMAA
|
||||
|
||||
globalFramebuffers.smaaEdgesFBO = new Framebuffer( "_smaaEdges", glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
globalFramebuffers.smaaEdgesFBO->Bind();
|
||||
globalFramebuffers.smaaEdgesFBO->AddColorBuffer( GL_RGBA8, 0 );
|
||||
|
@ -213,19 +225,34 @@ void Framebuffer::CheckFramebuffers()
|
|||
globalFramebuffers.hdrQuarterFBO->Check();
|
||||
*/
|
||||
|
||||
// BLOOOM
|
||||
for( int i = 0; i < 2; i++ )
|
||||
// BLOOM
|
||||
|
||||
for( int i = 0; i < MAX_BLOOM_BUFFERS; i++ )
|
||||
{
|
||||
globalImages->bloomRender[i]->Resize( glConfig.nativeScreenWidth / 4, glConfig.nativeScreenHeight / 4 );
|
||||
globalImages->bloomRenderImage[i]->Resize( glConfig.nativeScreenWidth / 4, glConfig.nativeScreenHeight / 4 );
|
||||
|
||||
globalFramebuffers.bloomRenderFBO[i]->width = glConfig.nativeScreenWidth / 4;
|
||||
globalFramebuffers.bloomRenderFBO[i]->height = glConfig.nativeScreenHeight / 4;
|
||||
|
||||
globalFramebuffers.bloomRenderFBO[i]->Bind();
|
||||
globalFramebuffers.bloomRenderFBO[i]->AttachImage2D( GL_TEXTURE_2D, globalImages->bloomRender[i], 0 );
|
||||
globalFramebuffers.bloomRenderFBO[i]->AttachImage2D( GL_TEXTURE_2D, globalImages->bloomRenderImage[i], 0 );
|
||||
globalFramebuffers.bloomRenderFBO[i]->Check();
|
||||
}
|
||||
|
||||
// AMBIENT OCCLUSION
|
||||
|
||||
for( int i = 0; i < MAX_SSAO_BUFFERS; i++ )
|
||||
{
|
||||
globalImages->ambientOcclusionImage[i]->Resize( glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
|
||||
globalFramebuffers.ambientOcclusionFBO[i]->width = glConfig.nativeScreenWidth;
|
||||
globalFramebuffers.ambientOcclusionFBO[i]->height = glConfig.nativeScreenHeight;
|
||||
|
||||
globalFramebuffers.ambientOcclusionFBO[i]->Bind();
|
||||
globalFramebuffers.ambientOcclusionFBO[i]->AttachImage2D( GL_TEXTURE_2D, globalImages->ambientOcclusionImage[i], 0 );
|
||||
globalFramebuffers.ambientOcclusionFBO[i]->Check();
|
||||
}
|
||||
|
||||
// SMAA
|
||||
|
||||
globalImages->smaaEdgesImage->Resize( glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
|
@ -257,12 +284,7 @@ void Framebuffer::Shutdown()
|
|||
|
||||
void Framebuffer::Bind()
|
||||
{
|
||||
#if 0
|
||||
if( r_logFile.GetBool() )
|
||||
{
|
||||
RB_LogComment( "--- Framebuffer::Bind( name = '%s' ) ---\n", fboName.c_str() );
|
||||
}
|
||||
#endif
|
||||
RENDERLOG_PRINTF( "Framebuffer::Bind( %s )\n", fboName.c_str() );
|
||||
|
||||
if( backEnd.glState.currentFramebuffer != this )
|
||||
{
|
||||
|
@ -278,6 +300,8 @@ bool Framebuffer::IsBound()
|
|||
|
||||
void Framebuffer::Unbind()
|
||||
{
|
||||
RENDERLOG_PRINTF( "Framebuffer::Unbind()\n" );
|
||||
|
||||
//if(backEnd.glState.framebuffer != NULL)
|
||||
{
|
||||
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue