mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 03:40:24 +00:00
Finished all NIF records
This commit is contained in:
parent
f773ef4b45
commit
7191c51828
6 changed files with 286 additions and 1 deletions
161
nif/controller.h
Normal file
161
nif/controller.h
Normal file
|
@ -0,0 +1,161 @@
|
||||||
|
/*
|
||||||
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||||
|
Copyright (C) 2008-2010 Nicolay Korslund
|
||||||
|
Email: < korslund@gmail.com >
|
||||||
|
WWW: http://openmw.sourceforge.net/
|
||||||
|
|
||||||
|
This file (controller.h) is part of the OpenMW package.
|
||||||
|
|
||||||
|
OpenMW is distributed as free software: you can redistribute it
|
||||||
|
and/or modify it under the terms of the GNU General Public License
|
||||||
|
version 3, as published by the Free Software Foundation.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
version 3 along with this program. If not, see
|
||||||
|
http://www.gnu.org/licenses/ .
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _NIF_CONTROLLER_H_
|
||||||
|
#define _NIF_CONTROLLER_H_
|
||||||
|
|
||||||
|
#include "record.h"
|
||||||
|
#include "nif_file.h"
|
||||||
|
#include "record_ptr.h"
|
||||||
|
|
||||||
|
namespace Nif
|
||||||
|
{
|
||||||
|
|
||||||
|
struct Controller : Record
|
||||||
|
{
|
||||||
|
ControllerPtr next;
|
||||||
|
int flags;
|
||||||
|
float frequency, phase;
|
||||||
|
float timeStart, timeStop;
|
||||||
|
ControlledPtr target;
|
||||||
|
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
next.read(nif);
|
||||||
|
|
||||||
|
flags = nif->getShort();
|
||||||
|
|
||||||
|
frequency = nif->getFloat();
|
||||||
|
phase = nif->getFloat();
|
||||||
|
timeStart = nif->getFloat();
|
||||||
|
timeStop = nif->getFloat();
|
||||||
|
|
||||||
|
target.read(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NiBSPArrayController : Controller
|
||||||
|
{
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Controller::read(nif);
|
||||||
|
|
||||||
|
// At the moment, just skip it all
|
||||||
|
nif->skip(111);
|
||||||
|
int s = nif->getShort();
|
||||||
|
nif->skip(15 + s*40);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
typedef NiBSPArrayController NiParticleSystemController;
|
||||||
|
|
||||||
|
struct NiMaterialColorController : Controller
|
||||||
|
{
|
||||||
|
NiPosDataPtr data;
|
||||||
|
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Controller::read(nif);
|
||||||
|
data.read(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NiPathController : Controller
|
||||||
|
{
|
||||||
|
NiPosDataPtr posData;
|
||||||
|
NiFloatDataPtr floatData;
|
||||||
|
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Controller::read(nif);
|
||||||
|
|
||||||
|
/*
|
||||||
|
int = 1
|
||||||
|
2xfloat
|
||||||
|
short = 0 or 1
|
||||||
|
*/
|
||||||
|
nif->skip(14);
|
||||||
|
posData.read(nif);
|
||||||
|
floatData.read(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NiUVController : Controller
|
||||||
|
{
|
||||||
|
NiUVDataPtr data;
|
||||||
|
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Controller::read(nif);
|
||||||
|
|
||||||
|
nif->getShort(); // always 0
|
||||||
|
data.read(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NiKeyframeController : Controller
|
||||||
|
{
|
||||||
|
NiKeyframeDataPtr data;
|
||||||
|
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Controller::read(nif);
|
||||||
|
data.read(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NiAlphaController : Controller
|
||||||
|
{
|
||||||
|
NiFloatDataPtr data;
|
||||||
|
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Controller::read(nif);
|
||||||
|
data.read(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NiGeomMorpherController : Controller
|
||||||
|
{
|
||||||
|
NiMorphDataPtr data;
|
||||||
|
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Controller::read(nif);
|
||||||
|
data.read(nif);
|
||||||
|
nif->getByte(); // always 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NiVisController : Controller
|
||||||
|
{
|
||||||
|
NiVisDataPtr data;
|
||||||
|
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Controller::read(nif);
|
||||||
|
data.read(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // Namespace
|
||||||
|
#endif
|
14
nif/data.h
14
nif/data.h
|
@ -433,5 +433,19 @@ struct NiKeyframeData : Record
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct NiSkinInstance : Record
|
||||||
|
{
|
||||||
|
NiSkinDataPtr data;
|
||||||
|
NodePtr root;
|
||||||
|
NodeList bones;
|
||||||
|
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
data.read(nif);
|
||||||
|
root.read(nif);
|
||||||
|
bones.read(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
#endif
|
#endif
|
||||||
|
|
92
nif/effect.h
Normal file
92
nif/effect.h
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||||
|
Copyright (C) 2008-2010 Nicolay Korslund
|
||||||
|
Email: < korslund@gmail.com >
|
||||||
|
WWW: http://openmw.sourceforge.net/
|
||||||
|
|
||||||
|
This file (effect.h) is part of the OpenMW package.
|
||||||
|
|
||||||
|
OpenMW is distributed as free software: you can redistribute it
|
||||||
|
and/or modify it under the terms of the GNU General Public License
|
||||||
|
version 3, as published by the Free Software Foundation.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
version 3 along with this program. If not, see
|
||||||
|
http://www.gnu.org/licenses/ .
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _NIF_EFFECT_H_
|
||||||
|
#define _NIF_EFFECT_H_
|
||||||
|
|
||||||
|
#include "node.h"
|
||||||
|
|
||||||
|
namespace Nif
|
||||||
|
{
|
||||||
|
|
||||||
|
typedef Node Effect;
|
||||||
|
|
||||||
|
// Used for NiAmbientLight and NiDirectionalLight. Might also work for
|
||||||
|
// NiPointLight and NiSpotLight?
|
||||||
|
struct NiLight : Effect
|
||||||
|
{
|
||||||
|
struct SLight
|
||||||
|
{
|
||||||
|
float dimmer;
|
||||||
|
Vector ambient;
|
||||||
|
Vector diffuse;
|
||||||
|
Vector specular;
|
||||||
|
};
|
||||||
|
|
||||||
|
const SLight *light;
|
||||||
|
|
||||||
|
void read(NIFFile *nif)
|
||||||
|
{
|
||||||
|
Effect::read(nif);
|
||||||
|
|
||||||
|
nif->getInt(); // 1
|
||||||
|
nif->getInt(); // 1?
|
||||||
|
light = nif->getPtr<SLight>();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NiTextureEffect : Effect
|
||||||
|
{
|
||||||
|
NiSourceTexturePtr texture;
|
||||||
|
|
||||||
|
void read(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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // Namespace
|
||||||
|
#endif
|
|
@ -42,7 +42,7 @@ struct Extra : Record
|
||||||
void read(NIFFile *nif) { extra.read(nif); }
|
void read(NIFFile *nif) { extra.read(nif); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NiVertWeigthsExtraData : Extra
|
struct NiVertWeightsExtraData : Extra
|
||||||
{
|
{
|
||||||
void read(NIFFile *nif)
|
void read(NIFFile *nif)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "property.h"
|
#include "property.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
|
#include "effect.h"
|
||||||
|
#include "controller.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -126,9 +126,17 @@ class RecordListT
|
||||||
class Node;
|
class Node;
|
||||||
class Extra;
|
class Extra;
|
||||||
class Property;
|
class Property;
|
||||||
|
class NiUVData;
|
||||||
|
class NiPosData;
|
||||||
|
class NiVisData;
|
||||||
class Controller;
|
class Controller;
|
||||||
|
class Controlled;
|
||||||
|
class NiSkinData;
|
||||||
|
class NiFloatData;
|
||||||
|
class NiMorphData;
|
||||||
class NiPixelData;
|
class NiPixelData;
|
||||||
class NiColorData;
|
class NiColorData;
|
||||||
|
class NiKeyframeData;
|
||||||
class NiTriShapeData;
|
class NiTriShapeData;
|
||||||
class NiSkinInstance;
|
class NiSkinInstance;
|
||||||
class NiSourceTexture;
|
class NiSourceTexture;
|
||||||
|
@ -137,9 +145,17 @@ class NiAutoNormalParticlesData;
|
||||||
|
|
||||||
typedef RecordPtrT<Node> NodePtr;
|
typedef RecordPtrT<Node> NodePtr;
|
||||||
typedef RecordPtrT<Extra> ExtraPtr;
|
typedef RecordPtrT<Extra> ExtraPtr;
|
||||||
|
typedef RecordPtrT<NiUVData> NiUVDataPtr;
|
||||||
|
typedef RecordPtrT<NiPosData> NiPosDataPtr;
|
||||||
|
typedef RecordPtrT<NiVisData> NiVisDataPtr;
|
||||||
typedef RecordPtrT<Controller> ControllerPtr;
|
typedef RecordPtrT<Controller> ControllerPtr;
|
||||||
|
typedef RecordPtrT<Controlled> ControlledPtr;
|
||||||
|
typedef RecordPtrT<NiSkinData> NiSkinDataPtr;
|
||||||
|
typedef RecordPtrT<NiMorphData> NiMorphDataPtr;
|
||||||
typedef RecordPtrT<NiPixelData> NiPixelDataPtr;
|
typedef RecordPtrT<NiPixelData> NiPixelDataPtr;
|
||||||
|
typedef RecordPtrT<NiFloatData> NiFloatDataPtr;
|
||||||
typedef RecordPtrT<NiColorData> NiColorDataPtr;
|
typedef RecordPtrT<NiColorData> NiColorDataPtr;
|
||||||
|
typedef RecordPtrT<NiKeyframeData> NiKeyframeDataPtr;
|
||||||
typedef RecordPtrT<NiTriShapeData> NiTriShapeDataPtr;
|
typedef RecordPtrT<NiTriShapeData> NiTriShapeDataPtr;
|
||||||
typedef RecordPtrT<NiSkinInstance> NiSkinInstancePtr;
|
typedef RecordPtrT<NiSkinInstance> NiSkinInstancePtr;
|
||||||
typedef RecordPtrT<NiSourceTexture> NiSourceTexturePtr;
|
typedef RecordPtrT<NiSourceTexture> NiSourceTexturePtr;
|
||||||
|
|
Loading…
Reference in a new issue