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

Fix BulletShape copy constructor and use for BulletShapeInstance

Copy mVisualCollisionType.
This commit is contained in:
elsid 2023-05-14 13:52:04 +02:00
parent 04d439485b
commit a8a76f9a05
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625
2 changed files with 13 additions and 16 deletions

View File

@ -71,13 +71,15 @@ namespace Resource
deleteShape(shape);
}
BulletShape::BulletShape(const BulletShape& copy, const osg::CopyOp& copyop)
: mCollisionShape(duplicateCollisionShape(copy.mCollisionShape.get()))
, mAvoidCollisionShape(duplicateCollisionShape(copy.mAvoidCollisionShape.get()))
, mCollisionBox(copy.mCollisionBox)
, mAnimatedShapes(copy.mAnimatedShapes)
, mFileName(copy.mFileName)
, mFileHash(copy.mFileHash)
BulletShape::BulletShape(const BulletShape& other, const osg::CopyOp& copyOp)
: Object(other, copyOp)
, mCollisionShape(duplicateCollisionShape(other.mCollisionShape.get()))
, mAvoidCollisionShape(duplicateCollisionShape(other.mAvoidCollisionShape.get()))
, mCollisionBox(other.mCollisionBox)
, mAnimatedShapes(other.mAnimatedShapes)
, mFileName(other.mFileName)
, mFileHash(other.mFileHash)
, mVisualCollisionType(other.mVisualCollisionType)
{
}
@ -94,13 +96,8 @@ namespace Resource
}
BulletShapeInstance::BulletShapeInstance(osg::ref_ptr<const BulletShape> source)
: mSource(std::move(source))
: BulletShape(*source)
, mSource(std::move(source))
{
mCollisionBox = mSource->mCollisionBox;
mAnimatedShapes = mSource->mAnimatedShapes;
mVisualCollisionType = mSource->mVisualCollisionType;
mCollisionShape = duplicateCollisionShape(mSource->mCollisionShape.get());
mAvoidCollisionShape = duplicateCollisionShape(mSource->mAvoidCollisionShape.get());
}
}

View File

@ -61,7 +61,7 @@ namespace Resource
VisualCollisionType mVisualCollisionType = VisualCollisionType::None;
BulletShape() = default;
BulletShape(const BulletShape& copy, const osg::CopyOp& copyop);
BulletShape(const BulletShape& other, const osg::CopyOp& copyOp = osg::CopyOp());
META_Object(Resource, BulletShape)
@ -76,7 +76,7 @@ namespace Resource
class BulletShapeInstance : public BulletShape
{
public:
BulletShapeInstance(osg::ref_ptr<const BulletShape> source);
explicit BulletShapeInstance(osg::ref_ptr<const BulletShape> source);
const osg::ref_ptr<const BulletShape>& getSource() const { return mSource; }