Skip to content

Commit

Permalink
docs and some cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina committed Jul 6, 2021
1 parent a70c5cf commit 7dce9b0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
13 changes: 13 additions & 0 deletions examples/config/scene3d.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@
<background_color>0.8 0.8 0.8</background_color>
<camera_pose>-6 0 6 0 0.5 0</camera_pose>
</plugin>
<plugin filename="InteractiveViewControl" name="Interactive view control">
<ignition-gui>
<anchors target="View 1">
<line own="right" target="right"/>
<line own="top" target="top"/>
</anchors>
<property key="resizable" type="bool">false</property>
<property key="width" type="double">5</property>
<property key="height" type="double">5</property>
<property key="state" type="string">floating</property>
<property key="showTitleBar" type="bool">false</property>
</ignition-gui>
</plugin>
<plugin filename="TransportSceneManager" name="Transport Scene Manager">
<ignition-gui>
<anchors target="View 1">
Expand Down
13 changes: 8 additions & 5 deletions src/plugins/interactive_view_control/InteractiveViewControl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@
/// \brief Private data class for InteractiveViewControl
class ignition::gui::plugins::InteractiveViewControlPrivate
{
/// \brief
/// \brief Perform rendering calls in the rendering thread.
public: void OnRender();

math::Vector3d ScreenToScene(
const math::Vector2i &_screenPos) const;
/// \brief Transform a position on screen to the first point that's hit on
/// the 3D scene
/// \param[in] _screenPos Position on 2D screen within the 3D scene
/// \return First point hit on the 3D scene.
math::Vector3d ScreenToScene(const math::Vector2i &_screenPos) const;

/// \brief Flag to indicate if mouse event is dirty
public: bool mouseDirty = false;

/// \brief True to block orbiting with the mouse.
public: bool blockOrbit = false;

/// \brief Mouse event
Expand Down Expand Up @@ -191,7 +195,7 @@ math::Vector3d InteractiveViewControlPrivate::ScreenToScene(

/////////////////////////////////////////////////
InteractiveViewControl::InteractiveViewControl()
: Plugin(), dataPtr(new InteractiveViewControlPrivate)
: Plugin(), dataPtr(std::make_unique<InteractiveViewControlPrivate>())
{
}

Expand Down Expand Up @@ -247,7 +251,6 @@ bool InteractiveViewControl::eventFilter(QObject *_obj, QEvent *_event)
auto blockOrbit = reinterpret_cast<ignition::gui::events::BlockOrbit *>(
_event);
this->dataPtr->blockOrbit = blockOrbit->Block();
std::cerr << "BlockOrbit " << blockOrbit->Block() << '\n';
}

// Standard event processing
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/minimal_scene/MinimalScene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ class ignition::gui::plugins::IgnRenderer::Implementation
/// \brief Mouse event
public: common::MouseEvent mouseEvent;

/// \brief Mouse event
public: common::KeyEvent keyEvent;
/// \brief Key event
public: common::KeyEvent keyEvent;

/// \brief Mutex to protect mouse events
public: std::mutex mutex;
/// \brief Mutex to protect mouse events
public: std::mutex mutex;

/// \brief User camera
public: rendering::CameraPtr camera{nullptr};

/// \brief The currently hovered mouse position in screen coordinates
public: math::Vector2i mouseHoverPos{math::Vector2i::Zero};
/// \brief The currently hovered mouse position in screen coordinates
public: math::Vector2i mouseHoverPos{math::Vector2i::Zero};

/// \brief Ray query for mouse clicks
public: rendering::RayQueryPtr rayQuery{nullptr};
Expand Down

0 comments on commit 7dce9b0

Please sign in to comment.