Skip to content

Commit f82f640

Browse files
committed
r_showLightGrid: fix wrong colors displayed
Sometimes color values were slightly greater than 1; this led to an incorrect float color -> byte color conversion. Fix it by clamping the colors in Tess_AddTetrahedron.
1 parent ced7066 commit f82f640

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/engine/renderer/tr_local.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3210,7 +3210,7 @@ void GLimp_LogComment_( std::string comment );
32103210
32113211
@param tetraVerts[0..2] are the ground vertices, tetraVerts[3] is the pyramid offset
32123212
*/
3213-
void Tess_AddTetrahedron( vec4_t tetraVerts[ 4 ], const Color::Color& color );
3213+
void Tess_AddTetrahedron( vec4_t tetraVerts[ 4 ], Color::Color color );
32143214

32153215
void Tess_AddCube( const vec3_t position, const vec3_t minSize, const vec3_t maxSize, const Color::Color& color );
32163216
void Tess_AddCubeWithNormals( const vec3_t position, const vec3_t minSize, const vec3_t maxSize, const Color::Color& color );

src/engine/renderer/tr_surface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,13 @@ void Tess_AddQuadStamp2WithNormals( vec4_t quadVerts[ 4 ], const Color::Color& c
399399
}
400400

401401
// Defines ATTR_POSITION, ATTR_COLOR
402-
void Tess_AddTetrahedron( vec4_t tetraVerts[ 4 ], const Color::Color& colorf )
402+
void Tess_AddTetrahedron( vec4_t tetraVerts[ 4 ], Color::Color colorf )
403403
{
404404
int k;
405405

406406
Tess_CheckOverflow( 12, 12 );
407407

408+
colorf.Clamp();
408409
Color::Color32Bit color = colorf;
409410

410411
// ground triangle

0 commit comments

Comments
 (0)