internal void SetViewingAngle(double verticalViewingAngle) {
double aspectRatio = (double)Screen.Width / (double)Screen.Height;
this.HorizontalViewingAngle = 2.0 * Math.Atan(aspectRatio * Math.Tan(0.5 * this.VerticalViewingAngle));
this.VerticalViewingAngle = verticalViewingAngle;
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
const double inverseDegrees = 57.295779513082320877;
// TODO //
// The old renderer assumes a negative aspect ratio. Once the new renderer
// is implemented, change the aspect ratio in the following line to positive.
// ref (float) (this.VerticalViewingAngle * inverseDegrees), (float) (-aspectRatio), 1.0f, (float) (this.ViewingDistance))
float radViewingAngle = (float) (this.VerticalViewingAngle * inverseDegrees);
float negAspect = (float) -aspectRatio;
float viewing = (float) this.ViewingDistance;
Matrix4 val = Matrix4.CreatePerspectiveFieldOfView(radViewingAngle, negAspect, 1.0f, viewing);
GL.LoadMatrix(ref val);
GL.MatrixMode(MatrixMode.Modelview);
}