mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-11 00:39:59 +00:00
94dc696f4f
In file included from /home/elsid/dev/openmw/apps/openmw/mwphysics/actor.hpp:7, from /home/elsid/dev/openmw/apps/openmw/mwphysics/trace.cpp:9: /home/elsid/dev/openmw/apps/openmw/mwphysics/ptrholder.hpp: In member function ‘osg::Vec3f MWPhysics::PtrHolder::velocity()’: /home/elsid/dev/openmw/apps/openmw/mwphysics/ptrholder.hpp:42:25: error: ‘exchange’ is not a member of ‘std’ 42 | return std::exchange(mVelocity, osg::Vec3f()); | ^~~~~~~~
83 lines
1.7 KiB
C++
83 lines
1.7 KiB
C++
#ifndef OPENMW_MWPHYSICS_PTRHOLDER_H
|
|
#define OPENMW_MWPHYSICS_PTRHOLDER_H
|
|
|
|
#include <mutex>
|
|
#include <memory>
|
|
#include <utility>
|
|
|
|
#include <osg/Vec3d>
|
|
|
|
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
|
|
|
|
#include "../mwworld/ptr.hpp"
|
|
|
|
namespace MWPhysics
|
|
{
|
|
class PtrHolder
|
|
{
|
|
public:
|
|
virtual ~PtrHolder() = default;
|
|
|
|
void updatePtr(const MWWorld::Ptr& updated)
|
|
{
|
|
mPtr = updated;
|
|
}
|
|
|
|
MWWorld::Ptr getPtr() const
|
|
{
|
|
return mPtr;
|
|
}
|
|
|
|
btCollisionObject* getCollisionObject() const
|
|
{
|
|
return mCollisionObject.get();
|
|
}
|
|
|
|
void setVelocity(osg::Vec3f velocity)
|
|
{
|
|
mVelocity = velocity;
|
|
}
|
|
|
|
osg::Vec3f velocity()
|
|
{
|
|
return std::exchange(mVelocity, osg::Vec3f());
|
|
}
|
|
|
|
void setSimulationPosition(const osg::Vec3f& position)
|
|
{
|
|
mSimulationPosition = position;
|
|
}
|
|
|
|
osg::Vec3f getSimulationPosition() const
|
|
{
|
|
return mSimulationPosition;
|
|
}
|
|
|
|
void setPosition(const osg::Vec3f& position)
|
|
{
|
|
mPreviousPosition = mPosition;
|
|
mPosition = position;
|
|
}
|
|
|
|
osg::Vec3d getPosition() const
|
|
{
|
|
return mPosition;
|
|
}
|
|
|
|
osg::Vec3d getPreviousPosition() const
|
|
{
|
|
return mPreviousPosition;
|
|
}
|
|
|
|
protected:
|
|
MWWorld::Ptr mPtr;
|
|
std::unique_ptr<btCollisionObject> mCollisionObject;
|
|
osg::Vec3f mVelocity;
|
|
osg::Vec3f mSimulationPosition;
|
|
osg::Vec3d mPosition;
|
|
osg::Vec3d mPreviousPosition;
|
|
};
|
|
}
|
|
|
|
#endif
|