Compare commits

...

15 Commits

Author SHA1 Message Date
Alibek Omarov
d6ec4a497c ref: soft: remove mistakingly put const on RI.rvp 2026-04-13 20:58:22 +05:00
Alibek Omarov
30884d7a52 ref: soft: replace RI.onlyClientDraw with RF_ONLY_CLIENTDRAW flag in viewpass 2026-04-13 14:08:13 +05:00
Alibek Omarov
95854bc4c4 ref: gl: remove onlyClientDraw, drawOrtho, RI.params with viewpass flag check. RF_DRAW_OVERVIEW and RF_DRAW_CUBEMAP are cannot be set at the same time, so drawOrtho check replaced by RF_DRAW_CUBEMAP only 2026-04-13 14:07:35 +05:00
Alibek Omarov
76565fd9a8 ref: soft: get rid of RI.drawOrtho, it's a debugging/development tool, not suited for software renderer use 2026-04-13 13:49:00 +05:00
Alibek Omarov
c509b90a39 ref: soft: read ref_viewpass_t flags instead of cached RI.drawWorld 2026-04-13 13:47:17 +05:00
Alibek Omarov
9f660d2660 ref: gl: read ref_viewpass_t flags instead of cached RI.drawWorld 2026-04-13 13:47:08 +05:00
Alibek Omarov
39f8fd6870 ref: soft: remove unused isSkyVisible 2026-04-13 13:40:25 +05:00
Alibek Omarov
7c0fca81b0 ref: gl: remove unused isSkyVisible 2026-04-13 13:40:18 +05:00
Alibek Omarov
e9e46dd67a ref: soft: replace RI.{vieworg,viewangles,pvsorigin} by ref_viewpass_t fields 2026-04-13 13:38:20 +05:00
Alibek Omarov
68875267de ref: gl: replace RI.{vieworg,viewangles,pvsorigin} by ref_viewpass_t fields 2026-04-13 13:38:11 +05:00
Alibek Omarov
5955d31997 ref: soft: save original viewpass and access viewport and fov through it 2026-04-13 13:29:58 +05:00
Alibek Omarov
69757945fa ref: gl: save original viewpass and access viewport and fov through it 2026-04-13 13:29:49 +05:00
Alibek Omarov
2da155708a engine: move underwater fov effect handling to the engine 2026-04-13 13:27:18 +05:00
Alibek Omarov
81bda52a79 ref: gl: drop legacy mirror viewpass code 2026-04-13 13:15:04 +05:00
Alibek Omarov
231646ae72 ref: soft: drop broken code for all non-viewer viewpasses 2026-04-13 13:12:35 +05:00
23 changed files with 226 additions and 357 deletions

View File

@@ -360,6 +360,29 @@ qboolean V_PreRender( void )
//============================================================================ //============================================================================
/*
====================
V_ApplyRefUnderwater
apply underwater fov effect
====================
*/
static void V_ApplyRefUnderwater( ref_viewpass_t *rvp )
{
if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP|RF_DRAW_OVERVIEW ))
return;
if( !FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
return;
if( cl.local.waterlevel < 3 )
return;
rvp->fov_x = atan( tan( DEG2RAD( rvp->fov_x ) / 2 ) * ( 0.97f + sin( cl.time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
rvp->fov_y = atan( tan( DEG2RAD( rvp->fov_y ) / 2 ) * ( 1.03f - sin( cl.time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
}
/* /*
================== ==================
V_RenderView V_RenderView
@@ -389,6 +412,7 @@ void V_RenderView( void )
clgame.dllFuncs.pfnCalcRefdef( &rp ); clgame.dllFuncs.pfnCalcRefdef( &rp );
V_GetRefParams( &rp, &rvp ); V_GetRefParams( &rp, &rvp );
V_RefApplyOverview( &rvp ); V_RefApplyOverview( &rvp );
V_ApplyRefUnderwater( &rvp );
if( viewnum == 0 && FBitSet( rvp.flags, RF_ONLY_CLIENTDRAW )) if( viewnum == 0 && FBitSet( rvp.flags, RF_ONLY_CLIENTDRAW ))
{ {

View File

@@ -578,7 +578,7 @@ static void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
if( !plight || !ent ) if( !plight || !ent )
return; return;
if( !RI.drawWorld || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT )) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT ))
{ {
plight->shadelight = 0; plight->shadelight = 0;
plight->ambientlight = 192; plight->ambientlight = 192;
@@ -1126,7 +1126,7 @@ init current time for a given model
*/ */
static void R_AliasSetupTimings( void ) static void R_AliasSetupTimings( void )
{ {
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{ {
// synchronize with server time // synchronize with server time
g_alias.time = gp_cl->time; g_alias.time = gp_cl->time;

View File

@@ -61,7 +61,7 @@ void GL_BackendEndFrame( void )
{ {
mleaf_t *curleaf; mleaf_t *curleaf;
if( r_speeds->value <= 0 || !RI.drawWorld ) if( r_speeds->value <= 0 || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return; return;
if( !RI.viewleaf ) if( !RI.viewleaf )
@@ -616,7 +616,7 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
string basename; string basename;
int i = 1, flags, result; int i = 1, flags, result;
if( !RI.drawWorld || !WORLDMODEL ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || !WORLDMODEL )
return false; return false;
// make sure the specified size is valid // make sure the specified size is valid
@@ -633,7 +633,7 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
r_side = Mem_Calloc( r_temppool, sizeof( rgbdata_t )); r_side = Mem_Calloc( r_temppool, sizeof( rgbdata_t ));
// use client vieworg // use client vieworg
if( !vieworg ) vieworg = RI.vieworg; if( !vieworg ) vieworg = RI.rvp.vieworigin;
for( i = 0; i < 6; i++ ) for( i = 0; i < 6; i++ )
{ {

View File

@@ -98,7 +98,7 @@ static void R_BeamComputeNormal( const vec3_t vStartPos, const vec3_t vNextPos,
VectorSubtract( vStartPos, vNextPos, vTangentY ); VectorSubtract( vStartPos, vNextPos, vTangentY );
// vDirToBeam = vector from viewer origin to beam // vDirToBeam = vector from viewer origin to beam
VectorSubtract( vStartPos, RI.vieworg, vDirToBeam ); VectorSubtract( vStartPos, RI.rvp.vieworigin, vDirToBeam );
// get a vector that is perpendicular to us and perpendicular to the beam. // get a vector that is perpendicular to us and perpendicular to the beam.
// this is used to fatten the beam. // this is used to fatten the beam.
@@ -1006,7 +1006,7 @@ static void R_BeamDraw( BEAM *pbeam, float frametime )
float flDistance; float flDistance;
// fade the beam if the player's not looking at the source // fade the beam if the player's not looking at the source
VectorSubtract( RI.vieworg, pbeam->source, localDir ); VectorSubtract( RI.rvp.vieworigin, pbeam->source, localDir );
flDot = DotProduct( delta, localDir ); flDot = DotProduct( delta, localDir );
VectorScale( delta, flDot, vecProjection ); VectorScale( delta, flDot, vecProjection );
VectorSubtract( localDir, vecProjection, tmp ); VectorSubtract( localDir, vecProjection, tmp );

View File

@@ -47,7 +47,7 @@ qboolean R_CullModel( const cl_entity_t *e, const vec3_t absmin, const vec3_t ab
if( ENGINE_GET_PARM( PARM_DEV_OVERVIEW )) if( ENGINE_GET_PARM( PARM_DEV_OVERVIEW ))
return true; return true;
if( RP_NORMALPASS() && !ENGINE_GET_PARM( PARM_THIRDPERSON ) && CL_IsViewEntityLocalPlayer()) if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ) && !ENGINE_GET_PARM( PARM_THIRDPERSON ) && CL_IsViewEntityLocalPlayer())
return false; return false;
return true; return true;
@@ -85,7 +85,7 @@ int R_CullSurface( const msurface_t *surf, const gl_frustum_t *frustum, uint cli
float dist; float dist;
// can use normal.z for world (optimisation) // can use normal.z for world (optimisation)
if( RI.drawOrtho ) if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ))
{ {
vec3_t orthonormal; vec3_t orthonormal;

View File

@@ -70,17 +70,9 @@ void VGL_ShimEndFrame( void );
#define SHADE_LAMBERT 1.4953241 #define SHADE_LAMBERT 1.4953241
#define DEFAULT_ALPHATEST 0.0f #define DEFAULT_ALPHATEST 0.0f
// refparams
#define RP_NONE 0
#define RP_ENVVIEW BIT( 0 ) // used for cubemapshot
#define RP_OLDVIEWLEAF BIT( 1 )
#define RP_CLIPPLANE BIT( 2 )
#define RP_NONVIEWERREF (RP_ENVVIEW)
#define R_ModelOpaque( rm ) ( rm == kRenderNormal ) #define R_ModelOpaque( rm ) ( rm == kRenderNormal )
#define R_StaticEntity( ent ) ( VectorIsNull( ent->origin ) && VectorIsNull( ent->angles )) #define R_StaticEntity( ent ) ( VectorIsNull( ent->origin ) && VectorIsNull( ent->angles ))
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ( gp_cl->playernum + 1 ) && e->player ) #define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ( gp_cl->playernum + 1 ) && e->player )
#define RP_NORMALPASS() ( FBitSet( RI.params, RP_NONVIEWERREF ) == 0 )
#define CL_IsViewEntityLocalPlayer() ( gp_cl->viewentity == ( gp_cl->playernum + 1 )) #define CL_IsViewEntityLocalPlayer() ( gp_cl->viewentity == ( gp_cl->playernum + 1 ))
@@ -127,27 +119,16 @@ typedef struct gltexture_s
typedef struct typedef struct
{ {
int params; // rendering parameters ref_viewpass_t rvp;
qboolean drawWorld; // ignore world for drawing PlayerModel
qboolean isSkyVisible; // sky is visible
qboolean onlyClientDraw; // disabled by client request
qboolean drawOrtho; // draw world as orthogonal projection
float fov_x, fov_y; // current view fov
cl_entity_t *currententity; cl_entity_t *currententity;
model_t *currentmodel; model_t *currentmodel;
cl_entity_t *currentbeam; // same as above but for beams cl_entity_t *currentbeam; // same as above but for beams
int viewport[4];
gl_frustum_t frustum; gl_frustum_t frustum;
mleaf_t *viewleaf; mleaf_t *viewleaf;
mleaf_t *oldviewleaf; mleaf_t *oldviewleaf;
vec3_t pvsorigin;
vec3_t vieworg; // locked vieworigin
vec3_t viewangles;
vec3_t vforward; vec3_t vforward;
vec3_t vright; vec3_t vright;
vec3_t vup; vec3_t vup;

View File

@@ -101,7 +101,7 @@ static int R_TransEntityCompare( const void *a, const void *b )
{ {
VectorAverage( ent1->model->mins, ent1->model->maxs, org ); VectorAverage( ent1->model->mins, ent1->model->maxs, org );
VectorAdd( ent1->origin, org, org ); VectorAdd( ent1->origin, org, org );
VectorSubtract( RI.vieworg, org, vecLen ); VectorSubtract( RI.rvp.vieworigin, org, vecLen );
dist1 = DotProduct( vecLen, vecLen ); dist1 = DotProduct( vecLen, vecLen );
} }
else dist1 = 1000000000; else dist1 = 1000000000;
@@ -110,7 +110,7 @@ static int R_TransEntityCompare( const void *a, const void *b )
{ {
VectorAverage( ent2->model->mins, ent2->model->maxs, org ); VectorAverage( ent2->model->mins, ent2->model->maxs, org );
VectorAdd( ent2->origin, org, org ); VectorAdd( ent2->origin, org, org );
VectorSubtract( RI.vieworg, org, vecLen ); VectorSubtract( RI.rvp.vieworigin, org, vecLen );
dist2 = DotProduct( vecLen, vecLen ); dist2 = DotProduct( vecLen, vecLen );
} }
else dist2 = 1000000000; else dist2 = 1000000000;
@@ -317,7 +317,7 @@ static void R_Clear( int bitMask )
pglClear( bits ); pglClear( bits );
// change ordering for overview // change ordering for overview
if( RI.drawOrtho ) if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ))
{ {
gldepthmin = 1.0f; gldepthmin = 1.0f;
gldepthmax = 0.0f; gldepthmax = 0.0f;
@@ -340,7 +340,7 @@ R_GetFarClip
*/ */
static float R_GetFarClip( void ) static float R_GetFarClip( void )
{ {
if( WORLDMODEL && RI.drawWorld ) if( WORLDMODEL && FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return tr.movevars->zmax * 1.73f; return tr.movevars->zmax * 1.73f;
return 2048.0f; return 2048.0f;
} }
@@ -352,28 +352,26 @@ R_SetupFrustum
*/ */
void R_SetupFrustum( void ) void R_SetupFrustum( void )
{ {
const ref_overview_t *ov = gEngfuncs.GetOverviewParms();
if( RP_NORMALPASS() && FBitSet( gp_host->features, ENGINE_QUAKE_COMPATIBLE ) && ( ENGINE_GET_PARM( PARM_WATER_LEVEL ) >= 3 ))
{
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97f + sin( gp_cl->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03f - sin( gp_cl->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
}
// build the transformation matrix for the given view angles // build the transformation matrix for the given view angles
AngleVectors( RI.viewangles, RI.vforward, RI.vright, RI.vup ); AngleVectors( RI.rvp.viewangles, RI.vforward, RI.vright, RI.vup );
if( !r_lockfrustum.value ) if( !r_lockfrustum.value )
{ {
VectorCopy( RI.vieworg, RI.cullorigin ); VectorCopy( RI.rvp.vieworigin, RI.cullorigin );
VectorCopy( RI.vforward, RI.cull_vforward ); VectorCopy( RI.vforward, RI.cull_vforward );
VectorCopy( RI.vright, RI.cull_vright ); VectorCopy( RI.vright, RI.cull_vright );
VectorCopy( RI.vup, RI.cull_vup ); VectorCopy( RI.vup, RI.cull_vup );
} }
if( RI.drawOrtho ) if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ))
{
const ref_overview_t *ov = gEngfuncs.GetOverviewParms();
GL_FrustumInitOrtho( &RI.frustum, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar ); GL_FrustumInitOrtho( &RI.frustum, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar );
else GL_FrustumInitProj( &RI.frustum, 0.0f, R_GetFarClip(), RI.fov_x, RI.fov_y ); // NOTE: we ignore nearplane here (mirrors only) }
else
{
GL_FrustumInitProj( &RI.frustum, 0.0f, R_GetFarClip(), RI.rvp.fov_x, RI.rvp.fov_y ); // NOTE: we ignore nearplane here (mirrors only)
}
} }
/* /*
@@ -385,7 +383,7 @@ static void R_SetupProjectionMatrix( matrix4x4 m )
{ {
GLfloat xMin, xMax, yMin, yMax, zNear, zFar; GLfloat xMin, xMax, yMin, yMax, zNear, zFar;
if( RI.drawOrtho ) if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ))
{ {
const ref_overview_t *ov = gEngfuncs.GetOverviewParms(); const ref_overview_t *ov = gEngfuncs.GetOverviewParms();
Matrix4x4_CreateOrtho( m, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar ); Matrix4x4_CreateOrtho( m, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar );
@@ -397,10 +395,10 @@ static void R_SetupProjectionMatrix( matrix4x4 m )
zNear = 4.0f; zNear = 4.0f;
zFar = Q_max( 256.0f, RI.farClip ); zFar = Q_max( 256.0f, RI.farClip );
yMax = zNear * tan( RI.fov_y * M_PI_F / 360.0f ); yMax = zNear * tan( RI.rvp.fov_y * M_PI_F / 360.0f );
yMin = -yMax; yMin = -yMax;
xMax = zNear * tan( RI.fov_x * M_PI_F / 360.0f ); xMax = zNear * tan( RI.rvp.fov_x * M_PI_F / 360.0f );
xMin = -xMax; xMin = -xMax;
if( tr.rotation & 1 ) if( tr.rotation & 1 )
@@ -423,17 +421,17 @@ static void R_SetupModelviewMatrix( matrix4x4 m )
Matrix4x4_CreateModelview( m ); Matrix4x4_CreateModelview( m );
if( tr.rotation & 1 ) if( tr.rotation & 1 )
{ {
Matrix4x4_ConcatRotate( m, anglemod( -RI.viewangles[2] + 90 ), 1, 0, 0 ); Matrix4x4_ConcatRotate( m, anglemod( -RI.rvp.viewangles[2] + 90 ), 1, 0, 0 );
Matrix4x4_ConcatRotate( m, -RI.viewangles[0], 0, 1, 0 ); Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[0], 0, 1, 0 );
Matrix4x4_ConcatRotate( m, -RI.viewangles[1], 0, 0, 1 ); Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[1], 0, 0, 1 );
} }
else else
{ {
Matrix4x4_ConcatRotate( m, -RI.viewangles[2], 1, 0, 0 ); Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[2], 1, 0, 0 );
Matrix4x4_ConcatRotate( m, -RI.viewangles[0], 0, 1, 0 ); Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[0], 0, 1, 0 );
Matrix4x4_ConcatRotate( m, -RI.viewangles[1], 0, 0, 1 ); Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[1], 0, 0, 1 );
} }
Matrix4x4_ConcatTranslate( m, -RI.vieworg[0], -RI.vieworg[1], -RI.vieworg[2] ); Matrix4x4_ConcatTranslate( m, -RI.rvp.vieworigin[0], -RI.rvp.vieworigin[1], -RI.rvp.vieworigin[2] );
} }
/* /*
@@ -513,7 +511,7 @@ R_FindViewLeaf
void R_FindViewLeaf( void ) void R_FindViewLeaf( void )
{ {
RI.oldviewleaf = RI.viewleaf; RI.oldviewleaf = RI.viewleaf;
RI.viewleaf = gEngfuncs.Mod_PointInLeaf( RI.pvsorigin, WORLDMODEL->nodes ); RI.viewleaf = gEngfuncs.Mod_PointInLeaf( RI.rvp.vieworigin, WORLDMODEL->nodes );
} }
/* /*
@@ -524,7 +522,7 @@ R_SetupFrame
static void R_SetupFrame( void ) static void R_SetupFrame( void )
{ {
// setup viewplane dist // setup viewplane dist
RI.viewplanedist = DotProduct( RI.vieworg, RI.vforward ); RI.viewplanedist = DotProduct( RI.rvp.vieworigin, RI.vforward );
// NOTE: this request is the fps-killer on some NVidia drivers // NOTE: this request is the fps-killer on some NVidia drivers
glState.isFogEnabled = pglIsEnabled( GL_FOG ); glState.isFogEnabled = pglIsEnabled( GL_FOG );
@@ -536,11 +534,8 @@ static void R_SetupFrame( void )
} }
// current viewleaf // current viewleaf
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{
RI.isSkyVisible = false; // unknown at this moment
R_FindViewLeaf(); R_FindViewLeaf();
}
} }
/* /*
@@ -557,15 +552,15 @@ void R_SetupGL( qboolean set_gl_state )
if( !set_gl_state ) return; if( !set_gl_state ) return;
if( RP_NORMALPASS( )) if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
{ {
int x, x2, y, y2; int x, x2, y, y2;
// set up viewport (main, playersetup) // set up viewport (main, playersetup)
x = floor( RI.viewport[0] * gpGlobals->width / gpGlobals->width ); x = floor( RI.rvp.viewport[0] * gpGlobals->width / gpGlobals->width );
x2 = ceil(( RI.viewport[0] + RI.viewport[2] ) * gpGlobals->width / gpGlobals->width ); x2 = ceil(( RI.rvp.viewport[0] + RI.rvp.viewport[2] ) * gpGlobals->width / gpGlobals->width );
y = floor( gpGlobals->height - RI.viewport[1] * gpGlobals->height / gpGlobals->height ); y = floor( gpGlobals->height - RI.rvp.viewport[1] * gpGlobals->height / gpGlobals->height );
y2 = ceil( gpGlobals->height - ( RI.viewport[1] + RI.viewport[3] ) * gpGlobals->height / gpGlobals->height ); y2 = ceil( gpGlobals->height - ( RI.rvp.viewport[1] + RI.rvp.viewport[3] ) * gpGlobals->height / gpGlobals->height );
if( tr.rotation & 1 ) if( tr.rotation & 1 )
pglViewport( y2, x, y - y2, x2 - x ); pglViewport( y2, x, y - y2, x2 - x );
@@ -574,7 +569,7 @@ void R_SetupGL( qboolean set_gl_state )
else else
{ {
// envpass, mirrorpass // envpass, mirrorpass
pglViewport( RI.viewport[0], RI.viewport[1], RI.viewport[2], RI.viewport[3] ); pglViewport( RI.rvp.viewport[0], RI.rvp.viewport[1], RI.rvp.viewport[2], RI.rvp.viewport[3] );
} }
pglMatrixMode( GL_PROJECTION ); pglMatrixMode( GL_PROJECTION );
@@ -583,20 +578,6 @@ void R_SetupGL( qboolean set_gl_state )
pglMatrixMode( GL_MODELVIEW ); pglMatrixMode( GL_MODELVIEW );
GL_LoadMatrix( RI.worldviewMatrix ); GL_LoadMatrix( RI.worldviewMatrix );
if( FBitSet( RI.params, RP_CLIPPLANE ))
{
GLdouble clip[4];
mplane_t *p = &RI.clipPlane;
clip[0] = p->normal[0];
clip[1] = p->normal[1];
clip[2] = p->normal[2];
clip[3] = -p->dist;
pglClipPlane( GL_CLIP_PLANE0, clip );
pglEnable( GL_CLIP_PLANE0 );
}
GL_Cull( GL_FRONT ); GL_Cull( GL_FRONT );
pglDisable( GL_BLEND ); pglDisable( GL_BLEND );
@@ -604,17 +585,6 @@ void R_SetupGL( qboolean set_gl_state )
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
} }
/*
=============
R_EndGL
=============
*/
static void R_EndGL( void )
{
if( RI.params & RP_CLIPPLANE )
pglDisable( GL_CLIP_PLANE0 );
}
/* /*
============= =============
R_RecursiveFindWaterTexture R_RecursiveFindWaterTexture
@@ -731,7 +701,7 @@ static void R_CheckFog( void )
RI.fogEnabled = false; RI.fogEnabled = false;
if( RI.onlyClientDraw || ENGINE_GET_PARM( PARM_WATER_LEVEL ) < 3 || !RI.drawWorld || !RI.viewleaf ) if( FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ) || ENGINE_GET_PARM( PARM_WATER_LEVEL ) < 3 || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || !RI.viewleaf )
{ {
if( RI.cached_waterlevel == 3 ) if( RI.cached_waterlevel == 3 )
{ {
@@ -747,7 +717,7 @@ static void R_CheckFog( void )
return; return;
} }
ent = gEngfuncs.CL_GetWaterEntity( RI.vieworg ); ent = gEngfuncs.CL_GetWaterEntity( RI.rvp.vieworigin );
if( ent && ent->model && ent->model->type == mod_brush && ent->curstate.skin < 0 ) if( ent && ent->model && ent->model->type == mod_brush && ent->curstate.skin < 0 )
cnt = ent->curstate.skin; cnt = ent->curstate.skin;
else cnt = RI.viewleaf->contents; else cnt = RI.viewleaf->contents;
@@ -853,7 +823,7 @@ static void R_DrawEntitiesOnList( void )
GL_CheckForErrors(); GL_CheckForErrors();
// first draw solid entities // first draw solid entities
for( i = 0; i < tr.draw_list->num_solid_entities && !RI.onlyClientDraw; i++ ) for( i = 0; i < tr.draw_list->num_solid_entities && !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ); i++ )
{ {
RI.currententity = tr.draw_list->solid_entities[i]; RI.currententity = tr.draw_list->solid_entities[i];
RI.currentmodel = RI.currententity->model; RI.currentmodel = RI.currententity->model;
@@ -885,7 +855,7 @@ static void R_DrawEntitiesOnList( void )
GL_CheckForErrors(); GL_CheckForErrors();
// draw sprites seperately, because of alpha blending // draw sprites seperately, because of alpha blending
for( i = 0; i < tr.draw_list->num_solid_entities && !RI.onlyClientDraw; i++ ) for( i = 0; i < tr.draw_list->num_solid_entities && !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ); i++ )
{ {
RI.currententity = tr.draw_list->solid_entities[i]; RI.currententity = tr.draw_list->solid_entities[i];
RI.currentmodel = RI.currententity->model; RI.currentmodel = RI.currententity->model;
@@ -903,20 +873,20 @@ static void R_DrawEntitiesOnList( void )
GL_CheckForErrors(); GL_CheckForErrors();
if( !RI.onlyClientDraw ) if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
{ {
gEngfuncs.CL_DrawEFX( tr.frametime, false ); gEngfuncs.CL_DrawEFX( tr.frametime, false );
} }
GL_CheckForErrors(); GL_CheckForErrors();
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
gEngfuncs.pfnDrawNormalTriangles(); gEngfuncs.pfnDrawNormalTriangles();
GL_CheckForErrors(); GL_CheckForErrors();
// then draw translucent entities // then draw translucent entities
for( i = 0; i < tr.draw_list->num_trans_entities && !RI.onlyClientDraw; i++ ) for( i = 0; i < tr.draw_list->num_trans_entities && !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ); i++ )
{ {
RI.currententity = tr.draw_list->trans_entities[i]; RI.currententity = tr.draw_list->trans_entities[i];
RI.currentmodel = RI.currententity->model; RI.currentmodel = RI.currententity->model;
@@ -952,7 +922,7 @@ static void R_DrawEntitiesOnList( void )
GL_CheckForErrors(); GL_CheckForErrors();
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{ {
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
gEngfuncs.pfnDrawTransparentTriangles (); gEngfuncs.pfnDrawTransparentTriangles ();
@@ -960,7 +930,7 @@ static void R_DrawEntitiesOnList( void )
GL_CheckForErrors(); GL_CheckForErrors();
if( !RI.onlyClientDraw ) if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
{ {
R_AllowFog( false ); R_AllowFog( false );
gEngfuncs.CL_DrawEFX( tr.frametime, true ); gEngfuncs.CL_DrawEFX( tr.frametime, true );
@@ -971,7 +941,7 @@ static void R_DrawEntitiesOnList( void )
pglDisable( GL_BLEND ); // Trinity Render issues pglDisable( GL_BLEND ); // Trinity Render issues
if( !RI.onlyClientDraw ) if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
R_DrawViewModel(); R_DrawViewModel();
gEngfuncs.CL_ExtraUpdate(); gEngfuncs.CL_ExtraUpdate();
@@ -987,11 +957,11 @@ R_SetupRefParams must be called right before
*/ */
void R_RenderScene( void ) void R_RenderScene( void )
{ {
if( !WORLDMODEL && RI.drawWorld ) if( !WORLDMODEL && FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
gEngfuncs.Host_Error( "%s: NULL worldmodel\n", __func__ ); gEngfuncs.Host_Error( "%s: NULL worldmodel\n", __func__ );
// frametime is valid only for normal pass // frametime is valid only for normal pass
if( RP_NORMALPASS( )) if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
tr.frametime = gp_cl->time - gp_cl->oldtime; tr.frametime = gp_cl->time - gp_cl->oldtime;
else tr.frametime = 0.0; else tr.frametime = 0.0;
@@ -1007,7 +977,7 @@ void R_RenderScene( void )
R_MarkLeaves(); R_MarkLeaves();
R_DrawFog (); R_DrawFog ();
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
R_AnimateRipples(); R_AnimateRipples();
R_CheckGLFog(); R_CheckGLFog();
@@ -1019,8 +989,6 @@ void R_RenderScene( void )
R_DrawEntitiesOnList(); R_DrawEntitiesOnList();
R_DrawWaterSurfaces(); R_DrawWaterSurfaces();
R_EndGL();
} }
void R_GammaChanged( qboolean do_reset_gamma ) void R_GammaChanged( qboolean do_reset_gamma )
@@ -1109,28 +1077,9 @@ set initial params for renderer
*/ */
void R_SetupRefParams( const ref_viewpass_t *rvp ) void R_SetupRefParams( const ref_viewpass_t *rvp )
{ {
RI.params = RP_NONE; RI.rvp = *rvp;
RI.drawWorld = FBitSet( rvp->flags, RF_DRAW_WORLD );
RI.onlyClientDraw = FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW );
RI.farClip = 0; RI.farClip = 0;
if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP ))
RI.drawOrtho = FBitSet( rvp->flags, RF_DRAW_OVERVIEW );
else RI.drawOrtho = false;
// setup viewport
RI.viewport[0] = rvp->viewport[0];
RI.viewport[1] = rvp->viewport[1];
RI.viewport[2] = rvp->viewport[2];
RI.viewport[3] = rvp->viewport[3];
// calc FOV
RI.fov_x = rvp->fov_x;
RI.fov_y = rvp->fov_y;
VectorCopy( rvp->vieworigin, RI.vieworg );
VectorCopy( rvp->viewangles, RI.viewangles );
VectorCopy( rvp->vieworigin, RI.pvsorigin );
} }
/* /*
@@ -1146,7 +1095,7 @@ void R_RenderFrame( const ref_viewpass_t *rvp )
// setup the initial render params // setup the initial render params
R_SetupRefParams( rvp ); R_SetupRefParams( rvp );
if( gl_finish.value && RI.drawWorld ) if( gl_finish.value && FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
pglFinish(); pglFinish();
// completely override rendering // completely override rendering
@@ -1164,7 +1113,7 @@ void R_RenderFrame( const ref_viewpass_t *rvp )
} }
tr.fCustomRendering = false; tr.fCustomRendering = false;
if( !RI.onlyClientDraw ) if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
R_RunViewmodelEvents(); R_RunViewmodelEvents();
tr.realframecount++; // right called after viewmodel events tr.realframecount++; // right called after viewmodel events
@@ -1246,7 +1195,7 @@ int CL_FxBlend( cl_entity_t *e )
blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 8 + offset ); blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 8 + offset );
break; break;
case kRenderFxFadeSlow: case kRenderFxFadeSlow:
if( RP_NORMALPASS( )) if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
{ {
if( e->curstate.renderamt > 0 ) if( e->curstate.renderamt > 0 )
e->curstate.renderamt -= 1; e->curstate.renderamt -= 1;
@@ -1255,7 +1204,7 @@ int CL_FxBlend( cl_entity_t *e )
blend = e->curstate.renderamt; blend = e->curstate.renderamt;
break; break;
case kRenderFxFadeFast: case kRenderFxFadeFast:
if( RP_NORMALPASS( )) if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
{ {
if( e->curstate.renderamt > 3 ) if( e->curstate.renderamt > 3 )
e->curstate.renderamt -= 4; e->curstate.renderamt -= 4;
@@ -1264,7 +1213,7 @@ int CL_FxBlend( cl_entity_t *e )
blend = e->curstate.renderamt; blend = e->curstate.renderamt;
break; break;
case kRenderFxSolidSlow: case kRenderFxSolidSlow:
if( RP_NORMALPASS( )) if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
{ {
if( e->curstate.renderamt < 255 ) if( e->curstate.renderamt < 255 )
e->curstate.renderamt += 1; e->curstate.renderamt += 1;
@@ -1273,7 +1222,7 @@ int CL_FxBlend( cl_entity_t *e )
blend = e->curstate.renderamt; blend = e->curstate.renderamt;
break; break;
case kRenderFxSolidFast: case kRenderFxSolidFast:
if( RP_NORMALPASS( )) if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
{ {
if( e->curstate.renderamt < 252 ) if( e->curstate.renderamt < 252 )
e->curstate.renderamt += 4; e->curstate.renderamt += 4;
@@ -1309,7 +1258,7 @@ int CL_FxBlend( cl_entity_t *e )
case kRenderFxHologram: case kRenderFxHologram:
case kRenderFxDistort: case kRenderFxDistort:
VectorCopy( e->origin, tmp ); VectorCopy( e->origin, tmp );
VectorSubtract( tmp, RI.vieworg, tmp ); VectorSubtract( tmp, RI.rvp.vieworigin, tmp );
dist = DotProduct( tmp, RI.vforward ); dist = DotProduct( tmp, RI.vforward );
// turn off distance fade // turn off distance fade

View File

@@ -73,9 +73,9 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float
size = partsize; // get initial size of particle size = partsize; // get initial size of particle
// scale up to keep particles from disappearing // scale up to keep particles from disappearing
size += (p->org[0] - RI.vieworg[0]) * RI.cull_vforward[0]; size += (p->org[0] - RI.rvp.vieworigin[0]) * RI.cull_vforward[0];
size += (p->org[1] - RI.vieworg[1]) * RI.cull_vforward[1]; size += (p->org[1] - RI.rvp.vieworigin[1]) * RI.cull_vforward[1];
size += (p->org[2] - RI.vieworg[2]) * RI.cull_vforward[2]; size += (p->org[2] - RI.rvp.vieworigin[2]) * RI.cull_vforward[2];
if( size < 20.0f ) size = partsize; if( size < 20.0f ) size = partsize;
else size = partsize + size * 0.002f; else size = partsize + size * 0.002f;

View File

@@ -956,7 +956,7 @@ static void EmitWaterPolys( msurface_t *warp, qboolean reverse, qboolean ripples
if( !warp->polys ) return; if( !warp->polys ) return;
// set the current waveheight // set the current waveheight
if( warp->polys->verts[0][2] >= RI.vieworg[2] ) if( warp->polys->verts[0][2] >= RI.rvp.vieworigin[2] )
waveHeight = -RI.currententity->curstate.scale; waveHeight = -RI.currententity->curstate.scale;
else waveHeight = RI.currententity->curstate.scale; else waveHeight = RI.currententity->curstate.scale;
@@ -1610,7 +1610,7 @@ void R_DrawWaterSurfaces( void )
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
if( !RI.drawWorld || RI.onlyClientDraw ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
return; return;
// non-transparent water is already drawed // non-transparent water is already drawed
@@ -1792,7 +1792,8 @@ void R_DrawBrushModel( cl_entity_t *e )
qboolean rotated; qboolean rotated;
qboolean allow_vbo = R_HasEnabledVBO(); qboolean allow_vbo = R_HasEnabledVBO();
if( !RI.drawWorld ) return; if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return;
model_t *clmodel = e->model; model_t *clmodel = e->model;
@@ -3683,7 +3684,7 @@ void R_DrawWorld( void )
return; return;
RI.currentmodel = RI.currententity->model; RI.currentmodel = RI.currententity->model;
if( !RI.drawWorld || RI.onlyClientDraw ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
return; return;
VectorCopy( RI.cullorigin, tr.modelorg ); VectorCopy( RI.cullorigin, tr.modelorg );
@@ -3699,7 +3700,7 @@ void R_DrawWorld( void )
R_ClearSkyBox (); R_ClearSkyBox ();
start = gEngfuncs.pfnTime(); start = gEngfuncs.pfnTime();
if( RI.drawOrtho ) if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ))
R_DrawWorldTopView( WORLDMODEL->nodes, RI.frustum.clipFlags ); R_DrawWorldTopView( WORLDMODEL->nodes, RI.frustum.clipFlags );
else R_RecursiveWorldNode( WORLDMODEL->nodes, RI.frustum.clipFlags ); else R_RecursiveWorldNode( WORLDMODEL->nodes, RI.frustum.clipFlags );
end = gEngfuncs.pfnTime(); end = gEngfuncs.pfnTime();
@@ -3748,7 +3749,8 @@ void R_MarkLeaves( void )
vec3_t test; vec3_t test;
int i; int i;
if( !RI.drawWorld ) return; if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return;
if( FBitSet( r_novis.flags, FCVAR_CHANGED ) || tr.fResetVis ) if( FBitSet( r_novis.flags, FCVAR_CHANGED ) || tr.fResetVis )
{ {
@@ -3758,15 +3760,15 @@ void R_MarkLeaves( void )
RI.viewleaf = NULL; RI.viewleaf = NULL;
} }
VectorCopy( RI.pvsorigin, test ); VectorCopy( RI.rvp.vieworigin, test );
if( RI.viewleaf != NULL ) if( RI.viewleaf != NULL )
{ {
// merge two leafs that can be a crossed-line contents // merge two leafs that can be a crossed-line contents
if( RI.viewleaf->contents == CONTENTS_EMPTY ) if( RI.viewleaf->contents == CONTENTS_EMPTY )
VectorSet( test, RI.pvsorigin[0], RI.pvsorigin[1], RI.pvsorigin[2] - 16.0f ); VectorSet( test, RI.rvp.vieworigin[0], RI.rvp.vieworigin[1], RI.rvp.vieworigin[2] - 16.0f );
else else
VectorSet( test, RI.pvsorigin[0], RI.pvsorigin[1], RI.pvsorigin[2] + 16.0f ); VectorSet( test, RI.rvp.vieworigin[0], RI.rvp.vieworigin[1], RI.rvp.vieworigin[2] + 16.0f );
leaf = gEngfuncs.Mod_PointInLeaf( test, WORLDMODEL->nodes ); leaf = gEngfuncs.Mod_PointInLeaf( test, WORLDMODEL->nodes );
@@ -3784,10 +3786,10 @@ void R_MarkLeaves( void )
RI.oldviewleaf = RI.viewleaf; RI.oldviewleaf = RI.viewleaf;
tr.visframecount++; tr.visframecount++;
if( r_novis.value || RI.drawOrtho || !RI.viewleaf || !WORLDMODEL->visdata ) if( r_novis.value || FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ) || !RI.viewleaf || !WORLDMODEL->visdata )
novis = true; novis = true;
gEngfuncs.R_FatPVS( RI.pvsorigin, r_pvs_radius->value, RI.visbytes, FBitSet( RI.params, RP_OLDVIEWLEAF ), novis ); gEngfuncs.R_FatPVS( RI.rvp.vieworigin, r_pvs_radius->value, RI.visbytes, false, novis );
if( force && !novis ) if( force && !novis )
gEngfuncs.R_FatPVS( test, r_pvs_radius->value, RI.visbytes, true, novis ); gEngfuncs.R_FatPVS( test, r_pvs_radius->value, RI.visbytes, true, novis );

View File

@@ -143,7 +143,7 @@ static float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **old
{ {
// e.g. doom-style sprite monsters // e.g. doom-style sprite monsters
float yaw = ent->angles[YAW]; float yaw = ent->angles[YAW];
int angleframe = (int)(Q_rint(( RI.viewangles[1] - yaw + 45.0f ) / 360 * 8) - 4) & 7; int angleframe = (int)(Q_rint(( RI.rvp.viewangles[1] - yaw + 45.0f ) / 360 * 8) - 4) & 7;
if( m_fDoInterp ) if( m_fDoInterp )
{ {
@@ -233,12 +233,12 @@ static float R_SpriteGlowBlend( vec3_t origin, int rendermode, int renderfx, flo
vec3_t glowDist; vec3_t glowDist;
pmtrace_t *tr; pmtrace_t *tr;
VectorSubtract( origin, RI.vieworg, glowDist ); VectorSubtract( origin, RI.rvp.vieworigin, glowDist );
dist = VectorLength( glowDist ); dist = VectorLength( glowDist );
if( RP_NORMALPASS( )) if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
{ {
tr = gEngfuncs.EV_VisTraceLine( RI.vieworg, origin, r_traceglow.value ? PM_GLASS_IGNORE : (PM_GLASS_IGNORE|PM_STUDIO_IGNORE)); tr = gEngfuncs.EV_VisTraceLine( RI.rvp.vieworigin, origin, r_traceglow.value ? PM_GLASS_IGNORE : (PM_GLASS_IGNORE|PM_STUDIO_IGNORE));
if(( 1.0f - tr->fraction ) * dist > 8.0f ) if(( 1.0f - tr->fraction ) * dist > 8.0f )
return 0.0f; return 0.0f;
@@ -270,9 +270,9 @@ static qboolean R_SpriteOccluded( cl_entity_t *e, vec3_t origin, float *pscale )
TriWorldToScreen( origin, v ); TriWorldToScreen( origin, v );
if( v[0] < RI.viewport[0] || v[0] > RI.viewport[0] + RI.viewport[2] ) if( v[0] < RI.rvp.viewport[0] || v[0] > RI.rvp.viewport[0] + RI.rvp.viewport[2] )
return true; // do scissor return true; // do scissor
if( v[1] < RI.viewport[1] || v[1] > RI.viewport[1] + RI.viewport[3] ) if( v[1] < RI.rvp.viewport[1] || v[1] > RI.rvp.viewport[1] + RI.rvp.viewport[3] )
return true; // do scissor return true; // do scissor
blend = R_SpriteGlowBlend( origin, e->curstate.rendermode, e->curstate.renderfx, pscale ); blend = R_SpriteGlowBlend( origin, e->curstate.rendermode, e->curstate.renderfx, pscale );
@@ -386,7 +386,7 @@ void R_DrawSpriteModel( cl_entity_t *e )
vec3_t v_forward, v_right, v_up; vec3_t v_forward, v_right, v_up;
vec3_t origin, color, color2 = { 0.0f }; vec3_t origin, color, color2 = { 0.0f };
if( RI.params & RP_ENVVIEW ) if( FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
return; return;
model = e->model; model = e->model;
@@ -495,7 +495,7 @@ void R_DrawSpriteModel( cl_entity_t *e )
VectorSubtract( origin, v_forward, origin ); VectorSubtract( origin, v_forward, origin );
break; break;
case SPR_FACING_UPRIGHT: case SPR_FACING_UPRIGHT:
VectorSet( v_right, origin[1] - RI.vieworg[1], -(origin[0] - RI.vieworg[0]), 0.0f ); VectorSet( v_right, origin[1] - RI.rvp.vieworigin[1], -(origin[0] - RI.rvp.vieworigin[0]), 0.0f );
VectorSet( v_up, 0.0f, 0.0f, 1.0f ); VectorSet( v_up, 0.0f, 0.0f, 1.0f );
VectorNormalize( v_right ); VectorNormalize( v_right );
break; break;

View File

@@ -167,7 +167,7 @@ init current time for a given model
*/ */
static void R_StudioSetupTimings( void ) static void R_StudioSetupTimings( void )
{ {
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{ {
// synchronize with server time // synchronize with server time
g_studio.time = gp_cl->time; g_studio.time = gp_cl->time;
@@ -369,7 +369,7 @@ pfnPlayerInfo
*/ */
player_info_t *pfnPlayerInfo( int index ) player_info_t *pfnPlayerInfo( int index )
{ {
if( !RI.drawWorld ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
index = -1; index = -1;
return gEngfuncs.pfnPlayerInfo( index ); return gEngfuncs.pfnPlayerInfo( index );
@@ -394,7 +394,7 @@ pfnGetPlayerState
*/ */
static entity_state_t *R_StudioGetPlayerState( int index ) static entity_state_t *R_StudioGetPlayerState( int index )
{ {
if( !RI.drawWorld ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return &RI.currententity->curstate; return &RI.currententity->curstate;
return gEngfuncs.pfnGetPlayerState( index ); return gEngfuncs.pfnGetPlayerState( index );
@@ -432,7 +432,7 @@ pfnGetViewInfo
*/ */
static void pfnGetViewInfo( float *origin, float *upv, float *rightv, float *forwardv ) static void pfnGetViewInfo( float *origin, float *upv, float *rightv, float *forwardv )
{ {
if( origin ) VectorCopy( RI.vieworg, origin ); if( origin ) VectorCopy( RI.rvp.vieworigin, origin );
if( forwardv ) VectorCopy( RI.vforward, forwardv ); if( forwardv ) VectorCopy( RI.vforward, forwardv );
if( rightv ) VectorCopy( RI.vright, rightv ); if( rightv ) VectorCopy( RI.vright, rightv );
if( upv ) VectorCopy( RI.vup, upv ); if( upv ) VectorCopy( RI.vup, upv );
@@ -1328,7 +1328,7 @@ static void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
if( !plight || !ent || !ent->model ) if( !plight || !ent || !ent->model )
return; return;
if( !RI.drawWorld || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT )) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT ))
{ {
plight->shadelight = 0; plight->shadelight = 0;
plight->ambientlight = 192; plight->ambientlight = 192;
@@ -2662,7 +2662,7 @@ static model_t *R_StudioSetupPlayerModel( int index )
state = &g_studio.player_models[index]; state = &g_studio.player_models[index];
// g-cont: force for "dev-mode", non-local games and menu preview // g-cont: force for "dev-mode", non-local games and menu preview
if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_LOCAL_GAME ) || !RI.drawWorld ) && info->model[0] ) if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_LOCAL_GAME ) || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) ) && info->model[0] )
{ {
if( Q_strcmp( state->name, info->model )) if( Q_strcmp( state->name, info->model ))
{ {
@@ -2914,7 +2914,7 @@ R_StudioSetChromeOrigin
*/ */
static void R_StudioSetChromeOrigin( void ) static void R_StudioSetChromeOrigin( void )
{ {
VectorCopy( RI.vieworg, g_studio.chrome_origin ); VectorCopy( RI.rvp.vieworigin, g_studio.chrome_origin );
} }
/* /*
@@ -3398,7 +3398,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
if( flags & STUDIO_RENDER ) if( flags & STUDIO_RENDER )
{ {
// change body if it's a menu entity // change body if it's a menu entity
if( cl_himodels->value && ( RI.currentmodel != RI.currententity->model || !RI.drawWorld )) if( cl_himodels->value && ( RI.currentmodel != RI.currententity->model || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )))
{ {
// show highest resolution multiplayer model // show highest resolution multiplayer model
RI.currententity->curstate.body = 255; RI.currententity->curstate.body = 255;
@@ -3554,7 +3554,7 @@ R_StudioDrawModelInternal
*/ */
static void R_StudioDrawModelInternal( cl_entity_t *e, int flags ) static void R_StudioDrawModelInternal( cl_entity_t *e, int flags )
{ {
if( !RI.drawWorld ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{ {
if( e->player ) if( e->player )
R_StudioDrawPlayer( flags, &e->curstate ); R_StudioDrawPlayer( flags, &e->curstate );
@@ -3589,7 +3589,7 @@ R_DrawStudioModel
*/ */
void R_DrawStudioModel( cl_entity_t *e ) void R_DrawStudioModel( cl_entity_t *e )
{ {
if( FBitSet( RI.params, RP_ENVVIEW )) if( FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ))
return; return;
R_StudioSetupTimings(); R_StudioSetupTimings();
@@ -3644,7 +3644,7 @@ void R_RunViewmodelEvents( void )
return; return;
// ignore in thirdperson, camera view or client is died // ignore in thirdperson, camera view or client is died
if( !RP_NORMALPASS() || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer()) if( FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ) || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer())
return; return;
RI.currententity = tr.viewent; RI.currententity = tr.viewent;
@@ -3694,7 +3694,7 @@ void R_DrawViewModel( void )
return; return;
// ignore in thirdperson, camera view or client is died // ignore in thirdperson, camera view or client is died
if( !RP_NORMALPASS() || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer()) if( FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ) || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer())
return; return;
tr.blend = CL_FxBlend( view ) / 255.0f; tr.blend = CL_FxBlend( view ) / 255.0f;

View File

@@ -226,10 +226,10 @@ int TriWorldToScreen( const float *world, float *screen )
retval = R_WorldToScreen( world, screen ); retval = R_WorldToScreen( world, screen );
screen[0] = 0.5f * screen[0] * (float)RI.viewport[2]; screen[0] = 0.5f * screen[0] * (float)RI.rvp.viewport[2];
screen[1] = -0.5f * screen[1] * (float)RI.viewport[3]; screen[1] = -0.5f * screen[1] * (float)RI.rvp.viewport[3];
screen[0] += 0.5f * (float)RI.viewport[2]; screen[0] += 0.5f * (float)RI.rvp.viewport[2];
screen[1] += 0.5f * (float)RI.viewport[3]; screen[1] += 0.5f * (float)RI.rvp.viewport[3];
return retval; return retval;
} }

View File

@@ -339,10 +339,6 @@ R_DrawSkybox
*/ */
void R_DrawSkyBox( void ) void R_DrawSkyBox( void )
{ {
int i;
RI.isSkyVisible = true;
// don't fogging skybox (this fix old Half-Life bug) // don't fogging skybox (this fix old Half-Life bug)
if( !RI.fogSkybox ) R_AllowFog( false ); if( !RI.fogSkybox ) R_AllowFog( false );
@@ -353,7 +349,7 @@ void R_DrawSkyBox( void )
pglDisable( GL_ALPHA_TEST ); pglDisable( GL_ALPHA_TEST );
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
for( i = 0; i < SKYBOX_MAX_SIDES; i++ ) for( int i = 0; i < SKYBOX_MAX_SIDES; i++ )
{ {
if( RI.skyMins[0][i] >= RI.skyMaxs[0][i] || RI.skyMins[1][i] >= RI.skyMaxs[1][i] ) if( RI.skyMins[0][i] >= RI.skyMaxs[0][i] || RI.skyMins[1][i] >= RI.skyMaxs[1][i] )
continue; continue;
@@ -421,7 +417,7 @@ static void R_CloudTexCoord( const vec3_t v, float speed, float *s, float *t )
speedscale = gp_cl->time * speed; speedscale = gp_cl->time * speed;
speedscale -= (int)speedscale & ~127; speedscale -= (int)speedscale & ~127;
VectorSubtract( v, RI.vieworg, dir ); VectorSubtract( v, RI.rvp.vieworigin, dir );
dir[2] *= 3.0f; // flatten the sphere dir[2] *= 3.0f; // flatten the sphere
length = VectorLength( dir ); length = VectorLength( dir );
@@ -533,16 +529,12 @@ Quake-style clouds
*/ */
void R_DrawClouds( void ) void R_DrawClouds( void )
{ {
int i;
RI.isSkyVisible = true;
if( RI.fogEnabled ) if( RI.fogEnabled )
pglFogf( GL_FOG_DENSITY, RI.fogDensity * 0.25f ); pglFogf( GL_FOG_DENSITY, RI.fogDensity * 0.25f );
pglDepthFunc( GL_GEQUAL ); pglDepthFunc( GL_GEQUAL );
pglDepthMask( GL_FALSE ); pglDepthMask( GL_FALSE );
for( i = 0; i < SKYBOX_MAX_SIDES; i++ ) for( int i = 0; i < SKYBOX_MAX_SIDES; i++ )
{ {
if( RI.skyMins[0][i] >= RI.skyMaxs[0][i] || RI.skyMins[1][i] >= RI.skyMaxs[1][i] ) if( RI.skyMins[0][i] >= RI.skyMaxs[0][i] || RI.skyMins[1][i] >= RI.skyMaxs[1][i] )
continue; continue;

View File

@@ -100,7 +100,7 @@ static void R_BeamComputeNormal( const vec3_t vStartPos, const vec3_t vNextPos,
VectorSubtract( vStartPos, vNextPos, vTangentY ); VectorSubtract( vStartPos, vNextPos, vTangentY );
// vDirToBeam = vector from viewer origin to beam // vDirToBeam = vector from viewer origin to beam
VectorSubtract( vStartPos, RI.vieworg, vDirToBeam ); VectorSubtract( vStartPos, RI.rvp.vieworigin, vDirToBeam );
// get a vector that is perpendicular to us and perpendicular to the beam. // get a vector that is perpendicular to us and perpendicular to the beam.
// this is used to fatten the beam. // this is used to fatten the beam.
@@ -1000,7 +1000,7 @@ static void R_BeamDraw( BEAM *pbeam, float frametime )
float flDistance; float flDistance;
// fade the beam if the player's not looking at the source // fade the beam if the player's not looking at the source
VectorSubtract( RI.vieworg, pbeam->source, localDir ); VectorSubtract( RI.rvp.vieworigin, pbeam->source, localDir );
flDot = DotProduct( delta, localDir ); flDot = DotProduct( delta, localDir );
VectorScale( delta, flDot, vecProjection ); VectorScale( delta, flDot, vecProjection );
VectorSubtract( localDir, vecProjection, tmp ); VectorSubtract( localDir, vecProjection, tmp );

View File

@@ -643,14 +643,14 @@ R_RenderWorld
*/ */
void R_RenderWorld( void ) void R_RenderWorld( void )
{ {
if( !RI.drawWorld ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return; return;
// auto cycle the world frame for texture animation // auto cycle the world frame for texture animation
RI.currententity = CL_GetEntityByIndex( 0 ); RI.currententity = CL_GetEntityByIndex( 0 );
// RI.currententity->frame = (int)(gp_cl->time*2); // RI.currententity->frame = (int)(gp_cl->time*2);
VectorCopy( RI.vieworg, tr.modelorg ); VectorCopy( RI.rvp.vieworigin, tr.modelorg );
RI.currentmodel = WORLDMODEL; RI.currentmodel = WORLDMODEL;
r_pcurrentvertbase = RI.currentmodel->vertexes; r_pcurrentvertbase = RI.currentmodel->vertexes;

View File

@@ -877,7 +877,7 @@ static void D_TurbulentSurf( surf_t *s )
// TODO: store once at start of frame // TODO: store once at start of frame
RI.currententity = s->entity; // FIXME: make this passed in to RI.currententity = s->entity; // FIXME: make this passed in to
// R_RotateBmodel () // R_RotateBmodel ()
VectorSubtract( RI.vieworg, RI.currententity->origin, VectorSubtract( RI.rvp.vieworigin, RI.currententity->origin,
local_modelorg ); local_modelorg );
TransformVector( local_modelorg, transformed_modelorg ); TransformVector( local_modelorg, transformed_modelorg );
@@ -940,7 +940,7 @@ static void D_AlphaSurf( surf_t *s )
// TODO: store once at start of frame // TODO: store once at start of frame
RI.currententity = s->entity; // FIXME: make this passed in to RI.currententity = s->entity; // FIXME: make this passed in to
// R_RotateBmodel () // R_RotateBmodel ()
VectorSubtract( RI.vieworg, RI.currententity->origin, local_modelorg ); VectorSubtract( RI.rvp.vieworigin, RI.currententity->origin, local_modelorg );
TransformVector( local_modelorg, transformed_modelorg ); TransformVector( local_modelorg, transformed_modelorg );
R_RotateBmodel(); // FIXME: don't mess with the frustum, R_RotateBmodel(); // FIXME: don't mess with the frustum,
@@ -1021,7 +1021,7 @@ static void D_SolidSurf( surf_t *s )
// TODO: store once at start of frame // TODO: store once at start of frame
RI.currententity = s->entity; // FIXME: make this passed in to RI.currententity = s->entity; // FIXME: make this passed in to
// R_RotateBmodel () // R_RotateBmodel ()
VectorSubtract( RI.vieworg, RI.currententity->origin, local_modelorg ); VectorSubtract( RI.rvp.vieworigin, RI.currententity->origin, local_modelorg );
TransformVector( local_modelorg, transformed_modelorg ); TransformVector( local_modelorg, transformed_modelorg );
R_RotateBmodel(); // FIXME: don't mess with the frustum, R_RotateBmodel(); // FIXME: don't mess with the frustum,
@@ -1123,7 +1123,7 @@ void D_DrawSurfaces( void )
surf_t *s; surf_t *s;
// currententity = NULL; //&r_worldentity; // currententity = NULL; //&r_worldentity;
VectorSubtract( RI.vieworg, vec3_origin, tr.modelorg ); VectorSubtract( RI.rvp.vieworigin, vec3_origin, tr.modelorg );
TransformVector( tr.modelorg, transformed_modelorg ); TransformVector( tr.modelorg, transformed_modelorg );
VectorCopy( transformed_modelorg, world_transformed_modelorg ); VectorCopy( transformed_modelorg, world_transformed_modelorg );
@@ -1148,7 +1148,7 @@ void D_DrawSurfaces( void )
D_DrawflatSurfaces(); D_DrawflatSurfaces();
// RI.currententity = NULL; //&r_worldentity; // RI.currententity = NULL; //&r_worldentity;
VectorSubtract( RI.vieworg, vec3_origin, tr.modelorg ); VectorSubtract( RI.rvp.vieworigin, vec3_origin, tr.modelorg );
R_TransformFrustum(); R_TransformFrustum();
} }

View File

@@ -61,17 +61,9 @@ typedef int fixed16_t;
#define SHADE_LAMBERT 1.4953241 #define SHADE_LAMBERT 1.4953241
#define DEFAULT_ALPHATEST 0.0f #define DEFAULT_ALPHATEST 0.0f
// refparams
#define RP_NONE 0
#define RP_ENVVIEW BIT( 0 ) // used for cubemapshot
#define RP_OLDVIEWLEAF BIT( 1 )
#define RP_CLIPPLANE BIT( 2 )
#define RP_NONVIEWERREF ( RP_ENVVIEW )
#define R_ModelOpaque( rm ) ( rm == kRenderNormal ) #define R_ModelOpaque( rm ) ( rm == kRenderNormal )
#define R_StaticEntity( ent ) ( VectorIsNull( ent->origin ) && VectorIsNull( ent->angles )) #define R_StaticEntity( ent ) ( VectorIsNull( ent->origin ) && VectorIsNull( ent->angles ))
#define RP_LOCALCLIENT( e ) (( e ) != NULL && ( e )->index == ( gp_cl->playernum + 1 ) && e->player ) #define RP_LOCALCLIENT( e ) (( e ) != NULL && ( e )->index == ( gp_cl->playernum + 1 ) && e->player )
#define RP_NORMALPASS() ( FBitSet( RI.params, RP_NONVIEWERREF ) == 0 )
#define CL_IsViewEntityLocalPlayer() ( gp_cl->viewentity == ( gp_cl->playernum + 1 )) #define CL_IsViewEntityLocalPlayer() ( gp_cl->viewentity == ( gp_cl->playernum + 1 ))
@@ -130,27 +122,16 @@ extern viddef_t vid;
typedef struct typedef struct
{ {
int params; // rendering parameters ref_viewpass_t rvp;
qboolean drawWorld; // ignore world for drawing PlayerModel
qboolean isSkyVisible; // sky is visible
qboolean onlyClientDraw; // disabled by client request
qboolean drawOrtho; // draw world as orthogonal projection
float fov_x, fov_y; // current view fov
cl_entity_t *currententity; cl_entity_t *currententity;
model_t *currentmodel; model_t *currentmodel;
cl_entity_t *currentbeam; // same as above but for beams cl_entity_t *currentbeam; // same as above but for beams
int viewport[4];
// gl_frustum_t frustum; // gl_frustum_t frustum;
mleaf_t *viewleaf; mleaf_t *viewleaf;
mleaf_t *oldviewleaf; mleaf_t *oldviewleaf;
vec3_t pvsorigin;
vec3_t vieworg; // locked vieworigin
vec3_t viewangles;
vec3_t vforward; vec3_t vforward;
vec3_t vright; vec3_t vright;
vec3_t vup; vec3_t vup;

View File

@@ -172,7 +172,7 @@ static int R_TransEntityCompare( const cl_entity_t **a, const cl_entity_t **b )
{ {
VectorAverage( ent1->model->mins, ent1->model->maxs, org ); VectorAverage( ent1->model->mins, ent1->model->maxs, org );
VectorAdd( ent1->origin, org, org ); VectorAdd( ent1->origin, org, org );
VectorSubtract( RI.vieworg, org, vecLen ); VectorSubtract( RI.rvp.vieworigin, org, vecLen );
dist1 = DotProduct( vecLen, vecLen ); dist1 = DotProduct( vecLen, vecLen );
} }
else else
@@ -182,7 +182,7 @@ static int R_TransEntityCompare( const cl_entity_t **a, const cl_entity_t **b )
{ {
VectorAverage( ent2->model->mins, ent2->model->maxs, org ); VectorAverage( ent2->model->mins, ent2->model->maxs, org );
VectorAdd( ent2->origin, org, org ); VectorAdd( ent2->origin, org, org );
VectorSubtract( RI.vieworg, org, vecLen ); VectorSubtract( RI.rvp.vieworigin, org, vecLen );
dist2 = DotProduct( vecLen, vecLen ); dist2 = DotProduct( vecLen, vecLen );
} }
else else
@@ -379,7 +379,7 @@ R_GetFarClip
*/ */
static float R_GetFarClip( void ) static float R_GetFarClip( void )
{ {
if( WORLDMODEL && RI.drawWorld ) if( WORLDMODEL && FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return tr.movevars->zmax * 1.73f; return tr.movevars->zmax * 1.73f;
return 2048.0f; return 2048.0f;
} }
@@ -392,10 +392,10 @@ R_SetupFrustum
void R_SetupFrustum( void ) void R_SetupFrustum( void )
{ {
// build the transformation matrix for the given view angles // build the transformation matrix for the given view angles
AngleVectors( RI.viewangles, RI.vforward, RI.vright, RI.vup ); AngleVectors( RI.rvp.viewangles, RI.vforward, RI.vright, RI.vup );
{ {
VectorCopy( RI.vieworg, RI.cullorigin ); VectorCopy( RI.rvp.vieworigin, RI.cullorigin );
VectorCopy( RI.vforward, RI.cull_vforward ); VectorCopy( RI.vforward, RI.cull_vforward );
VectorCopy( RI.vright, RI.cull_vright ); VectorCopy( RI.vright, RI.cull_vright );
VectorCopy( RI.vup, RI.cull_vup ); VectorCopy( RI.vup, RI.cull_vup );
@@ -411,22 +411,15 @@ static void R_SetupProjectionMatrix( matrix4x4 m )
{ {
float xMin, xMax, yMin, yMax, zNear, zFar; float xMin, xMax, yMin, yMax, zNear, zFar;
if( RI.drawOrtho )
{
const ref_overview_t *ov = gEngfuncs.GetOverviewParms();
Matrix4x4_CreateOrtho( m, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar );
return;
}
RI.farClip = R_GetFarClip(); RI.farClip = R_GetFarClip();
zNear = 4.0f; zNear = 4.0f;
zFar = Q_max( 256.0f, RI.farClip ); zFar = Q_max( 256.0f, RI.farClip );
yMax = zNear * tan( RI.fov_y * M_PI_F / 360.0f ); yMax = zNear * tan( RI.rvp.fov_y * M_PI_F / 360.0f );
yMin = -yMax; yMin = -yMax;
xMax = zNear * tan( RI.fov_x * M_PI_F / 360.0f ); xMax = zNear * tan( RI.rvp.fov_x * M_PI_F / 360.0f );
xMin = -xMax; xMin = -xMax;
Matrix4x4_CreateProjection( m, xMax, xMin, yMax, yMin, zNear, zFar ); Matrix4x4_CreateProjection( m, xMax, xMin, yMax, yMin, zNear, zFar );
@@ -440,10 +433,10 @@ R_SetupModelviewMatrix
static void R_SetupModelviewMatrix( matrix4x4 m ) static void R_SetupModelviewMatrix( matrix4x4 m )
{ {
Matrix4x4_CreateModelview( m ); Matrix4x4_CreateModelview( m );
Matrix4x4_ConcatRotate( m, -RI.viewangles[2], 1, 0, 0 ); Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[2], 1, 0, 0 );
Matrix4x4_ConcatRotate( m, -RI.viewangles[0], 0, 1, 0 ); Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[0], 0, 1, 0 );
Matrix4x4_ConcatRotate( m, -RI.viewangles[1], 0, 0, 1 ); Matrix4x4_ConcatRotate( m, -RI.rvp.viewangles[1], 0, 0, 1 );
Matrix4x4_ConcatTranslate( m, -RI.vieworg[0], -RI.vieworg[1], -RI.vieworg[2] ); Matrix4x4_ConcatTranslate( m, -RI.rvp.vieworigin[0], -RI.rvp.vieworigin[1], -RI.rvp.vieworigin[2] );
} }
/* /*
@@ -481,7 +474,7 @@ R_FindViewLeaf
void R_FindViewLeaf( void ) void R_FindViewLeaf( void )
{ {
RI.oldviewleaf = RI.viewleaf; RI.oldviewleaf = RI.viewleaf;
RI.viewleaf = gEngfuncs.Mod_PointInLeaf( RI.pvsorigin, WORLDMODEL->nodes ); RI.viewleaf = gEngfuncs.Mod_PointInLeaf( RI.rvp.vieworigin, WORLDMODEL->nodes );
} }
/* /*
@@ -492,7 +485,7 @@ R_SetupFrame
static void R_SetupFrame( void ) static void R_SetupFrame( void )
{ {
// setup viewplane dist // setup viewplane dist
RI.viewplanedist = DotProduct( RI.vieworg, RI.vforward ); RI.viewplanedist = DotProduct( RI.rvp.vieworigin, RI.vforward );
// if( !gl_nosort->value ) // if( !gl_nosort->value )
{ {
@@ -501,11 +494,8 @@ static void R_SetupFrame( void )
} }
// current viewleaf // current viewleaf
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{
RI.isSkyVisible = false; // unknown at this moment
R_FindViewLeaf(); R_FindViewLeaf();
}
// setup twice until globals fully refactored // setup twice until globals fully refactored
R_SetupFrameQ(); R_SetupFrameQ();
@@ -527,7 +517,7 @@ static void R_DrawEntitiesOnList( void )
d_pdrawspans = R_PolysetFillSpans8; d_pdrawspans = R_PolysetFillSpans8;
GL_SetRenderMode( kRenderNormal ); GL_SetRenderMode( kRenderNormal );
// first draw solid entities // first draw solid entities
for( i = 0; i < tr.draw_list->num_solid_entities && !RI.onlyClientDraw; i++ ) for( i = 0; i < tr.draw_list->num_solid_entities && !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ); i++ )
{ {
RI.currententity = tr.draw_list->solid_entities[i]; RI.currententity = tr.draw_list->solid_entities[i];
RI.currentmodel = RI.currententity->model; RI.currentmodel = RI.currententity->model;
@@ -555,7 +545,7 @@ static void R_DrawEntitiesOnList( void )
R_SetUpWorldTransform(); R_SetUpWorldTransform();
// draw sprites seperately, because of alpha blending // draw sprites seperately, because of alpha blending
for( i = 0; i < tr.draw_list->num_solid_entities && !RI.onlyClientDraw; i++ ) for( i = 0; i < tr.draw_list->num_solid_entities && !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ); i++ )
{ {
RI.currententity = tr.draw_list->solid_entities[i]; RI.currententity = tr.draw_list->solid_entities[i];
RI.currentmodel = RI.currententity->model; RI.currentmodel = RI.currententity->model;
@@ -571,17 +561,17 @@ static void R_DrawEntitiesOnList( void )
} }
} }
if( !RI.onlyClientDraw ) if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
{ {
gEngfuncs.CL_DrawEFX( tr.frametime, false ); gEngfuncs.CL_DrawEFX( tr.frametime, false );
} }
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
gEngfuncs.pfnDrawNormalTriangles(); gEngfuncs.pfnDrawNormalTriangles();
d_pdrawspans = R_PolysetDrawSpans8_33; d_pdrawspans = R_PolysetDrawSpans8_33;
// then draw translucent entities // then draw translucent entities
for( i = 0; i < tr.draw_list->num_trans_entities && !RI.onlyClientDraw; i++ ) for( i = 0; i < tr.draw_list->num_trans_entities && !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ); i++ )
{ {
RI.currententity = tr.draw_list->trans_entities[i]; RI.currententity = tr.draw_list->trans_entities[i];
RI.currentmodel = RI.currententity->model; RI.currentmodel = RI.currententity->model;
@@ -619,12 +609,10 @@ static void R_DrawEntitiesOnList( void )
} }
} }
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{
gEngfuncs.pfnDrawTransparentTriangles(); gEngfuncs.pfnDrawTransparentTriangles();
}
if( !RI.onlyClientDraw ) if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
{ {
R_AllowFog( false ); R_AllowFog( false );
gEngfuncs.CL_DrawEFX( tr.frametime, true ); gEngfuncs.CL_DrawEFX( tr.frametime, true );
@@ -633,7 +621,7 @@ static void R_DrawEntitiesOnList( void )
GL_SetRenderMode( kRenderNormal ); GL_SetRenderMode( kRenderNormal );
R_SetUpWorldTransform(); R_SetUpWorldTransform();
if( !RI.onlyClientDraw ) if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
R_DrawViewModel(); R_DrawViewModel();
gEngfuncs.CL_ExtraUpdate(); gEngfuncs.CL_ExtraUpdate();
@@ -804,7 +792,7 @@ static void R_DrawBEntitiesOnList( void )
VectorCopy( tr.modelorg, oldorigin ); VectorCopy( tr.modelorg, oldorigin );
insubmodel = true; insubmodel = true;
for( i = 0; i < tr.draw_list->num_edge_entities && !RI.onlyClientDraw; i++ ) for( i = 0; i < tr.draw_list->num_edge_entities && !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ); i++ )
{ {
int k; int k;
RI.currententity = tr.draw_list->edge_entities[i]; RI.currententity = tr.draw_list->edge_entities[i];
@@ -832,7 +820,7 @@ static void R_DrawBEntitiesOnList( void )
continue; // no part in a visible leaf continue; // no part in a visible leaf
VectorCopy( RI.currententity->origin, r_entorigin ); VectorCopy( RI.currententity->origin, r_entorigin );
VectorSubtract( RI.vieworg, r_entorigin, tr.modelorg ); VectorSubtract( RI.rvp.vieworigin, r_entorigin, tr.modelorg );
// VectorSubtract (r_origin, RI.currententity->origin, modelorg); // VectorSubtract (r_origin, RI.currententity->origin, modelorg);
r_pcurrentvertbase = RI.currentmodel->vertexes; r_pcurrentvertbase = RI.currentmodel->vertexes;
@@ -890,7 +878,7 @@ void R_DrawBrushModel( cl_entity_t *pent )
surf_t lsurfs[NUMSTACKSURFACES surf_t lsurfs[NUMSTACKSURFACES
+ (( CACHE_SIZE - 1 ) / sizeof( surf_t )) + 1]; + (( CACHE_SIZE - 1 ) / sizeof( surf_t )) + 1];
if( !RI.drawWorld ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return; return;
if( auxedges ) if( auxedges )
@@ -944,7 +932,7 @@ void R_DrawBrushModel( cl_entity_t *pent )
alphaspans = true; alphaspans = true;
VectorCopy( RI.currententity->origin, r_entorigin ); VectorCopy( RI.currententity->origin, r_entorigin );
VectorSubtract( RI.vieworg, r_entorigin, tr.modelorg ); VectorSubtract( RI.rvp.vieworigin, r_entorigin, tr.modelorg );
// VectorSubtract (r_origin, RI.currententity->origin, modelorg); // VectorSubtract (r_origin, RI.currententity->origin, modelorg);
r_pcurrentvertbase = RI.currentmodel->vertexes; r_pcurrentvertbase = RI.currentmodel->vertexes;
@@ -998,7 +986,7 @@ static void R_EdgeDrawing( void )
surf_t lsurfs[NUMSTACKSURFACES surf_t lsurfs[NUMSTACKSURFACES
+ (( CACHE_SIZE - 1 ) / sizeof( surf_t )) + 1]; + (( CACHE_SIZE - 1 ) / sizeof( surf_t )) + 1];
if( !RI.drawWorld ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return; return;
if( auxedges ) if( auxedges )
@@ -1053,7 +1041,7 @@ static void R_MarkLeaves( void )
tr.visframecount++; tr.visframecount++;
r_oldviewcluster = r_viewcluster; r_oldviewcluster = r_viewcluster;
gEngfuncs.R_FatPVS( RI.pvsorigin, r_pvs_radius->value, RI.visbytes, FBitSet( RI.params, RP_OLDVIEWLEAF ), false ); gEngfuncs.R_FatPVS( RI.rvp.vieworigin, r_pvs_radius->value, RI.visbytes, false, false );
vis = RI.visbytes; vis = RI.visbytes;
for( i = 0; i < WORLDMODEL->numleafs; i++ ) for( i = 0; i < WORLDMODEL->numleafs; i++ )
@@ -1082,14 +1070,11 @@ R_SetupRefParams must be called right before
*/ */
void GAME_EXPORT R_RenderScene( void ) void GAME_EXPORT R_RenderScene( void )
{ {
if( !WORLDMODEL && RI.drawWorld ) if( !WORLDMODEL && FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
gEngfuncs.Host_Error( "%s: NULL worldmodel\n", __func__ ); gEngfuncs.Host_Error( "%s: NULL worldmodel\n", __func__ );
// frametime is valid only for normal pass // frametime is valid only for normal pass
if( RP_NORMALPASS( ))
tr.frametime = gp_cl->time - gp_cl->oldtime; tr.frametime = gp_cl->time - gp_cl->oldtime;
else
tr.frametime = 0.0;
// begin a new frame // begin a new frame
tr.framecount++; tr.framecount++;
@@ -1160,28 +1145,7 @@ set initial params for renderer
*/ */
void R_SetupRefParams( const ref_viewpass_t *rvp ) void R_SetupRefParams( const ref_viewpass_t *rvp )
{ {
RI.params = RP_NONE; RI.rvp = *rvp;
RI.drawWorld = FBitSet( rvp->flags, RF_DRAW_WORLD );
RI.onlyClientDraw = FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW );
if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP ))
RI.drawOrtho = FBitSet( rvp->flags, RF_DRAW_OVERVIEW );
else
RI.drawOrtho = false;
// setup viewport
RI.viewport[0] = rvp->viewport[0];
RI.viewport[1] = rvp->viewport[1];
RI.viewport[2] = rvp->viewport[2];
RI.viewport[3] = rvp->viewport[3];
// calc FOV
RI.fov_x = rvp->fov_x;
RI.fov_y = rvp->fov_y;
VectorCopy( rvp->vieworigin, RI.vieworg );
VectorCopy( rvp->viewangles, RI.viewangles );
VectorCopy( rvp->vieworigin, RI.pvsorigin );
} }
/* /*
@@ -1216,7 +1180,7 @@ void GAME_EXPORT R_RenderFrame( const ref_viewpass_t *rvp )
} }
tr.fCustomRendering = false; tr.fCustomRendering = false;
if( !RI.onlyClientDraw ) if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ))
R_RunViewmodelEvents(); R_RunViewmodelEvents();
tr.realframecount++; // right called after viewmodel events tr.realframecount++; // right called after viewmodel events
@@ -1482,43 +1446,31 @@ int CL_FxBlend( cl_entity_t *e )
blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 8 + offset ); blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 8 + offset );
break; break;
case kRenderFxFadeSlow: case kRenderFxFadeSlow:
if( RP_NORMALPASS( ))
{
if( e->curstate.renderamt > 0 ) if( e->curstate.renderamt > 0 )
e->curstate.renderamt -= 1; e->curstate.renderamt -= 1;
else else
e->curstate.renderamt = 0; e->curstate.renderamt = 0;
}
blend = e->curstate.renderamt; blend = e->curstate.renderamt;
break; break;
case kRenderFxFadeFast: case kRenderFxFadeFast:
if( RP_NORMALPASS( ))
{
if( e->curstate.renderamt > 3 ) if( e->curstate.renderamt > 3 )
e->curstate.renderamt -= 4; e->curstate.renderamt -= 4;
else else
e->curstate.renderamt = 0; e->curstate.renderamt = 0;
}
blend = e->curstate.renderamt; blend = e->curstate.renderamt;
break; break;
case kRenderFxSolidSlow: case kRenderFxSolidSlow:
if( RP_NORMALPASS( ))
{
if( e->curstate.renderamt < 255 ) if( e->curstate.renderamt < 255 )
e->curstate.renderamt += 1; e->curstate.renderamt += 1;
else else
e->curstate.renderamt = 255; e->curstate.renderamt = 255;
}
blend = e->curstate.renderamt; blend = e->curstate.renderamt;
break; break;
case kRenderFxSolidFast: case kRenderFxSolidFast:
if( RP_NORMALPASS( ))
{
if( e->curstate.renderamt < 252 ) if( e->curstate.renderamt < 252 )
e->curstate.renderamt += 4; e->curstate.renderamt += 4;
else else
e->curstate.renderamt = 255; e->curstate.renderamt = 255;
}
blend = e->curstate.renderamt; blend = e->curstate.renderamt;
break; break;
case kRenderFxStrobeSlow: case kRenderFxStrobeSlow:
@@ -1559,7 +1511,7 @@ int CL_FxBlend( cl_entity_t *e )
case kRenderFxHologram: case kRenderFxHologram:
case kRenderFxDistort: case kRenderFxDistort:
VectorCopy( e->origin, tmp ); VectorCopy( e->origin, tmp );
VectorSubtract( tmp, RI.vieworg, tmp ); VectorSubtract( tmp, RI.rvp.vieworigin, tmp );
dist = DotProduct( tmp, RI.vforward ); dist = DotProduct( tmp, RI.vforward );
// turn off distance fade // turn off distance fade

View File

@@ -87,10 +87,8 @@ void D_ViewChanged( void )
/* /*
** clear Z-buffer and color-buffers if we're doing the gallery ** clear Z-buffer and color-buffers if we're doing the gallery
*/ */
if( !RI.drawWorld ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{
memset( d_pzbuffer, 0xff, vid.width * vid.height * sizeof( d_pzbuffer[0] )); memset( d_pzbuffer, 0xff, vid.width * vid.height * sizeof( d_pzbuffer[0] ));
}
D_Patch(); D_Patch();
} }
@@ -184,8 +182,8 @@ static void R_ViewChanged( vrect_t *vr )
RI.vrect = *vr; RI.vrect = *vr;
horizontalFieldOfView = 2 * tan((float)RI.fov_x / 360.0f * M_PI_F ); horizontalFieldOfView = 2 * tan((float)RI.rvp.fov_x / 360.0f * M_PI_F );
verticalFieldOfView = 2 * tan((float)RI.fov_y / 360.0f * M_PI_F ); verticalFieldOfView = 2 * tan((float)RI.rvp.fov_y / 360.0f * M_PI_F );
RI.fvrectx = (float)RI.vrect.x; RI.fvrectx = (float)RI.vrect.x;
RI.fvrectx_adj = (float)RI.vrect.x - 0.5f; RI.fvrectx_adj = (float)RI.vrect.x - 0.5f;
@@ -288,14 +286,14 @@ void R_SetupFrameQ( void )
// build the transformation matrix for the given view angles // build the transformation matrix for the given view angles
VectorCopy( RI.vieworg, tr.modelorg ); VectorCopy( RI.rvp.vieworigin, tr.modelorg );
// AngleVectors (RI.viewangles, RI.vforward, RI.vright, RI.vup); // AngleVectors (RI.rvp.viewangles, RI.vforward, RI.vright, RI.vup);
// current viewleaf // current viewleaf
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{ {
RI.viewleaf = gEngfuncs.Mod_PointInLeaf( RI.vieworg, WORLDMODEL->nodes ); RI.viewleaf = gEngfuncs.Mod_PointInLeaf( RI.rvp.vieworigin, WORLDMODEL->nodes );
r_viewcluster = RI.viewleaf->cluster; r_viewcluster = RI.viewleaf->cluster;
} }
@@ -307,10 +305,10 @@ void R_SetupFrameQ( void )
vrect.y = 0;//r_newrefdef.y; vrect.y = 0;//r_newrefdef.y;
vrect.width = gpGlobals->width; vrect.width = gpGlobals->width;
vrect.height = gpGlobals->height;*/ vrect.height = gpGlobals->height;*/
vrect.x = RI.viewport[0]; vrect.x = RI.rvp.viewport[0];
vrect.y = RI.viewport[1]; vrect.y = RI.rvp.viewport[1];
vrect.width = RI.viewport[2]; vrect.width = RI.rvp.viewport[2];
vrect.height = RI.viewport[3]; vrect.height = RI.rvp.viewport[3];
d_viewbuffer = (void *)vid.buffer; d_viewbuffer = (void *)vid.buffer;
r_screenwidth = vid.rowbytes; r_screenwidth = vid.rowbytes;

View File

@@ -72,9 +72,9 @@ void GAME_EXPORT CL_DrawParticles( double frametime, particle_t *cl_active_parti
size = partsize; // get initial size of particle size = partsize; // get initial size of particle
// scale up to keep particles from disappearing // scale up to keep particles from disappearing
size += ( p->org[0] - RI.vieworg[0] ) * RI.cull_vforward[0]; size += ( p->org[0] - RI.rvp.vieworigin[0] ) * RI.cull_vforward[0];
size += ( p->org[1] - RI.vieworg[1] ) * RI.cull_vforward[1]; size += ( p->org[1] - RI.rvp.vieworigin[1] ) * RI.cull_vforward[1];
size += ( p->org[2] - RI.vieworg[2] ) * RI.cull_vforward[2]; size += ( p->org[2] - RI.rvp.vieworigin[2] ) * RI.cull_vforward[2];
if( size < 20.0f ) if( size < 20.0f )
size = partsize; size = partsize;

View File

@@ -65,16 +65,12 @@ static float R_SpriteGlowBlend( vec3_t origin, int rendermode, int renderfx, flo
float dist, brightness; float dist, brightness;
vec3_t glowDist; vec3_t glowDist;
VectorSubtract( origin, RI.vieworg, glowDist ); VectorSubtract( origin, RI.rvp.vieworigin, glowDist );
dist = VectorLength( glowDist ); dist = VectorLength( glowDist );
if( RP_NORMALPASS( )) pmtrace_t *tr = gEngfuncs.EV_VisTraceLine( RI.rvp.vieworigin, origin, r_traceglow.value ? PM_GLASS_IGNORE : ( PM_GLASS_IGNORE | PM_STUDIO_IGNORE ));
{
pmtrace_t *tr = gEngfuncs.EV_VisTraceLine( RI.vieworg, origin, r_traceglow.value ? PM_GLASS_IGNORE : ( PM_GLASS_IGNORE | PM_STUDIO_IGNORE ));
if(( 1.0f - tr->fraction ) * dist > 8.0f ) if(( 1.0f - tr->fraction ) * dist > 8.0f )
return 0.0f; return 0.0f;
}
if( renderfx == kRenderFxNoDissipation ) if( renderfx == kRenderFxNoDissipation )
return 1.0f; return 1.0f;
@@ -102,9 +98,9 @@ static qboolean R_SpriteOccluded( cl_entity_t *e, vec3_t origin, float *pscale )
TriWorldToScreen( origin, v ); TriWorldToScreen( origin, v );
if( v[0] < RI.viewport[0] || v[0] > RI.viewport[0] + RI.viewport[2] ) if( v[0] < RI.rvp.viewport[0] || v[0] > RI.rvp.viewport[0] + RI.rvp.viewport[2] )
return true; // do scissor return true; // do scissor
if( v[1] < RI.viewport[1] || v[1] > RI.viewport[1] + RI.viewport[3] ) if( v[1] < RI.rvp.viewport[1] || v[1] > RI.rvp.viewport[1] + RI.rvp.viewport[3] )
return true; // do scissor return true; // do scissor
blend = R_SpriteGlowBlend( origin, e->curstate.rendermode, e->curstate.renderfx, pscale ); blend = R_SpriteGlowBlend( origin, e->curstate.rendermode, e->curstate.renderfx, pscale );
@@ -172,9 +168,6 @@ void R_DrawSpriteModel( cl_entity_t *e )
vec3_t v_forward, v_right, v_up; vec3_t v_forward, v_right, v_up;
vec3_t origin, color; vec3_t origin, color;
if( RI.params & RP_ENVVIEW )
return;
model = e->model; model = e->model;
psprite = (msprite_t *)model->cache.data; psprite = (msprite_t *)model->cache.data;
VectorCopy( e->origin, origin ); // set render origin VectorCopy( e->origin, origin ); // set render origin
@@ -242,7 +235,7 @@ void R_DrawSpriteModel( cl_entity_t *e )
VectorSubtract( origin, v_forward, origin ); VectorSubtract( origin, v_forward, origin );
break; break;
case SPR_FACING_UPRIGHT: case SPR_FACING_UPRIGHT:
VectorSet( v_right, origin[1] - RI.vieworg[1], -( origin[0] - RI.vieworg[0] ), 0.0f ); VectorSet( v_right, origin[1] - RI.rvp.vieworigin[1], -( origin[0] - RI.rvp.vieworigin[0] ), 0.0f );
VectorSet( v_up, 0.0f, 0.0f, 1.0f ); VectorSet( v_up, 0.0f, 0.0f, 1.0f );
VectorNormalize( v_right ); VectorNormalize( v_right );
break; break;

View File

@@ -147,7 +147,7 @@ init current time for a given model
*/ */
static void R_StudioSetupTimings( void ) static void R_StudioSetupTimings( void )
{ {
if( RI.drawWorld ) if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{ {
// synchronize with server time // synchronize with server time
g_studio.time = gp_cl->time; g_studio.time = gp_cl->time;
@@ -353,7 +353,7 @@ pfnPlayerInfo
*/ */
player_info_t *pfnPlayerInfo( int index ) player_info_t *pfnPlayerInfo( int index )
{ {
if( !RI.drawWorld ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
index = -1; index = -1;
return gEngfuncs.pfnPlayerInfo( index ); return gEngfuncs.pfnPlayerInfo( index );
@@ -378,7 +378,7 @@ pfnGetPlayerState
*/ */
static entity_state_t *R_StudioGetPlayerState( int index ) static entity_state_t *R_StudioGetPlayerState( int index )
{ {
if( !RI.drawWorld ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return &RI.currententity->curstate; return &RI.currententity->curstate;
return gEngfuncs.pfnGetPlayerState( index ); return gEngfuncs.pfnGetPlayerState( index );
@@ -420,7 +420,7 @@ pfnGetViewInfo
static void pfnGetViewInfo( float *origin, float *upv, float *rightv, float *forwardv ) static void pfnGetViewInfo( float *origin, float *upv, float *rightv, float *forwardv )
{ {
if( origin ) if( origin )
VectorCopy( RI.vieworg, origin ); VectorCopy( RI.rvp.vieworigin, origin );
if( forwardv ) if( forwardv )
VectorCopy( RI.vforward, forwardv ); VectorCopy( RI.vforward, forwardv );
if( rightv ) if( rightv )
@@ -1352,7 +1352,7 @@ static void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
if( !plight || !ent || !ent->model ) if( !plight || !ent || !ent->model )
return; return;
if( !RI.drawWorld || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT )) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT ))
{ {
plight->shadelight = 0; plight->shadelight = 0;
plight->ambientlight = 192; plight->ambientlight = 192;
@@ -2333,7 +2333,7 @@ static model_t *R_StudioSetupPlayerModel( int index )
state = &g_studio.player_models[index]; state = &g_studio.player_models[index];
// g-cont: force for "dev-mode", non-local games and menu preview // g-cont: force for "dev-mode", non-local games and menu preview
if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_LOCAL_GAME ) || !RI.drawWorld ) && info->model[0] ) if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_LOCAL_GAME ) || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) && info->model[0] )
{ {
if( Q_strcmp( state->name, info->model )) if( Q_strcmp( state->name, info->model ))
{ {
@@ -2572,7 +2572,7 @@ R_StudioSetChromeOrigin
*/ */
static void R_StudioSetChromeOrigin( void ) static void R_StudioSetChromeOrigin( void )
{ {
VectorCopy( RI.vieworg, g_studio.chrome_origin ); VectorCopy( RI.rvp.vieworigin, g_studio.chrome_origin );
} }
/* /*
@@ -2926,7 +2926,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
if( flags & STUDIO_RENDER ) if( flags & STUDIO_RENDER )
{ {
// change body if it's a menu entity // change body if it's a menu entity
if( cl_himodels->value && ( RI.currentmodel != RI.currententity->model || !RI.drawWorld )) if( cl_himodels->value && ( RI.currentmodel != RI.currententity->model || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )))
{ {
// show highest resolution multiplayer model // show highest resolution multiplayer model
RI.currententity->curstate.body = 255; RI.currententity->curstate.body = 255;
@@ -3087,7 +3087,7 @@ R_StudioDrawModelInternal
*/ */
static void R_StudioDrawModelInternal( cl_entity_t *e, int flags ) static void R_StudioDrawModelInternal( cl_entity_t *e, int flags )
{ {
if( !RI.drawWorld ) if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{ {
if( e->player ) if( e->player )
R_StudioDrawPlayer( flags, &e->curstate ); R_StudioDrawPlayer( flags, &e->curstate );
@@ -3124,9 +3124,6 @@ R_DrawStudioModel
*/ */
void R_DrawStudioModel( cl_entity_t *e ) void R_DrawStudioModel( cl_entity_t *e )
{ {
if( FBitSet( RI.params, RP_ENVVIEW ))
return;
R_StudioSetupTimings(); R_StudioSetupTimings();
if( e->player ) if( e->player )
@@ -3180,7 +3177,7 @@ void R_RunViewmodelEvents( void )
return; return;
// ignore in thirdperson, camera view or client is died // ignore in thirdperson, camera view or client is died
if( !RP_NORMALPASS() || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer()) if( ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer())
return; return;
RI.currententity = tr.viewent; RI.currententity = tr.viewent;
@@ -3230,7 +3227,7 @@ void R_DrawViewModel( void )
return; return;
// ignore in thirdperson, camera view or client is died // ignore in thirdperson, camera view or client is died
if( !RP_NORMALPASS() || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer()) if( ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer())
return; return;
tr.blend = CL_FxBlend( view ) / 255.0f; tr.blend = CL_FxBlend( view ) / 255.0f;

View File

@@ -78,9 +78,9 @@ void R_SetUpWorldTransform( void )
aliasoldworldtransform[i][0] = aliasworldtransform[i][2] = s_alias_up[i]; aliasoldworldtransform[i][0] = aliasworldtransform[i][2] = s_alias_up[i];
} }
aliasworldtransform[0][3] = -RI.vieworg[0]; aliasworldtransform[0][3] = -RI.rvp.vieworigin[0];
aliasworldtransform[1][3] = -RI.vieworg[1]; aliasworldtransform[1][3] = -RI.rvp.vieworigin[1];
aliasworldtransform[2][3] = -RI.vieworg[2]; aliasworldtransform[2][3] = -RI.rvp.vieworigin[2];
// aliasoldworldtransform[0][3] = RI.currententity->oldorigin[0]-r_origin[0]; // aliasoldworldtransform[0][3] = RI.currententity->oldorigin[0]-r_origin[0];
// aliasoldworldtransform[1][3] = RI.currententity->oldorigin[1]-r_origin[1]; // aliasoldworldtransform[1][3] = RI.currententity->oldorigin[1]-r_origin[1];