vmap: Added vmap_lightLinear, added vmap_lightLinearFade, plus light_surface
can now check for spawnflags 1 and has a valid 'fade' key value.
This commit is contained in:
parent
56603d6048
commit
c5bfadcf1a
3 changed files with 37 additions and 3 deletions
|
@ -400,9 +400,11 @@ void CreateEntityLights( void ){
|
||||||
si = info->si;
|
si = info->si;
|
||||||
|
|
||||||
float lb;
|
float lb;
|
||||||
|
float llfade;
|
||||||
int subd;
|
int subd;
|
||||||
int style;
|
int style;
|
||||||
float bscale, bsfrac, bsdist;
|
float bscale, bsfrac, bsdist;
|
||||||
|
int sflags;
|
||||||
|
|
||||||
if (!stristr(si->shader, surfacename))
|
if (!stristr(si->shader, surfacename))
|
||||||
continue;
|
continue;
|
||||||
|
@ -413,13 +415,15 @@ void CreateEntityLights( void ){
|
||||||
* the rest is always dummy values which are meaningless.
|
* the rest is always dummy values which are meaningless.
|
||||||
*/
|
*/
|
||||||
sscanf( _light_brightness, "%*f %*f %*f %f", &lb );
|
sscanf( _light_brightness, "%*f %*f %*f %f", &lb );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lb = FloatForKey( e, "light" );
|
lb = FloatForKey( e, "light" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sflags = IntForKey( e, "spawnflags" );
|
||||||
subd = IntForKey( e, "subdivisions" );
|
subd = IntForKey( e, "subdivisions" );
|
||||||
style = IntForKey( e, "style" );
|
style = IntForKey( e, "style" );
|
||||||
bscale = FloatForKey( e, "bouncescale" );
|
bscale = FloatForKey( e, "bouncescale" );
|
||||||
|
llfade = FloatForKey( e, "fade" );
|
||||||
|
|
||||||
/* 0.05 is a default */
|
/* 0.05 is a default */
|
||||||
bsfrac = FloatForKey( e, "backsplash_fraction" ) * 0.01f;
|
bsfrac = FloatForKey( e, "backsplash_fraction" ) * 0.01f;
|
||||||
|
@ -430,6 +434,10 @@ void CreateEntityLights( void ){
|
||||||
/* only apply when things are set. */
|
/* only apply when things are set. */
|
||||||
if (lb)
|
if (lb)
|
||||||
si->value = lb;
|
si->value = lb;
|
||||||
|
if (sflags & 1)
|
||||||
|
si->lightLinear = qtrue;
|
||||||
|
if (llfade)
|
||||||
|
si->lightLinearFade = llfade;
|
||||||
if (subd)
|
if (subd)
|
||||||
si->lightSubdivide = subd;
|
si->lightSubdivide = subd;
|
||||||
if (style)
|
if (style)
|
||||||
|
@ -859,9 +867,22 @@ void CreateSurfaceLights( void ){
|
||||||
|
|
||||||
/* set it up */
|
/* set it up */
|
||||||
light->flags = LIGHT_Q3A_DEFAULT;
|
light->flags = LIGHT_Q3A_DEFAULT;
|
||||||
|
|
||||||
|
/* vmap_lightLinear */
|
||||||
|
if (si->lightLinear == qtrue) {
|
||||||
|
light->flags &= ~LIGHT_ATTEN_ANGLE;
|
||||||
|
light->flags |= LIGHT_ATTEN_LINEAR;
|
||||||
|
}
|
||||||
|
|
||||||
light->type = EMIT_POINT;
|
light->type = EMIT_POINT;
|
||||||
light->photons = si->value * pointScale;
|
light->photons = si->value * pointScale;
|
||||||
|
|
||||||
|
/* vmap_lightLinearFade <multiplier> */
|
||||||
|
light->fade = si->lightLinearFade;
|
||||||
|
|
||||||
|
if (light->fade == 0.0f)
|
||||||
light->fade = 1.0f;
|
light->fade = 1.0f;
|
||||||
|
|
||||||
light->si = si;
|
light->si = si;
|
||||||
VectorCopy( origin, light->origin );
|
VectorCopy( origin, light->origin );
|
||||||
VectorCopy( si->color, light->color );
|
VectorCopy( si->color, light->color );
|
||||||
|
|
|
@ -1406,6 +1406,17 @@ shaderInfo_t *ShaderInfoForShader( const char *shaderName ){
|
||||||
si->lightSubdivide = atoi( mattoken );
|
si->lightSubdivide = atoi( mattoken );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vmap_lightLinear */
|
||||||
|
else if ( !Q_stricmp( mattoken, "vmap_lightLinear" ) ) {
|
||||||
|
si->lightLinear = qtrue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vmap_lightLinearFade multiplier */
|
||||||
|
else if ( !Q_stricmp( mattoken, "vmap_lightLinearFade" ) ) {
|
||||||
|
GetMatTokenAppend( shaderText, qfalse );
|
||||||
|
si->lightLinearFade = atof( mattoken );
|
||||||
|
}
|
||||||
|
|
||||||
/* q3map_backsplash <percent> <distance> */
|
/* q3map_backsplash <percent> <distance> */
|
||||||
else if ( !Q_stricmp( mattoken, "q3map_backsplash" ) || !Q_stricmp( mattoken, "vmap_backsplash" ) ) {
|
else if ( !Q_stricmp( mattoken, "q3map_backsplash" ) || !Q_stricmp( mattoken, "vmap_backsplash" ) ) {
|
||||||
GetMatTokenAppend( shaderText, qfalse );
|
GetMatTokenAppend( shaderText, qfalse );
|
||||||
|
|
|
@ -693,6 +693,8 @@ typedef struct shaderInfo_s
|
||||||
float backsplashDistance; /* default 16 */
|
float backsplashDistance; /* default 16 */
|
||||||
float lightSubdivide; /* default 999 */
|
float lightSubdivide; /* default 999 */
|
||||||
float lightFilterRadius; /* ydnar: lightmap filtering/blurring radius for lights created by this shader (default: 0) */
|
float lightFilterRadius; /* ydnar: lightmap filtering/blurring radius for lights created by this shader (default: 0) */
|
||||||
|
qb_t lightLinear; /* vmap addition */
|
||||||
|
float lightLinearFade; /* vmap addition */
|
||||||
|
|
||||||
int lightmapSampleSize; /* lightmap sample size */
|
int lightmapSampleSize; /* lightmap sample size */
|
||||||
float lightmapSampleOffset; /* ydnar: lightmap sample offset (default: 1.0) */
|
float lightmapSampleOffset; /* ydnar: lightmap sample offset (default: 1.0) */
|
||||||
|
|
Loading…
Reference in a new issue