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