NIF reader cleanup: move definitions to cpp file

c++11
scrawl 9 years ago
parent da690c91b3
commit 6b36e55a4e

@ -32,26 +32,8 @@ public:
float timeStart, timeStop;
ControlledPtr target;
void read(NIFStream *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);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
/// Anything that has a controller

@ -62,31 +62,8 @@ public:
*/
int alpha;
void read(NIFStream *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);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
class NiParticleGrowFade : public Controlled
@ -95,12 +72,7 @@ public:
float growTime;
float fadeTime;
void read(NIFStream *nif)
{
Controlled::read(nif);
growTime = nif->getFloat();
fadeTime = nif->getFloat();
}
void read(NIFStream *nif);
};
class NiParticleColorModifier : public Controlled
@ -108,17 +80,8 @@ class NiParticleColorModifier : public Controlled
public:
NiColorDataPtr data;
void read(NIFStream *nif)
{
Controlled::read(nif);
data.read(nif);
}
void post(NIFFile *nif)
{
Controlled::post(nif);
data.post(nif);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
class NiGravity : public Controlled
@ -132,45 +95,20 @@ public:
osg::Vec3f mPosition;
osg::Vec3f mDirection;
void read(NIFStream *nif)
{
Controlled::read(nif);
/*unknown*/nif->getFloat();
mForce = nif->getFloat();
mType = nif->getUInt();
mPosition = nif->getVector3();
mDirection = nif->getVector3();
}
void read(NIFStream *nif);
};
// NiPinaColada
class NiPlanarCollider : public Controlled
{
public:
void read(NIFStream *nif)
{
Controlled::read(nif);
// (I think) 4 floats + 4 vectors
nif->skip(4*16);
}
void read(NIFStream *nif);
};
class NiParticleRotation : public Controlled
{
public:
void read(NIFStream *nif)
{
Controlled::read(nif);
/*
byte (0 or 1)
float (1)
float*3
*/
nif->skip(17);
}
void read(NIFStream *nif);
};

@ -74,66 +74,8 @@ public:
ExtraPtr extra;
void read(NIFStream *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);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
typedef NiParticleSystemController NiBSPArrayController;
@ -142,17 +84,8 @@ class NiMaterialColorController : public Controller
public:
NiPosDataPtr data;
void read(NIFStream *nif)
{
Controller::read(nif);
data.read(nif);
}
void post(NIFFile *nif)
{
Controller::post(nif);
data.post(nif);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
class NiPathController : public Controller
@ -161,27 +94,8 @@ public:
NiPosDataPtr posData;
NiFloatDataPtr floatData;
void read(NIFStream *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);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
class NiUVController : public Controller
@ -189,19 +103,8 @@ class NiUVController : public Controller
public:
NiUVDataPtr data;
void read(NIFStream *nif)
{
Controller::read(nif);
nif->getUShort(); // always 0
data.read(nif);
}
void post(NIFFile *nif)
{
Controller::post(nif);
data.post(nif);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
class NiKeyframeController : public Controller
@ -209,17 +112,8 @@ class NiKeyframeController : public Controller
public:
NiKeyframeDataPtr data;
void read(NIFStream *nif)
{
Controller::read(nif);
data.read(nif);
}
void post(NIFFile *nif)
{
Controller::post(nif);
data.post(nif);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
class NiAlphaController : public Controller
@ -227,17 +121,8 @@ class NiAlphaController : public Controller
public:
NiFloatDataPtr data;
void read(NIFStream *nif)
{
Controller::read(nif);
data.read(nif);
}
void post(NIFFile *nif)
{
Controller::post(nif);
data.post(nif);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
class NiGeomMorpherController : public Controller
@ -245,18 +130,8 @@ class NiGeomMorpherController : public Controller
public:
NiMorphDataPtr data;
void read(NIFStream *nif)
{
Controller::read(nif);
data.read(nif);
nif->getChar(); // always 0
}
void post(NIFFile *nif)
{
Controller::post(nif);
data.post(nif);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
class NiVisController : public Controller
@ -264,17 +139,8 @@ class NiVisController : public Controller
public:
NiVisDataPtr data;
void read(NIFStream *nif)
{
Controller::read(nif);
data.read(nif);
}
void post(NIFFile *nif)
{
Controller::post(nif);
data.post(nif);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
class NiFlipController : public Controller
@ -284,20 +150,8 @@ public:
float mDelta; // Time between two flips. delta = (start_time - stop_time) / num_sources
NiSourceTextureList mSources;
void read(NIFStream *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);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
} // Namespace

@ -3,6 +3,13 @@
namespace Nif
{
void NiSkinInstance::read(NIFStream *nif)
{
data.read(nif);
root.read(nif);
bones.read(nif);
}
void NiSkinInstance::post(NIFFile *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

@ -41,34 +41,7 @@ public:
osg::Vec3f center;
float radius;
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);
}
}
void read(NIFStream *nif);
};
class NiTriShapeData : public ShapeData
@ -77,28 +50,7 @@ public:
// Triangles, three vertex indices per triangle
std::vector<short> triangles;
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));
}
}
void read(NIFStream *nif);
};
class NiAutoNormalParticlesData : public ShapeData
@ -112,22 +64,7 @@ public:
std::vector<float> sizes;
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());
}
}
void read(NIFStream *nif);
};
class NiRotatingParticlesData : public NiAutoNormalParticlesData
@ -135,16 +72,7 @@ class NiRotatingParticlesData : public NiAutoNormalParticlesData
public:
std::vector<osg::Quat> rotations;
void read(NIFStream *nif)
{
NiAutoNormalParticlesData::read(nif);
if(nif->getInt())
{
// Rotation quaternions.
nif->getQuaternions(rotations, vertices.size());
}
}
void read(NIFStream *nif);
};
class NiPosData : public Record
@ -152,10 +80,7 @@ class NiPosData : public Record
public:
Vector3KeyMap mKeyList;
void read(NIFStream *nif)
{
mKeyList.read(nif);
}
void read(NIFStream *nif);
};
class NiUVData : public Record
@ -163,11 +88,7 @@ class NiUVData : public Record
public:
FloatKeyMap mKeyList[4];
void read(NIFStream *nif)
{
for(int i = 0;i < 4;i++)
mKeyList[i].read(nif);
}
void read(NIFStream *nif);
};
class NiFloatData : public Record
@ -175,10 +96,7 @@ class NiFloatData : public Record
public:
FloatKeyMap mKeyList;
void read(NIFStream *nif)
{
mKeyList.read(nif);
}
void read(NIFStream *nif);
};
class NiPixelData : public Record
@ -187,37 +105,7 @@ public:
unsigned int rmask, gmask, bmask, amask;
int bpp, mips;
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);
}
void read(NIFStream *nif);
};
class NiColorData : public Record
@ -225,10 +113,7 @@ class NiColorData : public Record
public:
Vector4KeyMap mKeyMap;
void read(NIFStream *nif)
{
mKeyMap.read(nif);
}
void read(NIFStream *nif);
};
class NiVisData : public Record
@ -240,16 +125,7 @@ public:
};
std::vector<VisData> mVis;
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();
}
}
void read(NIFStream *nif);
};
class NiSkinInstance : public Record
@ -259,13 +135,7 @@ public:
NodePtr root;
NodeList bones;
void read(NIFStream *nif)
{
data.read(nif);
root.read(nif);
bones.read(nif);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
@ -288,34 +158,7 @@ public:
Transformation trafo;
std::vector<BoneInfo> bones;
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();
}
}
}
void read(NIFStream *nif);
};
struct NiMorphData : public Record
@ -326,19 +169,7 @@ struct NiMorphData : public Record
};
std::vector<MorphData> mMorphs;
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);
}
}
void read(NIFStream *nif);
};
@ -353,20 +184,7 @@ struct NiKeyframeData : public Record
Vector3KeyMap mTranslations;
FloatKeyMap mScales;
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);
}
void read(NIFStream *nif);
};
} // Namespace

@ -42,63 +42,19 @@ struct NiLight : Effect
osg::Vec3f diffuse;
osg::Vec3f specular;
void read(NIFStream *nif)
{
dimmer = nif->getFloat();
ambient = nif->getVector3();
diffuse = nif->getVector3();
specular = nif->getVector3();
}
void read(NIFStream *nif);
};
SLight light;
void read(NIFStream *nif)
{
Effect::read(nif);
nif->getInt(); // 1
nif->getInt(); // 1?
light.read(nif);
}
void read(NIFStream *nif);
};
struct NiTextureEffect : Effect
{
NiSourceTexturePtr texture;
void read(NIFStream *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);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
} // Namespace

@ -32,17 +32,7 @@ namespace Nif
class NiVertWeightsExtraData : public Extra
{
public:
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
}
void read(NIFStream *nif);
};
class NiTextKeyExtraData : public Extra
@ -55,20 +45,7 @@ public:
};
std::vector<TextKey> list;
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();
}
}
void read(NIFStream *nif);
};
class NiStringExtraData : public Extra
@ -80,13 +57,7 @@ public:
*/
std::string string;
void read(NIFStream *nif)
{
Extra::read(nif);
nif->getInt(); // size of string + 4. Really useful...
string = nif->getString();
}
void read(NIFStream *nif);
};
} // Namespace

@ -24,6 +24,10 @@ struct KeyT {
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)()>
struct KeyMapT {

@ -26,9 +26,6 @@
#include "base.hpp"
#include "controlled.hpp"
#include "data.hpp"
namespace Nif
{
@ -38,11 +35,7 @@ public:
// The meaning of these depends on the actual property type.
int flags;
void read(NIFStream *nif)
{
Named::read(nif);
flags = nif->getUShort();
}
void read(NIFStream *nif);
};
class NiTexturingProperty : public Property
@ -70,26 +63,8 @@ public:
int clamp, uvSet, filter;
short unknown2;
void read(NIFStream *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);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
/* Apply mode:
@ -120,42 +95,14 @@ public:
GlossTexture = 3,
GlowTexture = 4,
BumpTexture = 5,
DecalTexture = 6
DecalTexture = 6,
NumTextures = 7 // Sentry value
};
Texture textures[7];
void read(NIFStream *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);
}
void read(NIFStream *nif);
void post(NIFFile *nif);
};
class NiFogProperty : public Property
@ -164,14 +111,7 @@ public:
float mFogDepth;
osg::Vec3f mColour;
void read(NIFStream *nif)
{
Property::read(nif);
mFogDepth = nif->getFloat();
mColour = nif->getVector3();
}
void read(NIFStream *nif);
};
// These contain no other data than the 'flags' field in Property
@ -200,15 +140,7 @@ struct S_MaterialProperty
osg::Vec3f ambient, diffuse, specular, emissive;
float glossiness, alpha;
void read(NIFStream *nif)
{
ambient = nif->getVector3();
diffuse = nif->getVector3();
specular = nif->getVector3();
emissive = nif->getVector3();
glossiness = nif->getFloat();
alpha = nif->getFloat();
}
void read(NIFStream *nif);
};
struct S_VertexColorProperty
@ -224,11 +156,7 @@ struct S_VertexColorProperty
*/
int vertmode, lightmode;
void read(NIFStream *nif)
{
vertmode = nif->getInt();
lightmode = nif->getInt();
}
void read(NIFStream *nif);
};
struct S_AlphaProperty
@ -273,10 +201,7 @@ struct S_AlphaProperty
// Tested against when certain flags are set (see above.)
unsigned char threshold;
void read(NIFStream *nif)
{
threshold = nif->getChar();
}
void read(NIFStream *nif);
};
/*
@ -322,17 +247,7 @@ struct S_StencilProperty
*/
int drawMode;
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();
}
void read(NIFStream *nif);
};
class NiAlphaProperty : public StructPropT<S_AlphaProperty> { };

@ -110,12 +110,6 @@ struct Record
virtual void post(NIFFile *nif) {}
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

Loading…
Cancel
Save