Merge pull request #534 from illwieckz/noradiosity

Proper working with noradiosity 1 lights
This commit is contained in:
Timothee "TTimo" Besset 2018-01-07 13:06:03 -06:00 committed by GitHub
commit 94849adc93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 4 deletions

View File

@ -226,6 +226,7 @@ void CreateEntityLights( void ){
entity_t *e, *e2;
const char *name;
const char *target;
const char *noradiosity;
vec3_t dest;
const char *_color;
float intensity, scale, deviance, filterRadius;
@ -251,6 +252,12 @@ void CreateEntityLights( void ){
continue;
}
/* neumond: skip dynamic lights */
noradiosity = ValueForKey( e, "noradiosity" );
if ( noradiosity[ 0 ] == '1' ) {
continue;
}
/* lights with target names (and therefore styles) are only parsed from BSP */
target = ValueForKey( e, "targetname" );
if ( target[ 0 ] != '\0' && i >= numBSPEntities ) {

View File

@ -1644,9 +1644,16 @@ static qboolean ParseMapEntity( qboolean onlyLights ){
classname = ValueForKey( mapEnt, "classname" );
/* ydnar: only lights? */
if ( onlyLights && Q_strncasecmp( classname, "light", 5 ) ) {
numEntities--;
return qtrue;
if ( onlyLights ) {
if ( Q_strncasecmp( classname, "light", 5 ) ) {
numEntities--;
return qtrue;
}
value = ValueForKey( mapEnt, "noradiosity" );
if ( value[ 0 ] == '1' ) {
numEntities--;
return qtrue;
}
}
/* ydnar: determine if this is a func_group */

View File

@ -281,6 +281,7 @@ void SetModelNumbers( void ){
void SetLightStyles( void ){
int i, j, style, numStyles;
qboolean keepLights;
qboolean noRadiosityLight;
const char *t;
entity_t *e;
epair_t *ep, *next;
@ -303,10 +304,14 @@ void SetLightStyles( void ){
if ( Q_strncasecmp( t, "light", 5 ) ) {
continue;
}
t = ValueForKey( e, "noradiosity" );
noRadiosityLight = ( t[ 0 ] == '1' ) ? qtrue : qfalse;
t = ValueForKey( e, "targetname" );
if ( t[ 0 ] == '\0' ) {
/* ydnar: strip the light from the BSP file */
if ( keepLights == qfalse ) {
/* neumond: pass all dynamic lights to BSP regardless of keepLights.
pass all lights (radiosity+dynamic) to BSP if keepLights */
if ( keepLights == qfalse && noRadiosityLight == qfalse ) {
ep = e->epairs;
while ( ep != NULL )
{