2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
39 shift[0] = shift[1] = 0.0;
41 scale[0] = scale[1] = 0;
46 if ( name && name[0] ) {
52 void SetName( const char *p )
54 if ( name && name[0] ) {
58 name = strcpy( new char[strlen(p)+1], p );
65 texdef_t& operator =(const texdef_t& rhs)
69 shift[0] = rhs.shift[0];
70 shift[1] = rhs.shift[1];
72 scale[0] = rhs.scale[0];
73 scale[1] = rhs.scale[1];
87 // new brush primitive texdef
88 //typedef struct brushprimit_texdef_s
90 // float coords[2][3];
91 //} brushprimit_texdef_t;
93 class brushprimit_texdef_t {
96 brushprimit_texdef_t() {
97 memset(&coords, 0, sizeof(coords));
107 memset(&brushprimit_texdef.coords, 0, sizeof(brushprimit_texdef.coords));
108 brushprimit_texdef.coords[0][0] = 1.0;
109 brushprimit_texdef.coords[1][1] = 1.0;
116 // add brushprimit_texdef_t for brush primitive coordinates storage
117 brushprimit_texdef_t brushprimit_texdef;
119 // surface plugin, must be casted to a IPluginTexdef*
124 #define QER_TRANS 0x00000001
125 #define QER_NOCARVE 0x00000002
127 typedef struct qtexture_s
129 struct qtexture_s *next;
130 char name[64]; // includes partial directory and extension
135 int texture_number; // gl bind number
137 // name of the .shader file
138 char shadername[1024]; // old shader stuff
139 bool bFromShader; // created from a shader
140 float fTrans; // amount of transparency
141 int nShaderFlags; // qer_ shader flags
142 idVec3 color; // for flat shade mode
143 bool inuse; // true = is present on the level
145 // cast this one to an IPluginQTexture if you are using it
146 // NOTE: casting can be done with a GETPLUGINQTEXTURE defined in isurfaceplugin.h
147 // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginQTexture *pPluginQTexture } kind of thing ?
150 //++timo FIXME: this is the actual filename of the texture
151 // this will be removed after shader code cleanup
156 //++timo texdef and brushprimit_texdef are static
157 // TODO : do dynamic ?
158 typedef struct face_s
161 struct face_s *original; //used for vertex movement
163 idVec3 orgplanepts[3]; // used for arbitrary rotation
167 idPlane originalPlane;
170 idWinding *face_winding;
173 const idMaterial *d_texture;
175 // Timo new brush primit texdef
176 brushprimit_texdef_t brushprimit_texdef;
178 // cast this one to an IPluginTexdef if you are using it
179 // NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h
180 // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ?
195 #define MIN_PATCH_WIDTH 3
196 #define MIN_PATCH_HEIGHT 3
198 #define MAX_PATCH_WIDTH 64
199 #define MAX_PATCH_HEIGHT 64
202 // type in lower 16 bits, flags in upper
203 // endcaps directly follow this patch in the list
206 #define PATCH_GENERIC 0x00000000 // generic flat patch
207 #define PATCH_CYLINDER 0x00000001 // cylinder
208 #define PATCH_BEVEL 0x00000002 // bevel
209 #define PATCH_ENDCAP 0x00000004 // endcap
210 #define PATCH_HEMISPHERE 0x00000008 // hemisphere
211 #define PATCH_CONE 0x00000010 // cone
212 #define PATCH_TRIANGLE 0x00000020 // simple tri, assumes 3x3 patch
215 #define PATCH_CAP 0x00001000 // flat patch applied as a cap
216 #define PATCH_SEAM 0x00002000 // flat patch applied as a seam
217 #define PATCH_THICK 0x00004000 // patch applied as a thick portion
220 #define PATCH_BEZIER 0x00000000 // default bezier
221 #define PATCH_BSPLINE 0x10000000 // bspline
223 #define PATCH_TYPEMASK 0x00000fff //
224 #define PATCH_BTYPEMASK 0x0000f000 //
225 #define PATCH_STYLEMASK 0xffff0000 //
229 typedef struct brush_s brush_t;
232 int width, height; // in control points, not patches
233 int horzSubdivisions;
234 int vertSubdivisions;
235 bool explicitSubdivisions;
236 int contents, flags, value, type;
237 const idMaterial *d_texture;
248 // cast this one to an IPluginTexdef if you are using it
249 // NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h
250 // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ?
252 ID_INLINE idDrawVert &ctrl( int col, int row ) {
253 if ( col < 0 || col >= width || row < 0 || row >= height ) {
254 common->Warning( "patchMesh_t::ctrl: control point out of range" );
258 return verts[row * width + col];
277 typedef struct brush_s
279 struct brush_s *prev, *next; // links in active/selected
280 struct brush_s *oprev, *onext; // links in entity
281 brush_t * list; //keep a handy link to the list its in
282 struct entity_s *owner;
285 idVec3 lightCenter; // for moving the shading center of point lights
298 bool trackLightOrigin; // this brush is a special case light brush
305 // curve brush extensions
306 // all are derived from brush_faces
312 struct entity_s *pUndoOwner;
314 int undoId; //undo ID
315 int redoId; //redo ID
316 int ownerId; //entityId of the owner entity for undo
318 // TTimo: HTREEITEM is MFC, some plugins really don't like it
319 #ifdef QERTYPES_USE_MFC
320 int numberId; // brush number
321 HTREEITEM itemOwner; // owner for grouping
327 idRenderModel *modelHandle;
329 // brush primitive only
338 typedef struct trimodel_t
347 #define ECLASS_LIGHT 0x00000001
348 #define ECLASS_ANGLE 0x00000002
349 #define ECLASS_PATH 0x00000004
350 #define ECLASS_MISCMODEL 0x00000008
351 #define ECLASS_PLUGINENTITY 0x00000010
352 #define ECLASS_PROJECTEDLIGHT 0x00000020
353 #define ECLASS_WORLDSPAWN 0x00000040
354 #define ECLASS_SPEAKER 0x00000080
355 #define ECLASS_PARTICLE 0x00000100
356 #define ECLASS_ROTATABLE 0x00000200
357 #define ECLASS_CAMERAVIEW 0x00000400
358 #define ECLASS_MOVER 0x00000800
359 #define ECLASS_ENV 0x00001000
360 #define ECLASS_COMBATNODE 0x00002000
361 #define ECLASS_LIQUID 0x00004000
375 typedef struct evar_s {
381 typedef struct eclass_s
383 struct eclass_s *next;
386 bool unknown; // wasn't found in source
393 idRenderModel *modelHandle;
394 idRenderModel *entityModel;
397 unsigned int nShowFlags;
406 extern eclass_t *eclass;
411 #define W_CAMERA 0x0001
413 #define W_XY_OVERLAY 0x0004
415 #define W_TEXTURE 0x0010
416 #define W_Z_OVERLAY 0x0020
417 #define W_CONSOLE 0x0040
418 #define W_ENTITY 0x0080
419 #define W_CAMERA_IFON 0x0100
420 #define W_XZ 0x0200 //--| only used for patch vertex manip stuff
421 #define W_YZ 0x0400 //--|
422 #define W_MEDIA 0x1000
423 #define W_GAME 0x2000
424 #define W_ALL 0xFFFFFFFF
426 // used in some Drawing routines
427 enum VIEWTYPE {YZ, XZ, XY};