1// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QT3DRENDER_RENDER_UNIFORMBLOCKBUILDER_P_H
5#define QT3DRENDER_RENDER_UNIFORMBLOCKBUILDER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qhash.h>
19#include <Qt3DRender/private/shaderdata_p.h>
20#include <Qt3DRender/private/qt3drender_global_p.h>
21
22QT_BEGIN_NAMESPACE
23
24namespace Qt3DRender {
25namespace Render {
26
27class ShaderDataManager;
28class TextureManager;
29
30typedef QHash<int, QVariant> UniformBlockValueBuilderHash;
31
32struct Q_3DRENDERSHARED_PRIVATE_EXPORT UniformBlockValueBuilder
33{
34 explicit UniformBlockValueBuilder(const std::vector<int> &uniformNamesIds,
35 ShaderDataManager *shaderDataManager,
36 TextureManager *textureManager,
37 const Matrix4x4 &matrix);
38
39 void buildActiveUniformNameValueMapHelper(const ShaderData *currentShaderData,
40 const QString &blockName,
41 const int propertyInBlockNameId,
42 const int propertyNameId,
43 const ShaderData::PropertyValue *value);
44 void buildActiveUniformNameValueMapStructHelper(ShaderData *rShaderData,
45 const QString &blockName,
46 const QString &qmlPropertyName = QString());
47
48 UniformBlockValueBuilderHash activeUniformNamesToValue;
49
50private:
51 const std::vector<int> &m_uniformNamesIds;
52 ShaderDataManager *m_shaderDataManager = nullptr;
53 TextureManager *m_textureManager = nullptr;
54 const Matrix4x4 &m_viewMatrix;
55};
56
57} // namespace Render
58} // namespace Qt3DRender
59
60QT_END_NAMESPACE
61
62#endif // QT3DRENDER_RENDER_UNIFORMBLOCKBUILDER_P_H
63

source code of qt3d/src/render/jobs/uniformblockbuilder_p.h