Merge pull request #3 from Joshua-Ashton/zhlt_ambient_color

Support for ZHLT sun spread angle and ambient light_environment color
This commit is contained in:
Marco Cawthorne 2021-08-22 20:23:15 +02:00 committed by GitHub
commit d23ad3e797
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -246,7 +246,7 @@ void CreateEntityLights( void ){
const char *name; const char *name;
const char *target; const char *target;
vec3_t dest; vec3_t dest;
const char *_color, *_light_brightness; const char *_color, *_light_brightness, *_spread;
float intensity, scale, deviance, filterRadius; float intensity, scale, deviance, filterRadius;
int spawnflags, flags, numSamples; int spawnflags, flags, numSamples;
qboolean junior; qboolean junior;
@ -304,6 +304,10 @@ void CreateEntityLights( void ){
} else { } else {
/* alternative: read color in RGB8 values -eukara */ /* alternative: read color in RGB8 values -eukara */
_color = ValueForKey( e, "ambientcolor255" ); _color = ValueForKey( e, "ambientcolor255" );
if ( !_color || !_color[ 0 ] ) {
/* ZHLT's ambient light_environment color. */
_color = ValueForKey( e, "_diffuse_light" );
}
if ( _color && _color[ 0 ] ) { if ( _color && _color[ 0 ] ) {
sscanf( _color, "%f %f %f", &ambientColor[ 0 ], &ambientColor[ 1 ], &ambientColor[ 2 ] ); sscanf( _color, "%f %f %f", &ambientColor[ 0 ], &ambientColor[ 1 ], &ambientColor[ 2 ] );
ambientColor[0] /= 255; ambientColor[0] /= 255;
@ -336,7 +340,14 @@ void CreateEntityLights( void ){
/* get filter radius from shader */ /* get filter radius from shader */
sun->filterRadius = FloatForKey( e, "filterradius" ); sun->filterRadius = FloatForKey( e, "filterradius" );
sun->deviance = FloatForKey( e, "sunspreadangle" ); _spread = ValueForKey( e, "_spread" );
if ( _spread && _spread[ 0 ] ) {
/* ZHLT's sun spread angle. */
sun->deviance = atof( _spread );
}
else {
sun->deviance = FloatForKey( e, "sunspreadangle" );
}
sun->deviance = sun->deviance / 180.0f * Q_PI; sun->deviance = sun->deviance / 180.0f * Q_PI;
sun->numSamples = IntForKey( e, "samples" ); sun->numSamples = IntForKey( e, "samples" );