30 Mar 2017
This commit is contained in:
parent
5932684d40
commit
a03d5a2c48
|
@ -249,6 +249,8 @@ typedef struct render_interface_s
|
|||
void (*Mod_ProcessUserData)( struct model_s *mod, qboolean create, const byte *buffer );
|
||||
// alloc or destroy entity custom data
|
||||
void (*R_ProcessEntData)( qboolean allocate );
|
||||
// get visdata for current frame from custom renderer
|
||||
byte* (*Mod_GetCurrentVis)( void );
|
||||
} render_interface_t;
|
||||
|
||||
#endif//RENDER_API_H
|
|
@ -190,13 +190,14 @@ CL_UpdateLatchedVars
|
|||
*/
|
||||
void CL_UpdateLatchedVars( cl_entity_t *ent )
|
||||
{
|
||||
VectorCopy( ent->prevstate.origin, ent->latched.prevorigin );
|
||||
VectorCopy( ent->prevstate.angles, ent->latched.prevangles );
|
||||
ent->latched.prevanimtime = ent->prevstate.animtime;
|
||||
|
||||
if( !ent->model || ent->model->type != mod_studio )
|
||||
return; // below fields used only for studio interpolation
|
||||
|
||||
VectorCopy( ent->prevstate.origin, ent->latched.prevorigin );
|
||||
VectorCopy( ent->prevstate.angles, ent->latched.prevangles );
|
||||
|
||||
ent->latched.prevanimtime = ent->prevstate.animtime;
|
||||
|
||||
if( ent->curstate.sequence != ent->prevstate.sequence )
|
||||
{
|
||||
memcpy( ent->prevstate.blending, ent->latched.prevseqblending, sizeof( ent->prevstate.blending ));
|
||||
|
@ -216,15 +217,14 @@ CL_ResetLatchedVars
|
|||
*/
|
||||
void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset )
|
||||
{
|
||||
if( !ent->model || ent->model->type != mod_studio )
|
||||
return; // below fields used only for studio interpolation
|
||||
|
||||
if( full_reset )
|
||||
{
|
||||
// don't modify for sprites to avoid broke sprite interp
|
||||
if( ent->model && ent->model->type == mod_studio )
|
||||
{
|
||||
memcpy( ent->latched.prevblending, ent->curstate.blending, sizeof( ent->latched.prevblending ));
|
||||
ent->latched.sequencetime = ent->curstate.animtime;
|
||||
}
|
||||
|
||||
memcpy( ent->latched.prevblending, ent->curstate.blending, sizeof( ent->latched.prevblending ));
|
||||
ent->latched.sequencetime = ent->curstate.animtime;
|
||||
memcpy( ent->latched.prevcontroller, ent->curstate.controller, sizeof( ent->latched.prevcontroller ));
|
||||
ent->latched.prevframe = CL_GetStudioEstimatedFrame( ent );
|
||||
ent->prevstate = ent->curstate;
|
||||
|
@ -679,7 +679,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
CL_WriteDemoJumpTime();
|
||||
|
||||
// sentinel count. save it for debug checking
|
||||
count = MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS );
|
||||
count = MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS ) + 1;
|
||||
newframe = &cl.frames[cl.parsecountmod];
|
||||
|
||||
// allocate parse entities
|
||||
|
|
|
@ -1265,6 +1265,7 @@ void CL_PredictMovement( qboolean repredicting )
|
|||
if( !CL_LocalWeapons( ))
|
||||
{
|
||||
cl.local.viewmodel = frame->clientdata.viewmodel;
|
||||
cl.local.moving = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1322,6 +1323,7 @@ void CL_PredictMovement( qboolean repredicting )
|
|||
{
|
||||
cl.local.viewmodel = to->client.viewmodel;
|
||||
cl.local.repredicting = false;
|
||||
cl.local.moving = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1365,7 +1367,7 @@ void CL_PredictMovement( qboolean repredicting )
|
|||
cl_entity_t *ent = CL_GetEntityByIndex( cl.local.lastground );
|
||||
|
||||
cl.local.onground = cl.local.lastground;
|
||||
cl.local.moving = 0;
|
||||
cl.local.moving = false;
|
||||
|
||||
if( ent )
|
||||
{
|
||||
|
@ -1378,7 +1380,7 @@ void CL_PredictMovement( qboolean repredicting )
|
|||
if( VectorLength( delta ) > 0.0f )
|
||||
{
|
||||
cls.correction_time = 0;
|
||||
cl.local.moving = 1;
|
||||
cl.local.moving = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -654,7 +654,7 @@ void R_DrawTorus( vec3_t source, vec3_t delta, float width, float scale, float f
|
|||
}
|
||||
|
||||
// Transform point into screen space
|
||||
R_WorldToScreen( point, screen );
|
||||
TriWorldToScreen( point, screen );
|
||||
|
||||
if( i != 0 )
|
||||
{
|
||||
|
@ -961,7 +961,7 @@ R_DrawRing
|
|||
Draw beamring
|
||||
================
|
||||
*/
|
||||
void R_DrawRing(vec3_t source, vec3_t delta, float width, float amplitude, float freq, float speed, int segments)
|
||||
void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, float freq, float speed, int segments )
|
||||
{
|
||||
int i, j, noiseIndex, noiseStep;
|
||||
float div, length, fraction, factor, vLast, vStep;
|
||||
|
@ -1024,21 +1024,21 @@ void R_DrawRing(vec3_t source, vec3_t delta, float width, float amplitude, float
|
|||
for( i = 0; i < segments + 1; i++ )
|
||||
{
|
||||
fraction = i * div;
|
||||
x = cos( fraction * 2 * M_PI );
|
||||
y = sin( fraction * 2 * M_PI );
|
||||
SinCos( fraction * M_PI2, &x, &y );
|
||||
|
||||
VectorMAMAM( x, xaxis, y, yaxis, 1.0f, center, point );
|
||||
|
||||
// distort using noise
|
||||
factor = rgNoise[(noiseIndex >> 16) & 0x7F] * scale;
|
||||
factor = rgNoise[(noiseIndex >> 16) & (NOISE_DIVISIONS - 1)] * scale;
|
||||
VectorMA( point, factor, RI.vup, point );
|
||||
|
||||
// Rotate the noise along the perpendicluar axis a bit to keep the bolt from looking diagonal
|
||||
factor = rgNoise[(noiseIndex >> 16) & 0x7F] * scale * cos( fraction * M_PI * 3 * 8 + freq );
|
||||
factor = rgNoise[(noiseIndex >> 16) & (NOISE_DIVISIONS - 1)] * scale;
|
||||
factor *= cos( fraction * M_PI * 24 + freq );
|
||||
VectorMA( point, factor, RI.vright, point );
|
||||
|
||||
// Transform point into screen space
|
||||
R_WorldToScreen( point, screen );
|
||||
TriWorldToScreen( point, screen );
|
||||
|
||||
if( i != 0 )
|
||||
{
|
||||
|
@ -1048,6 +1048,8 @@ void R_DrawRing(vec3_t source, vec3_t delta, float width, float amplitude, float
|
|||
// we don't need Z, we're in screen space
|
||||
tmp[2] = 0;
|
||||
VectorNormalize( tmp );
|
||||
|
||||
// Build point along normal line (normal is -y, x)
|
||||
VectorScale( RI.vup, tmp[0], normal );
|
||||
VectorMA( normal, tmp[1], RI.vright, normal );
|
||||
|
||||
|
|
|
@ -105,9 +105,6 @@ qboolean R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags
|
|||
if( surf->flags & SURF_WATERCSG && !( e->curstate.effects & EF_NOWATERCSG ))
|
||||
return true;
|
||||
|
||||
if( surf->flags & SURF_NOCULL )
|
||||
return false;
|
||||
|
||||
// don't cull transparent surfaces because we should be draw decals on them
|
||||
if( surf->pdecals && ( e->curstate.rendermode == kRenderTransTexture || e->curstate.rendermode == kRenderTransAdd ))
|
||||
return false;
|
||||
|
@ -119,9 +116,9 @@ qboolean R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags
|
|||
if( RI.currententity == clgame.entities && surf->visframe != tr.framecount )
|
||||
return true;
|
||||
|
||||
if( r_faceplanecull->value && glState.faceCull != 0 )
|
||||
if( r_faceplanecull->value && !FBitSet( surf->flags, SURF_DRAWTURB ))
|
||||
{
|
||||
if( e->curstate.scale == 0.0f && !VectorIsNull( surf->plane->normal ))
|
||||
if( !VectorIsNull( surf->plane->normal ))
|
||||
{
|
||||
float dist;
|
||||
|
||||
|
|
|
@ -597,6 +597,9 @@ static void GL_SetTextureTarget( gltexture_t *tex, rgbdata_t *pic )
|
|||
// depth cubemaps only allowed when GL_EXT_gpu_shader4 is supported
|
||||
if( tex->target == GL_TEXTURE_CUBE_MAP_ARB && !GL_Support( GL_EXT_GPU_SHADER4 ) && FBitSet( tex->flags, TF_DEPTHMAP ))
|
||||
tex->target = GL_NONE;
|
||||
|
||||
if( tex->target == GL_TEXTURE_CUBE_MAP_ARB )
|
||||
tex->flags |= TF_CUBEMAP; // it's cubemap!
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -203,6 +203,7 @@ typedef struct
|
|||
int realframecount; // not including viewpasses
|
||||
int framecount;
|
||||
|
||||
qboolean fCustomRendering;
|
||||
qboolean fResetVis;
|
||||
|
||||
byte visbytes[(MAX_MAP_LEAFS+7)/8]; // member custom PVS
|
||||
|
|
|
@ -1074,6 +1074,8 @@ void R_RenderFrame( const ref_viewpass_t *rvp )
|
|||
// completely override rendering
|
||||
if( clgame.drawFuncs.GL_RenderFrame != NULL )
|
||||
{
|
||||
tr.fCustomRendering = true;
|
||||
|
||||
if( clgame.drawFuncs.GL_RenderFrame( rvp ))
|
||||
{
|
||||
tr.realframecount++;
|
||||
|
@ -1082,6 +1084,7 @@ void R_RenderFrame( const ref_viewpass_t *rvp )
|
|||
}
|
||||
}
|
||||
|
||||
tr.fCustomRendering = false;
|
||||
R_RunViewmodelEvents();
|
||||
tr.realframecount++; // right called after viewmodel events
|
||||
|
||||
|
@ -1315,9 +1318,7 @@ static void R_SetCurrentModel( model_t *mod )
|
|||
|
||||
static int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis )
|
||||
{
|
||||
int bytes = Mod_FatPVS( org, radius, visbuffer, world.visbytes, merge, fullvis );
|
||||
if( visbuffer ) memcpy( tr.visbytes, visbuffer, world.visbytes );
|
||||
return bytes;
|
||||
return Mod_FatPVS( org, radius, visbuffer, world.visbytes, merge, fullvis );
|
||||
}
|
||||
|
||||
static lightstyle_t *CL_GetLightStyle( int number )
|
||||
|
|
|
@ -44,6 +44,8 @@ static void LM_UploadBlock( int lightmapnum );
|
|||
|
||||
byte *Mod_GetCurrentVis( void )
|
||||
{
|
||||
if( clgame.drawFuncs.Mod_GetCurrentVis && tr.fCustomRendering )
|
||||
return clgame.drawFuncs.Mod_GetCurrentVis();
|
||||
return RI.visbytes;
|
||||
}
|
||||
|
||||
|
@ -1199,7 +1201,7 @@ dynamic:
|
|||
|
||||
if( is_dynamic )
|
||||
{
|
||||
if(( fa->styles[maps] >= 32 || fa->styles[maps] == 0 ) && ( fa->dlightframe != tr.framecount ))
|
||||
if(( fa->styles[maps] >= 32 || fa->styles[maps] == 0 || fa->styles[maps] == 20 ) && ( fa->dlightframe != tr.framecount ))
|
||||
{
|
||||
byte temp[132*132*4];
|
||||
int sample_size;
|
||||
|
|
|
@ -1603,6 +1603,9 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||
VectorSubtract( pseqdesc->bbmax, pseqdesc->bbmin, size );
|
||||
total = Q_max( size[0], Q_max( size[1], size[2] ));
|
||||
|
||||
if( RI.currententity == &clgame.viewent )
|
||||
total = 0.0f; // never used for viewmodels
|
||||
|
||||
if( !FBitSet( pseqdesc->flags, STUDIO_LOOPING ) && !pseqdesc->activity && m_pStudioHeader->numseq > 1 && total > 128.0f )
|
||||
Matrix3x4_OriginFromMatrix( g_studio.lighttransform[0], origin );
|
||||
else Matrix3x4_OriginFromMatrix( g_studio.rotationmatrix, origin );
|
||||
|
|
|
@ -195,7 +195,7 @@ void SV_EmitPacketEntities( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg
|
|||
MsgDev( D_WARN, "%s: delta request from out of date entities.\n", cl->name );
|
||||
|
||||
MSG_BeginServerCmd( msg, svc_packetentities );
|
||||
MSG_WriteUBitLong( msg, to->num_entities, MAX_VISIBLE_PACKET_BITS );
|
||||
MSG_WriteUBitLong( msg, to->num_entities - 1, MAX_VISIBLE_PACKET_BITS );
|
||||
|
||||
from = NULL;
|
||||
oldmax = 0;
|
||||
|
@ -203,7 +203,7 @@ void SV_EmitPacketEntities( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg
|
|||
else
|
||||
{
|
||||
MSG_BeginServerCmd( msg, svc_deltapacketentities );
|
||||
MSG_WriteUBitLong( msg, to->num_entities, MAX_VISIBLE_PACKET_BITS );
|
||||
MSG_WriteUBitLong( msg, to->num_entities - 1, MAX_VISIBLE_PACKET_BITS );
|
||||
MSG_WriteByte( msg, cl->delta_sequence );
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ void SV_EmitPacketEntities( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg
|
|||
oldmax = 0;
|
||||
|
||||
MSG_BeginServerCmd( msg, svc_packetentities );
|
||||
MSG_WriteUBitLong( msg, to->num_entities, MAX_VISIBLE_PACKET_BITS );
|
||||
MSG_WriteUBitLong( msg, to->num_entities - 1, MAX_VISIBLE_PACKET_BITS );
|
||||
}
|
||||
|
||||
newent = NULL;
|
||||
|
|
|
@ -512,7 +512,7 @@ void SV_RunGameFrame( void )
|
|||
{
|
||||
sv.time_residual += host.frametime;
|
||||
|
||||
while( sv.time_residual >= sv.frametime )
|
||||
if( sv.time_residual >= sv.frametime )
|
||||
{
|
||||
SV_Physics();
|
||||
|
||||
|
|
Reference in New Issue