2010-01-06 15:22:34 +00:00
|
|
|
/*
|
|
|
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
|
|
|
Copyright (C) 2008-2010 Nicolay Korslund
|
|
|
|
Email: < korslund@gmail.com >
|
|
|
|
WWW: http://openmw.sourceforge.net/
|
|
|
|
|
|
|
|
This file (data.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/ .
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2013-02-24 21:51:56 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_NIF_DATA_HPP
|
|
|
|
#define OPENMW_COMPONENTS_NIF_DATA_HPP
|
2010-01-06 15:22:34 +00:00
|
|
|
|
2014-10-19 06:26:44 +00:00
|
|
|
#include "base.hpp"
|
2010-01-06 15:22:34 +00:00
|
|
|
|
2015-02-20 16:56:49 +00:00
|
|
|
#include "niftypes.hpp" // Transformation
|
|
|
|
|
2015-06-17 23:26:45 +00:00
|
|
|
#include <osg/Array>
|
|
|
|
|
2010-01-06 15:22:34 +00:00
|
|
|
namespace Nif
|
|
|
|
{
|
|
|
|
|
2010-01-06 19:42:32 +00:00
|
|
|
// Common ancestor for several data classes
|
2010-06-28 01:05:01 +00:00
|
|
|
class ShapeData : public Record
|
2010-01-06 19:42:32 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2015-06-17 23:26:45 +00:00
|
|
|
osg::ref_ptr<osg::Vec3Array> vertices, normals;
|
|
|
|
osg::ref_ptr<osg::Vec4Array> colors;
|
|
|
|
|
|
|
|
std::vector< osg::ref_ptr<osg::Vec2Array> > uvlist;
|
2015-02-17 16:08:55 +00:00
|
|
|
osg::Vec3f center;
|
2012-07-03 04:41:21 +00:00
|
|
|
float radius;
|
2010-01-06 19:42:32 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-06 19:42:32 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiTriShapeData : public ShapeData
|
2010-01-06 19:42:32 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2012-07-03 04:41:21 +00:00
|
|
|
// Triangles, three vertex indices per triangle
|
2015-06-17 23:26:45 +00:00
|
|
|
osg::ref_ptr<osg::DrawElementsUShort> triangles;
|
2012-07-03 04:41:21 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-06 19:42:32 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiAutoNormalParticlesData : public ShapeData
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2013-04-06 13:44:34 +00:00
|
|
|
int numParticles;
|
|
|
|
|
2013-04-10 20:37:20 +00:00
|
|
|
float particleRadius;
|
2010-01-07 14:51:42 +00:00
|
|
|
|
2013-04-04 03:56:35 +00:00
|
|
|
int activeCount;
|
2013-04-03 14:00:24 +00:00
|
|
|
|
|
|
|
std::vector<float> sizes;
|
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 14:51:42 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiRotatingParticlesData : public NiAutoNormalParticlesData
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2015-02-17 16:08:55 +00:00
|
|
|
std::vector<osg::Quat> rotations;
|
2013-04-03 14:00:24 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 14:51:42 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiPosData : public Record
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2015-03-22 22:47:49 +00:00
|
|
|
Vector3KeyMapPtr mKeyList;
|
2012-07-12 15:00:26 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 18:11:03 +00:00
|
|
|
};
|
2010-01-07 14:51:42 +00:00
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiUVData : public Record
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2015-03-22 22:47:49 +00:00
|
|
|
FloatKeyMapPtr mKeyList[4];
|
2012-07-12 15:00:26 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 14:51:42 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiFloatData : public Record
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2015-03-22 22:47:49 +00:00
|
|
|
FloatKeyMapPtr mKeyList;
|
2012-07-12 15:00:26 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 14:51:42 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiPixelData : public Record
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2012-07-03 04:41:21 +00:00
|
|
|
unsigned int rmask, gmask, bmask, amask;
|
|
|
|
int bpp, mips;
|
2010-01-07 14:51:42 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 14:51:42 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiColorData : public Record
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2015-03-22 22:47:49 +00:00
|
|
|
Vector4KeyMapPtr mKeyMap;
|
2012-07-03 04:41:21 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 14:51:42 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiVisData : public Record
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2012-07-10 09:38:35 +00:00
|
|
|
struct VisData {
|
|
|
|
float time;
|
2015-03-06 10:19:57 +00:00
|
|
|
bool isSet;
|
2012-07-10 09:38:35 +00:00
|
|
|
};
|
2013-04-05 13:29:14 +00:00
|
|
|
std::vector<VisData> mVis;
|
2012-07-10 09:38:35 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 14:51:42 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiSkinInstance : public Record
|
2010-01-24 14:17:50 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2012-07-03 04:41:21 +00:00
|
|
|
NiSkinDataPtr data;
|
|
|
|
NodePtr root;
|
|
|
|
NodeList bones;
|
2010-01-24 14:17:50 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2012-07-03 04:41:21 +00:00
|
|
|
void post(NIFFile *nif);
|
2010-01-24 14:17:50 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 01:05:01 +00:00
|
|
|
class NiSkinData : public Record
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2010-06-28 01:05:01 +00:00
|
|
|
public:
|
2012-07-03 04:41:21 +00:00
|
|
|
struct VertWeight
|
|
|
|
{
|
2015-04-21 18:56:16 +00:00
|
|
|
unsigned short vertex;
|
2012-07-03 04:41:21 +00:00
|
|
|
float weight;
|
|
|
|
};
|
2012-07-10 09:38:35 +00:00
|
|
|
|
2012-07-03 04:41:21 +00:00
|
|
|
struct BoneInfo
|
|
|
|
{
|
2015-02-20 16:56:49 +00:00
|
|
|
Transformation trafo;
|
2015-03-26 22:15:46 +00:00
|
|
|
osg::Vec3f boundSphereCenter;
|
|
|
|
float boundSphereRadius;
|
2012-07-10 03:53:54 +00:00
|
|
|
std::vector<VertWeight> weights;
|
2012-07-03 04:41:21 +00:00
|
|
|
};
|
2010-01-24 12:49:38 +00:00
|
|
|
|
2015-02-20 16:56:49 +00:00
|
|
|
Transformation trafo;
|
2012-07-03 04:41:21 +00:00
|
|
|
std::vector<BoneInfo> bones;
|
2010-01-07 18:11:03 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 14:51:42 +00:00
|
|
|
};
|
|
|
|
|
2012-07-13 03:55:11 +00:00
|
|
|
struct NiMorphData : public Record
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2012-07-13 03:55:11 +00:00
|
|
|
struct MorphData {
|
2015-03-22 22:47:49 +00:00
|
|
|
FloatKeyMapPtr mKeyFrames;
|
2015-06-17 23:26:45 +00:00
|
|
|
osg::ref_ptr<osg::Vec3Array> mVertices;
|
2012-07-13 03:55:11 +00:00
|
|
|
};
|
|
|
|
std::vector<MorphData> mMorphs;
|
2012-07-03 04:41:21 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 14:51:42 +00:00
|
|
|
};
|
|
|
|
|
2011-11-23 23:18:51 +00:00
|
|
|
|
2012-07-13 03:55:11 +00:00
|
|
|
struct NiKeyframeData : public Record
|
2010-01-07 14:51:42 +00:00
|
|
|
{
|
2015-03-22 22:47:49 +00:00
|
|
|
QuaternionKeyMapPtr mRotations;
|
2014-12-05 19:58:03 +00:00
|
|
|
|
2015-03-22 22:47:49 +00:00
|
|
|
// may be NULL
|
|
|
|
FloatKeyMapPtr mXRotations;
|
|
|
|
FloatKeyMapPtr mYRotations;
|
|
|
|
FloatKeyMapPtr mZRotations;
|
2014-12-05 19:58:03 +00:00
|
|
|
|
2015-03-22 22:47:49 +00:00
|
|
|
Vector3KeyMapPtr mTranslations;
|
|
|
|
FloatKeyMapPtr mScales;
|
2012-07-03 04:41:21 +00:00
|
|
|
|
2015-02-22 18:17:03 +00:00
|
|
|
void read(NIFStream *nif);
|
2010-01-07 14:51:42 +00:00
|
|
|
};
|
|
|
|
|
2010-01-06 15:22:34 +00:00
|
|
|
} // Namespace
|
|
|
|
#endif
|