18 #ifndef IGNITION_GUI_PLUGINS_SCENE3D_HH_ 19 #define IGNITION_GUI_PLUGINS_SCENE3D_HH_ 25 #include <ignition/math/Color.hh> 26 #include <ignition/math/Pose3.hh> 27 #include <ignition/math/Vector2.hh> 28 #include <ignition/math/Vector3.hh> 30 #include <ignition/common/MouseEvent.hh> 41 class IgnRendererPrivate;
42 class RenderWindowItemPrivate;
72 public:
virtual void LoadConfig(
const tinyxml2::XMLElement *_pluginElem)
95 public:
void Render();
98 public:
void Initialize();
101 public:
void Destroy();
106 public:
void NewMouseEvent(
const common::MouseEvent &_e,
107 const math::Vector2d &_drag = math::Vector2d::Zero);
110 private:
void HandleMouseEvent();
116 private: math::Vector3d ScreenToScene(
const math::Vector2i &_screenPos)
120 public: GLuint textureId = 0u;
129 public: math::Pose3d cameraPose = math::Pose3d(0, 0, 2, 0, 0.4, 0);
132 public: math::Color backgroundColor = math::Color::Black;
135 public: math::Color ambientLight = math::Color(0.3f, 0.3f, 0.3f, 1.0f);
138 public:
bool initialized =
false;
144 public:
bool textureDirty =
false;
177 public slots:
void RenderNext();
180 public slots:
void ShutDown();
183 public slots:
void SizeChanged();
189 signals:
void TextureReady(
int _id,
const QSize &_size);
192 public: QOffscreenSurface *surface =
nullptr;
195 public: QOpenGLContext *context =
nullptr;
216 public:
void SetBackgroundColor(
const math::Color &_color);
220 public:
void SetAmbientLight(
const math::Color &_ambient);
224 public:
void SetEngineName(
const std::string &_name);
228 public:
void SetSceneName(
const std::string &_name);
232 public:
void SetCameraPose(
const math::Pose3d &_pose);
238 public:
void SetSceneService(
const std::string &_service);
244 public:
void SetPoseTopic(
const std::string &_topic);
250 public:
void SetDeletionTopic(
const std::string &_topic);
255 public:
void SetSceneTopic(
const std::string &_topic);
258 public Q_SLOTS:
void Ready();
261 protected:
virtual void mousePressEvent(
QMouseEvent *_e)
override;
264 protected:
virtual void mouseReleaseEvent(
QMouseEvent *_e)
override;
267 protected:
virtual void mouseMoveEvent(
QMouseEvent *_e)
override;
270 protected:
virtual void wheelEvent(
QWheelEvent *_e)
override;
278 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
279 QQuickItem::UpdatePaintNodeData *_data)
override;
293 public:
explicit TextureNode(QQuickWindow *_window);
302 public slots:
void NewTexture(
int _id,
const QSize &_size);
306 public slots:
void PrepareNode();
310 signals:
void TextureInUse();
314 signals:
void PendingNewTexture();
326 public: QSGTexture *texture =
nullptr;
329 public: QQuickWindow *window =
nullptr;
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:149
virtual ~Scene3D()
Destructor.
Base class for Ignition GUI plugins.
Definition: Plugin.hh:54
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:153
Creates a new ignition rendering scene or adds a user-camera to an existing scene. It is possible to orbit the camera around the scene with the mouse. Use other plugins to manage objects in the scene.
Definition: Scene3D.hh:61
A QQUickItem that manages the render window.
Definition: Scene3D.hh:203
std::string deletionTopic
Ign-transport deletion topic name.
Definition: Scene3D.hh:156
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: Scene3D.hh:86
Rendering thread.
Definition: Scene3D.hh:169
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:323
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:287
Definition: Application.hh:40
std::string sceneTopic
Ign-transport scene topic name New scene messages will be published to this topic when an entities ar...
Definition: Scene3D.hh:161
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:198