rendered paste body//====================
//CompensateFov
//====================
void CompensateFov( float *fov_x, float *fov_y, float width, float height, qboolean lock_x )
{
float x;
if( width*3 == 4*height || width*4 == height*5 ) { // 4:3 or 5:4 ratio
return;
}
if( lock_x ) {
*fov_y = 2 * atan( (width * 3) / (height * 4) * tan (*fov_x * M_PI / 360.0 * 0.5) )*360/M_PI;
return;
}
x = *fov_x;
*fov_x = CalcFov( *fov_y, width, height );
if( *fov_x < x ) {
*fov_x = x;
// fov_y = CalcFov( *fov_x, width, height );
}
}