|
|
|
@ -271,19 +271,16 @@ void ManualBulletShapeLoader::handleNiTriShape(Nif::NiTriShape *shape, int flags
|
|
|
|
|
|
|
|
|
|
Nif::NiTriShapeData *data = shape->data.getPtr();
|
|
|
|
|
|
|
|
|
|
float* vertices = &data->vertices[0];
|
|
|
|
|
short* triangles = &data->triangles[0];
|
|
|
|
|
const std::vector<Ogre::Vector3> &vertices = data->vertices;
|
|
|
|
|
const Ogre::Matrix3 &rot = shape->trafo.rotation;
|
|
|
|
|
const Ogre::Vector3 &pos = shape->trafo.pos;
|
|
|
|
|
float scale = shape->trafo.scale;
|
|
|
|
|
for(unsigned int i=0; i < data->triangles.size(); i = i+3)
|
|
|
|
|
float scale = shape->trafo.scale * parentScale;
|
|
|
|
|
short* triangles = &data->triangles[0];
|
|
|
|
|
for(size_t i = 0;i < data->triangles.size();i+=3)
|
|
|
|
|
{
|
|
|
|
|
Ogre::Vector3 b1(vertices[triangles[i+0]*3]*parentScale,vertices[triangles[i+0]*3+1]*parentScale,vertices[triangles[i+0]*3+2]*parentScale);
|
|
|
|
|
Ogre::Vector3 b2(vertices[triangles[i+1]*3]*parentScale,vertices[triangles[i+1]*3+1]*parentScale,vertices[triangles[i+1]*3+2]*parentScale);
|
|
|
|
|
Ogre::Vector3 b3(vertices[triangles[i+2]*3]*parentScale,vertices[triangles[i+2]*3+1]*parentScale,vertices[triangles[i+2]*3+2]*parentScale);
|
|
|
|
|
b1 = pos + rot*b1*scale;
|
|
|
|
|
b2 = pos + rot*b2*scale;
|
|
|
|
|
b3 = pos + rot*b3*scale;
|
|
|
|
|
Ogre::Vector3 b1 = pos + rot*vertices[triangles[i+0]]*scale;
|
|
|
|
|
Ogre::Vector3 b2 = pos + rot*vertices[triangles[i+1]]*scale;
|
|
|
|
|
Ogre::Vector3 b3 = pos + rot*vertices[triangles[i+2]]*scale;
|
|
|
|
|
mTriMesh->addTriangle(btVector3(b1.x,b1.y,b1.z),btVector3(b2.x,b2.y,b2.z),btVector3(b3.x,b3.y,b3.z));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|