mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-31 19:20:26 +00:00
Improve bullet performances
This commit is contained in:
parent
4367b93e64
commit
1bf7c4e53d
@ -88,8 +88,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||||||
resourceName = cShape->getName();
|
resourceName = cShape->getName();
|
||||||
cShape->collide = false;
|
cShape->collide = false;
|
||||||
|
|
||||||
currentShape = new btCompoundShape();
|
mTriMesh = new btTriangleMesh();
|
||||||
cShape->Shape = currentShape;
|
|
||||||
|
|
||||||
if (!vfs) vfs = new OgreVFS(resourceGroup);
|
if (!vfs) vfs = new OgreVFS(resourceGroup);
|
||||||
|
|
||||||
@ -135,6 +134,9 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||||||
{
|
{
|
||||||
handleNode(node,0,Ogre::Matrix3::IDENTITY,Ogre::Vector3::ZERO,1,hasCollisionNode,false,true);
|
handleNode(node,0,Ogre::Matrix3::IDENTITY,Ogre::Vector3::ZERO,1,hasCollisionNode,false,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentShape = new btBvhTriangleMeshShape(mTriMesh,true);
|
||||||
|
cShape->Shape = currentShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManualBulletShapeLoader::hasRootCollisionNode(Nif::Node* node)
|
bool ManualBulletShapeLoader::hasRootCollisionNode(Nif::Node* node)
|
||||||
@ -247,7 +249,6 @@ void ManualBulletShapeLoader::handleNiTriShape(Nif::NiTriShape *shape, int flags
|
|||||||
bool raycastingOnly)
|
bool raycastingOnly)
|
||||||
{
|
{
|
||||||
assert(shape != NULL);
|
assert(shape != NULL);
|
||||||
btCollisionShape* NodeShape;
|
|
||||||
|
|
||||||
// Interpret flags
|
// Interpret flags
|
||||||
bool hidden = (flags & 0x01) != 0; // Not displayed
|
bool hidden = (flags & 0x01) != 0; // Not displayed
|
||||||
@ -289,7 +290,6 @@ void ManualBulletShapeLoader::handleNiTriShape(Nif::NiTriShape *shape, int flags
|
|||||||
|
|
||||||
/* Do in-place transformation.the only needed transfo is the scale. (maybe not in fact)
|
/* Do in-place transformation.the only needed transfo is the scale. (maybe not in fact)
|
||||||
*/
|
*/
|
||||||
btTriangleMesh *mTriMesh = new btTriangleMesh();
|
|
||||||
|
|
||||||
Nif::NiTriShapeData *data = shape->data.getPtr();
|
Nif::NiTriShapeData *data = shape->data.getPtr();
|
||||||
|
|
||||||
@ -303,8 +303,6 @@ void ManualBulletShapeLoader::handleNiTriShape(Nif::NiTriShape *shape, int flags
|
|||||||
btVector3 b3(vertices[triangles[i+2]*3]*parentScale,vertices[triangles[i+2]*3+1]*parentScale,vertices[triangles[i+2]*3+2]*parentScale);
|
btVector3 b3(vertices[triangles[i+2]*3]*parentScale,vertices[triangles[i+2]*3+1]*parentScale,vertices[triangles[i+2]*3+2]*parentScale);
|
||||||
mTriMesh->addTriangle(b1,b2,b3);
|
mTriMesh->addTriangle(b1,b2,b3);
|
||||||
}
|
}
|
||||||
NodeShape = new btBvhTriangleMeshShape(mTriMesh,true);
|
|
||||||
currentShape->addChildShape(tr,NodeShape);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualBulletShapeLoader::load(const std::string &name,const std::string &group)
|
void ManualBulletShapeLoader::load(const std::string &name,const std::string &group)
|
||||||
|
@ -125,7 +125,8 @@ private:
|
|||||||
std::string resourceGroup;
|
std::string resourceGroup;
|
||||||
|
|
||||||
BulletShape* cShape;//current shape
|
BulletShape* cShape;//current shape
|
||||||
btCompoundShape* currentShape;//the shape curently under construction
|
btTriangleMesh *mTriMesh;
|
||||||
|
btBvhTriangleMeshShape* currentShape;//the shape curently under construction
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user