Proper working with noradiosity 1 lights

This commit is contained in:
neumond 2014-05-10 13:48:39 +04:00 committed by Thomas Debesse
parent 222adc1c87
commit 89c8c7355d
3 changed files with 23 additions and 4 deletions

View file

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

View file

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

View file

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