Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix windows warnings related to bullet #473

Merged
merged 3 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions bullet/src/Base.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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<btScalar>(mat(0, 0)), static_cast<btScalar>(mat(0, 1)),
static_cast<btScalar>(mat(0, 2)), static_cast<btScalar>(mat(1, 0)),
static_cast<btScalar>(mat(1, 1)), static_cast<btScalar>(mat(1, 2)),
static_cast<btScalar>(mat(2, 0)), static_cast<btScalar>(mat(2, 1)),
static_cast<btScalar>(mat(2, 2)));
}

inline btVector3 convertVec(Eigen::Vector3d vec)
{
return btVector3(vec(0), vec(1), vec(2));
return btVector3(static_cast<btScalar>(vec(0)), static_cast<btScalar>(vec(1)),
static_cast<btScalar>(vec(2)));
}

inline Eigen::Matrix3d convert(btMatrix3x3 mat)
Expand Down Expand Up @@ -146,14 +150,6 @@ class Base : public Implements3d<FeatureList<Feature>>
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);
Expand Down
8 changes: 4 additions & 4 deletions bullet/src/SDFFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,22 +224,22 @@ Identity SDFFeatures::ConstructSdfCollision(
else if (geom->SphereShape())
{
const auto sphere = geom->SphereShape();
const auto radius = sphere->Radius();
const auto radius = static_cast<btScalar>(sphere->Radius());
shape = std::make_shared<btSphereShape>(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<btScalar>(cylinder->Radius());
const auto halfLength = static_cast<btScalar>(cylinder->Length() * 0.5);
shape =
std::make_shared<btCylinderShapeZ>(btVector3(radius, radius, halfLength));
}
else if (geom->PlaneShape())
{
const auto plane = geom->PlaneShape();
const auto normal = convertVec(math::eigen3::convert(plane->Normal()));
shape = std::make_shared<btStaticPlaneShape>(normal, 0);
shape = std::make_shared<btStaticPlaneShape>(normal, 0.0f);
}

// TODO(lobotuerk/blast545) Add additional friction parameters for bullet
Expand Down
10 changes: 9 additions & 1 deletion bullet/src/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ 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)

Expand Down