Gazebo Gui

API Reference

7.2.2
MinimalSceneRhiOpenGL.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_MINIMALSCENERHIOPENGL_HH_
19 #define GZ_GUI_PLUGINS_MINIMALSCENE_MINIMALSCENERHIOPENGL_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 namespace gz::gui::plugins
32 {
34  class GzCameraTextureRhiOpenGLPrivate;
35 
38  {
39  // Documentation inherited
40  public: virtual ~GzCameraTextureRhiOpenGL() override;
41 
43  public: GzCameraTextureRhiOpenGL();
44 
45  // Documentation inherited
46  public: virtual void Update(rendering::CameraPtr _camera) override;
47 
48  // Documentation inherited
49  public: virtual void TextureId(void* _texturePtr) override;
50 
53  };
54 
56  class RenderThreadRhiOpenGLPrivate;
57 
60  {
61  // Documentation inherited
62  public: virtual ~RenderThreadRhiOpenGL() override;
63 
66  public: RenderThreadRhiOpenGL(GzRenderer *_renderer);
67 
68  // Documentation inherited
69  public: virtual QOffscreenSurface *Surface() const override;
70 
71  // Documentation inherited
72  public: virtual void SetSurface(QOffscreenSurface *_surface) override;
73 
74  // Documentation inherited
75  public: virtual QOpenGLContext *Context() const override;
76 
77  // Documentation inherited
78  public: virtual void SetContext(QOpenGLContext *_context) override;
79 
80  // Documentation inherited
81  public: virtual std::string Initialize() override;
82 
83  // Documentation inherited
84  public: virtual void RenderNext(RenderSync *_renderSync) override;
85 
86  // Documentation inherited
87  public: virtual void* TexturePtr() const override;
88 
89  // Documentation inherited
90  public: virtual QSize TextureSize() const override;
91 
92  // Documentation inherited
93  public: virtual void ShutDown() override;
94 
96  private: RenderThreadRhiOpenGL(
97  const RenderThreadRhiOpenGL &_other) = delete;
98  private: RenderThreadRhiOpenGL& operator=(
99  const RenderThreadRhiOpenGL &_other) = delete;
100 
103  };
104 
106  class TextureNodeRhiOpenGLPrivate;
107 
110  {
111  // Documentation inherited
112  public: virtual ~TextureNodeRhiOpenGL() override;
113 
116  public: TextureNodeRhiOpenGL(QQuickWindow *_window);
117 
118  // Documentation inherited
119  public: virtual QSGTexture *Texture() const override;
120 
121  // Documentation inherited
122  public: virtual bool HasNewTexture() const override;
123 
124  // Documentation inherited
125  public: virtual void NewTexture(
126  void* _texturePtr, const QSize &_size) override;
127 
128  // Documentation inherited
129  public: virtual void PrepareNode() override;
130 
132  private: TextureNodeRhiOpenGL(
133  const TextureNodeRhiOpenGL &_other) = delete;
134  private: TextureNodeRhiOpenGL& operator=(
135  const TextureNodeRhiOpenGL &_other) = delete;
136 
139  };
140 } // namespace gz::gui::plugins
141 
142 #endif // GZ_GUI_PLUGINS_MINIMALSCENE_MINIMALSCENERHIOPENGL_HH_