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