2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\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
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
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
25 // merged from brush.h, etc. for plugin support
\r
27 #ifndef _QERTYPES_H_
\r
28 #define _QERTYPES_H_
\r
39 #define PATH_MAX 260
\r
43 #define NAME_MAX 255
\r
45 typedef bool qboolean;
\r
47 #define MAXPOINTS 16
\r
49 // merged from qedefs.h ------
\r
51 #define MAX_EDGES 512
\r
52 #define MAX_POINTS 1024
\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
68 #define COLOR_GRIDMINOR_ALT 13
\r
69 #define COLOR_GRIDMAJOR_ALT 14
\r
71 #define COLOR_LAST 15
\r
73 // ----------------------------
\r
75 typedef float vec_t;
\r
76 typedef vec_t vec3_t[3];
\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
102 texdef_t(const texdef_t& other)
\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
120 name = (char*)NULL;
\r
124 void SetName(const char *p)
\r
133 name = strcpy(new char[strlen(p)+1], p);
\r
137 name = new char[1];
\r
142 const char * GetName() const
\r
147 // NOTE TTimo when loading prefs as binary, we load a bogus value in texdef..
\r
154 texdef_t& operator =(const texdef_t& rhs)
\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
180 // max length of a vfs texture path
\r
187 texdef_t() { name[0] = '\0'; }
\r
190 void SetName(const char *p)
\r
192 strncpy(name, p, QPATH);
\r
195 const char * GetName() const
\r
200 // NOTE TTimo when loading prefs as binary, we load a bogus value in texdef..
\r
206 texdef_t& operator =(const texdef_t& rhs)
\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
236 // new brush primitive texdef
\r
237 typedef struct brushprimit_texdef_s
\r
239 vec_t coords[2][3];
\r
240 } brushprimit_texdef_t;
\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
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
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
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
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
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
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
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
304 float points[8][5]; // variable sized
\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
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
326 // Nurail: Face Undo
\r
330 winding_t *face_winding;
\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
337 //++timo FIXME: remove!
\r
338 qtexture_t *d_texture;
\r
340 // Timo new brush primit texdef
\r
341 brushprimit_texdef_t brushprimit_texdef;
\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
356 curveVertex_t v[2];
\r
360 #define MIN_PATCH_WIDTH 3
\r
361 #define MIN_PATCH_HEIGHT 3
\r
363 #define MAX_PATCH_WIDTH 16
\r
364 #define MAX_PATCH_HEIGHT 16
\r
367 // type in lower 16 bits, flags in upper
\r
368 // endcaps directly follow this patch in the list
\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
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
385 #define PATCH_BEZIER 0x00000000 // default bezier
\r
386 #define PATCH_BSPLINE 0x10000000 // bspline
\r
388 #define PATCH_TYPEMASK 0x00000fff //
\r
389 #define PATCH_BTYPEMASK 0x0000f000 //
\r
390 #define PATCH_STYLEMASK 0xffff0000 //
\r
399 // spog - used for patch LOD trees
\r
403 BTNode_t *left, *right;
\r
412 drawVert_t vLeft, vRight;
\r
415 struct BTListList_t
\r
417 BTListList_t *next;
\r
421 // used in brush primitive AND entities
\r
422 typedef struct epair_s
\r
424 struct epair_s *next;
\r
430 typedef struct brush_s brush_t;
\r
433 int width, height; // in control points, not patches
\r
434 int contents, flags, value, type;
\r
435 qtexture_t *d_texture;
\r
437 drawVert_t ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];
\r
439 qboolean bSelected;
\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
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
454 void *drawLists; // pointer to std::list
\r
457 typedef struct brush_s
\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
463 face_t *brush_faces;
\r
465 qboolean bModelFailed;
\r
467 // curve brush extensions
\r
468 // all are derived from brush_faces
\r
469 qboolean patchBrush;
\r
470 qboolean hiddenBrush;
\r
474 patchMesh_t *pPatch;
\r
475 struct entity_s *pUndoOwner;
\r
477 int undoId; //undo ID
\r
478 int redoId; //redo ID
\r
479 int ownerId; //entityId of the owner entity for undo
\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
484 void* itemOwner; // GtkCTreeNode* ?
\r
486 // brush primitive only
\r
489 // brush filtered toggle
\r
495 #define MAX_FLAGS 16
\r
497 typedef struct vertmodel_t
\r
504 typedef struct triindex_t
\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
514 struct entitymodel_t *pNext;
\r
516 //trimodel *pTriList;
\r
517 //md3Triangle_t *pTriList;
\r
518 triindex *pTriList;
\r
519 vertmodel *pVertList;
\r
522 void *strSkin; // toolkit-independent .. cast to a GString*
\r
525 int nModelPosition;
\r
528 // eclass show flags
\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
535 #ifdef USEPLUGINENTITIES
\r
536 #define ECLASS_PLUGINENTITY 0x00000010
\r
537 #endif // USEPLUGINENTITIES
\r
539 typedef struct eclass_s
\r
541 struct eclass_s *next;
\r
543 qboolean fixedsize;
\r
544 qboolean unknown; // wasn't found in source
\r
549 char flagnames[MAX_FLAGS][32];
\r
551 entitymodel *model;
\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
557 unsigned int nShowFlags;
\r
562 extern eclass_t *eclass;
\r
567 #define W_CAMERA 0x0001
\r
568 #define W_XY 0x0002
\r
569 #define W_XY_OVERLAY 0x0004
\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
582 // used in some Drawing routines
\r
583 enum VIEWTYPE {YZ, XZ, XY};
\r
584 const char g_AxisName[3] = { 'X', 'Y', 'Z' };
\r
586 // dynamically allocated string
\r
594 inline string_t(const string_t& other)
\r
596 copy(other.m_string);
\r
598 inline string_t(const char* string)
\r
606 inline const string_t& operator=(const string_t& other)
\r
609 copy(other.m_string);
\r
612 inline const string_t& operator=(const char* string)
\r
618 inline bool operator<(const string_t& other) const
\r
620 return compare(other) < 0;
\r
622 inline bool operator>(const string_t& other) const
\r
624 return compare(other) > 0;
\r
626 inline bool operator==(const string_t& other) const
\r
628 return compare(other) == 0;
\r
630 inline bool operator!=(const string_t& other) const
\r
632 return compare(other) != 0;
\r
634 inline const char* c_str() const
\r
639 inline void copy(const char* string)
\r
641 m_string = new char[strlen(string)+1];
\r
642 strcpy(m_string, string);
\r
644 inline void destroy()
\r
648 inline int compare(const string_t& other) const
\r
650 return strcmp(m_string, other.m_string);
\r
660 : name(""), pattern("")
\r
662 filetype_t(const char* _name, const char* _pattern)
\r
663 : name(_name), pattern(_pattern)
\r
666 const char* pattern;
\r
673 #define OUTLINE_ZBUF 0x01 // zbuffered outline
\r
674 #define OUTLINE_BSEL 0x02 // selection overlay
\r
676 #ifdef USEPLUGINENTITIES
\r
677 // forward declare this one
\r
678 class IPluginEntity;
\r
679 #endif // USEPLUGINENTITIES
\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
697 typedef struct entity_s
\r
699 struct entity_s *prev, *next;
\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
705 brush_t brushes; // head/tail of list
\r
708 int undoId, redoId, entityId; // used for undo/redo
\r
712 entity_interfaces_t model;
\r
713 #ifdef USEPLUGINENTITIES
\r
714 IPluginEntity *pPlugEnt;
\r
715 #endif // USEPLUGINENTITIES
\r
717 // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=252
\r
718 // this is cam code addition?
\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
732 // window system independent camera view code
\r
733 // NOTE TTimo taken from xy.h
\r
740 vec3_t origin; // at center of window
\r
743 float topclip, bottomclip;
\r
748 // spog - struct used for nodes in filters list
\r
749 struct bfilter_t //c++ style
\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
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
766 int iTexMenu; // nearest, linear, etc
\r
767 float fGamma; // gamma for textures
\r
768 vec3_t colors[COLOR_LAST];
\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
790 // sel_sticky_brush,
\r
802 // most of the QE globals are stored in this structure
\r
805 qboolean d_showgrid;
\r
807 qboolean d_bSmallGrid; // we use this flag to hack our way into editing of <1 grids
\r
809 int d_num_entities;
\r
811 entity_t *d_project_entity;
\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
819 vec3_t d_points[MAX_POINTS];
\r
821 pedge_t d_edges[MAX_EDGES];
\r
824 int d_num_move_points;
\r
825 float *d_move_points[4096];
\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
833 texturewin_t d_texturewin;
\r
835 int d_pointfile_display_list;
\r
839 SavedInfo_t d_savedinfo;
\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
849 int d_parsed_brushes;
\r
851 qboolean show_blocks;
\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
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
864 win32: engine full path.
\r
865 unix: user home full path + engine dir.
\r
869 cache for m_strHomeGame + mod subdirectory.
\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
882 // tells if we are using .INI files for prefs instead of registry
\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
889 // tells we are using a BSP frontend plugin
\r
890 qboolean bBSPFrontendPlugin;
\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
896 qboolean bTextureCompressionSupported; // is texture compression supported by hardware?
\r
897 GLint texture_components;
\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
906 // set to true after OpenGL has been initialized and extensions have been tested
\r
907 bool m_bOpenGLReady;
\r
911 #endif // _QERTYPES_H_
\r