1 /* 2 =========================================================================== 3 4 Doom 3 GPL Source Code 5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 7 This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 9 Doom 3 Source Code is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Doom 3 Source Code is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>. 21 22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 26 =========================================================================== 27 */ 28 #ifndef _QERTYPE_H 29 #define _QERTYPE_H 30 31 #define MAXPOINTS 16 32 33 class texdef_t 34 { 35 public: texdef_t()36 texdef_t() 37 { 38 name = ""; 39 shift[0] = shift[1] = 0.0; 40 rotate = 0; 41 scale[0] = scale[1] = 0; 42 value = 0; 43 } ~texdef_t()44 ~texdef_t() 45 { 46 if ( name && name[0] ) { 47 delete []name; 48 } 49 name = NULL; 50 } 51 SetName(const char * p)52 void SetName( const char *p ) 53 { 54 if ( name && name[0] ) { 55 delete []name; 56 } 57 if ( p && p[0] ) { 58 name = strcpy( new char[strlen(p)+1], p ); 59 } 60 else { 61 name = ""; 62 } 63 } 64 65 texdef_t& operator =(const texdef_t& rhs) 66 { 67 if ( &rhs != this ) { 68 SetName(rhs.name); 69 shift[0] = rhs.shift[0]; 70 shift[1] = rhs.shift[1]; 71 rotate = rhs.rotate; 72 scale[0] = rhs.scale[0]; 73 scale[1] = rhs.scale[1]; 74 value = rhs.value; 75 } 76 return *this; 77 } 78 //char name[128]; 79 char * name; 80 float shift[2]; 81 float rotate; 82 float scale[2]; 83 int value; 84 }; 85 86 // Timo 87 // new brush primitive texdef 88 //typedef struct brushprimit_texdef_s 89 //{ 90 // float coords[2][3]; 91 //} brushprimit_texdef_t; 92 93 class brushprimit_texdef_t { 94 public: 95 float coords[2][3]; brushprimit_texdef_t()96 brushprimit_texdef_t() { 97 memset(&coords, 0, sizeof(coords)); 98 coords[0][0] = 1.0; 99 coords[1][1] = 1.0; 100 } 101 }; 102 103 class texturewin_t 104 { 105 public: texturewin_t()106 texturewin_t() { 107 memset(&brushprimit_texdef.coords, 0, sizeof(brushprimit_texdef.coords)); 108 brushprimit_texdef.coords[0][0] = 1.0; 109 brushprimit_texdef.coords[1][1] = 1.0; 110 } 111 ~texturewin_t()112 ~texturewin_t() { 113 } 114 int width, height; 115 int originy; 116 // add brushprimit_texdef_t for brush primitive coordinates storage 117 brushprimit_texdef_t brushprimit_texdef; 118 int m_nTotalHeight; 119 // surface plugin, must be casted to a IPluginTexdef* 120 void* pTexdef; 121 texdef_t texdef; 122 }; 123 124 #define QER_TRANS 0x00000001 125 #define QER_NOCARVE 0x00000002 126 127 typedef struct qtexture_s 128 { 129 struct qtexture_s *next; 130 char name[64]; // includes partial directory and extension 131 int width, height; 132 int contents; 133 int flags; 134 int value; 135 int texture_number; // gl bind number 136 137 // name of the .shader file 138 char shadername[1024]; // old shader stuff 139 bool bFromShader; // created from a shader 140 float fTrans; // amount of transparency 141 int nShaderFlags; // qer_ shader flags 142 idVec3 color; // for flat shade mode 143 bool inuse; // true = is present on the level 144 145 // cast this one to an IPluginQTexture if you are using it 146 // NOTE: casting can be done with a GETPLUGINQTEXTURE defined in isurfaceplugin.h 147 // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginQTexture *pPluginQTexture } kind of thing ? 148 void *pData; 149 150 //++timo FIXME: this is the actual filename of the texture 151 // this will be removed after shader code cleanup 152 char filename[64]; 153 154 } qtexture_t; 155 156 //++timo texdef and brushprimit_texdef are static 157 // TODO : do dynamic ? 158 typedef struct face_s 159 { 160 struct face_s *next; 161 struct face_s *original; //used for vertex movement 162 idVec3 planepts[3]; 163 idVec3 orgplanepts[3]; // used for arbitrary rotation 164 texdef_t texdef; 165 166 idPlane plane; 167 idPlane originalPlane; 168 bool dirty; 169 170 idWinding *face_winding; 171 172 idVec3 d_color; 173 const idMaterial *d_texture; 174 175 // Timo new brush primit texdef 176 brushprimit_texdef_t brushprimit_texdef; 177 178 // cast this one to an IPluginTexdef if you are using it 179 // NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h 180 // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ? 181 void *pData; 182 } face_t; 183 184 typedef struct { 185 idVec3 xyz; 186 float sideST[2]; 187 float capST[2]; 188 } curveVertex_t; 189 190 typedef struct { 191 curveVertex_t v[2]; 192 } sideVertex_t; 193 194 195 #define MIN_PATCH_WIDTH 3 196 #define MIN_PATCH_HEIGHT 3 197 198 #define MAX_PATCH_WIDTH 64 199 #define MAX_PATCH_HEIGHT 64 200 201 // patch type info 202 // type in lower 16 bits, flags in upper 203 // endcaps directly follow this patch in the list 204 205 // types 206 #define PATCH_GENERIC 0x00000000 // generic flat patch 207 #define PATCH_CYLINDER 0x00000001 // cylinder 208 #define PATCH_BEVEL 0x00000002 // bevel 209 #define PATCH_ENDCAP 0x00000004 // endcap 210 #define PATCH_HEMISPHERE 0x00000008 // hemisphere 211 #define PATCH_CONE 0x00000010 // cone 212 #define PATCH_TRIANGLE 0x00000020 // simple tri, assumes 3x3 patch 213 214 // behaviour styles 215 #define PATCH_CAP 0x00001000 // flat patch applied as a cap 216 #define PATCH_SEAM 0x00002000 // flat patch applied as a seam 217 #define PATCH_THICK 0x00004000 // patch applied as a thick portion 218 219 // styles 220 #define PATCH_BEZIER 0x00000000 // default bezier 221 #define PATCH_BSPLINE 0x10000000 // bspline 222 223 #define PATCH_TYPEMASK 0x00000fff // 224 #define PATCH_BTYPEMASK 0x0000f000 // 225 #define PATCH_STYLEMASK 0xffff0000 // 226 227 228 struct brush_s; 229 typedef struct brush_s brush_t; 230 231 typedef struct { 232 int width, height; // in control points, not patches 233 int horzSubdivisions; 234 int vertSubdivisions; 235 bool explicitSubdivisions; 236 int contents, flags, value, type; 237 const idMaterial *d_texture; 238 idDrawVert *verts; 239 //idDrawVert *ctrl; 240 brush_t * pSymbiot; 241 bool bSelected; 242 bool bOverlay; 243 int nListID; 244 int nListIDCam; 245 int nListSelected; 246 247 idDict * epairs; 248 // cast this one to an IPluginTexdef if you are using it 249 // NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h 250 // TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ? 251 void * pData; ctrl__anon0186ee2a0308252 ID_INLINE idDrawVert &ctrl( int col, int row ) { 253 if ( col < 0 || col >= width || row < 0 || row >= height ) { 254 common->Warning( "patchMesh_t::ctrl: control point out of range" ); 255 return verts[0]; 256 } 257 else { 258 return verts[row * width + col]; 259 } 260 } 261 } patchMesh_t; 262 263 enum { 264 LIGHT_TARGET, 265 LIGHT_RIGHT, 266 LIGHT_UP, 267 LIGHT_RADIUS, 268 LIGHT_X, 269 LIGHT_Y, 270 LIGHT_Z, 271 LIGHT_START, 272 LIGHT_END, 273 LIGHT_CENTER 274 }; 275 276 277 typedef struct brush_s 278 { 279 struct brush_s *prev, *next; // links in active/selected 280 struct brush_s *oprev, *onext; // links in entity 281 brush_t * list; //keep a handy link to the list its in 282 struct entity_s *owner; 283 idVec3 mins, maxs; 284 285 idVec3 lightCenter; // for moving the shading center of point lights 286 idVec3 lightRight; 287 idVec3 lightTarget; 288 idVec3 lightUp; 289 idVec3 lightRadius; 290 idVec3 lightOffset; 291 idVec3 lightColor; 292 idVec3 lightStart; 293 idVec3 lightEnd; 294 bool pointLight; 295 bool startEnd; 296 int lightTexture; 297 298 bool trackLightOrigin; // this brush is a special case light brush 299 bool entityModel; 300 301 face_t *brush_faces; 302 303 bool bModelFailed; 304 // 305 // curve brush extensions 306 // all are derived from brush_faces 307 bool hiddenBrush; 308 bool forceWireFrame; 309 bool forceVisibile; 310 311 patchMesh_t *pPatch; 312 struct entity_s *pUndoOwner; 313 314 int undoId; //undo ID 315 int redoId; //redo ID 316 int ownerId; //entityId of the owner entity for undo 317 318 // TTimo: HTREEITEM is MFC, some plugins really don't like it 319 #ifdef QERTYPES_USE_MFC 320 int numberId; // brush number 321 HTREEITEM itemOwner; // owner for grouping 322 #else 323 int numberId; 324 DWORD itemOwner; 325 #endif 326 327 idRenderModel *modelHandle; 328 329 // brush primitive only 330 idDict epairs; 331 332 } brush_t; 333 334 335 #define MAX_FLAGS 8 336 337 338 typedef struct trimodel_t 339 { 340 idVec3 v[3]; 341 float st[3][2]; 342 } trimodel; 343 344 345 // eclass show flags 346 347 #define ECLASS_LIGHT 0x00000001 348 #define ECLASS_ANGLE 0x00000002 349 #define ECLASS_PATH 0x00000004 350 #define ECLASS_MISCMODEL 0x00000008 351 #define ECLASS_PLUGINENTITY 0x00000010 352 #define ECLASS_PROJECTEDLIGHT 0x00000020 353 #define ECLASS_WORLDSPAWN 0x00000040 354 #define ECLASS_SPEAKER 0x00000080 355 #define ECLASS_PARTICLE 0x00000100 356 #define ECLASS_ROTATABLE 0x00000200 357 #define ECLASS_CAMERAVIEW 0x00000400 358 #define ECLASS_MOVER 0x00000800 359 #define ECLASS_ENV 0x00001000 360 #define ECLASS_COMBATNODE 0x00002000 361 #define ECLASS_LIQUID 0x00004000 362 363 enum EVAR_TYPES { 364 EVAR_STRING, 365 EVAR_INT, 366 EVAR_FLOAT, 367 EVAR_BOOL, 368 EVAR_COLOR, 369 EVAR_MATERIAL, 370 EVAR_MODEL, 371 EVAR_GUI, 372 EVAR_SOUND 373 }; 374 375 typedef struct evar_s { 376 int type; 377 idStr name; 378 idStr desc; 379 } evar_t; 380 381 typedef struct eclass_s 382 { 383 struct eclass_s *next; 384 idStr name; 385 bool fixedsize; 386 bool unknown; // wasn't found in source 387 idVec3 mins, maxs; 388 idVec3 color; 389 texdef_t texdef; 390 idStr comments; 391 idStr desc; 392 393 idRenderModel *modelHandle; 394 idRenderModel *entityModel; 395 396 int nFrame; 397 unsigned int nShowFlags; 398 idStr defMaterial; 399 idDict args; 400 idDict defArgs; 401 idList<evar_t> vars; 402 403 HMODULE hPlug; 404 } eclass_t; 405 406 extern eclass_t *eclass; 407 408 /* 409 ** window bits 410 */ 411 #define W_CAMERA 0x0001 412 #define W_XY 0x0002 413 #define W_XY_OVERLAY 0x0004 414 #define W_Z 0x0008 415 #define W_TEXTURE 0x0010 416 #define W_Z_OVERLAY 0x0020 417 #define W_CONSOLE 0x0040 418 #define W_ENTITY 0x0080 419 #define W_CAMERA_IFON 0x0100 420 #define W_XZ 0x0200 //--| only used for patch vertex manip stuff 421 #define W_YZ 0x0400 //--| 422 #define W_MEDIA 0x1000 423 #define W_GAME 0x2000 424 #define W_ALL 0xFFFFFFFF 425 426 // used in some Drawing routines 427 enum VIEWTYPE {YZ, XZ, XY}; 428 429 #endif 430