Sfoglia il codice sorgente

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>
Alexis Maiquez 3 anni fa
parent
commit
0843f69edf

+ 1 - 11
src/WallpaperEngine/Render/CScene.cpp

@@ -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)
@@ -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_sceneFBO = this->_rt_FullFrameBuffer;
-
     // use the scene's framebuffer by default
     glBindFramebuffer (GL_FRAMEBUFFER, this->getWallpaperFramebuffer());
     // ensure we render over the whole screen
@@ -258,12 +254,6 @@ void CScene::renderFrame (glm::ivec4 viewport)
 
     for (; cur != end; cur ++)
         (*cur)->render ();
-
-    if (this->getScene ()->isBloom () == true)
-    {
-        this->m_sceneFBO = this->_rt_imageCompositeLayer_bloom;
-        this->m_bloomObject->render ();
-    }
 }
 
 void CScene::updateMouse (glm::ivec4 viewport)

+ 0 - 2
src/WallpaperEngine/Render/CScene.h

@@ -44,7 +44,5 @@ namespace WallpaperEngine::Render
         CFBO* _rt_4FrameBuffer;
         CFBO* _rt_8FrameBuffer;
         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;
     };
 }

+ 5 - 5
src/WallpaperEngine/Render/CWallpaper.cpp

@@ -257,12 +257,12 @@ void CWallpaper::render (glm::ivec4 viewport, bool renderFrame, bool newFrame)
     if (heightRatio < 0.0f) heightRatio = -heightRatio;
 
     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
     };
 
     glBindBuffer (GL_ARRAY_BUFFER, this->m_positionBuffer);

+ 5 - 5
src/WallpaperEngine/Render/Objects/CImage.cpp

@@ -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)
     GLfloat sceneSpacePosition [] = {
-        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.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.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.w, 0.0f,
+        this->m_pos.z, this->m_pos.y, 0.0f
     };
 
     GLfloat copySpacePosition [] = {