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
5#ifndef QSSG_RENDER_GRAPH_OBJECT_H
6#define QSSG_RENDER_GRAPH_OBJECT_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is part of the QtQuick3D API, with limited compatibility guarantees.
13// Usage of this API may make your code source and binary incompatible with
14// future versions of Qt.
15//
16
17#include <QtQuick3DRuntimeRender/qtquick3druntimerenderexports.h>
18#include <QtCore/QDebug>
19#include <QtCore/qtconfigmacros.h>
20#include <QtQuick/qtquickglobal.h>
21
23
24// NOTE: Duplicat to avoid pulling in private headers
25#ifndef Q_QUICK3D_PROFILE_ID
26# if QT_CONFIG(qml_debug)
27# define Q_QUICK3D_PROFILE_ID_ qint32 profilingId = -1;
28# else
29# define Q_QUICK3D_PROFILE_ID_
30# endif
31#else
32# define Q_QUICK3D_PROFILE_ID_ Q_QUICK3D_PROFILE_ID
33#endif
34
35
37{
38 Q_DISABLE_COPY_MOVE(QSSGRenderGraphObject)
39public:
40 // Types should be setup on construction. Change the type
41 // at your own risk as the type is used for RTTI purposes.
42 // See QSSGRenderGraphObject, QQuick3DObject and QSSceneDesc (asset useage).
43
44 enum BaseType : quint32 {
45 // Internal types
46 Node = 0x1000,
47 Light = 0x2000,
48 Camera = 0x4000,
49 Renderable = 0x8000,
50 Resource = 0x10000,
51 Material = 0x20000,
52 Texture = 0x40000,
53 Extension = 0x80000,
54 User = 0x80000000,
55 };
56
57 enum class Type : quint32 {
59 // Nodes
61 Root, // Node
62 Layer, // Node
63 Joint, // Node
64 Skeleton, // Node (A resource to the model node)
65 ImportScene, // Node
67 // Light nodes
71 // Camera nodes
74 CustomFrustumCamera, // Perspective camera with user specified frustum bounds.
76 // Renderable nodes
77 Model = BaseType::Renderable | BaseType::Node, // Renderable Node
78 Item2D, // Renderable Node
79 Particles, // Renderable Node
80 // Resources
82 Effect, // Resource
83 Geometry, // Resource
84 TextureData, // Resource
85 MorphTarget, // Resource
86 ModelInstance, // Resource
87 ModelBlendParticle, // Resource
88 ResourceLoader, // Resource [meta]
89 // Materials
91 PrincipledMaterial, // Resource
92 CustomMaterial, // Resource
94 Skin, // Resource
95 // Textures
97 ImageCube, // Resource
99 TextureProvider, // Extension
100 // User types E.g.: (User | Node) + 1)
101 };
102 using TypeT = std::underlying_type_t<Type>;
103
104 enum class Flags : quint32 {
106 };
107 using FlagT = std::underlying_type_t<Flags>;
108
109 [[nodiscard]] static constexpr bool isNodeType(Type type) noexcept
110 {
111 return (TypeT(type) & BaseType::Node);
112 }
113
114 [[nodiscard]] static constexpr bool isLight(Type type) noexcept
115 {
116 return (TypeT(type) & BaseType::Light);
117 }
118
119 [[nodiscard]] static constexpr bool isCamera(Type type) noexcept
120 {
121 return (TypeT(type) & BaseType::Camera);
122 }
123
124 [[nodiscard]] static constexpr bool isMaterial(Type type) noexcept
125 {
126 return (TypeT(type) & BaseType::Material);
127 }
128
129 [[nodiscard]] static constexpr bool isTexture(Type type) noexcept
130 {
131 return (TypeT(type) & BaseType::Texture);
132 }
133
134 [[nodiscard]] static constexpr bool isRenderable(Type type) noexcept
135 {
136 return (TypeT(type) & BaseType::Renderable);
137 }
138
139 [[nodiscard]] static constexpr bool isResource(Type type) noexcept
140 {
141 return (TypeT(type) & BaseType::Resource);
142 }
143
144 [[nodiscard]] static constexpr bool isExtension(Type type) noexcept
145 {
146 return (TypeT(type) & BaseType::Extension);
147 }
148
149 // Note: This could have been a non-static member, as we never create or use
150 // user types we do the built-in types; In any case just follow the existing pattern.
151 [[nodiscard]] static constexpr bool isUserType(Type type) noexcept
152 {
153 return (TypeT(type) & BaseType::User);
154 }
155
156 // Objects tagged with HasGraphicsResources get special handling and will be queued for release
157 // on the render thread after the frame has been submitted. See cleanupNodes() in the scene manager.
158 [[nodiscard]] inline bool hasGraphicsResources() const noexcept
159 {
160 return ((flags & FlagT(Flags::HasGraphicsResources)) != 0);
161 }
162
163 const Type type;
166
167 virtual ~QSSGRenderGraphObject();
168
169#ifndef QT_NO_DEBUG_STREAM
170 friend Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug stream, QSSGRenderGraphObject::Type type);
171#endif
172
173protected:
174 explicit QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType);
175 explicit QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType, FlagT inFlags) : type(inType), flags(inFlags) {}
176};
177
178#ifndef QT_NO_DEBUG_STREAM
179Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug, QSSGRenderGraphObject::Type type);
180#endif
181
182QT_END_NAMESPACE
183
184#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
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
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_