Try to parse the rerelease's various _shadowlight keys, needs 'r_editlights_reload bsp' still.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6039 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
c2d3d3a41b
commit
ca03eba000
|
@ -331,6 +331,7 @@ typedef struct dlight_s
|
|||
#endif
|
||||
float corona;
|
||||
float coronascale;
|
||||
float fade[2];
|
||||
|
||||
unsigned int flags;
|
||||
char cubemapname[MAX_QPATH];
|
||||
|
|
|
@ -798,6 +798,8 @@ qboolean R_ImportRTLights(const char *entlump)
|
|||
qboolean okay = false;
|
||||
infobuf_t targets;
|
||||
const char *lmp;
|
||||
qboolean rerelease = false;
|
||||
float fade[2];
|
||||
memset(&targets, 0, sizeof(targets));
|
||||
|
||||
//a quick note about tenebrae:
|
||||
|
@ -846,7 +848,11 @@ qboolean R_ImportRTLights(const char *entlump)
|
|||
if (nest!=1)
|
||||
continue;
|
||||
if (key[0] == '_')
|
||||
{
|
||||
if (!strcmp(key+1, "shadowlight"))
|
||||
rerelease = true;
|
||||
memmove(key, key+1, strlen(key));
|
||||
}
|
||||
while (key[strlen(key)-1] == ' ') // remove trailing spaces
|
||||
key[strlen(key)-1] = 0;
|
||||
lmp = COM_ParseOut(lmp, value, sizeof(value));
|
||||
|
@ -884,6 +890,7 @@ qboolean R_ImportRTLights(const char *entlump)
|
|||
style = 0;
|
||||
skin = 0;
|
||||
pflags = 0;
|
||||
fade[0] = fade[1] = 0;
|
||||
VectorSet(colourscales, r_editlights_import_ambient.value, r_editlights_import_diffuse.value, r_editlights_import_specular.value);
|
||||
//effects = 0;
|
||||
islight = false;
|
||||
|
@ -918,6 +925,39 @@ qboolean R_ImportRTLights(const char *entlump)
|
|||
break; // error
|
||||
Q_strncpyz(value, com_token, sizeof(value));
|
||||
|
||||
if (rerelease)
|
||||
{
|
||||
if (!strcmp("color", key))
|
||||
sscanf(value, "%f %f %f", &light[0], &light[1], &light[2]);
|
||||
else if (!strcmp("shadowlightcull", key))
|
||||
;//sscanf(value, "%f %f %f", &color[0], &color[1], &color[2]);
|
||||
else if (!strcmp("shadowlightresolution", key))
|
||||
;//sscanf(value, "%f %f %f", &color[0], &color[1], &color[2]);
|
||||
else if (!strcmp("shadowlightradius", key))
|
||||
light[3] = atof(value);
|
||||
else if (!strcmp("shadowlightstartfadedistance", key))
|
||||
fade[0] = atof(value);
|
||||
else if (!strcmp("shadowlightendfadedistance", key))
|
||||
fade[1] = atof(value);
|
||||
else if (!strcmp("shadowlightintensity", key))
|
||||
{
|
||||
colourscales[0] *= atof(value);
|
||||
colourscales[1] *= atof(value);
|
||||
colourscales[2] *= atof(value);
|
||||
}
|
||||
else if (!strcmp("shadowlight", key))
|
||||
islight = atoi(value);
|
||||
else if (!strcmp("shadowlightstyle", key))
|
||||
style = atoi(value);
|
||||
else if (!strcmp("shadowlightconeangle", key))
|
||||
angles[1] = atof(value)*2;
|
||||
else if (!strcmp("origin", key))
|
||||
sscanf(value, "%f %f %f", &origin[0], &origin[1], &origin[2]);
|
||||
else if (!strcmp("target", key))
|
||||
Q_strncpyz(target, value, sizeof(target));
|
||||
}
|
||||
else
|
||||
{
|
||||
// now that we have the key pair worked out...
|
||||
if (!strcmp("light", key))
|
||||
{
|
||||
|
@ -1062,7 +1102,6 @@ qboolean R_ImportRTLights(const char *entlump)
|
|||
colourscales[1] = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (!strcmp("light_radius", key))
|
||||
{
|
||||
light[0] = 1;
|
||||
|
@ -1085,6 +1124,7 @@ qboolean R_ImportRTLights(const char *entlump)
|
|||
r_shadow_realtime_world_lightmaps.value = atof(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!islight)
|
||||
continue;
|
||||
if (lightscale <= 0)
|
||||
|
@ -1163,6 +1203,8 @@ qboolean R_ImportRTLights(const char *entlump)
|
|||
dl->flags |= (pflags & PFLAGS_CORONA)?LFLAG_FLASHBLEND:0;
|
||||
dl->flags |= (pflags & PFLAGS_NOSHADOW)?LFLAG_NOSHADOWS:0;
|
||||
dl->style = style;
|
||||
dl->fade[0] = fade[0];
|
||||
dl->fade[1] = fade[1];
|
||||
VectorCopy(colourscales, dl->lightcolourscales);
|
||||
|
||||
//handle spotlights.
|
||||
|
@ -1230,6 +1272,7 @@ qboolean R_LoadRTLights(void)
|
|||
float corona;
|
||||
float ambientscale, diffusescale, specularscale;
|
||||
vec3_t angles;
|
||||
float fade[2];
|
||||
|
||||
//delete all old lights, even dynamic ones
|
||||
rtlights_first = RTL_FIRST;
|
||||
|
@ -1329,7 +1372,7 @@ qboolean R_LoadRTLights(void)
|
|||
file = COM_Parse(file);
|
||||
flags |= file?atoi(com_token):LFLAG_REALTIMEMODE;
|
||||
|
||||
nearclip = fov = avel[0] = avel[1] = avel[2] = 0;
|
||||
nearclip = fov = avel[0] = avel[1] = avel[2] = fade[0] = fade[1] = 0;
|
||||
*customstyle = 0;
|
||||
while(file)
|
||||
{
|
||||
|
@ -1342,6 +1385,10 @@ qboolean R_LoadRTLights(void)
|
|||
avel[2] = file?atof(com_token+5):0;
|
||||
else if (!strncmp(com_token, "fov=", 4))
|
||||
fov = file?atof(com_token+4):0;
|
||||
else if (!strncmp(com_token, "fademin=", 8))
|
||||
fade[0] = file?atof(com_token+8):0;
|
||||
else if (!strncmp(com_token, "fademax=", 8))
|
||||
fade[1] = file?atof(com_token+4):0;
|
||||
else if (!strncmp(com_token, "nearclip=", 9))
|
||||
nearclip = file?atof(com_token+9):0;
|
||||
else if (!strncmp(com_token, "nostencil=", 10))
|
||||
|
@ -1374,6 +1421,8 @@ qboolean R_LoadRTLights(void)
|
|||
dl->lightcolourscales[0] = ambientscale;
|
||||
dl->lightcolourscales[1] = diffusescale;
|
||||
dl->lightcolourscales[2] = specularscale;
|
||||
dl->fade[0] = fade[0];
|
||||
dl->fade[1] = fade[1];
|
||||
AngleVectorsFLU(angles, dl->axis[0], dl->axis[1], dl->axis[2]);
|
||||
VectorCopy(avel, dl->rotation);
|
||||
|
||||
|
@ -1460,6 +1509,8 @@ static void R_SaveRTLights_f(void)
|
|||
VFS_PRINTF(f, " nearclip=%g", light->nearclip); //aka: distance into a wall, for lights that are meant to appear to come from a texture
|
||||
if (light->customstyle)
|
||||
VFS_PRINTF(f, " \"stylestring=%s\"", light->customstyle); //aka: outer cone
|
||||
if (light->fade[1]>0)
|
||||
VFS_PRINTF(f, " \"fademin=%g\" \"fademax=%g\"", light->fade[0], light->fade[1]);
|
||||
|
||||
VFS_PUTS(f, "\n");
|
||||
}
|
||||
|
|
|
@ -4100,6 +4100,20 @@ void Sh_DrawLights(qbyte *vis)
|
|||
colour[1] *= r_lightstylescale.value;
|
||||
colour[2] *= r_lightstylescale.value;
|
||||
}
|
||||
if (dl->fade[1])
|
||||
{
|
||||
vec3_t dir;
|
||||
float dist;
|
||||
VectorSubtract(dl->origin, r_origin, dir);
|
||||
dist = VectorLength(dir);
|
||||
if (dist > dl->fade[1])
|
||||
continue;
|
||||
if (dist > dl->fade[0])
|
||||
{
|
||||
dist = (dist-dl->fade[0]) / (dl->fade[1]-dl->fade[0]);
|
||||
VectorScale(colour, dist, colour);
|
||||
}
|
||||
}
|
||||
colour[0] *= r_refdef.hdr_value;
|
||||
colour[1] *= r_refdef.hdr_value;
|
||||
colour[2] *= r_refdef.hdr_value;
|
||||
|
|
Loading…
Reference in New Issue