18 #ifndef IGNITION_GAZEBO_GUI_SCENE3D_HH_ 19 #define IGNITION_GAZEBO_GUI_SCENE3D_HH_ 31 #include <sdf/Root.hh> 41 #include <ignition/rendering/Camera.hh> 45 #include "ignition/gui/qt.h" 53 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
54 class IgnRendererPrivate;
55 class RenderWindowItemPrivate;
85 QString errorPopupText
87 WRITE SetErrorPopupText
88 NOTIFY ErrorPopupTextChanged
95 public: ~Scene3D() override;
98 public:
void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
108 public slots:
void OnDropped(const QString &_drop,
109 int _mouseX,
int _mouseY);
114 public slots:
void OnHovered(
int _mouseX,
int _mouseY);
118 public slots:
void OnFocusWindow();
121 protected:
bool eventFilter(QObject *_obj, QEvent *_event) override;
127 private:
bool OnTransformMode(const msgs::StringMsg &_msg,
128 msgs::Boolean &_res);
134 private:
bool OnRecordVideo(const msgs::VideoRecord &_msg,
135 msgs::Boolean &_res);
141 private:
bool OnMoveTo(const msgs::StringMsg &_msg,
142 msgs::Boolean &_res);
148 private:
bool OnFollow(const msgs::StringMsg &_msg,
149 msgs::Boolean &_res);
155 private:
bool OnViewAngle(const msgs::
Vector3d &_msg,
156 msgs::Boolean &_res);
162 private:
bool OnMoveToPose(const msgs::GUICamera &_msg,
163 msgs::Boolean &_res);
169 private:
bool OnViewCollisions(const msgs::StringMsg &_msg,
170 msgs::Boolean &_res);
174 public: Q_INVOKABLE QString ErrorPopupText() const;
178 public: Q_INVOKABLE
void SetErrorPopupText(const QString &_errorTxt);
181 signals:
void ErrorPopupTextChanged();
186 signals:
void popupError();
190 private:
std::unique_ptr<Scene3DPrivate> dataPtr;
210 public:
void Render();
213 public:
void Initialize();
216 public:
void Destroy();
223 public:
void SetTransformMode(
const std::string &_mode);
231 public:
void SetModelPath(
const std::string &_filePath);
236 public:
void SetDropdownMenuEnabled(
bool _enableDropdownMenu);
242 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
247 public:
void SetRecordVideoUseSimTime(
bool _useSimTime);
251 public:
void SetRecordVideoLockstep(
bool _lockstep);
255 public:
void SetRecordVideoBitrate(
unsigned int _bitrate);
259 public:
void SetMoveTo(
const std::string &_target);
266 public:
void SetFollowTarget(
const std::string &_target,
267 bool _waitForTarget =
false);
281 public:
void SetViewCollisionsTarget(
const std::string &_target);
285 public:
void SetFollowPGain(
double _gain);
290 public:
void SetFollowWorldFrame(
bool _worldFrame);
302 public:
bool FollowWorldFrame()
const;
310 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
324 public:
void HandleKeyPress(QKeyEvent *_e);
328 public:
void HandleKeyRelease(QKeyEvent *_e);
361 public:
void SnapPoint(
370 public:
void RequestSelectionChange(
Entity _selectedEntity,
371 bool _deselectAll,
bool _sendEvent);
381 private:
double SnapValue(
382 double _coord,
double _interval,
double _sensitivity)
const;
389 private:
void HandleMouseEvent();
392 private:
void HandleMouseContextMenu();
395 private:
void HandleMouseViewControl();
398 private:
void HandleMouseTransformControl();
401 private:
void HandleEntitySelection();
404 private:
void HandleModelPlacement();
407 private:
void BroadcastHoverPos();
410 private:
void BroadcastLeftClick();
413 private:
void BroadcastRightClick();
417 private:
Entity UniqueId();
422 public:
bool GeneratePreview(
const sdf::Root &_sdf);
425 public:
void TerminateSpawnPreview();
446 private:
void OnMoveToComplete();
449 private:
void OnViewAngleComplete();
452 private:
void OnMoveToPoseComplete();
458 private:
void UpdateSelectedEntity(
const rendering::NodePtr &_node,
464 private:
void DeselectAllEntities(
bool _sendEvent);
467 signals:
void ContextMenuRequested(QString _entity);
473 signals:
void FollowTargetChanged(
const std::string &_target,
474 bool _waitForTarget);
477 public: GLuint textureId = 0u;
486 public:
bool initialized =
false;
489 public: QSize textureSize = QSize(1024, 1024);
492 public:
bool textureDirty =
false;
508 public slots:
void RenderNext();
511 public slots:
void ShutDown();
514 public slots:
void SizeChanged();
520 signals:
void TextureReady(
int _id,
const QSize &_size);
523 public: QOffscreenSurface *surface =
nullptr;
526 public: QOpenGLContext *context =
nullptr;
558 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
562 public:
void SetTransformMode(
const std::string &_mode);
570 public:
void SetModelPath(
const std::string &_filePath);
575 public:
void SetDropdownMenuEnabled(
bool _enableDropdownMenu);
581 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
586 public:
void SetRecordVideoUseSimTime(
bool _useSimTime);
590 public:
void SetRecordVideoLockstep(
bool _lockstep);
594 public:
void SetRecordVideoBitrate(
unsigned int _bitrate);
598 public:
void SetMoveTo(
const std::string &_target);
605 public Q_SLOTS:
void SetFollowTarget(
const std::string &_target,
606 bool _waitForTarget =
false);
620 public:
void SetViewCollisionsTarget(
const std::string &_target);
624 public:
void SetFollowPGain(
double _gain);
629 public:
void SetFollowWorldFrame(
bool _worldFrame);
637 public:
void SetWorldName(
const std::string &_name);
649 public:
void UpdateSelectedEntity(
Entity _entity,
656 public:
void DeselectAllEntities(
bool _sendEvent);
685 public:
bool RendererInitialized()
const;
688 public Q_SLOTS:
void Ready();
692 public:
void HandleKeyPress(QKeyEvent *_e);
696 public:
void HandleKeyRelease(QKeyEvent *_e);
699 protected:
void mousePressEvent(QMouseEvent *_e)
override;
702 protected:
void mouseReleaseEvent(QMouseEvent *_e)
override;
705 protected:
void mouseMoveEvent(QMouseEvent *_e)
override;
708 protected:
void wheelEvent(QWheelEvent *_e)
override;
716 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
717 QQuickItem::UpdatePaintNodeData *_data)
override;
723 signals:
void openContextMenu(QString _entity);
727 public slots:
void OnContextMenuRequested(QString _entity);
741 public:
explicit TextureNode(QQuickWindow *_window);
750 public slots:
void NewTexture(
int _id,
const QSize &_size);
754 public slots:
void PrepareNode();
758 signals:
void TextureInUse();
762 signals:
void PendingNewTexture();
768 public: QSize size = QSize(0, 0);
774 public: QSGTexture *texture =
nullptr;
777 public: QQuickWindow *window =
nullptr;
std::string worldName
Name of the world.
Definition: Scene3D.hh:483
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:529
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:735
A QQUickItem that manages the render window.
Definition: Scene3D.hh:534
Information passed to systems on the update callback.
Definition: Types.hh:37
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:771
The EntityComponentManager constructs, deletes, and returns components and entities. A component can be of any class which inherits from components::BaseComponent.
Definition: EntityComponentManager.hh:64
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:79
Ign-rendering renderer. All ign-rendering calls should be performed inside this class as it makes sur...
Definition: Scene3D.hh:199
static const Vector2< T > Zero
Rendering thread.
Definition: Scene3D.hh:500
Vector3< double > Vector3d
This library is part of the Ignition Robotics project.
Base class for a GUI System.
Definition: GuiSystem.hh:44
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light. At its core, an Entity is just an identifier.
Definition: Entity.hh:59
Definition: RenderUtil.hh:44