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();
355 private:
void BroadcastHoverPos();
358 private:
void BroadcastLeftClick();
362 private:
Entity UniqueId();
367 public:
bool GeneratePreview(
const sdf::Root &_sdf);
370 public:
void TerminateSpawnPreview();
391 private:
void OnMoveToComplete();
394 private:
void OnViewAngleComplete();
397 private:
void OnMoveToPoseComplete();
403 private:
void UpdateSelectedEntity(
const rendering::NodePtr &_node,
409 private:
void DeselectAllEntities(
bool _sendEvent);
412 signals:
void ContextMenuRequested(QString _entity);
418 signals:
void FollowTargetChanged(
const std::string &_target,
419 bool _waitForTarget);
422 public: GLuint textureId = 0u;
431 public: uint32_t visibilityMask = 0xFFFFFFFFu;
434 public:
bool initialized =
false;
437 public: QSize textureSize = QSize(1024, 1024);
440 public:
bool textureDirty =
false;
456 public slots:
void RenderNext();
459 public slots:
void ShutDown();
462 public slots:
void SizeChanged();
468 signals:
void TextureReady(
int _id,
const QSize &_size);
471 public: QOffscreenSurface *surface =
nullptr;
474 public: QOpenGLContext *context =
nullptr;
506 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
510 public:
void SetVisibilityMask(uint32_t _mask);
514 public:
void SetTransformMode(
const std::string &_mode);
522 public:
void SetModelPath(
const std::string &_filePath);
528 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
533 public:
void SetMoveTo(
const std::string &_target);
540 public Q_SLOTS:
void SetFollowTarget(
const std::string &_target,
541 bool _waitForTarget =
false);
555 public:
void SetFollowPGain(
double _gain);
560 public:
void SetFollowWorldFrame(
bool _worldFrame);
568 public:
void SetWorldName(
const std::string &_name);
580 public:
void UpdateSelectedEntity(
Entity _entity,
587 public:
void DeselectAllEntities(
bool _sendEvent);
613 public Q_SLOTS:
void Ready();
617 public:
void HandleKeyPress(QKeyEvent *_e);
621 public:
void HandleKeyRelease(QKeyEvent *_e);
624 protected:
void mousePressEvent(QMouseEvent *_e)
override;
627 protected:
void mouseReleaseEvent(QMouseEvent *_e)
override;
630 protected:
void mouseMoveEvent(QMouseEvent *_e)
override;
633 protected:
void wheelEvent(QWheelEvent *_e)
override;
641 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
642 QQuickItem::UpdatePaintNodeData *_data)
override;
648 signals:
void openContextMenu(QString _entity);
652 public slots:
void OnContextMenuRequested(QString _entity);
666 public:
explicit TextureNode(QQuickWindow *_window);
675 public slots:
void NewTexture(
int _id,
const QSize &_size);
679 public slots:
void PrepareNode();
683 signals:
void TextureInUse();
687 signals:
void PendingNewTexture();
693 public: QSize size = QSize(0, 0);
699 public: QSGTexture *texture =
nullptr;
702 public: QQuickWindow *window =
nullptr;
std::string worldName
Name of the world.
Definition: Scene3D.hh:428
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:477
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:660
A QQUickItem that manages the render window.
Definition: Scene3D.hh:482
Information passed to systems on the update callback.
Definition: Types.hh:36
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:696
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:448
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