Gazebo Gui

API Reference

8.3.0
MinimalSceneRhiVulkan.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_GUI_PLUGINS_MINIMALSCENE_MINIMALSCENERHIVULKAN_HH_
19 #define GZ_GUI_PLUGINS_MINIMALSCENE_MINIMALSCENERHIVULKAN_HH_
20 
21 #include "MinimalSceneRhi.hh"
22 #include "gz/gui/Plugin.hh"
23 
24 #include <QQuickWindow>
25 #include <QSGTexture>
26 #include <QSize>
27 
28 #include <memory>
29 #include <string>
30 
31 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2) && QT_CONFIG(vulkan)
32 namespace gz
33 {
34 namespace gui
35 {
36 namespace plugins
37 {
39  class GzCameraTextureRhiVulkanPrivate;
40 
42  class GzCameraTextureRhiVulkan : public GzCameraTextureRhi
43  {
44  // Documentation inherited
45  public: virtual ~GzCameraTextureRhiVulkan() override;
46 
48  public: GzCameraTextureRhiVulkan();
49 
50  // Documentation inherited
51  public: virtual void Update(rendering::CameraPtr _camera) override;
52 
55  };
56 
58  class RenderThreadRhiVulkanPrivate;
59 
61  class RenderThreadRhiVulkan : public RenderThreadRhi
62  {
63  // Documentation inherited
64  public: virtual ~RenderThreadRhiVulkan() override;
65 
68  public: explicit RenderThreadRhiVulkan(GzRenderer *_renderer);
69 
70  // Documentation inherited
71  public: virtual QOffscreenSurface *Surface() const override;
72 
73  // Documentation inherited
74  public: virtual void SetSurface(QOffscreenSurface *_surface) override;
75 
76  // Documentation inherited
77  public: virtual std::string Initialize() override;
78 
79  // Documentation inherited
80  public: virtual void Update(rendering::CameraPtr _camera) override;
81 
82  // Documentation inherited
83  public: virtual void RenderNext(RenderSync *_renderSync) override;
84 
85  // Documentation inherited
86  public: virtual void* TexturePtr() const override;
87 
88  // Documentation inherited
89  public: virtual QSize TextureSize() const override;
90 
91  // Documentation inherited
92  public: virtual void ShutDown() override;
93 
95  private: RenderThreadRhiVulkan(
96  const RenderThreadRhiVulkan &_other) = delete;
97  private: RenderThreadRhiVulkan& operator=(
98  const RenderThreadRhiVulkan &_other) = delete;
99 
102  };
103 
105  class TextureNodeRhiVulkanPrivate;
106 
108  class TextureNodeRhiVulkan : public TextureNodeRhi
109  {
110  // Documentation inherited
111  public: virtual ~TextureNodeRhiVulkan() override;
112 
116  public: explicit TextureNodeRhiVulkan(QQuickWindow *_window,
117  rendering::CameraPtr &_camera);
118 
119  // Documentation inherited
120  public: virtual QSGTexture *Texture() const override;
121 
122  // Documentation inherited
123  public: virtual bool HasNewTexture() const override;
124 
125  // Documentation inherited
126  public: virtual void NewTexture(
127  void* _texturePtr, const QSize &_size) override;
128 
129  // Documentation inherited
130  public: virtual void PrepareNode() override;
131 
133  private: TextureNodeRhiVulkan(
134  const TextureNodeRhiVulkan &_other) = delete;
135  private: TextureNodeRhiVulkan& operator=(
136  const TextureNodeRhiVulkan &_other) = delete;
137 
140  };
141 }
142 }
143 }
144 
145 #endif
146 
147 #endif