-
Notifications
You must be signed in to change notification settings - Fork 69
NUKE leftover CPU lightGrid code, minor fixes and cleanup #1496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3955,7 +3955,7 @@ static void R_LoadFogs( lump_t *l, lump_t *brushesLump, lump_t *sidesLump ) | |
| Log::Debug("%i fog volumes loaded", s_worldData.numFogs ); | ||
| } | ||
|
|
||
| static void R_SetDefaultLightGrid() | ||
| static void R_SetConstantColorLightGrid( const byte color[3] ) | ||
| { | ||
| world_t *w = &s_worldData; | ||
|
|
||
|
|
@@ -3983,9 +3983,9 @@ static void R_SetDefaultLightGrid() | |
| bspGridPoint2_t *gridPoint2 = (bspGridPoint2_t *) (gridPoint1 + w->numLightGridPoints); | ||
|
|
||
| // default some white light from above | ||
| gridPoint1->color[ 0 ] = 64; | ||
| gridPoint1->color[ 1 ] = 64; | ||
| gridPoint1->color[ 2 ] = 64; | ||
| gridPoint1->color[ 0 ] = color[0]; | ||
| gridPoint1->color[ 1 ] = color[1]; | ||
| gridPoint1->color[ 2 ] = color[2]; | ||
| gridPoint1->ambientPart = 128; | ||
| gridPoint2->direction[ 0 ] = floatToSnorm8(0.0f); | ||
| gridPoint2->direction[ 1 ] = floatToSnorm8(0.0f); | ||
|
|
@@ -4039,9 +4039,16 @@ void R_LoadLightGrid( lump_t *l ) | |
| vec3_t ambientColor, directedColor, direction; | ||
| float scale; | ||
|
|
||
| if ( tr.ambientLightSet ) { | ||
| const byte color[3]{ floatToUnorm8( tr.ambientLight[0] ), floatToUnorm8( tr.ambientLight[1] ), | ||
| floatToUnorm8( tr.ambientLight[2] ) }; | ||
| R_SetConstantColorLightGrid( color ); | ||
| } | ||
|
|
||
| if ( !r_precomputedLighting->integer ) | ||
| { | ||
| R_SetDefaultLightGrid(); | ||
| const byte color[3] { 64, 64, 64 }; | ||
| R_SetConstantColorLightGrid( color ); | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -4081,7 +4088,8 @@ void R_LoadLightGrid( lump_t *l ) | |
| { | ||
| Log::Warn("light grid mismatch, default light grid used" ); | ||
|
|
||
| R_SetDefaultLightGrid(); | ||
| const byte color[3]{ 64, 64, 64 }; | ||
| R_SetConstantColorLightGrid( color ); | ||
|
|
||
| return; | ||
| } | ||
|
|
@@ -4116,6 +4124,12 @@ void R_LoadLightGrid( lump_t *l ) | |
| tmpDirected[ 2 ] = in->directed[ 2 ]; | ||
| tmpDirected[ 3 ] = 255; | ||
|
|
||
| if ( tmpAmbient[0] < r_forceAmbient.Get() && | ||
| tmpAmbient[1] < r_forceAmbient.Get() && | ||
| tmpAmbient[2] < r_forceAmbient.Get() ) { | ||
| VectorSet( tmpAmbient, r_forceAmbient.Get(), r_forceAmbient.Get(), r_forceAmbient.Get() ); | ||
| } | ||
|
|
||
| if ( tr.legacyOverBrightClamping ) | ||
| { | ||
| R_ColorShiftLightingBytes( tmpAmbient ); | ||
|
|
@@ -4338,13 +4352,12 @@ void R_LoadEntities( lump_t *l, std::string &externalEntities ) | |
| // check for ambient color | ||
| else if ( !Q_stricmp( keyname, "_color" ) || !Q_stricmp( keyname, "ambientColor" ) ) | ||
| { | ||
| if ( r_forceAmbient->value <= 0 ) | ||
| { | ||
| sscanf( value, "%f %f %f", &tr.worldEntity.ambientLight[ 0 ], &tr.worldEntity.ambientLight[ 1 ], | ||
| &tr.worldEntity.ambientLight[ 2 ] ); | ||
| if ( r_forceAmbient.Get() == 0 ) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps. I just used the value that was already there for it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's also the issue that there could be maps relying on it. |
||
| sscanf( value, "%f %f %f", &tr.ambientLight[0], &tr.ambientLight[1], | ||
| &tr.ambientLight[2] ); | ||
|
|
||
| VectorCopy( tr.worldEntity.ambientLight, tr.worldEntity.ambientLight ); | ||
| VectorScale( tr.worldEntity.ambientLight, r_ambientScale->value, tr.worldEntity.ambientLight ); | ||
| VectorScale( tr.ambientLight, r_ambientScale.Get(), tr.ambientLight ); | ||
| tr.ambientLightSet = true; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -5048,11 +5061,6 @@ void RE_LoadWorldMap( const char *name ) | |
|
|
||
| VectorNormalize( tr.sunDirection ); | ||
|
|
||
| // set default ambient color | ||
| tr.worldEntity.ambientLight[ 0 ] = r_forceAmbient->value; | ||
| tr.worldEntity.ambientLight[ 1 ] = r_forceAmbient->value; | ||
| tr.worldEntity.ambientLight[ 2 ] = r_forceAmbient->value; | ||
|
|
||
| tr.worldMapLoaded = true; | ||
|
|
||
| // load it | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.