]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - plugins/md3model/mdlformat.h
reformat code! now the code is only ugly on the *inside*
[xonotic/netradiant.git] / plugins / md3model / mdlformat.h
1 /*
2    Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3    For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 #if !defined( INCLUDED_MDLFORMAT_H )
23 #define INCLUDED_MDLFORMAT_H
24
25 typedef unsigned char byte;
26
27 const unsigned char MDL_IDENT[4] = {'I', 'D', 'P', 'O',};
28
29 #define MDL_VERSION 6
30
31 #define MDL_ONSEAM              0x0020
32
33 typedef enum { MDL_FRAME_SINGLE = 0, MDL_FRAME_GROUP } aliasframetype_t;
34
35 typedef enum { MDL_SKIN_SINGLE = 0, MDL_SKIN_GROUP } aliasskintype_t;
36
37 typedef float float3[3];
38
39 typedef struct {
40     byte ident[4];
41     int version;
42     float3 scale;
43     float3 scale_origin;
44     float boundingradius;
45     float3 eyeposition;
46     int numskins;
47     int skinwidth;
48     int skinheight;
49     int numverts;
50     int numtris;
51     int numframes;
52     int synctype;
53     int flags;
54     float size;
55 } mdlHeader_t;
56
57 // TODO: could be shorts
58
59 typedef struct {
60     int onseam;
61     int s;
62     int t;
63 } mdlSt_t;
64
65 typedef struct dtriangle_s {
66     int facesfront;
67     int vertindex[3];
68 } mdlTriangle_t;
69
70 #define MDL_FACES_FRONT             1
71
72 // This mirrors trivert_t in trilib.h, is present so Quake knows how to
73 // load this data
74
75 typedef struct {
76     byte v[3];
77     byte lightnormalindex;
78 } mdlXyzNormal_t;
79
80 const int MDL_XYZNORMAL_SIZE = 4;
81
82 typedef struct {
83     mdlXyzNormal_t bboxmin;     // lightnormal isn't used
84     mdlXyzNormal_t bboxmax;     // lightnormal isn't used
85     char name[16];          // frame name from grabbing
86 } mdlFrame_t;
87
88 const int MDL_FRAME_SIZE = (MDL_XYZNORMAL_SIZE * 2) + 16;
89
90 typedef struct {
91     int numframes;
92     mdlXyzNormal_t bboxmin;     // lightnormal isn't used
93     mdlXyzNormal_t bboxmax;     // lightnormal isn't used
94 } mdlFrameGroup_t;
95
96 const int MDL_FRAMEGROUP_SIZE = 4 + (MDL_XYZNORMAL_SIZE * 2);
97
98 typedef struct {
99     int numskins;
100 } mdlSkinGroup_t;
101
102 typedef struct {
103     float interval;
104 } mdlFrameInterval_t;
105
106 typedef struct {
107     float interval;
108 } mdlSkinInterval_t;
109
110 typedef struct {
111     aliasframetype_t type;
112 } mdlFrameType_t;
113
114 typedef struct {
115     aliasskintype_t type;
116 } mdlSkinType_t;
117
118 #endif