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> 32 #include <ignition/rendering/Camera.hh> 33 #include <ignition/rendering/OrbitViewController.hh> 44 class IgnRendererPrivate;
45 class RenderWindowItemPrivate;
75 public:
virtual void LoadConfig(
const tinyxml2::XMLElement *_pluginElem)
98 public:
void Render();
101 public:
void Initialize();
104 public:
void Destroy();
109 public:
void NewMouseEvent(
const common::MouseEvent &_e,
110 const math::Vector2d &_drag = math::Vector2d::Zero);
113 private:
void HandleMouseEvent();
119 private: math::Vector3d ScreenToScene(
const math::Vector2i &_screenPos)
123 public: GLuint textureId = 0u;
132 public: math::Pose3d cameraPose = math::Pose3d(0, 0, 2, 0, 0.4, 0);
135 public: math::Color backgroundColor = math::Color::Black;
138 public: math::Color ambientLight = math::Color(0.3, 0.3, 0.3, 1.0);
141 public:
bool initialized =
false;
147 public:
bool textureDirty =
false;
180 public slots:
void RenderNext();
183 public slots:
void ShutDown();
186 public slots:
void SizeChanged();
192 signals:
void TextureReady(
int _id,
const QSize &_size);
195 public: QOffscreenSurface *surface =
nullptr;
198 public: QOpenGLContext *context =
nullptr;
219 public:
void SetBackgroundColor(
const math::Color &_color);
223 public:
void SetAmbientLight(
const math::Color &_ambient);
227 public:
void SetEngineName(
const std::string &_name);
231 public:
void SetSceneName(
const std::string &_name);
235 public:
void SetCameraPose(
const math::Pose3d &_pose);
241 public:
void SetSceneService(
const std::string &_service);
247 public:
void SetPoseTopic(
const std::string &_topic);
253 public:
void SetDeletionTopic(
const std::string &_topic);
258 public:
void SetSceneTopic(
const std::string &_topic);
261 public Q_SLOTS:
void Ready();
264 protected:
virtual void mousePressEvent(
QMouseEvent *_e)
override;
267 protected:
virtual void mouseReleaseEvent(
QMouseEvent *_e)
override;
270 protected:
virtual void mouseMoveEvent(
QMouseEvent *_e)
override;
273 protected:
virtual void wheelEvent(
QWheelEvent *_e)
override;
281 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
282 QQuickItem::UpdatePaintNodeData *_data)
override;
296 public:
explicit TextureNode(QQuickWindow *_window);
305 public slots:
void NewTexture(
int _id,
const QSize &_size);
309 public slots:
void PrepareNode();
313 signals:
void TextureInUse();
317 signals:
void PendingNewTexture();
329 public: QSGTexture *texture =
nullptr;
332 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:152
virtual ~Scene3D()
Destructor.
Base class for Ignition GUI plugins.
Definition: Plugin.hh:47
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:156
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:64
A QQUickItem that manages the render window.
Definition: Scene3D.hh:206
std::string deletionTopic
Ign-transport deletion topic name.
Definition: Scene3D.hh:159
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:89
Rendering thread.
Definition: Scene3D.hh:172
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:326
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:290
Definition: Application.hh:33
std::string sceneTopic
Ign-transport scene topic name New scene messages will be published to this topic when an entities ar...
Definition: Scene3D.hh:164
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:201