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>
89 public slots:
void OnHovered(
int _mouseX,
int _mouseY);
100 int _mouseX,
int _mouseY);
122 IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
140 public:
void Render(RenderSync *_renderSync);
148 public:
void Destroy();
161 public:
void NewDropEvent(
const std::string &_dropText,
173 private:
void HandleMouseEvent();
176 private:
void BroadcastHoverPos();
179 private:
void BroadcastDrag();
182 private:
void BroadcastLeftClick();
185 private:
void BroadcastRightClick();
188 private:
void BroadcastMousePress();
191 private:
void BroadcastScroll();
194 private:
void BroadcastKeyRelease();
197 private:
void BroadcastDrop();
200 private:
void BroadcastKeyPress();
224 public:
double cameraNearClip = 0.01;
227 public:
double cameraFarClip = 1000.0;
230 public:
unsigned int cameraAntiAliasing = 8;
239 public:
bool initialized =
false;
245 public:
bool textureDirty =
false;
248 public:
bool skyEnable =
false;
258 IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
272 public slots:
void RenderNext(RenderSync *_renderSync);
275 public slots:
void ShutDown();
278 public slots:
void SizeChanged();
284 signals:
void TextureReady(uint _id,
const QSize &_size);
294 public: QOffscreenSurface *surface =
nullptr;
297 public: QOpenGLContext *context =
nullptr;
316 public:
void SetBackgroundColor(
const math::Color &_color);
320 public:
void SetAmbientLight(
const math::Color &_ambient);
324 public:
void SetEngineName(
const std::string &_name);
328 public:
void SetSceneName(
const std::string &_name);
336 public:
void SetCameraNearClip(
double _near);
340 public:
void SetCameraFarClip(
double _far);
344 public:
void SetAntiAliasing(
unsigned int _aa);
349 public:
void OnHovered(
const gz::math::Vector2i &_hoverPos);
355 const gz::math::Vector2i &_dropPos);
359 public:
void SetSkyEnabled(
const bool &_sky);
363 public:
void SetCameraHFOV(
const math::Angle &_fov);
367 public:
void SetCameraViewController(
const std::string &_view_controller);
370 public Q_SLOTS:
void Ready();
385 public:
void StopRendering();
388 protected:
virtual void mousePressEvent(
QMouseEvent *_e)
override;
391 protected:
virtual void mouseReleaseEvent(
QMouseEvent *_e)
override;
394 protected:
virtual void mouseMoveEvent(
QMouseEvent *_e)
override;
397 protected:
virtual void keyPressEvent(
QKeyEvent *_e)
override;
400 protected:
virtual void keyReleaseEvent(
QKeyEvent *_e)
override;
403 protected:
virtual void wheelEvent(
QWheelEvent *_e)
override;
411 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
412 QQuickItem::UpdatePaintNodeData *_data)
override;
416 IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
428 public:
explicit TextureNode(QQuickWindow *_window,
429 RenderSync &_renderSync);
438 public slots:
void NewTexture(uint _id,
const QSize &_size);
442 public slots:
void PrepareNode();
445 signals:
void TextureInUse(RenderSync *_renderSync);
449 signals:
void PendingNewTexture();
464 public: QSGTexture *texture =
nullptr;
467 public: QQuickWindow *window =
nullptr;
Q_INVOKABLE void SetLoadingError(const QString &_loadingError)
Set the loading error message.
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: MinimalScene.hh:300
Creates a Gazebo rendering scene and user camera. It is possible to orbit the camera around the scene...
Definition: MinimalScene.hh:71
std::function< void(const QString &)> errorCb
Function to be called if there are errors.
Definition: MinimalScene.hh:291
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:212
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:420
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:461
void OnDropped(const QString &_drop, int _mouseX, int _mouseY)
Callback when receives a drop event.
QString loadingError
Loading error message.
Definition: MinimalScene.hh:81
QMutex mutex
Mutex to protect the texture variables.
Definition: MinimalScene.hh:458
Rendering thread.
Definition: MinimalScene.hh:262
A QQUickItem that manages the render window.
Definition: MinimalScene.hh:304
Ign-rendering renderer. All ign-rendering calls should be performed inside this class as it makes sur...
Definition: MinimalScene.hh:133
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.