mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-23 18:41:36 +00:00
Merge remote-tracking branch 'chris/nif-fixes'
This commit is contained in:
commit
6238c8d758
3 changed files with 15 additions and 15 deletions
|
@ -142,20 +142,18 @@ public:
|
||||||
{
|
{
|
||||||
ShapeData::read(nif);
|
ShapeData::read(nif);
|
||||||
|
|
||||||
int tris = nif->getUShort();
|
/*int tris =*/ nif->getUShort();
|
||||||
if(tris)
|
|
||||||
{
|
// We have three times as many vertices as triangles, so this
|
||||||
// We have three times as many vertices as triangles, so this
|
// is always equal to tris*3.
|
||||||
// is always equal to tris*3.
|
int cnt = nif->getInt();
|
||||||
int cnt = nif->getInt();
|
nif->getShorts(triangles, cnt);
|
||||||
nif->getShorts(triangles, cnt);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read the match list, which lists the vertices that are equal to
|
// Read the match list, which lists the vertices that are equal to
|
||||||
// vertices. We don't actually need need this for anything, so
|
// vertices. We don't actually need need this for anything, so
|
||||||
// just skip it.
|
// just skip it.
|
||||||
int verts = nif->getUShort();
|
int verts = nif->getUShort();
|
||||||
for(int i=0;i<verts;i++)
|
for(int i=0;i < verts;i++)
|
||||||
{
|
{
|
||||||
// Number of vertices matching vertex 'i'
|
// Number of vertices matching vertex 'i'
|
||||||
int num = nif->getUShort();
|
int num = nif->getUShort();
|
||||||
|
|
|
@ -220,11 +220,10 @@ void NIFFile::parse()
|
||||||
|
|
||||||
for(size_t i = 0;i < recNum;i++)
|
for(size_t i = 0;i < recNum;i++)
|
||||||
{
|
{
|
||||||
std::string rec = getString();
|
|
||||||
//cout << i << ": " << rec.toString() << endl;
|
|
||||||
|
|
||||||
Record *r = NULL;
|
Record *r = NULL;
|
||||||
|
|
||||||
|
std::string rec = getString();
|
||||||
|
|
||||||
/* These are all the record types we know how to read.
|
/* These are all the record types we know how to read.
|
||||||
|
|
||||||
This can be heavily optimized later if needed. For example, a
|
This can be heavily optimized later if needed. For example, a
|
||||||
|
|
|
@ -844,9 +844,12 @@ class NIFMeshLoader : Ogre::ManualResourceLoader
|
||||||
// Set the bounding box first
|
// Set the bounding box first
|
||||||
BoundsFinder bounds;
|
BoundsFinder bounds;
|
||||||
bounds.add(&srcVerts[0][0], srcVerts.size());
|
bounds.add(&srcVerts[0][0], srcVerts.size());
|
||||||
// No idea why this offset is needed. It works fine without it if the
|
if(!bounds.isValid())
|
||||||
// vertices weren't transformed first, but otherwise it fails later on
|
{
|
||||||
// when the object is being inserted into the scene.
|
float v[3] = { 0.0f, 0.0f, 0.0f };
|
||||||
|
bounds.add(&v[0], 1);
|
||||||
|
}
|
||||||
|
|
||||||
mesh->_setBounds(Ogre::AxisAlignedBox(bounds.minX()-0.5f, bounds.minY()-0.5f, bounds.minZ()-0.5f,
|
mesh->_setBounds(Ogre::AxisAlignedBox(bounds.minX()-0.5f, bounds.minY()-0.5f, bounds.minZ()-0.5f,
|
||||||
bounds.maxX()+0.5f, bounds.maxY()+0.5f, bounds.maxZ()+0.5f));
|
bounds.maxX()+0.5f, bounds.maxY()+0.5f, bounds.maxZ()+0.5f));
|
||||||
mesh->_setBoundingSphereRadius(bounds.getRadius());
|
mesh->_setBoundingSphereRadius(bounds.getRadius());
|
||||||
|
|
Loading…
Reference in a new issue