Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
36class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderGraphObject
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
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 {
58 Unknown = 0,
59 // Nodes
60 Node = BaseType::Node,
61 Layer, // Node
62 Joint, // Node
63 Skeleton, // Node (A resource to the model node)
64 ImportScene, // Node
65 ReflectionProbe,
66 // Light nodes
67 DirectionalLight = BaseType::Light | BaseType::Node,
68 PointLight,
69 SpotLight,
70 // Camera nodes
71 OrthographicCamera = BaseType::Camera | BaseType::Node,
72 PerspectiveCamera,
73 CustomFrustumCamera, // Perspective camera with user specified frustum bounds.
74 CustomCamera,
75 // Renderable nodes
76 Model = BaseType::Renderable | BaseType::Node, // Renderable Node
77 Item2D, // Renderable Node
78 Particles, // Renderable Node
79 // Resources
80 SceneEnvironment = BaseType::Resource, // Resource
81 Effect, // Resource
82 Geometry, // Resource
83 TextureData, // Resource
84 MorphTarget, // Resource
85 ModelInstance, // Resource
86 ModelBlendParticle, // Resource
87 ResourceLoader, // Resource [meta]
88 // Materials
89 DefaultMaterial = BaseType::Material | BaseType::Resource, // Resource
90 PrincipledMaterial, // Resource
91 CustomMaterial, // Resource
92 SpecularGlossyMaterial, //Resource
93 Skin, // Resource
94 // Textures
95 Image2D = BaseType::Texture | BaseType::Resource, // Resource
96 ImageCube, // Resource
97 RenderExtension = BaseType::Extension, // Extension
98 // User types E.g.: (User | Node) + 1)
99 };
100 using TypeT = std::underlying_type_t<Type>;
101
102 enum class Flags : quint32 {
103 HasGraphicsResources = 0x1
104 };
105 using FlagT = std::underlying_type_t<Flags>;
106
107 [[nodiscard]] static constexpr bool isNodeType(Type type) noexcept
108 {
109 return (TypeT(type) & BaseType::Node);
110 }
111
112 [[nodiscard]] static constexpr bool isLight(Type type) noexcept
113 {
114 return (TypeT(type) & BaseType::Light);
115 }
116
117 [[nodiscard]] static constexpr bool isCamera(Type type) noexcept
118 {
119 return (TypeT(type) & BaseType::Camera);
120 }
121
122 [[nodiscard]] static constexpr bool isMaterial(Type type) noexcept
123 {
124 return (TypeT(type) & BaseType::Material);
125 }
126
127 [[nodiscard]] static constexpr bool isTexture(Type type) noexcept
128 {
129 return (TypeT(type) & BaseType::Texture);
130 }
131
132 [[nodiscard]] static constexpr bool isRenderable(Type type) noexcept
133 {
134 return (TypeT(type) & BaseType::Renderable);
135 }
136
137 [[nodiscard]] static constexpr bool isResource(Type type) noexcept
138 {
139 return (TypeT(type) & BaseType::Resource);
140 }
141
142 [[nodiscard]] static constexpr bool isExtension(Type type) noexcept
143 {
144 return (TypeT(type) & BaseType::Extension);
145 }
146
147 // Note: This could have been a non-static member, as we never create or use
148 // user types we do the built-in types; In any case just follow the existing pattern.
149 [[nodiscard]] static constexpr bool isUserType(Type type) noexcept
150 {
151 return (TypeT(type) & BaseType::User);
152 }
153
154 // Objects tagged with HasGraphicsResources get special handling and will be queued for release
155 // on the render thread after the frame has been submitted. See cleanupNodes() in the scene manager.
156 [[nodiscard]] inline bool hasGraphicsResources() const noexcept
157 {
158 return ((flags & FlagT(Flags::HasGraphicsResources)) != 0);
159 }
160
161 const Type type;
164
165 virtual ~QSSGRenderGraphObject();
166
167#ifndef QT_NO_DEBUG_STREAM
168 friend Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug stream, QSSGRenderGraphObject::Type type);
169#endif
170
171protected:
173 explicit QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType, FlagT inFlags) : type(inType), flags(inFlags) {}
174};
175
176#ifndef QT_NO_DEBUG_STREAM
177Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug, QSSGRenderGraphObject::Type type);
178#endif
179
181
182#endif // QSSG_RENDER_GRAPH_OBJECT_H
Definition lalr.h:136
\inmodule QtCore
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
QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType, FlagT inFlags)
std::underlying_type_t< Type > TypeT
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
std::underlying_type_t< Flags > FlagT
QSSGRenderGraphObject(QSSGRenderGraphObject::Type inType)
Combined button and popup list for selecting options.
EGLStreamKHR stream
@ User
GLenum type
GLbitfield flags
Q_QUICK3DRUNTIMERENDER_EXPORT QDebug operator<<(QDebug, QSSGRenderGraphObject::Type type)
#define Q_QUICK3D_PROFILE_ID_
unsigned int quint32
Definition qtypes.h:50
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
Definition moc.h:23