QVulkanWindow: return QMatrix4x4 by value
The function never returns nullptr, so return the matrix by value. Change-Id: I7c1eeb43b9693866049763565b575348ddd35548 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
85554be25f
commit
5336e061ec
@ -511,7 +511,7 @@ void Renderer::createFloorPipeline()
|
|||||||
|
|
||||||
void Renderer::initSwapChainResources()
|
void Renderer::initSwapChainResources()
|
||||||
{
|
{
|
||||||
m_proj = *m_window->clipCorrectionMatrix();
|
m_proj = m_window->clipCorrectionMatrix();
|
||||||
const QSize sz = m_window->swapChainImageSize();
|
const QSize sz = m_window->swapChainImageSize();
|
||||||
m_proj.perspective(45.0f, sz.width() / (float) sz.height(), 0.01f, 1000.0f);
|
m_proj.perspective(45.0f, sz.width() / (float) sz.height(), 0.01f, 1000.0f);
|
||||||
markViewProjDirty();
|
markViewProjDirty();
|
||||||
|
@ -675,7 +675,7 @@ void VulkanRenderer::initSwapChainResources()
|
|||||||
qDebug("initSwapChainResources");
|
qDebug("initSwapChainResources");
|
||||||
|
|
||||||
// Projection matrix
|
// Projection matrix
|
||||||
m_proj = *m_window->clipCorrectionMatrix(); // adjust for Vulkan-OpenGL clip space differences
|
m_proj = m_window->clipCorrectionMatrix(); // adjust for Vulkan-OpenGL clip space differences
|
||||||
const QSize sz = m_window->swapChainImageSize();
|
const QSize sz = m_window->swapChainImageSize();
|
||||||
m_proj.perspective(45.0f, sz.width() / (float) sz.height(), 0.01f, 100.0f);
|
m_proj.perspective(45.0f, sz.width() / (float) sz.height(), 0.01f, 100.0f);
|
||||||
m_proj.translate(0, 0, -4);
|
m_proj.translate(0, 0, -4);
|
||||||
|
@ -393,7 +393,7 @@ void TriangleRenderer::initSwapChainResources()
|
|||||||
qDebug("initSwapChainResources");
|
qDebug("initSwapChainResources");
|
||||||
|
|
||||||
// Projection matrix
|
// Projection matrix
|
||||||
m_proj = *m_window->clipCorrectionMatrix(); // adjust for Vulkan-OpenGL clip space differences
|
m_proj = m_window->clipCorrectionMatrix(); // adjust for Vulkan-OpenGL clip space differences
|
||||||
const QSize sz = m_window->swapChainImageSize();
|
const QSize sz = m_window->swapChainImageSize();
|
||||||
m_proj.perspective(45.0f, sz.width() / (float) sz.height(), 0.01f, 100.0f);
|
m_proj.perspective(45.0f, sz.width() / (float) sz.height(), 0.01f, 100.0f);
|
||||||
m_proj.translate(0, 0, -4);
|
m_proj.translate(0, 0, -4);
|
||||||
|
@ -2690,7 +2690,7 @@ QImage QVulkanWindow::grab()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a pointer to a QMatrix4x4 that can be used to correct for coordinate
|
Returns a QMatrix4x4 that can be used to correct for coordinate
|
||||||
system differences between OpenGL and Vulkan.
|
system differences between OpenGL and Vulkan.
|
||||||
|
|
||||||
By pre-multiplying the projection matrix with this matrix, applications can
|
By pre-multiplying the projection matrix with this matrix, applications can
|
||||||
@ -2704,7 +2704,7 @@ QImage QVulkanWindow::grab()
|
|||||||
front face being CCW), the correct winding order in the rasterization state
|
front face being CCW), the correct winding order in the rasterization state
|
||||||
after applying this matrix is clockwise (\c{VK_FRONT_FACE_CLOCKWISE}).
|
after applying this matrix is clockwise (\c{VK_FRONT_FACE_CLOCKWISE}).
|
||||||
*/
|
*/
|
||||||
const QMatrix4x4 *QVulkanWindow::clipCorrectionMatrix()
|
QMatrix4x4 QVulkanWindow::clipCorrectionMatrix()
|
||||||
{
|
{
|
||||||
Q_D(QVulkanWindow);
|
Q_D(QVulkanWindow);
|
||||||
if (d->m_clipCorrect.isIdentity()) {
|
if (d->m_clipCorrect.isIdentity()) {
|
||||||
@ -2714,7 +2714,7 @@ const QMatrix4x4 *QVulkanWindow::clipCorrectionMatrix()
|
|||||||
0.0f, 0.0f, 0.5f, 0.5f,
|
0.0f, 0.0f, 0.5f, 0.5f,
|
||||||
0.0f, 0.0f, 0.0f, 1.0f);
|
0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
return &d->m_clipCorrect;
|
return d->m_clipCorrect;
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -138,7 +138,7 @@ public:
|
|||||||
bool supportsGrab() const;
|
bool supportsGrab() const;
|
||||||
QImage grab();
|
QImage grab();
|
||||||
|
|
||||||
const QMatrix4x4 *clipCorrectionMatrix();
|
QMatrix4x4 clipCorrectionMatrix();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void frameGrabbed(const QImage &image);
|
void frameGrabbed(const QImage &image);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user