Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qssgrenderimage.cpp
Go to the documentation of this file.
1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5#include <QtQuick3DRuntimeRender/private/qssgrenderimage_p.h>
6#include <QtQuick/QSGTexture>
7
9
16
18
20{
21 const bool wasDirty = m_flags.testFlag(Flag::Dirty);
22 m_flags.setFlag(Flag::Dirty, false);
23 if (m_flags.testFlag(Flag::TransformDirty)) {
25 return true;
26 }
27 return wasDirty;
28}
29
31{
32 m_flags.setFlag(Flag::TransformDirty, false);
33
35 if (m_flipU) {
36 m_textureTransform *= QMatrix4x4(-1.f, 0.f, 0.f, 1.f,
37 0.f, 1.f, 0.f, 0.f,
38 0.f, 0.f, 1.f, 0.f,
39 0.f, 0.f, 0.f, 1.f);
40 }
41 if (m_flipV) {
42 m_textureTransform *= QMatrix4x4(1.f, 0.f, 0.f, 0.f,
43 0.f, -1.f, 0.f, 1.f,
44 0.f, 0.f, 1.f, 0.f,
45 0.f, 0.f, 0.f, 1.f);
46 }
47
48 QMatrix4x4 pivot;
49 QMatrix4x4 pivot_r;
50 QMatrix4x4 translation;
51 QMatrix4x4 rotation;
53
54 pivot.translate(m_pivot.x(), m_pivot.y());
55 pivot_r.translate(-m_pivot.x(), -m_pivot.y());
56 translation.translate(m_position.x(), m_position.y());
57 scale.scale(m_scale.x(), m_scale.y());
58 rotation.rotate(m_rotation, QVector3D(0, 0, 1));
59
60 m_textureTransform *= translation;
61 m_textureTransform *= pivot;
62 m_textureTransform *= rotation;
64 m_textureTransform *= pivot_r;
65}
66
73
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
void rotate(float angle, const QVector3D &vector)
Multiples this matrix by another that rotates coordinates through angle degrees about vector.
bool isIdentity() const
Returns true if this matrix is the identity; false otherwise.
Definition qmatrix4x4.h:299
void translate(const QVector3D &vector)
Multiplies this matrix by another that translates coordinates by the components of vector.
constexpr float y() const noexcept
Returns the y coordinate of this point.
Definition qvectornd.h:502
constexpr float x() const noexcept
Returns the x coordinate of this point.
Definition qvectornd.h:501
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
Combined button and popup list for selecting options.
GLenum type
GLenum GLenum GLenum GLenum GLenum scale
bool isImageTransformIdentity() const
QSSGRenderImage(QSSGRenderGraphObject::Type type=QSSGRenderGraphObject::Type::Image2D)
QMatrix4x4 m_textureTransform
MappingModes m_mappingMode
void calculateTextureTransform()