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