00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KEOS_MDLQ1ANIMATEDLOADER_H
00022 #define KEOS_MDLQ1ANIMATEDLOADER_H
00023
00024 #include "KeosPrerequisites.h"
00025 #include "KeosLoader.h"
00026 #include "KeosAnimatedMeshKF.h"
00027
00028 namespace Keos
00029 {
00030
00033 class CMDLQ1AnimatedLoader : public ILoader<CAnimatedMeshKF>
00034 {
00035 public :
00036
00041 virtual CAnimatedMeshKF* LoadFromFile(const String& strFilename);
00042
00043 private :
00044
00049 void LoadColorMap( const String& strFilename, uchar* ColorMap );
00050
00052 static const int ms_nMagicId = (('O' << 24) + ('P' << 16) + ('D' << 8) + 'I');
00054 static const int ms_nMDLQ1Version = 6;
00056 static const TVector3F ms_NormalTable[];
00058 static const uchar ms_DefaultColorMap[];
00059
00060 #include <pshpack1.h>
00061
00062 typedef enum
00063 {
00064 ST_SYNC = 0, ST_RAND
00065 }
00066 TSyncType;
00067 typedef enum { ALIAS_SKIN_SINGLE = 0, ALIAS_SKIN_GROUP } TSkinType;
00068
00070 struct THeader
00071 {
00072 int Ident;
00073 int Version;
00074
00075 TVector3F Scale;
00076 TVector3F Translate;
00077 float BoundinGradius;
00078 TVector3F EyePosition;
00079
00080 int NbTextures;
00081 int TexWidth;
00082 int TexHeight;
00083
00084 int NbVertices;
00085 int NbTriangles;
00086 int NbFrames;
00087
00088 TSyncType SyncType;
00089 int Flags;
00090 float Size;
00091
00092 };
00093
00094
00095 struct TTexture
00096 {
00097 TSkinType Group;
00098 std::vector<uchar> Data;
00099
00100 };
00101
00103 struct TTexCoord
00104 {
00105 int Onseam;
00106 int u;
00107 int v;
00108
00109 };
00110
00111
00112 struct TTriangle
00113 {
00114 int FacesFront;
00115 int Vertices[3];
00116
00117 };
00118
00119
00120 struct TPoint
00121 {
00122 unsigned char x, y, z;
00123 unsigned char n;
00124
00125 };
00126
00127
00128 struct TFrame
00129 {
00130 long Type;
00131 TPoint BBoxMin;
00132 TPoint BBoxMax;
00133 char Name[16];
00134 std::vector<TPoint> Vertices;
00135
00136 };
00137
00138 #include <poppack.h>
00139 };
00140 }
00141
00142 #endif // KEOS_MDLQ1ANIMATEDLOADER_H