From 6e42b457ac5bf7f2005b10297c87f00fa7d87881 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 21 Mar 2015 22:09:26 +0000 Subject: [PATCH] Add a cvar: r_shadow_realtime_world_importlightentitiesfrommap 0: Never import lights from the .bsp/.ent file on map load. 1: Import lights from the .bsp/.ent file on map load if no rtlights are present. 2: Always use the .bsp/.ent's light entities, ignore rtlights files. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12208 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=e129d4fe60f23692aaa051b6c7cbc2fc1481e6b7 --- r_shadow.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/r_shadow.c b/r_shadow.c index c0ecf320..e4010bbc 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -298,6 +298,7 @@ cvar_t r_shadow_realtime_dlight_shadows = {CVAR_SAVE, "r_shadow_realtime_dlight_ cvar_t r_shadow_realtime_dlight_svbspculling = {0, "r_shadow_realtime_dlight_svbspculling", "0", "enables svbsp optimization on dynamic lights (very slow!)"}; cvar_t r_shadow_realtime_dlight_portalculling = {0, "r_shadow_realtime_dlight_portalculling", "0", "enables portal optimization on dynamic lights (slow!)"}; cvar_t r_shadow_realtime_world = {CVAR_SAVE, "r_shadow_realtime_world", "0", "enables rendering of full world lighting (whether loaded from the map, or a .rtlights file, or a .ent file, or a .lights file produced by hlight)"}; +cvar_t r_shadow_realtime_world_importlightentitiesfrommap = {0, "r_shadow_realtime_world_importlightentitiesfrommap", "1", "load lights from .ent file or map entities at startup if no .rtlights or .lights file is present (if set to 2, always use the .ent or map entities)"}; cvar_t r_shadow_realtime_world_lightmaps = {CVAR_SAVE, "r_shadow_realtime_world_lightmaps", "0", "brightness to render lightmaps when using full world lighting, try 0.5 for a tenebrae-like appearance"}; cvar_t r_shadow_realtime_world_shadows = {CVAR_SAVE, "r_shadow_realtime_world_shadows", "1", "enables rendering of shadows from world lights"}; cvar_t r_shadow_realtime_world_compile = {0, "r_shadow_realtime_world_compile", "1", "enables compilation of world lights for higher performance rendering"}; @@ -735,6 +736,7 @@ void R_Shadow_Init(void) Cvar_RegisterVariable(&r_shadow_lightradiusscale); Cvar_RegisterVariable(&r_shadow_projectdistance); Cvar_RegisterVariable(&r_shadow_frontsidecasting); + Cvar_RegisterVariable(&r_shadow_realtime_world_importlightentitiesfrommap); Cvar_RegisterVariable(&r_shadow_realtime_dlight); Cvar_RegisterVariable(&r_shadow_realtime_dlight_shadows); Cvar_RegisterVariable(&r_shadow_realtime_dlight_svbspculling); @@ -6036,10 +6038,14 @@ void R_Shadow_EditLights_Reload_f(void) return; strlcpy(r_shadow_mapname, cl.worldname, sizeof(r_shadow_mapname)); R_Shadow_ClearWorldLights(); - R_Shadow_LoadWorldLights(); - if (!Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray)) + if (r_shadow_realtime_world_importlightentitiesfrommap.integer <= 1) + { + R_Shadow_LoadWorldLights(); + if (!Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray)) + R_Shadow_LoadLightsFile(); + } + if (r_shadow_realtime_world_importlightentitiesfrommap.integer >= 1) { - R_Shadow_LoadLightsFile(); if (!Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray)) R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(); } -- 2.39.2