1// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QT3DRENDER_RENDER_NODEMANAGERS_H
5#define QT3DRENDER_RENDER_NODEMANAGERS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <Qt3DCore/private/qresourcemanager_p.h>
19#include <Qt3DRender/private/qt3drender_global_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QMatrix4x4;
24
25namespace Qt3DRender {
26
27class QTextureImageData;
28
29namespace Render {
30
31class CameraManager;
32class EntityManager;
33class BufferManager;
34class AttributeManager;
35class GeometryManager;
36class GeometryRendererManager;
37class ObjectPickerManager;
38class RayCasterManager;
39class BoundingVolumeDebugManager;
40class MaterialManager;
41class MatrixManager;
42class ShaderManager;
43class ShaderBuilderManager;
44class TechniqueManager;
45class EffectManager;
46class RenderPassManager;
47class RenderTargetManager;
48class SceneManager;
49class AttachmentManager;
50class ParameterManager;
51class ShaderDataManager;
52class TextureImageManager;
53class FilterKeyManager;
54class FrameGraphManager;
55class TransformManager;
56class TextureManager;
57class TextureDataManager;
58class TextureImageDataManager;
59class LayerManager;
60class LevelOfDetailManager;
61class LightManager;
62class EnvironmentLightManager;
63class ComputeCommandManager;
64class RenderStateManager;
65class ArmatureManager;
66class SkeletonManager;
67class JointManager;
68class ShaderImageManager;
69class PickingProxyManager;
70
71class FrameGraphNode;
72class Entity;
73class CameraLens;
74class Material;
75class Shader;
76class ShaderBuilder;
77class Technique;
78class Effect;
79class RenderPass;
80class Texture;
81class Layer;
82class LevelOfDetail;
83class FilterKey;
84class FrameGraphNode;
85class Transform;
86class Scene;
87class RenderTargetOutput;
88class RenderTarget;
89class ShaderData;
90class Parameter;
91class TextureImage;
92class Buffer;
93class Attribute;
94class Geometry;
95class GeometryRenderer;
96class ObjectPicker;
97class RayCaster;
98//class BoundingVolumeDebug;
99class Light;
100class EnvironmentLight;
101class ComputeCommand;
102class RenderStateNode;
103class Armature;
104class Skeleton;
105class Joint;
106class ShaderImage;
107class PickingProxy;
108
109
110class Q_3DRENDERSHARED_PRIVATE_EXPORT NodeManagers
111{
112public:
113 NodeManagers();
114 ~NodeManagers();
115
116 template<class Backend, typename Manager>
117 Manager *manager() const noexcept
118 {
119 return nullptr;
120 }
121
122 template<class Backend, typename Manager, typename Key>
123 Backend *lookupResource(const Key &id) const
124 {
125 Manager *mgr = manager<Backend, Manager>();
126 if (mgr != nullptr)
127 return mgr->lookupResource(id);
128 return nullptr;
129 }
130
131 template<class Backend, typename Manager, typename Handle, typename Key>
132 Handle lookupHandle(const Key &id) const
133 {
134 Manager *mgr = manager<Backend, Manager>();
135 if (mgr != nullptr)
136 return mgr->lookupHandle(id);
137 return Handle();
138 }
139
140 template<class Backend, typename Manager, typename Handle>
141 Backend *data(Handle handle)
142 {
143 Manager *mgr = manager<Backend, Manager>();
144 if (mgr != nullptr)
145 return mgr->data(handle);
146 return nullptr;
147 }
148
149
150 inline CameraManager *cameraManager() const noexcept { return m_cameraManager; }
151 inline EntityManager *renderNodesManager() const noexcept { return m_renderNodesManager; }
152 inline MaterialManager *materialManager() const noexcept { return m_materialManager; }
153 inline MatrixManager *worldMatrixManager() const noexcept { return m_worldMatrixManager; }
154 inline ShaderManager *shaderManager() const noexcept { return m_shaderManager; }
155 inline ShaderBuilderManager *shaderBuilderManager() const noexcept { return m_shaderBuilderManager; }
156 inline TechniqueManager *techniqueManager() const noexcept { return m_techniqueManager; }
157 inline EffectManager *effectManager() const noexcept { return m_effectManager; }
158 inline RenderPassManager *renderPassManager() const noexcept { return m_renderPassManager; }
159 inline TextureManager *textureManager() const noexcept { return m_textureManager; }
160 inline LayerManager *layerManager() const noexcept { return m_layerManager; }
161 inline LevelOfDetailManager *levelOfDetailManager() const noexcept { return m_levelOfDetailManager; }
162 inline FilterKeyManager *filterKeyManager() const noexcept { return m_filterKeyManager; }
163 inline FrameGraphManager *frameGraphManager() const noexcept { return m_frameGraphManager; }
164 inline TransformManager *transformManager() const noexcept { return m_transformManager; }
165 inline RenderTargetManager *renderTargetManager() const noexcept { return m_renderTargetManager; }
166 inline SceneManager *sceneManager() const noexcept { return m_sceneManager; }
167 inline AttachmentManager *attachmentManager() const noexcept { return m_attachmentManager; }
168 inline ParameterManager *parameterManager() const noexcept { return m_parameterManager; }
169 inline ShaderDataManager *shaderDataManager() const noexcept { return m_shaderDataManager; }
170 inline TextureImageManager *textureImageManager() const noexcept { return m_textureImageManager; }
171 inline BufferManager *bufferManager() const noexcept { return m_bufferManager; }
172 inline AttributeManager *attributeManager() const noexcept { return m_attributeManager; }
173 inline GeometryManager *geometryManager() const noexcept { return m_geometryManager; }
174 inline GeometryRendererManager *geometryRendererManager() const noexcept { return m_geometryRendererManager; }
175 inline ObjectPickerManager *objectPickerManager() const noexcept { return m_objectPickerManager; }
176 inline RayCasterManager *rayCasterManager() const noexcept { return m_rayCasterManager; }
177 // inline BoundingVolumeDebugManager *boundingVolumeDebugManager() const noexcept { return m_boundingVolumeDebugManager; }
178 inline LightManager *lightManager() const noexcept { return m_lightManager; }
179 inline EnvironmentLightManager *environmentLightManager() const noexcept { return m_environmentLightManager; }
180 inline ComputeCommandManager *computeJobManager() const noexcept { return m_computeJobManager; }
181 inline RenderStateManager *renderStateManager() const noexcept { return m_renderStateManager; }
182 inline ArmatureManager *armatureManager() const noexcept { return m_armatureManager; }
183 inline SkeletonManager *skeletonManager() const noexcept { return m_skeletonManager; }
184 inline JointManager *jointManager() const noexcept { return m_jointManager; }
185 inline ShaderImageManager *shaderImageManager() const noexcept { return m_shaderImageManager; }
186 inline PickingProxyManager *pickingProxyManager() const noexcept { return m_pickingProxyManager; }
187
188private:
189 CameraManager *m_cameraManager;
190 EntityManager *m_renderNodesManager;
191 MaterialManager *m_materialManager;
192 MatrixManager *m_worldMatrixManager;
193 ShaderManager *m_shaderManager;
194 ShaderBuilderManager *m_shaderBuilderManager;
195 TechniqueManager *m_techniqueManager;
196 EffectManager *m_effectManager;
197 RenderPassManager *m_renderPassManager;
198 TextureManager *m_textureManager;
199 TextureImageManager *m_textureImageManager;
200 LayerManager *m_layerManager;
201 LevelOfDetailManager *m_levelOfDetailManager;
202 FilterKeyManager *m_filterKeyManager;
203 FrameGraphManager *m_frameGraphManager;
204 TransformManager *m_transformManager;
205 RenderTargetManager *m_renderTargetManager;
206 SceneManager *m_sceneManager;
207 AttachmentManager *m_attachmentManager;
208 ParameterManager *m_parameterManager;
209 ShaderDataManager *m_shaderDataManager;
210 BufferManager *m_bufferManager;
211 AttributeManager *m_attributeManager;
212 GeometryManager *m_geometryManager;
213 GeometryRendererManager *m_geometryRendererManager;
214 ObjectPickerManager *m_objectPickerManager;
215 RayCasterManager *m_rayCasterManager;
216 // BoundingVolumeDebugManager *m_boundingVolumeDebugManager;
217 LightManager *m_lightManager;
218 EnvironmentLightManager *m_environmentLightManager;
219 ComputeCommandManager *m_computeJobManager;
220 RenderStateManager *m_renderStateManager;
221 ArmatureManager *m_armatureManager;
222 SkeletonManager *m_skeletonManager;
223 JointManager *m_jointManager;
224 ShaderImageManager *m_shaderImageManager;
225 PickingProxyManager *m_pickingProxyManager;
226};
227
228// Specializations
229
230template<>
231Q_3DRENDERSHARED_PRIVATE_EXPORT CameraManager *NodeManagers::manager<CameraLens>() const noexcept;
232
233template<>
234Q_3DRENDERSHARED_PRIVATE_EXPORT EntityManager *NodeManagers::manager<Entity>() const noexcept;
235
236template<>
237Q_3DRENDERSHARED_PRIVATE_EXPORT MaterialManager *NodeManagers::manager<Material>() const noexcept;
238
239template<>
240Q_3DRENDERSHARED_PRIVATE_EXPORT MatrixManager *NodeManagers::manager<QMatrix4x4*>() const noexcept;
241
242template<>
243Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderManager *NodeManagers::manager<Shader>() const noexcept;
244
245template<>
246Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderBuilderManager *NodeManagers::manager<ShaderBuilder>() const noexcept;
247
248template<>
249Q_3DRENDERSHARED_PRIVATE_EXPORT TechniqueManager *NodeManagers::manager<Technique>() const noexcept;
250
251template<>
252Q_3DRENDERSHARED_PRIVATE_EXPORT EffectManager *NodeManagers::manager<Effect>() const noexcept;
253
254template<>
255Q_3DRENDERSHARED_PRIVATE_EXPORT RenderPassManager *NodeManagers::manager<RenderPass>() const noexcept;
256
257template<>
258Q_3DRENDERSHARED_PRIVATE_EXPORT TextureManager *NodeManagers::manager<Texture>() const noexcept;
259
260template<>
261Q_3DRENDERSHARED_PRIVATE_EXPORT LayerManager *NodeManagers::manager<Layer>() const noexcept;
262
263template<>
264Q_3DRENDERSHARED_PRIVATE_EXPORT LevelOfDetailManager *NodeManagers::manager<LevelOfDetail>() const noexcept;
265
266template<>
267Q_3DRENDERSHARED_PRIVATE_EXPORT FilterKeyManager *NodeManagers::manager<FilterKey>() const noexcept;
268
269template<>
270Q_3DRENDERSHARED_PRIVATE_EXPORT FrameGraphManager *NodeManagers::manager<FrameGraphNode*>() const noexcept;
271
272template<>
273Q_3DRENDERSHARED_PRIVATE_EXPORT TransformManager *NodeManagers::manager<Transform>() const noexcept;
274
275template<>
276Q_3DRENDERSHARED_PRIVATE_EXPORT RenderTargetManager *NodeManagers::manager<RenderTarget>() const noexcept;
277
278template<>
279Q_3DRENDERSHARED_PRIVATE_EXPORT SceneManager *NodeManagers::manager<Scene>() const noexcept;
280
281template<>
282Q_3DRENDERSHARED_PRIVATE_EXPORT AttachmentManager *NodeManagers::manager<RenderTargetOutput>() const noexcept;
283
284template<>
285Q_3DRENDERSHARED_PRIVATE_EXPORT ParameterManager *NodeManagers::manager<Parameter>() const noexcept;
286
287template<>
288Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderDataManager *NodeManagers::manager<ShaderData>() const noexcept;
289
290template<>
291Q_3DRENDERSHARED_PRIVATE_EXPORT BufferManager *NodeManagers::manager<Buffer>() const noexcept;
292
293template<>
294Q_3DRENDERSHARED_PRIVATE_EXPORT TextureImageManager *NodeManagers::manager<TextureImage>() const noexcept;
295
296template<>
297Q_3DRENDERSHARED_PRIVATE_EXPORT AttributeManager *NodeManagers::manager<Attribute>() const noexcept;
298
299template<>
300Q_3DRENDERSHARED_PRIVATE_EXPORT GeometryManager *NodeManagers::manager<Geometry>() const noexcept;
301
302template<>
303Q_3DRENDERSHARED_PRIVATE_EXPORT GeometryRendererManager *NodeManagers::manager<GeometryRenderer>() const noexcept;
304
305template<>
306Q_3DRENDERSHARED_PRIVATE_EXPORT ObjectPickerManager *NodeManagers::manager<ObjectPicker>() const noexcept;
307
308template<>
309Q_3DRENDERSHARED_PRIVATE_EXPORT RayCasterManager *NodeManagers::manager<RayCaster>() const noexcept;
310
311//template<>
312//Q_3DRENDERSHARED_PRIVATE_EXPORT BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const noexcept;
313
314template<>
315LightManager *NodeManagers::manager<Light>() const noexcept;
316
317template<>
318EnvironmentLightManager *NodeManagers::manager<EnvironmentLight>() const noexcept;
319
320template<>
321Q_3DRENDERSHARED_PRIVATE_EXPORT ComputeCommandManager *NodeManagers::manager<ComputeCommand>() const noexcept;
322
323template<>
324Q_3DRENDERSHARED_PRIVATE_EXPORT RenderStateManager *NodeManagers::manager<RenderStateNode>() const noexcept;
325
326template<>
327Q_3DRENDERSHARED_PRIVATE_EXPORT ArmatureManager *NodeManagers::manager<Armature>() const noexcept;
328
329template<>
330Q_3DRENDERSHARED_PRIVATE_EXPORT SkeletonManager *NodeManagers::manager<Skeleton>() const noexcept;
331
332template<>
333Q_3DRENDERSHARED_PRIVATE_EXPORT JointManager *NodeManagers::manager<Joint>() const noexcept;
334
335template<>
336Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderImageManager *NodeManagers::manager<ShaderImage>() const noexcept;
337
338template<>
339Q_3DRENDERSHARED_PRIVATE_EXPORT PickingProxyManager *NodeManagers::manager<PickingProxy>() const noexcept;
340
341} // Render
342
343} // Qt3DRender
344
345QT_END_NAMESPACE
346
347
348#endif // NODEMANAGERS_H
349

source code of qt3d/src/render/backend/nodemanagers_p.h