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 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | class QMatrix4x4; |
24 | |
25 | namespace Qt3DRender { |
26 | |
27 | class QTextureImageData; |
28 | |
29 | namespace Render { |
30 | |
31 | class CameraManager; |
32 | class EntityManager; |
33 | class BufferManager; |
34 | class AttributeManager; |
35 | class GeometryManager; |
36 | class GeometryRendererManager; |
37 | class ObjectPickerManager; |
38 | class RayCasterManager; |
39 | class BoundingVolumeDebugManager; |
40 | class MaterialManager; |
41 | class MatrixManager; |
42 | class ShaderManager; |
43 | class ShaderBuilderManager; |
44 | class TechniqueManager; |
45 | class EffectManager; |
46 | class RenderPassManager; |
47 | class RenderTargetManager; |
48 | class SceneManager; |
49 | class AttachmentManager; |
50 | class ParameterManager; |
51 | class ShaderDataManager; |
52 | class TextureImageManager; |
53 | class FilterKeyManager; |
54 | class FrameGraphManager; |
55 | class TransformManager; |
56 | class TextureManager; |
57 | class TextureDataManager; |
58 | class TextureImageDataManager; |
59 | class LayerManager; |
60 | class LevelOfDetailManager; |
61 | class LightManager; |
62 | class EnvironmentLightManager; |
63 | class ComputeCommandManager; |
64 | class RenderStateManager; |
65 | class ArmatureManager; |
66 | class SkeletonManager; |
67 | class JointManager; |
68 | class ShaderImageManager; |
69 | class PickingProxyManager; |
70 | |
71 | class FrameGraphNode; |
72 | class Entity; |
73 | class CameraLens; |
74 | class Material; |
75 | class Shader; |
76 | class ShaderBuilder; |
77 | class Technique; |
78 | class Effect; |
79 | class RenderPass; |
80 | class Texture; |
81 | class Layer; |
82 | class LevelOfDetail; |
83 | class FilterKey; |
84 | class FrameGraphNode; |
85 | class Transform; |
86 | class Scene; |
87 | class RenderTargetOutput; |
88 | class RenderTarget; |
89 | class ShaderData; |
90 | class Parameter; |
91 | class TextureImage; |
92 | class Buffer; |
93 | class Attribute; |
94 | class Geometry; |
95 | class GeometryRenderer; |
96 | class ObjectPicker; |
97 | class RayCaster; |
98 | //class BoundingVolumeDebug; |
99 | class Light; |
100 | class EnvironmentLight; |
101 | class ComputeCommand; |
102 | class RenderStateNode; |
103 | class Armature; |
104 | class Skeleton; |
105 | class Joint; |
106 | class ShaderImage; |
107 | class PickingProxy; |
108 | |
109 | |
110 | class Q_3DRENDERSHARED_PRIVATE_EXPORT NodeManagers |
111 | { |
112 | public: |
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 | |
188 | private: |
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 | |
230 | template<> |
231 | Q_3DRENDERSHARED_PRIVATE_EXPORT CameraManager *NodeManagers::manager<CameraLens>() const noexcept; |
232 | |
233 | template<> |
234 | Q_3DRENDERSHARED_PRIVATE_EXPORT EntityManager *NodeManagers::manager<Entity>() const noexcept; |
235 | |
236 | template<> |
237 | Q_3DRENDERSHARED_PRIVATE_EXPORT MaterialManager *NodeManagers::manager<Material>() const noexcept; |
238 | |
239 | template<> |
240 | Q_3DRENDERSHARED_PRIVATE_EXPORT MatrixManager *NodeManagers::manager<QMatrix4x4*>() const noexcept; |
241 | |
242 | template<> |
243 | Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderManager *NodeManagers::manager<Shader>() const noexcept; |
244 | |
245 | template<> |
246 | Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderBuilderManager *NodeManagers::manager<ShaderBuilder>() const noexcept; |
247 | |
248 | template<> |
249 | Q_3DRENDERSHARED_PRIVATE_EXPORT TechniqueManager *NodeManagers::manager<Technique>() const noexcept; |
250 | |
251 | template<> |
252 | Q_3DRENDERSHARED_PRIVATE_EXPORT EffectManager *NodeManagers::manager<Effect>() const noexcept; |
253 | |
254 | template<> |
255 | Q_3DRENDERSHARED_PRIVATE_EXPORT RenderPassManager *NodeManagers::manager<RenderPass>() const noexcept; |
256 | |
257 | template<> |
258 | Q_3DRENDERSHARED_PRIVATE_EXPORT TextureManager *NodeManagers::manager<Texture>() const noexcept; |
259 | |
260 | template<> |
261 | Q_3DRENDERSHARED_PRIVATE_EXPORT LayerManager *NodeManagers::manager<Layer>() const noexcept; |
262 | |
263 | template<> |
264 | Q_3DRENDERSHARED_PRIVATE_EXPORT LevelOfDetailManager *NodeManagers::manager<LevelOfDetail>() const noexcept; |
265 | |
266 | template<> |
267 | Q_3DRENDERSHARED_PRIVATE_EXPORT FilterKeyManager *NodeManagers::manager<FilterKey>() const noexcept; |
268 | |
269 | template<> |
270 | Q_3DRENDERSHARED_PRIVATE_EXPORT FrameGraphManager *NodeManagers::manager<FrameGraphNode*>() const noexcept; |
271 | |
272 | template<> |
273 | Q_3DRENDERSHARED_PRIVATE_EXPORT TransformManager *NodeManagers::manager<Transform>() const noexcept; |
274 | |
275 | template<> |
276 | Q_3DRENDERSHARED_PRIVATE_EXPORT RenderTargetManager *NodeManagers::manager<RenderTarget>() const noexcept; |
277 | |
278 | template<> |
279 | Q_3DRENDERSHARED_PRIVATE_EXPORT SceneManager *NodeManagers::manager<Scene>() const noexcept; |
280 | |
281 | template<> |
282 | Q_3DRENDERSHARED_PRIVATE_EXPORT AttachmentManager *NodeManagers::manager<RenderTargetOutput>() const noexcept; |
283 | |
284 | template<> |
285 | Q_3DRENDERSHARED_PRIVATE_EXPORT ParameterManager *NodeManagers::manager<Parameter>() const noexcept; |
286 | |
287 | template<> |
288 | Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderDataManager *NodeManagers::manager<ShaderData>() const noexcept; |
289 | |
290 | template<> |
291 | Q_3DRENDERSHARED_PRIVATE_EXPORT BufferManager *NodeManagers::manager<Buffer>() const noexcept; |
292 | |
293 | template<> |
294 | Q_3DRENDERSHARED_PRIVATE_EXPORT TextureImageManager *NodeManagers::manager<TextureImage>() const noexcept; |
295 | |
296 | template<> |
297 | Q_3DRENDERSHARED_PRIVATE_EXPORT AttributeManager *NodeManagers::manager<Attribute>() const noexcept; |
298 | |
299 | template<> |
300 | Q_3DRENDERSHARED_PRIVATE_EXPORT GeometryManager *NodeManagers::manager<Geometry>() const noexcept; |
301 | |
302 | template<> |
303 | Q_3DRENDERSHARED_PRIVATE_EXPORT GeometryRendererManager *NodeManagers::manager<GeometryRenderer>() const noexcept; |
304 | |
305 | template<> |
306 | Q_3DRENDERSHARED_PRIVATE_EXPORT ObjectPickerManager *NodeManagers::manager<ObjectPicker>() const noexcept; |
307 | |
308 | template<> |
309 | Q_3DRENDERSHARED_PRIVATE_EXPORT RayCasterManager *NodeManagers::manager<RayCaster>() const noexcept; |
310 | |
311 | //template<> |
312 | //Q_3DRENDERSHARED_PRIVATE_EXPORT BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const noexcept; |
313 | |
314 | template<> |
315 | LightManager *NodeManagers::manager<Light>() const noexcept; |
316 | |
317 | template<> |
318 | EnvironmentLightManager *NodeManagers::manager<EnvironmentLight>() const noexcept; |
319 | |
320 | template<> |
321 | Q_3DRENDERSHARED_PRIVATE_EXPORT ComputeCommandManager *NodeManagers::manager<ComputeCommand>() const noexcept; |
322 | |
323 | template<> |
324 | Q_3DRENDERSHARED_PRIVATE_EXPORT RenderStateManager *NodeManagers::manager<RenderStateNode>() const noexcept; |
325 | |
326 | template<> |
327 | Q_3DRENDERSHARED_PRIVATE_EXPORT ArmatureManager *NodeManagers::manager<Armature>() const noexcept; |
328 | |
329 | template<> |
330 | Q_3DRENDERSHARED_PRIVATE_EXPORT SkeletonManager *NodeManagers::manager<Skeleton>() const noexcept; |
331 | |
332 | template<> |
333 | Q_3DRENDERSHARED_PRIVATE_EXPORT JointManager *NodeManagers::manager<Joint>() const noexcept; |
334 | |
335 | template<> |
336 | Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderImageManager *NodeManagers::manager<ShaderImage>() const noexcept; |
337 | |
338 | template<> |
339 | Q_3DRENDERSHARED_PRIVATE_EXPORT PickingProxyManager *NodeManagers::manager<PickingProxy>() const noexcept; |
340 | |
341 | } // Render |
342 | |
343 | } // Qt3DRender |
344 | |
345 | QT_END_NAMESPACE |
346 | |
347 | |
348 | #endif // NODEMANAGERS_H |
349 | |