|
|
|
@ -95,7 +95,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mShape->mHasCollisionNode = hasRootCollisionNode(node);
|
|
|
|
|
mShape->mAutogenerated = hasAutoGeneratedCollision(node);
|
|
|
|
|
|
|
|
|
|
//do a first pass
|
|
|
|
|
handleNode(node,0,false,false,false);
|
|
|
|
@ -152,12 +152,9 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|
|
|
|
mShape->mRaycastingShape = new TriangleMeshShape(mStaticMesh,true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ManualBulletShapeLoader::hasRootCollisionNode(Nif::Node const * node)
|
|
|
|
|
bool ManualBulletShapeLoader::hasAutoGeneratedCollision(Nif::Node const * rootNode)
|
|
|
|
|
{
|
|
|
|
|
if(node->recType == Nif::RC_RootCollisionNode)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
const Nif::NiNode *ninode = dynamic_cast<const Nif::NiNode*>(node);
|
|
|
|
|
const Nif::NiNode *ninode = dynamic_cast<const Nif::NiNode*>(rootNode);
|
|
|
|
|
if(ninode)
|
|
|
|
|
{
|
|
|
|
|
const Nif::NodeList &list = ninode->children;
|
|
|
|
@ -165,13 +162,12 @@ bool ManualBulletShapeLoader::hasRootCollisionNode(Nif::Node const * node)
|
|
|
|
|
{
|
|
|
|
|
if(!list[i].empty())
|
|
|
|
|
{
|
|
|
|
|
if(hasRootCollisionNode(list[i].getPtr()))
|
|
|
|
|
return true;
|
|
|
|
|
if(list[i].getPtr()->recType == Nif::RC_RootCollisionNode)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
|
|
|
@ -230,8 +226,8 @@ void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (isCollisionNode || (!mShape->mHasCollisionNode && !raycasting))
|
|
|
|
|
&& (!isMarker || (mShape->mHasCollisionNode && !raycasting)))
|
|
|
|
|
if ( (isCollisionNode || (mShape->mAutogenerated && !raycasting))
|
|
|
|
|
&& (!isMarker || (!mShape->mAutogenerated && !raycasting)))
|
|
|
|
|
{
|
|
|
|
|
// NOTE: a trishape with hasBounds=true, but no BBoxCollision flag should NOT go through handleNiTriShape!
|
|
|
|
|
// It must be ignored completely.
|
|
|
|
|