1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-29 04:20:29 +00:00

Rename Resource::BulletShape::CollisionBox fields according to styleguide

This commit is contained in:
elsid 2021-10-28 01:43:25 +02:00
parent e3cfe5d35a
commit 29a772c33f
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40
6 changed files with 31 additions and 31 deletions

View File

@ -22,7 +22,7 @@ namespace MWPhysics
Actor::Actor(const MWWorld::Ptr& ptr, const Resource::BulletShape* shape, PhysicsTaskScheduler* scheduler, bool canWaterWalk)
: mStandingOnPtr(nullptr), mCanWaterWalk(canWaterWalk), mWalkingOnWater(false)
, mMeshTranslation(shape->mCollisionBox.center), mOriginalHalfExtents(shape->mCollisionBox.extents)
, mMeshTranslation(shape->mCollisionBox.mCenter), mOriginalHalfExtents(shape->mCollisionBox.mExtents)
, mStuckFrames(0), mLastStuckPosition{0, 0, 0}
, mForce(0.f, 0.f, 0.f), mOnGround(true), mOnSlope(false)
, mInternalCollisionMode(true)

View File

@ -618,7 +618,7 @@ namespace MWPhysics
osg::ref_ptr<const Resource::BulletShape> shape = mShapeManager->getShape(mesh);
// Try to get shape from basic model as fallback for creatures
if (!ptr.getClass().isNpc() && shape && shape->mCollisionBox.extents.length2() == 0)
if (!ptr.getClass().isNpc() && shape && shape->mCollisionBox.mExtents.length2() == 0)
{
const std::string fallbackModel = ptr.getClass().getModel(ptr);
if (fallbackModel != mesh)
@ -643,7 +643,7 @@ namespace MWPhysics
{
osg::ref_ptr<Resource::BulletShapeInstance> shapeInstance = mShapeManager->getInstance(mesh);
assert(shapeInstance);
float radius = computeRadius ? shapeInstance->mCollisionBox.extents.length() / 2.f : 1.f;
float radius = computeRadius ? shapeInstance->mCollisionBox.mExtents.length() / 2.f : 1.f;
mProjectileId++;

View File

@ -162,8 +162,8 @@ namespace Resource
{
return compareObjects(lhs.mCollisionShape, rhs.mCollisionShape)
&& compareObjects(lhs.mAvoidCollisionShape, rhs.mAvoidCollisionShape)
&& lhs.mCollisionBox.extents == rhs.mCollisionBox.extents
&& lhs.mCollisionBox.center == rhs.mCollisionBox.center
&& lhs.mCollisionBox.mExtents == rhs.mCollisionBox.mExtents
&& lhs.mCollisionBox.mCenter == rhs.mCollisionBox.mCenter
&& lhs.mAnimatedShapes == rhs.mAnimatedShapes;
}
@ -172,8 +172,8 @@ namespace Resource
return stream << "Resource::BulletShape {"
<< value.mCollisionShape << ", "
<< value.mAvoidCollisionShape << ", "
<< "osg::Vec3f {" << value.mCollisionBox.extents << "}" << ", "
<< "osg::Vec3f {" << value.mCollisionBox.center << "}" << ", "
<< "osg::Vec3f {" << value.mCollisionBox.mExtents << "}" << ", "
<< "osg::Vec3f {" << value.mCollisionBox.mCenter << "}" << ", "
<< value.mAnimatedShapes
<< "}";
}
@ -441,8 +441,8 @@ namespace
const auto result = mLoader.load(mNifFile);
Resource::BulletShape expected;
expected.mCollisionBox.extents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.center = osg::Vec3f(-1, -2, -3);
expected.mCollisionBox.mExtents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.mCenter = osg::Vec3f(-1, -2, -3);
std::unique_ptr<btBoxShape> box(new btBoxShape(btVector3(1, 2, 3)));
std::unique_ptr<btCompoundShape> shape(new btCompoundShape);
shape->addChildShape(btTransform(btMatrix3x3::getIdentity(), btVector3(-1, -2, -3)), box.release());
@ -466,8 +466,8 @@ namespace
const auto result = mLoader.load(mNifFile);
Resource::BulletShape expected;
expected.mCollisionBox.extents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.center = osg::Vec3f(-1, -2, -3);
expected.mCollisionBox.mExtents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.mCenter = osg::Vec3f(-1, -2, -3);
std::unique_ptr<btBoxShape> box(new btBoxShape(btVector3(1, 2, 3)));
std::unique_ptr<btCompoundShape> shape(new btCompoundShape);
shape->addChildShape(btTransform(btMatrix3x3::getIdentity(), btVector3(-1, -2, -3)), box.release());
@ -496,8 +496,8 @@ namespace
const auto result = mLoader.load(mNifFile);
Resource::BulletShape expected;
expected.mCollisionBox.extents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.center = osg::Vec3f(-1, -2, -3);
expected.mCollisionBox.mExtents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.mCenter = osg::Vec3f(-1, -2, -3);
std::unique_ptr<btBoxShape> box(new btBoxShape(btVector3(1, 2, 3)));
std::unique_ptr<btCompoundShape> shape(new btCompoundShape);
shape->addChildShape(btTransform(btMatrix3x3::getIdentity(), btVector3(-1, -2, -3)), box.release());
@ -531,8 +531,8 @@ namespace
const auto result = mLoader.load(mNifFile);
Resource::BulletShape expected;
expected.mCollisionBox.extents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.center = osg::Vec3f(-1, -2, -3);
expected.mCollisionBox.mExtents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.mCenter = osg::Vec3f(-1, -2, -3);
std::unique_ptr<btBoxShape> box(new btBoxShape(btVector3(1, 2, 3)));
std::unique_ptr<btCompoundShape> shape(new btCompoundShape);
shape->addChildShape(btTransform(btMatrix3x3::getIdentity(), btVector3(-1, -2, -3)), box.release());
@ -566,8 +566,8 @@ namespace
const auto result = mLoader.load(mNifFile);
Resource::BulletShape expected;
expected.mCollisionBox.extents = osg::Vec3f(4, 5, 6);
expected.mCollisionBox.center = osg::Vec3f(-4, -5, -6);
expected.mCollisionBox.mExtents = osg::Vec3f(4, 5, 6);
expected.mCollisionBox.mCenter = osg::Vec3f(-4, -5, -6);
std::unique_ptr<btBoxShape> box(new btBoxShape(btVector3(4, 5, 6)));
std::unique_ptr<btCompoundShape> shape(new btCompoundShape);
shape->addChildShape(btTransform(btMatrix3x3::getIdentity(), btVector3(-4, -5, -6)), box.release());
@ -589,8 +589,8 @@ namespace
const auto result = mLoader.load(mNifFile);
Resource::BulletShape expected;
expected.mCollisionBox.extents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.center = osg::Vec3f(-1, -2, -3);
expected.mCollisionBox.mExtents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.mCenter = osg::Vec3f(-1, -2, -3);
EXPECT_EQ(*result, expected);
}
@ -623,8 +623,8 @@ namespace
const auto result = mLoader.load(mNifFile);
Resource::BulletShape expected;
expected.mCollisionBox.extents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.center = osg::Vec3f(-1, -2, -3);
expected.mCollisionBox.mExtents = osg::Vec3f(1, 2, 3);
expected.mCollisionBox.mCenter = osg::Vec3f(-1, -2, -3);
EXPECT_EQ(*result, expected);
}

View File

@ -143,8 +143,8 @@ osg::ref_ptr<Resource::BulletShape> BulletNifLoader::load(const Nif::File& nif)
{
if (findBoundingBox(node, filename))
{
const btVector3 extents = Misc::Convert::toBullet(mShape->mCollisionBox.extents);
const btVector3 center = Misc::Convert::toBullet(mShape->mCollisionBox.center);
const btVector3 extents = Misc::Convert::toBullet(mShape->mCollisionBox.mExtents);
const btVector3 center = Misc::Convert::toBullet(mShape->mCollisionBox.mCenter);
std::unique_ptr<btCompoundShape> compound (new btCompoundShape);
std::unique_ptr<btBoxShape> boxShape(new btBoxShape(extents));
btTransform transform = btTransform::getIdentity();
@ -206,8 +206,8 @@ bool BulletNifLoader::findBoundingBox(const Nif::Node* node, const std::string&
switch (type)
{
case Nif::NiBoundingVolume::Type::BOX_BV:
mShape->mCollisionBox.extents = node->bounds.box.extents;
mShape->mCollisionBox.center = node->bounds.box.center;
mShape->mCollisionBox.mExtents = node->bounds.box.extents;
mShape->mCollisionBox.mCenter = node->bounds.box.center;
break;
default:
{

View File

@ -29,8 +29,8 @@ namespace Resource
struct CollisionBox
{
osg::Vec3f extents;
osg::Vec3f center;
osg::Vec3f mExtents;
osg::Vec3f mCenter;
};
// Used for actors and projectiles. mCollisionShape is used for actors only when we need to autogenerate collision box for creatures.
// For now, use one file <-> one resource for simplicity.

View File

@ -86,10 +86,10 @@ public:
btBvhTriangleMeshShape* triangleMeshShape = new TriangleMeshShape(mTriangleMesh.release(), true);
btVector3 aabbMin = triangleMeshShape->getLocalAabbMin();
btVector3 aabbMax = triangleMeshShape->getLocalAabbMax();
shape->mCollisionBox.extents[0] = (aabbMax[0] - aabbMin[0]) / 2.0f;
shape->mCollisionBox.extents[1] = (aabbMax[1] - aabbMin[1]) / 2.0f;
shape->mCollisionBox.extents[2] = (aabbMax[2] - aabbMin[2]) / 2.0f;
shape->mCollisionBox.center = osg::Vec3f( (aabbMax[0] + aabbMin[0]) / 2.0f,
shape->mCollisionBox.mExtents[0] = (aabbMax[0] - aabbMin[0]) / 2.0f;
shape->mCollisionBox.mExtents[1] = (aabbMax[1] - aabbMin[1]) / 2.0f;
shape->mCollisionBox.mExtents[2] = (aabbMax[2] - aabbMin[2]) / 2.0f;
shape->mCollisionBox.mCenter = osg::Vec3f( (aabbMax[0] + aabbMin[0]) / 2.0f,
(aabbMax[1] + aabbMin[1]) / 2.0f,
(aabbMax[2] + aabbMin[2]) / 2.0f );
shape->mCollisionShape = triangleMeshShape;