remove workaround for classic render

This commit is contained in:
NightFox 2021-12-28 00:50:39 +03:00
parent 2395469d0c
commit 0b1b181f26
3 changed files with 19 additions and 70 deletions

View File

@ -2698,13 +2698,7 @@ void CL_AddEntityEffects( cl_entity_t *ent )
if (REF_GET_PARM( PARM_MODERNFLASHLIGHT, 1 ) == true)
{
if( ent->player ) // && !Host_IsQuakeCompatible( ) ???
{
dlight_t *dl = CL_AllocDlight( ent->index );
dl->radius = -1;
dl->die = cl.time + 0.01f; // die on next frame
}
else
if( !ent->player )
{
if ( FBitSet( ent->curstate.effects, EF_DIMLIGHT ) )
{

View File

@ -551,70 +551,21 @@ static uint32_t writeDlightsToUBO( void )
// TODO this should not be here (where? vk_scene?)
for (int i = 0; i < MAX_DLIGHTS && num_lights < ARRAYSIZE(ubo_lights->light); ++i) {
dlight_t *l = gEngine.GetDynamicLight(i);
const dlight_t *l = gEngine.GetDynamicLight(i);
if( !l || l->die < gpGlobals->time || !l->radius )
continue;
// Draw flashlight (workaround)
cl_entity_t *entPlayer;
entPlayer = gEngine.GetLocalPlayer();
if( FBitSet( entPlayer->curstate.effects, EF_DIMLIGHT )) {
#define FLASHLIGHT_DISTANCE 2000 // in units
pmtrace_t *trace;
vec3_t forward, view_ofs;
vec3_t vecSrc, vecEnd;
float falloff;
trace = gEngine.EV_VisTraceLine( vecSrc, vecEnd, PM_NORMAL );
// compute falloff
falloff = trace->fraction * FLASHLIGHT_DISTANCE;
if( falloff < 500.0f ) falloff = 1.0f;
else falloff = 500.0f / falloff;
falloff *= falloff;
AngleVectors( g_camera.viewangles, forward, NULL, NULL );
view_ofs[0] = view_ofs[1] = 0.0f;
if( entPlayer->curstate.usehull == 1 ) {
view_ofs[2] = 12.0f; // VEC_DUCK_VIEW;
} else {
view_ofs[2] = 28.0f; // DEFAULT_VIEWHEIGHT
}
VectorAdd( entPlayer->origin, view_ofs, vecSrc );
VectorMA( vecSrc, FLASHLIGHT_DISTANCE, forward, vecEnd );
trace = gEngine.EV_VisTraceLine( vecSrc, vecEnd, PM_NORMAL );
VectorMA( trace->endpos, -10, forward, l->origin );
// apply brigthness to dlight
l->color.r = bound( 0, falloff * 255, 255 );
l->color.g = bound( 0, falloff * 255, 255 );
l->color.b = bound( 0, falloff * 255, 255 );
l->radius = 75;
Vector4Set(
ubo_lights->light[num_lights].color,
l->color.r / 255.f,
l->color.g / 255.f,
l->color.b / 255.f,
1.f);
Vector4Set(
ubo_lights->light[num_lights].pos_r,
l->origin[0],
l->origin[1],
l->origin[2],
l->radius);
} else {
Vector4Set(
ubo_lights->light[num_lights].color,
l->color.r / 255.f,
l->color.g / 255.f,
l->color.b / 255.f,
1.f);
Vector4Set(
ubo_lights->light[num_lights].pos_r,
l->origin[0],
l->origin[1],
l->origin[2],
l->radius);
}
Vector4Set(
ubo_lights->light[num_lights].color,
l->color.r / 255.f,
l->color.g / 255.f,
l->color.b / 255.f,
1.f);
Vector4Set(
ubo_lights->light[num_lights].pos_r,
l->origin[0],
l->origin[1],
l->origin[2],
l->radius);
num_lights++;
}

View File

@ -1,4 +1,5 @@
#include "vk_core.h"
#include "vk_cvar.h"
#include "vk_common.h"
#include "vk_textures.h"
#include "vk_renderstate.h"
@ -250,7 +251,10 @@ static int VK_RefGetParm( int parm, int arg )
tex = findTexture(arg);
return tex->flags;
case PARM_MODERNFLASHLIGHT:
return true;
if (CVAR_TO_BOOL( vk_rtx )) {
return true;
}
return false;
}
PRINT_NOT_IMPLEMENTED_ARGS("(%s(%d), %d)", getParmName(parm), parm, arg);