void R_Viewport_InitRectSideView(r_viewport_t *v, const matrix4x4_t *cameramatrix, int side, int size, int border, float nearclip, float farclip, const float *nearplane)
{
matrix4x4_t tempmatrix, basematrix;
- if (border > size - 2)
- border = size - 2;
memset(v, 0, sizeof(*v));
v->type = R_VIEWPORTTYPE_PERSPECTIVECUBESIDE;
v->cameramatrix = *cameramatrix;
if ((r_shadow_shadowmapmaxsize >> i) > lodlinear)
r_shadow_shadowmaplod = i;
- size = r_shadow_shadowmode == R_SHADOW_SHADOWMODE_SHADOWMAPCUBESIDE ? r_shadow_shadowmapmaxsize >> r_shadow_shadowmaplod : lodlinear;
- size = bound(1, size, r_shadow_shadowmapmaxsize);
+ if (r_shadow_shadowmode == R_SHADOW_SHADOWMODE_SHADOWMAPCUBESIDE)
+ size = max(1, r_shadow_shadowmapmaxsize >> r_shadow_shadowmaplod);
+ else
+ size = bound(r_shadow_shadowmapborder, lodlinear, r_shadow_shadowmapmaxsize);
+
borderbias = r_shadow_shadowmapborder / (float)(size - r_shadow_shadowmapborder);
if (numsurfaces)