1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 22:45:34 +00:00

Fix Bug #1: "Meshes rendered with wrong orientation"

Discard the tranformation of the root NiNode when loading nif files
(set the 'identity' transformation instead).

After applying the fix test the following types of interiors:

 - Dwemer ruins (the bug was common here before the fix)

 - Ancestral tombs (the bug was common here before the fix)

 - Daedric shrines

 - Caves/grottos

 - Dunmer strongholds

 - Telvanni, imperial, redoran houses/towers/castles

Also checked exteriors (although it is hard to do without terrain
rendering)
This commit is contained in:
Roman Melnik 2012-03-22 00:39:19 +02:00
parent 88979577db
commit ebc49de851
2 changed files with 24 additions and 0 deletions

View file

@ -162,6 +162,15 @@ void NIFFile::parse()
r->recName = rec;
records[i] = r;
r->read(this);
// Discard tranformations for the root node, otherwise some meshes
// occasionally get wrong orientation. Only for NiNode-s for now, but
// can be expanded if needed.
// This should be rewritten when the method is cleaned up.
if (0 == i && rec == "NiNode")
{
static_cast<Nif::Node*>(r)->trafo = Nif::Transformation::getIdentity();
}
}
/* After the data, the nif contains an int N and then a list of N

View file

@ -59,6 +59,21 @@ struct Transformation
Matrix rotation;
float scale;
Vector velocity;
static const Transformation* getIdentity()
{
static Transformation* identity = NULL;
if (NULL == identity)
{
identity = new Transformation();
identity->scale = 1.0f;
identity->rotation.v[0].array[0] = 1.0f;
identity->rotation.v[1].array[1] = 1.0f;
identity->rotation.v[2].array[2] = 1.0f;
}
return identity;
}
};
#pragma pack(pop)