make flashlight handling a bit cleaner
This commit is contained in:
parent
cf09305f79
commit
51a29c012c
|
@ -840,12 +840,7 @@ static int addSpotLight( const vk_light_entity_t *le, float radius, int lightsty
|
|||
return index;
|
||||
}
|
||||
|
||||
void VK_AddFlashlight( cl_entity_t *ent ) {
|
||||
vec3_t color;
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
vk_light_entity_t le;
|
||||
|
||||
void R_LightAddFlashlight(const struct cl_entity_s *ent, qboolean local_player ) {
|
||||
// parameters
|
||||
const float hack_attenuation = 0.1;
|
||||
float radius = 1.0;
|
||||
|
@ -855,11 +850,16 @@ void VK_AddFlashlight( cl_entity_t *ent ) {
|
|||
const vec3_t light_color = {255, 255, 192};
|
||||
float light_intensity = 300;
|
||||
|
||||
vec3_t color;
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
vk_light_entity_t le;
|
||||
|
||||
float thirdperson_offset = 25;
|
||||
vec3_t forward, view_ofs;
|
||||
vec3_t vecSrc, vecEnd;
|
||||
pmtrace_t *trace;
|
||||
if( ent->index == gEngine.EngineGetParm(PARM_PLAYER_INDEX, 0))
|
||||
if( local_player )
|
||||
{
|
||||
// local player case
|
||||
// position
|
||||
|
@ -1077,7 +1077,6 @@ void XVK_GetEmissiveForTexture( vec3_t out, int texture_id ) {
|
|||
void VK_LightsFrameFinalize( void ) {
|
||||
APROF_SCOPE_BEGIN_EARLY(finalize);
|
||||
const model_t* const world = gEngine.pfnGetModelByIndex( 1 );
|
||||
cl_entity_t *entPlayer;
|
||||
|
||||
if (g_lights.num_emissive_surfaces > UINT8_MAX) {
|
||||
ERROR_THROTTLED(10, "Too many emissive surfaces found: %d; some areas will be dark", g_lights.num_emissive_surfaces);
|
||||
|
@ -1110,11 +1109,6 @@ void VK_LightsFrameFinalize( void ) {
|
|||
continue;
|
||||
addDlight(dlight);
|
||||
}
|
||||
// Draw flashlight for local player
|
||||
entPlayer = gEngine.GetLocalPlayer();
|
||||
if( FBitSet( entPlayer->curstate.effects, EF_DIMLIGHT )) {
|
||||
VK_AddFlashlight(entPlayer);
|
||||
}
|
||||
APROF_SCOPE_END(dlights);
|
||||
|
||||
if (debug_dump_lights.enabled) {
|
||||
|
|
|
@ -92,3 +92,6 @@ void XVK_GetEmissiveForTexture( vec3_t out, int texture_id );
|
|||
void VK_LightsFrameFinalize( void );
|
||||
|
||||
int R_LightCellIndex( const int light_cell[3] );
|
||||
|
||||
struct cl_entity_s;
|
||||
void R_LightAddFlashlight( const struct cl_entity_s *ent, qboolean local_player );
|
||||
|
|
|
@ -595,10 +595,8 @@ static void drawEntity( cl_entity_t *ent, int render_mode )
|
|||
|
||||
static float g_frametime = 0;
|
||||
|
||||
void VK_AddFlashlight(cl_entity_t *ent);
|
||||
|
||||
void VK_SceneRender( const ref_viewpass_t *rvp ) {
|
||||
int current_pipeline_index = kRenderNormal;
|
||||
const cl_entity_t* const local_player = gEngine.GetLocalPlayer();
|
||||
|
||||
g_frametime = /*FIXME VK RP_NORMALPASS( )) ? */
|
||||
gpGlobals->time - gpGlobals->oldtime
|
||||
|
@ -631,14 +629,22 @@ void VK_SceneRender( const ref_viewpass_t *rvp ) {
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Draw flashlight for local player
|
||||
if( FBitSet( local_player->curstate.effects, EF_DIMLIGHT )) {
|
||||
R_LightAddFlashlight(local_player, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw opaque entities
|
||||
for (int i = 0; i < g_lists.draw_list->num_solid_entities; ++i)
|
||||
{
|
||||
cl_entity_t *ent = g_lists.draw_list->solid_entities[i];
|
||||
drawEntity(ent, kRenderNormal);
|
||||
|
||||
// Draw flashlight for other players
|
||||
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT )) {
|
||||
VK_AddFlashlight(ent);
|
||||
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ) && ent != local_player) {
|
||||
R_LightAddFlashlight(ent, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue