mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
Make BulletShape::makeInstance free function
This commit is contained in:
parent
b905dd17c3
commit
fc9a405dc5
@ -99,10 +99,9 @@ bool BulletShape::isAnimated() const
|
||||
return !mAnimatedShapes.empty();
|
||||
}
|
||||
|
||||
osg::ref_ptr<BulletShapeInstance> BulletShape::makeInstance() const
|
||||
osg::ref_ptr<BulletShapeInstance> makeInstance(osg::ref_ptr<const BulletShape> source)
|
||||
{
|
||||
osg::ref_ptr<BulletShapeInstance> instance (new BulletShapeInstance(this));
|
||||
return instance;
|
||||
return {new BulletShapeInstance(std::move(source))};
|
||||
}
|
||||
|
||||
BulletShapeInstance::BulletShapeInstance(osg::ref_ptr<const BulletShape> source)
|
||||
|
@ -21,7 +21,6 @@ namespace Resource
|
||||
|
||||
using CollisionShapePtr = std::unique_ptr<btCollisionShape, DeleteCollisionShape>;
|
||||
|
||||
class BulletShapeInstance;
|
||||
class BulletShape : public osg::Object
|
||||
{
|
||||
public:
|
||||
@ -48,8 +47,6 @@ namespace Resource
|
||||
// we store the node's record index mapped to the child index of the shape in the btCompoundShape.
|
||||
std::map<int, int> mAnimatedShapes;
|
||||
|
||||
osg::ref_ptr<BulletShapeInstance> makeInstance() const;
|
||||
|
||||
btCollisionShape* getCollisionShape() const;
|
||||
|
||||
btCollisionShape* getAvoidCollisionShape() const;
|
||||
@ -71,6 +68,8 @@ namespace Resource
|
||||
osg::ref_ptr<const BulletShape> mSource;
|
||||
};
|
||||
|
||||
osg::ref_ptr<BulletShapeInstance> makeInstance(osg::ref_ptr<const BulletShape> source);
|
||||
|
||||
// Subclass btBhvTriangleMeshShape to auto-delete the meshInterface
|
||||
struct TriangleMeshShape : public btBvhTriangleMeshShape
|
||||
{
|
||||
|
@ -193,9 +193,8 @@ osg::ref_ptr<BulletShapeInstance> BulletShapeManager::createInstance(const std::
|
||||
{
|
||||
osg::ref_ptr<const BulletShape> shape = getShape(name);
|
||||
if (shape)
|
||||
return shape->makeInstance();
|
||||
else
|
||||
return osg::ref_ptr<BulletShapeInstance>();
|
||||
return makeInstance(std::move(shape));
|
||||
return osg::ref_ptr<BulletShapeInstance>();
|
||||
}
|
||||
|
||||
void BulletShapeManager::updateCache(double referenceTime)
|
||||
|
Loading…
Reference in New Issue
Block a user