Move btCollisionObject* into PtrHolder

Remove unused function
pull/3097/head
fredzio 3 years ago
parent 8ad3d3d792
commit e88b94d0b0

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

@ -132,11 +132,6 @@ namespace MWPhysics
return mInternalCollisionMode && mOnSlope;
}
btCollisionObject* getCollisionObject() const
{
return mCollisionObject.get();
}
/// Sets whether this actor should be able to collide with the water surface
void setCanWaterWalk(bool waterWalk);
@ -188,8 +183,6 @@ namespace MWPhysics
std::unique_ptr<btCollisionShape> mShape;
btConvexShape* mConvexShape;
std::unique_ptr<btCollisionObject> mCollisionObject;
osg::Vec3f mMeshTranslation;
osg::Vec3f mOriginalHalfExtents;
osg::Vec3f mHalfExtents;

@ -83,16 +83,6 @@ namespace MWPhysics
}
}
btCollisionObject* Object::getCollisionObject()
{
return mCollisionObject.get();
}
const btCollisionObject* Object::getCollisionObject() const
{
return mCollisionObject.get();
}
btTransform Object::getTransform() const
{
std::unique_lock<std::mutex> lock(mPositionMutex);

@ -33,8 +33,6 @@ namespace MWPhysics
void setRotation(osg::Quat quat);
void updatePosition();
void commitPositionChange();
btCollisionObject* getCollisionObject();
const btCollisionObject* getCollisionObject() const;
btTransform getTransform() const;
/// Return solid flag. Not used by the object itself, true by default.
bool isSolid() const;
@ -45,7 +43,6 @@ namespace MWPhysics
bool animateCollisionShapes();
private:
std::unique_ptr<btCollisionObject> mCollisionObject;
osg::ref_ptr<Resource::BulletShapeInstance> mShapeInstance;
std::map<int, osg::NodePath> mRecIndexToNodePath;
bool mSolid;

@ -42,11 +42,6 @@ namespace MWPhysics
void setPosition(const osg::Vec3f& position);
osg::Vec3f getPosition() const;
btCollisionObject* getCollisionObject() const
{
return mCollisionObject.get();
}
bool isActive() const
{
return mActive.load(std::memory_order_acquire);
@ -76,7 +71,6 @@ namespace MWPhysics
std::unique_ptr<btCollisionShape> mShape;
btConvexShape* mConvexShape;
std::unique_ptr<btCollisionObject> mCollisionObject;
bool mTransformUpdatePending;
bool mCanCrossWaterSurface;
bool mCrossedWaterSurface;

@ -2,6 +2,9 @@
#define OPENMW_MWPHYSICS_PTRHOLDER_H
#include <mutex>
#include <memory>
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
#include "../mwworld/ptr.hpp"
@ -10,7 +13,7 @@ namespace MWPhysics
class PtrHolder
{
public:
virtual ~PtrHolder() {}
virtual ~PtrHolder() = default;
void updatePtr(const MWWorld::Ptr& updated)
{
@ -24,14 +27,14 @@ namespace MWPhysics
return mPtr;
}
MWWorld::ConstPtr getPtr() const
btCollisionObject* getCollisionObject() const
{
std::scoped_lock lock(mMutex);
return mPtr;
return mCollisionObject.get();
}
protected:
MWWorld::Ptr mPtr;
std::unique_ptr<btCollisionObject> mCollisionObject;
private:
mutable std::mutex mMutex;

Loading…
Cancel
Save