]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/qertypes.h
transfer from internal tree r5311 branches/1.4-gpl
[xonotic/netradiant.git] / include / qertypes.h
1 /*\r
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.\r
4 \r
5 This file is part of GtkRadiant.\r
6 \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
11 \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
16 \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
20 */\r
21 \r
22 // qertypes.h\r
23 //\r
24 // common types\r
25 // merged from brush.h, etc. for plugin support\r
26 //\r
27 #ifndef _QERTYPES_H_\r
28 #define _QERTYPES_H_\r
29 \r
30 #ifdef _WIN32\r
31 #include <wtypes.h>\r
32 #endif\r
33 \r
34 #include <GL/gl.h>\r
35 \r
36 #include "str.h"\r
37 \r
38 #ifdef _WIN32\r
39 #define PATH_MAX 260\r
40 #endif\r
41 \r
42 // HACK glib-2.0\r
43 #define NAME_MAX 255\r
44 \r
45 typedef bool qboolean;\r
46 \r
47 #define MAXPOINTS       16\r
48 \r
49 // merged from qedefs.h ------\r
50 \r
51 #define MAX_EDGES       512\r
52 #define MAX_POINTS      1024\r
53 \r
54 #define COLOR_TEXTUREBACK         0\r
55 #define COLOR_GRIDBACK            1\r
56 #define COLOR_GRIDMINOR           2\r
57 #define COLOR_GRIDMAJOR           3\r
58 #define COLOR_CAMERABACK          4\r
59 #define COLOR_ENTITY        5\r
60 #define COLOR_GRIDBLOCK     6\r
61 #define COLOR_GRIDTEXT      7\r
62 #define COLOR_BRUSHES       8\r
63 #define COLOR_SELBRUSHES    9\r
64 #define COLOR_CLIPPER       10\r
65 #define COLOR_VIEWNAME      11\r
66 #define COLOR_SELBRUSHES3D  12\r
67 \r
68 #define COLOR_GRIDMINOR_ALT 13\r
69 #define COLOR_GRIDMAJOR_ALT 14\r
70 \r
71 #define COLOR_LAST          15\r
72 \r
73 // ----------------------------\r
74 \r
75 typedef float vec_t;\r
76 typedef vec_t vec3_t[3];\r
77 \r
78 // turn this on/off to use a static texdef or a memory one\r
79 // THIS MUST BE CONSISTENT throughout a whole build of Radiant / modules / plugins\r
80 // DO_TEXDEF_ALLOC is more memory efficient, but I suspect it to be wacky on win32 / C runtime etc.\r
81 #define DO_TEXDEF_ALLOC 1\r
82 #if DO_TEXDEF_ALLOC\r
83 \r
84 class texdef_t\r
85 {\r
86 private:\r
87   char *name;\r
88 public:\r
89   texdef_t()\r
90   {\r
91     name = new char[1];\r
92     name[0] = '\0';\r
93     shift[0] = 0.0f;\r
94     shift[1] = 0.0f;\r
95     rotate = 0.0f;\r
96     scale[0] = 1.0f;\r
97     scale[1] = 1.0f;\r
98     contents = 0;\r
99     flags = 0;\r
100     value = 0;\r
101   }\r
102   texdef_t(const texdef_t& other)\r
103   {\r
104     name = NULL;\r
105     SetName(other.name);\r
106     shift[0] = other.shift[0];\r
107     shift[1] = other.shift[1];\r
108     rotate = other.rotate;\r
109     scale[0] = other.scale[0];\r
110     scale[1] = other.scale[1];\r
111     contents = other.contents;\r
112     flags = other.flags;\r
113     value = other.value;\r
114   }\r
115   ~texdef_t()\r
116   {\r
117     if (name)\r
118     {\r
119       delete []name;\r
120       name = (char*)NULL;\r
121     }\r
122   }\r
123 \r
124   void SetName(const char *p)\r
125   {\r
126     if (name)\r
127     {\r
128       delete []name;\r
129       name = NULL;\r
130     }\r
131     if (p)\r
132     {\r
133       name = strcpy(new char[strlen(p)+1], p);\r
134     }\r
135     else\r
136     {\r
137       name = new char[1];\r
138       name[0] = '\0';\r
139     }\r
140   }\r
141 \r
142   const char * GetName() const\r
143   {\r
144     return name;\r
145   }\r
146 \r
147   // NOTE TTimo when loading prefs as binary, we load a bogus value in texdef..\r
148   void DropName()\r
149   {\r
150     name = NULL;\r
151     SetName(NULL);\r
152   }\r
153 \r
154   texdef_t& operator =(const texdef_t& rhs)\r
155   {\r
156     if (&rhs != this)\r
157     {\r
158       SetName(rhs.name);\r
159       shift[0] = rhs.shift[0];\r
160       shift[1] = rhs.shift[1];\r
161       rotate = rhs.rotate;\r
162       scale[0] = rhs.scale[0];\r
163       scale[1] = rhs.scale[1];\r
164       contents = rhs.contents;\r
165       flags = rhs.flags;\r
166       value = rhs.value;\r
167     }\r
168     return *this;\r
169   }\r
170         float   shift[2];\r
171         float   rotate;\r
172         float   scale[2];\r
173         int             contents;\r
174         int             flags;\r
175         int             value;\r
176 };\r
177 \r
178 #else\r
179 \r
180 // max length of a vfs texture path\r
181 #define QPATH 64\r
182 class texdef_t\r
183 {\r
184 private:\r
185   char name[QPATH];\r
186 public:\r
187   texdef_t() { name[0] = '\0'; }\r
188   ~texdef_t() {  }\r
189 \r
190   void SetName(const char *p)\r
191   {\r
192     strncpy(name, p, QPATH);\r
193   }\r
194 \r
195   const char * GetName() const\r
196   {\r
197     return name;\r
198   }\r
199 \r
200   // NOTE TTimo when loading prefs as binary, we load a bogus value in texdef..\r
201   void DropName()\r
202   {\r
203     name[0] = '\0';\r
204   }\r
205 \r
206   texdef_t& operator =(const texdef_t& rhs)\r
207   {\r
208     if (&rhs != this)\r
209     {\r
210       SetName(rhs.name);\r
211       shift[0] = rhs.shift[0];\r
212       shift[1] = rhs.shift[1];\r
213       rotate = rhs.rotate;\r
214       scale[0] = rhs.scale[0];\r
215       scale[1] = rhs.scale[1];\r
216       contents = rhs.contents;\r
217       flags = rhs.flags;\r
218       value = rhs.value;\r
219     }\r
220     return *this;\r
221   }\r
222         float   shift[2];\r
223         float   rotate;\r
224         float   scale[2];\r
225         int             contents;\r
226         int             flags;\r
227         int             value;\r
228 };\r
229 \r
230 #endif\r
231 \r
232 // forward declare\r
233 class IShader;\r
234 \r
235 // Timo\r
236 // new brush primitive texdef\r
237 typedef struct brushprimit_texdef_s\r
238 {\r
239         vec_t   coords[2][3];\r
240 } brushprimit_texdef_t;\r
241 \r
242 // this structure is used in Radiant to reflect the state of the texture window\r
243 // it gives information on current shader and various flags\r
244 class texturewin_t\r
245 {\r
246 public:\r
247   texturewin_t()\r
248   {\r
249   }\r
250   ~texturewin_t()\r
251   {\r
252   }\r
253         int                     width, height;\r
254         int                     originy;\r
255         // add brushprimit_texdef_t for brush primitive coordinates storage\r
256         brushprimit_texdef_t    brushprimit_texdef;\r
257         int m_nTotalHeight;\r
258         // surface plugin, must be casted to a IPluginTexdef*\r
259         void* pTexdef;\r
260         texdef_t        texdef;\r
261         // shader\r
262         // NOTE: never NULL, initialized in Texture_Init\r
263         // NOTE: the reference name of the shader is texdef.name (see QERApp_ReloadShaders for an example)\r
264         IShader *pShader;\r
265 };\r
266 \r
267 #define QER_TRANS     0x00000001\r
268 #define QER_NOCARVE   0x00000002\r
269 #define QER_NODRAW    0x00000004\r
270 #define QER_NONSOLID  0x00000008\r
271 #define QER_WATER     0x00000010\r
272 #define QER_LAVA      0x00000020\r
273 #define QER_FOG       0x00000040\r
274 #define QER_ALPHAFUNC 0x00000080\r
275 #define QER_CULL      0x00000100\r
276 \r
277 \r
278 // describes a GL texture that Radiant uses to represent a shader\r
279 // NOTE: all qtexture_t are stored in a main list at g_qeglobals.d_qtextures\r
280 // shaders have reference couting, but qtexture_t don't (they're way too deep into Radiant)\r
281 typedef struct qtexture_s\r
282 {\r
283   struct        qtexture_s *next;\r
284   // name of the texture file (the physical image file we are using)\r
285   // NOTE: used for lookup, must be unique .. vfs path of the texture, lowercase, NO FILE EXTENSION\r
286   // ex textures/gothic_wall/iron\r
287   // NOTE: the "textures/" prefix might seem unnecessary .. but it's better to stick to the vfs name\r
288   char            name[64];\r
289   int               width,  height;\r
290   GLuint                texture_number; // gl bind number (the qtexture_t are usually loaded and binded by the shaders module)\r
291   vec3_t                color;                      // for flat shade mode\r
292   qboolean      inuse;                            // true = is present on the level (for the texture browser interface)\r
293 } qtexture_t;\r
294 \r
295 // NOTE: don't trust this definition!\r
296 // you should read float points[..][5]\r
297 // see NewWinding definition\r
298 // WARNING: don't touch anything to this struct unless you looked into winding.cpp and WINDING_SIZE(pt)\r
299 #define MAX_POINTS_ON_WINDING 64\r
300 typedef struct\r
301 {\r
302   int           numpoints;\r
303   int           maxpoints;\r
304   float         points[8][5];                   // variable sized\r
305 } winding_t;\r
306 \r
307 typedef struct\r
308 {\r
309   vec3_t        normal;\r
310   double        dist;\r
311   int           type;\r
312 } plane_t;\r
313 \r
314 // pShader is a shortcut to the shader\r
315 // it's only up-to-date after a Brush_Build call\r
316 // to initialize the pShader, use QERApp_Shader_ForName(texdef.name)\r
317 typedef struct face_s\r
318 {\r
319         struct face_s                   *next;\r
320         struct face_s                   *prev;\r
321         struct face_s                   *original;              //used for vertex movement\r
322         vec3_t                                  planepts[3];\r
323         texdef_t                                texdef;\r
324         plane_t                                 plane;\r
325         \r
326         // Nurail: Face Undo\r
327         int                             undoId;\r
328         int                             redoId;\r
329 \r
330         winding_t                               *face_winding;\r
331 \r
332         vec3_t                                  d_color;\r
333   vec_t           d_shade;\r
334   // calls through here have indirections (pure virtual)\r
335   // it would be good if the rendering loop would avoid scanning there (for the GL binding number for example)\r
336         IShader                                 *pShader;\r
337         //++timo FIXME: remove!\r
338         qtexture_t                              *d_texture;\r
339 \r
340         // Timo new brush primit texdef\r
341         brushprimit_texdef_t    brushprimit_texdef;\r
342 \r
343         // cast this one to an IPluginTexdef if you are using it\r
344         // NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h\r
345         // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ?\r
346         void                                    *pData;\r
347 } face_t;\r
348 \r
349 typedef struct {\r
350   vec3_t        xyz;\r
351   float sideST[2];\r
352   float capST[2];\r
353 } curveVertex_t;\r
354 \r
355 typedef struct {\r
356   curveVertex_t v[2];\r
357 } sideVertex_t;\r
358 \r
359 \r
360 #define MIN_PATCH_WIDTH         3\r
361 #define MIN_PATCH_HEIGHT        3\r
362 \r
363 #define MAX_PATCH_WIDTH         16\r
364 #define MAX_PATCH_HEIGHT        16\r
365 \r
366 // patch type info\r
367 // type in lower 16 bits, flags in upper\r
368 // endcaps directly follow this patch in the list\r
369 \r
370 // types\r
371 #define PATCH_GENERIC     0x00000000    // generic flat patch\r
372 #define PATCH_CYLINDER    0x00000001    // cylinder\r
373 #define PATCH_BEVEL       0x00000002    // bevel\r
374 #define PATCH_ENDCAP      0x00000004    // endcap\r
375 #define PATCH_HEMISPHERE  0x00000008    // hemisphere\r
376 #define PATCH_CONE        0x00000010    // cone\r
377 #define PATCH_TRIANGLE    0x00000020    // simple tri, assumes 3x3 patch\r
378 \r
379 // behaviour styles\r
380 #define PATCH_CAP         0x00001000    // flat patch applied as a cap\r
381 #define PATCH_SEAM        0x00002000    // flat patch applied as a seam\r
382 #define PATCH_THICK       0x00004000    // patch applied as a thick portion\r
383 \r
384 // styles\r
385 #define PATCH_BEZIER      0x00000000    // default bezier\r
386 #define PATCH_BSPLINE     0x10000000    // bspline\r
387 \r
388 #define PATCH_TYPEMASK     0x00000fff    // \r
389 #define PATCH_BTYPEMASK    0x0000f000    // \r
390 #define PATCH_STYLEMASK    0xffff0000    // \r
391 \r
392 typedef struct {\r
393   vec3_t        xyz;\r
394   float         st[2];\r
395   float         lightmap[2];\r
396   vec3_t        normal;\r
397 } drawVert_t;\r
398 \r
399 // spog - used for patch LOD trees\r
400 \r
401 struct BTNode_t\r
402 {\r
403         BTNode_t *left, *right;\r
404         drawVert_t info;\r
405         drawVert_t vMid;\r
406 };\r
407 \r
408 struct BTreeList_t\r
409 {\r
410         BTreeList_t *next;\r
411         BTNode_t *pBT;\r
412         drawVert_t vLeft, vRight;\r
413 };\r
414 \r
415 struct BTListList_t\r
416 {\r
417         BTListList_t *next;\r
418         BTreeList_t *list;\r
419 };\r
420 \r
421 // used in brush primitive AND entities\r
422 typedef struct epair_s\r
423 {\r
424   struct epair_s        *next;\r
425   char  *key;\r
426   char  *value;\r
427 } epair_t;\r
428 \r
429 struct brush_s;\r
430 typedef struct brush_s brush_t;\r
431 \r
432 typedef struct {\r
433   int   width, height;          // in control points, not patches\r
434   int   contents, flags, value, type;\r
435   qtexture_t  *d_texture;\r
436   IShader     *pShader;\r
437   drawVert_t ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];\r
438   brush_t *pSymbiot;\r
439   qboolean bSelected;\r
440   qboolean bOverlay;\r
441   qboolean bDirty;\r
442   int  nListID;\r
443   epair_t *epairs;\r
444   // cast this one to an IPluginTexdef if you are using it\r
445   // NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h\r
446   // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ?\r
447   void                                  *pData;\r
448   // spog - curve LOD binary trees and lists\r
449   BTNode_t *rowLOD[((MAX_PATCH_WIDTH-1)/2) * MAX_PATCH_HEIGHT]; // = ((MAX_PATCH_WIDTH-1)/2) * MAX_PATCH_HEIGHT\r
450   BTNode_t *colLOD[((MAX_PATCH_HEIGHT-1)/2) * MAX_PATCH_WIDTH]; // = ((MAX_PATCH_HEIGHT-1)/2) * MAX_PATCH_WIDTH\r
451   bool rowDirty[((MAX_PATCH_WIDTH-1)-1)/2];\r
452   bool colDirty[((MAX_PATCH_HEIGHT-1)-1)/2];\r
453   bool LODUpdated;\r
454   void *drawLists; // pointer to std::list\r
455 } patchMesh_t;\r
456 \r
457 typedef struct brush_s\r
458 {\r
459   struct brush_s        *prev, *next;   // links in active/selected\r
460   struct brush_s        *oprev, *onext; // links in entity\r
461   struct entity_s       *owner;\r
462   vec3_t                mins, maxs;\r
463   face_t                *brush_faces;\r
464 \r
465   qboolean bModelFailed;\r
466   //\r
467   // curve brush extensions\r
468   // all are derived from brush_faces\r
469   qboolean      patchBrush;\r
470   qboolean      hiddenBrush;\r
471   \r
472   //int nPatchID;\r
473 \r
474   patchMesh_t *pPatch;\r
475   struct entity_s *pUndoOwner;\r
476 \r
477   int undoId;                                           //undo ID\r
478   int redoId;                                           //redo ID\r
479   int ownerId;                                  //entityId of the owner entity for undo\r
480 \r
481   // TTimo: this is not legal, we are not supposed to put UI toolkit dependant stuff in the interfaces\r
482   // NOTE: the grouping stuff never worked, there is embryonary code everywhere though\r
483   int numberId;\r
484   void* itemOwner; // GtkCTreeNode* ?\r
485 \r
486   // brush primitive only\r
487   epair_t *epairs;\r
488 \r
489   // brush filtered toggle\r
490   bool bFiltered;\r
491   bool bCamCulled;\r
492   bool bBrushDef;\r
493 } brush_t;\r
494 \r
495 #define MAX_FLAGS       16\r
496 \r
497 typedef struct vertmodel_t\r
498 {\r
499   float v[3];\r
500   float st[2];\r
501   float normal[3];\r
502 } vertmodel;\r
503 \r
504 typedef struct triindex_t\r
505 {\r
506   int indexes[3];\r
507 } triindex;\r
508 \r
509 // TTimo: NOTE: we don't have dedicated stuff to copy/allocate/delete this structure like we do for entity_t and brush_t\r
510 //   could be necessary, I'm adding GString *strSkin that needs to be copied around\r
511 // TTimo 04/01/2001 removing the GString* for toolkit-independent interfaces .. cast it ..\r
512 typedef struct entitymodel_t\r
513 {\r
514   struct entitymodel_t *pNext;\r
515   int nTriCount;\r
516   //trimodel *pTriList;\r
517   //md3Triangle_t *pTriList;\r
518   triindex *pTriList;\r
519   vertmodel *pVertList;\r
520   int numVerts;\r
521   int nTextureBind;\r
522   void *strSkin; // toolkit-independent .. cast to a GString*\r
523   int nSkinWidth;\r
524   int nSkinHeight;\r
525   int   nModelPosition;\r
526 } entitymodel;\r
527 \r
528 // eclass show flags\r
529 \r
530 #define     ECLASS_LIGHT      0x00000001\r
531 #define     ECLASS_ANGLE      0x00000002\r
532 #define     ECLASS_PATH       0x00000004\r
533 #define     ECLASS_MISCMODEL  0x00000008\r
534 \r
535 #ifdef USEPLUGINENTITIES\r
536 #define         ECLASS_PLUGINENTITY 0x00000010\r
537 #endif // USEPLUGINENTITIES\r
538 \r
539 typedef struct eclass_s\r
540 {\r
541         struct eclass_s *next;\r
542         char    *name;\r
543         qboolean        fixedsize;\r
544         qboolean        unknown;                // wasn't found in source\r
545         vec3_t  mins, maxs;\r
546         vec3_t  color;\r
547         texdef_t        texdef;\r
548         char    *comments;\r
549         char    flagnames[MAX_FLAGS][32];\r
550 \r
551   entitymodel *model;\r
552   char  *modelpath;\r
553   //++timo NOTE: I don't know what this is used for exactly. But don't trust it for the real skin paths on models (screws up with long/short path names)\r
554   //++hydra NOTE: this, hopefully, will be used to use specific shaders on the bounding boxes of the eclass instead of a color.\r
555   char  *skinpath;\r
556   int   nFrame;\r
557   unsigned int nShowFlags;\r
558 \r
559   void* hPlug;\r
560 } eclass_t;\r
561 \r
562 extern  eclass_t        *eclass;\r
563 \r
564 /*\r
565 ** window bits\r
566 */\r
567 #define W_CAMERA                  0x0001\r
568 #define W_XY                        0x0002\r
569 #define W_XY_OVERLAY    0x0004\r
570 #define W_Z                                 0x0008\r
571 #define W_TEXTURE                 0x0010\r
572 #define W_Z_OVERLAY             0x0020\r
573 #define W_CONSOLE                 0x0040\r
574 #define W_ENTITY                  0x0080\r
575 #define W_CAMERA_IFON 0x0100\r
576 #define W_XZ          0x0200  //--| only used for patch vertex manip stuff\r
577 #define W_YZ          0x0400  //--|\r
578 #define W_GROUP       0x0800 \r
579 #define W_MEDIA       0x1000 \r
580 #define W_ALL                   0xFFFFFFFF\r
581 \r
582 // used in some Drawing routines\r
583 enum VIEWTYPE {YZ, XZ, XY};\r
584 const char g_AxisName[3] = { 'X', 'Y', 'Z' };\r
585 \r
586 // dynamically allocated string\r
587 class string_t\r
588 {\r
589 public:\r
590   inline string_t()\r
591   {\r
592     copy("");\r
593   }\r
594   inline string_t(const string_t& other)\r
595   {\r
596     copy(other.m_string);\r
597   }\r
598   inline string_t(const char* string)\r
599   {\r
600     copy(string);\r
601   }\r
602   inline ~string_t()\r
603   {\r
604     destroy();\r
605   }\r
606   inline const string_t& operator=(const string_t& other)\r
607   {\r
608     destroy();\r
609     copy(other.m_string);\r
610     return *this;\r
611   }\r
612   inline const string_t& operator=(const char* string)\r
613   {\r
614     destroy();\r
615     copy(string);\r
616     return *this;\r
617   }\r
618   inline bool operator<(const string_t& other) const\r
619   {\r
620     return compare(other) < 0;\r
621   }\r
622   inline bool operator>(const string_t& other) const\r
623   {\r
624     return compare(other) > 0;\r
625   }\r
626   inline bool operator==(const string_t& other) const\r
627   {\r
628     return compare(other) == 0;\r
629   }\r
630   inline bool operator!=(const string_t& other) const\r
631   {\r
632     return compare(other) != 0;\r
633   }\r
634   inline const char* c_str() const\r
635   {\r
636     return m_string;\r
637   }\r
638 private:\r
639   inline void copy(const char* string)\r
640   {\r
641     m_string = new char[strlen(string)+1];\r
642     strcpy(m_string, string);\r
643   }\r
644   inline void destroy()\r
645   {\r
646     delete[] m_string;\r
647   }\r
648   inline int compare(const string_t& other) const\r
649   {\r
650     return strcmp(m_string, other.m_string);\r
651   }\r
652 \r
653   char* m_string;\r
654 };\r
655 \r
656 class filetype_t\r
657 {\r
658 public:\r
659   filetype_t()\r
660     : name(""), pattern("")\r
661   {}\r
662   filetype_t(const char* _name, const char* _pattern)\r
663     : name(_name), pattern(_pattern)\r
664   {}\r
665   const char* name;\r
666   const char* pattern;\r
667 };\r
668 \r
669 \r
670 /*\r
671 ** Outline bits\r
672 */\r
673 #define OUTLINE_ZBUF  0x01  // zbuffered outline\r
674 #define OUTLINE_BSEL  0x02  // selection overlay\r
675 \r
676 #ifdef USEPLUGINENTITIES\r
677 // forward declare this one\r
678 class IPluginEntity;\r
679 #endif // USEPLUGINENTITIES\r
680 \r
681 // MODEL\r
682 \r
683 class IRender;\r
684 class ISelect;\r
685 class IEdit;\r
686 \r
687 // NOTE TTimo about ~entity_interfaces_t\r
688 // using constructors / destructors on C structs is bad practice\r
689 struct entity_interfaces_t\r
690 {\r
691   IRender *pRender;\r
692   ISelect *pSelect;\r
693   IEdit *pEdit;\r
694 };\r
695 // MODEL END\r
696    \r
697 typedef struct entity_s\r
698 {\r
699   struct entity_s       *prev, *next;\r
700 \r
701   /*!\r
702   \todo can use a brushes list, or the blind data below\r
703   for now, blind data should be interpreted as CPtrArray*, only use in the IMAP API\r
704   */\r
705   brush_t               brushes;                                        // head/tail of list\r
706   void *pData;\r
707 \r
708   int                   undoId, redoId, entityId;       // used for undo/redo\r
709   vec3_t                origin;\r
710   eclass_t      *eclass;\r
711   epair_t               *epairs;\r
712   entity_interfaces_t model;\r
713 #ifdef USEPLUGINENTITIES\r
714   IPluginEntity *pPlugEnt;\r
715 #endif // USEPLUGINENTITIES\r
716 \r
717   // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=252\r
718   // this is cam code addition?\r
719   vec3_t color;\r
720 \r
721         // Arnout: HACK-ish and change for 1.3 (in 1.3 we have a blind data pointer according to TTimo)\r
722         float fLightEnvelope1[3];\r
723         float fLightEnvelope2[2];\r
724 } entity_t;\r
725 \r
726 typedef struct\r
727 {\r
728   int      p1, p2;\r
729   face_t   *f1, *f2;\r
730 } pedge_t;\r
731 \r
732 // window system independent camera view code\r
733 // NOTE TTimo taken from xy.h\r
734 typedef struct\r
735 {\r
736   int       width, height;\r
737 \r
738   qboolean  timing;\r
739 \r
740   vec3_t    origin;  // at center of window\r
741   float     scale;\r
742 \r
743   float     topclip, bottomclip;\r
744 \r
745   qboolean  d_dirty;\r
746 } xy_t;\r
747 \r
748 // spog - struct used for nodes in filters list\r
749 struct bfilter_t //c++ style\r
750 {\r
751         bfilter_t       *next;\r
752         int             attribute;              // 1=brush->face->pShader->getName()\r
753                                                         // 2=brush->pPatch->pShader->getFlags()\r
754                                                         // 3=brush->owner->eclass->name\r
755                                                         // 4=brush->owner->eclass->nShowFlags\r
756         int             mask;\r
757         char    *string;\r
758         bool    active;\r
759 };\r
760 \r
761 // djbob: no longer any need to add only to end, versioning removed, it is no longer saved as binary\r
762 // IMPORTANT: whenever you update this struct, you need to add the relevant load/save code\r
763 // preferences.cpp LoadPref / SavePref\r
764 typedef struct\r
765 {\r
766   int         iTexMenu;         // nearest, linear, etc\r
767   float     fGamma;               // gamma for textures\r
768   vec3_t    colors[COLOR_LAST];\r
769   int       exclude;\r
770   int       include;\r
771   texdef_t  m_SIIncrement;  // increments for the surface inspector\r
772   texdef_t  m_PIIncrement;  // increments for the patch inspector\r
773   vec3_t    AxisColors[3];  // colors used for X, Y Z axis\r
774                             // these are in the View > Show menu with Show coordinates\r
775   qboolean  show_names;\r
776   qboolean  show_coordinates;\r
777   qboolean  show_angles;\r
778   qboolean  show_outline;\r
779   qboolean  show_axis;\r
780   qboolean  bNoSelectedOutlines;\r
781   bfilter_t     *filters; // FIXME spog - might be better in another location?\r
782   int       iSelectedOutlinesStyle;\r
783 } SavedInfo_t;\r
784 \r
785 typedef enum\r
786 {\r
787   sel_brush,\r
788   sel_brush_on,\r
789   sel_brush_off,\r
790   // sel_sticky_brush,\r
791   // sel_face,\r
792   sel_vertex,\r
793   sel_edge,\r
794   sel_singlevertex,\r
795   sel_curvepoint,\r
796   sel_area,\r
797   sel_areatall,\r
798   sel_facets_on,\r
799   sel_facets_off,\r
800 } select_t;\r
801 \r
802 // most of the QE globals are stored in this structure\r
803 typedef struct\r
804 {\r
805   qboolean  d_showgrid;\r
806   float     d_gridsize;\r
807   qboolean  d_bSmallGrid; // we use this flag to hack our way into editing of <1 grids\r
808         \r
809   int      d_num_entities;\r
810         \r
811   entity_t *d_project_entity;\r
812 \r
813   // defines the boundaries of the current work area\r
814   // is used to guess brushes and drop points third coordinate when creating from 2D view\r
815   vec3_t    d_work_min,d_work_max;\r
816   // not stored in registry, default is off\r
817   qboolean      d_show_work;\r
818 \r
819   vec3_t       d_points[MAX_POINTS];\r
820   int          d_numpoints;\r
821   pedge_t      d_edges[MAX_EDGES];\r
822   int          d_numedges;\r
823 \r
824   int          d_num_move_points;\r
825   float        *d_move_points[4096];\r
826 \r
827   qtexture_t   *d_qtextures;\r
828   // used to speedup access, specially in QERApp_Try_Texture_ForName\r
829   // must always be kept up-to-date with d_qtextures*\r
830   //++timo FIXME at some point in the future it would even be better to remove d_qtextures and use this instead\r
831   GHashTable *d_qtexmap;\r
832 \r
833   texturewin_t d_texturewin;\r
834 \r
835   int          d_pointfile_display_list;\r
836 \r
837   xy_t         d_xyOld;\r
838 \r
839   SavedInfo_t  d_savedinfo;\r
840         \r
841   int          d_workcount;\r
842         \r
843   // connect entities uses the last two brushes selected\r
844   int            d_select_count;\r
845   brush_t      *d_select_order[2];\r
846   vec3_t       d_select_translate;    // for dragging w/o making new display lists\r
847   select_t     d_select_mode;\r
848         \r
849   int          d_parsed_brushes;\r
850         \r
851   qboolean     show_blocks;\r
852   int                  blockSize;\r
853 \r
854   // NOTE TTimo\r
855   // a lot of this data should be in a property bag and available to the other modules through an API\r
856   // this is generated from game configuration and the project settings, and should be still be part of it\r
857         \r
858   // tells if we are internally using brush primitive (texture coordinates and map format)\r
859   // this is a shortcut for IntForKey( g_qeglobals.d_project_entity, "brush_primit" )\r
860   // NOTE: must keep the two ones in sync\r
861   bool         m_bBrushPrimitMode;\r
862 \r
863   /*!\r
864   win32: engine full path.\r
865   unix: user home full path + engine dir.\r
866   */\r
867   Str         m_strHomeGame;\r
868   /*!\r
869   cache for m_strHomeGame + mod subdirectory.\r
870   */\r
871   Str         m_strHomeMaps;\r
872 \r
873   // used while importing brush data from file or memory buffer\r
874   // tells if conversion between map format and internal preferences ( m_bBrushPrimitMode ) is needed\r
875   qboolean     bNeedConvert;\r
876   qboolean     bOldBrushes;\r
877   qboolean     bPrimitBrushes;\r
878         \r
879   vec3_t       d_vAreaTL;\r
880   vec3_t       d_vAreaBR;\r
881         \r
882   // tells if we are using .INI files for prefs instead of registry\r
883   qboolean      use_ini;\r
884   // even in .INI mode we use the registry for all void* prefs\r
885   char          use_ini_registry[64];\r
886   // disabled all INI / registry read write .. used when shutting down after registry cleanup\r
887   qboolean disable_ini;\r
888         \r
889   // tells we are using a BSP frontend plugin\r
890   qboolean      bBSPFrontendPlugin;\r
891 \r
892   // handle to the console log file\r
893   // we use low level I/O to get rid of buffering and have everything on file if we crash\r
894   int hLogFile;\r
895 \r
896   qboolean bTextureCompressionSupported; // is texture compression supported by hardware?\r
897   GLint texture_components;\r
898 \r
899   // temporary values that should be initialised only once at run-time\r
900   // there are too many uneccessary calls to Sys_QGL_ExtensionSupported\r
901   // NOTE TTimo: those are unused atm (set right, but not used)\r
902   // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=623\r
903   bool m_bOpenGLCompressionSupported;\r
904   bool m_bS3CompressionSupported;\r
905   \r
906   // set to true after OpenGL has been initialized and extensions have been tested\r
907   bool m_bOpenGLReady;\r
908 \r
909 } QEGlobals_t;\r
910 \r
911 #endif // _QERTYPES_H_\r