| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
#ifndef TR_LOCAL_H |
| 25 |
#define TR_LOCAL_H |
| 26 |
|
| 27 |
#include "../qcommon/q_shared.h" |
| 28 |
#include "../qcommon/qfiles.h" |
| 29 |
#include "../qcommon/qcommon.h" |
| 30 |
#include "../renderercommon/tr_public.h" |
| 31 |
#include "../renderercommon/tr_common.h" |
| 32 |
#include "../renderercommon/iqm.h" |
| 33 |
#include "../renderercommon/qgl.h" |
| 34 |
|
| 35 |
#define GLE(ret, name, ...) extern name##proc * qgl##name; |
| 36 |
QGL_1_1_PROCS; |
| 37 |
QGL_1_1_FIXED_FUNCTION_PROCS; |
| 38 |
QGL_DESKTOP_1_1_PROCS; |
| 39 |
QGL_DESKTOP_1_1_FIXED_FUNCTION_PROCS; |
| 40 |
QGL_3_0_PROCS; |
| 41 |
#undef GLE |
| 42 |
|
| 43 |
#define GL_INDEX_TYPE GL_UNSIGNED_INT |
| 44 |
typedef unsigned int glIndex_t; |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
#define SHADERNUM_BITS 14 |
| 50 |
#define MAX_SHADERS (1<<SHADERNUM_BITS) |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
typedef struct dlight_s { |
| 55 |
vec3_t origin; |
| 56 |
vec3_t color; |
| 57 |
float radius; |
| 58 |
|
| 59 |
vec3_t transformed; |
| 60 |
int additive; |
| 61 |
} dlight_t; |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
typedef struct { |
| 67 |
refEntity_t e; |
| 68 |
|
| 69 |
float axisLength; |
| 70 |
|
| 71 |
qboolean needDlights; |
| 72 |
qboolean lightingCalculated; |
| 73 |
vec3_t lightDir; |
| 74 |
vec3_t ambientLight; |
| 75 |
int ambientLightInt; |
| 76 |
vec3_t directedLight; |
| 77 |
} trRefEntity_t; |
| 78 |
|
| 79 |
|
| 80 |
typedef struct { |
| 81 |
vec3_t origin; |
| 82 |
vec3_t axis[3]; |
| 83 |
vec3_t viewOrigin; |
| 84 |
float modelMatrix[16]; |
| 85 |
} orientationr_t; |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
typedef enum { |
| 90 |
SS_BAD, |
| 91 |
SS_PORTAL, |
| 92 |
SS_ENVIRONMENT, |
| 93 |
SS_OPAQUE, |
| 94 |
|
| 95 |
SS_DECAL, |
| 96 |
SS_SEE_THROUGH, |
| 97 |
|
| 98 |
SS_BANNER, |
| 99 |
|
| 100 |
SS_FOG, |
| 101 |
|
| 102 |
SS_UNDERWATER, |
| 103 |
|
| 104 |
SS_BLEND0, |
| 105 |
SS_BLEND1, |
| 106 |
SS_BLEND2, |
| 107 |
SS_BLEND3, |
| 108 |
|
| 109 |
SS_BLEND6, |
| 110 |
SS_STENCIL_SHADOW, |
| 111 |
SS_ALMOST_NEAREST, |
| 112 |
|
| 113 |
SS_NEAREST |
| 114 |
} shaderSort_t; |
| 115 |
|
| 116 |
|
| 117 |
#define MAX_SHADER_STAGES 8 |
| 118 |
|
| 119 |
typedef enum { |
| 120 |
GF_NONE, |
| 121 |
|
| 122 |
GF_SIN, |
| 123 |
GF_SQUARE, |
| 124 |
GF_TRIANGLE, |
| 125 |
GF_SAWTOOTH, |
| 126 |
GF_INVERSE_SAWTOOTH, |
| 127 |
|
| 128 |
GF_NOISE |
| 129 |
|
| 130 |
} genFunc_t; |
| 131 |
|
| 132 |
|
| 133 |
typedef enum { |
| 134 |
DEFORM_NONE, |
| 135 |
DEFORM_WAVE, |
| 136 |
DEFORM_NORMALS, |
| 137 |
DEFORM_BULGE, |
| 138 |
DEFORM_MOVE, |
| 139 |
DEFORM_PROJECTION_SHADOW, |
| 140 |
DEFORM_AUTOSPRITE, |
| 141 |
DEFORM_AUTOSPRITE2, |
| 142 |
DEFORM_TEXT0, |
| 143 |
DEFORM_TEXT1, |
| 144 |
DEFORM_TEXT2, |
| 145 |
DEFORM_TEXT3, |
| 146 |
DEFORM_TEXT4, |
| 147 |
DEFORM_TEXT5, |
| 148 |
DEFORM_TEXT6, |
| 149 |
DEFORM_TEXT7 |
| 150 |
} deform_t; |
| 151 |
|
| 152 |
typedef enum { |
| 153 |
AGEN_IDENTITY, |
| 154 |
AGEN_SKIP, |
| 155 |
AGEN_ENTITY, |
| 156 |
AGEN_ONE_MINUS_ENTITY, |
| 157 |
AGEN_VERTEX, |
| 158 |
AGEN_ONE_MINUS_VERTEX, |
| 159 |
AGEN_LIGHTING_SPECULAR, |
| 160 |
AGEN_WAVEFORM, |
| 161 |
AGEN_PORTAL, |
| 162 |
AGEN_CONST |
| 163 |
} alphaGen_t; |
| 164 |
|
| 165 |
typedef enum { |
| 166 |
CGEN_BAD, |
| 167 |
CGEN_IDENTITY_LIGHTING, |
| 168 |
CGEN_IDENTITY, |
| 169 |
CGEN_ENTITY, |
| 170 |
CGEN_ONE_MINUS_ENTITY, |
| 171 |
CGEN_EXACT_VERTEX, |
| 172 |
CGEN_VERTEX, |
| 173 |
CGEN_ONE_MINUS_VERTEX, |
| 174 |
CGEN_WAVEFORM, |
| 175 |
CGEN_LIGHTING_DIFFUSE, |
| 176 |
CGEN_FOG, |
| 177 |
CGEN_CONST |
| 178 |
} colorGen_t; |
| 179 |
|
| 180 |
typedef enum { |
| 181 |
TCGEN_BAD, |
| 182 |
TCGEN_IDENTITY, |
| 183 |
TCGEN_LIGHTMAP, |
| 184 |
TCGEN_TEXTURE, |
| 185 |
TCGEN_ENVIRONMENT_MAPPED, |
| 186 |
TCGEN_FOG, |
| 187 |
TCGEN_VECTOR |
| 188 |
} texCoordGen_t; |
| 189 |
|
| 190 |
typedef enum { |
| 191 |
ACFF_NONE, |
| 192 |
ACFF_MODULATE_RGB, |
| 193 |
ACFF_MODULATE_RGBA, |
| 194 |
ACFF_MODULATE_ALPHA |
| 195 |
} acff_t; |
| 196 |
|
| 197 |
typedef struct { |
| 198 |
genFunc_t func; |
| 199 |
|
| 200 |
float base; |
| 201 |
float amplitude; |
| 202 |
float phase; |
| 203 |
float frequency; |
| 204 |
} waveForm_t; |
| 205 |
|
| 206 |
#define TR_MAX_TEXMODS 4 |
| 207 |
|
| 208 |
typedef enum { |
| 209 |
TMOD_NONE, |
| 210 |
TMOD_TRANSFORM, |
| 211 |
TMOD_TURBULENT, |
| 212 |
TMOD_SCROLL, |
| 213 |
TMOD_SCALE, |
| 214 |
TMOD_STRETCH, |
| 215 |
TMOD_ROTATE, |
| 216 |
TMOD_ENTITY_TRANSLATE |
| 217 |
} texMod_t; |
| 218 |
|
| 219 |
#define MAX_SHADER_DEFORMS 3 |
| 220 |
typedef struct { |
| 221 |
deform_t deformation; |
| 222 |
|
| 223 |
vec3_t moveVector; |
| 224 |
waveForm_t deformationWave; |
| 225 |
float deformationSpread; |
| 226 |
|
| 227 |
float bulgeWidth; |
| 228 |
float bulgeHeight; |
| 229 |
float bulgeSpeed; |
| 230 |
} deformStage_t; |
| 231 |
|
| 232 |
|
| 233 |
typedef struct { |
| 234 |
texMod_t type; |
| 235 |
|
| 236 |
|
| 237 |
waveForm_t wave; |
| 238 |
|
| 239 |
|
| 240 |
float matrix[2][2]; |
| 241 |
float translate[2]; |
| 242 |
|
| 243 |
|
| 244 |
float scale[2]; |
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
float scroll[2]; |
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
float rotateSpeed; |
| 254 |
|
| 255 |
} texModInfo_t; |
| 256 |
|
| 257 |
|
| 258 |
#define MAX_IMAGE_ANIMATIONS 8 |
| 259 |
|
| 260 |
typedef struct { |
| 261 |
image_t *image[MAX_IMAGE_ANIMATIONS]; |
| 262 |
int numImageAnimations; |
| 263 |
float imageAnimationSpeed; |
| 264 |
|
| 265 |
texCoordGen_t tcGen; |
| 266 |
vec3_t tcGenVectors[2]; |
| 267 |
|
| 268 |
int numTexMods; |
| 269 |
texModInfo_t *texMods; |
| 270 |
|
| 271 |
int videoMapHandle; |
| 272 |
qboolean isLightmap; |
| 273 |
qboolean isVideoMap; |
| 274 |
} textureBundle_t; |
| 275 |
|
| 276 |
#define NUM_TEXTURE_BUNDLES 2 |
| 277 |
|
| 278 |
typedef struct { |
| 279 |
qboolean active; |
| 280 |
|
| 281 |
textureBundle_t bundle[NUM_TEXTURE_BUNDLES]; |
| 282 |
|
| 283 |
waveForm_t rgbWave; |
| 284 |
colorGen_t rgbGen; |
| 285 |
|
| 286 |
waveForm_t alphaWave; |
| 287 |
alphaGen_t alphaGen; |
| 288 |
|
| 289 |
byte constantColor[4]; |
| 290 |
|
| 291 |
unsigned stateBits; |
| 292 |
|
| 293 |
acff_t adjustColorsForFog; |
| 294 |
|
| 295 |
qboolean isDetail; |
| 296 |
} shaderStage_t; |
| 297 |
|
| 298 |
struct shaderCommands_s; |
| 299 |
|
| 300 |
typedef enum { |
| 301 |
CT_FRONT_SIDED, |
| 302 |
CT_BACK_SIDED, |
| 303 |
CT_TWO_SIDED |
| 304 |
} cullType_t; |
| 305 |
|
| 306 |
typedef enum { |
| 307 |
FP_NONE, |
| 308 |
FP_EQUAL, |
| 309 |
FP_LE |
| 310 |
} fogPass_t; |
| 311 |
|
| 312 |
typedef struct { |
| 313 |
float cloudHeight; |
| 314 |
image_t *outerbox[6], *innerbox[6]; |
| 315 |
} skyParms_t; |
| 316 |
|
| 317 |
typedef struct { |
| 318 |
vec3_t color; |
| 319 |
float depthForOpaque; |
| 320 |
} fogParms_t; |
| 321 |
|
| 322 |
|
| 323 |
typedef struct shader_s { |
| 324 |
char name[MAX_QPATH]; |
| 325 |
int lightmapIndex; |
| 326 |
|
| 327 |
int index; |
| 328 |
int sortedIndex; |
| 329 |
|
| 330 |
float sort; |
| 331 |
|
| 332 |
qboolean defaultShader; |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
qboolean explicitlyDefined; |
| 339 |
|
| 340 |
int surfaceFlags; |
| 341 |
int contentFlags; |
| 342 |
|
| 343 |
qboolean entityMergable; |
| 344 |
|
| 345 |
qboolean isSky; |
| 346 |
skyParms_t sky; |
| 347 |
fogParms_t fogParms; |
| 348 |
|
| 349 |
float portalRange; |
| 350 |
|
| 351 |
int multitextureEnv; |
| 352 |
|
| 353 |
cullType_t cullType; |
| 354 |
qboolean polygonOffset; |
| 355 |
qboolean noMipMaps; |
| 356 |
qboolean noPicMip; |
| 357 |
|
| 358 |
fogPass_t fogPass; |
| 359 |
|
| 360 |
qboolean needsNormal; |
| 361 |
qboolean needsST1; |
| 362 |
qboolean needsST2; |
| 363 |
qboolean needsColor; |
| 364 |
|
| 365 |
int numDeforms; |
| 366 |
deformStage_t deforms[MAX_SHADER_DEFORMS]; |
| 367 |
|
| 368 |
int numUnfoggedPasses; |
| 369 |
shaderStage_t *stages[MAX_SHADER_STAGES]; |
| 370 |
|
| 371 |
void (*optimalStageIteratorFunc)( void ); |
| 372 |
|
| 373 |
double clampTime; |
| 374 |
double timeOffset; |
| 375 |
|
| 376 |
struct shader_s *remappedShader; |
| 377 |
|
| 378 |
struct shader_s *next; |
| 379 |
} shader_t; |
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
typedef struct { |
| 385 |
int x, y, width, height; |
| 386 |
float fov_x, fov_y; |
| 387 |
vec3_t vieworg; |
| 388 |
vec3_t viewaxis[3]; |
| 389 |
|
| 390 |
stereoFrame_t stereoFrame; |
| 391 |
|
| 392 |
int time; |
| 393 |
int rdflags; |
| 394 |
|
| 395 |
|
| 396 |
byte areamask[MAX_MAP_AREA_BYTES]; |
| 397 |
qboolean areamaskModified; |
| 398 |
|
| 399 |
double floatTime; |
| 400 |
|
| 401 |
|
| 402 |
char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH]; |
| 403 |
|
| 404 |
int num_entities; |
| 405 |
trRefEntity_t *entities; |
| 406 |
|
| 407 |
int num_dlights; |
| 408 |
struct dlight_s *dlights; |
| 409 |
|
| 410 |
int numPolys; |
| 411 |
struct srfPoly_s *polys; |
| 412 |
|
| 413 |
int numDrawSurfs; |
| 414 |
struct drawSurf_s *drawSurfs; |
| 415 |
|
| 416 |
|
| 417 |
} trRefdef_t; |
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
#define MAX_SKIN_SURFACES 256 |
| 427 |
|
| 428 |
|
| 429 |
typedef struct { |
| 430 |
char name[MAX_QPATH]; |
| 431 |
shader_t *shader; |
| 432 |
} skinSurface_t; |
| 433 |
|
| 434 |
typedef struct skin_s { |
| 435 |
char name[MAX_QPATH]; |
| 436 |
int numSurfaces; |
| 437 |
skinSurface_t *surfaces; |
| 438 |
} skin_t; |
| 439 |
|
| 440 |
|
| 441 |
typedef struct { |
| 442 |
int originalBrushNumber; |
| 443 |
vec3_t bounds[2]; |
| 444 |
|
| 445 |
unsigned colorInt; |
| 446 |
float tcScale; |
| 447 |
fogParms_t parms; |
| 448 |
|
| 449 |
|
| 450 |
qboolean hasSurface; |
| 451 |
float surface[4]; |
| 452 |
} fog_t; |
| 453 |
|
| 454 |
typedef struct { |
| 455 |
orientationr_t or; |
| 456 |
orientationr_t world; |
| 457 |
vec3_t pvsOrigin; |
| 458 |
qboolean isPortal; |
| 459 |
qboolean isMirror; |
| 460 |
int frameSceneNum; |
| 461 |
int frameCount; |
| 462 |
cplane_t portalPlane; |
| 463 |
int viewportX, viewportY, viewportWidth, viewportHeight; |
| 464 |
float fovX, fovY; |
| 465 |
float projectionMatrix[16]; |
| 466 |
cplane_t frustum[4]; |
| 467 |
vec3_t visBounds[2]; |
| 468 |
float zFar; |
| 469 |
stereoFrame_t stereoFrame; |
| 470 |
} viewParms_t; |
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
typedef enum { |
| 483 |
SF_BAD, |
| 484 |
SF_SKIP, |
| 485 |
SF_FACE, |
| 486 |
SF_GRID, |
| 487 |
SF_TRIANGLES, |
| 488 |
SF_POLY, |
| 489 |
SF_MD3, |
| 490 |
SF_MDR, |
| 491 |
SF_IQM, |
| 492 |
SF_FLARE, |
| 493 |
SF_ENTITY, |
| 494 |
|
| 495 |
SF_NUM_SURFACE_TYPES, |
| 496 |
SF_MAX = 0x7fffffff |
| 497 |
} surfaceType_t; |
| 498 |
|
| 499 |
typedef struct drawSurf_s { |
| 500 |
unsigned sort; |
| 501 |
surfaceType_t *surface; |
| 502 |
} drawSurf_t; |
| 503 |
|
| 504 |
#define MAX_FACE_POINTS 64 |
| 505 |
|
| 506 |
#define MAX_PATCH_SIZE 32 // max dimensions of a patch mesh in map file |
| 507 |
#define MAX_GRID_SIZE 65 // max dimensions of a grid mesh in memory |
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
typedef struct srfPoly_s { |
| 512 |
surfaceType_t surfaceType; |
| 513 |
qhandle_t hShader; |
| 514 |
int fogIndex; |
| 515 |
int numVerts; |
| 516 |
polyVert_t *verts; |
| 517 |
} srfPoly_t; |
| 518 |
|
| 519 |
|
| 520 |
typedef struct srfFlare_s { |
| 521 |
surfaceType_t surfaceType; |
| 522 |
vec3_t origin; |
| 523 |
vec3_t normal; |
| 524 |
vec3_t color; |
| 525 |
} srfFlare_t; |
| 526 |
|
| 527 |
typedef struct srfGridMesh_s { |
| 528 |
surfaceType_t surfaceType; |
| 529 |
|
| 530 |
|
| 531 |
int dlightBits; |
| 532 |
|
| 533 |
|
| 534 |
vec3_t meshBounds[2]; |
| 535 |
vec3_t localOrigin; |
| 536 |
float meshRadius; |
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
vec3_t lodOrigin; |
| 542 |
float lodRadius; |
| 543 |
int lodFixed; |
| 544 |
int lodStitched; |
| 545 |
|
| 546 |
|
| 547 |
int width, height; |
| 548 |
float *widthLodError; |
| 549 |
float *heightLodError; |
| 550 |
drawVert_t verts[1]; |
| 551 |
} srfGridMesh_t; |
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
#define VERTEXSIZE 8 |
| 556 |
typedef struct { |
| 557 |
surfaceType_t surfaceType; |
| 558 |
cplane_t plane; |
| 559 |
|
| 560 |
|
| 561 |
int dlightBits; |
| 562 |
|
| 563 |
|
| 564 |
int numPoints; |
| 565 |
int numIndices; |
| 566 |
int ofsIndices; |
| 567 |
float points[1][VERTEXSIZE]; |
| 568 |
|
| 569 |
} srfSurfaceFace_t; |
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
typedef struct { |
| 574 |
surfaceType_t surfaceType; |
| 575 |
|
| 576 |
|
| 577 |
int dlightBits; |
| 578 |
|
| 579 |
|
| 580 |
vec3_t bounds[2]; |
| 581 |
vec3_t localOrigin; |
| 582 |
float radius; |
| 583 |
|
| 584 |
|
| 585 |
int numIndexes; |
| 586 |
int *indexes; |
| 587 |
|
| 588 |
int numVerts; |
| 589 |
drawVert_t *verts; |
| 590 |
} srfTriangles_t; |
| 591 |
|
| 592 |
typedef struct { |
| 593 |
vec3_t translate; |
| 594 |
quat_t rotate; |
| 595 |
vec3_t scale; |
| 596 |
} iqmTransform_t; |
| 597 |
|
| 598 |
|
| 599 |
typedef struct { |
| 600 |
int num_vertexes; |
| 601 |
int num_triangles; |
| 602 |
int num_frames; |
| 603 |
int num_surfaces; |
| 604 |
int num_joints; |
| 605 |
int num_poses; |
| 606 |
struct srfIQModel_s *surfaces; |
| 607 |
|
| 608 |
int *triangles; |
| 609 |
|
| 610 |
|
| 611 |
float *positions; |
| 612 |
float *texcoords; |
| 613 |
float *normals; |
| 614 |
float *tangents; |
| 615 |
byte *colors; |
| 616 |
int *influences; |
| 617 |
|
| 618 |
|
| 619 |
byte *influenceBlendIndexes; |
| 620 |
union { |
| 621 |
float *f; |
| 622 |
byte *b; |
| 623 |
} influenceBlendWeights; |
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
int blendWeightsType; |
| 629 |
|
| 630 |
char *jointNames; |
| 631 |
int *jointParents; |
| 632 |
float *bindJoints; |
| 633 |
float *invBindJoints; |
| 634 |
iqmTransform_t *poses; |
| 635 |
float *bounds; |
| 636 |
} iqmData_t; |
| 637 |
|
| 638 |
|
| 639 |
typedef struct srfIQModel_s { |
| 640 |
surfaceType_t surfaceType; |
| 641 |
char name[MAX_QPATH]; |
| 642 |
shader_t *shader; |
| 643 |
iqmData_t *data; |
| 644 |
int first_vertex, num_vertexes; |
| 645 |
int first_triangle, num_triangles; |
| 646 |
int first_influence, num_influences; |
| 647 |
} srfIQModel_t; |
| 648 |
|
| 649 |
|
| 650 |
extern void (*rb_surfaceTable[SF_NUM_SURFACE_TYPES])(void *); |
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
#define SIDE_FRONT 0 |
| 666 |
#define SIDE_BACK 1 |
| 667 |
#define SIDE_ON 2 |
| 668 |
|
| 669 |
typedef struct msurface_s { |
| 670 |
int viewCount; |
| 671 |
struct shader_s *shader; |
| 672 |
int fogIndex; |
| 673 |
|
| 674 |
surfaceType_t *data; |
| 675 |
} msurface_t; |
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
#define CONTENTS_NODE -1 |
| 680 |
typedef struct mnode_s { |
| 681 |
|
| 682 |
int contents; |
| 683 |
int visframe; |
| 684 |
vec3_t mins, maxs; |
| 685 |
struct mnode_s *parent; |
| 686 |
|
| 687 |
|
| 688 |
cplane_t *plane; |
| 689 |
struct mnode_s *children[2]; |
| 690 |
|
| 691 |
|
| 692 |
int cluster; |
| 693 |
int area; |
| 694 |
|
| 695 |
msurface_t **firstmarksurface; |
| 696 |
int nummarksurfaces; |
| 697 |
} mnode_t; |
| 698 |
|
| 699 |
typedef struct { |
| 700 |
vec3_t bounds[2]; |
| 701 |
msurface_t *firstSurface; |
| 702 |
int numSurfaces; |
| 703 |
} bmodel_t; |
| 704 |
|
| 705 |
typedef struct { |
| 706 |
char name[MAX_QPATH]; |
| 707 |
char baseName[MAX_QPATH]; |
| 708 |
|
| 709 |
int dataSize; |
| 710 |
|
| 711 |
int numShaders; |
| 712 |
dshader_t *shaders; |
| 713 |
|
| 714 |
bmodel_t *bmodels; |
| 715 |
|
| 716 |
int numplanes; |
| 717 |
cplane_t *planes; |
| 718 |
|
| 719 |
int numnodes; |
| 720 |
int numDecisionNodes; |
| 721 |
mnode_t *nodes; |
| 722 |
|
| 723 |
int numsurfaces; |
| 724 |
msurface_t *surfaces; |
| 725 |
|
| 726 |
int nummarksurfaces; |
| 727 |
msurface_t **marksurfaces; |
| 728 |
|
| 729 |
int numfogs; |
| 730 |
fog_t *fogs; |
| 731 |
|
| 732 |
vec3_t lightGridOrigin; |
| 733 |
vec3_t lightGridSize; |
| 734 |
vec3_t lightGridInverseSize; |
| 735 |
int lightGridBounds[3]; |
| 736 |
byte *lightGridData; |
| 737 |
|
| 738 |
|
| 739 |
int numClusters; |
| 740 |
int clusterBytes; |
| 741 |
const byte *vis; |
| 742 |
|
| 743 |
byte *novis; |
| 744 |
|
| 745 |
char *entityString; |
| 746 |
char *entityParsePoint; |
| 747 |
} world_t; |
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
typedef enum { |
| 752 |
MOD_BAD, |
| 753 |
MOD_BRUSH, |
| 754 |
MOD_MESH, |
| 755 |
MOD_MDR, |
| 756 |
MOD_IQM |
| 757 |
} modtype_t; |
| 758 |
|
| 759 |
typedef struct model_s { |
| 760 |
char name[MAX_QPATH]; |
| 761 |
modtype_t type; |
| 762 |
int index; |
| 763 |
|
| 764 |
int dataSize; |
| 765 |
bmodel_t *bmodel; |
| 766 |
md3Header_t *md3[MD3_MAX_LODS]; |
| 767 |
void *modelData; |
| 768 |
|
| 769 |
int numLods; |
| 770 |
} model_t; |
| 771 |
|
| 772 |
|
| 773 |
#define MAX_MOD_KNOWN 1024 |
| 774 |
|
| 775 |
void R_ModelInit (void); |
| 776 |
model_t *R_GetModelByHandle( qhandle_t hModel ); |
| 777 |
int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame, |
| 778 |
float frac, const char *tagName ); |
| 779 |
void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs ); |
| 780 |
|
| 781 |
void R_Modellist_f (void); |
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
#define MAX_DRAWIMAGES 2048 |
| 786 |
#define MAX_SKINS 1024 |
| 787 |
|
| 788 |
|
| 789 |
#define MAX_DRAWSURFS 0x10000 |
| 790 |
#define DRAWSURF_MASK (MAX_DRAWSURFS-1) |
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
#define QSORT_FOGNUM_SHIFT 2 |
| 812 |
#define QSORT_REFENTITYNUM_SHIFT 7 |
| 813 |
#define QSORT_SHADERNUM_SHIFT (QSORT_REFENTITYNUM_SHIFT+REFENTITYNUM_BITS) |
| 814 |
#if (QSORT_SHADERNUM_SHIFT+SHADERNUM_BITS) > 32 |
| 815 |
#error "Need to update sorting, too many bits." |
| 816 |
#endif |
| 817 |
|
| 818 |
extern int gl_filter_min, gl_filter_max; |
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
typedef struct { |
| 824 |
int c_sphere_cull_patch_in, c_sphere_cull_patch_clip, c_sphere_cull_patch_out; |
| 825 |
int c_box_cull_patch_in, c_box_cull_patch_clip, c_box_cull_patch_out; |
| 826 |
int c_sphere_cull_md3_in, c_sphere_cull_md3_clip, c_sphere_cull_md3_out; |
| 827 |
int c_box_cull_md3_in, c_box_cull_md3_clip, c_box_cull_md3_out; |
| 828 |
|
| 829 |
int c_leafs; |
| 830 |
int c_dlightSurfaces; |
| 831 |
int c_dlightSurfacesCulled; |
| 832 |
} frontEndCounters_t; |
| 833 |
|
| 834 |
#define FOG_TABLE_SIZE 256 |
| 835 |
#define FUNCTABLE_SIZE 1024 |
| 836 |
#define FUNCTABLE_SIZE2 10 |
| 837 |
#define FUNCTABLE_MASK (FUNCTABLE_SIZE-1) |
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
typedef struct { |
| 842 |
int currenttextures[2]; |
| 843 |
int currenttmu; |
| 844 |
qboolean finishCalled; |
| 845 |
int texEnv[2]; |
| 846 |
int faceCulling; |
| 847 |
unsigned long glStateBits; |
| 848 |
} glstate_t; |
| 849 |
|
| 850 |
typedef struct { |
| 851 |
int c_surfaces, c_shaders, c_vertexes, c_indexes, c_totalIndexes; |
| 852 |
float c_overDraw; |
| 853 |
|
| 854 |
int c_dlightVertexes; |
| 855 |
int c_dlightIndexes; |
| 856 |
|
| 857 |
int c_flareAdds; |
| 858 |
int c_flareTests; |
| 859 |
int c_flareRenders; |
| 860 |
|
| 861 |
int msec; |
| 862 |
} backEndCounters_t; |
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
typedef struct { |
| 867 |
trRefdef_t refdef; |
| 868 |
viewParms_t viewParms; |
| 869 |
orientationr_t or; |
| 870 |
backEndCounters_t pc; |
| 871 |
qboolean isHyperspace; |
| 872 |
trRefEntity_t *currentEntity; |
| 873 |
qboolean skyRenderedThisView; |
| 874 |
|
| 875 |
qboolean projection2D; |
| 876 |
byte color2D[4]; |
| 877 |
qboolean vertexes2D; |
| 878 |
trRefEntity_t entity2D; |
| 879 |
} backEndState_t; |
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
typedef struct { |
| 890 |
qboolean registered; |
| 891 |
|
| 892 |
int visCount; |
| 893 |
int frameCount; |
| 894 |
int sceneCount; |
| 895 |
int viewCount; |
| 896 |
|
| 897 |
|
| 898 |
int frameSceneNum; |
| 899 |
|
| 900 |
qboolean worldMapLoaded; |
| 901 |
world_t *world; |
| 902 |
|
| 903 |
const byte *externalVisData; |
| 904 |
|
| 905 |
image_t *defaultImage; |
| 906 |
image_t *scratchImage[32]; |
| 907 |
image_t *fogImage; |
| 908 |
image_t *dlightImage; |
| 909 |
image_t *flareImage; |
| 910 |
image_t *whiteImage; |
| 911 |
image_t *identityLightImage; |
| 912 |
|
| 913 |
shader_t *defaultShader; |
| 914 |
shader_t *shadowShader; |
| 915 |
shader_t *projectionShadowShader; |
| 916 |
|
| 917 |
shader_t *flareShader; |
| 918 |
shader_t *sunShader; |
| 919 |
|
| 920 |
int numLightmaps; |
| 921 |
image_t **lightmaps; |
| 922 |
|
| 923 |
trRefEntity_t *currentEntity; |
| 924 |
trRefEntity_t worldEntity; |
| 925 |
int currentEntityNum; |
| 926 |
int shiftedEntityNum; |
| 927 |
model_t *currentModel; |
| 928 |
|
| 929 |
viewParms_t viewParms; |
| 930 |
|
| 931 |
float identityLight; |
| 932 |
int identityLightByte; |
| 933 |
int overbrightBits; |
| 934 |
|
| 935 |
orientationr_t or; |
| 936 |
|
| 937 |
trRefdef_t refdef; |
| 938 |
|
| 939 |
int viewCluster; |
| 940 |
|
| 941 |
vec3_t sunLight; |
| 942 |
vec3_t sunDirection; |
| 943 |
|
| 944 |
frontEndCounters_t pc; |
| 945 |
int frontEndMsec; |
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
model_t *models[MAX_MOD_KNOWN]; |
| 952 |
int numModels; |
| 953 |
|
| 954 |
int numImages; |
| 955 |
image_t *images[MAX_DRAWIMAGES]; |
| 956 |
|
| 957 |
|
| 958 |
|
| 959 |
|
| 960 |
int numShaders; |
| 961 |
shader_t *shaders[MAX_SHADERS]; |
| 962 |
shader_t *sortedShaders[MAX_SHADERS]; |
| 963 |
|
| 964 |
int numSkins; |
| 965 |
skin_t *skins[MAX_SKINS]; |
| 966 |
|
| 967 |
float sinTable[FUNCTABLE_SIZE]; |
| 968 |
float squareTable[FUNCTABLE_SIZE]; |
| 969 |
float triangleTable[FUNCTABLE_SIZE]; |
| 970 |
float sawToothTable[FUNCTABLE_SIZE]; |
| 971 |
float inverseSawToothTable[FUNCTABLE_SIZE]; |
| 972 |
float fogTable[FOG_TABLE_SIZE]; |
| 973 |
} trGlobals_t; |
| 974 |
|
| 975 |
extern backEndState_t backEnd; |
| 976 |
extern trGlobals_t tr; |
| 977 |
extern glstate_t glState; |
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
|
| 982 |
extern cvar_t *r_flareSize; |
| 983 |
extern cvar_t *r_flareFade; |
| 984 |
|
| 985 |
#define FLARE_STDCOEFF "150" |
| 986 |
extern cvar_t *r_flareCoeff; |
| 987 |
|
| 988 |
extern cvar_t *r_railWidth; |
| 989 |
extern cvar_t *r_railCoreWidth; |
| 990 |
extern cvar_t *r_railSegmentLength; |
| 991 |
|
| 992 |
extern cvar_t *r_ignore; |
| 993 |
extern cvar_t *r_verbose; |
| 994 |
extern cvar_t *r_ignoreFastPath; |
| 995 |
|
| 996 |
extern cvar_t *r_znear; |
| 997 |
extern cvar_t *r_zproj; |
| 998 |
extern cvar_t *r_stereoSeparation; |
| 999 |
|
| 1000 |
extern cvar_t *r_measureOverdraw; |
| 1001 |
|
| 1002 |
extern cvar_t *r_lodbias; |
| 1003 |
extern cvar_t *r_lodscale; |
| 1004 |
|
| 1005 |
extern cvar_t *r_primitives; |
| 1006 |
|
| 1007 |
|
| 1008 |
|
| 1009 |
|
| 1010 |
extern cvar_t *r_inGameVideo; |
| 1011 |
extern cvar_t *r_fastsky; |
| 1012 |
extern cvar_t *r_drawSun; |
| 1013 |
extern cvar_t *r_dynamiclight; |
| 1014 |
extern cvar_t *r_dlightBacks; |
| 1015 |
|
| 1016 |
extern cvar_t *r_norefresh; |
| 1017 |
extern cvar_t *r_drawentities; |
| 1018 |
extern cvar_t *r_drawworld; |
| 1019 |
extern cvar_t *r_speeds; |
| 1020 |
extern cvar_t *r_detailTextures; |
| 1021 |
extern cvar_t *r_novis; |
| 1022 |
extern cvar_t *r_nocull; |
| 1023 |
extern cvar_t *r_facePlaneCull; |
| 1024 |
extern cvar_t *r_nocurves; |
| 1025 |
extern cvar_t *r_showcluster; |
| 1026 |
|
| 1027 |
extern cvar_t *r_gamma; |
| 1028 |
extern cvar_t *r_displayRefresh; |
| 1029 |
|
| 1030 |
extern cvar_t *r_nobind; |
| 1031 |
extern cvar_t *r_singleShader; |
| 1032 |
extern cvar_t *r_roundImagesDown; |
| 1033 |
extern cvar_t *r_colorMipLevels; |
| 1034 |
extern cvar_t *r_picmip; |
| 1035 |
extern cvar_t *r_finish; |
| 1036 |
extern cvar_t *r_textureMode; |
| 1037 |
extern cvar_t *r_offsetFactor; |
| 1038 |
extern cvar_t *r_offsetUnits; |
| 1039 |
|
| 1040 |
extern cvar_t *r_fullbright; |
| 1041 |
extern cvar_t *r_lightmap; |
| 1042 |
extern cvar_t *r_vertexLight; |
| 1043 |
extern cvar_t *r_uiFullScreen; |
| 1044 |
|
| 1045 |
extern cvar_t *r_logFile; |
| 1046 |
extern cvar_t *r_showtris; |
| 1047 |
extern cvar_t *r_showsky; |
| 1048 |
extern cvar_t *r_shownormals; |
| 1049 |
extern cvar_t *r_clear; |
| 1050 |
|
| 1051 |
extern cvar_t *r_shadows; |
| 1052 |
extern cvar_t *r_flares; |
| 1053 |
|
| 1054 |
extern cvar_t *r_intensity; |
| 1055 |
|
| 1056 |
extern cvar_t *r_lockpvs; |
| 1057 |
extern cvar_t *r_noportals; |
| 1058 |
extern cvar_t *r_portalOnly; |
| 1059 |
|
| 1060 |
extern cvar_t *r_subdivisions; |
| 1061 |
extern cvar_t *r_lodCurveError; |
| 1062 |
extern cvar_t *r_skipBackEnd; |
| 1063 |
|
| 1064 |
extern cvar_t *r_anaglyphMode; |
| 1065 |
|
| 1066 |
extern cvar_t *r_greyscale; |
| 1067 |
|
| 1068 |
extern cvar_t *r_ignoreGLErrors; |
| 1069 |
|
| 1070 |
extern cvar_t *r_overBrightBits; |
| 1071 |
extern cvar_t *r_mapOverBrightBits; |
| 1072 |
|
| 1073 |
extern cvar_t *r_debugSurface; |
| 1074 |
extern cvar_t *r_simpleMipMaps; |
| 1075 |
|
| 1076 |
extern cvar_t *r_showImages; |
| 1077 |
extern cvar_t *r_debugSort; |
| 1078 |
|
| 1079 |
extern cvar_t *r_printShaders; |
| 1080 |
|
| 1081 |
extern cvar_t *r_marksOnTriangleMeshes; |
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
void R_SwapBuffers( int ); |
| 1086 |
|
| 1087 |
void R_RenderView( viewParms_t *parms ); |
| 1088 |
|
| 1089 |
void R_AddMD3Surfaces( trRefEntity_t *e ); |
| 1090 |
void R_AddNullModelSurfaces( trRefEntity_t *e ); |
| 1091 |
void R_AddBeamSurfaces( trRefEntity_t *e ); |
| 1092 |
void R_AddRailSurfaces( trRefEntity_t *e, qboolean isUnderwater ); |
| 1093 |
void R_AddLightningBoltSurfaces( trRefEntity_t *e ); |
| 1094 |
|
| 1095 |
void R_AddPolygonSurfaces( void ); |
| 1096 |
|
| 1097 |
void R_DecomposeSort( unsigned sort, int *entityNum, shader_t **shader, |
| 1098 |
int *fogNum, int *dlightMap ); |
| 1099 |
|
| 1100 |
void R_AddDrawSurf( surfaceType_t *surface, shader_t *shader, int fogIndex, int dlightMap ); |
| 1101 |
|
| 1102 |
|
| 1103 |
#define CULL_IN 0 // completely unclipped |
| 1104 |
#define CULL_CLIP 1 // clipped by one or more planes |
| 1105 |
#define CULL_OUT 2 // completely outside the clipping planes |
| 1106 |
void R_LocalNormalToWorld (vec3_t local, vec3_t world); |
| 1107 |
void R_LocalPointToWorld (vec3_t local, vec3_t world); |
| 1108 |
int R_CullLocalBox (vec3_t bounds[2]); |
| 1109 |
int R_CullPointAndRadius( vec3_t origin, float radius ); |
| 1110 |
int R_CullLocalPointAndRadius( vec3_t origin, float radius ); |
| 1111 |
|
| 1112 |
void R_SetupProjection(viewParms_t *dest, float zProj, qboolean computeFrustum); |
| 1113 |
void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms, orientationr_t *or ); |
| 1114 |
|
| 1115 |
|
| 1116 |
|
| 1117 |
|
| 1118 |
void GL_Bind( image_t *image ); |
| 1119 |
void GL_SetDefaultState (void); |
| 1120 |
void GL_SelectTexture( int unit ); |
| 1121 |
void GL_TextureMode( const char *string ); |
| 1122 |
void GL_CheckErrors( void ); |
| 1123 |
void GL_State( unsigned long stateVector ); |
| 1124 |
void GL_TexEnv( int env ); |
| 1125 |
void GL_Cull( int cullType ); |
| 1126 |
|
| 1127 |
#define GLS_SRCBLEND_ZERO 0x00000001 |
| 1128 |
#define GLS_SRCBLEND_ONE 0x00000002 |
| 1129 |
#define GLS_SRCBLEND_DST_COLOR 0x00000003 |
| 1130 |
#define GLS_SRCBLEND_ONE_MINUS_DST_COLOR 0x00000004 |
| 1131 |
#define GLS_SRCBLEND_SRC_ALPHA 0x00000005 |
| 1132 |
#define GLS_SRCBLEND_ONE_MINUS_SRC_ALPHA 0x00000006 |
| 1133 |
#define GLS_SRCBLEND_DST_ALPHA 0x00000007 |
| 1134 |
#define GLS_SRCBLEND_ONE_MINUS_DST_ALPHA 0x00000008 |
| 1135 |
#define GLS_SRCBLEND_ALPHA_SATURATE 0x00000009 |
| 1136 |
#define GLS_SRCBLEND_BITS 0x0000000f |
| 1137 |
|
| 1138 |
#define GLS_DSTBLEND_ZERO 0x00000010 |
| 1139 |
#define GLS_DSTBLEND_ONE 0x00000020 |
| 1140 |
#define GLS_DSTBLEND_SRC_COLOR 0x00000030 |
| 1141 |
#define GLS_DSTBLEND_ONE_MINUS_SRC_COLOR 0x00000040 |
| 1142 |
#define GLS_DSTBLEND_SRC_ALPHA 0x00000050 |
| 1143 |
#define GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA 0x00000060 |
| 1144 |
#define GLS_DSTBLEND_DST_ALPHA 0x00000070 |
| 1145 |
#define GLS_DSTBLEND_ONE_MINUS_DST_ALPHA 0x00000080 |
| 1146 |
#define GLS_DSTBLEND_BITS 0x000000f0 |
| 1147 |
|
| 1148 |
#define GLS_DEPTHMASK_TRUE 0x00000100 |
| 1149 |
|
| 1150 |
#define GLS_POLYMODE_LINE 0x00001000 |
| 1151 |
|
| 1152 |
#define GLS_DEPTHTEST_DISABLE 0x00010000 |
| 1153 |
#define GLS_DEPTHFUNC_EQUAL 0x00020000 |
| 1154 |
|
| 1155 |
#define GLS_ATEST_GT_0 0x10000000 |
| 1156 |
#define GLS_ATEST_LT_80 0x20000000 |
| 1157 |
#define GLS_ATEST_GE_80 0x40000000 |
| 1158 |
#define GLS_ATEST_BITS 0x70000000 |
| 1159 |
|
| 1160 |
#define GLS_DEFAULT GLS_DEPTHMASK_TRUE |
| 1161 |
|
| 1162 |
void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty); |
| 1163 |
void RE_UploadCinematic (int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty); |
| 1164 |
|
| 1165 |
void RE_BeginFrame( stereoFrame_t stereoFrame ); |
| 1166 |
void RE_BeginRegistration( glconfig_t *glconfig ); |
| 1167 |
void RE_LoadWorldMap( const char *mapname ); |
| 1168 |
void RE_SetWorldVisData( const byte *vis ); |
| 1169 |
qhandle_t RE_RegisterModel( const char *name ); |
| 1170 |
qhandle_t RE_RegisterSkin( const char *name ); |
| 1171 |
void RE_Shutdown( qboolean destroyWindow ); |
| 1172 |
|
| 1173 |
qboolean R_GetEntityToken( char *buffer, int size ); |
| 1174 |
|
| 1175 |
model_t *R_AllocModel( void ); |
| 1176 |
|
| 1177 |
void R_Init( void ); |
| 1178 |
|
| 1179 |
void R_SetColorMappings( void ); |
| 1180 |
void R_GammaCorrect( byte *buffer, int bufSize ); |
| 1181 |
|
| 1182 |
void R_ImageList_f( void ); |
| 1183 |
void R_SkinList_f( void ); |
| 1184 |
|
| 1185 |
const void *RB_TakeScreenshotCmd( const void *data ); |
| 1186 |
void R_ScreenShot_f( void ); |
| 1187 |
|
| 1188 |
void R_InitFogTable( void ); |
| 1189 |
float R_FogFactor( float s, float t ); |
| 1190 |
void R_InitImages( void ); |
| 1191 |
void R_DeleteTextures( void ); |
| 1192 |
int R_SumOfUsedImages( void ); |
| 1193 |
void R_InitSkins( void ); |
| 1194 |
skin_t *R_GetSkinByHandle( qhandle_t hSkin ); |
| 1195 |
|
| 1196 |
int R_ComputeLOD( trRefEntity_t *ent ); |
| 1197 |
|
| 1198 |
const void *RB_TakeVideoFrameCmd( const void *data ); |
| 1199 |
|
| 1200 |
|
| 1201 |
|
| 1202 |
|
| 1203 |
shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImage ); |
| 1204 |
shader_t *R_GetShaderByHandle( qhandle_t hShader ); |
| 1205 |
shader_t *R_GetShaderByState( int index, long *cycleTime ); |
| 1206 |
shader_t *R_FindShaderByName( const char *name ); |
| 1207 |
void R_InitShaders( void ); |
| 1208 |
void R_ShaderList_f( void ); |
| 1209 |
void R_RemapShader(const char *oldShader, const char *newShader, const char *timeOffset); |
| 1210 |
|
| 1211 |
|
| 1212 |
|
| 1213 |
|
| 1214 |
|
| 1215 |
|
| 1216 |
|
| 1217 |
|
| 1218 |
typedef byte color4ub_t[4]; |
| 1219 |
|
| 1220 |
typedef struct stageVars |
| 1221 |
{ |
| 1222 |
color4ub_t colors[SHADER_MAX_VERTEXES]; |
| 1223 |
vec2_t texcoords[NUM_TEXTURE_BUNDLES][SHADER_MAX_VERTEXES]; |
| 1224 |
} stageVars_t; |
| 1225 |
|
| 1226 |
|
| 1227 |
typedef struct shaderCommands_s |
| 1228 |
{ |
| 1229 |
glIndex_t indexes[SHADER_MAX_INDEXES] Q_ALIGN(16); |
| 1230 |
vec4_t xyz[SHADER_MAX_VERTEXES] Q_ALIGN(16); |
| 1231 |
vec4_t normal[SHADER_MAX_VERTEXES] Q_ALIGN(16); |
| 1232 |
vec2_t texCoords[SHADER_MAX_VERTEXES][2] Q_ALIGN(16); |
| 1233 |
color4ub_t vertexColors[SHADER_MAX_VERTEXES] Q_ALIGN(16); |
| 1234 |
int vertexDlightBits[SHADER_MAX_VERTEXES] Q_ALIGN(16); |
| 1235 |
|
| 1236 |
stageVars_t svars Q_ALIGN(16); |
| 1237 |
|
| 1238 |
color4ub_t constantColor255[SHADER_MAX_VERTEXES] Q_ALIGN(16); |
| 1239 |
|
| 1240 |
shader_t *shader; |
| 1241 |
double shaderTime; |
| 1242 |
int fogNum; |
| 1243 |
|
| 1244 |
int dlightBits; |
| 1245 |
|
| 1246 |
int numIndexes; |
| 1247 |
int numVertexes; |
| 1248 |
|
| 1249 |
|
| 1250 |
int numPasses; |
| 1251 |
void (*currentStageIteratorFunc)( void ); |
| 1252 |
shaderStage_t **xstages; |
| 1253 |
} shaderCommands_t; |
| 1254 |
|
| 1255 |
extern shaderCommands_t tess; |
| 1256 |
|
| 1257 |
void RB_BeginSurface(shader_t *shader, int fogNum ); |
| 1258 |
void RB_EndSurface(void); |
| 1259 |
void RB_CheckOverflow( int verts, int indexes ); |
| 1260 |
#define RB_CHECKOVERFLOW(v,i) if (tess.numVertexes + (v) >= SHADER_MAX_VERTEXES || tess.numIndexes + (i) >= SHADER_MAX_INDEXES ) {RB_CheckOverflow(v,i);} |
| 1261 |
|
| 1262 |
void RB_StageIteratorGeneric( void ); |
| 1263 |
void RB_StageIteratorSky( void ); |
| 1264 |
void RB_StageIteratorVertexLitTexture( void ); |
| 1265 |
void RB_StageIteratorLightmappedMultitexture( void ); |
| 1266 |
|
| 1267 |
void RB_AddQuadStamp( vec3_t origin, vec3_t left, vec3_t up, byte *color ); |
| 1268 |
void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, byte *color, float s1, float t1, float s2, float t2 ); |
| 1269 |
|
| 1270 |
void RB_ShowImages( void ); |
| 1271 |
|
| 1272 |
|
| 1273 |
|
| 1274 |
|
| 1275 |
|
| 1276 |
|
| 1277 |
|
| 1278 |
|
| 1279 |
|
| 1280 |
|
| 1281 |
void R_AddBrushModelSurfaces( trRefEntity_t *e ); |
| 1282 |
void R_AddWorldSurfaces( void ); |
| 1283 |
qboolean R_inPVS( const vec3_t p1, const vec3_t p2 ); |
| 1284 |
|
| 1285 |
|
| 1286 |
|
| 1287 |
|
| 1288 |
|
| 1289 |
|
| 1290 |
|
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
void R_ClearFlares( void ); |
| 1295 |
|
| 1296 |
void RB_AddFlare( void *surface, int fogNum, vec3_t point, vec3_t color, vec3_t normal ); |
| 1297 |
void RB_AddDlightFlares( void ); |
| 1298 |
void RB_RenderFlares (void); |
| 1299 |
|
| 1300 |
|
| 1301 |
|
| 1302 |
|
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
|
| 1307 |
|
| 1308 |
void R_DlightBmodel( bmodel_t *bmodel ); |
| 1309 |
void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ); |
| 1310 |
void R_TransformDlights( int count, dlight_t *dl, orientationr_t *or ); |
| 1311 |
int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir ); |
| 1312 |
|
| 1313 |
|
| 1314 |
|
| 1315 |
|
| 1316 |
|
| 1317 |
|
| 1318 |
|
| 1319 |
|
| 1320 |
|
| 1321 |
|
| 1322 |
void RB_ShadowTessEnd( void ); |
| 1323 |
void RB_ShadowFinish( void ); |
| 1324 |
void RB_ProjectionShadowDeform( void ); |
| 1325 |
|
| 1326 |
|
| 1327 |
|
| 1328 |
|
| 1329 |
|
| 1330 |
|
| 1331 |
|
| 1332 |
|
| 1333 |
|
| 1334 |
void R_BuildCloudData( shaderCommands_t *shader ); |
| 1335 |
void R_InitSkyTexCoords( float cloudLayerHeight ); |
| 1336 |
void R_DrawSkyBox( shaderCommands_t *shader ); |
| 1337 |
void RB_DrawSun( float scale, shader_t *shader ); |
| 1338 |
void RB_ClipSkyPolygons( shaderCommands_t *shader ); |
| 1339 |
|
| 1340 |
|
| 1341 |
|
| 1342 |
|
| 1343 |
|
| 1344 |
|
| 1345 |
|
| 1346 |
|
| 1347 |
|
| 1348 |
#define PATCH_STITCHING |
| 1349 |
|
| 1350 |
srfGridMesh_t *R_SubdividePatchToGrid( int width, int height, |
| 1351 |
drawVert_t points[MAX_PATCH_SIZE*MAX_PATCH_SIZE] ); |
| 1352 |
srfGridMesh_t *R_GridInsertColumn( srfGridMesh_t *grid, int column, int row, vec3_t point, float loderror ); |
| 1353 |
srfGridMesh_t *R_GridInsertRow( srfGridMesh_t *grid, int row, int column, vec3_t point, float loderror ); |
| 1354 |
void R_FreeSurfaceGridMesh( srfGridMesh_t *grid ); |
| 1355 |
|
| 1356 |
|
| 1357 |
|
| 1358 |
|
| 1359 |
|
| 1360 |
|
| 1361 |
|
| 1362 |
|
| 1363 |
|
| 1364 |
int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projection, |
| 1365 |
int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t *fragmentBuffer ); |
| 1366 |
|
| 1367 |
|
| 1368 |
|
| 1369 |
|
| 1370 |
|
| 1371 |
|
| 1372 |
|
| 1373 |
|
| 1374 |
|
| 1375 |
|
| 1376 |
void R_InitNextFrame( void ); |
| 1377 |
|
| 1378 |
void RE_ClearScene( void ); |
| 1379 |
void RE_AddRefEntityToScene( const refEntity_t *ent ); |
| 1380 |
void RE_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts, int num ); |
| 1381 |
void RE_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b ); |
| 1382 |
void RE_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b ); |
| 1383 |
void RE_RenderScene( const refdef_t *fd ); |
| 1384 |
|
| 1385 |
|
| 1386 |
|
| 1387 |
|
| 1388 |
|
| 1389 |
|
| 1390 |
|
| 1391 |
|
| 1392 |
|
| 1393 |
#define MC_BITS_X (16) |
| 1394 |
#define MC_BITS_Y (16) |
| 1395 |
#define MC_BITS_Z (16) |
| 1396 |
#define MC_BITS_VECT (16) |
| 1397 |
|
| 1398 |
#define MC_SCALE_X (1.0f/64) |
| 1399 |
#define MC_SCALE_Y (1.0f/64) |
| 1400 |
#define MC_SCALE_Z (1.0f/64) |
| 1401 |
|
| 1402 |
void MC_UnCompress(float mat[3][4],const unsigned char * comp); |
| 1403 |
|
| 1404 |
|
| 1405 |
|
| 1406 |
|
| 1407 |
|
| 1408 |
|
| 1409 |
|
| 1410 |
|
| 1411 |
|
| 1412 |
void R_MDRAddAnimSurfaces( trRefEntity_t *ent ); |
| 1413 |
void RB_MDRSurfaceAnim( mdrSurface_t *surface ); |
| 1414 |
qboolean R_LoadIQM (model_t *mod, void *buffer, int filesize, const char *name ); |
| 1415 |
void R_AddIQMSurfaces( trRefEntity_t *ent ); |
| 1416 |
void RB_IQMSurfaceAnim( surfaceType_t *surface ); |
| 1417 |
int R_IQMLerpTag( orientation_t *tag, iqmData_t *data, |
| 1418 |
int startFrame, int endFrame, |
| 1419 |
float frac, const char *tagName ); |
| 1420 |
|
| 1421 |
|
| 1422 |
|
| 1423 |
|
| 1424 |
|
| 1425 |
void R_TransformModelToClip( const vec3_t src, const float *modelMatrix, const float *projectionMatrix, |
| 1426 |
vec4_t eye, vec4_t dst ); |
| 1427 |
void R_TransformClipToWindow( const vec4_t clip, const viewParms_t *view, vec4_t normalized, vec4_t window ); |
| 1428 |
|
| 1429 |
void RB_DeformTessGeometry( void ); |
| 1430 |
|
| 1431 |
void RB_CalcEnvironmentTexCoords( float *dstTexCoords ); |
| 1432 |
void RB_CalcFogTexCoords( float *dstTexCoords ); |
| 1433 |
void RB_CalcScrollTexCoords( const float scroll[2], float *dstTexCoords ); |
| 1434 |
void RB_CalcRotateTexCoords( float rotSpeed, float *dstTexCoords ); |
| 1435 |
void RB_CalcScaleTexCoords( const float scale[2], float *dstTexCoords ); |
| 1436 |
void RB_CalcTurbulentTexCoords( const waveForm_t *wf, float *dstTexCoords ); |
| 1437 |
void RB_CalcTransformTexCoords( const texModInfo_t *tmi, float *dstTexCoords ); |
| 1438 |
void RB_CalcModulateColorsByFog( unsigned char *dstColors ); |
| 1439 |
void RB_CalcModulateAlphasByFog( unsigned char *dstColors ); |
| 1440 |
void RB_CalcModulateRGBAsByFog( unsigned char *dstColors ); |
| 1441 |
void RB_CalcWaveAlpha( const waveForm_t *wf, unsigned char *dstColors ); |
| 1442 |
void RB_CalcWaveColor( const waveForm_t *wf, unsigned char *dstColors ); |
| 1443 |
void RB_CalcAlphaFromEntity( unsigned char *dstColors ); |
| 1444 |
void RB_CalcAlphaFromOneMinusEntity( unsigned char *dstColors ); |
| 1445 |
void RB_CalcStretchTexCoords( const waveForm_t *wf, float *texCoords ); |
| 1446 |
void RB_CalcColorFromEntity( unsigned char *dstColors ); |
| 1447 |
void RB_CalcColorFromOneMinusEntity( unsigned char *dstColors ); |
| 1448 |
void RB_CalcSpecularAlpha( unsigned char *alphas ); |
| 1449 |
void RB_CalcDiffuseColor( unsigned char *colors ); |
| 1450 |
|
| 1451 |
|
| 1452 |
|
| 1453 |
|
| 1454 |
|
| 1455 |
|
| 1456 |
|
| 1457 |
|
| 1458 |
|
| 1459 |
void RB_ExecuteRenderCommands( const void *data ); |
| 1460 |
|
| 1461 |
|
| 1462 |
|
| 1463 |
|
| 1464 |
|
| 1465 |
|
| 1466 |
|
| 1467 |
|
| 1468 |
|
| 1469 |
#define MAX_RENDER_COMMANDS 0x40000 |
| 1470 |
|
| 1471 |
typedef struct { |
| 1472 |
byte cmds[MAX_RENDER_COMMANDS]; |
| 1473 |
int used; |
| 1474 |
} renderCommandList_t; |
| 1475 |
|
| 1476 |
typedef struct { |
| 1477 |
int commandId; |
| 1478 |
float color[4]; |
| 1479 |
} setColorCommand_t; |
| 1480 |
|
| 1481 |
typedef struct { |
| 1482 |
int commandId; |
| 1483 |
int buffer; |
| 1484 |
} drawBufferCommand_t; |
| 1485 |
|
| 1486 |
typedef struct { |
| 1487 |
int commandId; |
| 1488 |
image_t *image; |
| 1489 |
int width; |
| 1490 |
int height; |
| 1491 |
void *data; |
| 1492 |
} subImageCommand_t; |
| 1493 |
|
| 1494 |
typedef struct { |
| 1495 |
int commandId; |
| 1496 |
} swapBuffersCommand_t; |
| 1497 |
|
| 1498 |
typedef struct { |
| 1499 |
int commandId; |
| 1500 |
int buffer; |
| 1501 |
} endFrameCommand_t; |
| 1502 |
|
| 1503 |
typedef struct { |
| 1504 |
int commandId; |
| 1505 |
shader_t *shader; |
| 1506 |
float x, y; |
| 1507 |
float w, h; |
| 1508 |
float s1, t1; |
| 1509 |
float s2, t2; |
| 1510 |
} stretchPicCommand_t; |
| 1511 |
|
| 1512 |
typedef struct { |
| 1513 |
int commandId; |
| 1514 |
trRefdef_t refdef; |
| 1515 |
viewParms_t viewParms; |
| 1516 |
drawSurf_t *drawSurfs; |
| 1517 |
int numDrawSurfs; |
| 1518 |
} drawSurfsCommand_t; |
| 1519 |
|
| 1520 |
typedef struct { |
| 1521 |
int commandId; |
| 1522 |
int x; |
| 1523 |
int y; |
| 1524 |
int width; |
| 1525 |
int height; |
| 1526 |
char *fileName; |
| 1527 |
qboolean jpeg; |
| 1528 |
} screenshotCommand_t; |
| 1529 |
|
| 1530 |
typedef struct { |
| 1531 |
int commandId; |
| 1532 |
int width; |
| 1533 |
int height; |
| 1534 |
byte *captureBuffer; |
| 1535 |
byte *encodeBuffer; |
| 1536 |
qboolean motionJpeg; |
| 1537 |
} videoFrameCommand_t; |
| 1538 |
|
| 1539 |
typedef struct |
| 1540 |
{ |
| 1541 |
int commandId; |
| 1542 |
|
| 1543 |
GLboolean rgba[4]; |
| 1544 |
} colorMaskCommand_t; |
| 1545 |
|
| 1546 |
typedef struct |
| 1547 |
{ |
| 1548 |
int commandId; |
| 1549 |
} clearDepthCommand_t; |
| 1550 |
|
| 1551 |
typedef enum { |
| 1552 |
RC_END_OF_LIST, |
| 1553 |
RC_SET_COLOR, |
| 1554 |
RC_STRETCH_PIC, |
| 1555 |
RC_DRAW_SURFS, |
| 1556 |
RC_DRAW_BUFFER, |
| 1557 |
RC_SWAP_BUFFERS, |
| 1558 |
RC_SCREENSHOT, |
| 1559 |
RC_VIDEOFRAME, |
| 1560 |
RC_COLORMASK, |
| 1561 |
RC_CLEARDEPTH |
| 1562 |
} renderCommand_t; |
| 1563 |
|
| 1564 |
|
| 1565 |
|
| 1566 |
|
| 1567 |
|
| 1568 |
#define MAX_POLYS 600 |
| 1569 |
#define MAX_POLYVERTS 3000 |
| 1570 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
typedef struct { |
| 1574 |
drawSurf_t drawSurfs[MAX_DRAWSURFS]; |
| 1575 |
dlight_t dlights[MAX_DLIGHTS]; |
| 1576 |
trRefEntity_t entities[MAX_REFENTITIES]; |
| 1577 |
srfPoly_t *polys; |
| 1578 |
polyVert_t *polyVerts; |
| 1579 |
renderCommandList_t commands; |
| 1580 |
} backEndData_t; |
| 1581 |
|
| 1582 |
extern int max_polys; |
| 1583 |
extern int max_polyverts; |
| 1584 |
|
| 1585 |
extern backEndData_t *backEndData; |
| 1586 |
|
| 1587 |
|
| 1588 |
void *R_GetCommandBuffer( int bytes ); |
| 1589 |
void RB_ExecuteRenderCommands( const void *data ); |
| 1590 |
|
| 1591 |
void R_IssuePendingRenderCommands( void ); |
| 1592 |
|
| 1593 |
void R_AddDrawSurfCmd( drawSurf_t *drawSurfs, int numDrawSurfs ); |
| 1594 |
|
| 1595 |
void RE_SetColor( const float *rgba ); |
| 1596 |
void RE_StretchPic ( float x, float y, float w, float h, |
| 1597 |
float s1, float t1, float s2, float t2, qhandle_t hShader ); |
| 1598 |
void RE_BeginFrame( stereoFrame_t stereoFrame ); |
| 1599 |
void RE_EndFrame( int *frontEndMsec, int *backEndMsec ); |
| 1600 |
void RE_SaveJPG(char * filename, int quality, int image_width, int image_height, |
| 1601 |
unsigned char *image_buffer, int padding); |
| 1602 |
size_t RE_SaveJPGToBuffer(byte *buffer, size_t bufSize, int quality, |
| 1603 |
int image_width, int image_height, byte *image_buffer, int padding); |
| 1604 |
void RE_TakeVideoFrame( int width, int height, |
| 1605 |
byte *captureBuffer, byte *encodeBuffer, qboolean motionJpeg ); |
| 1606 |
|
| 1607 |
void R_DrawElements( int numIndexes, const glIndex_t *indexes ); |
| 1608 |
void VectorArrayNormalize( vec4_t *normals, unsigned int count ); |
| 1609 |
|
| 1610 |
#ifdef idppc_altivec |
| 1611 |
void LerpMeshVertexes_altivec( md3Surface_t *surf, float backlerp ); |
| 1612 |
void ProjectDlightTexture_altivec( void ); |
| 1613 |
void RB_CalcDiffuseColor_altivec( unsigned char *colors ); |
| 1614 |
#endif |
| 1615 |
|
| 1616 |
#endif |