2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\r
7 GtkRadiant is free software; you can redistribute it and/or modify
\r
8 it under the terms of the GNU General Public License as published by
\r
9 the Free Software Foundation; either version 2 of the License, or
\r
10 (at your option) any later version.
\r
12 GtkRadiant is distributed in the hope that it will be useful,
\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 GNU General Public License for more details.
\r
17 You should have received a copy of the GNU General Public License
\r
18 along with GtkRadiant; if not, write to the Free Software
\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
24 ========================================================================
\r
26 .FM triangle flexible model file format
\r
28 ========================================================================
\r
31 #ifndef __FMODEL_HEADER
\r
32 #define __FMODEL_HEADER
\r
34 #include "bspfile.h"
\r
36 //typedef unsigned char byte;
\r
37 //typedef int qboolean;
\r
38 //typedef float vec3_t[3];
\r
40 #define MAX_FM_TRIANGLES 2048
\r
41 #define MAX_FM_VERTS 2048
\r
42 #define MAX_FM_FRAMES 2048
\r
43 #define MAX_FM_SKINS 64
\r
44 #define MAX_FM_SKINNAME 64
\r
45 #define MAX_FM_MESH_NODES 16 // also defined in game/qshared.h
\r
48 #define DTRIVERTX_V0 0
\r
49 #define DTRIVERTX_V1 1
\r
50 #define DTRIVERTX_V2 2
\r
51 #define DTRIVERTX_LNI 3
\r
52 #define DTRIVERTX_SIZE 4
\r
54 #define SKINPAGE_WIDTH 640
\r
55 #define SKINPAGE_HEIGHT 480
\r
57 #define ENCODED_WIDTH_X 92
\r
58 #define ENCODED_WIDTH_Y 475
\r
59 #define ENCODED_HEIGHT_X 128
\r
60 #define ENCODED_HEIGHT_Y 475
\r
62 #define SCALE_ADJUST_FACTOR 0.96
\r
64 #define INFO_HEIGHT 5
\r
65 #define INFO_Y (SKINPAGE_HEIGHT-INFO_HEIGHT)
\r
67 extern byte *BasePalette;
\r
68 extern byte *BasePixels,*TransPixels;
\r
69 extern int BaseWidth, BaseHeight, TransWidth, TransHeight;
\r
70 extern int ScaleWidth, ScaleHeight;
\r
72 int ExtractNumber(byte *pic, int x, int y);
\r
73 void DrawTextChar(int x, int y, char *text);
\r
74 void DrawLine(int x1, int y1, int x2, int y2);
\r
76 // the glcmd format:
\r
77 // a positive integer starts a tristrip command, followed by that many
\r
78 // vertex structures.
\r
79 // a negative integer starts a trifan command, followed by -x vertexes
\r
80 // a zero indicates the end of the command list.
\r
81 // a vertex consists of a floating point s, a floating point t,
\r
82 // and an integer vertex index.
\r
86 #define FM_HEADER_NAME "header"
\r
87 #define FM_HEADER_VER 2
\r
93 int framesize; // byte size of each frame
\r
97 int num_st; // greater than num_xyz for seams
\r
99 int num_glcmds; // dwords in strip/fan command list
\r
101 int num_mesh_nodes;
\r
106 #define FM_SKIN_NAME "skin"
\r
107 #define FM_SKIN_VER 1
\r
111 #define FM_ST_NAME "st coord"
\r
112 #define FM_ST_VER 1
\r
122 #define FM_TRI_NAME "tris"
\r
123 #define FM_TRI_VER 1
\r
127 short index_xyz[3];
\r
133 #define FM_FRAME_NAME "frames"
\r
134 #define FM_FRAME_VER 1
\r
136 // Frame for compression, just the names
\r
137 #define FM_SHORT_FRAME_NAME "short frames"
\r
138 #define FM_SHORT_FRAME_VER 1
\r
140 // Normals for compressed frames
\r
141 #define FM_NORMAL_NAME "normals"
\r
142 #define FM_NORMAL_VER 1
\r
144 // Compressed Frame Data
\r
145 #define FM_COMP_NAME "comp data"
\r
146 #define FM_COMP_VER 1
\r
149 #define FM_GLCMDS_NAME "glcmds"
\r
150 #define FM_GLCMDS_VER 1
\r
153 // Mesh Nodes Header
\r
154 #define FM_MESH_NAME "mesh nodes"
\r
155 #define FM_MESH_VER 3
\r
158 #define FM_SKELETON_NAME "skeleton"
\r
159 #define FM_SKELETON_VER 1
\r
161 // References Header
\r
162 #define FM_REFERENCES_NAME "references"
\r
163 #define FM_REFERENCES_VER 1
\r
171 byte tris[MAX_FM_TRIANGLES>>3];
\r
174 short *triIndicies;
\r
180 byte verts[MAX_FM_VERTS>>3];
\r
181 short start_glcmds, num_glcmds;
\r
184 //=================================================================
\r
189 byte v[3]; // scaled byte to fit in frame mins/maxs
\r
190 byte lightnormalindex;
\r
195 float scale[3]; // multiply byte verts by this
\r
196 float translate[3]; // then add this
\r
197 char name[16]; // frame name from grabbing
\r
198 fmtrivertx_t verts[1]; // variable sized
\r
202 #endif // #define __FMODEL_HEADER
\r