Fix some backgrounds appearing flipped upside down, bloom effect now renders directly into the _rt_FrameBuffer as the flip happens after the scene is drawn completely

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2022-11-04 11:28:10 +01:00
parent ed1efdcd66
commit 0843f69edf
4 changed files with 11 additions and 23 deletions

View File

@ -163,10 +163,8 @@ CScene::CScene (Core::CScene* scene, CContext* context) :
) )
); );
this->_rt_imageCompositeLayer_bloom = this->findFBO ("_rt_imageLayerComposite_-1_b"); this->m_objectsByRenderOrder.push_back (this->m_bloomObject);
} }
this->_rt_FullFrameBuffer = this->m_sceneFBO;
} }
Render::CObject* CScene::createObject (Core::CObject* object) Render::CObject* CScene::createObject (Core::CObject* object)
@ -247,8 +245,6 @@ void CScene::renderFrame (glm::ivec4 viewport)
this->m_parallaxDisplacement.y = glm::mix (this->m_parallaxDisplacement.y, (this->m_mousePosition.y * amount) * influence, delay); this->m_parallaxDisplacement.y = glm::mix (this->m_parallaxDisplacement.y, (this->m_mousePosition.y * amount) * influence, delay);
} }
this->m_sceneFBO = this->_rt_FullFrameBuffer;
// use the scene's framebuffer by default // use the scene's framebuffer by default
glBindFramebuffer (GL_FRAMEBUFFER, this->getWallpaperFramebuffer()); glBindFramebuffer (GL_FRAMEBUFFER, this->getWallpaperFramebuffer());
// ensure we render over the whole screen // ensure we render over the whole screen
@ -258,12 +254,6 @@ void CScene::renderFrame (glm::ivec4 viewport)
for (; cur != end; cur ++) for (; cur != end; cur ++)
(*cur)->render (); (*cur)->render ();
if (this->getScene ()->isBloom () == true)
{
this->m_sceneFBO = this->_rt_imageCompositeLayer_bloom;
this->m_bloomObject->render ();
}
} }
void CScene::updateMouse (glm::ivec4 viewport) void CScene::updateMouse (glm::ivec4 viewport)

View File

@ -44,7 +44,5 @@ namespace WallpaperEngine::Render
CFBO* _rt_4FrameBuffer; CFBO* _rt_4FrameBuffer;
CFBO* _rt_8FrameBuffer; CFBO* _rt_8FrameBuffer;
CFBO* _rt_Bloom; CFBO* _rt_Bloom;
CFBO* _rt_imageCompositeLayer_bloom; // this one doesn't exist on the official wallpaper engine, but our approach requires it
CFBO* _rt_FullFrameBuffer;
}; };
} }

View File

@ -257,12 +257,12 @@ void CWallpaper::render (glm::ivec4 viewport, bool renderFrame, bool newFrame)
if (heightRatio < 0.0f) heightRatio = -heightRatio; if (heightRatio < 0.0f) heightRatio = -heightRatio;
GLfloat position [] = { GLfloat position [] = {
-widthRatio, heightRatio, 0.0f,
widthRatio, heightRatio, 0.0f,
-widthRatio, -heightRatio, 0.0f, -widthRatio, -heightRatio, 0.0f,
widthRatio, -heightRatio, 0.0f, -widthRatio, -heightRatio, 0.0f,
-widthRatio, heightRatio, 0.0f, widthRatio, heightRatio, 0.0f,
-widthRatio, heightRatio, 0.0f, widthRatio, -heightRatio, 0.0f
widthRatio, -heightRatio, 0.0f,
widthRatio, heightRatio, 0.0f
}; };
glBindBuffer (GL_ARRAY_BUFFER, this->m_positionBuffer); glBindBuffer (GL_ARRAY_BUFFER, this->m_positionBuffer);

View File

@ -110,12 +110,12 @@ CImage::CImage (CScene* scene, Core::Objects::CImage* image) :
// build a list of vertices, these might need some change later (or maybe invert the camera) // build a list of vertices, these might need some change later (or maybe invert the camera)
GLfloat sceneSpacePosition [] = { GLfloat sceneSpacePosition [] = {
this->m_pos.x, this->m_pos.w, 0.0f,
this->m_pos.z, this->m_pos.w, 0.0f,
this->m_pos.x, this->m_pos.y, 0.0f, this->m_pos.x, this->m_pos.y, 0.0f,
this->m_pos.z, this->m_pos.y, 0.0f, this->m_pos.x, this->m_pos.y, 0.0f,
this->m_pos.x, this->m_pos.w, 0.0f, this->m_pos.z, this->m_pos.w, 0.0f,
this->m_pos.x, this->m_pos.w, 0.0f, this->m_pos.z, this->m_pos.y, 0.0f
this->m_pos.z, this->m_pos.y, 0.0f,
this->m_pos.z, this->m_pos.w, 0.0f
}; };
GLfloat copySpacePosition [] = { GLfloat copySpacePosition [] = {