2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
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.
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.
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
24 ========================================================================
26 .FM triangle flexible model file format
28 ========================================================================
31 #ifndef __FMODEL_HEADER
32 #define __FMODEL_HEADER
36 //typedef unsigned char byte;
37 //typedef int qboolean;
38 //typedef float vec3_t[3];
40 #define MAX_FM_TRIANGLES 2048
41 #define MAX_FM_VERTS 2048
42 #define MAX_FM_FRAMES 2048
43 #define MAX_FM_SKINS 64
44 #define MAX_FM_SKINNAME 64
45 #define MAX_FM_MESH_NODES 16 // also defined in game/qshared.h
48 #define DTRIVERTX_V0 0
49 #define DTRIVERTX_V1 1
50 #define DTRIVERTX_V2 2
51 #define DTRIVERTX_LNI 3
52 #define DTRIVERTX_SIZE 4
54 #define SKINPAGE_WIDTH 640
55 #define SKINPAGE_HEIGHT 480
57 #define ENCODED_WIDTH_X 92
58 #define ENCODED_WIDTH_Y 475
59 #define ENCODED_HEIGHT_X 128
60 #define ENCODED_HEIGHT_Y 475
62 #define SCALE_ADJUST_FACTOR 0.96
65 #define INFO_Y ( SKINPAGE_HEIGHT - INFO_HEIGHT )
67 extern byte *BasePalette;
68 extern byte *BasePixels,*TransPixels;
69 extern int BaseWidth, BaseHeight, TransWidth, TransHeight;
70 extern int ScaleWidth, ScaleHeight;
72 int ExtractNumber( byte *pic, int x, int y );
73 void DrawTextChar( int x, int y, char *text );
74 void DrawLine( int x1, int y1, int x2, int y2 );
77 // a positive integer starts a tristrip command, followed by that many
79 // a negative integer starts a trifan command, followed by -x vertexes
80 // a zero indicates the end of the command list.
81 // a vertex consists of a floating point s, a floating point t,
82 // and an integer vertex index.
86 #define FM_HEADER_NAME "header"
87 #define FM_HEADER_VER 2
93 int framesize; // byte size of each frame
97 int num_st; // greater than num_xyz for seams
99 int num_glcmds; // dwords in strip/fan command list
106 #define FM_SKIN_NAME "skin"
107 #define FM_SKIN_VER 1
111 #define FM_ST_NAME "st coord"
122 #define FM_TRI_NAME "tris"
133 #define FM_FRAME_NAME "frames"
134 #define FM_FRAME_VER 1
136 // Frame for compression, just the names
137 #define FM_SHORT_FRAME_NAME "short frames"
138 #define FM_SHORT_FRAME_VER 1
140 // Normals for compressed frames
141 #define FM_NORMAL_NAME "normals"
142 #define FM_NORMAL_VER 1
144 // Compressed Frame Data
145 #define FM_COMP_NAME "comp data"
146 #define FM_COMP_VER 1
149 #define FM_GLCMDS_NAME "glcmds"
150 #define FM_GLCMDS_VER 1
154 #define FM_MESH_NAME "mesh nodes"
155 #define FM_MESH_VER 3
158 #define FM_SKELETON_NAME "skeleton"
159 #define FM_SKELETON_VER 1
162 #define FM_REFERENCES_NAME "references"
163 #define FM_REFERENCES_VER 1
171 byte tris[MAX_FM_TRIANGLES >> 3];
180 byte verts[MAX_FM_VERTS >> 3];
181 short start_glcmds, num_glcmds;
184 //=================================================================
189 byte v[3]; // scaled byte to fit in frame mins/maxs
190 byte lightnormalindex;
195 float scale[3]; // multiply byte verts by this
196 float translate[3]; // then add this
197 char name[16]; // frame name from grabbing
198 fmtrivertx_t verts[1]; // variable sized
202 #endif // #define __FMODEL_HEADER