summaryrefslogtreecommitdiffstats
path: root/src/plugins/renderers/rhi/renderer/renderview_p.h
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-11-26 11:48:42 +0100
committerPaul Lemire <paul.lemire@kdab.com>2020-11-26 16:42:10 +0100
commit9c682cf8ffe302719df1202d89e560e4fe67739d (patch)
tree744a1d8aeea9e14cf442e359a1110d6860b8ecfe /src/plugins/renderers/rhi/renderer/renderview_p.h
parent1e2902ba3e1285fb2db5a90712135b130fdbbb84 (diff)
Use RHI's clipSpaceCorrMatrix for backend where Y is not up
It's better to rely on RHI instead of a hard coded matrix. Also modify the UBO to provide the clipSpaceCorrectionMatrix and the uncorrected projectionMatrix. All the other matrices we compute and provide use the corrected projectionMatrix but these two new matrices give users the libertity of bypassing the correction if they need to. Pick-to: 6.0 6.0.0 Change-Id: I52e409cc9b38ea0e939d19d92e2ddd907aa7d1cb Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/plugins/renderers/rhi/renderer/renderview_p.h')
-rw-r--r--src/plugins/renderers/rhi/renderer/renderview_p.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/renderers/rhi/renderer/renderview_p.h b/src/plugins/renderers/rhi/renderer/renderview_p.h
index df5fe0438..dad66d2d5 100644
--- a/src/plugins/renderers/rhi/renderer/renderview_p.h
+++ b/src/plugins/renderers/rhi/renderer/renderview_p.h
@@ -125,13 +125,12 @@ struct Q_AUTOTEST_EXPORT BlitFramebufferInfo
QBlitFramebuffer::InterpolationMethod interpolationMethod;
};
-// This class is kind of analogous to RenderBin but I want to avoid trampling
-// on that until we get this working
-
struct RenderViewUBO
{
float viewMatrix[16];
float projectionMatrix[16];
+ float uncorrectedProjectionMatrix[16];
+ float clipCorrectionMatrix[16];
float viewProjectionMatrix[16];
float inverseViewMatrix[16];
float inverseProjectionMatrix[16];
@@ -147,7 +146,7 @@ struct RenderViewUBO
float yUpInNDC;
float yUpInFBO;
};
-static_assert(sizeof(RenderViewUBO) == sizeof(float) * (8 * 16 + 1 * 4 + 1 * 3 + 6 * 1),
+static_assert(sizeof(RenderViewUBO) == sizeof(float) * (10 * 16 + 1 * 4 + 1 * 3 + 6 * 1),
"UBO doesn't match std140");
class Q_AUTOTEST_EXPORT RenderView
@@ -348,6 +347,7 @@ private:
Qt3DCore::QNodeIdVector m_layerFilterIds;
Matrix4x4 m_viewMatrix;
Matrix4x4 m_viewProjectionMatrix;
+ Matrix4x4 m_clipCorrectionMatrix;
Vector3D m_eyePos;
Vector3D m_eyeViewDir;