From 0e1052a1cc6abdd06c00fc3470f2e7558ae15bc1 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 17 Jan 2023 22:10:04 -0600 Subject: [PATCH 1/2] Fix windows warnings related to bullet Signed-off-by: Addisu Z. Taddese --- bullet/src/Base.hh | 20 ++++++++------------ bullet/src/SDFFeatures.cc | 8 ++++---- bullet/src/plugin.cc | 11 ++++++++++- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/bullet/src/Base.hh b/bullet/src/Base.hh index e8cd7e878..8d83be30a 100644 --- a/bullet/src/Base.hh +++ b/bullet/src/Base.hh @@ -111,14 +111,18 @@ struct JointInfo inline btMatrix3x3 convertMat(Eigen::Matrix3d mat) { - return btMatrix3x3(mat(0, 0), mat(0, 1), mat(0, 2), - mat(1, 0), mat(1, 1), mat(1, 2), - mat(2, 0), mat(2, 1), mat(2, 2)); + return btMatrix3x3( + static_cast(mat(0, 0)), static_cast(mat(0, 1)), + static_cast(mat(0, 2)), static_cast(mat(1, 0)), + static_cast(mat(1, 1)), static_cast(mat(1, 2)), + static_cast(mat(2, 0)), static_cast(mat(2, 1)), + static_cast(mat(2, 2))); } inline btVector3 convertVec(Eigen::Vector3d vec) { - return btVector3(vec(0), vec(1), vec(2)); + return btVector3(static_cast(vec(0)), static_cast(vec(1)), + static_cast(vec(2))); } inline Eigen::Matrix3d convert(btMatrix3x3 mat) @@ -146,14 +150,6 @@ class Base : public Implements3d> return entityCount++; } - public: inline Identity InitiateEngine(std::size_t /*_engineID*/) override - { - const auto id = this->GetNextEntity(); - assert(id == 0); - - return this->GenerateIdentity(0); - } - public: inline std::size_t idToIndexInContainer(std::size_t _id) const { auto it = this->childIdToParentId.find(_id); diff --git a/bullet/src/SDFFeatures.cc b/bullet/src/SDFFeatures.cc index 7183b6056..d98cce98d 100644 --- a/bullet/src/SDFFeatures.cc +++ b/bullet/src/SDFFeatures.cc @@ -224,14 +224,14 @@ Identity SDFFeatures::ConstructSdfCollision( else if (geom->SphereShape()) { const auto sphere = geom->SphereShape(); - const auto radius = sphere->Radius(); + const auto radius = static_cast(sphere->Radius()); shape = std::make_shared(radius); } else if (geom->CylinderShape()) { const auto cylinder = geom->CylinderShape(); - const auto radius = cylinder->Radius(); - const auto halfLength = cylinder->Length()*0.5; + const auto radius = static_cast(cylinder->Radius()); + const auto halfLength = static_cast(cylinder->Length() * 0.5); shape = std::make_shared(btVector3(radius, radius, halfLength)); } @@ -239,7 +239,7 @@ Identity SDFFeatures::ConstructSdfCollision( { const auto plane = geom->PlaneShape(); const auto normal = convertVec(math::eigen3::convert(plane->Normal())); - shape = std::make_shared(normal, 0); + shape = std::make_shared(normal, 0.0f); } // TODO(lobotuerk/blast545) Add additional friction parameters for bullet diff --git a/bullet/src/plugin.cc b/bullet/src/plugin.cc index f565a4d9a..5873c6170 100644 --- a/bullet/src/plugin.cc +++ b/bullet/src/plugin.cc @@ -53,7 +53,16 @@ class Plugin : public virtual SDFFeatures, public virtual ShapeFeatures, public virtual JointFeatures -{}; +{ + public: Identity InitiateEngine(std::size_t /*_engineID*/) override + { + const auto id = this->GetNextEntity(); + assert(id == 0); + + return this->GenerateIdentity(0); + } + +}; IGN_PHYSICS_ADD_PLUGIN(Plugin, FeaturePolicy3d, BulletFeatures) From 2f7111a4d3781f83009a9f92d61e215254107c8d Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 19 Jan 2023 10:04:35 -0600 Subject: [PATCH 2/2] Remove extra newline Signed-off-by: Addisu Z. Taddese --- bullet/src/plugin.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/bullet/src/plugin.cc b/bullet/src/plugin.cc index 5873c6170..6de6bdb7e 100644 --- a/bullet/src/plugin.cc +++ b/bullet/src/plugin.cc @@ -61,7 +61,6 @@ class Plugin : return this->GenerateIdentity(0); } - }; IGN_PHYSICS_ADD_PLUGIN(Plugin, FeaturePolicy3d, BulletFeatures)