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;
90 public:
void LoadConfig(
const tinyxml2::XMLElement *_pluginElem)
override;
100 public slots:
void OnDropped(
const QString &_drop,
101 int _mouseX,
int _mouseY);
106 public slots:
void OnHovered(
int _mouseX,
int _mouseY);
110 public slots:
void OnFocusWindow();
113 protected:
bool eventFilter(QObject *_obj, QEvent *_event)
override;
179 public:
void Render();
182 public:
void Initialize();
185 public:
void Destroy();
192 public:
void SetTransformMode(
const std::string &_mode);
200 public:
void SetModelPath(
const std::string &_filePath);
206 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
211 public:
void SetMoveTo(
const std::string &_target);
218 public:
void SetFollowTarget(
const std::string &_target,
219 bool _waitForTarget =
false);
233 public:
void SetFollowPGain(
double _gain);
238 public:
void SetFollowWorldFrame(
bool _worldFrame);
250 public:
bool FollowWorldFrame()
const;
258 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
272 public:
void HandleKeyPress(QKeyEvent *_e);
276 public:
void HandleKeyRelease(QKeyEvent *_e);
309 public:
void SnapPoint(
318 public:
void RequestSelectionChange(
Entity _selectedEntity,
319 bool _deselectAll,
bool _sendEvent);
329 private:
double SnapValue(
330 double _coord,
double _interval,
double _sensitivity)
const;
337 private:
void HandleMouseEvent();
340 private:
void HandleMouseContextMenu();
343 private:
void HandleMouseViewControl();
346 private:
void HandleMouseTransformControl();
349 private:
void HandleEntitySelection();
352 private:
void HandleModelPlacement();
356 private:
Entity UniqueId();
361 public:
bool GeneratePreview(
const sdf::Root &_sdf);
364 public:
void TerminateSpawnPreview();
385 private:
void OnMoveToComplete();
388 private:
void OnViewAngleComplete();
391 private:
void OnMoveToPoseComplete();
397 private:
void UpdateSelectedEntity(
const rendering::NodePtr &_node,
403 private:
void DeselectAllEntities(
bool _sendEvent);
406 signals:
void ContextMenuRequested(QString _entity);
412 signals:
void FollowTargetChanged(
const std::string &_target,
413 bool _waitForTarget);
416 public: GLuint textureId = 0u;
425 public: uint32_t visibilityMask = 0xFFFFFFFFu;
428 public:
bool initialized =
false;
431 public: QSize textureSize = QSize(1024, 1024);
434 public:
bool textureDirty =
false;
450 public slots:
void RenderNext();
453 public slots:
void ShutDown();
456 public slots:
void SizeChanged();
462 signals:
void TextureReady(
int _id,
const QSize &_size);
465 public: QOffscreenSurface *surface =
nullptr;
468 public: QOpenGLContext *context =
nullptr;
500 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
504 public:
void SetVisibilityMask(uint32_t _mask);
508 public:
void SetTransformMode(
const std::string &_mode);
516 public:
void SetModelPath(
const std::string &_filePath);
522 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
527 public:
void SetMoveTo(
const std::string &_target);
534 public Q_SLOTS:
void SetFollowTarget(
const std::string &_target,
535 bool _waitForTarget =
false);
549 public:
void SetFollowPGain(
double _gain);
554 public:
void SetFollowWorldFrame(
bool _worldFrame);
562 public:
void SetWorldName(
const std::string &_name);
574 public:
void UpdateSelectedEntity(
Entity _entity,
581 public:
void DeselectAllEntities(
bool _sendEvent);
607 public Q_SLOTS:
void Ready();
610 protected:
void mousePressEvent(QMouseEvent *_e)
override;
613 protected:
void mouseReleaseEvent(QMouseEvent *_e)
override;
616 protected:
void mouseMoveEvent(QMouseEvent *_e)
override;
619 protected:
void wheelEvent(QWheelEvent *_e)
override;
622 protected:
void keyPressEvent(QKeyEvent *_e)
override;
625 protected:
void keyReleaseEvent(QKeyEvent *_e)
override;
633 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
634 QQuickItem::UpdatePaintNodeData *_data)
override;
640 signals:
void openContextMenu(QString _entity);
644 public slots:
void OnContextMenuRequested(QString _entity);
658 public:
explicit TextureNode(QQuickWindow *_window);
667 public slots:
void NewTexture(
int _id,
const QSize &_size);
671 public slots:
void PrepareNode();
675 signals:
void TextureInUse();
679 signals:
void PendingNewTexture();
685 public: QSize size = QSize(0, 0);
691 public: QSGTexture *texture =
nullptr;
694 public: QQuickWindow *window =
nullptr;
std::string worldName
Name of the world.
Definition: Scene3D.hh:422
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:471
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:652
A QQUickItem that manages the render window.
Definition: Scene3D.hh:476
Information passed to systems on the update callback.
Definition: Types.hh:36
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:688
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:168
static const Vector2< T > Zero
Rendering thread.
Definition: Scene3D.hh:442
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