1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691
|
/*
===========================================================================
Return to Castle Wolfenstein multiplayer GPL Source Code
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
This file is part of the Return to Castle Wolfenstein multiplayer GPL Source Code (RTCW MP Source Code).
RTCW MP Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
RTCW MP Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with RTCW MP Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the RTCW MP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW MP Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "tr_local.h"
int r_firstSceneDrawSurf;
int r_numdlights;
int r_firstSceneDlight;
int r_numcoronas;
int r_firstSceneCorona;
int r_numentities;
int r_firstSceneEntity;
int r_numpolys;
int r_firstScenePoly;
int r_numpolyverts;
int skyboxportal;
/*
====================
R_InitNextFrame
====================
*/
void R_InitNextFrame( void ) {
backEndData->commands.used = 0;
r_firstSceneDrawSurf = 0;
r_numdlights = 0;
r_firstSceneDlight = 0;
r_numcoronas = 0;
r_firstSceneCorona = 0;
r_numentities = 0;
r_firstSceneEntity = 0;
r_numpolys = 0;
r_firstScenePoly = 0;
r_numpolyverts = 0;
}
/*
====================
RE_ClearScene
====================
*/
void RE_ClearScene( void ) {
r_firstSceneDlight = r_numdlights;
r_firstSceneCorona = r_numcoronas;
r_firstSceneEntity = r_numentities;
r_firstScenePoly = r_numpolys;
}
/*
===========================================================================
DISCRETE POLYS
===========================================================================
*/
/*
=====================
R_AddPolygonSurfaces
Adds all the scene's polys into this view's drawsurf list
=====================
*/
void R_AddPolygonSurfaces( void ) {
int i;
shader_t *sh;
srfPoly_t *poly;
int fogMask;
tr.currentEntityNum = REFENTITYNUM_WORLD;
tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT;
fogMask = -((tr.refdef.rdflags & RDF_NOFOG) == 0);
for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) {
sh = R_GetShaderByHandle( poly->hShader );
R_AddDrawSurf( ( void * )poly, sh, poly->fogIndex & fogMask, qfalse, qfalse, 0 /*cubeMap*/ );
}
}
/*
=====================
RE_AddPolyToScene
=====================
*/
void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts ) {
srfPoly_t *poly;
int i;
int fogIndex;
fog_t *fog;
vec3_t bounds[2];
if ( !tr.registered ) {
return;
}
if ( !hShader ) {
// This isn't a useful warning, and an hShader of zero isn't a null shader, it's
// the default shader.
//ri.Printf( PRINT_WARNING, "WARNING: RE_AddPolyToScene: NULL poly shader\n");
//return;
}
if ( ( ( r_numpolyverts + numVerts ) >= max_polyverts ) || ( r_numpolys >= max_polys ) ) {
return;
}
poly = &backEndData->polys[r_numpolys];
poly->surfaceType = SF_POLY;
poly->hShader = hShader;
poly->numVerts = numVerts;
poly->verts = &backEndData->polyVerts[r_numpolyverts];
memcpy( poly->verts, verts, numVerts * sizeof( *verts ) );
// Ridah
if ( glConfig.hardwareType == GLHW_RAGEPRO ) {
poly->verts->modulate[0] = 255;
poly->verts->modulate[1] = 255;
poly->verts->modulate[2] = 255;
poly->verts->modulate[3] = 255;
}
// done.
r_numpolys++;
r_numpolyverts += numVerts;
// see if it is in a fog volume
if ( tr.world->numfogs == 1 ) {
fogIndex = 0;
} else {
// find which fog volume the poly is in
VectorCopy( poly->verts[0].xyz, bounds[0] );
VectorCopy( poly->verts[0].xyz, bounds[1] );
for ( i = 1 ; i < poly->numVerts ; i++ ) {
AddPointToBounds( poly->verts[i].xyz, bounds[0], bounds[1] );
}
for ( fogIndex = 1 ; fogIndex < tr.world->numfogs ; fogIndex++ ) {
fog = &tr.world->fogs[fogIndex];
if ( bounds[1][0] >= fog->bounds[0][0]
&& bounds[1][1] >= fog->bounds[0][1]
&& bounds[1][2] >= fog->bounds[0][2]
&& bounds[0][0] <= fog->bounds[1][0]
&& bounds[0][1] <= fog->bounds[1][1]
&& bounds[0][2] <= fog->bounds[1][2] ) {
break;
}
}
if ( fogIndex == tr.world->numfogs ) {
fogIndex = 0;
}
}
poly->fogIndex = fogIndex;
}
// Ridah
/*
=====================
RE_AddPolysToScene
=====================
*/
void RE_AddPolysToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys ) {
srfPoly_t *poly;
int i;
int fogIndex;
fog_t *fog;
vec3_t bounds[2];
int j;
if ( !tr.registered ) {
return;
}
if ( !hShader ) {
ri.Printf( PRINT_WARNING, "WARNING: RE_AddPolysToScene: NULL poly shader\n" );
return;
}
for ( j = 0; j < numPolys; j++ ) {
if ( r_numpolyverts + numVerts >= max_polyverts || r_numpolys >= max_polys ) {
// ri.Printf( PRINT_WARNING, "WARNING: RE_AddPolysToScene: MAX_POLYS or MAX_POLYVERTS reached\n");
return;
}
poly = &backEndData->polys[r_numpolys];
poly->surfaceType = SF_POLY;
poly->hShader = hShader;
poly->numVerts = numVerts;
poly->verts = &backEndData->polyVerts[r_numpolyverts];
memcpy( poly->verts, &verts[numVerts * j], numVerts * sizeof( *verts ) );
// Ridah
if ( glConfig.hardwareType == GLHW_RAGEPRO ) {
poly->verts->modulate[0] = 255;
poly->verts->modulate[1] = 255;
poly->verts->modulate[2] = 255;
poly->verts->modulate[3] = 255;
}
// done.
r_numpolys++;
r_numpolyverts += numVerts;
// if no world is loaded
if ( tr.world == NULL ) {
fogIndex = 0;
}
// see if it is in a fog volume
else if ( tr.world->numfogs == 1 ) {
fogIndex = 0;
} else {
// find which fog volume the poly is in
VectorCopy( poly->verts[0].xyz, bounds[0] );
VectorCopy( poly->verts[0].xyz, bounds[1] );
for ( i = 1 ; i < poly->numVerts ; i++ ) {
AddPointToBounds( poly->verts[i].xyz, bounds[0], bounds[1] );
}
for ( fogIndex = 1 ; fogIndex < tr.world->numfogs ; fogIndex++ ) {
fog = &tr.world->fogs[fogIndex];
if ( bounds[1][0] >= fog->bounds[0][0]
&& bounds[1][1] >= fog->bounds[0][1]
&& bounds[1][2] >= fog->bounds[0][2]
&& bounds[0][0] <= fog->bounds[1][0]
&& bounds[0][1] <= fog->bounds[1][1]
&& bounds[0][2] <= fog->bounds[1][2] ) {
break;
}
}
if ( fogIndex == tr.world->numfogs ) {
fogIndex = 0;
}
}
poly->fogIndex = fogIndex;
}
}
// done.
//=================================================================================
/*
=====================
RE_AddRefEntityToScene
=====================
*/
void RE_AddRefEntityToScene( const refEntity_t *ent ) {
vec3_t cross;
if ( !tr.registered ) {
return;
}
if ( r_numentities >= MAX_REFENTITIES ) {
ri.Printf(PRINT_DEVELOPER, "RE_AddRefEntityToScene: Dropping refEntity, reached MAX_REFENTITIES\n");
return;
}
if ( Q_isnan(ent->origin[0]) || Q_isnan(ent->origin[1]) || Q_isnan(ent->origin[2]) ) {
static qboolean firstTime = qtrue;
if (firstTime) {
firstTime = qfalse;
ri.Printf( PRINT_WARNING, "RE_AddRefEntityToScene passed a refEntity which has an origin with a NaN component\n");
}
return;
}
if ( (int)ent->reType < 0 || ent->reType >= RT_MAX_REF_ENTITY_TYPE ) {
ri.Error( ERR_DROP, "RE_AddRefEntityToScene: bad reType %i", ent->reType );
}
backEndData->entities[r_numentities].e = *ent;
backEndData->entities[r_numentities].lightingCalculated = qfalse;
CrossProduct(ent->axis[0], ent->axis[1], cross);
backEndData->entities[r_numentities].mirrored = (DotProduct(ent->axis[2], cross) < 0.f);
r_numentities++;
}
// Ridah, added support for overdraw field
/*
=====================
RE_AddLightToScene
=====================
*/
void RE_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, int overdraw ) {
dlight_t *dl;
if ( !tr.registered ) {
return;
}
if ( r_numdlights >= MAX_DLIGHTS ) {
return;
}
if ( intensity <= 0 ) {
return;
}
// these cards don't have the correct blend mode
if ( glConfig.hardwareType == GLHW_RIVA128 || glConfig.hardwareType == GLHW_PERMEDIA2 ) {
return;
}
// RF, allow us to force some dlights under all circumstances
if ( !( overdraw & REF_FORCE_DLIGHT ) ) {
if ( r_dynamiclight->integer == 0 ) {
return;
}
if ( r_dynamiclight->integer == 2 && !( backEndData->dlights[r_numdlights].forced ) ) {
return;
}
}
overdraw &= ~REF_FORCE_DLIGHT;
overdraw &= ~REF_JUNIOR_DLIGHT; //----(SA) added
dl = &backEndData->dlights[r_numdlights++];
VectorCopy( org, dl->origin );
dl->radius = intensity;
dl->color[0] = r;
dl->color[1] = g;
dl->color[2] = b;
dl->dlshader = NULL;
dl->overdraw = 0;
if ( overdraw == 10 ) { // sorry, hijacking 10 for a quick hack (SA)
dl->dlshader = R_GetShaderByHandle( RE_RegisterShader( "negdlightshader" ) );
} else if ( overdraw == 11 ) { // 11 is flames
dl->dlshader = R_GetShaderByHandle( RE_RegisterShader( "flamedlightshader" ) );
} else {
dl->overdraw = overdraw;
}
}
// done.
/*
==============
RE_AddCoronaToScene
==============
*/
void RE_AddCoronaToScene( const vec3_t org, float r, float g, float b, float scale, int id, qboolean visible ) {
corona_t *cor;
if ( !tr.registered ) {
return;
}
if ( r_numcoronas >= MAX_CORONAS ) {
return;
}
cor = &backEndData->coronas[r_numcoronas++];
VectorCopy( org, cor->origin );
cor->color[0] = r;
cor->color[1] = g;
cor->color[2] = b;
cor->scale = scale;
cor->id = id;
cor->visible = visible;
}
void RE_BeginScene(const refdef_t *fd)
{
memcpy( tr.refdef.text, fd->text, sizeof( tr.refdef.text ) );
tr.refdef.x = fd->x;
tr.refdef.y = fd->y;
tr.refdef.width = fd->width;
tr.refdef.height = fd->height;
tr.refdef.fov_x = fd->fov_x;
tr.refdef.fov_y = fd->fov_y;
VectorCopy( fd->vieworg, tr.refdef.vieworg );
VectorCopy( fd->viewaxis[0], tr.refdef.viewaxis[0] );
VectorCopy( fd->viewaxis[1], tr.refdef.viewaxis[1] );
VectorCopy( fd->viewaxis[2], tr.refdef.viewaxis[2] );
tr.refdef.time = fd->time;
tr.refdef.rdflags = fd->rdflags;
if ( fd->rdflags & RDF_SKYBOXPORTAL ) {
skyboxportal = 1;
}
// copy the areamask data over and note if it has changed, which
// will force a reset of the visible leafs even if the view hasn't moved
tr.refdef.areamaskModified = qfalse;
if ( !( tr.refdef.rdflags & RDF_NOWORLDMODEL ) ) {
int areaDiff;
int i;
// compare the area bits
areaDiff = 0;
for ( i = 0 ; i < MAX_MAP_AREA_BYTES / 4 ; i++ ) {
areaDiff |= ( (int *)tr.refdef.areamask )[i] ^ ( (int *)fd->areamask )[i];
( (int *)tr.refdef.areamask )[i] = ( (int *)fd->areamask )[i];
}
if ( areaDiff ) {
// a door just opened or something
tr.refdef.areamaskModified = qtrue;
}
}
tr.refdef.sunDir[3] = 0.0f;
tr.refdef.sunCol[3] = 1.0f;
tr.refdef.sunAmbCol[3] = 1.0f;
VectorCopy(tr.sunDirection, tr.refdef.sunDir);
if ( (tr.refdef.rdflags & RDF_NOWORLDMODEL) || !(r_depthPrepass->value) ){
VectorSet(tr.refdef.sunCol, 0, 0, 0);
VectorSet(tr.refdef.sunAmbCol, 0, 0, 0);
}
else
{
float scale = (1 << r_mapOverBrightBits->integer) / 255.0f;
if (r_forceSun->integer)
VectorScale(tr.sunLight, scale * r_forceSunLightScale->value, tr.refdef.sunCol);
else
VectorScale(tr.sunLight, scale, tr.refdef.sunCol);
if (r_sunlightMode->integer == 1)
{
tr.refdef.sunAmbCol[0] =
tr.refdef.sunAmbCol[1] =
tr.refdef.sunAmbCol[2] = r_forceSun->integer ? r_forceSunAmbientScale->value : tr.sunShadowScale;
}
else
{
if (r_forceSun->integer)
VectorScale(tr.sunLight, scale * r_forceSunAmbientScale->value, tr.refdef.sunAmbCol);
else
VectorScale(tr.sunLight, scale * tr.sunShadowScale, tr.refdef.sunAmbCol);
}
}
if (r_forceAutoExposure->integer)
{
tr.refdef.autoExposureMinMax[0] = r_forceAutoExposureMin->value;
tr.refdef.autoExposureMinMax[1] = r_forceAutoExposureMax->value;
}
else
{
tr.refdef.autoExposureMinMax[0] = tr.autoExposureMinMax[0];
tr.refdef.autoExposureMinMax[1] = tr.autoExposureMinMax[1];
}
if (r_forceToneMap->integer)
{
tr.refdef.toneMinAvgMaxLinear[0] = pow(2, r_forceToneMapMin->value);
tr.refdef.toneMinAvgMaxLinear[1] = pow(2, r_forceToneMapAvg->value);
tr.refdef.toneMinAvgMaxLinear[2] = pow(2, r_forceToneMapMax->value);
}
else
{
tr.refdef.toneMinAvgMaxLinear[0] = pow(2, tr.toneMinAvgMaxLevel[0]);
tr.refdef.toneMinAvgMaxLinear[1] = pow(2, tr.toneMinAvgMaxLevel[1]);
tr.refdef.toneMinAvgMaxLinear[2] = pow(2, tr.toneMinAvgMaxLevel[2]);
}
// Makro - copy exta info if present
if (fd->rdflags & RDF_EXTRA) {
const refdefex_t* extra = (const refdefex_t*) (fd+1);
tr.refdef.blurFactor = extra->blurFactor;
if (fd->rdflags & RDF_SUNLIGHT)
{
VectorCopy(extra->sunDir, tr.refdef.sunDir);
VectorCopy(extra->sunCol, tr.refdef.sunCol);
VectorCopy(extra->sunAmbCol, tr.refdef.sunAmbCol);
}
}
else
{
tr.refdef.blurFactor = 0.0f;
}
// derived info
tr.refdef.floatTime = tr.refdef.time * 0.001;
tr.refdef.numDrawSurfs = r_firstSceneDrawSurf;
tr.refdef.drawSurfs = backEndData->drawSurfs;
tr.refdef.num_entities = r_numentities - r_firstSceneEntity;
tr.refdef.entities = &backEndData->entities[r_firstSceneEntity];
tr.refdef.num_dlights = r_numdlights - r_firstSceneDlight;
tr.refdef.dlights = &backEndData->dlights[r_firstSceneDlight];
tr.refdef.num_coronas = r_numcoronas - r_firstSceneCorona;
tr.refdef.coronas = &backEndData->coronas[r_firstSceneCorona];
tr.refdef.numPolys = r_numpolys - r_firstScenePoly;
tr.refdef.polys = &backEndData->polys[r_firstScenePoly];
tr.refdef.num_pshadows = 0;
tr.refdef.pshadows = &backEndData->pshadows[0];
// turn off dynamic lighting globally by clearing all the
// dlights if it needs to be disabled or if vertex lighting is enabled
if ( /*r_dynamiclight->integer == 0 || // RF, disabled so we can force things like lightning dlights
r_vertexLight->integer == 1 ||*/
glConfig.hardwareType == GLHW_PERMEDIA2 ) {
tr.refdef.num_dlights = 0;
}
// a single frame may have multiple scenes draw inside it --
// a 3D game view, 3D status bar renderings, 3D menus, etc.
// They need to be distinguished by the light flare code, because
// the visibility state for a given surface may be different in
// each scene / view.
tr.frameSceneNum++;
tr.sceneCount++;
}
void RE_EndScene(void)
{
// the next scene rendered in this frame will tack on after this one
r_firstSceneDrawSurf = tr.refdef.numDrawSurfs;
r_firstSceneEntity = r_numentities;
r_firstSceneDlight = r_numdlights;
r_firstScenePoly = r_numpolys;
}
/*
@@@@@@@@@@@@@@@@@@@@@
RE_RenderScene
Draw a 3D view into a part of the window, then return
to 2D drawing.
Rendering a scene may require multiple views to be rendered
to handle mirrors,
@@@@@@@@@@@@@@@@@@@@@
*/
void RE_RenderScene( const refdef_t *fd ) {
viewParms_t parms;
int startTime;
if ( !tr.registered ) {
return;
}
GLimp_LogComment( "====== RE_RenderScene =====\n" );
if ( r_norefresh->integer ) {
return;
}
startTime = ri.Milliseconds();
if (!tr.world && !( fd->rdflags & RDF_NOWORLDMODEL ) ) {
ri.Error (ERR_DROP, "R_RenderScene: NULL worldmodel");
}
RE_BeginScene(fd);
// SmileTheory: playing with shadow mapping
if (!( fd->rdflags & RDF_NOWORLDMODEL ) && tr.refdef.num_dlights && r_dlightMode->integer >= 2)
{
R_RenderDlightCubemaps(fd);
}
/* playing with more shadows */
if(glRefConfig.framebufferObject && !( fd->rdflags & RDF_NOWORLDMODEL ) && r_shadows->integer == 4)
{
R_RenderPshadowMaps(fd);
}
// playing with even more shadows
if(glRefConfig.framebufferObject && r_sunlightMode->integer && !( fd->rdflags & RDF_NOWORLDMODEL ) && (r_forceSun->integer || tr.sunShadows))
{
if (r_shadowCascadeZFar->integer != 0)
{
R_RenderSunShadowMaps(fd, 0);
R_RenderSunShadowMaps(fd, 1);
R_RenderSunShadowMaps(fd, 2);
}
else
{
Mat4Zero(tr.refdef.sunShadowMvp[0]);
Mat4Zero(tr.refdef.sunShadowMvp[1]);
Mat4Zero(tr.refdef.sunShadowMvp[2]);
}
// only rerender last cascade if sun has changed position
if (r_forceSun->integer == 2 || !VectorCompare(tr.refdef.sunDir, tr.lastCascadeSunDirection))
{
VectorCopy(tr.refdef.sunDir, tr.lastCascadeSunDirection);
R_RenderSunShadowMaps(fd, 3);
Mat4Copy(tr.refdef.sunShadowMvp[3], tr.lastCascadeSunMvp);
}
else
{
Mat4Copy(tr.lastCascadeSunMvp, tr.refdef.sunShadowMvp[3]);
}
}
// playing with cube maps
// this is where dynamic cubemaps would be rendered
if (0) //(glRefConfig.framebufferObject && !( fd->rdflags & RDF_NOWORLDMODEL ))
{
int i, j;
for (i = 0; i < tr.numCubemaps; i++)
{
for (j = 0; j < 6; j++)
{
R_RenderCubemapSide(i, j, qtrue);
}
}
}
// setup view parms for the initial view
//
// set up viewport
// The refdef takes 0-at-the-top y coordinates, so
// convert to GL's 0-at-the-bottom space
//
memset( &parms, 0, sizeof( parms ) );
parms.viewportX = tr.refdef.x;
parms.viewportY = glConfig.vidHeight - ( tr.refdef.y + tr.refdef.height );
parms.viewportWidth = tr.refdef.width;
parms.viewportHeight = tr.refdef.height;
parms.isPortal = qfalse;
parms.fovX = tr.refdef.fov_x;
parms.fovY = tr.refdef.fov_y;
parms.stereoFrame = tr.refdef.stereoFrame;
VectorCopy( fd->vieworg, parms.or.origin );
VectorCopy( fd->viewaxis[0], parms.or.axis[0] );
VectorCopy( fd->viewaxis[1], parms.or.axis[1] );
VectorCopy( fd->viewaxis[2], parms.or.axis[2] );
VectorCopy( fd->vieworg, parms.pvsOrigin );
if(!( fd->rdflags & RDF_NOWORLDMODEL ) && r_depthPrepass->value && ((r_forceSun->integer) || tr.sunShadows))
{
parms.flags = VPF_USESUNLIGHT;
}
R_RenderView( &parms );
if(!( fd->rdflags & RDF_NOWORLDMODEL ))
R_AddPostProcessCmd();
RE_EndScene();
tr.frontEndMsec += ri.Milliseconds() - startTime;
}
|