18 #ifndef IGNITION_GUI_PLUGINS_SCENE3D_HH_ 19 #define IGNITION_GUI_PLUGINS_SCENE3D_HH_ 41 class IgnRendererPrivate;
42 class RenderWindowItemPrivate;
82 public: virtual ~Scene3D();
87 public slots:
void OnHovered(
int _mouseX,
int _mouseY);
116 private:
std::unique_ptr<Scene3DPrivate> dataPtr;
128 public: IgnRenderer();
131 public: ~IgnRenderer();
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();
178 private:
void BroadcastKeyRelease();
181 private:
void BroadcastKeyPress();
191 public: GLuint textureId = 0u;
209 public:
bool initialized =
false;
212 public:
QSize textureSize =
QSize(1024, 1024);
215 public:
bool textureDirty =
false;
248 public slots:
void RenderNext();
251 public slots:
void ShutDown();
254 public slots:
void SizeChanged();
260 signals:
void TextureReady(
int _id,
const QSize &_size);
270 public: QOffscreenSurface *surface =
nullptr;
273 public: QOpenGLContext *context =
nullptr;
294 public:
void SetBackgroundColor(
const math::Color &_color);
298 public:
void SetAmbientLight(
const math::Color &_ambient);
302 public:
void SetEngineName(
const std::string &_name);
306 public:
void SetSceneName(
const std::string &_name);
316 public:
void SetSceneService(
const std::string &_service);
322 public:
void SetPoseTopic(
const std::string &_topic);
328 public:
void SetDeletionTopic(
const std::string &_topic);
333 public:
void SetSceneTopic(
const std::string &_topic);
341 public Q_SLOTS:
void Ready();
345 public:
void HandleKeyPress(
QKeyEvent *_e);
349 public:
void HandleKeyRelease(
QKeyEvent *_e);
352 protected:
virtual void mousePressEvent(
QMouseEvent *_e)
override;
355 protected:
virtual void mouseReleaseEvent(
QMouseEvent *_e)
override;
358 protected:
virtual void mouseMoveEvent(
QMouseEvent *_e)
override;
361 protected:
virtual void wheelEvent(
QWheelEvent *_e)
override;
364 protected:
virtual void keyPressEvent(
QKeyEvent *_event)
override;
367 protected:
virtual void keyReleaseEvent(
QKeyEvent *_event)
override;
375 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
376 QQuickItem::UpdatePaintNodeData *_data)
override;
394 public:
explicit TextureNode(QQuickWindow *_window);
403 public slots:
void NewTexture(
int _id,
const QSize &_size);
407 public slots:
void PrepareNode();
411 signals:
void TextureInUse();
415 signals:
void PendingNewTexture();
427 public: QSGTexture *texture =
nullptr;
430 public: QQuickWindow *window =
nullptr;
void OnHovered(int _mouseX, int _mouseY)
Callback when the mouse hovers to a new position.
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:220
Definition: Application.hh:35
Base class for Ignition GUI plugins.
Definition: Plugin.hh:54
Q_INVOKABLE QString LoadingError() const
Get the loading error string.
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:224
Q_INVOKABLE void SetLoadingError(const QString &_loadingError)
Set the loading error message.
Creates an ignition rendering scene and user camera. It is possible to orbit the camera around the sc...
Definition: Scene3D.hh:66
A QQUickItem that manages the render window.
Definition: MinimalScene.hh:288
std::string deletionTopic
Ign-transport deletion topic name.
Definition: Scene3D.hh:227
static const Vector2< T > Zero
void OnFocusWindow()
Callback when the mouse enters the render window to focus the window for mouse/key events...
virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override
Load the plugin with a configuration file. Override this on custom plugins to handle custom configura...
Ign-rendering renderer. All ign-rendering calls should be performed inside this class as it makes sur...
Definition: MinimalScene.hh:126
bool eventFilter(QObject *_obj, QEvent *_event) override
Rendering thread.
Definition: MinimalScene.hh:246
QString loadingError
Loading error message.
Definition: Scene3D.hh:76
Texture node for displaying the render texture from ign-renderer.
Definition: MinimalScene.hh:392
std::string sceneTopic
Ign-transport scene topic name New scene messages will be published to this topic when an entities ar...
Definition: Scene3D.hh:232
void LoadingErrorChanged()
Notify that loading error has changed.