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);
205 public:
void SetDropdownMenuEnabled(
bool _enableDropdownMenu);
211 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
216 public:
void SetRecordVideoUseSimTime(
bool _useSimTime);
220 public:
void SetRecordVideoLockstep(
bool _lockstep);
224 public:
void SetRecordVideoBitrate(
unsigned int _bitrate);
228 public:
void SetMoveTo(
const std::string &_target);
235 public:
void SetFollowTarget(
const std::string &_target,
236 bool _waitForTarget =
false);
250 public:
void SetFollowPGain(
double _gain);
255 public:
void SetFollowWorldFrame(
bool _worldFrame);
267 public:
bool FollowWorldFrame()
const;
275 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
289 public:
void HandleKeyPress(QKeyEvent *_e);
293 public:
void HandleKeyRelease(QKeyEvent *_e);
326 public:
void SnapPoint(
335 public:
void RequestSelectionChange(
Entity _selectedEntity,
336 bool _deselectAll,
bool _sendEvent);
346 private:
double SnapValue(
347 double _coord,
double _interval,
double _sensitivity)
const;
354 private:
void HandleMouseEvent();
357 private:
void HandleMouseContextMenu();
360 private:
void HandleMouseViewControl();
363 private:
void HandleMouseTransformControl();
366 private:
void HandleEntitySelection();
369 private:
void HandleModelPlacement();
372 private:
void BroadcastHoverPos();
375 private:
void BroadcastLeftClick();
378 private:
void BroadcastRightClick();
382 private:
Entity UniqueId();
387 public:
bool GeneratePreview(
const sdf::Root &_sdf);
390 public:
void TerminateSpawnPreview();
411 private:
void OnMoveToComplete();
414 private:
void OnViewAngleComplete();
417 private:
void OnMoveToPoseComplete();
423 private:
void UpdateSelectedEntity(
const rendering::NodePtr &_node,
429 private:
void DeselectAllEntities(
bool _sendEvent);
432 signals:
void ContextMenuRequested(QString _entity);
438 signals:
void FollowTargetChanged(
const std::string &_target,
439 bool _waitForTarget);
442 public: GLuint textureId = 0u;
451 public:
bool initialized =
false;
454 public: QSize textureSize = QSize(1024, 1024);
457 public:
bool textureDirty =
false;
473 public slots:
void RenderNext();
476 public slots:
void ShutDown();
479 public slots:
void SizeChanged();
485 signals:
void TextureReady(
int _id,
const QSize &_size);
488 public: QOffscreenSurface *surface =
nullptr;
491 public: QOpenGLContext *context =
nullptr;
523 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
527 public:
void SetTransformMode(
const std::string &_mode);
535 public:
void SetModelPath(
const std::string &_filePath);
540 public:
void SetDropdownMenuEnabled(
bool _enableDropdownMenu);
546 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
551 public:
void SetRecordVideoUseSimTime(
bool _useSimTime);
555 public:
void SetRecordVideoLockstep(
bool _lockstep);
559 public:
void SetRecordVideoBitrate(
unsigned int _bitrate);
563 public:
void SetMoveTo(
const std::string &_target);
570 public Q_SLOTS:
void SetFollowTarget(
const std::string &_target,
571 bool _waitForTarget =
false);
585 public:
void SetFollowPGain(
double _gain);
590 public:
void SetFollowWorldFrame(
bool _worldFrame);
598 public:
void SetWorldName(
const std::string &_name);
610 public:
void UpdateSelectedEntity(
Entity _entity,
617 public:
void DeselectAllEntities(
bool _sendEvent);
646 public:
bool RendererInitialized()
const;
649 public Q_SLOTS:
void Ready();
653 public:
void HandleKeyPress(QKeyEvent *_e);
657 public:
void HandleKeyRelease(QKeyEvent *_e);
660 protected:
void mousePressEvent(QMouseEvent *_e)
override;
663 protected:
void mouseReleaseEvent(QMouseEvent *_e)
override;
666 protected:
void mouseMoveEvent(QMouseEvent *_e)
override;
669 protected:
void wheelEvent(QWheelEvent *_e)
override;
677 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
678 QQuickItem::UpdatePaintNodeData *_data)
override;
684 signals:
void openContextMenu(QString _entity);
688 public slots:
void OnContextMenuRequested(QString _entity);
702 public:
explicit TextureNode(QQuickWindow *_window);
711 public slots:
void NewTexture(
int _id,
const QSize &_size);
715 public slots:
void PrepareNode();
719 signals:
void TextureInUse();
723 signals:
void PendingNewTexture();
729 public: QSize size = QSize(0, 0);
735 public: QSGTexture *texture =
nullptr;
738 public: QQuickWindow *window =
nullptr;
std::string worldName
Name of the world.
Definition: Scene3D.hh:448
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:494
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:696
A QQUickItem that manages the render window.
Definition: Scene3D.hh:499
Information passed to systems on the update callback.
Definition: Types.hh:37
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:732
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:465
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