Finished all NIF records
parent
f773ef4b45
commit
7191c51828
@ -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
|
@ -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
|
Loading…
Reference in New Issue