NIF Transformation redundancy fix and include fixes

c++11
scrawl 10 years ago
parent 8c10d4badb
commit f6f37e02df

@ -26,6 +26,8 @@
#include "base.hpp" #include "base.hpp"
#include "niftypes.hpp" // Transformation
namespace Nif namespace Nif
{ {
@ -270,13 +272,6 @@ public:
class NiSkinData : public Record class NiSkinData : public Record
{ {
public: public:
struct BoneTrafo
{
Matrix3 rotation; // Rotation offset from bone?
osg::Vec3f trans; // Translation
float scale; // Scale
};
struct VertWeight struct VertWeight
{ {
short vertex; short vertex;
@ -285,18 +280,18 @@ public:
struct BoneInfo struct BoneInfo
{ {
BoneTrafo trafo; Transformation trafo;
osg::Vec4f unknown; osg::Vec4f unknown;
std::vector<VertWeight> weights; std::vector<VertWeight> weights;
}; };
BoneTrafo trafo; Transformation trafo;
std::vector<BoneInfo> bones; std::vector<BoneInfo> bones;
void read(NIFStream *nif) void read(NIFStream *nif)
{ {
trafo.rotation = nif->getMatrix3(); trafo.rotation = nif->getMatrix3();
trafo.trans = nif->getVector3(); trafo.pos = nif->getVector3();
trafo.scale = nif->getFloat(); trafo.scale = nif->getFloat();
int boneNum = nif->getInt(); int boneNum = nif->getInt();
@ -308,7 +303,7 @@ public:
BoneInfo &bi = bones[i]; BoneInfo &bi = bones[i];
bi.trafo.rotation = nif->getMatrix3(); bi.trafo.rotation = nif->getMatrix3();
bi.trafo.trans = nif->getVector3(); bi.trafo.pos = nif->getVector3();
bi.trafo.scale = nif->getFloat(); bi.trafo.scale = nif->getFloat();
bi.unknown = nif->getVector4(); bi.unknown = nif->getVector4();

@ -39,7 +39,7 @@ struct Matrix3
{ {
for (int i=0;i<3;++i) for (int i=0;i<3;++i)
for (int j=0;j<3;++j) for (int j=0;j<3;++j)
mValues[i][j] = 0; mValues[i][j] = (i==j) ? 1.f : 0.f;
} }
}; };

@ -68,7 +68,7 @@ public:
NiNode *parent; NiNode *parent;
// Bone transformation. If set, node is a part of a skeleton. // Bone transformation. If set, node is a part of a skeleton.
const NiSkinData::BoneTrafo *boneTrafo; const Transformation *boneTrafo;
// Bone weight info, from NiSkinData // Bone weight info, from NiSkinData
const NiSkinData::BoneInfo *boneInfo; const NiSkinData::BoneInfo *boneInfo;
@ -77,7 +77,7 @@ public:
// boneTrafo is set it is the root bone in the skeleton. // boneTrafo is set it is the root bone in the skeleton.
short boneIndex; short boneIndex;
void makeRootBone(const NiSkinData::BoneTrafo *tr) void makeRootBone(const Transformation *tr)
{ {
boneTrafo = tr; boneTrafo = tr;
boneIndex = -1; boneIndex = -1;

@ -26,6 +26,9 @@
#include "base.hpp" #include "base.hpp"
#include "controlled.hpp"
#include "data.hpp"
namespace Nif namespace Nif
{ {

Loading…
Cancel
Save