refactoring
This commit is contained in:
parent
0aba565ab8
commit
e68546cd8b
|
@ -2698,7 +2698,13 @@ void CL_AddEntityEffects( cl_entity_t *ent )
|
|||
|
||||
if (REF_GET_PARM( PARM_MODERNFLASHLIGHT, 1 ) == true)
|
||||
{
|
||||
if( !ent->player ) // TODO: need testing
|
||||
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 ( FBitSet( ent->curstate.effects, EF_DIMLIGHT ) )
|
||||
{
|
||||
|
|
|
@ -812,7 +812,7 @@ static int addSpotLight( const vk_light_entity_t *le, float radius, int lightsty
|
|||
return index;
|
||||
}
|
||||
|
||||
void VK_AddFlashlight( cl_entity_t *ent, vk_global_camera_t g_camera ) {
|
||||
void VK_AddFlashlight( cl_entity_t *ent ) {
|
||||
vec3_t color;
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
|
@ -827,7 +827,7 @@ void VK_AddFlashlight( cl_entity_t *ent, vk_global_camera_t g_camera ) {
|
|||
const float _cone = 10.0;
|
||||
const float _cone2 = 30.0;
|
||||
const vec3_t light_color = {255, 255, 192};
|
||||
const float light_intensity = 250;
|
||||
const float light_intensity = 300;
|
||||
|
||||
VectorCopy(light_color, color);
|
||||
|
||||
|
@ -941,6 +941,8 @@ static float sphereSolidAngleFromDistDiv2Pi(float r, float d) {
|
|||
}
|
||||
|
||||
static void addDlight( const dlight_t *dlight ) {
|
||||
cl_entity_t *entPlayer;
|
||||
|
||||
const float k_light_radius = 2.f;
|
||||
const float k_threshold = 2.f;
|
||||
|
||||
|
@ -952,6 +954,12 @@ static void addDlight( const dlight_t *dlight ) {
|
|||
if( !dlight || dlight->die < gpGlobals->time || !dlight->radius )
|
||||
return;
|
||||
|
||||
// Draw flashlight
|
||||
entPlayer = gEngine.GetLocalPlayer();
|
||||
if( FBitSet( entPlayer->curstate.effects, EF_DIMLIGHT )) {
|
||||
VK_AddFlashlight(entPlayer);
|
||||
}
|
||||
|
||||
max_comp = Q_max(dlight->color.r, Q_max(dlight->color.g, dlight->color.b));
|
||||
if (max_comp < k_threshold || dlight->radius <= k_light_radius)
|
||||
return;
|
||||
|
|
|
@ -595,12 +595,8 @@ static void drawEntity( cl_entity_t *ent, int render_mode )
|
|||
|
||||
static float g_frametime = 0;
|
||||
|
||||
void VK_AddFlashlight(cl_entity_t *ent, vk_global_camera_t g_camera);
|
||||
|
||||
void VK_SceneRender( const ref_viewpass_t *rvp )
|
||||
{
|
||||
cl_entity_t *entPlayer;
|
||||
|
||||
int current_pipeline_index = kRenderNormal;
|
||||
|
||||
g_frametime = /*FIXME VK RP_NORMALPASS( )) ? */
|
||||
|
@ -664,19 +660,6 @@ void VK_SceneRender( const ref_viewpass_t *rvp )
|
|||
// Draw transparent beams
|
||||
gEngine.CL_DrawEFX( g_frametime, true );
|
||||
|
||||
// Draw flashlight // TODO: REFACTORING?
|
||||
entPlayer = gEngine.GetLocalPlayer();
|
||||
if( entPlayer->player ) { // && !Host_IsQuakeCompatible( ) ???
|
||||
if( FBitSet( entPlayer->curstate.effects, EF_DIMLIGHT )) {
|
||||
//gEngine.Con_Printf( S_WARN "FLASHLIGHT! \n");
|
||||
//dlight_t *dl = gEngine.gEfxApi.CL_AllocDlight( entPlayer->index ); // not work
|
||||
//dlight_t *dl = CL_AllocDlight( entPlayer->index ); // need copy CL_AllocDlight
|
||||
//dl->die = gpGlobals->time + 0.01f; // die on next frame
|
||||
// TODO: try allocate CL_AllocDlight from cl_tent.c but blank
|
||||
VK_AddFlashlight(entPlayer, g_camera); // FIXME: buggy with vk_rtx_freeze
|
||||
}
|
||||
}
|
||||
|
||||
VK_RenderDebugLabelEnd();
|
||||
|
||||
if (ui_infotool->value > 0)
|
||||
|
|
Loading…
Reference in New Issue