Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qssgrendermotionvectormap_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QSSG_RENDER_MOTIONVECTORMAP_H
6#define QSSG_RENDER_MOTIONVECTORMAP_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuick3DRuntimeRender/private/qtquick3druntimerenderglobal_p.h>
20#include <QtGui/QMatrix4x4>
21#include <QtGui/QVector3D>
22#include <QtCore/QHash>
23#include <QtCore/QByteArray>
24#include <QtQuick3DUtils/private/qssgrenderbasetypes_p.h>
25#include <QtQuick3DRuntimeRender/private/qssgrenderableobjects_p.h>
26
27QT_BEGIN_NAMESPACE
28
29class QSSGRhiContext;
31class QRhiRenderBuffer;
32class QRhiTextureRenderTarget;
33class QRhiRenderPassDescriptor;
34class QRhiTexture;
35
36class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderMotionVectorMap
37{
38 Q_DISABLE_COPY(QSSGRenderMotionVectorMap)
39public:
40 struct MotionResultData {
41 QMatrix4x4 prevModelViewProjection;
42 QMatrix4x4 prevInstanceLocal;
43 QMatrix4x4 prevInstanceGlobal;
44 QSSGRenderImageTexture prevBoneTexture;
45 QSSGRenderImageTexture prevInstanceTexture;
46 QSSGRenderImageTexture currentMorphWeightTexture;
47 QSSGRenderImageTexture prevMorphWeightTexture;
48 };
49
51 ~QSSGRenderMotionVectorMap();
52
53 void endFrame();
54 MotionResultData trackMotionData(const void *modelKey,
55 const QMatrix4x4 &currentModelViewProjection,
56 const QMatrix4x4 &currentInstanceLocal,
57 const QMatrix4x4 &currentInstanceGlobal,
58 QSSGRenderTextureData *currentBoneTextureData,
59 QSSGRenderInstanceTable *currentInstanceTable,
60 const QVector<float> &currentMorphWeights);
61
62 void releaseCachedResources();
63
64private:
65 struct MotionStoreData {
66 QMatrix4x4 prevModelViewProjection;
67 QMatrix4x4 prevInstanceLocal;
68 QMatrix4x4 prevInstanceGlobal;
69 std::shared_ptr<QSSGRenderTextureData> prevBoneTextureData;
70 std::shared_ptr<QSSGRenderTextureData> prevInstanceTextureData;
71 std::shared_ptr<QSSGRenderTextureData> currentMorphWeightTextureData;
72 std::shared_ptr<QSSGRenderTextureData> prevMorphWeightTextureData;
73 QSize lastPrevBoneTextureDataSize;
74 QSize lastPrevInstanceTextureDataSize;
75 QSize lastPrevMorphWeightTextureDataSize;
76 QSize lastCurrentMorphWeightTextureDataSize;
77 int frameAge = 0;
78 };
79
80 const QSSGRenderContextInterface &m_context;
81 QHash<const void*, MotionStoreData> m_cache;
82
83 void cleanupStaleEntries();
84 void releaseEntryResources(MotionStoreData& entry);
85 QSSGRenderImageTexture loadAndReleaseIfNeeded(const std::shared_ptr<QSSGRenderTextureData>& textureData, QSize lastSize);
86};
87
88using QSSGRenderMotionVectorMapPtr = std::shared_ptr<QSSGRenderMotionVectorMap>;
89
90QT_END_NAMESPACE
91
92#endif // QSSG_RENDER_MOTIONVECTORMAP_H
virtual void endFrame()
Called when the RHI ends rendering a in the context.
QSSGRenderMotionVectorMap(const QSSGRenderContextInterface &inContext)
MotionResultData trackMotionData(const void *modelKey, const QMatrix4x4 &currentModelViewProjection, const QMatrix4x4 &currentInstanceLocal, const QMatrix4x4 &currentInstanceGlobal, QSSGRenderTextureData *currentBoneTextureData, QSSGRenderInstanceTable *currentInstanceTable, const QVector< float > &currentMorphWeights)
friend class QSSGRenderContextInterface