mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Use normalized path in BulletShapeManager
This commit is contained in:
parent
7a5c478e34
commit
63e984ba24
10 changed files with 92 additions and 108 deletions
|
@ -33,7 +33,8 @@ namespace
|
|||
{
|
||||
const ObjectId id(&shape);
|
||||
osg::ref_ptr<Resource::BulletShape> bulletShape(new Resource::BulletShape);
|
||||
bulletShape->mFileName = "test.nif";
|
||||
constexpr VFS::Path::NormalizedView test("test.nif");
|
||||
bulletShape->mFileName = test;
|
||||
bulletShape->mFileHash = "test_hash";
|
||||
ObjectTransform objectTransform;
|
||||
std::fill(std::begin(objectTransform.mPosition.pos), std::end(objectTransform.mPosition.pos), 0.1f);
|
||||
|
|
|
@ -131,7 +131,8 @@ namespace NavMeshTool
|
|||
osg::ref_ptr<const Resource::BulletShape> shape = [&] {
|
||||
try
|
||||
{
|
||||
return bulletShapeManager.getShape(Misc::ResourceHelpers::correctMeshPath(model));
|
||||
return bulletShapeManager.getShape(
|
||||
VFS::Path::toNormalized(Misc::ResourceHelpers::correctMeshPath(model)));
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
|
|
@ -412,9 +412,9 @@ namespace MWPhysics
|
|||
if (ptr.mRef->mData.mPhysicsPostponed)
|
||||
return;
|
||||
|
||||
std::string animationMesh = mesh;
|
||||
if (ptr.getClass().useAnim())
|
||||
animationMesh = Misc::ResourceHelpers::correctActorModelPath(mesh, mResourceSystem->getVFS());
|
||||
const VFS::Path::Normalized animationMesh = ptr.getClass().useAnim()
|
||||
? Misc::ResourceHelpers::correctActorModelPath(mesh, mResourceSystem->getVFS())
|
||||
: mesh;
|
||||
osg::ref_ptr<Resource::BulletShapeInstance> shapeInstance = mShapeManager->getInstance(animationMesh);
|
||||
if (!shapeInstance || !shapeInstance->mCollisionShape)
|
||||
return;
|
||||
|
@ -562,7 +562,8 @@ namespace MWPhysics
|
|||
|
||||
void PhysicsSystem::addActor(const MWWorld::Ptr& ptr, const std::string& mesh)
|
||||
{
|
||||
std::string animationMesh = Misc::ResourceHelpers::correctActorModelPath(mesh, mResourceSystem->getVFS());
|
||||
const VFS::Path::Normalized animationMesh
|
||||
= Misc::ResourceHelpers::correctActorModelPath(mesh, mResourceSystem->getVFS());
|
||||
osg::ref_ptr<const Resource::BulletShape> shape = mShapeManager->getShape(animationMesh);
|
||||
|
||||
// Try to get shape from basic model as fallback for creatures
|
||||
|
@ -570,7 +571,7 @@ namespace MWPhysics
|
|||
{
|
||||
if (animationMesh != mesh)
|
||||
{
|
||||
shape = mShapeManager->getShape(mesh);
|
||||
shape = mShapeManager->getShape(VFS::Path::toNormalized(mesh));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -590,7 +591,8 @@ namespace MWPhysics
|
|||
int PhysicsSystem::addProjectile(
|
||||
const MWWorld::Ptr& caster, const osg::Vec3f& position, const std::string& mesh, bool computeRadius)
|
||||
{
|
||||
osg::ref_ptr<Resource::BulletShapeInstance> shapeInstance = mShapeManager->getInstance(mesh);
|
||||
osg::ref_ptr<Resource::BulletShapeInstance> shapeInstance
|
||||
= mShapeManager->getInstance(VFS::Path::toNormalized(mesh));
|
||||
assert(shapeInstance);
|
||||
float radius = computeRadius ? shapeInstance->mCollisionBox.mExtents.length() / 2.f : 1.f;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue