소스 검색

g_ModelViewProjectionMatrix should now have the right values for passes (fixes sun not displaying properly in 2882477794)

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
Alexis Maiquez 3 년 전
부모
커밋
6f570be911
2개의 변경된 파일과 7개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      src/WallpaperEngine/Render/Objects/CImage.cpp
  2. 1 0
      src/WallpaperEngine/Render/Objects/CImage.h

+ 6 - 3
src/WallpaperEngine/Render/Objects/CImage.cpp

@@ -222,7 +222,8 @@ CImage::CImage (CScene* scene, Core::Objects::CImage* image) :
             this->getScene ()->getCamera ()->getProjection () *
             this->getScene ()->getCamera ()->getLookAt ();
 
-    this->m_modelViewProjectionPass = glm::ortho <float> (0.0, size.x, 0.0, size.y);
+    this->m_modelViewProjectionPass = glm::mat4(1.0f);
+    this->m_modelViewProjectionCopy = glm::ortho <float> (0.0, size.x, 0.0, size.y);
 }
 
 void CImage::setup ()
@@ -329,13 +330,15 @@ void CImage::setupPasses ()
 
     auto cur = this->m_passes.begin ();
     auto end = this->m_passes.end ();
+    bool first = true;
 
     for (; cur != end; cur ++)
     {
         Effects::CPass* pass = *cur;
         const CFBO* prevDrawTo = drawTo;
-        GLuint spacePosition = this->getCopySpacePosition ();
-        glm::mat4* projection = &this->m_modelViewProjectionPass;
+        GLuint spacePosition = (first) ? this->getCopySpacePosition () : this->getPassSpacePosition ();
+        glm::mat4* projection = (first) ? &this->m_modelViewProjectionCopy : &this->m_modelViewProjectionPass;
+        first = false;
 
         // set viewport and target texture if needed
         if (pass->getMaterial ()->getMaterial ()->hasTarget () == true)

+ 1 - 0
src/WallpaperEngine/Render/Objects/CImage.h

@@ -72,6 +72,7 @@ namespace WallpaperEngine::Render::Objects
 
         glm::mat4 m_modelViewProjectionScreen;
         glm::mat4 m_modelViewProjectionPass;
+        glm::mat4 m_modelViewProjectionCopy;
 
         CFBO* m_mainFBO;
         CFBO* m_subFBO;