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;
186 public:
void Render();
189 public:
void Initialize();
192 public:
void Destroy();
199 public:
void SetTransformMode(
const std::string &_mode);
207 public:
void SetModelPath(
const std::string &_filePath);
212 public:
void SetDropdownMenuEnabled(
bool _enableDropdownMenu);
218 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
223 public:
void SetRecordVideoUseSimTime(
bool _useSimTime);
227 public:
void SetRecordVideoLockstep(
bool _lockstep);
231 public:
void SetRecordVideoBitrate(
unsigned int _bitrate);
235 public:
void SetMoveTo(
const std::string &_target);
242 public:
void SetFollowTarget(
const std::string &_target,
243 bool _waitForTarget =
false);
257 public:
void SetViewCollisionsTarget(
const std::string &_target);
261 public:
void SetFollowPGain(
double _gain);
266 public:
void SetFollowWorldFrame(
bool _worldFrame);
278 public:
bool FollowWorldFrame()
const;
286 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
300 public:
void HandleKeyPress(QKeyEvent *_e);
304 public:
void HandleKeyRelease(QKeyEvent *_e);
337 public:
void SnapPoint(
346 public:
void RequestSelectionChange(
Entity _selectedEntity,
347 bool _deselectAll,
bool _sendEvent);
357 private:
double SnapValue(
358 double _coord,
double _interval,
double _sensitivity)
const;
365 private:
void HandleMouseEvent();
368 private:
void HandleMouseContextMenu();
371 private:
void HandleMouseViewControl();
374 private:
void HandleMouseTransformControl();
377 private:
void HandleEntitySelection();
380 private:
void HandleModelPlacement();
383 private:
void BroadcastHoverPos();
386 private:
void BroadcastLeftClick();
389 private:
void BroadcastRightClick();
393 private:
Entity UniqueId();
398 public:
bool GeneratePreview(
const sdf::Root &_sdf);
401 public:
void TerminateSpawnPreview();
422 private:
void OnMoveToComplete();
425 private:
void OnViewAngleComplete();
428 private:
void OnMoveToPoseComplete();
434 private:
void UpdateSelectedEntity(
const rendering::NodePtr &_node,
440 private:
void DeselectAllEntities(
bool _sendEvent);
443 signals:
void ContextMenuRequested(QString _entity);
449 signals:
void FollowTargetChanged(
const std::string &_target,
450 bool _waitForTarget);
453 public: GLuint textureId = 0u;
462 public: uint32_t visibilityMask = 0xFFFFFFFFu;
465 public:
bool initialized =
false;
468 public: QSize textureSize = QSize(1024, 1024);
471 public:
bool textureDirty =
false;
487 public slots:
void RenderNext();
490 public slots:
void ShutDown();
493 public slots:
void SizeChanged();
499 signals:
void TextureReady(
int _id,
const QSize &_size);
502 public: QOffscreenSurface *surface =
nullptr;
505 public: QOpenGLContext *context =
nullptr;
537 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
541 public:
void SetVisibilityMask(uint32_t _mask);
545 public:
void SetTransformMode(
const std::string &_mode);
553 public:
void SetModelPath(
const std::string &_filePath);
558 public:
void SetDropdownMenuEnabled(
bool _enableDropdownMenu);
564 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
569 public:
void SetRecordVideoUseSimTime(
bool _useSimTime);
573 public:
void SetRecordVideoLockstep(
bool _lockstep);
577 public:
void SetRecordVideoBitrate(
unsigned int _bitrate);
581 public:
void SetMoveTo(
const std::string &_target);
588 public Q_SLOTS:
void SetFollowTarget(
const std::string &_target,
589 bool _waitForTarget =
false);
603 public:
void SetViewCollisionsTarget(
const std::string &_target);
607 public:
void SetFollowPGain(
double _gain);
612 public:
void SetFollowWorldFrame(
bool _worldFrame);
620 public:
void SetWorldName(
const std::string &_name);
632 public:
void UpdateSelectedEntity(
Entity _entity,
639 public:
void DeselectAllEntities(
bool _sendEvent);
668 public:
bool RendererInitialized()
const;
671 public Q_SLOTS:
void Ready();
675 public:
void HandleKeyPress(QKeyEvent *_e);
679 public:
void HandleKeyRelease(QKeyEvent *_e);
682 protected:
void mousePressEvent(QMouseEvent *_e)
override;
685 protected:
void mouseReleaseEvent(QMouseEvent *_e)
override;
688 protected:
void mouseMoveEvent(QMouseEvent *_e)
override;
691 protected:
void wheelEvent(QWheelEvent *_e)
override;
699 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
700 QQuickItem::UpdatePaintNodeData *_data)
override;
706 signals:
void openContextMenu(QString _entity);
710 public slots:
void OnContextMenuRequested(QString _entity);
724 public:
explicit TextureNode(QQuickWindow *_window);
733 public slots:
void NewTexture(
int _id,
const QSize &_size);
737 public slots:
void PrepareNode();
741 signals:
void TextureInUse();
745 signals:
void PendingNewTexture();
751 public: QSize size = QSize(0, 0);
757 public: QSGTexture *texture =
nullptr;
760 public: QQuickWindow *window =
nullptr;
std::string worldName
Name of the world.
Definition: Scene3D.hh:459
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:508
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:718
A QQUickItem that manages the render window.
Definition: Scene3D.hh:513
Information passed to systems on the update callback.
Definition: Types.hh:36
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:754
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:175
static const Vector2< T > Zero
Rendering thread.
Definition: Scene3D.hh:479
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