Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/rend2' into rend2
Browse files Browse the repository at this point in the history
  • Loading branch information
xycaleth committed Mar 4, 2014
2 parents 7d4cc45 + fa08890 commit 37a6878
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
6 changes: 6 additions & 0 deletions codemp/rd-rend2/tr_bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2700,6 +2700,8 @@ void R_LoadEntities( lump_t *l ) {
w->lightGridSize[1] = 64;
w->lightGridSize[2] = 128;

tr.distanceCull = 6000;//DEFAULT_DISTANCE_CULL;

p = (char *)(fileBase + l->fileofs);

// store for reference by the cgame
Expand Down Expand Up @@ -2756,6 +2758,10 @@ void R_LoadEntities( lump_t *l ) {
R_RemapShader(value, s, "0");
continue;
}
if (!Q_stricmp(keyname, "distanceCull")) {
sscanf(value, "%f", &tr.distanceCull );
continue;
}
// check for a different grid size
if (!Q_stricmp(keyname, "gridsize")) {
sscanf(value, "%f %f %f", &w->lightGridSize[0], &w->lightGridSize[1], &w->lightGridSize[2] );
Expand Down
14 changes: 7 additions & 7 deletions codemp/rd-rend2/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1205,10 +1205,10 @@ void R_Register( void )
"0", CVAR_ARCHIVE | CVAR_LATCH );
r_ext_max_anisotropy = ri->Cvar_Get( "r_ext_max_anisotropy", "2", CVAR_ARCHIVE | CVAR_LATCH );

r_picmip = ri->Cvar_Get ("r_picmip", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_picmip = ri->Cvar_Get ("r_picmip", "0", CVAR_ARCHIVE | CVAR_LATCH );
ri->Cvar_CheckRange( r_picmip, 0, 16, qtrue );
r_roundImagesDown = ri->Cvar_Get ("r_roundImagesDown", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_colorMipLevels = ri->Cvar_Get ("r_colorMipLevels", "0", CVAR_LATCH );
ri->Cvar_CheckRange( r_picmip, 0, 16, qtrue );
r_detailTextures = ri->Cvar_Get( "r_detailtextures", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_texturebits = ri->Cvar_Get( "r_texturebits", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_colorbits = ri->Cvar_Get( "r_colorbits", "0", CVAR_ARCHIVE | CVAR_LATCH );
Expand All @@ -1218,9 +1218,9 @@ void R_Register( void )
ri->Cvar_CheckRange( r_ext_multisample, 0, 4, qtrue );
r_overBrightBits = ri->Cvar_Get ("r_overBrightBits", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_ignorehwgamma = ri->Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH);
r_mode = ri->Cvar_Get( "r_mode", "-2", CVAR_ARCHIVE | CVAR_LATCH );
r_fullscreen = ri->Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE );
r_noborder = ri->Cvar_Get("r_noborder", "0", CVAR_ARCHIVE);
r_mode = ri->Cvar_Get( "r_mode", "4", CVAR_ARCHIVE | CVAR_LATCH );
r_fullscreen = ri->Cvar_Get( "r_fullscreen", "0", CVAR_ARCHIVE|CVAR_LATCH );
r_noborder = ri->Cvar_Get("r_noborder", "0", CVAR_ARCHIVE|CVAR_LATCH);
r_centerWindow = ri->Cvar_Get( "r_centerWindow", "0", CVAR_ARCHIVE|CVAR_LATCH );
r_customwidth = ri->Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH );
r_customheight = ri->Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH );
Expand Down Expand Up @@ -1308,8 +1308,8 @@ void R_Register( void )
r_lodbias = ri->Cvar_Get( "r_lodbias", "0", CVAR_ARCHIVE );
r_flares = ri->Cvar_Get ("r_flares", "0", CVAR_ARCHIVE );
r_znear = ri->Cvar_Get( "r_znear", "4", CVAR_CHEAT );
r_autolodscalevalue = ri->Cvar_Get( "r_autolodscalevalue", "0", CVAR_ROM );
ri->Cvar_CheckRange( r_znear, 0.001f, 200, qfalse );
r_autolodscalevalue = ri->Cvar_Get( "r_autolodscalevalue", "0", CVAR_ROM );
r_zproj = ri->Cvar_Get( "r_zproj", "64", CVAR_ARCHIVE );
r_stereoSeparation = ri->Cvar_Get( "r_stereoSeparation", "64", CVAR_ARCHIVE );
r_ignoreGLErrors = ri->Cvar_Get( "r_ignoreGLErrors", "1", CVAR_ARCHIVE );
Expand Down Expand Up @@ -1632,7 +1632,7 @@ extern qboolean gG2_GBMUseSPMethod;
static void G2API_BoltMatrixReconstruction( qboolean reconstruct ) { gG2_GBMNoReconstruct = (qboolean)!reconstruct; }
static void G2API_BoltMatrixSPMethod( qboolean spMethod ) { gG2_GBMUseSPMethod = spMethod; }

static float GetDistanceCull( void ) { return 6000/*tr.distanceCull*/; }
static float GetDistanceCull( void ) { return tr.distanceCull; }

extern void R_SVModelInit( void ); //tr_model.cpp

Expand Down
1 change: 1 addition & 0 deletions codemp/rd-rend2/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,7 @@ typedef struct trGlobals_s {
float fogTable[FOG_TABLE_SIZE];

float rangedFog;
float distanceCull, distanceCullSquared; //rwwRMG - added

#ifdef _WIN32
WinVars_t *wv;
Expand Down
17 changes: 10 additions & 7 deletions codemp/rd-rend2/tr_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,18 +926,20 @@ static void R_SetFarClip( void )
// if not rendering the world (icons, menus, etc)
// set a 2k far clip plane
if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) {
tr.viewParms.zFar = 2048;
// override the zfar then
if ( tr.refdef.rdflags & RDF_AUTOMAP )
tr.viewParms.zFar = 32768.0f;
else
tr.viewParms.zFar = 2048.0f;
return;
}

//
// set far clipping planes dynamically
//
farthestCornerDistance = 0;
for ( i = 0; i < 8; i++ )
{
vec3_t v;
vec3_t vecTo;
float distance;

if ( i & 1 )
Expand Down Expand Up @@ -967,16 +969,17 @@ static void R_SetFarClip( void )
v[2] = tr.viewParms.visBounds[1][2];
}

VectorSubtract( v, tr.viewParms.ori.origin, vecTo );

distance = vecTo[0] * vecTo[0] + vecTo[1] * vecTo[1] + vecTo[2] * vecTo[2];
distance = DistanceSquared( tr.viewParms.ori.origin, v );

if ( distance > farthestCornerDistance )
{
farthestCornerDistance = distance;
}
}
tr.viewParms.zFar = sqrt( farthestCornerDistance );
// Bring in the zFar to the distanceCull distance
// The sky renders at zFar so need to move it out a little
// ...and make sure there is a minimum zfar to prevent problems
tr.viewParms.zFar = Com_Clamp(2048.0f, tr.distanceCull * (1.732), sqrtf( farthestCornerDistance ));
}

/*
Expand Down

0 comments on commit 37a6878

Please sign in to comment.