Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

ATypes.h

Go to the documentation of this file.
00001 /*
00002 CS Senior Project 2003
00003 Team : Leftfield
00004 Project : ModernWarfare
00005 Members :
00006 - Russ Christensen              <rchriste@cs.utah.edu>
00007 - Todd Smith                    <tcsmith@cs.utah.edu>
00008 - Usit Duongsaa                 <duongsaa@cs.utah.edu>
00009 
00010 Copyright 2003 Russ Christensen, Usit Duongsaa, and Todd Smith. All rights reserved.
00011 
00012 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00013 
00014 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
00015 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
00016 THIS SOFTWARE IS PROVIDED BY RUSS CHRISTENSEN, USIT DUONGSAA, AND TODD SMITH ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUSS, USIT, TODD OR OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00017 */
00018 
00025 namespace {
00026 }
00027 
00028 #ifndef INCLUDE_ATYPES
00029 #define INCLUDE_ATYPES
00030 
00031 #include "ExternalLibs.h"
00032 
00033 //------------------------------------------------------------------------------------
00034 typedef D3DXVECTOR2 Vec2D;
00035 typedef D3DXVECTOR3 Vec3D;
00036 typedef D3DXVECTOR4 Vec4D;
00037 typedef D3DXMATRIX  Matx;
00038 
00039 typedef void(*AierraInitFunc)();
00040 typedef void(*AierraUpdateFunc)();
00041 typedef void(*AierraRenderFunc)();
00042 typedef void(*AierraShutdownFunc)();
00043 
00044 typedef int AFont;
00045 typedef int AMesh;
00046 typedef int ATexture;
00047 typedef int ATerrain;
00048 
00049 const int TERR_ROWS             =       90;
00050 const int TERR_COLS             =       90;
00051 
00052 
00053 //------------------------------------------------------------------------------------
00054 class Box
00055 {
00056 public:
00057         Box() {  left=0.0f; right=1.0f; top=0.0f; bottom=1.0f; }
00058         Box( FLOAT Left, FLOAT Top, FLOAT Right, FLOAT Bottom )
00059         {
00060                 left=Left; right=Right; top=Top; bottom=Bottom;
00061         }
00062         bool isContain( Vec2D pt )
00063         {
00064                 return pt.x >= left && pt.x <= right && pt.y >= top && pt.y <= bottom;
00065         }
00066 
00067         FLOAT left, right, top, bottom;
00068 };
00069 //------------------------------------------------------------------------------------
00070 //------------------------------------------------------------------------------------
00072 class Error : public exception
00073 {
00074 public:
00075         Error( string s ) { MessageBox(NULL, s.c_str(), "EXCEPTION", MB_OK ); }
00076         Error( char *s )  { *this=Error(string(s)); }   
00077 };
00078 //------------------------------------------------------------------------------------
00080 class TerminateNormally : public exception
00081 {
00082         public:
00084                 TerminateNormally() {}
00085 };
00086 //------------------------------------------------------------------------------------
00089 struct OverlayEntry                             
00090 {                                                               
00091         OverlayEntry() {}
00092         OverlayEntry( int op, int blendMode, Vec2D pt1, Vec2D pt2, Vec3D color, FLOAT alpha,
00093                                         FLOAT size, string s, int res, int priority )
00094         {
00095                 this->op = op;                  this->blendMode = blendMode;
00096                 this->pt1 = pt1;                this->pt2 = pt2;
00097                 this->color = color;    this->alpha = alpha;
00098                 this->size = size;              this->s = s;
00099                 this->resource = res;   this->priority = priority;
00100         }
00101         int priority;
00102         int op;
00103         int blendMode;
00104         Vec2D pt1, pt2;
00105         Vec3D color;    
00106         FLOAT alpha;
00107         FLOAT size;
00108         string s;
00109         AFont resource;         // font or texture
00110 };
00111 //------------------------------------------------------------------------------------
00113 struct MeshEntry
00114 {
00115         UINT VBmin, VBcount, IBstart, TriCount;
00116         Vec3D size;
00117 };
00119 struct TerrainEntry
00120 {
00121         bool                                            doRender;
00122         FLOAT                                           sizeX, sizeY, sizeZ, offsetZ;
00123         FLOAT                                           zMap[TERR_ROWS][TERR_COLS];             // height
00124         FLOAT                                           BMap[TERR_ROWS][TERR_COLS];             // blend factor
00125         Vec3D                                           NMap[TERR_ROWS][TERR_COLS];             // surface normal
00126         LPDIRECT3DVERTEXBUFFER8         vb;
00127         LPDIRECT3DINDEXBUFFER8          ib;
00128         ATexture                                        texLow, texHigh, texNormal;
00129 };
00130 //------------------------------------------------------------------------------------
00132 struct Int2Tuple
00133 {
00134         Int2Tuple() { a=b=0; }
00135         Int2Tuple(int A, int B) { a=A; b=B; }
00136         bool operator =(const Int2Tuple &rhs) const { return a==rhs.a && b==rhs.b; }
00137         bool operator <(const Int2Tuple &rhs) const { return (a*1000+b) < (rhs.a*1000+rhs.b); }
00138         int a, b;
00139 };
00140 //------------------------------------------------------------------------------------
00142 struct Int3Tuple
00143 {
00144         Int3Tuple() { a=b=c=0; }
00145         Int3Tuple(int A, int B, int C) { a=A; b=B; c=C; }
00146         bool operator =(const Int3Tuple &rhs) const { return a==rhs.a && b==rhs.b && c==rhs.c; }
00147         bool operator <(const Int3Tuple &rhs) const { return (a*1000+b)*1000+c < (rhs.a*1000+rhs.b)*1000+rhs.c; }
00148         int a, b, c;
00149 };
00150 //------------------------------------------------------------------------------------
00152 struct MeshRenderRequestEntry
00153 {
00154         MeshRenderRequestEntry() { mesh=texture=bumpmap=NULL; }
00155         MeshRenderRequestEntry( AMesh mesh, Vec3D pos, Vec3D size, Vec3D dir, 
00156                                                         ATexture texture, ATexture bumpmap, Vec3D stripColor )
00157         {
00158                 this->mesh=mesh;                this->pos=pos;  this->size=size;        this->dir=dir;
00159                 this->texture=texture;  this->bumpmap=bumpmap;                          this->stripColor=stripColor;
00160         }
00161 
00162         AMesh           mesh;
00163         Vec3D           pos, size, dir;
00164         ATexture        texture, bumpmap;
00165         Vec3D           stripColor;
00166 };
00167 //------------------------------------------------------------------------------------
00168 struct SpriteRenderRequestEntry
00169 {
00170         SpriteRenderRequestEntry() { tex=NULL; }
00171         SpriteRenderRequestEntry( ATexture tex, int blendMode, Vec3D pos, Vec4D mult, FLOAT size )
00172         {
00173                 this->tex = tex;                        this->blendMode = blendMode;    this->pos = pos;
00174                 this->multiplier = mult;        this->size = size;
00175         }
00176         ATexture        tex;
00177         int                     blendMode;
00178         Vec3D           pos;
00179         Vec4D           multiplier;
00180         FLOAT           size;
00181 };
00182 //------------------------------------------------------------------------------------
00183 void profiler_begin(string s);
00184 void profiler_end(string s);
00185 
00186 class AProfilerBlock
00187 {
00188 public:
00189         AProfilerBlock(string s) { profiler_begin(s); m_str=s; }
00190         ~AProfilerBlock()        { profiler_end(m_str); }
00191 protected:
00192         string m_str;
00193 };
00194 //------------------------------------------------------------------------------------
00195 
00196 #endif

Generated on Wed Apr 23 05:50:14 2003 for Modern Warfare by doxygen1.3-rc2