Go to the documentation of this file.
18 #ifndef GZ_GUI_PLUGINS_MINIMALSCENE_HH_
19 #define GZ_GUI_PLUGINS_MINIMALSCENE_HH_
24 #include <gz/common/KeyEvent.hh>
25 #include <gz/common/MouseEvent.hh>
26 #include <gz/math/Color.hh>
27 #include <gz/math/Pose3.hh>
28 #include <gz/math/Vector2.hh>
29 #include <gz/utils/ImplPtr.hh>
86 public slots:
void OnHovered(
int _mouseX,
int _mouseY);
97 int _mouseX,
int _mouseY);
119 IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
137 public:
void Render(RenderSync *_renderSync);
145 public:
void Destroy();
158 public:
void NewDropEvent(
const std::string &_dropText,
170 private:
void HandleMouseEvent();
173 private:
void BroadcastHoverPos();
176 private:
void BroadcastDrag();
179 private:
void BroadcastLeftClick();
182 private:
void BroadcastRightClick();
185 private:
void BroadcastMousePress();
188 private:
void BroadcastScroll();
191 private:
void BroadcastKeyRelease();
194 private:
void BroadcastDrop();
197 private:
void BroadcastKeyPress();
221 public:
double cameraNearClip = 0.01;
224 public:
double cameraFarClip = 1000.0;
233 public:
bool initialized =
false;
239 public:
bool textureDirty =
false;
242 public:
bool skyEnable =
false;
252 IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
266 public slots:
void RenderNext(RenderSync *_renderSync);
269 public slots:
void ShutDown();
272 public slots:
void SizeChanged();
278 signals:
void TextureReady(uint _id,
const QSize &_size);
288 public: QOffscreenSurface *surface =
nullptr;
291 public: QOpenGLContext *context =
nullptr;
310 public:
void SetBackgroundColor(
const math::Color &_color);
314 public:
void SetAmbientLight(
const math::Color &_ambient);
318 public:
void SetEngineName(
const std::string &_name);
322 public:
void SetSceneName(
const std::string &_name);
330 public:
void SetCameraNearClip(
double _near);
334 public:
void SetCameraFarClip(
double _far);
339 public:
void OnHovered(
const gz::math::Vector2i &_hoverPos);
345 const gz::math::Vector2i &_dropPos);
349 public:
void SetSkyEnabled(
const bool &_sky);
353 public:
void SetCameraHFOV(
const math::Angle &_fov);
357 public:
void SetCameraViewController(
const std::string &_view_controller);
360 public Q_SLOTS:
void Ready();
375 public:
void StopRendering();
378 protected:
virtual void mousePressEvent(
QMouseEvent *_e)
override;
381 protected:
virtual void mouseReleaseEvent(
QMouseEvent *_e)
override;
384 protected:
virtual void mouseMoveEvent(
QMouseEvent *_e)
override;
387 protected:
virtual void keyPressEvent(
QKeyEvent *_e)
override;
390 protected:
virtual void keyReleaseEvent(
QKeyEvent *_e)
override;
393 protected:
virtual void wheelEvent(
QWheelEvent *_e)
override;
401 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
402 QQuickItem::UpdatePaintNodeData *_data)
override;
406 IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
418 public:
explicit TextureNode(QQuickWindow *_window,
419 RenderSync &_renderSync);
428 public slots:
void NewTexture(uint _id,
const QSize &_size);
432 public slots:
void PrepareNode();
435 signals:
void TextureInUse(RenderSync *_renderSync);
439 signals:
void PendingNewTexture();
454 public: QSGTexture *texture =
nullptr;
457 public: QQuickWindow *window =
nullptr;
Q_INVOKABLE void SetLoadingError(const QString &_loadingError)
Set the loading error message.
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: MinimalScene.hh:294
Creates a Gazebo rendering scene and user camera. It is possible to orbit the camera around the scene...
Definition: MinimalScene.hh:68
std::function< void(const QString &)> errorCb
Function to be called if there are errors.
Definition: MinimalScene.hh:285
void OnFocusWindow()
Callback when the mouse enters the render window to focus the window for mouse/key events.
GLuint textureId
Render texture id.
Definition: MinimalScene.hh:209
void OnHovered(int _mouseX, int _mouseY)
Callback when the mouse hovers to a new position.
Texture node for displaying the render texture from gz-renderer.
Definition: MinimalScene.hh:410
Base class for Gazebo GUI plugins.
Definition: gz/gui/Plugin.hh:54
Q_INVOKABLE QString LoadingError() const
Get the loading error string.
RenderSync & renderSync
See RenderSync.
Definition: MinimalScene.hh:451
void OnDropped(const QString &_drop, int _mouseX, int _mouseY)
Callback when receives a drop event.
QString loadingError
Loading error message.
Definition: MinimalScene.hh:78
QMutex mutex
Mutex to protect the texture variables.
Definition: MinimalScene.hh:448
Rendering thread.
Definition: MinimalScene.hh:256
A QQUickItem that manages the render window.
Definition: MinimalScene.hh:298
Ign-rendering renderer. All ign-rendering calls should be performed inside this class as it makes sur...
Definition: MinimalScene.hh:130
Definition: gz/gui/Application.hh:35
virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override
Load the plugin with a configuration file. Override this on custom plugins to handle custom configura...
void LoadingErrorChanged()
Notify that loading error has changed.