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

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