src/render/rViewport.h

Go to the documentation of this file.
00001 /*
00002 
00003 *************************************************************************
00004 
00005 ArmageTron -- Just another Tron Lightcycle Game in 3D.
00006 Copyright (C) 2000  Manuel Moos (manuel@moosnet.de)
00007 
00008 **************************************************************************
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00023   
00024 ***************************************************************************
00025 
00026 */
00027 
00028 #ifndef ArmageTron_VIEWPORT_H
00029 #define ArmageTron_VIEWPORT_H
00030 
00031 #define MAX_VIEWPORTS 4
00032 
00033 #include "defs.h"
00034 #include "tString.h"
00035 #include "tCoord.h"
00036 #include "tSafePTR.h"
00037 
00038 class rViewport{
00039     REAL left,bottom,width,height;
00040 public:
00041     rViewport(REAL l,REAL b,REAL w,REAL h):left(l),bottom(b),width(w),height(h){}
00042     // create a subviewport of top
00043     rViewport(rViewport &top,rViewport &sub)
00044             :left  (top.left+top.width*sub.left),
00045             bottom(top.bottom+top.height*sub.bottom),
00046             width(top.width*sub.width),
00047     height(top.height*sub.height){}
00048 
00049     ~rViewport(){tCHECK_DEST;}
00050 
00051 #ifndef DEDICATED
00052     void Select();
00053 #endif
00054 
00055     void Perspective(REAL fov,REAL zNear=1,REAL zFar=10000000,REAL xShift = 0);
00056 
00057     REAL UpDownFOV(REAL fov);
00058 
00060     rViewport CorrectAspectBottom() const;
00061 
00063     rViewport EqualAspectBottom() const;
00064 
00066     tCoord GetDimensions() const {return tCoord(width, height);}
00067 
00068     static rViewport s_viewportFullscreen,
00069     s_viewportLeft,s_viewportRight,
00070     s_viewportTop,s_viewportBottom,
00071     s_viewportTopLeft,s_viewportBottomLeft,
00072     s_viewportTopRight,s_viewportBottomRight, s_viewportDemonstation;
00073 
00074     static void CorrectViewport(int i, int mp);
00075     static void CorrectViewports(int mp);
00076     static void SetDirectionOfCorrection(int vp, int dir);
00077     static void Update(int mp);
00078 
00079 };
00080 
00081 extern int      sr_viewportBelongsToPlayer[MAX_VIEWPORTS];
00082 extern int  s_newViewportBelongsToPlayer[MAX_VIEWPORTS];
00083 
00084 
00085 class rViewportConfiguration{
00086     rViewport *viewports[MAX_VIEWPORTS];
00087 public:
00088     const int num_viewports;
00089 
00090     static int next_conf_num;
00091 
00092     rViewportConfiguration(rViewport *first);
00093     rViewportConfiguration(rViewport *first,rViewport *second);
00094     rViewportConfiguration(rViewport *first,rViewport *second,rViewport *third);
00095     rViewportConfiguration(rViewport *first,rViewport *second,rViewport *third,
00096                            rViewport *forth);
00097 #ifndef DEDICATED
00098     void Select(int i);
00099     static void DemonstrateViewport(tString *titles);
00100 #endif
00101     rViewport * Port(int i);
00102 
00103     static rViewportConfiguration *s_viewportConfigurations[];
00104     static const int               s_viewportNumConfigurations;
00105     static char const *            s_viewportConfigurationNames[];
00106 
00107     static rViewportConfiguration *CurrentViewportConfiguration();
00108 
00109     static rViewport * CurrentViewport(int i);
00110 
00111     static void UpdateConf();
00112 };
00113 
00114 #endif
00115 
00116 
00117 

Generated on Sat Mar 15 22:55:53 2008 for Armagetron Advanced by  doxygen 1.5.4