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
96 ShaderStorageImage, // Resource, used only in the frontend object, backends are Image2D/ImageCube
97 ComputePass, // Resource
98 RenderPassTexture, // Resource
99 // Materials
102 CustomMaterial, // Resource
104 LegacySkin, // Reserved; Type::Skin had this value before Qt 6.13. Never construct an object with it.
105 // Textures
107 ImageCube, // Resource
109 TextureProvider, // Extension
110 // User types E.g.: (User | Node) + 1)
111 };
112 using TypeT = std::underlying_type_t<Type>;
113
114 enum class Flags : quint32 {
116 InternallyReserved = 0xffff0000,
117 };
118 using FlagT = std::underlying_type_t<Flags>;
119
120 [[nodiscard]] static constexpr bool isNodeType(Type type) noexcept
121 {
122 return (TypeT(type) & BaseType::Node);
123 }
124
125 [[nodiscard]] static constexpr bool isLight(Type type) noexcept
126 {
127 return (TypeT(type) & BaseType::Light);
128 }
129
130 [[nodiscard]] static constexpr bool isCamera(Type type) noexcept
131 {
132 return (TypeT(type) & BaseType::Camera);
133 }
134
135 [[nodiscard]] static constexpr bool isMaterial(Type type) noexcept
136 {
137 // Type::Skin had the LegacySkin value, in the material range, before
138 // Qt 6.13. Keep rejecting it here in case it reaches us from code
139 // built against the older headers, where the value was inlined.
140 return (TypeT(type) & BaseType::Material) && (type != Type::LegacySkin);
141 }
142
143 [[nodiscard]] static constexpr bool isTexture(Type type) noexcept
144 {
145 return (TypeT(type) & BaseType::Texture);
146 }
147
148 [[nodiscard]] static constexpr bool isRenderable(Type type) noexcept
149 {
150 return (TypeT(type) & BaseType::Renderable);
151 }
152
153 [[nodiscard]] static constexpr bool isResource(Type type) noexcept
154 {
155 return (TypeT(type) & BaseType::Resource);
156 }
157
158 [[nodiscard]] static constexpr bool isExtension(Type type) noexcept
159 {
160 return (TypeT(type) & BaseType::Extension);
161 }
162
163 // Note: This could have been a non-static member, as we never create or use
164 // user types we do the built-in types; In any case just follow the existing pattern.
165 [[nodiscard]] static constexpr bool isUserType(Type type) noexcept
166 {
167 return (TypeT(type) & BaseType::User);
168 }
169
170 // Objects tagged with HasGraphicsResources get special handling and will be queued for release
171 // on the render thread after the frame has been submitted. See cleanupNodes() in the scene manager.
172 [[nodiscard]] inline bool hasGraphicsResources() const noexcept
173 {
174 return ((flags & FlagT(Flags::HasGraphicsResources)) != 0);
175 }
176
177 const Type type;
180
181 virtual ~QSSGRenderGraphObject();
182
183#ifndef QT_NO_DEBUG_STREAM
184 friend Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug stream, QSSGRenderGraphObject::Type type);
185#endif
186
187protected:
188 explicit QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType);
189 explicit QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType, FlagT inFlags) : type(inType), flags(inFlags) {}
190};
191
192#ifndef QT_NO_DEBUG_STREAM
193Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug, QSSGRenderGraphObject::Type type);
194#endif
195
196QT_END_NAMESPACE
197
198#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_