From 14f6cd5b474bf3e0b2fc82d4202d4e14f062c6a5 Mon Sep 17 00:00:00 2001 From: ahcorde Date: Wed, 28 Apr 2021 20:49:46 +0200 Subject: [PATCH] Support Capsule and Ellipsoid in Scene3D Signed-off-by: ahcorde --- src/plugins/scene3d/Scene3D.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/plugins/scene3d/Scene3D.cc b/src/plugins/scene3d/Scene3D.cc index b9900f4bc..7610ef3b1 100644 --- a/src/plugins/scene3d/Scene3D.cc +++ b/src/plugins/scene3d/Scene3D.cc @@ -29,6 +29,8 @@ #include #include +#include + #include #include @@ -681,6 +683,20 @@ rendering::GeometryPtr SceneManager::LoadGeometry(const msgs::Geometry &_msg, scale.Y() = scale.X(); scale.Z() = _msg.cylinder().length(); } + else if (_msg.has_capsule()) + { + auto capsule = this->scene->CreateCapsule(); + capsule->SetRadius(_msg.capsule().radius()); + capsule->SetLength(_msg.capsule().length()); + geom = capsule; + } + else if (_msg.has_ellipsoid()) + { + geom = this->scene->CreateSphere(); + scale.X() = _msg.ellipsoid().radii().x() * 2; + scale.Y() = _msg.ellipsoid().radii().y() * 2; + scale.Z() = _msg.ellipsoid().radii().z() * 2; + } else if (_msg.has_plane()) { geom = this->scene->CreatePlane();