Polymodes: Slight optimizations in getshadefactor.

git-svn-id: https://svn.eduke32.com/eduke32@5439 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-11-25 12:07:47 +00:00
parent 7d3cbf4f83
commit 34bf6443ce

View file

@ -72,9 +72,6 @@ static inline int32_t eligible_for_tileshades(int32_t const picnum, int32_t cons
static inline float getshadefactor(int32_t const shade)
{
int32_t const shadebound = (shadescale_unbounded || shade>=numshades) ? numshades : numshades-1;
float const clamped_shade = min(max(shade*shadescale, 0), shadebound);
// 8-bit tiles, i.e. non-hightiles and non-models, don't get additional
// glColor() shading with r_usetileshades!
if (getrendermode() == REND_POLYMOST && r_usetileshades &&
@ -82,6 +79,10 @@ static inline float getshadefactor(int32_t const shade)
eligible_for_tileshades(globalpicnum, globalpal))
return 1.f;
float const shadebound = (float)((shadescale_unbounded || shade>=numshades) ? numshades : numshades-1);
float const scaled_shade = (float)shade*shadescale;
float const clamped_shade = min(max(scaled_shade, 0.f), shadebound);
return ((float)(numshades-clamped_shade))/(float)numshades;
}