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;
197 public:
void Render(RenderSync *_renderSync);
200 public:
void Initialize();
203 public:
void Destroy();
210 public:
void SetTransformMode(
const std::string &_mode);
218 public:
void SetModelPath(
const std::string &_filePath);
223 public:
void SetDropdownMenuEnabled(
bool _enableDropdownMenu);
229 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
234 public:
void SetRecordVideoUseSimTime(
bool _useSimTime);
238 public:
void SetRecordVideoLockstep(
bool _lockstep);
242 public:
void SetRecordVideoBitrate(
unsigned int _bitrate);
246 public:
void SetMoveTo(
const std::string &_target);
253 public:
void SetFollowTarget(
const std::string &_target,
254 bool _waitForTarget =
false);
268 public:
void SetViewCollisionsTarget(
const std::string &_target);
272 public:
void SetFollowPGain(
double _gain);
277 public:
void SetFollowWorldFrame(
bool _worldFrame);
289 public:
bool FollowWorldFrame()
const;
297 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
311 public:
void HandleKeyPress(QKeyEvent *_e);
315 public:
void HandleKeyRelease(QKeyEvent *_e);
348 public:
void SnapPoint(
357 public:
void RequestSelectionChange(
Entity _selectedEntity,
358 bool _deselectAll,
bool _sendEvent);
368 private:
double SnapValue(
369 double _coord,
double _interval,
double _sensitivity)
const;
376 private:
void HandleMouseEvent();
379 private:
void HandleMouseContextMenu();
382 private:
void HandleMouseViewControl();
385 private:
void HandleMouseTransformControl();
388 private:
void HandleEntitySelection();
391 private:
void HandleModelPlacement();
394 private:
void BroadcastHoverPos();
397 private:
void BroadcastLeftClick();
400 private:
void BroadcastRightClick();
404 private:
Entity UniqueId();
409 public:
bool GeneratePreview(
const sdf::Root &_sdf);
412 public:
void TerminateSpawnPreview();
433 private:
void OnMoveToComplete();
436 private:
void OnViewAngleComplete();
439 private:
void OnMoveToPoseComplete();
445 private:
void UpdateSelectedEntity(
const rendering::NodePtr &_node,
451 private:
void DeselectAllEntities(
bool _sendEvent);
454 signals:
void ContextMenuRequested(QString _entity);
460 signals:
void FollowTargetChanged(
const std::string &_target,
461 bool _waitForTarget);
476 public: uint32_t visibilityMask = 0xFFFFFFFFu;
479 public:
bool initialized =
false;
482 public: QSize textureSize = QSize(1024, 1024);
485 public:
bool textureDirty =
false;
503 public slots:
void RenderNext(RenderSync *renderSync);
506 public slots:
void ShutDown();
509 public slots:
void SizeChanged();
515 signals:
void TextureReady(uint _id,
const QSize &_size);
518 public: QOffscreenSurface *surface =
nullptr;
521 public: QOpenGLContext *context =
nullptr;
553 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
557 public:
void SetVisibilityMask(uint32_t _mask);
561 public:
void SetTransformMode(
const std::string &_mode);
569 public:
void SetModelPath(
const std::string &_filePath);
574 public:
void SetDropdownMenuEnabled(
bool _enableDropdownMenu);
580 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
585 public:
void SetRecordVideoUseSimTime(
bool _useSimTime);
589 public:
void SetRecordVideoLockstep(
bool _lockstep);
593 public:
void SetRecordVideoBitrate(
unsigned int _bitrate);
597 public:
void SetMoveTo(
const std::string &_target);
604 public Q_SLOTS:
void SetFollowTarget(
const std::string &_target,
605 bool _waitForTarget =
false);
619 public:
void SetViewCollisionsTarget(
const std::string &_target);
623 public:
void SetFollowPGain(
double _gain);
628 public:
void SetFollowWorldFrame(
bool _worldFrame);
636 public:
void SetWorldName(
const std::string &_name);
648 public:
void UpdateSelectedEntity(
Entity _entity,
655 public:
void DeselectAllEntities(
bool _sendEvent);
684 public:
bool RendererInitialized()
const;
687 public Q_SLOTS:
void Ready();
691 public:
void HandleKeyPress(QKeyEvent *_e);
695 public:
void HandleKeyRelease(QKeyEvent *_e);
698 protected:
void mousePressEvent(QMouseEvent *_e)
override;
701 protected:
void mouseReleaseEvent(QMouseEvent *_e)
override;
704 protected:
void mouseMoveEvent(QMouseEvent *_e)
override;
707 protected:
void wheelEvent(QWheelEvent *_e)
override;
715 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
716 QQuickItem::UpdatePaintNodeData *_data)
override;
722 signals:
void openContextMenu(QString _entity);
726 public slots:
void OnContextMenuRequested(QString _entity);
742 public:
explicit TextureNode(QQuickWindow *_window,
743 RenderSync &_renderSync);
752 public slots:
void NewTexture(uint _id,
const QSize &_size);
756 public slots:
void PrepareNode();
761 signals:
void TextureInUse(RenderSync *_renderSync);
765 signals:
void PendingNewTexture();
771 public: QSize size = QSize(0, 0);
780 public: QSGTexture *texture =
nullptr;
783 public: QQuickWindow *window =
nullptr;
std::string worldName
Name of the world.
Definition: Scene3D.hh:473
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:524
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:734
A QQUickItem that manages the render window.
Definition: Scene3D.hh:529
Information passed to systems on the update callback.
Definition: Types.hh:36
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:774
The EntityComponentManager constructs, deletes, and returns components and entities. A component can be of any class which inherits from components::BaseComponent.
Definition: EntityComponentManager.hh:65
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:184
static const Vector2< T > Zero
Rendering thread.
Definition: Scene3D.hh:493
RenderSync & renderSync
See RenderSync.
Definition: Scene3D.hh:777
GLuint textureId
Render texture id Values is constantly constantly cycled/swapped/changed from a worker thread Don't r...
Definition: Scene3D.hh:467
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