69
// Jonathan's improved version
70
REAL aspectratio = (height * sr_screenHeight) / (width * sr_screenWidth * currentScreensetting.aspect);
71
REAL ensureverticalfov = fmax((3.0 / 5.0) * aspectratio, 1.0);
71
// Jonathan's improved version (fixed again)
73
// the true aspect ratio of the viewport. 16/9, 16/10, 4/3, 5/4 (or halves of that for splitscreen)
74
REAL aspectratio = (width * sr_screenWidth * currentScreensetting.aspect)/(height * sr_screenHeight);
76
// usually, fov is the horizontal fov. However, for widescreen, we want to expand the
77
// horizontal fov without distorting the image in such a way that we don't sacrifice too much of
78
// the vertical fov. For non-widescreen, the following number will be 1, for aspect ratios > 1.5 (semi-widescreen),
80
REAL ensureverticalfov = fmax(aspectratio/1.5, 1.0);
82
// calculate the horizontal fov. For widescreen, make it extra wide.
72
83
REAL xmul = ensureverticalfov * tan((M_PI / 360.0) * fov);
73
REAL ymul = ensureverticalfov * aspectratio * xmul;
74
glMatrixMode(GL_PROJECTION);
85
// transfer that directly to the vertical fov.
86
REAL ymul = xmul/aspectratio;
76
89
glFrustum(-nnear * xmul + xshift, nnear * xmul + xshift, -nnear * ymul, nnear * ymul, nnear, ffar);
77
90
glTranslatef(xshift, 0.f, 0.f);
79
93
#if 0 // Z-Man's old and clumsy version
80
94
REAL ratio=currentScreensetting.aspect*(width*sr_screenWidth)/(height*sr_screenHeight);