another way to do 265c42d
[xonotic/netradiant.git] / tools / quake3 / q3data / 3dslib.h
1 /*
2    Copyright (C) 1999-2007 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 typedef struct
23 {
24         float x, y, z;
25 } _3DSPoint_t;
26
27 typedef struct
28 {
29         short a, b, c;
30         short flags;
31 } _3DSFace_t;
32
33 typedef struct
34 {
35         float s, t;
36 } _3DSTexVert_t;
37
38 typedef struct
39 {
40         char name[100];
41         short numFaces;
42         short *pFaces;
43 } _3DSMeshMaterialGroup_t;
44
45 typedef struct
46 {
47         char name[80];
48
49         char texture[100];
50         char specular[100];
51         char reflection[100];
52         char bump[100];
53         char opacity[100];
54 } _3DSMaterial_t;
55
56 typedef struct
57 {
58         short numFaces, numPoints, numTexVerts;
59         int numMeshMaterialGroups;
60
61         _3DSPoint_t *pPoints;
62         _3DSFace_t  *pFaces;
63         _3DSTexVert_t *pTexVerts;
64
65         _3DSMeshMaterialGroup_t *pMeshMaterialGroups;
66 } _3DSTriObject_t;
67
68 typedef struct
69 {
70         char name[100];
71
72         int numTriObjects;
73         _3DSTriObject_t *pTriObjects;
74 } _3DSNamedObject_t;
75
76 typedef struct
77 {
78         int numNamedObjects;
79         int numMaterials;
80
81         _3DSNamedObject_t   *pNamedObjects;
82         _3DSMaterial_t      *pMaterials;
83
84 } _3DSEditChunk_t;
85
86 typedef struct
87 {
88         _3DSEditChunk_t editChunk;
89 } _3DS_t;
90
91 #define _3DS_CHUNK_NULL                     0x0000
92 #define _3DS_CHUNK_UNKNOWN0                 0x0001
93 #define _3DS_CHUNK_M3D_VERSION              0x0002
94 #define _3DS_CHUNK_M3D_KFVERSION            0x0005
95 #define _3DS_CHUNK_COLOR_F                  0x0010
96 #define _3DS_CHUNK_COLOR_24                 0x0011
97 #define _3DS_CHUNK_LIN_COLOR_24             0x0012
98 #define _3DS_CHUNK_LIN_COLOR_F              0x0013
99 #define _3DS_CHUNK_INT_PERCENTAGE           0x0030
100 #define _3DS_CHUNK_FLOAT_PERCENT            0x0031
101 #define _3DS_CHUNK_MASTER_SCALE             0x0100
102 #define _3DS_CHUNK_CHUNK_TYPE               0x0995
103 #define _3DS_CHUNK_CHUNK_UNIQUE             0x0996
104 #define _3DS_CHUNK_NOT_CHUNK                0x0997
105 #define _3DS_CHUNK_CONTAINER                0x0998
106 #define _3DS_CHUNK_IS_CHUNK                 0x0999
107 #define _3DS_CHUNK_C_SXP_SELFI_MASKDATA     0x0c3c
108
109 #define _3DS_CHUNK_BITMAP                   0x1100
110 #define _3DS_CHUNK_USE_BITMAP               0x1101
111 #define _3DS_CHUNK_SOLID_BGND               0x1200
112 #define _3DS_CHUNK_USE_SOLID_BGND           0x1201
113
114 #define _3DS_CHUNK_EDIT                     0x3d3d
115 #define _3DS_CHUNK_MESH_VERSION             0x3d3e
116
117 #define _3DS_CHUNK_NAMED_OBJECT             0x4000
118 #define _3DS_CHUNK_NAMED_TRI_OBJECT         0x4100
119 #define _3DS_CHUNK_POINT_ARRAY              0x4110
120 #define _3DS_CHUNK_POINT_FLAG_ARRAY         0x4111
121 #define _3DS_CHUNK_FACE_ARRAY               0x4120
122 #define _3DS_CHUNK_MSH_MAT_GROUP            0x4130
123 #define _3DS_CHUNK_TEX_VERTS                0x4140
124 #define _3DS_CHUNK_SMOOTH_GROUP             0x4150
125 #define _3DS_CHUNK_MESH_MATRIX              0x4160
126 #define _3DS_CHUNK_MAGIC                    0x4d4d
127
128 #define _3DS_CHUNK_MAT_NAME                 0xa000
129 #define _3DS_CHUNK_TEXMAP                   0xa200
130 #define _3DS_CHUNK_SPECMAP                  0xa204
131 #define _3DS_CHUNK_OPACMAP                  0xa210
132 #define _3DS_CHUNK_REFLMAP                  0xa220
133 #define _3DS_CHUNK_BUMPMAP                  0xa230
134 #define _3DS_CHUNK_MAT_MAPNAME              0xa300
135 #define _3DS_CHUNK_MAT_LIST                 0xafff
136
137 #define _3DS_CHUNK_KEYFRAME_DATA            0xb000
138
139 void _3DS_LoadPolysets( const char *filename, polyset_t **ppPSET, int *numpsets, qboolean verbose );