#include "rSDL.h"
#include "tConfiguration.h"
#include "tEventQueue.h"
#include "uInputQueue.h"
#include "eTess2.h"
#include "rTexture.h"
#include "eGameObject.h"
#include "rFont.h"
#include "eTimer.h"
#include "eCamera.h"
#include "rScreen.h"
#include "rRender.h"
#include "eWall.h"
#include "eAdvWall.h"
#include "eFloor.h"
#include "ePath.h"
#include "eGrid.h"
#include "eDebugLine.h"
#include "tDirectories.h"
#include "eRectangle.h"
Go to the source code of this file.
Defines | |
#define | eWall_h 4 |
#define | view_h 2.7 |
#define | SIDELEN (se_GridSize()) |
#define | EXTENSION 10 |
#define | INTENSITY(x, xx) (1-(((x)-(xx))*((x)-(xx))/(EXTENSION*SIDELEN*EXTENSION*SIDELEN))) |
Functions | |
bool | sg_MoviePack () |
static void | sky_select () |
static void | TexVertex (REAL x, REAL y, REAL h) |
static void | finite_xy_plane (const eCoord &pos, const eCoord &dir, REAL h, eRectangle rect) |
static void | infinity_xy_plane (eCoord const &pos, const eCoord &dir, REAL h=0) |
void | draw_eWall (eGrid *grid, int v, int i, REAL &zNear, eCamera const *cam) |
void | paint_sr_lowerSky (eGrid *grid, int viewer, bool sr_upperSky, eCoord const &camPos) |
Variables | |
static REAL | sr_floorMirror_strength = .1 |
static tSettingItem< REAL > | f_m ("FLOOR_MIRROR_INT", sr_floorMirror_strength) |
REAL | upper_height = 100 |
REAL | lower_height = 50 |
static rFileTexture | sky (rTextureGroups::TEX_FLOOR,"textures/sky.png", 1, 1, true) |
static rFileTexture | sky_moviepack (rTextureGroups::TEX_FLOOR,"moviepack/sky.png", 1, 1, true) |
short | se_bugRip |
static REAL | z = 0 |
eWall * | displayed_eWall = 0 |
#define eWall_h 4 |
Definition at line 58 of file eDisplay.cpp.
#define EXTENSION 10 |
Referenced by eGrid::display_simple().
Referenced by eGrid::display_simple().
#define SIDELEN (se_GridSize()) |
Referenced by eGrid::display_simple().
#define view_h 2.7 |
Definition at line 59 of file eDisplay.cpp.
Definition at line 204 of file eDisplay.cpp.
References eWallView::Belongs(), eGrid::CameraDir(), eGrid::CameraPos(), eCoord, eWall::EndPoint(), eWall::Height(), eWall::Len(), REAL, eWall::Render(), se_wallsVisible, eGrid::Turn(), tHeapBase::UpperL(), tHeapBase::UpperR(), eWallView::Value(), and z.
00205 { 00206 if (i<se_wallsVisible[v].Len()) 00207 { 00208 eWallView *view=se_wallsVisible[v](i); 00209 #ifdef DEBUG 00210 if (view->Value()<=z) 00211 { 00212 #endif 00213 displayed_eWall = view->Belongs(); 00214 REAL len = displayed_eWall->Len(); 00215 if ( len > .01) 00216 { 00217 REAL zDist = z - displayed_eWall->Height(); 00218 if ( zDist < zNear ) 00219 { 00220 const eCoord& camPos = grid->CameraPos( v ); 00221 const eCoord& camDir = grid->CameraDir( v ); 00222 eCoord base = displayed_eWall->EndPoint(0); 00223 eCoord end = displayed_eWall->EndPoint(1); 00224 00225 if ( eCoord::F( base-camPos, camDir ) > 0.01f || eCoord::F( end-camPos, camDir ) > 0.01f ) 00226 { 00227 eCoord dirNorm = end - base; 00228 dirNorm.Normalize(); 00229 eCoord camRelative = ( camPos - base ).Turn( dirNorm.Conj() ); 00230 REAL dist = fabs( camRelative.y ); 00231 if ( camRelative.x < 0 ) 00232 { 00233 dist -= camRelative.x; 00234 } 00235 if ( camRelative.x > len ) 00236 { 00237 dist += camRelative.x - len; 00238 } 00239 if ( dist < zDist ) 00240 { 00241 dist = zDist; 00242 } 00243 // TODO: better criterion for ingoring of walls 00244 if ( dist < zNear && dist > 0.001f ) 00245 { 00246 zNear = dist; 00247 } 00248 } 00249 } 00250 00251 displayed_eWall->Render(cam); 00252 } 00253 displayed_eWall=0; 00254 00255 draw_eWall(grid,v,tHeapBase::UpperL(i),zNear,cam); 00256 draw_eWall(grid,v,tHeapBase::UpperR(i),zNear,cam); 00257 00258 #ifdef DEBUG 00259 } 00260 #endif 00261 } 00262 }
static void finite_xy_plane | ( | const eCoord & | pos, | |
const eCoord & | dir, | |||
REAL | h, | |||
eRectangle | rect | |||
) | [static] |
Definition at line 102 of file eDisplay.cpp.
References BeginTriangleFan(), eRectangle::GetHigh(), eRectangle::GetLow(), eRectangle::Include(), REAL, RenderEnd(), sr_floorMirror, and TexVertex().
Referenced by infinity_xy_plane().
00103 { 00104 // expand plane to camera position to avoid embarrasing reflection bug 00105 if ( sr_floorMirror ) 00106 rect.Include( pos ); 00107 00108 // fetch rectangle coordinates 00109 REAL lx = rect.GetLow().x; 00110 REAL ly = rect.GetLow().y; 00111 REAL hx = rect.GetHigh().x; 00112 REAL hy = rect.GetHigh().y; 00113 00114 // draw rectangle as triangle fan (good for avoiding artefacts near pos) 00115 BeginTriangleFan(); 00116 TexVertex( pos.x-dir.x, pos.y-dir.y, h ); 00117 TexVertex(lx, ly, h); 00118 TexVertex(lx, hy, h); 00119 TexVertex(hx, hy, h); 00120 TexVertex(hx, ly, h); 00121 TexVertex(lx, ly, h); 00122 RenderEnd(); 00123 }
static void infinity_xy_plane | ( | eCoord const & | pos, | |
const eCoord & | dir, | |||
REAL | h = 0 | |||
) | [static] |
Definition at line 125 of file eDisplay.cpp.
References BeginTriangleFan(), finite_xy_plane(), eWallRim::GetBounds(), REAL, RenderEnd(), se_bugRip, sr_highRim, and sr_infinityPlane.
Referenced by eGrid::display_simple(), and paint_sr_lowerSky().
00125 { 00126 bool use_rim=false; 00127 REAL zero=0; 00128 00129 if (sr_highRim) 00130 use_rim=true; 00131 00132 if ( se_bugRip ) 00133 use_rim=false; 00134 00135 // always use the rim if infinity rendering is turned off 00136 use_rim |= !sr_infinityPlane; 00137 00138 if (use_rim){ 00139 /* 00140 // the rim wall based rendering does not work properly for shaped arenas, so 00141 // it's been replaced. 00142 00143 BeginTriangles(); 00144 for(int i=se_rimWalls.Len()-1;i>=0;i--){ 00145 eCoord p1=se_rimWalls(i)->EndPoint(0); 00146 eCoord p2=se_rimWalls(i)->EndPoint(1); 00147 00148 glTexCoord2f(pos.x, pos.y); 00149 glVertex3f (pos.x, pos.y, h); 00150 00151 glTexCoord2f(p1.x, p1.y); 00152 glVertex3f (p1.x, p1.y, h); 00153 00154 glTexCoord2f(p2.x, p2.y); 00155 glVertex3f (p2.x, p2.y, h); 00156 } 00157 RenderEnd(); 00158 */ 00159 finite_xy_plane( pos, dir, h, eWallRim::GetBounds() ); 00160 } 00161 else 00162 { 00163 if (!sr_infinityPlane) 00164 zero=.001; 00165 00166 BeginTriangleFan(); 00167 00168 glTexCoord4f(pos.x-dir.x, pos.y-dir.y, h, 1); 00169 glVertex4f (pos.x-dir.x, pos.y-dir.y, h, 1); 00170 00171 glTexCoord4f(1,0.1,zero*h,zero); 00172 glVertex4f (1,0.1,zero*h,zero); 00173 00174 glTexCoord4f(0.1,1.1,zero*h,zero); 00175 glVertex4f (0.1,1.1,zero*h,zero); 00176 00177 glTexCoord4f(-1,0.1,zero*h,zero); 00178 glVertex4f (-1,0.1,zero*h,zero); 00179 00180 glTexCoord4f(0.1,-1.1,zero*h,zero); 00181 glVertex4f (0.1,-1.1,zero*h,zero); 00182 00183 glTexCoord4f(1,0.1,zero*h,zero); 00184 glVertex4f (1,0.1,zero*h,zero); 00185 00186 RenderEnd(); 00187 } 00188 }
void paint_sr_lowerSky | ( | eGrid * | grid, | |
int | viewer, | |||
bool | sr_upperSky, | |||
eCoord const & | camPos | |||
) |
Definition at line 265 of file eDisplay.cpp.
References eGrid::CameraDir(), cos(), infinity_xy_plane(), lower_height, REAL, se_GameTime(), sin(), sky_select(), sr_alphaBlend, sr_skyWobble, TexMatrix(), and z.
Referenced by eGrid::display_simple().
00265 { 00266 TexMatrix(); 00267 glLoadIdentity(); 00268 glScalef(.005,.005,.005); 00269 glEnable(GL_TEXTURE_2D); 00270 glDisable(GL_CULL_FACE); 00271 00272 if (sr_skyWobble){ 00273 glTranslatef(se_GameTime()*.1,se_GameTime()*.07145,0); 00274 glScalef(1+.2*sin(se_GameTime()),1+.1*cos(se_GameTime()),1); 00275 glTranslatef(-300,-200,0); 00276 } 00277 00278 sky_select(); 00279 00280 REAL sa=(lower_height-z)*.1; 00281 if (sa>1) sa=1; 00282 if (!sr_upperSky){ 00283 sa=1; 00284 glBlendFunc(GL_SRC_ALPHA,GL_ZERO); 00285 } 00286 if (sa>0){ 00287 glColor4f(1,1,1,sa); 00288 infinity_xy_plane(camPos,grid->CameraDir(viewer),lower_height); 00289 } 00290 if (!sr_upperSky && sr_alphaBlend) 00291 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); 00292 }
bool sg_MoviePack | ( | ) |
Definition at line 59 of file gStuff.cpp.
00059 { 00060 return sg_moviepackInstalled && sg_moviepackUse; 00061 }
static void sky_select | ( | ) | [static] |
Definition at line 76 of file eDisplay.cpp.
References tDirectories::Data(), tPath::GetReadPath(), rITexture::Select(), sg_MoviePack(), sky, and sky_moviepack.
Referenced by paint_sr_lowerSky().
00076 { 00077 if (sg_MoviePack()){ 00078 // Since old movie packs usually don't include sky.png we need to 00079 // be nice and fall back to the default sky tecture. -k 00080 tString s = tDirectories::Data().GetReadPath( "moviepack/sky.png" ); 00081 if(strlen(s) > 0) 00082 sky_moviepack.Select(); 00083 else 00084 sky.Select(); 00085 } 00086 else { 00087 sky.Select(); 00088 } 00089 }
Definition at line 95 of file eDisplay.cpp.
Referenced by finite_xy_plane(), and gWallRim_helper().
eWall* displayed_eWall = 0 |
Definition at line 202 of file eDisplay.cpp.
tSettingItem<REAL> f_m("FLOOR_MIRROR_INT", sr_floorMirror_strength) [static] |
REAL lower_height = 50 |
Definition at line 66 of file eDisplay.cpp.
Referenced by eGrid::display_simple(), gWallRim_helper(), and paint_sr_lowerSky().
short se_bugRip |
Referenced by infinity_xy_plane().
rFileTexture sky(rTextureGroups::TEX_FLOOR,"textures/sky.png", 1, 1, true) [static] |
Referenced by sky_select().
rFileTexture sky_moviepack(rTextureGroups::TEX_FLOOR,"moviepack/sky.png", 1, 1, true) [static] |
Referenced by sky_select().
REAL sr_floorMirror_strength = .1 [static] |
REAL upper_height = 100 |
Definition at line 65 of file eDisplay.cpp.
Referenced by eGrid::display_simple(), and gWallRim_helper().
Definition at line 190 of file eDisplay.cpp.
Referenced by eGrid::display_simple(), draw_eWall(), rModel::Load(), main(), nMessage::operator<<(), paint_sr_lowerSky(), eGrid::Render(), and gAIPlayer::ThinkPath().