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: uint32_t visibilityMask = 0xFFFFFFFFu;
454 public:
bool initialized =
false;
457 public: QSize textureSize = QSize(1024, 1024);
460 public:
bool textureDirty =
false;
476 public slots:
void RenderNext();
479 public slots:
void ShutDown();
482 public slots:
void SizeChanged();
488 signals:
void TextureReady(
int _id,
const QSize &_size);
491 public: QOffscreenSurface *surface =
nullptr;
494 public: QOpenGLContext *context =
nullptr;
526 public:
void SetInitCameraPose(
const math::Pose3d &_pose);
530 public:
void SetVisibilityMask(uint32_t _mask);
534 public:
void SetTransformMode(
const std::string &_mode);
542 public:
void SetModelPath(
const std::string &_filePath);
547 public:
void SetDropdownMenuEnabled(
bool _enableDropdownMenu);
553 public:
void SetRecordVideo(
bool _record,
const std::string &_format,
558 public:
void SetRecordVideoUseSimTime(
bool _useSimTime);
562 public:
void SetRecordVideoLockstep(
bool _lockstep);
566 public:
void SetRecordVideoBitrate(
unsigned int _bitrate);
570 public:
void SetMoveTo(
const std::string &_target);
577 public Q_SLOTS:
void SetFollowTarget(
const std::string &_target,
578 bool _waitForTarget =
false);
592 public:
void SetFollowPGain(
double _gain);
597 public:
void SetFollowWorldFrame(
bool _worldFrame);
605 public:
void SetWorldName(
const std::string &_name);
617 public:
void UpdateSelectedEntity(
Entity _entity,
624 public:
void DeselectAllEntities(
bool _sendEvent);
653 public:
bool RendererInitialized()
const;
656 public Q_SLOTS:
void Ready();
660 public:
void HandleKeyPress(QKeyEvent *_e);
664 public:
void HandleKeyRelease(QKeyEvent *_e);
667 protected:
void mousePressEvent(QMouseEvent *_e)
override;
670 protected:
void mouseReleaseEvent(QMouseEvent *_e)
override;
673 protected:
void mouseMoveEvent(QMouseEvent *_e)
override;
676 protected:
void wheelEvent(QWheelEvent *_e)
override;
684 private: QSGNode *updatePaintNode(QSGNode *_oldNode,
685 QQuickItem::UpdatePaintNodeData *_data)
override;
691 signals:
void openContextMenu(QString _entity);
695 public slots:
void OnContextMenuRequested(QString _entity);
709 public:
explicit TextureNode(QQuickWindow *_window);
718 public slots:
void NewTexture(
int _id,
const QSize &_size);
722 public slots:
void PrepareNode();
726 signals:
void TextureInUse();
730 signals:
void PendingNewTexture();
736 public: QSize size = QSize(0, 0);
742 public: QSGTexture *texture =
nullptr;
745 public: QQuickWindow *window =
nullptr;
std::string worldName
Name of the world.
Definition: Scene3D.hh:448
IgnRenderer ignRenderer
Ign-rendering renderer.
Definition: Scene3D.hh:497
Texture node for displaying the render texture from ign-renderer.
Definition: Scene3D.hh:703
A QQUickItem that manages the render window.
Definition: Scene3D.hh:502
Information passed to systems on the update callback.
Definition: Types.hh:36
QMutex mutex
Mutex to protect the texture variables.
Definition: Scene3D.hh:739
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:468
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