~vitty/armagetronad/trunk-armagetronad-breakpad

« back to all changes in this revision

Viewing changes to src/render/rViewport.cpp

  • Committer: z-man
  • Date: 2010-08-06 07:05:46 UTC
  • Revision ID: svn-v3-list-QlpoOTFBWSZTWZvbKhsAAAdRgAAQABK6798QIABURMgAAaeoNT1TxT1DQbKaeobXKiyAmlWT7Y5MkdJOtXDtB7w7DOGFBHiOBxaUIu7HQyyQSvxdyRThQkJvbKhs:7d95bf1e-0414-0410-9756-b78462a59f44:armagetronad%2Ftrunk%2Farmagetronad:9426
Merging branch 0.2.8 from revision 9356 to 9425:
 ------------------------------------------------------------------------
 r9424 | bazaarmagetron | 2010-06-28 17:45:41 +0200 (Mon, 28 Jun 2010) | 2 lines
 
 Manuel Moos: Improving readability of console and in-game menu by fading the background to black with an alpha quad.
 
 ------------------------------------------------------------------------
 r9423 | bazaarmagetron | 2010-06-25 16:03:21 +0200 (Fri, 25 Jun 2010) | 2 lines
 
 Manuel Moos: Finishing passing of configuration directory from last merge.
 
 ------------------------------------------------------------------------
 r9422 | bazaarmagetron | 2010-06-25 16:02:48 +0200 (Fri, 25 Jun 2010) | 5 lines
 
 author: Manuel Moos
 Merging own changes from earlier:
  - Added passing down of $CONFIG directory in serverstarter scripts.
  - Hovering over color menu items no longer breaks debug recording playback fast forward.
 
 ------------------------------------------------------------------------
 r9421 | bazaarmagetron | 2010-06-24 01:04:25 +0200 (Thu, 24 Jun 2010) | 2 lines
 
 Manuel Moos: Merging own forgotten changes.
 
 ------------------------------------------------------------------------
 r9420 | bazaarmagetron | 2010-06-07 15:19:04 +0200 (Mon, 07 Jun 2010) | 2 lines
 
 Manuel Moos: Avoiding player list read overflow. How did this go unnoticed for so long?
 
 ------------------------------------------------------------------------
 r9419 | bazaarmagetron | 2010-05-27 13:36:19 +0200 (Thu, 27 May 2010) | 2 lines
 
 Manuel Moos: Fixing aspect ratio calculations. In all practical cases, ensuring vertical fov did not happen; in those where something happened (really, really high screens), it overcompensated and distorted the image.
 
 ------------------------------------------------------------------------
 r9418 | bazaarmagetron | 2010-05-26 15:04:31 +0200 (Wed, 26 May 2010) | 2 lines
 
 Manuel Moos: Taking ownership of ALL network objects formerly belonging to a deleted user.
 
 ------------------------------------------------------------------------
 r9417 | bazaarmagetron | 2010-05-26 15:03:55 +0200 (Wed, 26 May 2010) | 2 lines
 
 Manuel Moos: Clearing send queue on new user login. Fixes one instance of odd authentication dialogs popping up.
 
 ------------------------------------------------------------------------
 r9416 | bazaarmagetron | 2010-05-26 15:03:19 +0200 (Wed, 26 May 2010) | 2 lines
 
 Manuel Moos: Simplified default login procedure for @forums accounts.
 
 ------------------------------------------------------------------------
 r9415 | bazaarmagetron | 2010-04-25 23:27:21 +0200 (Sun, 25 Apr 2010) | 2 lines
 
 Manuel Moos: Updated to current version from gnu.org. Address change, formatting, and LGPL is now the lesser GNU License.
 
 ------------------------------------------------------------------------
 r9414 | bazaarmagetron | 2010-04-25 23:26:49 +0200 (Sun, 25 Apr 2010) | 2 lines
 
 Manuel Moos: Using OUR version of COPYING.
 
 ------------------------------------------------------------------------
 r9413 | bazaarmagetron | 2010-04-22 12:33:03 +0200 (Thu, 22 Apr 2010) | 2 lines
 
 Manuel Moos: Avoiding reloading of title screen when textures are reloaded and it isn't actually getting displayed.
 
 ------------------------------------------------------------------------
 r9412 | bazaarmagetron | 2010-04-19 20:02:56 +0200 (Mon, 19 Apr 2010) | 1 line
 
 Luke Dashjr: replace references to guru3.sytes.net with working URIs at forums.armagetronad.net
 ------------------------------------------------------------------------
 r9408 | bazaarmagetron | 2010-04-17 19:02:43 +0200 (Sat, 17 Apr 2010) | 1 line
 
 Luke Dashjr: main is not a valid hack for AC_CHECK_LIB... use valid values
 ------------------------------------------------------------------------
 r9400 | bazaarmagetron | 2010-03-19 23:41:45 +0100 (Fri, 19 Mar 2010) | 1 line
 
 Luke Dashjr: png_sig_cmp is in both libpng12 and libpng14, where as png_check_sig is only libpng12 --ssuominen
 ------------------------------------------------------------------------
 r9377 | bazaarmagetron | 2010-02-22 20:39:56 +0100 (Mon, 22 Feb 2010) | 1 line
 
 Manuel Moos: partial portugese translation
 ------------------------------------------------------------------------
 r9375 | bazaarmagetron | 2010-02-21 01:16:35 +0100 (Sun, 21 Feb 2010) | 2 lines
 
 Manuel Moos: More typo fixes.
 
 ------------------------------------------------------------------------
 r9368 | bazaarmagetron | 2010-02-20 18:08:58 +0100 (Sat, 20 Feb 2010) | 2 lines
 
 Manuel Moos: Rebranding support for configure error messages.
 
 ------------------------------------------------------------------------
 r9367 | bazaarmagetron | 2010-02-20 18:08:00 +0100 (Sat, 20 Feb 2010) | 2 lines
 
 Manuel Moos: Merging start menu branch.
 
 ------------------------------------------------------------------------
 r9366 | bazaarmagetron | 2010-02-20 18:06:37 +0100 (Sat, 20 Feb 2010) | 2 lines
 
 Manuel Moos: Merging tooltip branch.
 
 ------------------------------------------------------------------------
 r9365 | bazaarmagetron | 2010-02-20 18:04:54 +0100 (Sat, 20 Feb 2010) | 2 lines
 
 Manuel Moos: Merging luke's spelling fix branch.
 
 ------------------------------------------------------------------------
 r9364 | bazaarmagetron | 2010-02-19 19:25:59 +0100 (Fri, 19 Feb 2010) | 2 lines
 
 Manuel Moos: "Winner..." message only shown if there is a non-zero win score. Yeah, we don't care if it's negative.
 
 ------------------------------------------------------------------------

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
*/
27
27
 
28
28
#include "rFont.h"
 
29
#include "rRender.h"
29
30
#include "rScreen.h"
30
31
#include "rViewport.h"
31
32
#include "rConsole.h"
66
67
    if (!sr_glOut)
67
68
        return;
68
69
 
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);
 
70
#if 1
 
71
    // Jonathan's improved version (fixed again)
 
72
 
 
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);
 
75
 
 
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),
 
79
    // it'll be higher.
 
80
    REAL ensureverticalfov = fmax(aspectratio/1.5, 1.0);
 
81
 
 
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);
 
84
 
 
85
    // transfer that directly to the vertical fov.
 
86
    REAL ymul = xmul/aspectratio;
 
87
    ProjMatrix();
75
88
    xshift *= nnear;
76
89
    glFrustum(-nnear * xmul + xshift, nnear * xmul + xshift, -nnear * ymul, nnear * ymul, nnear, ffar);
77
90
    glTranslatef(xshift, 0.f, 0.f);
 
91
#endif
78
92
 
79
93
#if 0 // Z-Man's old and clumsy version
80
94
    REAL ratio=currentScreensetting.aspect*(width*sr_screenWidth)/(height*sr_screenHeight);
216
230
        rViewport sub(rViewport::s_viewportDemonstation,*(s_viewportConfigurations[next_conf_num]->Port(i)));
217
231
        sub.Select();
218
232
 
 
233
        RenderEnd();
 
234
 
219
235
        glDisable(GL_TEXTURE_2D);
220
236
        glDisable(GL_DEPTH_TEST);
221
237
 
223
239
        glRectf(-.9,-.9,.9,.9);
224
240
 
225
241
        glColor3f(.6,.6,.6);
226
 
        glBegin(GL_LINE_LOOP);
 
242
        BeginLineLoop();
227
243
        glVertex2f(-1,-1);
228
244
        glVertex2f(-1,1);
229
245
        glVertex2f(1,1);
230
246
        glVertex2f(1,-1);
231
 
        glEnd();
232
247
 
233
248
        glColor3f(1,1,1);
234
249
        DisplayText(0,0,.5,titles[i], sr_fontMenu);