Go to the documentation of this file.
18 #ifndef GZ_GUI_PLUGINS_SCENE3D_HH_
19 #define GZ_GUI_PLUGINS_SCENE3D_HH_
25 #include <gz/math/Color.hh>
26 #include <gz/math/Pose3.hh>
27 #include <gz/math/Vector2.hh>
28 #include <gz/math/Vector3.hh>
30 #include <gz/common/MouseEvent.hh>
41 class IgnRendererPrivate;
42 class RenderWindowItemPrivate;
87 public slots:
void OnHovered(
int _mouseX,
int _mouseY);
116 private:
std::unique_ptr<Scene3DPrivate> dataPtr;
134 public:
void Render();
142 public:
void Destroy();
156 public:
void HandleKeyPress(
QKeyEvent *_e);
160 public:
void HandleKeyRelease(
QKeyEvent *_e);
163 private:
void HandleMouseEvent();
166 private:
void HandleMouseViewControl();
169 private:
void BroadcastHoverPos();
172 private:
void BroadcastLeftClick();
175 private:
void BroadcastRightClick();
185 public: GLuint textureId = 0u;
203 public:
bool initialized =
false;
209 public:
bool textureDirty =
false;
242 public slots:
void RenderNext();
245 public slots:
void ShutDown();
248 public slots:
void SizeChanged();
254 signals:
void TextureReady(
int _id,
const QSize &_size);
264 public: QOffscreenSurface *surface =
nullptr;
267 public: QOpenGLContext *context =
nullptr;
288 public:
void SetBackgroundColor(
const math::Color &_color);
292 public:
void SetAmbientLight(
const math::Color &_ambient);
296 public:
void SetEngineName(
const std::string &_name);
300 public:
void SetSceneName(
const std::string &_name);
310 public:
void SetSceneService(
const std::string &_service);
316 public:
void SetPoseTopic(
const std::string &_topic);
322 public:
void SetDeletionTopic(
const std::string &_topic);
327 public:
void SetSceneTopic(
const std::string &_topic);
332 public:
void OnHovered(
const gz::math::Vector2i &_hoverPos);
335 public Q_SLOTS:
void Ready();
339 public:
void HandleKeyPress(
QKeyEvent *_e);
343 public:
void HandleKeyRelease(
QKeyEvent *_e);
346 protected:
virtual void mousePressEvent(
QMouseEvent *_e)
override;
349 protected:
virtual void mouseReleaseEvent(
QMouseEvent *_e)
override;
352 protected:
virtual void mouseMoveEvent(
QMouseEvent *_e)
override;
355 protected:
virtual void wheelEvent(
QWheelEvent *_e)
override;
363 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
364 QQuickItem::UpdatePaintNodeData *_data)
override;
382 public:
explicit TextureNode(QQuickWindow *_window);
391 public slots:
void NewTexture(
int _id,
const QSize &_size);
395 public slots:
void PrepareNode();
399 signals:
void TextureInUse();
403 signals:
void PendingNewTexture();
415 public: QSGTexture *texture =
nullptr;
418 public: QQuickWindow *window =
nullptr;
QString loadingError
Loading error message.
Definition: Scene3D.hh:76
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:270
virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override
Load the plugin with a configuration file. Override this on custom plugins to handle custom configura...
std::string sceneService
Scene service. If not empty, a request will be made to get the scene information using this service a...
Definition: Scene3D.hh:214
std::function< void(const QString &)> errorCb
Function to be called if there are errors.
Definition: Scene3D.hh:261
void OnFocusWindow()
Callback when the mouse enters the render window to focus the window for mouse/key events.
bool eventFilter(QObject *_obj, QEvent *_event) override
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:376
static const Vector2< T > Zero
Base class for Gazebo GUI plugins.
Definition: gz/gui/Plugin.hh:54
void LoadingErrorChanged()
Notify that loading error has changed.
std::string poseTopic
Scene pose topic. If not empty, a node will subcribe to this topic to get pose updates of objects in ...
Definition: Scene3D.hh:218
std::string deletionTopic
Ign-transport deletion topic name.
Definition: Scene3D.hh:221
Creates an ignition rendering scene and user camera. It is possible to orbit the camera around the sc...
Definition: Scene3D.hh:66
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:412
Rendering thread.
Definition: Scene3D.hh:234
A QQUickItem that manages the render window.
Definition: Scene3D.hh:275
Ign-rendering renderer. All ign-rendering calls should be performed inside this class as it makes sur...
Definition: Scene3D.hh:125
void OnHovered(int _mouseX, int _mouseY)
Callback when the mouse hovers to a new position.
Definition: gz/gui/Application.hh:35
std::string sceneTopic
Ign-transport scene topic name New scene messages will be published to this topic when an entities ar...
Definition: Scene3D.hh:226
Q_INVOKABLE QString LoadingError() const
Get the loading error string.
Q_INVOKABLE void SetLoadingError(const QString &_loadingError)
Set the loading error message.