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