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
qssgrendergraphobject.h
Go to the documentation of this file.
1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2023 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6
7#ifndef QSSG_RENDER_GRAPH_OBJECT_H
8#define QSSG_RENDER_GRAPH_OBJECT_H
9
10//
11// W A R N I N G
12// -------------
13//
14// This file is part of the QtQuick3D API, with limited compatibility guarantees.
15// Usage of this API may make your code source and binary incompatible with
16// future versions of Qt.
17//
18
19#include <QtQuick3DRuntimeRender/qtquick3druntimerenderexports.h>
20#include <QtCore/QDebug>
21#include <QtCore/qtconfigmacros.h>
22#include <QtQuick/qtquickglobal.h>
23
25
26// NOTE: Duplicat to avoid pulling in private headers
27#ifndef Q_QUICK3D_PROFILE_ID
28# if QT_CONFIG(qml_debug)
29# define Q_QUICK3D_PROFILE_ID_ qint32 profilingId = -1;
30# else
31# define Q_QUICK3D_PROFILE_ID_
32# endif
33#else
34# define Q_QUICK3D_PROFILE_ID_ Q_QUICK3D_PROFILE_ID
35#endif
36
37
39{
40 Q_DISABLE_COPY_MOVE(QSSGRenderGraphObject)
41public:
42 // Types should be setup on construction. Change the type
43 // at your own risk as the type is used for RTTI purposes.
44 // See QSSGRenderGraphObject, QQuick3DObject and QSSceneDesc (asset useage).
45
46 enum BaseType : quint32 {
47 // Internal types
48 Node = 0x1000,
49 Light = 0x2000,
50 Camera = 0x4000,
51 Renderable = 0x8000,
52 Resource = 0x10000,
53 Material = 0x20000,
54 Texture = 0x40000,
55 Extension = 0x80000,
56 User = 0x80000000,
57 };
58
59 enum class Type : quint32 {
61 // Nodes
63 Root, // Node
64 Layer, // Node
65 Joint, // Node
66 Skeleton, // Node (A resource to the model node)
67 ImportScene, // Node
69 SceneRoot, // Node
70 // Light nodes
74 // Camera nodes
77 CustomFrustumCamera, // Perspective camera with user specified frustum bounds.
79 // Renderable nodes
80 Model = BaseType::Renderable | BaseType::Node, // Renderable Node
81 Item2D, // Renderable Node
82 Particles, // Renderable Node
83 // Resources
85 Effect, // Resource
86 Geometry, // Resource
87 TextureData, // Resource
88 MorphTarget, // Resource
89 ModelInstance, // Resource
90 ModelBlendParticle, // Resource
91 ResourceLoader, // Resource [meta]
92 RenderPass, // Resource
93 SkyMaterial, // Resource
94 Skin, // Resource
95 // Materials
97 PrincipledMaterial, // Resource
98 CustomMaterial, // Resource
100 LegacySkin, // Reserved; Type::Skin had this value before Qt 6.13. Never construct an object with it.
101 // Textures
103 ImageCube, // Resource
105 TextureProvider, // Extension
106 // User types E.g.: (User | Node) + 1)
107 };
108 using TypeT = std::underlying_type_t<Type>;
109
110 enum class Flags : quint32 {
112 InternallyReserved = 0xffff0000,
113 };
114 using FlagT = std::underlying_type_t<Flags>;
115
116 [[nodiscard]] static constexpr bool isNodeType(Type type) noexcept
117 {
118 return (TypeT(type) & BaseType::Node);
119 }
120
121 [[nodiscard]] static constexpr bool isLight(Type type) noexcept
122 {
123 return (TypeT(type) & BaseType::Light);
124 }
125
126 [[nodiscard]] static constexpr bool isCamera(Type type) noexcept
127 {
128 return (TypeT(type) & BaseType::Camera);
129 }
130
131 [[nodiscard]] static constexpr bool isMaterial(Type type) noexcept
132 {
133 // Type::Skin had the LegacySkin value, in the material range, before
134 // Qt 6.13. Keep rejecting it here in case it reaches us from code
135 // built against the older headers, where the value was inlined.
136 return (TypeT(type) & BaseType::Material) && (type != Type::LegacySkin);
137 }
138
139 [[nodiscard]] static constexpr bool isTexture(Type type) noexcept
140 {
141 return (TypeT(type) & BaseType::Texture);
142 }
143
144 [[nodiscard]] static constexpr bool isRenderable(Type type) noexcept
145 {
146 return (TypeT(type) & BaseType::Renderable);
147 }
148
149 [[nodiscard]] static constexpr bool isResource(Type type) noexcept
150 {
151 return (TypeT(type) & BaseType::Resource);
152 }
153
154 [[nodiscard]] static constexpr bool isExtension(Type type) noexcept
155 {
156 return (TypeT(type) & BaseType::Extension);
157 }
158
159 // Note: This could have been a non-static member, as we never create or use
160 // user types we do the built-in types; In any case just follow the existing pattern.
161 [[nodiscard]] static constexpr bool isUserType(Type type) noexcept
162 {
163 return (TypeT(type) & BaseType::User);
164 }
165
166 // Objects tagged with HasGraphicsResources get special handling and will be queued for release
167 // on the render thread after the frame has been submitted. See cleanupNodes() in the scene manager.
168 [[nodiscard]] inline bool hasGraphicsResources() const noexcept
169 {
170 return ((flags & FlagT(Flags::HasGraphicsResources)) != 0);
171 }
172
173 const Type type;
176
177 virtual ~QSSGRenderGraphObject();
178
179#ifndef QT_NO_DEBUG_STREAM
180 friend Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug stream, QSSGRenderGraphObject::Type type);
181#endif
182
183protected:
184 explicit QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType);
185 explicit QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType, FlagT inFlags) : type(inType), flags(inFlags) {}
186};
187
188#ifndef QT_NO_DEBUG_STREAM
189Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug, QSSGRenderGraphObject::Type type);
190#endif
191
192QT_END_NAMESPACE
193
194#endif // QSSG_RENDER_GRAPH_OBJECT_H
Type
\value X11 \value Windows \value MacPrinter \value CoreGraphics \macos's Quartz2D (CoreGraphics) \val...
static constexpr bool isCamera(Type type) noexcept
static constexpr bool isRenderable(Type type) noexcept
static constexpr bool isNodeType(Type type) noexcept
static constexpr bool isUserType(Type type) noexcept
static constexpr bool isExtension(Type type) noexcept
static constexpr bool isResource(Type type) noexcept
static constexpr bool isMaterial(Type type) noexcept
static constexpr bool isTexture(Type type) noexcept
bool hasGraphicsResources() const noexcept
static constexpr bool isLight(Type type) noexcept
Combined button and popup list for selecting options.
QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2620
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2620
Flags
#define RETURN_AS_STRING(T)
static QT_BEGIN_NAMESPACE const char * asString(QSSGRenderGraphObject::Type type)
#define Q_QUICK3D_PROFILE_ID_