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 VAOManager;
79class ShaderManager;
80class ShaderBuilderManager;
81class TechniqueManager;
82class EffectManager;
83class RenderPassManager;
84class RenderTargetManager;
85class SceneManager;
86class AttachmentManager;
87class ParameterManager;
88class ShaderDataManager;
89class GLBufferManager;
90class GLFenceManager;
91class TextureImageManager;
92class FilterKeyManager;
93class FrameGraphManager;
94class TransformManager;
95class GLTextureManager;
96class TextureManager;
97class TextureDataManager;
98class TextureImageDataManager;
99class LayerManager;
100class LevelOfDetailManager;
101class LightManager;
102class EnvironmentLightManager;
103class ComputeCommandManager;
104class RenderStateManager;
105class ArmatureManager;
106class SkeletonManager;
107class JointManager;
108class ShaderImageManager;
109
110class FrameGraphNode;
111class Entity;
112class CameraLens;
113class Material;
114class Shader;
115class ShaderBuilder;
116class Technique;
117class Effect;
118class RenderPass;
119class Texture;
120class Layer;
121class LevelOfDetail;
122class FilterKey;
123class FrameGraphNode;
124class Transform;
125class Scene;
126class RenderTargetOutput;
127class RenderTarget;
128class ShaderData;
129class Parameter;
130class GLBuffer;
131class TextureImage;
132class Buffer;
133class Attribute;
134class Geometry;
135class GeometryRenderer;
136class ObjectPicker;
137class RayCaster;
138//class BoundingVolumeDebug;
139class Light;
140class EnvironmentLight;
141class ComputeCommand;
142class RenderStateNode;
143class Armature;
144class Skeleton;
145class Joint;
146class OpenGLVertexArrayObject;
147class ShaderImage;
148
149class ResourceAccessor;
150
151class Q_3DRENDERSHARED_PRIVATE_EXPORT NodeManagers
152{
153public:
154 NodeManagers();
155 ~NodeManagers();
156
157 template<class Backend, typename Manager>
158 Manager *manager() const noexcept
159 {
160 return nullptr;
161 }
162
163 template<class Backend, typename Manager, typename Key>
164 Backend *lookupResource(const Key &id) const
165 {
166 Manager *mgr = manager<Backend, Manager>();
167 if (mgr != nullptr)
168 return mgr->lookupResource(id);
169 return nullptr;
170 }
171
172 template<class Backend, typename Manager, typename Handle, typename Key>
173 Handle lookupHandle(const Key &id) const
174 {
175 Manager *mgr = manager<Backend, Manager>();
176 if (mgr != nullptr)
177 return mgr->lookupHandle(id);
178 return Handle();
179 }
180
181 template<class Backend, typename Manager, typename Handle>
182 Backend *data(Handle handle)
183 {
184 Manager *mgr = manager<Backend, Manager>();
185 if (mgr != nullptr)
186 return mgr->data(handle);
187 return nullptr;
188 }
189
190
191 inline CameraManager *cameraManager() const noexcept { return m_cameraManager; }
192 inline EntityManager *renderNodesManager() const noexcept { return m_renderNodesManager; }
193 inline MaterialManager *materialManager() const noexcept { return m_materialManager; }
194 inline MatrixManager *worldMatrixManager() const noexcept { return m_worldMatrixManager; }
195 inline VAOManager *vaoManager() const noexcept { return m_vaoManager; }
196 inline ShaderManager *shaderManager() const noexcept { return m_shaderManager; }
197 inline ShaderBuilderManager *shaderBuilderManager() const noexcept { return m_shaderBuilderManager; }
198 inline TechniqueManager *techniqueManager() const noexcept { return m_techniqueManager; }
199 inline EffectManager *effectManager() const noexcept { return m_effectManager; }
200 inline RenderPassManager *renderPassManager() const noexcept { return m_renderPassManager; }
201 inline GLTextureManager *glTextureManager() const noexcept { return m_glTextureManager; }
202 inline TextureManager *textureManager() const noexcept { return m_textureManager; }
203 inline LayerManager *layerManager() const noexcept { return m_layerManager; }
204 inline LevelOfDetailManager *levelOfDetailManager() const noexcept { return m_levelOfDetailManager; }
205 inline FilterKeyManager *filterKeyManager() const noexcept { return m_filterKeyManager; }
206 inline FrameGraphManager *frameGraphManager() const noexcept { return m_frameGraphManager; }
207 inline TransformManager *transformManager() const noexcept { return m_transformManager; }
208 inline RenderTargetManager *renderTargetManager() const noexcept { return m_renderTargetManager; }
209 inline SceneManager *sceneManager() const noexcept { return m_sceneManager; }
210 inline AttachmentManager *attachmentManager() const noexcept { return m_attachmentManager; }
211 inline ParameterManager *parameterManager() const noexcept { return m_parameterManager; }
212 inline ShaderDataManager *shaderDataManager() const noexcept { return m_shaderDataManager; }
213 inline GLBufferManager *glBufferManager() const noexcept { return m_glBufferManager; }
214 inline GLFenceManager *glFenceManager() const noexcept { return m_glFenceManager; }
215 inline TextureImageManager *textureImageManager() const noexcept { return m_textureImageManager; }
216 inline BufferManager *bufferManager() const noexcept { return m_bufferManager; }
217 inline AttributeManager *attributeManager() const noexcept { return m_attributeManager; }
218 inline GeometryManager *geometryManager() const noexcept { return m_geometryManager; }
219 inline GeometryRendererManager *geometryRendererManager() const noexcept { return m_geometryRendererManager; }
220 inline ObjectPickerManager *objectPickerManager() const noexcept { return m_objectPickerManager; }
221 inline RayCasterManager *rayCasterManager() const noexcept { return m_rayCasterManager; }
222 // inline BoundingVolumeDebugManager *boundingVolumeDebugManager() const noexcept { return m_boundingVolumeDebugManager; }
223 inline LightManager *lightManager() const noexcept { return m_lightManager; }
224 inline EnvironmentLightManager *environmentLightManager() const noexcept { return m_environmentLightManager; }
225 inline ComputeCommandManager *computeJobManager() const noexcept { return m_computeJobManager; }
226 inline RenderStateManager *renderStateManager() const noexcept { return m_renderStateManager; }
227 inline ArmatureManager *armatureManager() const noexcept { return m_armatureManager; }
228 inline SkeletonManager *skeletonManager() const noexcept { return m_skeletonManager; }
229 inline JointManager *jointManager() const noexcept { return m_jointManager; }
230 inline ShaderImageManager *shaderImageManager() const noexcept { return m_shaderImageManager; }
231
232 QSharedPointer<ResourceAccessor> resourceAccessor();
233
234private:
235 CameraManager *m_cameraManager;
236 EntityManager *m_renderNodesManager;
237 MaterialManager *m_materialManager;
238 MatrixManager *m_worldMatrixManager;
239 VAOManager *m_vaoManager;
240 ShaderManager *m_shaderManager;
241 ShaderBuilderManager *m_shaderBuilderManager;
242 TechniqueManager *m_techniqueManager;
243 EffectManager *m_effectManager;
244 RenderPassManager *m_renderPassManager;
245 TextureManager *m_textureManager;
246 TextureImageManager *m_textureImageManager;
247 GLTextureManager *m_glTextureManager;
248 LayerManager *m_layerManager;
249 LevelOfDetailManager *m_levelOfDetailManager;
250 FilterKeyManager *m_filterKeyManager;
251 FrameGraphManager *m_frameGraphManager;
252 TransformManager *m_transformManager;
253 RenderTargetManager *m_renderTargetManager;
254 SceneManager *m_sceneManager;
255 AttachmentManager *m_attachmentManager;
256 ParameterManager *m_parameterManager;
257 ShaderDataManager *m_shaderDataManager;
258 GLBufferManager *m_glBufferManager;
259 GLFenceManager *m_glFenceManager;
260 BufferManager *m_bufferManager;
261 AttributeManager *m_attributeManager;
262 GeometryManager *m_geometryManager;
263 GeometryRendererManager *m_geometryRendererManager;
264 ObjectPickerManager *m_objectPickerManager;
265 RayCasterManager *m_rayCasterManager;
266 // BoundingVolumeDebugManager *m_boundingVolumeDebugManager;
267 LightManager *m_lightManager;
268 EnvironmentLightManager *m_environmentLightManager;
269 ComputeCommandManager *m_computeJobManager;
270 RenderStateManager *m_renderStateManager;
271 ArmatureManager *m_armatureManager;
272 SkeletonManager *m_skeletonManager;
273 JointManager *m_jointManager;
274 ShaderImageManager *m_shaderImageManager;
275
276 QSharedPointer<ResourceAccessor> m_resourceAccessor;
277};
278
279// Specializations
280
281template<>
282Q_3DRENDERSHARED_PRIVATE_EXPORT CameraManager *NodeManagers::manager<CameraLens>() const noexcept;
283
284template<>
285Q_3DRENDERSHARED_PRIVATE_EXPORT EntityManager *NodeManagers::manager<Entity>() const noexcept;
286
287template<>
288Q_3DRENDERSHARED_PRIVATE_EXPORT MaterialManager *NodeManagers::manager<Material>() const noexcept;
289
290template<>
291Q_3DRENDERSHARED_PRIVATE_EXPORT MatrixManager *NodeManagers::manager<QMatrix4x4*>() const noexcept;
292
293template<>
294Q_3DRENDERSHARED_PRIVATE_EXPORT VAOManager *NodeManagers::manager<OpenGLVertexArrayObject>() const noexcept;
295
296template<>
297Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderManager *NodeManagers::manager<Shader>() const noexcept;
298
299template<>
300Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderBuilderManager *NodeManagers::manager<ShaderBuilder>() const noexcept;
301
302template<>
303Q_3DRENDERSHARED_PRIVATE_EXPORT TechniqueManager *NodeManagers::manager<Technique>() const noexcept;
304
305template<>
306Q_3DRENDERSHARED_PRIVATE_EXPORT EffectManager *NodeManagers::manager<Effect>() const noexcept;
307
308template<>
309Q_3DRENDERSHARED_PRIVATE_EXPORT RenderPassManager *NodeManagers::manager<RenderPass>() const noexcept;
310
311template<>
312Q_3DRENDERSHARED_PRIVATE_EXPORT TextureManager *NodeManagers::manager<Texture>() const noexcept;
313
314template<>
315Q_3DRENDERSHARED_PRIVATE_EXPORT LayerManager *NodeManagers::manager<Layer>() const noexcept;
316
317template<>
318Q_3DRENDERSHARED_PRIVATE_EXPORT LevelOfDetailManager *NodeManagers::manager<LevelOfDetail>() const noexcept;
319
320template<>
321Q_3DRENDERSHARED_PRIVATE_EXPORT FilterKeyManager *NodeManagers::manager<FilterKey>() const noexcept;
322
323template<>
324Q_3DRENDERSHARED_PRIVATE_EXPORT FrameGraphManager *NodeManagers::manager<FrameGraphNode*>() const noexcept;
325
326template<>
327Q_3DRENDERSHARED_PRIVATE_EXPORT TransformManager *NodeManagers::manager<Transform>() const noexcept;
328
329template<>
330Q_3DRENDERSHARED_PRIVATE_EXPORT RenderTargetManager *NodeManagers::manager<RenderTarget>() const noexcept;
331
332template<>
333Q_3DRENDERSHARED_PRIVATE_EXPORT SceneManager *NodeManagers::manager<Scene>() const noexcept;
334
335template<>
336Q_3DRENDERSHARED_PRIVATE_EXPORT AttachmentManager *NodeManagers::manager<RenderTargetOutput>() const noexcept;
337
338template<>
339Q_3DRENDERSHARED_PRIVATE_EXPORT ParameterManager *NodeManagers::manager<Parameter>() const noexcept;
340
341template<>
342Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderDataManager *NodeManagers::manager<ShaderData>() const noexcept;
343
344template<>
345Q_3DRENDERSHARED_PRIVATE_EXPORT GLBufferManager *NodeManagers::manager<GLBuffer>() const noexcept;
346
347template<>
348Q_3DRENDERSHARED_PRIVATE_EXPORT TextureImageManager *NodeManagers::manager<TextureImage>() const noexcept;
349
350template<>
351Q_3DRENDERSHARED_PRIVATE_EXPORT BufferManager *NodeManagers::manager<Buffer>() const noexcept;
352
353template<>
354Q_3DRENDERSHARED_PRIVATE_EXPORT AttributeManager *NodeManagers::manager<Attribute>() const noexcept;
355
356template<>
357Q_3DRENDERSHARED_PRIVATE_EXPORT GeometryManager *NodeManagers::manager<Geometry>() const noexcept;
358
359template<>
360Q_3DRENDERSHARED_PRIVATE_EXPORT GeometryRendererManager *NodeManagers::manager<GeometryRenderer>() const noexcept;
361
362template<>
363Q_3DRENDERSHARED_PRIVATE_EXPORT ObjectPickerManager *NodeManagers::manager<ObjectPicker>() const noexcept;
364
365template<>
366Q_3DRENDERSHARED_PRIVATE_EXPORT RayCasterManager *NodeManagers::manager<RayCaster>() const noexcept;
367
368//template<>
369//Q_3DRENDERSHARED_PRIVATE_EXPORT BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const noexcept;
370
371template<>
372LightManager *NodeManagers::manager<Light>() const noexcept;
373
374template<>
375EnvironmentLightManager *NodeManagers::manager<EnvironmentLight>() const noexcept;
376
377template<>
378Q_3DRENDERSHARED_PRIVATE_EXPORT ComputeCommandManager *NodeManagers::manager<ComputeCommand>() const noexcept;
379
380template<>
381Q_3DRENDERSHARED_PRIVATE_EXPORT RenderStateManager *NodeManagers::manager<RenderStateNode>() const noexcept;
382
383template<>
384Q_3DRENDERSHARED_PRIVATE_EXPORT ArmatureManager *NodeManagers::manager<Armature>() const noexcept;
385
386template<>
387Q_3DRENDERSHARED_PRIVATE_EXPORT SkeletonManager *NodeManagers::manager<Skeleton>() const noexcept;
388
389template<>
390Q_3DRENDERSHARED_PRIVATE_EXPORT JointManager *NodeManagers::manager<Joint>() const noexcept;
391
392template<>
393Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderImageManager *NodeManagers::manager<ShaderImage>() const noexcept;
394
395} // Render
396
397} // Qt3DRender
398
399QT_END_NAMESPACE
400
401
402#endif // NODEMANAGERS_H
403