| 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 "tr_extratypes.h" |
| 33 |
#include "tr_extramath.h" |
| 34 |
#include "tr_fbo.h" |
| 35 |
#include "tr_postprocess.h" |
| 36 |
#include "../renderercommon/iqm.h" |
| 37 |
#include "../renderercommon/qgl.h" |
| 38 |
|
| 39 |
#define GLE(ret, name, ...) extern name##proc * qgl##name; |
| 40 |
QGL_1_1_PROCS; |
| 41 |
QGL_DESKTOP_1_1_PROCS; |
| 42 |
QGL_1_3_PROCS; |
| 43 |
QGL_1_5_PROCS; |
| 44 |
QGL_2_0_PROCS; |
| 45 |
QGL_3_0_PROCS; |
| 46 |
QGL_ARB_occlusion_query_PROCS; |
| 47 |
QGL_ARB_framebuffer_object_PROCS; |
| 48 |
QGL_ARB_vertex_array_object_PROCS; |
| 49 |
QGL_EXT_direct_state_access_PROCS; |
| 50 |
#undef GLE |
| 51 |
|
| 52 |
#define GL_INDEX_TYPE GL_UNSIGNED_SHORT |
| 53 |
typedef unsigned short glIndex_t; |
| 54 |
|
| 55 |
typedef unsigned int vaoCacheGlIndex_t; |
| 56 |
|
| 57 |
#define BUFFER_OFFSET(i) ((char *)NULL + (i)) |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
#define SHADERNUM_BITS 14 |
| 63 |
#define MAX_SHADERS (1<<SHADERNUM_BITS) |
| 64 |
|
| 65 |
#define MAX_FBOS 64 |
| 66 |
#define MAX_VISCOUNTS 5 |
| 67 |
#define MAX_VAOS 4096 |
| 68 |
|
| 69 |
#define MAX_CALC_PSHADOWS 64 |
| 70 |
#define MAX_DRAWN_PSHADOWS 16 // do not increase past 32, because bit flags are used on surfaces |
| 71 |
#define PSHADOW_MAP_SIZE 512 |
| 72 |
|
| 73 |
typedef struct cubemap_s { |
| 74 |
char name[MAX_QPATH]; |
| 75 |
vec3_t origin; |
| 76 |
float parallaxRadius; |
| 77 |
image_t *image; |
| 78 |
} cubemap_t; |
| 79 |
|
| 80 |
typedef struct dlight_s { |
| 81 |
vec3_t origin; |
| 82 |
vec3_t color; |
| 83 |
float radius; |
| 84 |
|
| 85 |
vec3_t transformed; |
| 86 |
int additive; |
| 87 |
} dlight_t; |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
typedef struct { |
| 93 |
refEntity_t e; |
| 94 |
|
| 95 |
float axisLength; |
| 96 |
|
| 97 |
qboolean needDlights; |
| 98 |
qboolean lightingCalculated; |
| 99 |
qboolean mirrored; |
| 100 |
vec3_t lightDir; |
| 101 |
vec3_t modelLightDir; |
| 102 |
vec3_t ambientLight; |
| 103 |
int ambientLightInt; |
| 104 |
vec3_t directedLight; |
| 105 |
} trRefEntity_t; |
| 106 |
|
| 107 |
|
| 108 |
typedef struct { |
| 109 |
vec3_t origin; |
| 110 |
vec3_t axis[3]; |
| 111 |
vec3_t viewOrigin; |
| 112 |
float modelMatrix[16]; |
| 113 |
float transformMatrix[16]; |
| 114 |
} orientationr_t; |
| 115 |
|
| 116 |
|
| 117 |
#define VAO_MAX_ATTRIBS 16 |
| 118 |
|
| 119 |
typedef enum |
| 120 |
{ |
| 121 |
VAO_USAGE_STATIC, |
| 122 |
VAO_USAGE_DYNAMIC |
| 123 |
} vaoUsage_t; |
| 124 |
|
| 125 |
typedef struct vaoAttrib_s |
| 126 |
{ |
| 127 |
uint32_t enabled; |
| 128 |
uint32_t count; |
| 129 |
uint32_t type; |
| 130 |
uint32_t normalized; |
| 131 |
uint32_t stride; |
| 132 |
uint32_t offset; |
| 133 |
} |
| 134 |
vaoAttrib_t; |
| 135 |
|
| 136 |
typedef struct vao_s |
| 137 |
{ |
| 138 |
char name[MAX_QPATH]; |
| 139 |
|
| 140 |
uint32_t vao; |
| 141 |
|
| 142 |
uint32_t vertexesVBO; |
| 143 |
int vertexesSize; |
| 144 |
vaoAttrib_t attribs[VAO_MAX_ATTRIBS]; |
| 145 |
|
| 146 |
uint32_t frameSize; |
| 147 |
|
| 148 |
uint32_t indexesIBO; |
| 149 |
int indexesSize; |
| 150 |
} vao_t; |
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
typedef enum { |
| 155 |
SS_BAD, |
| 156 |
SS_PORTAL, |
| 157 |
SS_ENVIRONMENT, |
| 158 |
SS_OPAQUE, |
| 159 |
|
| 160 |
SS_DECAL, |
| 161 |
SS_SEE_THROUGH, |
| 162 |
|
| 163 |
SS_BANNER, |
| 164 |
|
| 165 |
SS_FOG, |
| 166 |
|
| 167 |
SS_UNDERWATER, |
| 168 |
|
| 169 |
SS_BLEND0, |
| 170 |
SS_BLEND1, |
| 171 |
SS_BLEND2, |
| 172 |
SS_BLEND3, |
| 173 |
|
| 174 |
SS_BLEND6, |
| 175 |
SS_STENCIL_SHADOW, |
| 176 |
SS_ALMOST_NEAREST, |
| 177 |
|
| 178 |
SS_NEAREST |
| 179 |
} shaderSort_t; |
| 180 |
|
| 181 |
|
| 182 |
#define MAX_SHADER_STAGES 8 |
| 183 |
|
| 184 |
typedef enum { |
| 185 |
GF_NONE, |
| 186 |
|
| 187 |
GF_SIN, |
| 188 |
GF_SQUARE, |
| 189 |
GF_TRIANGLE, |
| 190 |
GF_SAWTOOTH, |
| 191 |
GF_INVERSE_SAWTOOTH, |
| 192 |
|
| 193 |
GF_NOISE |
| 194 |
|
| 195 |
} genFunc_t; |
| 196 |
|
| 197 |
|
| 198 |
typedef enum { |
| 199 |
DEFORM_NONE, |
| 200 |
DEFORM_WAVE, |
| 201 |
DEFORM_NORMALS, |
| 202 |
DEFORM_BULGE, |
| 203 |
DEFORM_MOVE, |
| 204 |
DEFORM_PROJECTION_SHADOW, |
| 205 |
DEFORM_AUTOSPRITE, |
| 206 |
DEFORM_AUTOSPRITE2, |
| 207 |
DEFORM_TEXT0, |
| 208 |
DEFORM_TEXT1, |
| 209 |
DEFORM_TEXT2, |
| 210 |
DEFORM_TEXT3, |
| 211 |
DEFORM_TEXT4, |
| 212 |
DEFORM_TEXT5, |
| 213 |
DEFORM_TEXT6, |
| 214 |
DEFORM_TEXT7 |
| 215 |
} deform_t; |
| 216 |
|
| 217 |
|
| 218 |
typedef enum |
| 219 |
{ |
| 220 |
|
| 221 |
|
| 222 |
DGEN_NONE, |
| 223 |
DGEN_WAVE_SIN, |
| 224 |
DGEN_WAVE_SQUARE, |
| 225 |
DGEN_WAVE_TRIANGLE, |
| 226 |
DGEN_WAVE_SAWTOOTH, |
| 227 |
DGEN_WAVE_INVERSE_SAWTOOTH, |
| 228 |
DGEN_WAVE_NOISE, |
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
DGEN_BULGE, |
| 233 |
DGEN_MOVE |
| 234 |
} deformGen_t; |
| 235 |
|
| 236 |
typedef enum { |
| 237 |
AGEN_IDENTITY, |
| 238 |
AGEN_SKIP, |
| 239 |
AGEN_ENTITY, |
| 240 |
AGEN_ONE_MINUS_ENTITY, |
| 241 |
AGEN_VERTEX, |
| 242 |
AGEN_ONE_MINUS_VERTEX, |
| 243 |
AGEN_LIGHTING_SPECULAR, |
| 244 |
AGEN_WAVEFORM, |
| 245 |
AGEN_PORTAL, |
| 246 |
AGEN_CONST, |
| 247 |
} alphaGen_t; |
| 248 |
|
| 249 |
typedef enum { |
| 250 |
CGEN_BAD, |
| 251 |
CGEN_IDENTITY_LIGHTING, |
| 252 |
CGEN_IDENTITY, |
| 253 |
CGEN_ENTITY, |
| 254 |
CGEN_ONE_MINUS_ENTITY, |
| 255 |
CGEN_EXACT_VERTEX, |
| 256 |
CGEN_VERTEX, |
| 257 |
CGEN_EXACT_VERTEX_LIT, |
| 258 |
CGEN_VERTEX_LIT, |
| 259 |
CGEN_ONE_MINUS_VERTEX, |
| 260 |
CGEN_WAVEFORM, |
| 261 |
CGEN_LIGHTING_DIFFUSE, |
| 262 |
CGEN_FOG, |
| 263 |
CGEN_CONST |
| 264 |
} colorGen_t; |
| 265 |
|
| 266 |
typedef enum { |
| 267 |
TCGEN_BAD, |
| 268 |
TCGEN_IDENTITY, |
| 269 |
TCGEN_LIGHTMAP, |
| 270 |
TCGEN_TEXTURE, |
| 271 |
TCGEN_ENVIRONMENT_MAPPED, |
| 272 |
TCGEN_FOG, |
| 273 |
TCGEN_VECTOR |
| 274 |
} texCoordGen_t; |
| 275 |
|
| 276 |
typedef enum { |
| 277 |
ACFF_NONE, |
| 278 |
ACFF_MODULATE_RGB, |
| 279 |
ACFF_MODULATE_RGBA, |
| 280 |
ACFF_MODULATE_ALPHA |
| 281 |
} acff_t; |
| 282 |
|
| 283 |
typedef struct { |
| 284 |
genFunc_t func; |
| 285 |
|
| 286 |
float base; |
| 287 |
float amplitude; |
| 288 |
float phase; |
| 289 |
float frequency; |
| 290 |
} waveForm_t; |
| 291 |
|
| 292 |
#define TR_MAX_TEXMODS 4 |
| 293 |
|
| 294 |
typedef enum { |
| 295 |
TMOD_NONE, |
| 296 |
TMOD_TRANSFORM, |
| 297 |
TMOD_TURBULENT, |
| 298 |
TMOD_SCROLL, |
| 299 |
TMOD_SCALE, |
| 300 |
TMOD_STRETCH, |
| 301 |
TMOD_ROTATE, |
| 302 |
TMOD_ENTITY_TRANSLATE |
| 303 |
} texMod_t; |
| 304 |
|
| 305 |
#define MAX_SHADER_DEFORMS 3 |
| 306 |
typedef struct { |
| 307 |
deform_t deformation; |
| 308 |
|
| 309 |
vec3_t moveVector; |
| 310 |
waveForm_t deformationWave; |
| 311 |
float deformationSpread; |
| 312 |
|
| 313 |
float bulgeWidth; |
| 314 |
float bulgeHeight; |
| 315 |
float bulgeSpeed; |
| 316 |
} deformStage_t; |
| 317 |
|
| 318 |
|
| 319 |
typedef struct { |
| 320 |
texMod_t type; |
| 321 |
|
| 322 |
|
| 323 |
waveForm_t wave; |
| 324 |
|
| 325 |
|
| 326 |
float matrix[2][2]; |
| 327 |
float translate[2]; |
| 328 |
|
| 329 |
|
| 330 |
float scale[2]; |
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
float scroll[2]; |
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
float rotateSpeed; |
| 340 |
|
| 341 |
} texModInfo_t; |
| 342 |
|
| 343 |
|
| 344 |
#define MAX_IMAGE_ANIMATIONS 8 |
| 345 |
|
| 346 |
typedef struct { |
| 347 |
image_t *image[MAX_IMAGE_ANIMATIONS]; |
| 348 |
int numImageAnimations; |
| 349 |
float imageAnimationSpeed; |
| 350 |
|
| 351 |
texCoordGen_t tcGen; |
| 352 |
vec3_t tcGenVectors[2]; |
| 353 |
|
| 354 |
int numTexMods; |
| 355 |
texModInfo_t *texMods; |
| 356 |
|
| 357 |
int videoMapHandle; |
| 358 |
qboolean isLightmap; |
| 359 |
qboolean isVideoMap; |
| 360 |
} textureBundle_t; |
| 361 |
|
| 362 |
enum |
| 363 |
{ |
| 364 |
TB_COLORMAP = 0, |
| 365 |
TB_DIFFUSEMAP = 0, |
| 366 |
TB_LIGHTMAP = 1, |
| 367 |
TB_LEVELSMAP = 1, |
| 368 |
TB_SHADOWMAP3 = 1, |
| 369 |
TB_NORMALMAP = 2, |
| 370 |
TB_DELUXEMAP = 3, |
| 371 |
TB_SHADOWMAP2 = 3, |
| 372 |
TB_SPECULARMAP = 4, |
| 373 |
TB_SHADOWMAP = 5, |
| 374 |
TB_CUBEMAP = 6, |
| 375 |
TB_SHADOWMAP4 = 6, |
| 376 |
NUM_TEXTURE_BUNDLES = 7 |
| 377 |
}; |
| 378 |
|
| 379 |
typedef enum |
| 380 |
{ |
| 381 |
|
| 382 |
ST_COLORMAP = 0, |
| 383 |
ST_DIFFUSEMAP = 0, |
| 384 |
ST_NORMALMAP, |
| 385 |
ST_NORMALPARALLAXMAP, |
| 386 |
ST_SPECULARMAP, |
| 387 |
ST_GLSL |
| 388 |
} stageType_t; |
| 389 |
|
| 390 |
typedef struct { |
| 391 |
qboolean active; |
| 392 |
|
| 393 |
textureBundle_t bundle[NUM_TEXTURE_BUNDLES]; |
| 394 |
|
| 395 |
waveForm_t rgbWave; |
| 396 |
colorGen_t rgbGen; |
| 397 |
|
| 398 |
waveForm_t alphaWave; |
| 399 |
alphaGen_t alphaGen; |
| 400 |
|
| 401 |
byte constantColor[4]; |
| 402 |
|
| 403 |
unsigned stateBits; |
| 404 |
|
| 405 |
acff_t adjustColorsForFog; |
| 406 |
|
| 407 |
qboolean isDetail; |
| 408 |
|
| 409 |
stageType_t type; |
| 410 |
struct shaderProgram_s *glslShaderGroup; |
| 411 |
int glslShaderIndex; |
| 412 |
|
| 413 |
vec4_t normalScale; |
| 414 |
vec4_t specularScale; |
| 415 |
|
| 416 |
} shaderStage_t; |
| 417 |
|
| 418 |
struct shaderCommands_s; |
| 419 |
|
| 420 |
typedef enum { |
| 421 |
CT_FRONT_SIDED, |
| 422 |
CT_BACK_SIDED, |
| 423 |
CT_TWO_SIDED |
| 424 |
} cullType_t; |
| 425 |
|
| 426 |
typedef enum { |
| 427 |
FP_NONE, |
| 428 |
FP_EQUAL, |
| 429 |
FP_LE |
| 430 |
} fogPass_t; |
| 431 |
|
| 432 |
typedef struct { |
| 433 |
float cloudHeight; |
| 434 |
image_t *outerbox[6], *innerbox[6]; |
| 435 |
} skyParms_t; |
| 436 |
|
| 437 |
typedef struct { |
| 438 |
vec3_t color; |
| 439 |
float depthForOpaque; |
| 440 |
} fogParms_t; |
| 441 |
|
| 442 |
|
| 443 |
typedef struct shader_s { |
| 444 |
char name[MAX_QPATH]; |
| 445 |
int lightmapIndex; |
| 446 |
|
| 447 |
int index; |
| 448 |
int sortedIndex; |
| 449 |
|
| 450 |
float sort; |
| 451 |
|
| 452 |
qboolean defaultShader; |
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
qboolean explicitlyDefined; |
| 459 |
|
| 460 |
int surfaceFlags; |
| 461 |
int contentFlags; |
| 462 |
|
| 463 |
qboolean entityMergable; |
| 464 |
|
| 465 |
qboolean isSky; |
| 466 |
skyParms_t sky; |
| 467 |
fogParms_t fogParms; |
| 468 |
|
| 469 |
float portalRange; |
| 470 |
qboolean isPortal; |
| 471 |
|
| 472 |
cullType_t cullType; |
| 473 |
qboolean polygonOffset; |
| 474 |
qboolean noMipMaps; |
| 475 |
qboolean noPicMip; |
| 476 |
|
| 477 |
fogPass_t fogPass; |
| 478 |
|
| 479 |
int vertexAttribs; |
| 480 |
|
| 481 |
int numDeforms; |
| 482 |
deformStage_t deforms[MAX_SHADER_DEFORMS]; |
| 483 |
|
| 484 |
int numUnfoggedPasses; |
| 485 |
shaderStage_t *stages[MAX_SHADER_STAGES]; |
| 486 |
|
| 487 |
void (*optimalStageIteratorFunc)( void ); |
| 488 |
|
| 489 |
double clampTime; |
| 490 |
double timeOffset; |
| 491 |
|
| 492 |
struct shader_s *remappedShader; |
| 493 |
|
| 494 |
struct shader_s *next; |
| 495 |
} shader_t; |
| 496 |
|
| 497 |
enum |
| 498 |
{ |
| 499 |
ATTR_INDEX_POSITION = 0, |
| 500 |
ATTR_INDEX_TEXCOORD = 1, |
| 501 |
ATTR_INDEX_LIGHTCOORD = 2, |
| 502 |
ATTR_INDEX_TANGENT = 3, |
| 503 |
ATTR_INDEX_NORMAL = 4, |
| 504 |
ATTR_INDEX_COLOR = 5, |
| 505 |
ATTR_INDEX_PAINTCOLOR = 6, |
| 506 |
ATTR_INDEX_LIGHTDIRECTION = 7, |
| 507 |
ATTR_INDEX_BONE_INDEXES = 8, |
| 508 |
ATTR_INDEX_BONE_WEIGHTS = 9, |
| 509 |
|
| 510 |
|
| 511 |
ATTR_INDEX_POSITION2 = 10, |
| 512 |
ATTR_INDEX_TANGENT2 = 11, |
| 513 |
ATTR_INDEX_NORMAL2 = 12, |
| 514 |
|
| 515 |
ATTR_INDEX_COUNT = 13 |
| 516 |
}; |
| 517 |
|
| 518 |
enum |
| 519 |
{ |
| 520 |
ATTR_POSITION = 1 << ATTR_INDEX_POSITION, |
| 521 |
ATTR_TEXCOORD = 1 << ATTR_INDEX_TEXCOORD, |
| 522 |
ATTR_LIGHTCOORD = 1 << ATTR_INDEX_LIGHTCOORD, |
| 523 |
ATTR_TANGENT = 1 << ATTR_INDEX_TANGENT, |
| 524 |
ATTR_NORMAL = 1 << ATTR_INDEX_NORMAL, |
| 525 |
ATTR_COLOR = 1 << ATTR_INDEX_COLOR, |
| 526 |
ATTR_PAINTCOLOR = 1 << ATTR_INDEX_PAINTCOLOR, |
| 527 |
ATTR_LIGHTDIRECTION = 1 << ATTR_INDEX_LIGHTDIRECTION, |
| 528 |
ATTR_BONE_INDEXES = 1 << ATTR_INDEX_BONE_INDEXES, |
| 529 |
ATTR_BONE_WEIGHTS = 1 << ATTR_INDEX_BONE_WEIGHTS, |
| 530 |
|
| 531 |
|
| 532 |
ATTR_POSITION2 = 1 << ATTR_INDEX_POSITION2, |
| 533 |
ATTR_TANGENT2 = 1 << ATTR_INDEX_TANGENT2, |
| 534 |
ATTR_NORMAL2 = 1 << ATTR_INDEX_NORMAL2, |
| 535 |
|
| 536 |
ATTR_DEFAULT = ATTR_POSITION, |
| 537 |
ATTR_BITS = ATTR_POSITION | |
| 538 |
ATTR_TEXCOORD | |
| 539 |
ATTR_LIGHTCOORD | |
| 540 |
ATTR_TANGENT | |
| 541 |
ATTR_NORMAL | |
| 542 |
ATTR_COLOR | |
| 543 |
ATTR_PAINTCOLOR | |
| 544 |
ATTR_LIGHTDIRECTION | |
| 545 |
ATTR_BONE_INDEXES | |
| 546 |
ATTR_BONE_WEIGHTS | |
| 547 |
ATTR_POSITION2 | |
| 548 |
ATTR_TANGENT2 | |
| 549 |
ATTR_NORMAL2 |
| 550 |
}; |
| 551 |
|
| 552 |
enum |
| 553 |
{ |
| 554 |
GENERICDEF_USE_DEFORM_VERTEXES = 0x0001, |
| 555 |
GENERICDEF_USE_TCGEN_AND_TCMOD = 0x0002, |
| 556 |
GENERICDEF_USE_VERTEX_ANIMATION = 0x0004, |
| 557 |
GENERICDEF_USE_FOG = 0x0008, |
| 558 |
GENERICDEF_USE_RGBAGEN = 0x0010, |
| 559 |
GENERICDEF_USE_BONE_ANIMATION = 0x0020, |
| 560 |
GENERICDEF_ALL = 0x003F, |
| 561 |
GENERICDEF_COUNT = 0x0040, |
| 562 |
}; |
| 563 |
|
| 564 |
enum |
| 565 |
{ |
| 566 |
FOGDEF_USE_DEFORM_VERTEXES = 0x0001, |
| 567 |
FOGDEF_USE_VERTEX_ANIMATION = 0x0002, |
| 568 |
FOGDEF_USE_BONE_ANIMATION = 0x0004, |
| 569 |
FOGDEF_ALL = 0x0007, |
| 570 |
FOGDEF_COUNT = 0x0008, |
| 571 |
}; |
| 572 |
|
| 573 |
enum |
| 574 |
{ |
| 575 |
DLIGHTDEF_USE_DEFORM_VERTEXES = 0x0001, |
| 576 |
DLIGHTDEF_ALL = 0x0001, |
| 577 |
DLIGHTDEF_COUNT = 0x0002, |
| 578 |
}; |
| 579 |
|
| 580 |
enum |
| 581 |
{ |
| 582 |
LIGHTDEF_USE_LIGHTMAP = 0x0001, |
| 583 |
LIGHTDEF_USE_LIGHT_VECTOR = 0x0002, |
| 584 |
LIGHTDEF_USE_LIGHT_VERTEX = 0x0003, |
| 585 |
LIGHTDEF_LIGHTTYPE_MASK = 0x0003, |
| 586 |
LIGHTDEF_ENTITY_VERTEX_ANIMATION = 0x0004, |
| 587 |
LIGHTDEF_USE_TCGEN_AND_TCMOD = 0x0008, |
| 588 |
LIGHTDEF_USE_PARALLAXMAP = 0x0010, |
| 589 |
LIGHTDEF_USE_SHADOWMAP = 0x0020, |
| 590 |
LIGHTDEF_ENTITY_BONE_ANIMATION = 0x0040, |
| 591 |
LIGHTDEF_ALL = 0x007F, |
| 592 |
LIGHTDEF_COUNT = 0x0080 |
| 593 |
}; |
| 594 |
|
| 595 |
enum |
| 596 |
{ |
| 597 |
SHADOWMAPDEF_USE_VERTEX_ANIMATION = 0x0001, |
| 598 |
SHADOWMAPDEF_USE_BONE_ANIMATION = 0x0002, |
| 599 |
SHADOWMAPDEF_ALL = 0x0003, |
| 600 |
SHADOWMAPDEF_COUNT = 0x0004 |
| 601 |
}; |
| 602 |
|
| 603 |
enum |
| 604 |
{ |
| 605 |
GLSL_INT, |
| 606 |
GLSL_FLOAT, |
| 607 |
GLSL_FLOAT5, |
| 608 |
GLSL_VEC2, |
| 609 |
GLSL_VEC3, |
| 610 |
GLSL_VEC4, |
| 611 |
GLSL_MAT16, |
| 612 |
GLSL_MAT16_BONEMATRIX |
| 613 |
}; |
| 614 |
|
| 615 |
typedef enum |
| 616 |
{ |
| 617 |
UNIFORM_DIFFUSEMAP = 0, |
| 618 |
UNIFORM_LIGHTMAP, |
| 619 |
UNIFORM_NORMALMAP, |
| 620 |
UNIFORM_DELUXEMAP, |
| 621 |
UNIFORM_SPECULARMAP, |
| 622 |
|
| 623 |
UNIFORM_TEXTUREMAP, |
| 624 |
UNIFORM_LEVELSMAP, |
| 625 |
UNIFORM_CUBEMAP, |
| 626 |
|
| 627 |
UNIFORM_SCREENIMAGEMAP, |
| 628 |
UNIFORM_SCREENDEPTHMAP, |
| 629 |
|
| 630 |
UNIFORM_SHADOWMAP, |
| 631 |
UNIFORM_SHADOWMAP2, |
| 632 |
UNIFORM_SHADOWMAP3, |
| 633 |
UNIFORM_SHADOWMAP4, |
| 634 |
|
| 635 |
UNIFORM_SHADOWMVP, |
| 636 |
UNIFORM_SHADOWMVP2, |
| 637 |
UNIFORM_SHADOWMVP3, |
| 638 |
UNIFORM_SHADOWMVP4, |
| 639 |
|
| 640 |
UNIFORM_ENABLETEXTURES, |
| 641 |
|
| 642 |
UNIFORM_DIFFUSETEXMATRIX0, |
| 643 |
UNIFORM_DIFFUSETEXMATRIX1, |
| 644 |
UNIFORM_DIFFUSETEXMATRIX2, |
| 645 |
UNIFORM_DIFFUSETEXMATRIX3, |
| 646 |
UNIFORM_DIFFUSETEXMATRIX4, |
| 647 |
UNIFORM_DIFFUSETEXMATRIX5, |
| 648 |
UNIFORM_DIFFUSETEXMATRIX6, |
| 649 |
UNIFORM_DIFFUSETEXMATRIX7, |
| 650 |
|
| 651 |
UNIFORM_TCGEN0, |
| 652 |
UNIFORM_TCGEN0VECTOR0, |
| 653 |
UNIFORM_TCGEN0VECTOR1, |
| 654 |
|
| 655 |
UNIFORM_DEFORMGEN, |
| 656 |
UNIFORM_DEFORMPARAMS, |
| 657 |
|
| 658 |
UNIFORM_COLORGEN, |
| 659 |
UNIFORM_ALPHAGEN, |
| 660 |
UNIFORM_COLOR, |
| 661 |
UNIFORM_BASECOLOR, |
| 662 |
UNIFORM_VERTCOLOR, |
| 663 |
|
| 664 |
UNIFORM_DLIGHTINFO, |
| 665 |
UNIFORM_LIGHTFORWARD, |
| 666 |
UNIFORM_LIGHTUP, |
| 667 |
UNIFORM_LIGHTRIGHT, |
| 668 |
UNIFORM_LIGHTORIGIN, |
| 669 |
UNIFORM_MODELLIGHTDIR, |
| 670 |
UNIFORM_LIGHTRADIUS, |
| 671 |
UNIFORM_AMBIENTLIGHT, |
| 672 |
UNIFORM_DIRECTEDLIGHT, |
| 673 |
|
| 674 |
UNIFORM_PORTALRANGE, |
| 675 |
|
| 676 |
UNIFORM_FOGDISTANCE, |
| 677 |
UNIFORM_FOGDEPTH, |
| 678 |
UNIFORM_FOGEYET, |
| 679 |
UNIFORM_FOGCOLORMASK, |
| 680 |
|
| 681 |
UNIFORM_MODELMATRIX, |
| 682 |
UNIFORM_MODELVIEWPROJECTIONMATRIX, |
| 683 |
|
| 684 |
UNIFORM_TIME, |
| 685 |
UNIFORM_VERTEXLERP, |
| 686 |
UNIFORM_NORMALSCALE, |
| 687 |
UNIFORM_SPECULARSCALE, |
| 688 |
|
| 689 |
UNIFORM_VIEWINFO, |
| 690 |
UNIFORM_VIEWORIGIN, |
| 691 |
UNIFORM_LOCALVIEWORIGIN, |
| 692 |
UNIFORM_VIEWFORWARD, |
| 693 |
UNIFORM_VIEWLEFT, |
| 694 |
UNIFORM_VIEWUP, |
| 695 |
|
| 696 |
UNIFORM_INVTEXRES, |
| 697 |
UNIFORM_AUTOEXPOSUREMINMAX, |
| 698 |
UNIFORM_TONEMINAVGMAXLINEAR, |
| 699 |
|
| 700 |
UNIFORM_PRIMARYLIGHTORIGIN, |
| 701 |
UNIFORM_PRIMARYLIGHTCOLOR, |
| 702 |
UNIFORM_PRIMARYLIGHTAMBIENT, |
| 703 |
UNIFORM_PRIMARYLIGHTRADIUS, |
| 704 |
|
| 705 |
UNIFORM_CUBEMAPINFO, |
| 706 |
|
| 707 |
UNIFORM_ALPHATEST, |
| 708 |
|
| 709 |
UNIFORM_BONEMATRIX, |
| 710 |
|
| 711 |
UNIFORM_GREYSCALE, |
| 712 |
|
| 713 |
UNIFORM_COUNT |
| 714 |
} uniform_t; |
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
typedef struct shaderProgram_s |
| 719 |
{ |
| 720 |
char name[MAX_QPATH]; |
| 721 |
|
| 722 |
GLuint program; |
| 723 |
GLuint vertexShader; |
| 724 |
GLuint fragmentShader; |
| 725 |
uint32_t attribs; |
| 726 |
|
| 727 |
|
| 728 |
GLint uniforms[UNIFORM_COUNT]; |
| 729 |
short uniformBufferOffsets[UNIFORM_COUNT]; |
| 730 |
char *uniformBuffer; |
| 731 |
} shaderProgram_t; |
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
typedef struct { |
| 736 |
int x, y, width, height; |
| 737 |
float fov_x, fov_y; |
| 738 |
vec3_t vieworg; |
| 739 |
vec3_t viewaxis[3]; |
| 740 |
|
| 741 |
stereoFrame_t stereoFrame; |
| 742 |
|
| 743 |
int time; |
| 744 |
int rdflags; |
| 745 |
|
| 746 |
|
| 747 |
byte areamask[MAX_MAP_AREA_BYTES]; |
| 748 |
qboolean areamaskModified; |
| 749 |
|
| 750 |
double floatTime; |
| 751 |
|
| 752 |
float blurFactor; |
| 753 |
|
| 754 |
|
| 755 |
char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH]; |
| 756 |
|
| 757 |
int num_entities; |
| 758 |
trRefEntity_t *entities; |
| 759 |
|
| 760 |
int num_dlights; |
| 761 |
struct dlight_s *dlights; |
| 762 |
|
| 763 |
int numPolys; |
| 764 |
struct srfPoly_s *polys; |
| 765 |
|
| 766 |
int numDrawSurfs; |
| 767 |
struct drawSurf_s *drawSurfs; |
| 768 |
|
| 769 |
unsigned int dlightMask; |
| 770 |
int num_pshadows; |
| 771 |
struct pshadow_s *pshadows; |
| 772 |
|
| 773 |
float sunShadowMvp[4][16]; |
| 774 |
float sunDir[4]; |
| 775 |
float sunCol[4]; |
| 776 |
float sunAmbCol[4]; |
| 777 |
|
| 778 |
float autoExposureMinMax[2]; |
| 779 |
float toneMinAvgMaxLinear[3]; |
| 780 |
} trRefdef_t; |
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
#define MAX_SKIN_SURFACES 256 |
| 790 |
|
| 791 |
|
| 792 |
typedef struct { |
| 793 |
char name[MAX_QPATH]; |
| 794 |
shader_t *shader; |
| 795 |
} skinSurface_t; |
| 796 |
|
| 797 |
typedef struct skin_s { |
| 798 |
char name[MAX_QPATH]; |
| 799 |
int numSurfaces; |
| 800 |
skinSurface_t *surfaces; |
| 801 |
} skin_t; |
| 802 |
|
| 803 |
|
| 804 |
typedef struct { |
| 805 |
int originalBrushNumber; |
| 806 |
vec3_t bounds[2]; |
| 807 |
|
| 808 |
unsigned colorInt; |
| 809 |
float tcScale; |
| 810 |
fogParms_t parms; |
| 811 |
|
| 812 |
|
| 813 |
qboolean hasSurface; |
| 814 |
float surface[4]; |
| 815 |
} fog_t; |
| 816 |
|
| 817 |
typedef enum { |
| 818 |
VPF_NONE = 0x00, |
| 819 |
VPF_NOVIEWMODEL = 0x01, |
| 820 |
VPF_SHADOWMAP = 0x02, |
| 821 |
VPF_DEPTHSHADOW = 0x04, |
| 822 |
VPF_DEPTHCLAMP = 0x08, |
| 823 |
VPF_ORTHOGRAPHIC = 0x10, |
| 824 |
VPF_USESUNLIGHT = 0x20, |
| 825 |
VPF_FARPLANEFRUSTUM = 0x40, |
| 826 |
VPF_NOCUBEMAPS = 0x80 |
| 827 |
} viewParmFlags_t; |
| 828 |
|
| 829 |
typedef struct { |
| 830 |
orientationr_t or; |
| 831 |
orientationr_t world; |
| 832 |
vec3_t pvsOrigin; |
| 833 |
qboolean isPortal; |
| 834 |
qboolean isMirror; |
| 835 |
viewParmFlags_t flags; |
| 836 |
int frameSceneNum; |
| 837 |
int frameCount; |
| 838 |
cplane_t portalPlane; |
| 839 |
int viewportX, viewportY, viewportWidth, viewportHeight; |
| 840 |
FBO_t *targetFbo; |
| 841 |
int targetFboLayer; |
| 842 |
int targetFboCubemapIndex; |
| 843 |
float fovX, fovY; |
| 844 |
float projectionMatrix[16]; |
| 845 |
cplane_t frustum[5]; |
| 846 |
vec3_t visBounds[2]; |
| 847 |
float zFar; |
| 848 |
float zNear; |
| 849 |
stereoFrame_t stereoFrame; |
| 850 |
} viewParms_t; |
| 851 |
|
| 852 |
|
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
typedef byte color4ub_t[4]; |
| 861 |
|
| 862 |
|
| 863 |
typedef enum { |
| 864 |
SF_BAD, |
| 865 |
SF_SKIP, |
| 866 |
SF_FACE, |
| 867 |
SF_GRID, |
| 868 |
SF_TRIANGLES, |
| 869 |
SF_POLY, |
| 870 |
SF_MDV, |
| 871 |
SF_MDR, |
| 872 |
SF_IQM, |
| 873 |
SF_FLARE, |
| 874 |
SF_ENTITY, |
| 875 |
SF_VAO_MDVMESH, |
| 876 |
SF_VAO_IQM, |
| 877 |
|
| 878 |
SF_NUM_SURFACE_TYPES, |
| 879 |
SF_MAX = 0x7fffffff |
| 880 |
} surfaceType_t; |
| 881 |
|
| 882 |
typedef struct drawSurf_s { |
| 883 |
unsigned int sort; |
| 884 |
int cubemapIndex; |
| 885 |
surfaceType_t *surface; |
| 886 |
} drawSurf_t; |
| 887 |
|
| 888 |
#define MAX_FACE_POINTS 64 |
| 889 |
|
| 890 |
#define MAX_PATCH_SIZE 32 // max dimensions of a patch mesh in map file |
| 891 |
#define MAX_GRID_SIZE 65 // max dimensions of a grid mesh in memory |
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
typedef struct srfPoly_s { |
| 896 |
surfaceType_t surfaceType; |
| 897 |
qhandle_t hShader; |
| 898 |
int fogIndex; |
| 899 |
int numVerts; |
| 900 |
polyVert_t *verts; |
| 901 |
} srfPoly_t; |
| 902 |
|
| 903 |
|
| 904 |
typedef struct srfFlare_s { |
| 905 |
surfaceType_t surfaceType; |
| 906 |
vec3_t origin; |
| 907 |
vec3_t normal; |
| 908 |
vec3_t color; |
| 909 |
} srfFlare_t; |
| 910 |
|
| 911 |
typedef struct |
| 912 |
{ |
| 913 |
vec3_t xyz; |
| 914 |
vec2_t st; |
| 915 |
vec2_t lightmap; |
| 916 |
int16_t normal[4]; |
| 917 |
int16_t tangent[4]; |
| 918 |
int16_t lightdir[4]; |
| 919 |
uint16_t color[4]; |
| 920 |
|
| 921 |
#if DEBUG_OPTIMIZEVERTICES |
| 922 |
unsigned int id; |
| 923 |
#endif |
| 924 |
} srfVert_t; |
| 925 |
|
| 926 |
#define srfVert_t_cleared(x) srfVert_t (x) = {{0, 0, 0}, {0, 0}, {0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}} |
| 927 |
|
| 928 |
|
| 929 |
typedef struct srfBspSurface_s |
| 930 |
{ |
| 931 |
surfaceType_t surfaceType; |
| 932 |
|
| 933 |
|
| 934 |
int dlightBits; |
| 935 |
int pshadowBits; |
| 936 |
|
| 937 |
|
| 938 |
vec3_t cullBounds[2]; |
| 939 |
vec3_t cullOrigin; |
| 940 |
float cullRadius; |
| 941 |
cplane_t cullPlane; |
| 942 |
|
| 943 |
|
| 944 |
int numIndexes; |
| 945 |
glIndex_t *indexes; |
| 946 |
|
| 947 |
|
| 948 |
int numVerts; |
| 949 |
srfVert_t *verts; |
| 950 |
|
| 951 |
|
| 952 |
|
| 953 |
|
| 954 |
|
| 955 |
|
| 956 |
vec3_t lodOrigin; |
| 957 |
float lodRadius; |
| 958 |
int lodFixed; |
| 959 |
int lodStitched; |
| 960 |
|
| 961 |
|
| 962 |
int width, height; |
| 963 |
float *widthLodError; |
| 964 |
float *heightLodError; |
| 965 |
} srfBspSurface_t; |
| 966 |
|
| 967 |
typedef struct { |
| 968 |
vec3_t translate; |
| 969 |
quat_t rotate; |
| 970 |
vec3_t scale; |
| 971 |
} iqmTransform_t; |
| 972 |
|
| 973 |
|
| 974 |
typedef struct { |
| 975 |
int num_vertexes; |
| 976 |
int num_triangles; |
| 977 |
int num_frames; |
| 978 |
int num_surfaces; |
| 979 |
int num_joints; |
| 980 |
int num_poses; |
| 981 |
struct srfIQModel_s *surfaces; |
| 982 |
|
| 983 |
int *triangles; |
| 984 |
|
| 985 |
|
| 986 |
float *positions; |
| 987 |
float *texcoords; |
| 988 |
float *normals; |
| 989 |
float *tangents; |
| 990 |
byte *colors; |
| 991 |
int *influences; |
| 992 |
|
| 993 |
|
| 994 |
byte *influenceBlendIndexes; |
| 995 |
union { |
| 996 |
float *f; |
| 997 |
byte *b; |
| 998 |
} influenceBlendWeights; |
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
int blendWeightsType; |
| 1004 |
|
| 1005 |
char *jointNames; |
| 1006 |
int *jointParents; |
| 1007 |
float *bindJoints; |
| 1008 |
float *invBindJoints; |
| 1009 |
iqmTransform_t *poses; |
| 1010 |
float *bounds; |
| 1011 |
|
| 1012 |
int numVaoSurfaces; |
| 1013 |
struct srfVaoIQModel_s *vaoSurfaces; |
| 1014 |
} iqmData_t; |
| 1015 |
|
| 1016 |
|
| 1017 |
typedef struct srfIQModel_s { |
| 1018 |
surfaceType_t surfaceType; |
| 1019 |
char name[MAX_QPATH]; |
| 1020 |
shader_t *shader; |
| 1021 |
iqmData_t *data; |
| 1022 |
int first_vertex, num_vertexes; |
| 1023 |
int first_triangle, num_triangles; |
| 1024 |
int first_influence, num_influences; |
| 1025 |
} srfIQModel_t; |
| 1026 |
|
| 1027 |
typedef struct srfVaoIQModel_s |
| 1028 |
{ |
| 1029 |
surfaceType_t surfaceType; |
| 1030 |
|
| 1031 |
iqmData_t *iqmData; |
| 1032 |
struct srfIQModel_s *iqmSurface; |
| 1033 |
|
| 1034 |
|
| 1035 |
int numIndexes; |
| 1036 |
int numVerts; |
| 1037 |
|
| 1038 |
|
| 1039 |
vao_t *vao; |
| 1040 |
} srfVaoIQModel_t; |
| 1041 |
|
| 1042 |
typedef struct srfVaoMdvMesh_s |
| 1043 |
{ |
| 1044 |
surfaceType_t surfaceType; |
| 1045 |
|
| 1046 |
struct mdvModel_s *mdvModel; |
| 1047 |
struct mdvSurface_s *mdvSurface; |
| 1048 |
|
| 1049 |
|
| 1050 |
int numIndexes; |
| 1051 |
int numVerts; |
| 1052 |
|
| 1053 |
|
| 1054 |
vao_t *vao; |
| 1055 |
} srfVaoMdvMesh_t; |
| 1056 |
|
| 1057 |
extern void (*rb_surfaceTable[SF_NUM_SURFACE_TYPES])(void *); |
| 1058 |
|
| 1059 |
|
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
|
| 1067 |
typedef struct pshadow_s |
| 1068 |
{ |
| 1069 |
float sort; |
| 1070 |
|
| 1071 |
int numEntities; |
| 1072 |
int entityNums[8]; |
| 1073 |
vec3_t entityOrigins[8]; |
| 1074 |
float entityRadiuses[8]; |
| 1075 |
|
| 1076 |
float viewRadius; |
| 1077 |
vec3_t viewOrigin; |
| 1078 |
|
| 1079 |
vec3_t lightViewAxis[3]; |
| 1080 |
vec3_t lightOrigin; |
| 1081 |
float lightRadius; |
| 1082 |
cplane_t cullPlane; |
| 1083 |
} pshadow_t; |
| 1084 |
|
| 1085 |
|
| 1086 |
|
| 1087 |
|
| 1088 |
|
| 1089 |
|
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
#define SIDE_FRONT 0 |
| 1100 |
#define SIDE_BACK 1 |
| 1101 |
#define SIDE_ON 2 |
| 1102 |
|
| 1103 |
#define CULLINFO_NONE 0 |
| 1104 |
#define CULLINFO_BOX 1 |
| 1105 |
#define CULLINFO_SPHERE 2 |
| 1106 |
#define CULLINFO_PLANE 4 |
| 1107 |
|
| 1108 |
typedef struct cullinfo_s { |
| 1109 |
int type; |
| 1110 |
vec3_t bounds[2]; |
| 1111 |
vec3_t localOrigin; |
| 1112 |
float radius; |
| 1113 |
cplane_t plane; |
| 1114 |
} cullinfo_t; |
| 1115 |
|
| 1116 |
typedef struct msurface_s { |
| 1117 |
|
| 1118 |
struct shader_s *shader; |
| 1119 |
int fogIndex; |
| 1120 |
int cubemapIndex; |
| 1121 |
cullinfo_t cullinfo; |
| 1122 |
|
| 1123 |
surfaceType_t *data; |
| 1124 |
} msurface_t; |
| 1125 |
|
| 1126 |
|
| 1127 |
#define CONTENTS_NODE -1 |
| 1128 |
typedef struct mnode_s { |
| 1129 |
|
| 1130 |
int contents; |
| 1131 |
int visCounts[MAX_VISCOUNTS]; |
| 1132 |
vec3_t mins, maxs; |
| 1133 |
struct mnode_s *parent; |
| 1134 |
|
| 1135 |
|
| 1136 |
cplane_t *plane; |
| 1137 |
struct mnode_s *children[2]; |
| 1138 |
|
| 1139 |
|
| 1140 |
int cluster; |
| 1141 |
int area; |
| 1142 |
|
| 1143 |
int firstmarksurface; |
| 1144 |
int nummarksurfaces; |
| 1145 |
} mnode_t; |
| 1146 |
|
| 1147 |
typedef struct { |
| 1148 |
vec3_t bounds[2]; |
| 1149 |
int firstSurface; |
| 1150 |
int numSurfaces; |
| 1151 |
} bmodel_t; |
| 1152 |
|
| 1153 |
typedef struct { |
| 1154 |
char name[MAX_QPATH]; |
| 1155 |
char baseName[MAX_QPATH]; |
| 1156 |
|
| 1157 |
int dataSize; |
| 1158 |
|
| 1159 |
int numShaders; |
| 1160 |
dshader_t *shaders; |
| 1161 |
|
| 1162 |
int numBModels; |
| 1163 |
bmodel_t *bmodels; |
| 1164 |
|
| 1165 |
int numplanes; |
| 1166 |
cplane_t *planes; |
| 1167 |
|
| 1168 |
int numnodes; |
| 1169 |
int numDecisionNodes; |
| 1170 |
mnode_t *nodes; |
| 1171 |
|
| 1172 |
int numWorldSurfaces; |
| 1173 |
|
| 1174 |
int numsurfaces; |
| 1175 |
msurface_t *surfaces; |
| 1176 |
int *surfacesViewCount; |
| 1177 |
int *surfacesDlightBits; |
| 1178 |
int *surfacesPshadowBits; |
| 1179 |
|
| 1180 |
int nummarksurfaces; |
| 1181 |
int *marksurfaces; |
| 1182 |
|
| 1183 |
int numfogs; |
| 1184 |
fog_t *fogs; |
| 1185 |
|
| 1186 |
vec3_t lightGridOrigin; |
| 1187 |
vec3_t lightGridSize; |
| 1188 |
vec3_t lightGridInverseSize; |
| 1189 |
int lightGridBounds[3]; |
| 1190 |
byte *lightGridData; |
| 1191 |
uint16_t *lightGrid16; |
| 1192 |
|
| 1193 |
|
| 1194 |
int numClusters; |
| 1195 |
int clusterBytes; |
| 1196 |
const byte *vis; |
| 1197 |
|
| 1198 |
char *entityString; |
| 1199 |
char *entityParsePoint; |
| 1200 |
} world_t; |
| 1201 |
|
| 1202 |
|
| 1203 |
|
| 1204 |
|
| 1205 |
|
| 1206 |
|
| 1207 |
|
| 1208 |
typedef struct |
| 1209 |
{ |
| 1210 |
float bounds[2][3]; |
| 1211 |
float localOrigin[3]; |
| 1212 |
float radius; |
| 1213 |
} mdvFrame_t; |
| 1214 |
|
| 1215 |
typedef struct |
| 1216 |
{ |
| 1217 |
float origin[3]; |
| 1218 |
float axis[3][3]; |
| 1219 |
} mdvTag_t; |
| 1220 |
|
| 1221 |
typedef struct |
| 1222 |
{ |
| 1223 |
char name[MAX_QPATH]; |
| 1224 |
} mdvTagName_t; |
| 1225 |
|
| 1226 |
typedef struct |
| 1227 |
{ |
| 1228 |
vec3_t xyz; |
| 1229 |
int16_t normal[4]; |
| 1230 |
int16_t tangent[4]; |
| 1231 |
} mdvVertex_t; |
| 1232 |
|
| 1233 |
typedef struct |
| 1234 |
{ |
| 1235 |
float st[2]; |
| 1236 |
} mdvSt_t; |
| 1237 |
|
| 1238 |
typedef struct mdvSurface_s |
| 1239 |
{ |
| 1240 |
surfaceType_t surfaceType; |
| 1241 |
|
| 1242 |
char name[MAX_QPATH]; |
| 1243 |
|
| 1244 |
int numShaderIndexes; |
| 1245 |
int *shaderIndexes; |
| 1246 |
|
| 1247 |
int numVerts; |
| 1248 |
mdvVertex_t *verts; |
| 1249 |
mdvSt_t *st; |
| 1250 |
|
| 1251 |
int numIndexes; |
| 1252 |
glIndex_t *indexes; |
| 1253 |
|
| 1254 |
struct mdvModel_s *model; |
| 1255 |
} mdvSurface_t; |
| 1256 |
|
| 1257 |
typedef struct mdvModel_s |
| 1258 |
{ |
| 1259 |
int numFrames; |
| 1260 |
mdvFrame_t *frames; |
| 1261 |
|
| 1262 |
int numTags; |
| 1263 |
mdvTag_t *tags; |
| 1264 |
mdvTagName_t *tagNames; |
| 1265 |
|
| 1266 |
int numSurfaces; |
| 1267 |
mdvSurface_t *surfaces; |
| 1268 |
|
| 1269 |
int numVaoSurfaces; |
| 1270 |
srfVaoMdvMesh_t *vaoSurfaces; |
| 1271 |
|
| 1272 |
int numSkins; |
| 1273 |
} mdvModel_t; |
| 1274 |
|
| 1275 |
|
| 1276 |
|
| 1277 |
|
| 1278 |
typedef enum { |
| 1279 |
MOD_BAD, |
| 1280 |
MOD_BRUSH, |
| 1281 |
MOD_MESH, |
| 1282 |
MOD_MDR, |
| 1283 |
MOD_IQM |
| 1284 |
} modtype_t; |
| 1285 |
|
| 1286 |
typedef struct model_s { |
| 1287 |
char name[MAX_QPATH]; |
| 1288 |
modtype_t type; |
| 1289 |
int index; |
| 1290 |
|
| 1291 |
int dataSize; |
| 1292 |
bmodel_t *bmodel; |
| 1293 |
mdvModel_t *mdv[MD3_MAX_LODS]; |
| 1294 |
void *modelData; |
| 1295 |
|
| 1296 |
int numLods; |
| 1297 |
} model_t; |
| 1298 |
|
| 1299 |
|
| 1300 |
#define MAX_MOD_KNOWN 1024 |
| 1301 |
|
| 1302 |
void R_ModelInit (void); |
| 1303 |
model_t *R_GetModelByHandle( qhandle_t hModel ); |
| 1304 |
int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame, |
| 1305 |
float frac, const char *tagName ); |
| 1306 |
void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs ); |
| 1307 |
|
| 1308 |
void R_Modellist_f (void); |
| 1309 |
|
| 1310 |
|
| 1311 |
|
| 1312 |
#define MAX_DRAWIMAGES 2048 |
| 1313 |
#define MAX_SKINS 1024 |
| 1314 |
|
| 1315 |
|
| 1316 |
#define MAX_DRAWSURFS 0x10000 |
| 1317 |
#define DRAWSURF_MASK (MAX_DRAWSURFS-1) |
| 1318 |
|
| 1319 |
|
| 1320 |
|
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 |
|
| 1325 |
|
| 1326 |
|
| 1327 |
|
| 1328 |
|
| 1329 |
|
| 1330 |
|
| 1331 |
|
| 1332 |
|
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
|
| 1337 |
|
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 1341 |
|
| 1342 |
|
| 1343 |
|
| 1344 |
|
| 1345 |
#define QSORT_FOGNUM_SHIFT 2 |
| 1346 |
#define QSORT_REFENTITYNUM_SHIFT 7 |
| 1347 |
#define QSORT_SHADERNUM_SHIFT (QSORT_REFENTITYNUM_SHIFT+REFENTITYNUM_BITS) |
| 1348 |
#if (QSORT_SHADERNUM_SHIFT+SHADERNUM_BITS) > 32 |
| 1349 |
#error "Need to update sorting, too many bits." |
| 1350 |
#endif |
| 1351 |
#define QSORT_PSHADOW_SHIFT 1 |
| 1352 |
|
| 1353 |
extern int gl_filter_min, gl_filter_max; |
| 1354 |
|
| 1355 |
|
| 1356 |
|
| 1357 |
|
| 1358 |
typedef struct { |
| 1359 |
int c_sphere_cull_patch_in, c_sphere_cull_patch_clip, c_sphere_cull_patch_out; |
| 1360 |
int c_box_cull_patch_in, c_box_cull_patch_clip, c_box_cull_patch_out; |
| 1361 |
int c_sphere_cull_md3_in, c_sphere_cull_md3_clip, c_sphere_cull_md3_out; |
| 1362 |
int c_box_cull_md3_in, c_box_cull_md3_clip, c_box_cull_md3_out; |
| 1363 |
|
| 1364 |
int c_leafs; |
| 1365 |
int c_dlightSurfaces; |
| 1366 |
int c_dlightSurfacesCulled; |
| 1367 |
} frontEndCounters_t; |
| 1368 |
|
| 1369 |
#define FOG_TABLE_SIZE 256 |
| 1370 |
#define FUNCTABLE_SIZE 1024 |
| 1371 |
#define FUNCTABLE_SIZE2 10 |
| 1372 |
#define FUNCTABLE_MASK (FUNCTABLE_SIZE-1) |
| 1373 |
|
| 1374 |
|
| 1375 |
|
| 1376 |
typedef struct { |
| 1377 |
qboolean finishCalled; |
| 1378 |
int texEnv[2]; |
| 1379 |
int faceCulling; |
| 1380 |
int faceCullFront; |
| 1381 |
uint32_t glStateBits; |
| 1382 |
uint32_t storedGlState; |
| 1383 |
float vertexAttribsInterpolation; |
| 1384 |
qboolean vertexAnimation; |
| 1385 |
int boneAnimation; |
| 1386 |
mat4_t boneMatrix[IQM_MAX_JOINTS]; |
| 1387 |
uint32_t vertexAttribsEnabled; |
| 1388 |
FBO_t *currentFBO; |
| 1389 |
vao_t *currentVao; |
| 1390 |
mat4_t modelview; |
| 1391 |
mat4_t projection; |
| 1392 |
mat4_t modelviewProjection; |
| 1393 |
} glstate_t; |
| 1394 |
|
| 1395 |
typedef enum { |
| 1396 |
MI_NONE, |
| 1397 |
MI_NVX, |
| 1398 |
MI_ATI |
| 1399 |
} memInfo_t; |
| 1400 |
|
| 1401 |
typedef enum { |
| 1402 |
TCR_NONE = 0x0000, |
| 1403 |
TCR_RGTC = 0x0001, |
| 1404 |
TCR_BPTC = 0x0002, |
| 1405 |
} textureCompressionRef_t; |
| 1406 |
|
| 1407 |
|
| 1408 |
|
| 1409 |
typedef struct { |
| 1410 |
qboolean intelGraphics; |
| 1411 |
|
| 1412 |
qboolean occlusionQuery; |
| 1413 |
GLenum occlusionQueryTarget; |
| 1414 |
|
| 1415 |
int glslMajorVersion; |
| 1416 |
int glslMinorVersion; |
| 1417 |
int glslMaxAnimatedBones; |
| 1418 |
|
| 1419 |
memInfo_t memInfo; |
| 1420 |
|
| 1421 |
qboolean framebufferObject; |
| 1422 |
int maxRenderbufferSize; |
| 1423 |
int maxColorAttachments; |
| 1424 |
|
| 1425 |
qboolean textureFloat; |
| 1426 |
textureCompressionRef_t textureCompression; |
| 1427 |
qboolean swizzleNormalmap; |
| 1428 |
|
| 1429 |
qboolean framebufferMultisample; |
| 1430 |
qboolean framebufferBlit; |
| 1431 |
|
| 1432 |
qboolean depthClamp; |
| 1433 |
qboolean seamlessCubeMap; |
| 1434 |
|
| 1435 |
qboolean vertexArrayObject; |
| 1436 |
qboolean directStateAccess; |
| 1437 |
|
| 1438 |
int maxVertexAttribs; |
| 1439 |
qboolean gpuVertexAnimation; |
| 1440 |
|
| 1441 |
GLenum vaoCacheGlIndexType; |
| 1442 |
size_t vaoCacheGlIndexSize; |
| 1443 |
|
| 1444 |
|
| 1445 |
qboolean readDepth; |
| 1446 |
qboolean readStencil; |
| 1447 |
qboolean shadowSamplers; |
| 1448 |
qboolean standardDerivatives; |
| 1449 |
} glRefConfig_t; |
| 1450 |
|
| 1451 |
|
| 1452 |
typedef struct { |
| 1453 |
int c_surfaces, c_shaders, c_vertexes, c_indexes, c_totalIndexes; |
| 1454 |
int c_surfBatches; |
| 1455 |
float c_overDraw; |
| 1456 |
|
| 1457 |
int c_vaoBinds; |
| 1458 |
int c_vaoVertexes; |
| 1459 |
int c_vaoIndexes; |
| 1460 |
|
| 1461 |
int c_staticVaoDraws; |
| 1462 |
int c_dynamicVaoDraws; |
| 1463 |
|
| 1464 |
int c_dlightVertexes; |
| 1465 |
int c_dlightIndexes; |
| 1466 |
|
| 1467 |
int c_flareAdds; |
| 1468 |
int c_flareTests; |
| 1469 |
int c_flareRenders; |
| 1470 |
|
| 1471 |
int c_glslShaderBinds; |
| 1472 |
int c_genericDraws; |
| 1473 |
int c_lightallDraws; |
| 1474 |
int c_fogDraws; |
| 1475 |
int c_dlightDraws; |
| 1476 |
|
| 1477 |
int msec; |
| 1478 |
} backEndCounters_t; |
| 1479 |
|
| 1480 |
|
| 1481 |
|
| 1482 |
typedef struct { |
| 1483 |
trRefdef_t refdef; |
| 1484 |
viewParms_t viewParms; |
| 1485 |
orientationr_t or; |
| 1486 |
backEndCounters_t pc; |
| 1487 |
qboolean isHyperspace; |
| 1488 |
trRefEntity_t *currentEntity; |
| 1489 |
qboolean skyRenderedThisView; |
| 1490 |
|
| 1491 |
qboolean projection2D; |
| 1492 |
byte color2D[4]; |
| 1493 |
qboolean vertexes2D; |
| 1494 |
trRefEntity_t entity2D; |
| 1495 |
|
| 1496 |
FBO_t *last2DFBO; |
| 1497 |
qboolean colorMask[4]; |
| 1498 |
qboolean depthFill; |
| 1499 |
float greyscale; |
| 1500 |
} backEndState_t; |
| 1501 |
|
| 1502 |
|
| 1503 |
|
| 1504 |
|
| 1505 |
|
| 1506 |
|
| 1507 |
|
| 1508 |
|
| 1509 |
|
| 1510 |
typedef struct { |
| 1511 |
qboolean registered; |
| 1512 |
|
| 1513 |
int visIndex; |
| 1514 |
int visClusters[MAX_VISCOUNTS]; |
| 1515 |
int visCounts[MAX_VISCOUNTS]; |
| 1516 |
|
| 1517 |
int frameCount; |
| 1518 |
int sceneCount; |
| 1519 |
int viewCount; |
| 1520 |
|
| 1521 |
|
| 1522 |
int frameSceneNum; |
| 1523 |
|
| 1524 |
qboolean worldMapLoaded; |
| 1525 |
qboolean worldDeluxeMapping; |
| 1526 |
vec2_t autoExposureMinMax; |
| 1527 |
vec3_t toneMinAvgMaxLevel; |
| 1528 |
world_t *world; |
| 1529 |
|
| 1530 |
const byte *externalVisData; |
| 1531 |
|
| 1532 |
image_t *defaultImage; |
| 1533 |
image_t *scratchImage[32]; |
| 1534 |
image_t *fogImage; |
| 1535 |
image_t *dlightImage; |
| 1536 |
image_t *flareImage; |
| 1537 |
image_t *whiteImage; |
| 1538 |
image_t *identityLightImage; |
| 1539 |
|
| 1540 |
image_t *shadowCubemaps[MAX_DLIGHTS]; |
| 1541 |
|
| 1542 |
|
| 1543 |
image_t *renderImage; |
| 1544 |
image_t *sunRaysImage; |
| 1545 |
image_t *renderDepthImage; |
| 1546 |
image_t *pshadowMaps[MAX_DRAWN_PSHADOWS]; |
| 1547 |
image_t *screenScratchImage; |
| 1548 |
image_t *textureScratchImage[2]; |
| 1549 |
image_t *quarterImage[2]; |
| 1550 |
image_t *calcLevelsImage; |
| 1551 |
image_t *targetLevelsImage; |
| 1552 |
image_t *fixedLevelsImage; |
| 1553 |
image_t *sunShadowDepthImage[4]; |
| 1554 |
image_t *screenShadowImage; |
| 1555 |
image_t *screenSsaoImage; |
| 1556 |
image_t *hdrDepthImage; |
| 1557 |
image_t *renderCubeImage; |
| 1558 |
|
| 1559 |
image_t *textureDepthImage; |
| 1560 |
|
| 1561 |
FBO_t *renderFbo; |
| 1562 |
FBO_t *msaaResolveFbo; |
| 1563 |
FBO_t *sunRaysFbo; |
| 1564 |
FBO_t *depthFbo; |
| 1565 |
FBO_t *pshadowFbos[MAX_DRAWN_PSHADOWS]; |
| 1566 |
FBO_t *screenScratchFbo; |
| 1567 |
FBO_t *textureScratchFbo[2]; |
| 1568 |
FBO_t *quarterFbo[2]; |
| 1569 |
FBO_t *calcLevelsFbo; |
| 1570 |
FBO_t *targetLevelsFbo; |
| 1571 |
FBO_t *sunShadowFbo[4]; |
| 1572 |
FBO_t *screenShadowFbo; |
| 1573 |
FBO_t *screenSsaoFbo; |
| 1574 |
FBO_t *hdrDepthFbo; |
| 1575 |
FBO_t *renderCubeFbo; |
| 1576 |
|
| 1577 |
shader_t *defaultShader; |
| 1578 |
shader_t *shadowShader; |
| 1579 |
shader_t *projectionShadowShader; |
| 1580 |
|
| 1581 |
shader_t *flareShader; |
| 1582 |
shader_t *sunShader; |
| 1583 |
shader_t *sunFlareShader; |
| 1584 |
|
| 1585 |
int numLightmaps; |
| 1586 |
int lightmapSize; |
| 1587 |
image_t **lightmaps; |
| 1588 |
image_t **deluxemaps; |
| 1589 |
|
| 1590 |
int fatLightmapCols; |
| 1591 |
int fatLightmapRows; |
| 1592 |
|
| 1593 |
int numCubemaps; |
| 1594 |
cubemap_t *cubemaps; |
| 1595 |
|
| 1596 |
trRefEntity_t *currentEntity; |
| 1597 |
trRefEntity_t worldEntity; |
| 1598 |
int currentEntityNum; |
| 1599 |
int shiftedEntityNum; |
| 1600 |
model_t *currentModel; |
| 1601 |
|
| 1602 |
|
| 1603 |
|
| 1604 |
|
| 1605 |
shaderProgram_t genericShader[GENERICDEF_COUNT]; |
| 1606 |
shaderProgram_t textureColorShader; |
| 1607 |
shaderProgram_t fogShader[FOGDEF_COUNT]; |
| 1608 |
shaderProgram_t dlightShader[DLIGHTDEF_COUNT]; |
| 1609 |
shaderProgram_t lightallShader[LIGHTDEF_COUNT]; |
| 1610 |
shaderProgram_t shadowmapShader[SHADOWMAPDEF_COUNT]; |
| 1611 |
shaderProgram_t pshadowShader; |
| 1612 |
shaderProgram_t down4xShader; |
| 1613 |
shaderProgram_t bokehShader; |
| 1614 |
shaderProgram_t tonemapShader; |
| 1615 |
shaderProgram_t calclevels4xShader[2]; |
| 1616 |
shaderProgram_t shadowmaskShader; |
| 1617 |
shaderProgram_t ssaoShader; |
| 1618 |
shaderProgram_t depthBlurShader[4]; |
| 1619 |
shaderProgram_t testcubeShader; |
| 1620 |
shaderProgram_t greyscaleShader; |
| 1621 |
|
| 1622 |
|
| 1623 |
|
| 1624 |
|
| 1625 |
viewParms_t viewParms; |
| 1626 |
|
| 1627 |
float identityLight; |
| 1628 |
int identityLightByte; |
| 1629 |
int overbrightBits; |
| 1630 |
|
| 1631 |
orientationr_t or; |
| 1632 |
|
| 1633 |
trRefdef_t refdef; |
| 1634 |
|
| 1635 |
int viewCluster; |
| 1636 |
|
| 1637 |
float sunShadowScale; |
| 1638 |
|
| 1639 |
qboolean sunShadows; |
| 1640 |
vec3_t sunLight; |
| 1641 |
vec3_t sunDirection; |
| 1642 |
vec3_t lastCascadeSunDirection; |
| 1643 |
float lastCascadeSunMvp[16]; |
| 1644 |
|
| 1645 |
frontEndCounters_t pc; |
| 1646 |
int frontEndMsec; |
| 1647 |
|
| 1648 |
|
| 1649 |
|
| 1650 |
|
| 1651 |
|
| 1652 |
model_t *models[MAX_MOD_KNOWN]; |
| 1653 |
int numModels; |
| 1654 |
|
| 1655 |
int numImages; |
| 1656 |
image_t *images[MAX_DRAWIMAGES]; |
| 1657 |
|
| 1658 |
int numFBOs; |
| 1659 |
FBO_t *fbos[MAX_FBOS]; |
| 1660 |
|
| 1661 |
int numVaos; |
| 1662 |
vao_t *vaos[MAX_VAOS]; |
| 1663 |
|
| 1664 |
|
| 1665 |
|
| 1666 |
|
| 1667 |
int numShaders; |
| 1668 |
shader_t *shaders[MAX_SHADERS]; |
| 1669 |
shader_t *sortedShaders[MAX_SHADERS]; |
| 1670 |
|
| 1671 |
int numSkins; |
| 1672 |
skin_t *skins[MAX_SKINS]; |
| 1673 |
|
| 1674 |
GLuint sunFlareQuery[2]; |
| 1675 |
int sunFlareQueryIndex; |
| 1676 |
qboolean sunFlareQueryActive[2]; |
| 1677 |
|
| 1678 |
float sinTable[FUNCTABLE_SIZE]; |
| 1679 |
float squareTable[FUNCTABLE_SIZE]; |
| 1680 |
float triangleTable[FUNCTABLE_SIZE]; |
| 1681 |
float sawToothTable[FUNCTABLE_SIZE]; |
| 1682 |
float inverseSawToothTable[FUNCTABLE_SIZE]; |
| 1683 |
float fogTable[FOG_TABLE_SIZE]; |
| 1684 |
} trGlobals_t; |
| 1685 |
|
| 1686 |
extern backEndState_t backEnd; |
| 1687 |
extern trGlobals_t tr; |
| 1688 |
extern glstate_t glState; |
| 1689 |
extern glRefConfig_t glRefConfig; |
| 1690 |
|
| 1691 |
|
| 1692 |
|
| 1693 |
|
| 1694 |
extern cvar_t *r_flareSize; |
| 1695 |
extern cvar_t *r_flareFade; |
| 1696 |
|
| 1697 |
#define FLARE_STDCOEFF "150" |
| 1698 |
extern cvar_t *r_flareCoeff; |
| 1699 |
|
| 1700 |
extern cvar_t *r_railWidth; |
| 1701 |
extern cvar_t *r_railCoreWidth; |
| 1702 |
extern cvar_t *r_railSegmentLength; |
| 1703 |
|
| 1704 |
extern cvar_t *r_ignore; |
| 1705 |
extern cvar_t *r_verbose; |
| 1706 |
|
| 1707 |
extern cvar_t *r_znear; |
| 1708 |
extern cvar_t *r_zproj; |
| 1709 |
extern cvar_t *r_stereoSeparation; |
| 1710 |
|
| 1711 |
extern cvar_t *r_measureOverdraw; |
| 1712 |
|
| 1713 |
extern cvar_t *r_lodbias; |
| 1714 |
extern cvar_t *r_lodscale; |
| 1715 |
|
| 1716 |
extern cvar_t *r_inGameVideo; |
| 1717 |
extern cvar_t *r_fastsky; |
| 1718 |
extern cvar_t *r_drawSun; |
| 1719 |
extern cvar_t *r_dynamiclight; |
| 1720 |
extern cvar_t *r_dlightBacks; |
| 1721 |
|
| 1722 |
extern cvar_t *r_norefresh; |
| 1723 |
extern cvar_t *r_drawentities; |
| 1724 |
extern cvar_t *r_drawworld; |
| 1725 |
extern cvar_t *r_speeds; |
| 1726 |
extern cvar_t *r_detailTextures; |
| 1727 |
extern cvar_t *r_novis; |
| 1728 |
extern cvar_t *r_nocull; |
| 1729 |
extern cvar_t *r_facePlaneCull; |
| 1730 |
extern cvar_t *r_nocurves; |
| 1731 |
extern cvar_t *r_showcluster; |
| 1732 |
|
| 1733 |
extern cvar_t *r_gamma; |
| 1734 |
extern cvar_t *r_displayRefresh; |
| 1735 |
|
| 1736 |
extern cvar_t *r_ext_framebuffer_object; |
| 1737 |
extern cvar_t *r_ext_texture_float; |
| 1738 |
extern cvar_t *r_ext_framebuffer_multisample; |
| 1739 |
extern cvar_t *r_arb_seamless_cube_map; |
| 1740 |
extern cvar_t *r_arb_vertex_array_object; |
| 1741 |
extern cvar_t *r_ext_direct_state_access; |
| 1742 |
|
| 1743 |
extern cvar_t *r_nobind; |
| 1744 |
extern cvar_t *r_singleShader; |
| 1745 |
extern cvar_t *r_roundImagesDown; |
| 1746 |
extern cvar_t *r_colorMipLevels; |
| 1747 |
extern cvar_t *r_picmip; |
| 1748 |
extern cvar_t *r_finish; |
| 1749 |
extern cvar_t *r_textureMode; |
| 1750 |
extern cvar_t *r_offsetFactor; |
| 1751 |
extern cvar_t *r_offsetUnits; |
| 1752 |
|
| 1753 |
extern cvar_t *r_fullbright; |
| 1754 |
extern cvar_t *r_lightmap; |
| 1755 |
extern cvar_t *r_vertexLight; |
| 1756 |
extern cvar_t *r_uiFullScreen; |
| 1757 |
|
| 1758 |
extern cvar_t *r_logFile; |
| 1759 |
extern cvar_t *r_showtris; |
| 1760 |
extern cvar_t *r_showsky; |
| 1761 |
extern cvar_t *r_shownormals; |
| 1762 |
extern cvar_t *r_clear; |
| 1763 |
|
| 1764 |
extern cvar_t *r_shadows; |
| 1765 |
extern cvar_t *r_flares; |
| 1766 |
|
| 1767 |
extern cvar_t *r_intensity; |
| 1768 |
|
| 1769 |
extern cvar_t *r_lockpvs; |
| 1770 |
extern cvar_t *r_noportals; |
| 1771 |
extern cvar_t *r_portalOnly; |
| 1772 |
|
| 1773 |
extern cvar_t *r_subdivisions; |
| 1774 |
extern cvar_t *r_lodCurveError; |
| 1775 |
extern cvar_t *r_skipBackEnd; |
| 1776 |
|
| 1777 |
extern cvar_t *r_anaglyphMode; |
| 1778 |
|
| 1779 |
extern cvar_t *r_externalGLSL; |
| 1780 |
|
| 1781 |
extern cvar_t *r_hdr; |
| 1782 |
extern cvar_t *r_floatLightmap; |
| 1783 |
extern cvar_t *r_postProcess; |
| 1784 |
|
| 1785 |
extern cvar_t *r_toneMap; |
| 1786 |
extern cvar_t *r_forceToneMap; |
| 1787 |
extern cvar_t *r_forceToneMapMin; |
| 1788 |
extern cvar_t *r_forceToneMapAvg; |
| 1789 |
extern cvar_t *r_forceToneMapMax; |
| 1790 |
|
| 1791 |
extern cvar_t *r_autoExposure; |
| 1792 |
extern cvar_t *r_forceAutoExposure; |
| 1793 |
extern cvar_t *r_forceAutoExposureMin; |
| 1794 |
extern cvar_t *r_forceAutoExposureMax; |
| 1795 |
|
| 1796 |
extern cvar_t *r_cameraExposure; |
| 1797 |
|
| 1798 |
extern cvar_t *r_depthPrepass; |
| 1799 |
extern cvar_t *r_ssao; |
| 1800 |
|
| 1801 |
extern cvar_t *r_normalMapping; |
| 1802 |
extern cvar_t *r_specularMapping; |
| 1803 |
extern cvar_t *r_deluxeMapping; |
| 1804 |
extern cvar_t *r_parallaxMapping; |
| 1805 |
extern cvar_t *r_parallaxMapOffset; |
| 1806 |
extern cvar_t *r_parallaxMapShadows; |
| 1807 |
extern cvar_t *r_cubeMapping; |
| 1808 |
extern cvar_t *r_cubemapSize; |
| 1809 |
extern cvar_t *r_deluxeSpecular; |
| 1810 |
extern cvar_t *r_pbr; |
| 1811 |
extern cvar_t *r_baseNormalX; |
| 1812 |
extern cvar_t *r_baseNormalY; |
| 1813 |
extern cvar_t *r_baseParallax; |
| 1814 |
extern cvar_t *r_baseSpecular; |
| 1815 |
extern cvar_t *r_baseGloss; |
| 1816 |
extern cvar_t *r_glossType; |
| 1817 |
extern cvar_t *r_dlightMode; |
| 1818 |
extern cvar_t *r_pshadowDist; |
| 1819 |
extern cvar_t *r_mergeLightmaps; |
| 1820 |
extern cvar_t *r_imageUpsample; |
| 1821 |
extern cvar_t *r_imageUpsampleMaxSize; |
| 1822 |
extern cvar_t *r_imageUpsampleType; |
| 1823 |
extern cvar_t *r_genNormalMaps; |
| 1824 |
extern cvar_t *r_forceSun; |
| 1825 |
extern cvar_t *r_forceSunLightScale; |
| 1826 |
extern cvar_t *r_forceSunAmbientScale; |
| 1827 |
extern cvar_t *r_sunlightMode; |
| 1828 |
extern cvar_t *r_drawSunRays; |
| 1829 |
extern cvar_t *r_sunShadows; |
| 1830 |
extern cvar_t *r_shadowFilter; |
| 1831 |
extern cvar_t *r_shadowBlur; |
| 1832 |
extern cvar_t *r_shadowMapSize; |
| 1833 |
extern cvar_t *r_shadowCascadeZNear; |
| 1834 |
extern cvar_t *r_shadowCascadeZFar; |
| 1835 |
extern cvar_t *r_shadowCascadeZBias; |
| 1836 |
extern cvar_t *r_ignoreDstAlpha; |
| 1837 |
|
| 1838 |
extern cvar_t *r_greyscale; |
| 1839 |
|
| 1840 |
extern cvar_t *r_ignoreGLErrors; |
| 1841 |
|
| 1842 |
extern cvar_t *r_overBrightBits; |
| 1843 |
extern cvar_t *r_mapOverBrightBits; |
| 1844 |
|
| 1845 |
extern cvar_t *r_debugSurface; |
| 1846 |
extern cvar_t *r_simpleMipMaps; |
| 1847 |
|
| 1848 |
extern cvar_t *r_showImages; |
| 1849 |
extern cvar_t *r_debugSort; |
| 1850 |
|
| 1851 |
extern cvar_t *r_printShaders; |
| 1852 |
|
| 1853 |
extern cvar_t *r_marksOnTriangleMeshes; |
| 1854 |
|
| 1855 |
extern cvar_t *r_vaoCache; |
| 1856 |
|
| 1857 |
|
| 1858 |
|
| 1859 |
static ID_INLINE qboolean ShaderRequiresCPUDeforms(const shader_t * shader) |
| 1860 |
{ |
| 1861 |
if(shader->numDeforms) |
| 1862 |
{ |
| 1863 |
const deformStage_t *ds = &shader->deforms[0]; |
| 1864 |
|
| 1865 |
if (shader->numDeforms > 1) |
| 1866 |
return qtrue; |
| 1867 |
|
| 1868 |
switch (ds->deformation) |
| 1869 |
{ |
| 1870 |
case DEFORM_WAVE: |
| 1871 |
case DEFORM_BULGE: |
| 1872 |
|
| 1873 |
return ( backEnd.refdef.floatTime != (float)backEnd.refdef.floatTime ); |
| 1874 |
|
| 1875 |
default: |
| 1876 |
return qtrue; |
| 1877 |
} |
| 1878 |
} |
| 1879 |
|
| 1880 |
return qfalse; |
| 1881 |
} |
| 1882 |
|
| 1883 |
|
| 1884 |
|
| 1885 |
void R_SwapBuffers( int ); |
| 1886 |
|
| 1887 |
void R_RenderView( viewParms_t *parms ); |
| 1888 |
void R_RenderDlightCubemaps(const refdef_t *fd); |
| 1889 |
void R_RenderPshadowMaps(const refdef_t *fd); |
| 1890 |
void R_RenderSunShadowMaps(const refdef_t *fd, int level); |
| 1891 |
void R_RenderCubemapSide( int cubemapIndex, int cubemapSide, qboolean subscene ); |
| 1892 |
|
| 1893 |
void R_AddMD3Surfaces( trRefEntity_t *e ); |
| 1894 |
void R_AddNullModelSurfaces( trRefEntity_t *e ); |
| 1895 |
void R_AddBeamSurfaces( trRefEntity_t *e ); |
| 1896 |
void R_AddRailSurfaces( trRefEntity_t *e, qboolean isUnderwater ); |
| 1897 |
void R_AddLightningBoltSurfaces( trRefEntity_t *e ); |
| 1898 |
|
| 1899 |
void R_AddPolygonSurfaces( void ); |
| 1900 |
|
| 1901 |
void R_DecomposeSort( unsigned sort, int *entityNum, shader_t **shader, |
| 1902 |
int *fogNum, int *dlightMap, int *pshadowMap ); |
| 1903 |
|
| 1904 |
void R_AddDrawSurf( surfaceType_t *surface, shader_t *shader, |
| 1905 |
int fogIndex, int dlightMap, int pshadowMap, int cubemap ); |
| 1906 |
|
| 1907 |
void R_CalcTexDirs(vec3_t sdir, vec3_t tdir, const vec3_t v1, const vec3_t v2, |
| 1908 |
const vec3_t v3, const vec2_t w1, const vec2_t w2, const vec2_t w3); |
| 1909 |
vec_t R_CalcTangentSpace(vec3_t tangent, vec3_t bitangent, const vec3_t normal, const vec3_t sdir, const vec3_t tdir); |
| 1910 |
qboolean R_CalcTangentVectors(srfVert_t * dv[3]); |
| 1911 |
|
| 1912 |
#define CULL_IN 0 // completely unclipped |
| 1913 |
#define CULL_CLIP 1 // clipped by one or more planes |
| 1914 |
#define CULL_OUT 2 // completely outside the clipping planes |
| 1915 |
void R_LocalNormalToWorld (const vec3_t local, vec3_t world); |
| 1916 |
void R_LocalPointToWorld (const vec3_t local, vec3_t world); |
| 1917 |
int R_CullBox (vec3_t bounds[2]); |
| 1918 |
int R_CullLocalBox (vec3_t bounds[2]); |
| 1919 |
int R_CullPointAndRadiusEx( const vec3_t origin, float radius, const cplane_t* frustum, int numPlanes ); |
| 1920 |
int R_CullPointAndRadius( const vec3_t origin, float radius ); |
| 1921 |
int R_CullLocalPointAndRadius( const vec3_t origin, float radius ); |
| 1922 |
|
| 1923 |
void R_SetupProjection(viewParms_t *dest, float zProj, float zFar, qboolean computeFrustum); |
| 1924 |
void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms, orientationr_t *or ); |
| 1925 |
|
| 1926 |
|
| 1927 |
|
| 1928 |
|
| 1929 |
void GL_BindToTMU( image_t *image, int tmu ); |
| 1930 |
void GL_SetDefaultState (void); |
| 1931 |
void GL_TextureMode( const char *string ); |
| 1932 |
void GL_CheckErrs( char *file, int line ); |
| 1933 |
#define GL_CheckErrors(...) GL_CheckErrs(__FILE__, __LINE__) |
| 1934 |
void GL_State( unsigned long stateVector ); |
| 1935 |
void GL_SetProjectionMatrix(mat4_t matrix); |
| 1936 |
void GL_SetModelviewMatrix(mat4_t matrix); |
| 1937 |
void GL_Cull( int cullType ); |
| 1938 |
|
| 1939 |
#define GLS_SRCBLEND_ZERO 0x00000001 |
| 1940 |
#define GLS_SRCBLEND_ONE 0x00000002 |
| 1941 |
#define GLS_SRCBLEND_DST_COLOR 0x00000003 |
| 1942 |
#define GLS_SRCBLEND_ONE_MINUS_DST_COLOR 0x00000004 |
| 1943 |
#define GLS_SRCBLEND_SRC_ALPHA 0x00000005 |
| 1944 |
#define GLS_SRCBLEND_ONE_MINUS_SRC_ALPHA 0x00000006 |
| 1945 |
#define GLS_SRCBLEND_DST_ALPHA 0x00000007 |
| 1946 |
#define GLS_SRCBLEND_ONE_MINUS_DST_ALPHA 0x00000008 |
| 1947 |
#define GLS_SRCBLEND_ALPHA_SATURATE 0x00000009 |
| 1948 |
#define GLS_SRCBLEND_BITS 0x0000000f |
| 1949 |
|
| 1950 |
#define GLS_DSTBLEND_ZERO 0x00000010 |
| 1951 |
#define GLS_DSTBLEND_ONE 0x00000020 |
| 1952 |
#define GLS_DSTBLEND_SRC_COLOR 0x00000030 |
| 1953 |
#define GLS_DSTBLEND_ONE_MINUS_SRC_COLOR 0x00000040 |
| 1954 |
#define GLS_DSTBLEND_SRC_ALPHA 0x00000050 |
| 1955 |
#define GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA 0x00000060 |
| 1956 |
#define GLS_DSTBLEND_DST_ALPHA 0x00000070 |
| 1957 |
#define GLS_DSTBLEND_ONE_MINUS_DST_ALPHA 0x00000080 |
| 1958 |
#define GLS_DSTBLEND_BITS 0x000000f0 |
| 1959 |
|
| 1960 |
#define GLS_DEPTHMASK_TRUE 0x00000100 |
| 1961 |
|
| 1962 |
#define GLS_POLYMODE_LINE 0x00001000 |
| 1963 |
|
| 1964 |
#define GLS_DEPTHTEST_DISABLE 0x00010000 |
| 1965 |
#define GLS_DEPTHFUNC_EQUAL 0x00020000 |
| 1966 |
#define GLS_DEPTHFUNC_GREATER 0x00040000 |
| 1967 |
#define GLS_DEPTHFUNC_BITS 0x00060000 |
| 1968 |
|
| 1969 |
#define GLS_ATEST_GT_0 0x10000000 |
| 1970 |
#define GLS_ATEST_LT_80 0x20000000 |
| 1971 |
#define GLS_ATEST_GE_80 0x40000000 |
| 1972 |
#define GLS_ATEST_BITS 0x70000000 |
| 1973 |
|
| 1974 |
#define GLS_DEFAULT GLS_DEPTHMASK_TRUE |
| 1975 |
|
| 1976 |
void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty); |
| 1977 |
void RE_UploadCinematic (int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty); |
| 1978 |
|
| 1979 |
void RE_BeginFrame( stereoFrame_t stereoFrame ); |
| 1980 |
void RE_BeginRegistration( glconfig_t *glconfig ); |
| 1981 |
void RE_LoadWorldMap( const char *mapname ); |
| 1982 |
void RE_SetWorldVisData( const byte *vis ); |
| 1983 |
qhandle_t RE_RegisterModel( const char *name ); |
| 1984 |
qhandle_t RE_RegisterSkin( const char *name ); |
| 1985 |
void RE_Shutdown( qboolean destroyWindow ); |
| 1986 |
|
| 1987 |
qboolean R_GetEntityToken( char *buffer, int size ); |
| 1988 |
|
| 1989 |
model_t *R_AllocModel( void ); |
| 1990 |
|
| 1991 |
void R_Init( void ); |
| 1992 |
void R_UpdateSubImage( image_t *image, byte *pic, int x, int y, int width, int height, GLenum picFormat ); |
| 1993 |
|
| 1994 |
void R_SetColorMappings( void ); |
| 1995 |
void R_GammaCorrect( byte *buffer, int bufSize ); |
| 1996 |
|
| 1997 |
void R_ImageList_f( void ); |
| 1998 |
void R_SkinList_f( void ); |
| 1999 |
|
| 2000 |
const void *RB_TakeScreenshotCmd( const void *data ); |
| 2001 |
void R_ScreenShot_f( void ); |
| 2002 |
|
| 2003 |
void R_InitFogTable( void ); |
| 2004 |
float R_FogFactor( float s, float t ); |
| 2005 |
void R_InitImages( void ); |
| 2006 |
void R_DeleteTextures( void ); |
| 2007 |
int R_SumOfUsedImages( void ); |
| 2008 |
void R_InitSkins( void ); |
| 2009 |
skin_t *R_GetSkinByHandle( qhandle_t hSkin ); |
| 2010 |
|
| 2011 |
int R_ComputeLOD( trRefEntity_t *ent ); |
| 2012 |
|
| 2013 |
const void *RB_TakeVideoFrameCmd( const void *data ); |
| 2014 |
|
| 2015 |
|
| 2016 |
|
| 2017 |
|
| 2018 |
shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImage ); |
| 2019 |
shader_t *R_FindShaderEx( const char *name, int lightmapIndex, qboolean mipRawImage, int realLightmapIndex ); |
| 2020 |
shader_t *R_GetShaderByHandle( qhandle_t hShader ); |
| 2021 |
shader_t *R_GetShaderByState( int index, long *cycleTime ); |
| 2022 |
shader_t *R_FindShaderByName( const char *name ); |
| 2023 |
void R_InitShaders( void ); |
| 2024 |
void R_ShaderList_f( void ); |
| 2025 |
void R_RemapShader(const char *oldShader, const char *newShader, const char *timeOffset); |
| 2026 |
|
| 2027 |
|
| 2028 |
|
| 2029 |
|
| 2030 |
|
| 2031 |
|
| 2032 |
|
| 2033 |
|
| 2034 |
|
| 2035 |
void GLimp_InitExtraExtensions( void ); |
| 2036 |
|
| 2037 |
|
| 2038 |
|
| 2039 |
|
| 2040 |
|
| 2041 |
|
| 2042 |
|
| 2043 |
|
| 2044 |
|
| 2045 |
typedef struct stageVars |
| 2046 |
{ |
| 2047 |
color4ub_t colors[SHADER_MAX_VERTEXES]; |
| 2048 |
vec2_t texcoords[NUM_TEXTURE_BUNDLES][SHADER_MAX_VERTEXES]; |
| 2049 |
} stageVars_t; |
| 2050 |
|
| 2051 |
typedef struct shaderCommands_s |
| 2052 |
{ |
| 2053 |
glIndex_t indexes[SHADER_MAX_INDEXES] Q_ALIGN(16); |
| 2054 |
vec4_t xyz[SHADER_MAX_VERTEXES] Q_ALIGN(16); |
| 2055 |
int16_t normal[SHADER_MAX_VERTEXES][4] Q_ALIGN(16); |
| 2056 |
int16_t tangent[SHADER_MAX_VERTEXES][4] Q_ALIGN(16); |
| 2057 |
vec2_t texCoords[SHADER_MAX_VERTEXES] Q_ALIGN(16); |
| 2058 |
vec2_t lightCoords[SHADER_MAX_VERTEXES] Q_ALIGN(16); |
| 2059 |
uint16_t color[SHADER_MAX_VERTEXES][4] Q_ALIGN(16); |
| 2060 |
int16_t lightdir[SHADER_MAX_VERTEXES][4] Q_ALIGN(16); |
| 2061 |
|
| 2062 |
|
| 2063 |
void *attribPointers[ATTR_INDEX_COUNT]; |
| 2064 |
vao_t *vao; |
| 2065 |
qboolean useInternalVao; |
| 2066 |
qboolean useCacheVao; |
| 2067 |
|
| 2068 |
stageVars_t svars Q_ALIGN(16); |
| 2069 |
|
| 2070 |
|
| 2071 |
|
| 2072 |
shader_t *shader; |
| 2073 |
double shaderTime; |
| 2074 |
int fogNum; |
| 2075 |
int cubemapIndex; |
| 2076 |
|
| 2077 |
int dlightBits; |
| 2078 |
int pshadowBits; |
| 2079 |
|
| 2080 |
int firstIndex; |
| 2081 |
int numIndexes; |
| 2082 |
int numVertexes; |
| 2083 |
|
| 2084 |
|
| 2085 |
int numPasses; |
| 2086 |
void (*currentStageIteratorFunc)( void ); |
| 2087 |
shaderStage_t **xstages; |
| 2088 |
} shaderCommands_t; |
| 2089 |
|
| 2090 |
extern shaderCommands_t tess; |
| 2091 |
|
| 2092 |
void RB_BeginSurface(shader_t *shader, int fogNum, int cubemapIndex ); |
| 2093 |
void RB_EndSurface(void); |
| 2094 |
void RB_CheckOverflow( int verts, int indexes ); |
| 2095 |
#define RB_CHECKOVERFLOW(v,i) if (tess.numVertexes + (v) >= SHADER_MAX_VERTEXES || tess.numIndexes + (i) >= SHADER_MAX_INDEXES ) {RB_CheckOverflow(v,i);} |
| 2096 |
|
| 2097 |
void R_DrawElements( int numIndexes, int firstIndex ); |
| 2098 |
void RB_StageIteratorGeneric( void ); |
| 2099 |
void RB_StageIteratorSky( void ); |
| 2100 |
void RB_StageIteratorVertexLitTexture( void ); |
| 2101 |
void RB_StageIteratorLightmappedMultitexture( void ); |
| 2102 |
|
| 2103 |
void RB_AddQuadStamp( vec3_t origin, vec3_t left, vec3_t up, float color[4] ); |
| 2104 |
void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, float color[4], float s1, float t1, float s2, float t2 ); |
| 2105 |
void RB_InstantQuad( vec4_t quadVerts[4] ); |
| 2106 |
|
| 2107 |
void RB_InstantQuad2(vec4_t quadVerts[4], vec2_t texCoords[4]); |
| 2108 |
|
| 2109 |
void RB_ShowImages( void ); |
| 2110 |
|
| 2111 |
|
| 2112 |
|
| 2113 |
|
| 2114 |
|
| 2115 |
|
| 2116 |
|
| 2117 |
|
| 2118 |
|
| 2119 |
|
| 2120 |
void R_AddBrushModelSurfaces( trRefEntity_t *e ); |
| 2121 |
void R_AddWorldSurfaces( void ); |
| 2122 |
qboolean R_inPVS( const vec3_t p1, const vec3_t p2 ); |
| 2123 |
|
| 2124 |
|
| 2125 |
|
| 2126 |
|
| 2127 |
|
| 2128 |
|
| 2129 |
|
| 2130 |
|
| 2131 |
|
| 2132 |
|
| 2133 |
void R_ClearFlares( void ); |
| 2134 |
|
| 2135 |
void RB_AddFlare( void *surface, int fogNum, vec3_t point, vec3_t color, vec3_t normal ); |
| 2136 |
void RB_AddDlightFlares( void ); |
| 2137 |
void RB_RenderFlares (void); |
| 2138 |
|
| 2139 |
|
| 2140 |
|
| 2141 |
|
| 2142 |
|
| 2143 |
|
| 2144 |
|
| 2145 |
|
| 2146 |
|
| 2147 |
void R_DlightBmodel( bmodel_t *bmodel ); |
| 2148 |
void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ); |
| 2149 |
void R_TransformDlights( int count, dlight_t *dl, orientationr_t *or ); |
| 2150 |
int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir ); |
| 2151 |
int R_LightDirForPoint( vec3_t point, vec3_t lightDir, vec3_t normal, world_t *world ); |
| 2152 |
int R_CubemapForPoint( vec3_t point ); |
| 2153 |
|
| 2154 |
|
| 2155 |
|
| 2156 |
|
| 2157 |
|
| 2158 |
|
| 2159 |
|
| 2160 |
|
| 2161 |
|
| 2162 |
|
| 2163 |
void RB_ShadowTessEnd( void ); |
| 2164 |
void RB_ShadowFinish( void ); |
| 2165 |
void RB_ProjectionShadowDeform( void ); |
| 2166 |
|
| 2167 |
|
| 2168 |
|
| 2169 |
|
| 2170 |
|
| 2171 |
|
| 2172 |
|
| 2173 |
|
| 2174 |
|
| 2175 |
void R_BuildCloudData( shaderCommands_t *shader ); |
| 2176 |
void R_InitSkyTexCoords( float cloudLayerHeight ); |
| 2177 |
void R_DrawSkyBox( shaderCommands_t *shader ); |
| 2178 |
void RB_DrawSun( float scale, shader_t *shader ); |
| 2179 |
void RB_ClipSkyPolygons( shaderCommands_t *shader ); |
| 2180 |
|
| 2181 |
|
| 2182 |
|
| 2183 |
|
| 2184 |
|
| 2185 |
|
| 2186 |
|
| 2187 |
|
| 2188 |
|
| 2189 |
#define PATCH_STITCHING |
| 2190 |
|
| 2191 |
void R_SubdividePatchToGrid( srfBspSurface_t *grid, int width, int height, |
| 2192 |
srfVert_t points[MAX_PATCH_SIZE*MAX_PATCH_SIZE] ); |
| 2193 |
void R_GridInsertColumn( srfBspSurface_t *grid, int column, int row, vec3_t point, float loderror ); |
| 2194 |
void R_GridInsertRow( srfBspSurface_t *grid, int row, int column, vec3_t point, float loderror ); |
| 2195 |
|
| 2196 |
|
| 2197 |
|
| 2198 |
|
| 2199 |
|
| 2200 |
|
| 2201 |
|
| 2202 |
|
| 2203 |
|
| 2204 |
int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projection, |
| 2205 |
int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t *fragmentBuffer ); |
| 2206 |
|
| 2207 |
|
| 2208 |
|
| 2209 |
|
| 2210 |
|
| 2211 |
|
| 2212 |
|
| 2213 |
|
| 2214 |
|
| 2215 |
|
| 2216 |
void R_VaoPackTangent(int16_t *out, vec4_t v); |
| 2217 |
void R_VaoPackNormal(int16_t *out, vec3_t v); |
| 2218 |
void R_VaoPackColor(uint16_t *out, vec4_t c); |
| 2219 |
void R_VaoUnpackTangent(vec4_t v, int16_t *pack); |
| 2220 |
void R_VaoUnpackNormal(vec3_t v, int16_t *pack); |
| 2221 |
|
| 2222 |
vao_t *R_CreateVao(const char *name, byte *vertexes, int vertexesSize, byte *indexes, int indexesSize, vaoUsage_t usage); |
| 2223 |
vao_t *R_CreateVao2(const char *name, int numVertexes, srfVert_t *verts, int numIndexes, glIndex_t *inIndexes); |
| 2224 |
|
| 2225 |
void R_BindVao(vao_t *vao); |
| 2226 |
void R_BindNullVao(void); |
| 2227 |
|
| 2228 |
void Vao_SetVertexPointers(vao_t *vao); |
| 2229 |
|
| 2230 |
void R_InitVaos(void); |
| 2231 |
void R_ShutdownVaos(void); |
| 2232 |
void R_VaoList_f(void); |
| 2233 |
|
| 2234 |
void RB_UpdateTessVao(unsigned int attribBits); |
| 2235 |
|
| 2236 |
void VaoCache_Commit(void); |
| 2237 |
void VaoCache_DrawElements(int numIndexes, int firstIndex); |
| 2238 |
void VaoCache_Init(void); |
| 2239 |
void VaoCache_BindVao(void); |
| 2240 |
void VaoCache_CheckAdd(qboolean *endSurface, qboolean *recycleVertexBuffer, qboolean *recycleIndexBuffer, int numVerts, int numIndexes); |
| 2241 |
void VaoCache_RecycleVertexBuffer(void); |
| 2242 |
void VaoCache_RecycleIndexBuffer(void); |
| 2243 |
void VaoCache_InitQueue(void); |
| 2244 |
void VaoCache_AddSurface(srfVert_t *verts, int numVerts, glIndex_t *indexes, int numIndexes); |
| 2245 |
|
| 2246 |
|
| 2247 |
|
| 2248 |
|
| 2249 |
|
| 2250 |
|
| 2251 |
|
| 2252 |
|
| 2253 |
|
| 2254 |
void GLSL_InitGPUShaders(void); |
| 2255 |
void GLSL_ShutdownGPUShaders(void); |
| 2256 |
void GLSL_VertexAttribPointers(uint32_t attribBits); |
| 2257 |
void GLSL_BindProgram(shaderProgram_t * program); |
| 2258 |
|
| 2259 |
void GLSL_SetUniformInt(shaderProgram_t *program, int uniformNum, GLint value); |
| 2260 |
void GLSL_SetUniformFloat(shaderProgram_t *program, int uniformNum, GLfloat value); |
| 2261 |
void GLSL_SetUniformFloat5(shaderProgram_t *program, int uniformNum, const vec5_t v); |
| 2262 |
void GLSL_SetUniformVec2(shaderProgram_t *program, int uniformNum, const vec2_t v); |
| 2263 |
void GLSL_SetUniformVec3(shaderProgram_t *program, int uniformNum, const vec3_t v); |
| 2264 |
void GLSL_SetUniformVec4(shaderProgram_t *program, int uniformNum, const vec4_t v); |
| 2265 |
void GLSL_SetUniformMat4(shaderProgram_t *program, int uniformNum, const mat4_t matrix); |
| 2266 |
void GLSL_SetUniformMat4BoneMatrix(shaderProgram_t *program, int uniformNum, mat4_t *matrix, int numMatricies); |
| 2267 |
|
| 2268 |
shaderProgram_t *GLSL_GetGenericShaderProgram(int stage); |
| 2269 |
|
| 2270 |
|
| 2271 |
|
| 2272 |
|
| 2273 |
|
| 2274 |
|
| 2275 |
|
| 2276 |
|
| 2277 |
|
| 2278 |
void R_InitNextFrame( void ); |
| 2279 |
|
| 2280 |
void RE_ClearScene( void ); |
| 2281 |
void RE_AddRefEntityToScene( const refEntity_t *ent ); |
| 2282 |
void RE_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts, int num ); |
| 2283 |
void RE_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b ); |
| 2284 |
void RE_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b ); |
| 2285 |
void RE_BeginScene( const refdef_t *fd ); |
| 2286 |
void RE_RenderScene( const refdef_t *fd ); |
| 2287 |
void RE_EndScene( void ); |
| 2288 |
|
| 2289 |
|
| 2290 |
|
| 2291 |
|
| 2292 |
|
| 2293 |
|
| 2294 |
|
| 2295 |
|
| 2296 |
|
| 2297 |
#define MC_BITS_X (16) |
| 2298 |
#define MC_BITS_Y (16) |
| 2299 |
#define MC_BITS_Z (16) |
| 2300 |
#define MC_BITS_VECT (16) |
| 2301 |
|
| 2302 |
#define MC_SCALE_X (1.0f/64) |
| 2303 |
#define MC_SCALE_Y (1.0f/64) |
| 2304 |
#define MC_SCALE_Z (1.0f/64) |
| 2305 |
|
| 2306 |
void MC_UnCompress(float mat[3][4],const unsigned char * comp); |
| 2307 |
|
| 2308 |
|
| 2309 |
|
| 2310 |
|
| 2311 |
|
| 2312 |
|
| 2313 |
|
| 2314 |
|
| 2315 |
|
| 2316 |
void R_MDRAddAnimSurfaces( trRefEntity_t *ent ); |
| 2317 |
void RB_MDRSurfaceAnim( mdrSurface_t *surface ); |
| 2318 |
qboolean R_LoadIQM (model_t *mod, void *buffer, int filesize, const char *name ); |
| 2319 |
void R_AddIQMSurfaces( trRefEntity_t *ent ); |
| 2320 |
void RB_IQMSurfaceAnim( surfaceType_t *surface ); |
| 2321 |
void RB_IQMSurfaceAnimVao( srfVaoIQModel_t *surface ); |
| 2322 |
int R_IQMLerpTag( orientation_t *tag, iqmData_t *data, |
| 2323 |
int startFrame, int endFrame, |
| 2324 |
float frac, const char *tagName ); |
| 2325 |
|
| 2326 |
|
| 2327 |
|
| 2328 |
|
| 2329 |
|
| 2330 |
void R_TransformModelToClip( const vec3_t src, const float *modelMatrix, const float *projectionMatrix, |
| 2331 |
vec4_t eye, vec4_t dst ); |
| 2332 |
void R_TransformClipToWindow( const vec4_t clip, const viewParms_t *view, vec4_t normalized, vec4_t window ); |
| 2333 |
|
| 2334 |
void RB_DeformTessGeometry( void ); |
| 2335 |
|
| 2336 |
void RB_CalcFogTexCoords( float *dstTexCoords ); |
| 2337 |
|
| 2338 |
void RB_CalcScaleTexMatrix( const float scale[2], float *matrix ); |
| 2339 |
void RB_CalcScrollTexMatrix( const float scrollSpeed[2], float *matrix ); |
| 2340 |
void RB_CalcRotateTexMatrix( float degsPerSecond, float *matrix ); |
| 2341 |
void RB_CalcTurbulentFactors( const waveForm_t *wf, float *amplitude, float *now ); |
| 2342 |
void RB_CalcTransformTexMatrix( const texModInfo_t *tmi, float *matrix ); |
| 2343 |
void RB_CalcStretchTexMatrix( const waveForm_t *wf, float *matrix ); |
| 2344 |
|
| 2345 |
void RB_CalcModulateColorsByFog( unsigned char *dstColors ); |
| 2346 |
float RB_CalcWaveAlphaSingle( const waveForm_t *wf ); |
| 2347 |
float RB_CalcWaveColorSingle( const waveForm_t *wf ); |
| 2348 |
|
| 2349 |
|
| 2350 |
|
| 2351 |
|
| 2352 |
|
| 2353 |
|
| 2354 |
|
| 2355 |
|
| 2356 |
|
| 2357 |
void RB_ExecuteRenderCommands( const void *data ); |
| 2358 |
|
| 2359 |
|
| 2360 |
|
| 2361 |
|
| 2362 |
|
| 2363 |
|
| 2364 |
|
| 2365 |
|
| 2366 |
|
| 2367 |
#define MAX_RENDER_COMMANDS 0x80000 |
| 2368 |
|
| 2369 |
typedef struct { |
| 2370 |
byte cmds[MAX_RENDER_COMMANDS]; |
| 2371 |
int used; |
| 2372 |
} renderCommandList_t; |
| 2373 |
|
| 2374 |
typedef struct { |
| 2375 |
int commandId; |
| 2376 |
float color[4]; |
| 2377 |
} setColorCommand_t; |
| 2378 |
|
| 2379 |
typedef struct { |
| 2380 |
int commandId; |
| 2381 |
int buffer; |
| 2382 |
} drawBufferCommand_t; |
| 2383 |
|
| 2384 |
typedef struct { |
| 2385 |
int commandId; |
| 2386 |
image_t *image; |
| 2387 |
int width; |
| 2388 |
int height; |
| 2389 |
void *data; |
| 2390 |
} subImageCommand_t; |
| 2391 |
|
| 2392 |
typedef struct { |
| 2393 |
int commandId; |
| 2394 |
} swapBuffersCommand_t; |
| 2395 |
|
| 2396 |
typedef struct { |
| 2397 |
int commandId; |
| 2398 |
int buffer; |
| 2399 |
} endFrameCommand_t; |
| 2400 |
|
| 2401 |
typedef struct { |
| 2402 |
int commandId; |
| 2403 |
shader_t *shader; |
| 2404 |
float x, y; |
| 2405 |
float w, h; |
| 2406 |
float s1, t1; |
| 2407 |
float s2, t2; |
| 2408 |
} stretchPicCommand_t; |
| 2409 |
|
| 2410 |
typedef struct { |
| 2411 |
int commandId; |
| 2412 |
trRefdef_t refdef; |
| 2413 |
viewParms_t viewParms; |
| 2414 |
drawSurf_t *drawSurfs; |
| 2415 |
int numDrawSurfs; |
| 2416 |
} drawSurfsCommand_t; |
| 2417 |
|
| 2418 |
typedef struct { |
| 2419 |
int commandId; |
| 2420 |
int x; |
| 2421 |
int y; |
| 2422 |
int width; |
| 2423 |
int height; |
| 2424 |
char *fileName; |
| 2425 |
qboolean jpeg; |
| 2426 |
} screenshotCommand_t; |
| 2427 |
|
| 2428 |
typedef struct { |
| 2429 |
int commandId; |
| 2430 |
int width; |
| 2431 |
int height; |
| 2432 |
byte *captureBuffer; |
| 2433 |
byte *encodeBuffer; |
| 2434 |
qboolean motionJpeg; |
| 2435 |
} videoFrameCommand_t; |
| 2436 |
|
| 2437 |
typedef struct |
| 2438 |
{ |
| 2439 |
int commandId; |
| 2440 |
|
| 2441 |
GLboolean rgba[4]; |
| 2442 |
} colorMaskCommand_t; |
| 2443 |
|
| 2444 |
typedef struct |
| 2445 |
{ |
| 2446 |
int commandId; |
| 2447 |
} clearDepthCommand_t; |
| 2448 |
|
| 2449 |
typedef struct { |
| 2450 |
int commandId; |
| 2451 |
int map; |
| 2452 |
int cubeSide; |
| 2453 |
} capShadowmapCommand_t; |
| 2454 |
|
| 2455 |
typedef struct { |
| 2456 |
int commandId; |
| 2457 |
trRefdef_t refdef; |
| 2458 |
viewParms_t viewParms; |
| 2459 |
} postProcessCommand_t; |
| 2460 |
|
| 2461 |
typedef struct { |
| 2462 |
int commandId; |
| 2463 |
} exportCubemapsCommand_t; |
| 2464 |
|
| 2465 |
typedef enum { |
| 2466 |
RC_END_OF_LIST, |
| 2467 |
RC_SET_COLOR, |
| 2468 |
RC_STRETCH_PIC, |
| 2469 |
RC_DRAW_SURFS, |
| 2470 |
RC_DRAW_BUFFER, |
| 2471 |
RC_SWAP_BUFFERS, |
| 2472 |
RC_SCREENSHOT, |
| 2473 |
RC_VIDEOFRAME, |
| 2474 |
RC_COLORMASK, |
| 2475 |
RC_CLEARDEPTH, |
| 2476 |
RC_CAPSHADOWMAP, |
| 2477 |
RC_POSTPROCESS, |
| 2478 |
RC_EXPORT_CUBEMAPS |
| 2479 |
} renderCommand_t; |
| 2480 |
|
| 2481 |
|
| 2482 |
|
| 2483 |
|
| 2484 |
|
| 2485 |
#define MAX_POLYS 600 |
| 2486 |
#define MAX_POLYVERTS 3000 |
| 2487 |
|
| 2488 |
|
| 2489 |
|
| 2490 |
typedef struct { |
| 2491 |
drawSurf_t drawSurfs[MAX_DRAWSURFS]; |
| 2492 |
dlight_t dlights[MAX_DLIGHTS]; |
| 2493 |
trRefEntity_t entities[MAX_REFENTITIES]; |
| 2494 |
srfPoly_t *polys; |
| 2495 |
polyVert_t *polyVerts; |
| 2496 |
pshadow_t pshadows[MAX_CALC_PSHADOWS]; |
| 2497 |
renderCommandList_t commands; |
| 2498 |
} backEndData_t; |
| 2499 |
|
| 2500 |
extern int max_polys; |
| 2501 |
extern int max_polyverts; |
| 2502 |
|
| 2503 |
extern backEndData_t *backEndData; |
| 2504 |
|
| 2505 |
|
| 2506 |
void *R_GetCommandBuffer( int bytes ); |
| 2507 |
void RB_ExecuteRenderCommands( const void *data ); |
| 2508 |
|
| 2509 |
void R_IssuePendingRenderCommands( void ); |
| 2510 |
|
| 2511 |
void R_AddDrawSurfCmd( drawSurf_t *drawSurfs, int numDrawSurfs ); |
| 2512 |
void R_AddCapShadowmapCmd( int dlight, int cubeSide ); |
| 2513 |
void R_AddPostProcessCmd (void); |
| 2514 |
|
| 2515 |
void RE_SetColor( const float *rgba ); |
| 2516 |
void RE_StretchPic ( float x, float y, float w, float h, |
| 2517 |
float s1, float t1, float s2, float t2, qhandle_t hShader ); |
| 2518 |
void RE_BeginFrame( stereoFrame_t stereoFrame ); |
| 2519 |
void RE_EndFrame( int *frontEndMsec, int *backEndMsec ); |
| 2520 |
void RE_SaveJPG(char * filename, int quality, int image_width, int image_height, |
| 2521 |
unsigned char *image_buffer, int padding); |
| 2522 |
size_t RE_SaveJPGToBuffer(byte *buffer, size_t bufSize, int quality, |
| 2523 |
int image_width, int image_height, byte *image_buffer, int padding); |
| 2524 |
void RE_TakeVideoFrame( int width, int height, |
| 2525 |
byte *captureBuffer, byte *encodeBuffer, qboolean motionJpeg ); |
| 2526 |
|
| 2527 |
void R_ConvertTextureFormat( const byte *in, int width, int height, GLenum format, GLenum type, byte *out ); |
| 2528 |
|
| 2529 |
|
| 2530 |
#endif |