1 /* 2 modelgen.h 3 4 header file for model generation program 5 6 Copyright (C) 1996-1997 Id Software, Inc. 7 8 This program is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License 10 as published by the Free Software Foundation; either version 2 11 of the License, or (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 17 See the GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to: 21 22 Free Software Foundation, Inc. 23 59 Temple Place - Suite 330 24 Boston, MA 02111-1307, USA 25 26 */ 27 28 // ********************************************************* 29 // * This file must be identical in the modelgen directory * 30 // * and in the Quake directory, because it's used to * 31 // * pass data from one to the other via model files. * 32 // ********************************************************* 33 34 #ifndef _MODELGEN_H 35 #define _MODELGEN_H 36 37 #include "QF/mathlib.h" 38 39 #define ALIAS_VERSION_MDL 6 // .mdl 40 #define ALIAS_VERSION_MD2 8 // .md2 41 42 #define ALIAS_ONSEAM 0x0020 43 44 // must match definition in spritegn.h 45 #ifndef SYNCTYPE_T 46 #define SYNCTYPE_T 47 typedef enum {ST_SYNC=0, ST_RAND } synctype_t; 48 #endif 49 50 typedef enum { ALIAS_SINGLE=0, ALIAS_GROUP } aliasframetype_t; 51 52 typedef enum { ALIAS_SKIN_SINGLE=0, ALIAS_SKIN_GROUP } aliasskintype_t; 53 54 typedef struct { 55 int ident; 56 int version; 57 vec3_t scale; 58 vec3_t scale_origin; 59 float boundingradius; 60 vec3_t eyeposition; 61 int numskins; 62 int skinwidth; 63 int skinheight; 64 int numverts; 65 int numtris; 66 int numframes; 67 synctype_t synctype; 68 int flags; 69 float size; 70 } mdl_t; 71 72 // TODO: could be shorts 73 74 typedef struct { 75 float st[2]; 76 } tex_coord_t; 77 78 typedef struct { 79 int onseam; 80 int s; 81 int t; 82 } stvert_t; 83 84 typedef struct dtriangle_s { 85 int facesfront; 86 int vertindex[3]; 87 } dtriangle_t; 88 89 #define DT_FACES_FRONT 0x0010 90 91 // This mirrors trivert_t in trilib.h, is present so Quake knows how to 92 // load this data 93 94 typedef struct { 95 byte v[3]; 96 byte lightnormalindex; 97 } trivertx_t; 98 99 typedef struct { 100 unsigned short v[3]; 101 unsigned short lightnormalindex; 102 } trivertx16_t; 103 104 typedef struct { 105 trivertx_t bboxmin; // lightnormal isn't used 106 trivertx_t bboxmax; // lightnormal isn't used 107 char name[16]; // frame name from grabbing 108 } daliasframe_t; 109 110 typedef struct { 111 int numframes; 112 trivertx_t bboxmin; // lightnormal isn't used 113 trivertx_t bboxmax; // lightnormal isn't used 114 } daliasgroup_t; 115 116 typedef struct { 117 int numskins; 118 } daliasskingroup_t; 119 120 typedef struct { 121 float interval; 122 } daliasinterval_t; 123 124 typedef struct { 125 float interval; 126 } daliasskininterval_t; 127 128 typedef struct { 129 aliasframetype_t type; 130 } daliasframetype_t; 131 132 typedef struct { 133 aliasskintype_t type; 134 } daliasskintype_t; 135 136 // little-endian "IDPO" 137 #define IDHEADER_MDL (('O'<<24)+('P'<<16)+('D'<<8)+'I') 138 139 // little-endian "MD16" -- 16 bit vertices 140 #define HEADER_MDL16 (('6'<<24)+('1'<<16)+('D'<<8)+'M') 141 142 // little-endian "IDP2" 143 #define IDHEADER_MD2 (('2'<<24)+('P'<<16)+('D'<<8)+'I') 144 145 #endif // _MODELGEN_H 146