mirror of
https://github.com/OpenMW/openmw.git
synced 2025-05-06 09:41:24 +00:00
NIF reader cleanup: move definitions to cpp file
This commit is contained in:
parent
da690c91b3
commit
6b36e55a4e
10 changed files with 274 additions and 633 deletions
|
@ -32,26 +32,8 @@ public:
|
||||||
float timeStart, timeStop;
|
float timeStart, timeStop;
|
||||||
ControlledPtr target;
|
ControlledPtr target;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
next.read(nif);
|
|
||||||
|
|
||||||
flags = nif->getUShort();
|
|
||||||
|
|
||||||
frequency = nif->getFloat();
|
|
||||||
phase = nif->getFloat();
|
|
||||||
timeStart = nif->getFloat();
|
|
||||||
timeStop = nif->getFloat();
|
|
||||||
|
|
||||||
target.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Record::post(nif);
|
|
||||||
next.post(nif);
|
|
||||||
target.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Anything that has a controller
|
/// Anything that has a controller
|
||||||
|
|
|
@ -62,31 +62,8 @@ public:
|
||||||
*/
|
*/
|
||||||
int alpha;
|
int alpha;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Named::read(nif);
|
|
||||||
|
|
||||||
external = !!nif->getChar();
|
|
||||||
if(external)
|
|
||||||
filename = nif->getString();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nif->getChar(); // always 1
|
|
||||||
data.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
pixel = nif->getInt();
|
|
||||||
mipmap = nif->getInt();
|
|
||||||
alpha = nif->getInt();
|
|
||||||
|
|
||||||
nif->getChar(); // always 1
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Named::post(nif);
|
|
||||||
data.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiParticleGrowFade : public Controlled
|
class NiParticleGrowFade : public Controlled
|
||||||
|
@ -95,12 +72,7 @@ public:
|
||||||
float growTime;
|
float growTime;
|
||||||
float fadeTime;
|
float fadeTime;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
Controlled::read(nif);
|
|
||||||
growTime = nif->getFloat();
|
|
||||||
fadeTime = nif->getFloat();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiParticleColorModifier : public Controlled
|
class NiParticleColorModifier : public Controlled
|
||||||
|
@ -108,17 +80,8 @@ class NiParticleColorModifier : public Controlled
|
||||||
public:
|
public:
|
||||||
NiColorDataPtr data;
|
NiColorDataPtr data;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Controlled::read(nif);
|
|
||||||
data.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Controlled::post(nif);
|
|
||||||
data.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiGravity : public Controlled
|
class NiGravity : public Controlled
|
||||||
|
@ -132,45 +95,20 @@ public:
|
||||||
osg::Vec3f mPosition;
|
osg::Vec3f mPosition;
|
||||||
osg::Vec3f mDirection;
|
osg::Vec3f mDirection;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
Controlled::read(nif);
|
|
||||||
|
|
||||||
/*unknown*/nif->getFloat();
|
|
||||||
mForce = nif->getFloat();
|
|
||||||
mType = nif->getUInt();
|
|
||||||
mPosition = nif->getVector3();
|
|
||||||
mDirection = nif->getVector3();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// NiPinaColada
|
// NiPinaColada
|
||||||
class NiPlanarCollider : public Controlled
|
class NiPlanarCollider : public Controlled
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
Controlled::read(nif);
|
|
||||||
|
|
||||||
// (I think) 4 floats + 4 vectors
|
|
||||||
nif->skip(4*16);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiParticleRotation : public Controlled
|
class NiParticleRotation : public Controlled
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
Controlled::read(nif);
|
|
||||||
|
|
||||||
/*
|
|
||||||
byte (0 or 1)
|
|
||||||
float (1)
|
|
||||||
float*3
|
|
||||||
*/
|
|
||||||
nif->skip(17);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -74,66 +74,8 @@ public:
|
||||||
|
|
||||||
ExtraPtr extra;
|
ExtraPtr extra;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Controller::read(nif);
|
|
||||||
|
|
||||||
velocity = nif->getFloat();
|
|
||||||
velocityRandom = nif->getFloat();
|
|
||||||
verticalDir = nif->getFloat();
|
|
||||||
verticalAngle = nif->getFloat();
|
|
||||||
horizontalDir = nif->getFloat();
|
|
||||||
horizontalAngle = nif->getFloat();
|
|
||||||
/*normal?*/ nif->getVector3();
|
|
||||||
/*color?*/ nif->getVector4();
|
|
||||||
size = nif->getFloat();
|
|
||||||
startTime = nif->getFloat();
|
|
||||||
stopTime = nif->getFloat();
|
|
||||||
nif->getChar();
|
|
||||||
emitRate = nif->getFloat();
|
|
||||||
lifetime = nif->getFloat();
|
|
||||||
lifetimeRandom = nif->getFloat();
|
|
||||||
|
|
||||||
emitFlags = nif->getUShort();
|
|
||||||
offsetRandom = nif->getVector3();
|
|
||||||
|
|
||||||
emitter.read(nif);
|
|
||||||
|
|
||||||
/* Unknown Short, 0?
|
|
||||||
* Unknown Float, 1.0?
|
|
||||||
* Unknown Int, 1?
|
|
||||||
* Unknown Int, 0?
|
|
||||||
* Unknown Short, 0?
|
|
||||||
*/
|
|
||||||
nif->skip(16);
|
|
||||||
|
|
||||||
numParticles = nif->getUShort();
|
|
||||||
activeCount = nif->getUShort();
|
|
||||||
|
|
||||||
particles.resize(numParticles);
|
|
||||||
for(size_t i = 0;i < particles.size();i++)
|
|
||||||
{
|
|
||||||
particles[i].velocity = nif->getVector3();
|
|
||||||
nif->getVector3(); /* unknown */
|
|
||||||
particles[i].lifetime = nif->getFloat();
|
|
||||||
particles[i].lifespan = nif->getFloat();
|
|
||||||
particles[i].timestamp = nif->getFloat();
|
|
||||||
nif->getUShort(); /* unknown */
|
|
||||||
particles[i].vertex = nif->getUShort();
|
|
||||||
}
|
|
||||||
|
|
||||||
nif->getUInt(); /* -1? */
|
|
||||||
extra.read(nif);
|
|
||||||
nif->getUInt(); /* -1? */
|
|
||||||
nif->getChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Controller::post(nif);
|
|
||||||
emitter.post(nif);
|
|
||||||
extra.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
typedef NiParticleSystemController NiBSPArrayController;
|
typedef NiParticleSystemController NiBSPArrayController;
|
||||||
|
|
||||||
|
@ -142,17 +84,8 @@ class NiMaterialColorController : public Controller
|
||||||
public:
|
public:
|
||||||
NiPosDataPtr data;
|
NiPosDataPtr data;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Controller::read(nif);
|
|
||||||
data.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Controller::post(nif);
|
|
||||||
data.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiPathController : public Controller
|
class NiPathController : public Controller
|
||||||
|
@ -161,27 +94,8 @@ public:
|
||||||
NiPosDataPtr posData;
|
NiPosDataPtr posData;
|
||||||
NiFloatDataPtr floatData;
|
NiFloatDataPtr floatData;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Controller::read(nif);
|
|
||||||
|
|
||||||
/*
|
|
||||||
int = 1
|
|
||||||
2xfloat
|
|
||||||
short = 0 or 1
|
|
||||||
*/
|
|
||||||
nif->skip(14);
|
|
||||||
posData.read(nif);
|
|
||||||
floatData.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Controller::post(nif);
|
|
||||||
|
|
||||||
posData.post(nif);
|
|
||||||
floatData.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiUVController : public Controller
|
class NiUVController : public Controller
|
||||||
|
@ -189,19 +103,8 @@ class NiUVController : public Controller
|
||||||
public:
|
public:
|
||||||
NiUVDataPtr data;
|
NiUVDataPtr data;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Controller::read(nif);
|
|
||||||
|
|
||||||
nif->getUShort(); // always 0
|
|
||||||
data.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Controller::post(nif);
|
|
||||||
data.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiKeyframeController : public Controller
|
class NiKeyframeController : public Controller
|
||||||
|
@ -209,17 +112,8 @@ class NiKeyframeController : public Controller
|
||||||
public:
|
public:
|
||||||
NiKeyframeDataPtr data;
|
NiKeyframeDataPtr data;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Controller::read(nif);
|
|
||||||
data.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Controller::post(nif);
|
|
||||||
data.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiAlphaController : public Controller
|
class NiAlphaController : public Controller
|
||||||
|
@ -227,17 +121,8 @@ class NiAlphaController : public Controller
|
||||||
public:
|
public:
|
||||||
NiFloatDataPtr data;
|
NiFloatDataPtr data;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Controller::read(nif);
|
|
||||||
data.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Controller::post(nif);
|
|
||||||
data.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiGeomMorpherController : public Controller
|
class NiGeomMorpherController : public Controller
|
||||||
|
@ -245,18 +130,8 @@ class NiGeomMorpherController : public Controller
|
||||||
public:
|
public:
|
||||||
NiMorphDataPtr data;
|
NiMorphDataPtr data;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Controller::read(nif);
|
|
||||||
data.read(nif);
|
|
||||||
nif->getChar(); // always 0
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Controller::post(nif);
|
|
||||||
data.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiVisController : public Controller
|
class NiVisController : public Controller
|
||||||
|
@ -264,17 +139,8 @@ class NiVisController : public Controller
|
||||||
public:
|
public:
|
||||||
NiVisDataPtr data;
|
NiVisDataPtr data;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Controller::read(nif);
|
|
||||||
data.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Controller::post(nif);
|
|
||||||
data.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiFlipController : public Controller
|
class NiFlipController : public Controller
|
||||||
|
@ -284,20 +150,8 @@ public:
|
||||||
float mDelta; // Time between two flips. delta = (start_time - stop_time) / num_sources
|
float mDelta; // Time between two flips. delta = (start_time - stop_time) / num_sources
|
||||||
NiSourceTextureList mSources;
|
NiSourceTextureList mSources;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Controller::read(nif);
|
|
||||||
mTexSlot = nif->getUInt();
|
|
||||||
/*unknown=*/nif->getUInt();/*0?*/
|
|
||||||
mDelta = nif->getFloat();
|
|
||||||
mSources.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Controller::post(nif);
|
|
||||||
mSources.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
|
@ -3,6 +3,13 @@
|
||||||
|
|
||||||
namespace Nif
|
namespace Nif
|
||||||
{
|
{
|
||||||
|
void NiSkinInstance::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
data.read(nif);
|
||||||
|
root.read(nif);
|
||||||
|
bones.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
void NiSkinInstance::post(NIFFile *nif)
|
void NiSkinInstance::post(NIFFile *nif)
|
||||||
{
|
{
|
||||||
data.post(nif);
|
data.post(nif);
|
||||||
|
@ -26,4 +33,206 @@ void NiSkinInstance::post(NIFFile *nif)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShapeData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
int verts = nif->getUShort();
|
||||||
|
|
||||||
|
if(nif->getInt())
|
||||||
|
nif->getVector3s(vertices, verts);
|
||||||
|
|
||||||
|
if(nif->getInt())
|
||||||
|
nif->getVector3s(normals, verts);
|
||||||
|
|
||||||
|
center = nif->getVector3();
|
||||||
|
radius = nif->getFloat();
|
||||||
|
|
||||||
|
if(nif->getInt())
|
||||||
|
nif->getVector4s(colors, verts);
|
||||||
|
|
||||||
|
// Only the first 6 bits are used as a count. I think the rest are
|
||||||
|
// flags of some sort.
|
||||||
|
int uvs = nif->getUShort();
|
||||||
|
uvs &= 0x3f;
|
||||||
|
|
||||||
|
if(nif->getInt())
|
||||||
|
{
|
||||||
|
uvlist.resize(uvs);
|
||||||
|
for(int i = 0;i < uvs;i++)
|
||||||
|
nif->getVector2s(uvlist[i], verts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiTriShapeData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
ShapeData::read(nif);
|
||||||
|
|
||||||
|
/*int tris =*/ nif->getUShort();
|
||||||
|
|
||||||
|
// We have three times as many vertices as triangles, so this
|
||||||
|
// is always equal to tris*3.
|
||||||
|
int cnt = nif->getInt();
|
||||||
|
nif->getShorts(triangles, cnt);
|
||||||
|
|
||||||
|
// Read the match list, which lists the vertices that are equal to
|
||||||
|
// vertices. We don't actually need need this for anything, so
|
||||||
|
// just skip it.
|
||||||
|
int verts = nif->getUShort();
|
||||||
|
for(int i=0;i < verts;i++)
|
||||||
|
{
|
||||||
|
// Number of vertices matching vertex 'i'
|
||||||
|
int num = nif->getUShort();
|
||||||
|
nif->skip(num * sizeof(short));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiAutoNormalParticlesData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
ShapeData::read(nif);
|
||||||
|
|
||||||
|
// Should always match the number of vertices
|
||||||
|
numParticles = nif->getUShort();
|
||||||
|
|
||||||
|
particleRadius = nif->getFloat();
|
||||||
|
activeCount = nif->getUShort();
|
||||||
|
|
||||||
|
if(nif->getInt())
|
||||||
|
{
|
||||||
|
// Particle sizes
|
||||||
|
nif->getFloats(sizes, vertices.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiRotatingParticlesData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
NiAutoNormalParticlesData::read(nif);
|
||||||
|
|
||||||
|
if(nif->getInt())
|
||||||
|
{
|
||||||
|
// Rotation quaternions.
|
||||||
|
nif->getQuaternions(rotations, vertices.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiPosData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
mKeyList.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiUVData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
for(int i = 0;i < 4;i++)
|
||||||
|
mKeyList[i].read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiFloatData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
mKeyList.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiPixelData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
nif->getInt(); // always 0 or 1
|
||||||
|
|
||||||
|
rmask = nif->getInt(); // usually 0xff
|
||||||
|
gmask = nif->getInt(); // usually 0xff00
|
||||||
|
bmask = nif->getInt(); // usually 0xff0000
|
||||||
|
amask = nif->getInt(); // usually 0xff000000 or zero
|
||||||
|
|
||||||
|
bpp = nif->getInt();
|
||||||
|
|
||||||
|
// Unknown
|
||||||
|
nif->skip(12);
|
||||||
|
|
||||||
|
mips = nif->getInt();
|
||||||
|
|
||||||
|
// Bytes per pixel, should be bpp * 8
|
||||||
|
/*int bytes =*/ nif->getInt();
|
||||||
|
|
||||||
|
for(int i=0; i<mips; i++)
|
||||||
|
{
|
||||||
|
// Image size and offset in the following data field
|
||||||
|
/*int x =*/ nif->getInt();
|
||||||
|
/*int y =*/ nif->getInt();
|
||||||
|
/*int offset =*/ nif->getInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip the data
|
||||||
|
unsigned int dataSize = nif->getInt();
|
||||||
|
nif->skip(dataSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiColorData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
mKeyMap.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiVisData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
int count = nif->getInt();
|
||||||
|
mVis.resize(count);
|
||||||
|
for(size_t i = 0;i < mVis.size();i++)
|
||||||
|
{
|
||||||
|
mVis[i].time = nif->getFloat();
|
||||||
|
mVis[i].isSet = nif->getChar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiSkinData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
trafo.rotation = nif->getMatrix3();
|
||||||
|
trafo.pos = nif->getVector3();
|
||||||
|
trafo.scale = nif->getFloat();
|
||||||
|
|
||||||
|
int boneNum = nif->getInt();
|
||||||
|
nif->getInt(); // -1
|
||||||
|
|
||||||
|
bones.resize(boneNum);
|
||||||
|
for(int i=0;i<boneNum;i++)
|
||||||
|
{
|
||||||
|
BoneInfo &bi = bones[i];
|
||||||
|
|
||||||
|
bi.trafo.rotation = nif->getMatrix3();
|
||||||
|
bi.trafo.pos = nif->getVector3();
|
||||||
|
bi.trafo.scale = nif->getFloat();
|
||||||
|
bi.unknown = nif->getVector4();
|
||||||
|
|
||||||
|
// Number of vertex weights
|
||||||
|
bi.weights.resize(nif->getUShort());
|
||||||
|
for(size_t j = 0;j < bi.weights.size();j++)
|
||||||
|
{
|
||||||
|
bi.weights[j].vertex = nif->getUShort();
|
||||||
|
bi.weights[j].weight = nif->getFloat();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiMorphData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
int morphCount = nif->getInt();
|
||||||
|
int vertCount = nif->getInt();
|
||||||
|
/*relative targets?*/nif->getChar();
|
||||||
|
|
||||||
|
mMorphs.resize(morphCount);
|
||||||
|
for(int i = 0;i < morphCount;i++)
|
||||||
|
{
|
||||||
|
mMorphs[i].mData.read(nif, true);
|
||||||
|
nif->getVector3s(mMorphs[i].mVertices, vertCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiKeyframeData::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
mRotations.read(nif);
|
||||||
|
if(mRotations.mInterpolationType == mRotations.sXYZInterpolation)
|
||||||
|
{
|
||||||
|
//Chomp unused float
|
||||||
|
nif->getFloat();
|
||||||
|
mXRotations.read(nif, true);
|
||||||
|
mYRotations.read(nif, true);
|
||||||
|
mZRotations.read(nif, true);
|
||||||
|
}
|
||||||
|
mTranslations.read(nif);
|
||||||
|
mScales.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
|
@ -41,34 +41,7 @@ public:
|
||||||
osg::Vec3f center;
|
osg::Vec3f center;
|
||||||
float radius;
|
float radius;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
int verts = nif->getUShort();
|
|
||||||
|
|
||||||
if(nif->getInt())
|
|
||||||
nif->getVector3s(vertices, verts);
|
|
||||||
|
|
||||||
if(nif->getInt())
|
|
||||||
nif->getVector3s(normals, verts);
|
|
||||||
|
|
||||||
center = nif->getVector3();
|
|
||||||
radius = nif->getFloat();
|
|
||||||
|
|
||||||
if(nif->getInt())
|
|
||||||
nif->getVector4s(colors, verts);
|
|
||||||
|
|
||||||
// Only the first 6 bits are used as a count. I think the rest are
|
|
||||||
// flags of some sort.
|
|
||||||
int uvs = nif->getUShort();
|
|
||||||
uvs &= 0x3f;
|
|
||||||
|
|
||||||
if(nif->getInt())
|
|
||||||
{
|
|
||||||
uvlist.resize(uvs);
|
|
||||||
for(int i = 0;i < uvs;i++)
|
|
||||||
nif->getVector2s(uvlist[i], verts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiTriShapeData : public ShapeData
|
class NiTriShapeData : public ShapeData
|
||||||
|
@ -77,28 +50,7 @@ public:
|
||||||
// Triangles, three vertex indices per triangle
|
// Triangles, three vertex indices per triangle
|
||||||
std::vector<short> triangles;
|
std::vector<short> triangles;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
ShapeData::read(nif);
|
|
||||||
|
|
||||||
/*int tris =*/ nif->getUShort();
|
|
||||||
|
|
||||||
// We have three times as many vertices as triangles, so this
|
|
||||||
// is always equal to tris*3.
|
|
||||||
int cnt = nif->getInt();
|
|
||||||
nif->getShorts(triangles, cnt);
|
|
||||||
|
|
||||||
// Read the match list, which lists the vertices that are equal to
|
|
||||||
// vertices. We don't actually need need this for anything, so
|
|
||||||
// just skip it.
|
|
||||||
int verts = nif->getUShort();
|
|
||||||
for(int i=0;i < verts;i++)
|
|
||||||
{
|
|
||||||
// Number of vertices matching vertex 'i'
|
|
||||||
int num = nif->getUShort();
|
|
||||||
nif->skip(num * sizeof(short));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiAutoNormalParticlesData : public ShapeData
|
class NiAutoNormalParticlesData : public ShapeData
|
||||||
|
@ -112,22 +64,7 @@ public:
|
||||||
|
|
||||||
std::vector<float> sizes;
|
std::vector<float> sizes;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
ShapeData::read(nif);
|
|
||||||
|
|
||||||
// Should always match the number of vertices
|
|
||||||
numParticles = nif->getUShort();
|
|
||||||
|
|
||||||
particleRadius = nif->getFloat();
|
|
||||||
activeCount = nif->getUShort();
|
|
||||||
|
|
||||||
if(nif->getInt())
|
|
||||||
{
|
|
||||||
// Particle sizes
|
|
||||||
nif->getFloats(sizes, vertices.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiRotatingParticlesData : public NiAutoNormalParticlesData
|
class NiRotatingParticlesData : public NiAutoNormalParticlesData
|
||||||
|
@ -135,16 +72,7 @@ class NiRotatingParticlesData : public NiAutoNormalParticlesData
|
||||||
public:
|
public:
|
||||||
std::vector<osg::Quat> rotations;
|
std::vector<osg::Quat> rotations;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
NiAutoNormalParticlesData::read(nif);
|
|
||||||
|
|
||||||
if(nif->getInt())
|
|
||||||
{
|
|
||||||
// Rotation quaternions.
|
|
||||||
nif->getQuaternions(rotations, vertices.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiPosData : public Record
|
class NiPosData : public Record
|
||||||
|
@ -152,10 +80,7 @@ class NiPosData : public Record
|
||||||
public:
|
public:
|
||||||
Vector3KeyMap mKeyList;
|
Vector3KeyMap mKeyList;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
mKeyList.read(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiUVData : public Record
|
class NiUVData : public Record
|
||||||
|
@ -163,11 +88,7 @@ class NiUVData : public Record
|
||||||
public:
|
public:
|
||||||
FloatKeyMap mKeyList[4];
|
FloatKeyMap mKeyList[4];
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
for(int i = 0;i < 4;i++)
|
|
||||||
mKeyList[i].read(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiFloatData : public Record
|
class NiFloatData : public Record
|
||||||
|
@ -175,10 +96,7 @@ class NiFloatData : public Record
|
||||||
public:
|
public:
|
||||||
FloatKeyMap mKeyList;
|
FloatKeyMap mKeyList;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
mKeyList.read(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiPixelData : public Record
|
class NiPixelData : public Record
|
||||||
|
@ -187,37 +105,7 @@ public:
|
||||||
unsigned int rmask, gmask, bmask, amask;
|
unsigned int rmask, gmask, bmask, amask;
|
||||||
int bpp, mips;
|
int bpp, mips;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
nif->getInt(); // always 0 or 1
|
|
||||||
|
|
||||||
rmask = nif->getInt(); // usually 0xff
|
|
||||||
gmask = nif->getInt(); // usually 0xff00
|
|
||||||
bmask = nif->getInt(); // usually 0xff0000
|
|
||||||
amask = nif->getInt(); // usually 0xff000000 or zero
|
|
||||||
|
|
||||||
bpp = nif->getInt();
|
|
||||||
|
|
||||||
// Unknown
|
|
||||||
nif->skip(12);
|
|
||||||
|
|
||||||
mips = nif->getInt();
|
|
||||||
|
|
||||||
// Bytes per pixel, should be bpp * 8
|
|
||||||
/*int bytes =*/ nif->getInt();
|
|
||||||
|
|
||||||
for(int i=0; i<mips; i++)
|
|
||||||
{
|
|
||||||
// Image size and offset in the following data field
|
|
||||||
/*int x =*/ nif->getInt();
|
|
||||||
/*int y =*/ nif->getInt();
|
|
||||||
/*int offset =*/ nif->getInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip the data
|
|
||||||
unsigned int dataSize = nif->getInt();
|
|
||||||
nif->skip(dataSize);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiColorData : public Record
|
class NiColorData : public Record
|
||||||
|
@ -225,10 +113,7 @@ class NiColorData : public Record
|
||||||
public:
|
public:
|
||||||
Vector4KeyMap mKeyMap;
|
Vector4KeyMap mKeyMap;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
mKeyMap.read(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiVisData : public Record
|
class NiVisData : public Record
|
||||||
|
@ -240,16 +125,7 @@ public:
|
||||||
};
|
};
|
||||||
std::vector<VisData> mVis;
|
std::vector<VisData> mVis;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
int count = nif->getInt();
|
|
||||||
mVis.resize(count);
|
|
||||||
for(size_t i = 0;i < mVis.size();i++)
|
|
||||||
{
|
|
||||||
mVis[i].time = nif->getFloat();
|
|
||||||
mVis[i].isSet = nif->getChar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiSkinInstance : public Record
|
class NiSkinInstance : public Record
|
||||||
|
@ -259,13 +135,7 @@ public:
|
||||||
NodePtr root;
|
NodePtr root;
|
||||||
NodeList bones;
|
NodeList bones;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
data.read(nif);
|
|
||||||
root.read(nif);
|
|
||||||
bones.read(nif);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif);
|
void post(NIFFile *nif);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -288,34 +158,7 @@ public:
|
||||||
Transformation trafo;
|
Transformation trafo;
|
||||||
std::vector<BoneInfo> bones;
|
std::vector<BoneInfo> bones;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
trafo.rotation = nif->getMatrix3();
|
|
||||||
trafo.pos = nif->getVector3();
|
|
||||||
trafo.scale = nif->getFloat();
|
|
||||||
|
|
||||||
int boneNum = nif->getInt();
|
|
||||||
nif->getInt(); // -1
|
|
||||||
|
|
||||||
bones.resize(boneNum);
|
|
||||||
for(int i=0;i<boneNum;i++)
|
|
||||||
{
|
|
||||||
BoneInfo &bi = bones[i];
|
|
||||||
|
|
||||||
bi.trafo.rotation = nif->getMatrix3();
|
|
||||||
bi.trafo.pos = nif->getVector3();
|
|
||||||
bi.trafo.scale = nif->getFloat();
|
|
||||||
bi.unknown = nif->getVector4();
|
|
||||||
|
|
||||||
// Number of vertex weights
|
|
||||||
bi.weights.resize(nif->getUShort());
|
|
||||||
for(size_t j = 0;j < bi.weights.size();j++)
|
|
||||||
{
|
|
||||||
bi.weights[j].vertex = nif->getUShort();
|
|
||||||
bi.weights[j].weight = nif->getFloat();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NiMorphData : public Record
|
struct NiMorphData : public Record
|
||||||
|
@ -326,19 +169,7 @@ struct NiMorphData : public Record
|
||||||
};
|
};
|
||||||
std::vector<MorphData> mMorphs;
|
std::vector<MorphData> mMorphs;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
int morphCount = nif->getInt();
|
|
||||||
int vertCount = nif->getInt();
|
|
||||||
/*relative targets?*/nif->getChar();
|
|
||||||
|
|
||||||
mMorphs.resize(morphCount);
|
|
||||||
for(int i = 0;i < morphCount;i++)
|
|
||||||
{
|
|
||||||
mMorphs[i].mData.read(nif, true);
|
|
||||||
nif->getVector3s(mMorphs[i].mVertices, vertCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -353,20 +184,7 @@ struct NiKeyframeData : public Record
|
||||||
Vector3KeyMap mTranslations;
|
Vector3KeyMap mTranslations;
|
||||||
FloatKeyMap mScales;
|
FloatKeyMap mScales;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
mRotations.read(nif);
|
|
||||||
if(mRotations.mInterpolationType == mRotations.sXYZInterpolation)
|
|
||||||
{
|
|
||||||
//Chomp unused float
|
|
||||||
nif->getFloat();
|
|
||||||
mXRotations.read(nif, true);
|
|
||||||
mYRotations.read(nif, true);
|
|
||||||
mZRotations.read(nif, true);
|
|
||||||
}
|
|
||||||
mTranslations.read(nif);
|
|
||||||
mScales.read(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
|
@ -42,63 +42,19 @@ struct NiLight : Effect
|
||||||
osg::Vec3f diffuse;
|
osg::Vec3f diffuse;
|
||||||
osg::Vec3f specular;
|
osg::Vec3f specular;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
dimmer = nif->getFloat();
|
|
||||||
ambient = nif->getVector3();
|
|
||||||
diffuse = nif->getVector3();
|
|
||||||
specular = nif->getVector3();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
SLight light;
|
SLight light;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
Effect::read(nif);
|
|
||||||
|
|
||||||
nif->getInt(); // 1
|
|
||||||
nif->getInt(); // 1?
|
|
||||||
light.read(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NiTextureEffect : Effect
|
struct NiTextureEffect : Effect
|
||||||
{
|
{
|
||||||
NiSourceTexturePtr texture;
|
NiSourceTexturePtr texture;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Effect::read(nif);
|
|
||||||
|
|
||||||
int tmp = nif->getInt();
|
|
||||||
if(tmp) nif->getInt(); // always 1?
|
|
||||||
|
|
||||||
/*
|
|
||||||
3 x Vector4 = [1,0,0,0]
|
|
||||||
int = 2
|
|
||||||
int = 0 or 3
|
|
||||||
int = 2
|
|
||||||
int = 2
|
|
||||||
*/
|
|
||||||
nif->skip(16*4);
|
|
||||||
|
|
||||||
texture.read(nif);
|
|
||||||
|
|
||||||
/*
|
|
||||||
byte = 0
|
|
||||||
vector4 = [1,0,0,0]
|
|
||||||
short = 0
|
|
||||||
short = -75
|
|
||||||
short = 0
|
|
||||||
*/
|
|
||||||
nif->skip(23);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Effect::post(nif);
|
|
||||||
texture.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
|
@ -32,17 +32,7 @@ namespace Nif
|
||||||
class NiVertWeightsExtraData : public Extra
|
class NiVertWeightsExtraData : public Extra
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
Extra::read(nif);
|
|
||||||
|
|
||||||
// We should have s*4+2 == i, for some reason. Might simply be the
|
|
||||||
// size of the rest of the record, unhelpful as that may be.
|
|
||||||
/*int i =*/ nif->getInt();
|
|
||||||
int s = nif->getUShort();
|
|
||||||
|
|
||||||
nif->skip(s * sizeof(float)); // vertex weights I guess
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiTextKeyExtraData : public Extra
|
class NiTextKeyExtraData : public Extra
|
||||||
|
@ -55,20 +45,7 @@ public:
|
||||||
};
|
};
|
||||||
std::vector<TextKey> list;
|
std::vector<TextKey> list;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
Extra::read(nif);
|
|
||||||
|
|
||||||
nif->getInt(); // 0
|
|
||||||
|
|
||||||
int keynum = nif->getInt();
|
|
||||||
list.resize(keynum);
|
|
||||||
for(int i=0; i<keynum; i++)
|
|
||||||
{
|
|
||||||
list[i].time = nif->getFloat();
|
|
||||||
list[i].text = nif->getString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiStringExtraData : public Extra
|
class NiStringExtraData : public Extra
|
||||||
|
@ -80,13 +57,7 @@ public:
|
||||||
*/
|
*/
|
||||||
std::string string;
|
std::string string;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
Extra::read(nif);
|
|
||||||
|
|
||||||
nif->getInt(); // size of string + 4. Really useful...
|
|
||||||
string = nif->getString();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
|
@ -24,6 +24,10 @@ struct KeyT {
|
||||||
float mContinuity; // Only for TBC interpolation
|
float mContinuity; // Only for TBC interpolation
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
typedef KeyT<float> FloatKey;
|
||||||
|
typedef KeyT<osg::Vec3f> Vector3Key;
|
||||||
|
typedef KeyT<osg::Vec4f> Vector4Key;
|
||||||
|
typedef KeyT<osg::Quat> QuaternionKey;
|
||||||
|
|
||||||
template<typename T, T (NIFStream::*getValue)()>
|
template<typename T, T (NIFStream::*getValue)()>
|
||||||
struct KeyMapT {
|
struct KeyMapT {
|
||||||
|
|
|
@ -26,9 +26,6 @@
|
||||||
|
|
||||||
#include "base.hpp"
|
#include "base.hpp"
|
||||||
|
|
||||||
#include "controlled.hpp"
|
|
||||||
#include "data.hpp"
|
|
||||||
|
|
||||||
namespace Nif
|
namespace Nif
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -38,11 +35,7 @@ public:
|
||||||
// The meaning of these depends on the actual property type.
|
// The meaning of these depends on the actual property type.
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
Named::read(nif);
|
|
||||||
flags = nif->getUShort();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiTexturingProperty : public Property
|
class NiTexturingProperty : public Property
|
||||||
|
@ -70,26 +63,8 @@ public:
|
||||||
int clamp, uvSet, filter;
|
int clamp, uvSet, filter;
|
||||||
short unknown2;
|
short unknown2;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
inUse = !!nif->getInt();
|
|
||||||
if(!inUse) return;
|
|
||||||
|
|
||||||
texture.read(nif);
|
|
||||||
clamp = nif->getInt();
|
|
||||||
filter = nif->getInt();
|
|
||||||
uvSet = nif->getInt();
|
|
||||||
|
|
||||||
// I have no idea, but I think these are actually two
|
|
||||||
// PS2-specific shorts (ps2L and ps2K), followed by an unknown
|
|
||||||
// short.
|
|
||||||
nif->skip(6);
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
texture.post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Apply mode:
|
/* Apply mode:
|
||||||
|
@ -120,42 +95,14 @@ public:
|
||||||
GlossTexture = 3,
|
GlossTexture = 3,
|
||||||
GlowTexture = 4,
|
GlowTexture = 4,
|
||||||
BumpTexture = 5,
|
BumpTexture = 5,
|
||||||
DecalTexture = 6
|
DecalTexture = 6,
|
||||||
|
NumTextures = 7 // Sentry value
|
||||||
};
|
};
|
||||||
|
|
||||||
Texture textures[7];
|
Texture textures[7];
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
void post(NIFFile *nif);
|
||||||
Property::read(nif);
|
|
||||||
apply = nif->getInt();
|
|
||||||
|
|
||||||
// Unknown, always 7. Probably the number of textures to read
|
|
||||||
// below
|
|
||||||
nif->getInt();
|
|
||||||
|
|
||||||
textures[0].read(nif); // Base
|
|
||||||
textures[1].read(nif); // Dark
|
|
||||||
textures[2].read(nif); // Detail
|
|
||||||
textures[3].read(nif); // Gloss (never present)
|
|
||||||
textures[4].read(nif); // Glow
|
|
||||||
textures[5].read(nif); // Bump map
|
|
||||||
if(textures[5].inUse)
|
|
||||||
{
|
|
||||||
// Ignore these at the moment
|
|
||||||
/*float lumaScale =*/ nif->getFloat();
|
|
||||||
/*float lumaOffset =*/ nif->getFloat();
|
|
||||||
/*const Vector4 *lumaMatrix =*/ nif->getVector4();
|
|
||||||
}
|
|
||||||
textures[6].read(nif); // Decal
|
|
||||||
}
|
|
||||||
|
|
||||||
void post(NIFFile *nif)
|
|
||||||
{
|
|
||||||
Property::post(nif);
|
|
||||||
for(int i = 0;i < 7;i++)
|
|
||||||
textures[i].post(nif);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiFogProperty : public Property
|
class NiFogProperty : public Property
|
||||||
|
@ -164,14 +111,7 @@ public:
|
||||||
float mFogDepth;
|
float mFogDepth;
|
||||||
osg::Vec3f mColour;
|
osg::Vec3f mColour;
|
||||||
|
|
||||||
|
void read(NIFStream *nif);
|
||||||
void read(NIFStream *nif)
|
|
||||||
{
|
|
||||||
Property::read(nif);
|
|
||||||
|
|
||||||
mFogDepth = nif->getFloat();
|
|
||||||
mColour = nif->getVector3();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// These contain no other data than the 'flags' field in Property
|
// These contain no other data than the 'flags' field in Property
|
||||||
|
@ -200,15 +140,7 @@ struct S_MaterialProperty
|
||||||
osg::Vec3f ambient, diffuse, specular, emissive;
|
osg::Vec3f ambient, diffuse, specular, emissive;
|
||||||
float glossiness, alpha;
|
float glossiness, alpha;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
ambient = nif->getVector3();
|
|
||||||
diffuse = nif->getVector3();
|
|
||||||
specular = nif->getVector3();
|
|
||||||
emissive = nif->getVector3();
|
|
||||||
glossiness = nif->getFloat();
|
|
||||||
alpha = nif->getFloat();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct S_VertexColorProperty
|
struct S_VertexColorProperty
|
||||||
|
@ -224,11 +156,7 @@ struct S_VertexColorProperty
|
||||||
*/
|
*/
|
||||||
int vertmode, lightmode;
|
int vertmode, lightmode;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
vertmode = nif->getInt();
|
|
||||||
lightmode = nif->getInt();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct S_AlphaProperty
|
struct S_AlphaProperty
|
||||||
|
@ -273,10 +201,7 @@ struct S_AlphaProperty
|
||||||
// Tested against when certain flags are set (see above.)
|
// Tested against when certain flags are set (see above.)
|
||||||
unsigned char threshold;
|
unsigned char threshold;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
threshold = nif->getChar();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -322,17 +247,7 @@ struct S_StencilProperty
|
||||||
*/
|
*/
|
||||||
int drawMode;
|
int drawMode;
|
||||||
|
|
||||||
void read(NIFStream *nif)
|
void read(NIFStream *nif);
|
||||||
{
|
|
||||||
enabled = nif->getChar();
|
|
||||||
compareFunc = nif->getInt();
|
|
||||||
stencilRef = nif->getUInt();
|
|
||||||
stencilMask = nif->getUInt();
|
|
||||||
failAction = nif->getInt();
|
|
||||||
zFailAction = nif->getInt();
|
|
||||||
zPassAction = nif->getInt();
|
|
||||||
drawMode = nif->getInt();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NiAlphaProperty : public StructPropT<S_AlphaProperty> { };
|
class NiAlphaProperty : public StructPropT<S_AlphaProperty> { };
|
||||||
|
|
|
@ -110,12 +110,6 @@ struct Record
|
||||||
virtual void post(NIFFile *nif) {}
|
virtual void post(NIFFile *nif) {}
|
||||||
|
|
||||||
virtual ~Record() {}
|
virtual ~Record() {}
|
||||||
|
|
||||||
/*
|
|
||||||
Use these later if you want custom allocation of all NIF objects
|
|
||||||
static void* operator new(size_t size);
|
|
||||||
static void operator delete(void *p);
|
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
Loading…
Reference in a new issue