|
|
|
@ -55,18 +55,90 @@ void NIFFile::parse()
|
|
|
|
|
{
|
|
|
|
|
SString rec = getString();
|
|
|
|
|
|
|
|
|
|
cout << i << ": " << rec.toString() << endl;
|
|
|
|
|
//cout << i << ": " << rec.toString() << endl;
|
|
|
|
|
|
|
|
|
|
Record *r;
|
|
|
|
|
|
|
|
|
|
// This can be heavily optimized later if needed. For example, a
|
|
|
|
|
// hash table or a FSM-based parser could be used to look up
|
|
|
|
|
// node names.
|
|
|
|
|
if(rec == "NiNode") r = new NiNode;
|
|
|
|
|
/* These are all the record types we know how to read.
|
|
|
|
|
|
|
|
|
|
This can be heavily optimized later if needed. For example, a
|
|
|
|
|
hash table or a FSM-based parser could be used to look up
|
|
|
|
|
node names.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// NiNodes
|
|
|
|
|
if(rec == "NiNode" || rec == "AvoidNode" ||
|
|
|
|
|
rec == "RootCollisionNode" ||
|
|
|
|
|
rec == "NiBSParticleNode" ||
|
|
|
|
|
rec == "NiBSAnimationNode" ||
|
|
|
|
|
rec == "NiBillboardNode") r = new NiNode;
|
|
|
|
|
|
|
|
|
|
// Other nodes
|
|
|
|
|
else if(rec == "NiTriShape") r = new NiTriShape;
|
|
|
|
|
else if(rec == "NiRotatingParticles") r = new NiRotatingParticles;
|
|
|
|
|
else if(rec == "NiAutoNormalParticles") r = new NiAutoNormalParticles;
|
|
|
|
|
else if(rec == "NiCamera") r = new NiCamera;
|
|
|
|
|
|
|
|
|
|
// Properties
|
|
|
|
|
else if(rec == "NiTexturingProperty") r = new NiTexturingProperty;
|
|
|
|
|
else if(rec == "NiMaterialProperty") r = new NiMaterialProperty;
|
|
|
|
|
else if(rec == "NiZBufferProperty") r = new NiZBufferProperty;
|
|
|
|
|
else if(rec == "NiAlphaProperty") r = new NiAlphaProperty;
|
|
|
|
|
else if(rec == "NiVertexColorProperty") r = new NiVertexColorProperty;
|
|
|
|
|
else if(rec == "NiShadeProperty") r = new NiShadeProperty;
|
|
|
|
|
else if(rec == "NiDitherProperty") r = new NiDitherProperty;
|
|
|
|
|
else if(rec == "NiWireframeProperty") r = new NiWireframeProperty;
|
|
|
|
|
else if(rec == "NiSpecularProperty") r = new NiSpecularProperty;
|
|
|
|
|
|
|
|
|
|
// Controllers
|
|
|
|
|
else if(rec == "NiVisController") r = new NiVisController;
|
|
|
|
|
else if(rec == "NiGeomMorpherController") r = new NiGeomMorpherController;
|
|
|
|
|
else if(rec == "NiKeyframeController") r = new NiKeyframeController;
|
|
|
|
|
else if(rec == "NiAlphaController") r = new NiAlphaController;
|
|
|
|
|
else if(rec == "NiUVController") r = new NiUVController;
|
|
|
|
|
else if(rec == "NiPathController") r = new NiPathController;
|
|
|
|
|
else if(rec == "NiMaterialColorController") r = new NiMaterialColorController;
|
|
|
|
|
else if(rec == "NiBSPArrayController") r = new NiBSPArrayController;
|
|
|
|
|
else if(rec == "NiParticleSystemController") r = new NiParticleSystemController;
|
|
|
|
|
|
|
|
|
|
// Effects
|
|
|
|
|
else if(rec == "NiAmbientLight" ||
|
|
|
|
|
rec == "NiDirectionalLight") r = new NiLight;
|
|
|
|
|
else if(rec == "NiTextureEffect") r = new NiTextureEffect;
|
|
|
|
|
|
|
|
|
|
// Extra Data
|
|
|
|
|
else if(rec == "NiVertWeightsExtraData") r = new NiVertWeightsExtraData;
|
|
|
|
|
else if(rec == "NiTextKeyExtraData") r = new NiTextKeyExtraData;
|
|
|
|
|
else if(rec == "NiStringExtraData") r = new NiStringExtraData;
|
|
|
|
|
|
|
|
|
|
else if(rec == "NiGravity") r = new NiGravity;
|
|
|
|
|
else if(rec == "NiPlanarCollider") r = new NiPlanarCollider;
|
|
|
|
|
else if(rec == "NiParticleGrowFade") r = new NiParticleGrowFade;
|
|
|
|
|
else if(rec == "NiParticleColorModifier") r = new NiParticleColorModifier;
|
|
|
|
|
else if(rec == "NiParticleRotation") r = new NiParticleRotation;
|
|
|
|
|
|
|
|
|
|
// Data
|
|
|
|
|
else if(rec == "NiFloatData") r = new NiFloatData;
|
|
|
|
|
else if(rec == "NiTriShapeData") r = new NiTriShapeData;
|
|
|
|
|
else if(rec == "NiVisData") r = new NiVisData;
|
|
|
|
|
else if(rec == "NiColorData") r = new NiColorData;
|
|
|
|
|
else if(rec == "NiPixelData") r = new NiPixelData;
|
|
|
|
|
else if(rec == "NiMorphData") r = new NiMorphData;
|
|
|
|
|
else if(rec == "NiKeyframeData") r = new NiKeyframeData;
|
|
|
|
|
else if(rec == "NiSkinData") r = new NiSkinData;
|
|
|
|
|
else if(rec == "NiUVData") r = new NiUVData;
|
|
|
|
|
else if(rec == "NiPosData") r = new NiPosData;
|
|
|
|
|
else if(rec == "NiRotatingParticlesData") r = new NiRotatingParticlesData;
|
|
|
|
|
else if(rec == "NiAutoNormalParticlesData") r = new NiAutoNormalParticlesData;
|
|
|
|
|
|
|
|
|
|
// Other
|
|
|
|
|
else if(rec == "NiSequenceStreamHelper") r = new NiSequenceStreamHelper;
|
|
|
|
|
else if(rec == "NiSourceTexture") r = new NiSourceTexture;
|
|
|
|
|
else break;
|
|
|
|
|
else if(rec == "NiSkinInstance") r = new NiSkinInstance;
|
|
|
|
|
|
|
|
|
|
// Failure
|
|
|
|
|
else
|
|
|
|
|
fail("Unknown record type " + rec.toString());
|
|
|
|
|
|
|
|
|
|
r->read(this);
|
|
|
|
|
}
|
|
|
|
|