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:
bool initialized =
false;
465 public: QSize textureSize = QSize(1024, 1024);
468 public:
bool textureDirty =
false;
484 public slots:
void RenderNext();
487 public slots:
void ShutDown();
490 public slots:
void SizeChanged();
496 signals:
void TextureReady(
int _id,
const QSize &_size);
499 public: QOffscreenSurface *surface =
nullptr;
502 public: QOpenGLContext *context =
nullptr;
534 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
538 public:
void SetTransformMode(
const std::string &_mode);
546 public:
void SetModelPath(
const std::string &_filePath);
551 public:
void SetDropdownMenuEnabled(
bool _enableDropdownMenu);
557 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
562 public:
void SetRecordVideoUseSimTime(
bool _useSimTime);
566 public:
void SetRecordVideoLockstep(
bool _lockstep);
570 public:
void SetRecordVideoBitrate(
unsigned int _bitrate);
574 public:
void SetMoveTo(
const std::string &_target);
581 public Q_SLOTS:
void SetFollowTarget(
const std::string &_target,
582 bool _waitForTarget =
false);
596 public:
void SetViewCollisionsTarget(
const std::string &_target);
600 public:
void SetFollowPGain(
double _gain);
605 public:
void SetFollowWorldFrame(
bool _worldFrame);
613 public:
void SetWorldName(
const std::string &_name);
625 public:
void UpdateSelectedEntity(
Entity _entity,
632 public:
void DeselectAllEntities(
bool _sendEvent);
661 public:
bool RendererInitialized()
const;
664 public Q_SLOTS:
void Ready();
668 public:
void HandleKeyPress(QKeyEvent *_e);
672 public:
void HandleKeyRelease(QKeyEvent *_e);
675 protected:
void mousePressEvent(QMouseEvent *_e)
override;
678 protected:
void mouseReleaseEvent(QMouseEvent *_e)
override;
681 protected:
void mouseMoveEvent(QMouseEvent *_e)
override;
684 protected:
void wheelEvent(QWheelEvent *_e)
override;
692 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
693 QQuickItem::UpdatePaintNodeData *_data)
override;
699 signals:
void openContextMenu(QString _entity);
703 public slots:
void OnContextMenuRequested(QString _entity);
717 public:
explicit TextureNode(QQuickWindow *_window);
726 public slots:
void NewTexture(
int _id,
const QSize &_size);
730 public slots:
void PrepareNode();
734 signals:
void TextureInUse();
738 signals:
void PendingNewTexture();
744 public: QSize size = QSize(0, 0);
750 public: QSGTexture *texture =
nullptr;
753 public: QQuickWindow *window =
nullptr;
std::string worldName
Name of the world.
Definition: Scene3D.hh:459
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:505
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:711
A QQUickItem that manages the render window.
Definition: Scene3D.hh:510
Information passed to systems on the update callback.
Definition: Types.hh:37
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:747
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:476
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