mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-25 16:43:33 +00:00
Move btCollisionObject* into PtrHolder
Remove unused function
This commit is contained in:
parent
8ad3d3d792
commit
e88b94d0b0
@ -21,7 +21,7 @@ namespace MWPhysics
|
|||||||
|
|
||||||
Actor::Actor(const MWWorld::Ptr& ptr, const Resource::BulletShape* shape, PhysicsTaskScheduler* scheduler, bool canWaterWalk)
|
Actor::Actor(const MWWorld::Ptr& ptr, const Resource::BulletShape* shape, PhysicsTaskScheduler* scheduler, bool canWaterWalk)
|
||||||
: mStandingOnPtr(nullptr), mCanWaterWalk(canWaterWalk), mWalkingOnWater(false)
|
: 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}
|
, mVelocity(0,0,0), mStuckFrames(0), mLastStuckPosition{0, 0, 0}
|
||||||
, mForce(0.f, 0.f, 0.f), mOnGround(true), mOnSlope(false)
|
, mForce(0.f, 0.f, 0.f), mOnGround(true), mOnSlope(false)
|
||||||
, mInternalCollisionMode(true)
|
, mInternalCollisionMode(true)
|
||||||
|
@ -132,11 +132,6 @@ namespace MWPhysics
|
|||||||
return mInternalCollisionMode && mOnSlope;
|
return mInternalCollisionMode && mOnSlope;
|
||||||
}
|
}
|
||||||
|
|
||||||
btCollisionObject* getCollisionObject() const
|
|
||||||
{
|
|
||||||
return mCollisionObject.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets whether this actor should be able to collide with the water surface
|
/// Sets whether this actor should be able to collide with the water surface
|
||||||
void setCanWaterWalk(bool waterWalk);
|
void setCanWaterWalk(bool waterWalk);
|
||||||
|
|
||||||
@ -188,8 +183,6 @@ namespace MWPhysics
|
|||||||
std::unique_ptr<btCollisionShape> mShape;
|
std::unique_ptr<btCollisionShape> mShape;
|
||||||
btConvexShape* mConvexShape;
|
btConvexShape* mConvexShape;
|
||||||
|
|
||||||
std::unique_ptr<btCollisionObject> mCollisionObject;
|
|
||||||
|
|
||||||
osg::Vec3f mMeshTranslation;
|
osg::Vec3f mMeshTranslation;
|
||||||
osg::Vec3f mOriginalHalfExtents;
|
osg::Vec3f mOriginalHalfExtents;
|
||||||
osg::Vec3f mHalfExtents;
|
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
|
btTransform Object::getTransform() const
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(mPositionMutex);
|
std::unique_lock<std::mutex> lock(mPositionMutex);
|
||||||
|
@ -33,8 +33,6 @@ namespace MWPhysics
|
|||||||
void setRotation(osg::Quat quat);
|
void setRotation(osg::Quat quat);
|
||||||
void updatePosition();
|
void updatePosition();
|
||||||
void commitPositionChange();
|
void commitPositionChange();
|
||||||
btCollisionObject* getCollisionObject();
|
|
||||||
const btCollisionObject* getCollisionObject() const;
|
|
||||||
btTransform getTransform() const;
|
btTransform getTransform() const;
|
||||||
/// Return solid flag. Not used by the object itself, true by default.
|
/// Return solid flag. Not used by the object itself, true by default.
|
||||||
bool isSolid() const;
|
bool isSolid() const;
|
||||||
@ -45,7 +43,6 @@ namespace MWPhysics
|
|||||||
bool animateCollisionShapes();
|
bool animateCollisionShapes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<btCollisionObject> mCollisionObject;
|
|
||||||
osg::ref_ptr<Resource::BulletShapeInstance> mShapeInstance;
|
osg::ref_ptr<Resource::BulletShapeInstance> mShapeInstance;
|
||||||
std::map<int, osg::NodePath> mRecIndexToNodePath;
|
std::map<int, osg::NodePath> mRecIndexToNodePath;
|
||||||
bool mSolid;
|
bool mSolid;
|
||||||
|
@ -42,11 +42,6 @@ namespace MWPhysics
|
|||||||
void setPosition(const osg::Vec3f& position);
|
void setPosition(const osg::Vec3f& position);
|
||||||
osg::Vec3f getPosition() const;
|
osg::Vec3f getPosition() const;
|
||||||
|
|
||||||
btCollisionObject* getCollisionObject() const
|
|
||||||
{
|
|
||||||
return mCollisionObject.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isActive() const
|
bool isActive() const
|
||||||
{
|
{
|
||||||
return mActive.load(std::memory_order_acquire);
|
return mActive.load(std::memory_order_acquire);
|
||||||
@ -76,7 +71,6 @@ namespace MWPhysics
|
|||||||
std::unique_ptr<btCollisionShape> mShape;
|
std::unique_ptr<btCollisionShape> mShape;
|
||||||
btConvexShape* mConvexShape;
|
btConvexShape* mConvexShape;
|
||||||
|
|
||||||
std::unique_ptr<btCollisionObject> mCollisionObject;
|
|
||||||
bool mTransformUpdatePending;
|
bool mTransformUpdatePending;
|
||||||
bool mCanCrossWaterSurface;
|
bool mCanCrossWaterSurface;
|
||||||
bool mCrossedWaterSurface;
|
bool mCrossedWaterSurface;
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
#define OPENMW_MWPHYSICS_PTRHOLDER_H
|
#define OPENMW_MWPHYSICS_PTRHOLDER_H
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
@ -10,7 +13,7 @@ namespace MWPhysics
|
|||||||
class PtrHolder
|
class PtrHolder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~PtrHolder() {}
|
virtual ~PtrHolder() = default;
|
||||||
|
|
||||||
void updatePtr(const MWWorld::Ptr& updated)
|
void updatePtr(const MWWorld::Ptr& updated)
|
||||||
{
|
{
|
||||||
@ -24,14 +27,14 @@ namespace MWPhysics
|
|||||||
return mPtr;
|
return mPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::ConstPtr getPtr() const
|
btCollisionObject* getCollisionObject() const
|
||||||
{
|
{
|
||||||
std::scoped_lock lock(mMutex);
|
return mCollisionObject.get();
|
||||||
return mPtr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MWWorld::Ptr mPtr;
|
MWWorld::Ptr mPtr;
|
||||||
|
std::unique_ptr<btCollisionObject> mCollisionObject;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable std::mutex mMutex;
|
mutable std::mutex mMutex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user