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 | |
57 | QT_BEGIN_NAMESPACE |
58 | |
59 | class QMatrix4x4; |
60 | |
61 | namespace Qt3DRender { |
62 | |
63 | class QTextureImageData; |
64 | |
65 | namespace Render { |
66 | |
67 | class CameraManager; |
68 | class EntityManager; |
69 | class BufferManager; |
70 | class AttributeManager; |
71 | class GeometryManager; |
72 | class GeometryRendererManager; |
73 | class ObjectPickerManager; |
74 | class RayCasterManager; |
75 | class BoundingVolumeDebugManager; |
76 | class MaterialManager; |
77 | class MatrixManager; |
78 | class ShaderManager; |
79 | class ShaderBuilderManager; |
80 | class TechniqueManager; |
81 | class EffectManager; |
82 | class RenderPassManager; |
83 | class RenderTargetManager; |
84 | class SceneManager; |
85 | class AttachmentManager; |
86 | class ParameterManager; |
87 | class ShaderDataManager; |
88 | class TextureImageManager; |
89 | class FilterKeyManager; |
90 | class FrameGraphManager; |
91 | class TransformManager; |
92 | class TextureManager; |
93 | class TextureDataManager; |
94 | class TextureImageDataManager; |
95 | class LayerManager; |
96 | class LevelOfDetailManager; |
97 | class LightManager; |
98 | class EnvironmentLightManager; |
99 | class ComputeCommandManager; |
100 | class RenderStateManager; |
101 | class ArmatureManager; |
102 | class SkeletonManager; |
103 | class JointManager; |
104 | class ShaderImageManager; |
105 | |
106 | class FrameGraphNode; |
107 | class Entity; |
108 | class CameraLens; |
109 | class Material; |
110 | class Shader; |
111 | class ShaderBuilder; |
112 | class Technique; |
113 | class Effect; |
114 | class RenderPass; |
115 | class Texture; |
116 | class Layer; |
117 | class LevelOfDetail; |
118 | class FilterKey; |
119 | class FrameGraphNode; |
120 | class Transform; |
121 | class Scene; |
122 | class RenderTargetOutput; |
123 | class RenderTarget; |
124 | class ShaderData; |
125 | class Parameter; |
126 | class TextureImage; |
127 | class Buffer; |
128 | class Attribute; |
129 | class Geometry; |
130 | class GeometryRenderer; |
131 | class ObjectPicker; |
132 | class RayCaster; |
133 | //class BoundingVolumeDebug; |
134 | class Light; |
135 | class EnvironmentLight; |
136 | class ComputeCommand; |
137 | class RenderStateNode; |
138 | class Armature; |
139 | class Skeleton; |
140 | class Joint; |
141 | class ShaderImage; |
142 | |
143 | |
144 | class Q_3DRENDERSHARED_PRIVATE_EXPORT NodeManagers |
145 | { |
146 | public: |
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 | |
221 | private: |
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 | |
262 | template<> |
263 | Q_3DRENDERSHARED_PRIVATE_EXPORT CameraManager *NodeManagers::manager<CameraLens>() const noexcept; |
264 | |
265 | template<> |
266 | Q_3DRENDERSHARED_PRIVATE_EXPORT EntityManager *NodeManagers::manager<Entity>() const noexcept; |
267 | |
268 | template<> |
269 | Q_3DRENDERSHARED_PRIVATE_EXPORT MaterialManager *NodeManagers::manager<Material>() const noexcept; |
270 | |
271 | template<> |
272 | Q_3DRENDERSHARED_PRIVATE_EXPORT MatrixManager *NodeManagers::manager<QMatrix4x4*>() const noexcept; |
273 | |
274 | template<> |
275 | Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderManager *NodeManagers::manager<Shader>() const noexcept; |
276 | |
277 | template<> |
278 | Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderBuilderManager *NodeManagers::manager<ShaderBuilder>() const noexcept; |
279 | |
280 | template<> |
281 | Q_3DRENDERSHARED_PRIVATE_EXPORT TechniqueManager *NodeManagers::manager<Technique>() const noexcept; |
282 | |
283 | template<> |
284 | Q_3DRENDERSHARED_PRIVATE_EXPORT EffectManager *NodeManagers::manager<Effect>() const noexcept; |
285 | |
286 | template<> |
287 | Q_3DRENDERSHARED_PRIVATE_EXPORT RenderPassManager *NodeManagers::manager<RenderPass>() const noexcept; |
288 | |
289 | template<> |
290 | Q_3DRENDERSHARED_PRIVATE_EXPORT TextureManager *NodeManagers::manager<Texture>() const noexcept; |
291 | |
292 | template<> |
293 | Q_3DRENDERSHARED_PRIVATE_EXPORT LayerManager *NodeManagers::manager<Layer>() const noexcept; |
294 | |
295 | template<> |
296 | Q_3DRENDERSHARED_PRIVATE_EXPORT LevelOfDetailManager *NodeManagers::manager<LevelOfDetail>() const noexcept; |
297 | |
298 | template<> |
299 | Q_3DRENDERSHARED_PRIVATE_EXPORT FilterKeyManager *NodeManagers::manager<FilterKey>() const noexcept; |
300 | |
301 | template<> |
302 | Q_3DRENDERSHARED_PRIVATE_EXPORT FrameGraphManager *NodeManagers::manager<FrameGraphNode*>() const noexcept; |
303 | |
304 | template<> |
305 | Q_3DRENDERSHARED_PRIVATE_EXPORT TransformManager *NodeManagers::manager<Transform>() const noexcept; |
306 | |
307 | template<> |
308 | Q_3DRENDERSHARED_PRIVATE_EXPORT RenderTargetManager *NodeManagers::manager<RenderTarget>() const noexcept; |
309 | |
310 | template<> |
311 | Q_3DRENDERSHARED_PRIVATE_EXPORT SceneManager *NodeManagers::manager<Scene>() const noexcept; |
312 | |
313 | template<> |
314 | Q_3DRENDERSHARED_PRIVATE_EXPORT AttachmentManager *NodeManagers::manager<RenderTargetOutput>() const noexcept; |
315 | |
316 | template<> |
317 | Q_3DRENDERSHARED_PRIVATE_EXPORT ParameterManager *NodeManagers::manager<Parameter>() const noexcept; |
318 | |
319 | template<> |
320 | Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderDataManager *NodeManagers::manager<ShaderData>() const noexcept; |
321 | |
322 | template<> |
323 | Q_3DRENDERSHARED_PRIVATE_EXPORT BufferManager *NodeManagers::manager<Buffer>() const noexcept; |
324 | |
325 | template<> |
326 | Q_3DRENDERSHARED_PRIVATE_EXPORT TextureImageManager *NodeManagers::manager<TextureImage>() const noexcept; |
327 | |
328 | template<> |
329 | Q_3DRENDERSHARED_PRIVATE_EXPORT AttributeManager *NodeManagers::manager<Attribute>() const noexcept; |
330 | |
331 | template<> |
332 | Q_3DRENDERSHARED_PRIVATE_EXPORT GeometryManager *NodeManagers::manager<Geometry>() const noexcept; |
333 | |
334 | template<> |
335 | Q_3DRENDERSHARED_PRIVATE_EXPORT GeometryRendererManager *NodeManagers::manager<GeometryRenderer>() const noexcept; |
336 | |
337 | template<> |
338 | Q_3DRENDERSHARED_PRIVATE_EXPORT ObjectPickerManager *NodeManagers::manager<ObjectPicker>() const noexcept; |
339 | |
340 | template<> |
341 | Q_3DRENDERSHARED_PRIVATE_EXPORT RayCasterManager *NodeManagers::manager<RayCaster>() const noexcept; |
342 | |
343 | //template<> |
344 | //Q_3DRENDERSHARED_PRIVATE_EXPORT BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const noexcept; |
345 | |
346 | template<> |
347 | LightManager *NodeManagers::manager<Light>() const noexcept; |
348 | |
349 | template<> |
350 | EnvironmentLightManager *NodeManagers::manager<EnvironmentLight>() const noexcept; |
351 | |
352 | template<> |
353 | Q_3DRENDERSHARED_PRIVATE_EXPORT ComputeCommandManager *NodeManagers::manager<ComputeCommand>() const noexcept; |
354 | |
355 | template<> |
356 | Q_3DRENDERSHARED_PRIVATE_EXPORT RenderStateManager *NodeManagers::manager<RenderStateNode>() const noexcept; |
357 | |
358 | template<> |
359 | Q_3DRENDERSHARED_PRIVATE_EXPORT ArmatureManager *NodeManagers::manager<Armature>() const noexcept; |
360 | |
361 | template<> |
362 | Q_3DRENDERSHARED_PRIVATE_EXPORT SkeletonManager *NodeManagers::manager<Skeleton>() const noexcept; |
363 | |
364 | template<> |
365 | Q_3DRENDERSHARED_PRIVATE_EXPORT JointManager *NodeManagers::manager<Joint>() const noexcept; |
366 | |
367 | template<> |
368 | Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderImageManager *NodeManagers::manager<ShaderImage>() const noexcept; |
369 | |
370 | } // Render |
371 | |
372 | } // Qt3DRender |
373 | |
374 | QT_END_NAMESPACE |
375 | |
376 | |
377 | #endif // NODEMANAGERS_H |
378 | |