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 // Materials
96 PrincipledMaterial, // Resource
97 CustomMaterial, // Resource
99 Skin, // Resource
100 // Textures
102 ImageCube, // Resource
104 TextureProvider, // Extension
105 // User types E.g.: (User | Node) + 1)
106 };
107 using TypeT = std::underlying_type_t<Type>;
108
109 enum class Flags : quint32 {
111 InternallyReserved = 0xffff0000,
112 };
113 using FlagT = std::underlying_type_t<Flags>;
114
115 [[nodiscard]] static constexpr bool isNodeType(Type type) noexcept
116 {
117 return (TypeT(type) & BaseType::Node);
118 }
119
120 [[nodiscard]] static constexpr bool isLight(Type type) noexcept
121 {
122 return (TypeT(type) & BaseType::Light);
123 }
124
125 [[nodiscard]] static constexpr bool isCamera(Type type) noexcept
126 {
127 return (TypeT(type) & BaseType::Camera);
128 }
129
130 [[nodiscard]] static constexpr bool isMaterial(Type type) noexcept
131 {
132 return (TypeT(type) & BaseType::Material);
133 }
134
135 [[nodiscard]] static constexpr bool isTexture(Type type) noexcept
136 {
137 return (TypeT(type) & BaseType::Texture);
138 }
139
140 [[nodiscard]] static constexpr bool isRenderable(Type type) noexcept
141 {
142 return (TypeT(type) & BaseType::Renderable);
143 }
144
145 [[nodiscard]] static constexpr bool isResource(Type type) noexcept
146 {
147 return (TypeT(type) & BaseType::Resource);
148 }
149
150 [[nodiscard]] static constexpr bool isExtension(Type type) noexcept
151 {
152 return (TypeT(type) & BaseType::Extension);
153 }
154
155 // Note: This could have been a non-static member, as we never create or use
156 // user types we do the built-in types; In any case just follow the existing pattern.
157 [[nodiscard]] static constexpr bool isUserType(Type type) noexcept
158 {
159 return (TypeT(type) & BaseType::User);
160 }
161
162 // Objects tagged with HasGraphicsResources get special handling and will be queued for release
163 // on the render thread after the frame has been submitted. See cleanupNodes() in the scene manager.
164 [[nodiscard]] inline bool hasGraphicsResources() const noexcept
165 {
166 return ((flags & FlagT(Flags::HasGraphicsResources)) != 0);
167 }
168
169 const Type type;
172
173 virtual ~QSSGRenderGraphObject();
174
175#ifndef QT_NO_DEBUG_STREAM
176 friend Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug stream, QSSGRenderGraphObject::Type type);
177#endif
178
179protected:
180 explicit QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType);
181 explicit QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType, FlagT inFlags) : type(inType), flags(inFlags) {}
182};
183
184#ifndef QT_NO_DEBUG_STREAM
185Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug, QSSGRenderGraphObject::Type type);
186#endif
187
188QT_END_NAMESPACE
189
190#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:2582
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2582
Flags
#define RETURN_AS_STRING(T)
static QT_BEGIN_NAMESPACE const char * asString(QSSGRenderGraphObject::Type type)
#define Q_QUICK3D_PROFILE_ID_