Fix r_mergeLightmaps 0 crashing OpenGL2 renderer
tr.fatLightmapStep was 0 and caused modulus division by 0.
This commit is contained in:
parent
872465500e
commit
d79fe65878
1 changed files with 10 additions and 6 deletions
|
@ -524,11 +524,13 @@ static float FatPackU(float input, int lightmapnum)
|
||||||
if (tr.worldDeluxeMapping)
|
if (tr.worldDeluxeMapping)
|
||||||
lightmapnum >>= 1;
|
lightmapnum >>= 1;
|
||||||
|
|
||||||
lightmapnum %= (tr.fatLightmapStep * tr.fatLightmapStep);
|
|
||||||
|
|
||||||
if(tr.fatLightmapSize > 0)
|
if(tr.fatLightmapSize > 0)
|
||||||
{
|
{
|
||||||
int x = lightmapnum % tr.fatLightmapStep;
|
int x;
|
||||||
|
|
||||||
|
lightmapnum %= (tr.fatLightmapStep * tr.fatLightmapStep);
|
||||||
|
|
||||||
|
x = lightmapnum % tr.fatLightmapStep;
|
||||||
|
|
||||||
return (input / ((float)tr.fatLightmapStep)) + ((1.0 / ((float)tr.fatLightmapStep)) * (float)x);
|
return (input / ((float)tr.fatLightmapStep)) + ((1.0 / ((float)tr.fatLightmapStep)) * (float)x);
|
||||||
}
|
}
|
||||||
|
@ -544,11 +546,13 @@ static float FatPackV(float input, int lightmapnum)
|
||||||
if (tr.worldDeluxeMapping)
|
if (tr.worldDeluxeMapping)
|
||||||
lightmapnum >>= 1;
|
lightmapnum >>= 1;
|
||||||
|
|
||||||
lightmapnum %= (tr.fatLightmapStep * tr.fatLightmapStep);
|
|
||||||
|
|
||||||
if(tr.fatLightmapSize > 0)
|
if(tr.fatLightmapSize > 0)
|
||||||
{
|
{
|
||||||
int y = lightmapnum / tr.fatLightmapStep;
|
int y;
|
||||||
|
|
||||||
|
lightmapnum %= (tr.fatLightmapStep * tr.fatLightmapStep);
|
||||||
|
|
||||||
|
y = lightmapnum / tr.fatLightmapStep;
|
||||||
|
|
||||||
return (input / ((float)tr.fatLightmapStep)) + ((1.0 / ((float)tr.fatLightmapStep)) * (float)y);
|
return (input / ((float)tr.fatLightmapStep)) + ((1.0 / ((float)tr.fatLightmapStep)) * (float)y);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue