~swag/armagetronad/0.2.9-sty+ct+ap-fork

« back to all changes in this revision

Viewing changes to src/engine/eDisplay.cpp

  • Committer: luke-jr
  • Date: 2006-05-29 01:55:42 UTC
  • Revision ID: svn-v3-list-QlpoOTFBWSZTWZvbKhsAAAdRgAAQABK6798QIABURMgAAaeoNT1TxT1DQbKaeobXKiyAmlWT7Y5MkdJOtXDtB7w7DOGFBHiOBxaUIu7HQyyQSvxdyRThQkJvbKhs:7d95bf1e-0414-0410-9756-b78462a59f44:armagetronad%2Fbranches%2F0.2.8%2Farmagetronad:4612
Unify tags/branches of modules released together

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
*************************************************************************
 
4
 
 
5
ArmageTron -- Just another Tron Lightcycle Game in 3D.
 
6
Copyright (C) 2000  Manuel Moos (manuel@moosnet.de)
 
7
 
 
8
**************************************************************************
 
9
 
 
10
This program is free software; you can redistribute it and/or
 
11
modify it under the terms of the GNU General Public License
 
12
as published by the Free Software Foundation; either version 2
 
13
of the License, or (at your option) any later version.
 
14
 
 
15
This program is distributed in the hope that it will be useful,
 
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
GNU General Public License for more details.
 
19
 
 
20
You should have received a copy of the GNU General Public License
 
21
along with this program; if not, write to the Free Software
 
22
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
23
 
 
24
***************************************************************************
 
25
 
 
26
*/
 
27
 
 
28
//void se_FetchAndStoreSDLInput();
 
29
 
 
30
#include "rSDL.h"
 
31
 
 
32
#include "tConfiguration.h"
 
33
 
 
34
// floor mirror
 
35
#ifndef DEDICATED
 
36
static REAL sr_floorMirror_strength=.1;
 
37
static tSettingItem<REAL> f_m("FLOOR_MIRROR_INT",sr_floorMirror_strength);
 
38
 
 
39
#include "tEventQueue.h"
 
40
#include "uInputQueue.h"
 
41
#include "eTess2.h"
 
42
#include "rTexture.h"
 
43
#include "eGameObject.h"
 
44
#include "rFont.h"
 
45
#include "eTimer.h"
 
46
#include "eCamera.h"
 
47
#include "rScreen.h"
 
48
#include "rRender.h"
 
49
#include "eWall.h"
 
50
#include "eAdvWall.h"
 
51
#include "eFloor.h"
 
52
#include "ePath.h"
 
53
#include "eGrid.h"
 
54
#include "eDebugLine.h"
 
55
#include "tDirectories.h"
 
56
#include "eRectangle.h"
 
57
 
 
58
#define eWall_h 4
 
59
#define view_h 2.7
 
60
 
 
61
#ifdef DEBUG
 
62
bool debug_grid=0;
 
63
#endif
 
64
 
 
65
REAL upper_height=100;
 
66
REAL lower_height=50;
 
67
 
 
68
 
 
69
#ifndef DEDICATED
 
70
 
 
71
static rFileTexture sky(rTextureGroups::TEX_FLOOR,"textures/sky.png",1,1,true);
 
72
static rFileTexture sky_moviepack(rTextureGroups::TEX_FLOOR,"moviepack/sky.png",1,1,true);
 
73
 
 
74
extern bool sg_MoviePack();
 
75
 
 
76
static void sky_select(){
 
77
    if (sg_MoviePack()){
 
78
        // Since old movie packs usually don't include sky.png we need to
 
79
        // be nice and fall back to the default sky tecture. -k
 
80
        tString s = tDirectories::Data().GetReadPath( "moviepack/sky.png" );
 
81
        if(strlen(s) > 0)
 
82
            sky_moviepack.Select();
 
83
        else
 
84
            sky.Select();
 
85
    }
 
86
    else {
 
87
        sky.Select();
 
88
    }
 
89
}
 
90
 
 
91
// if the rip bug is activated, don't use the rim to draw the floor
 
92
extern short se_bugRip;
 
93
 
 
94
// passes a vertex with z-projected texture coordinates to OpenGL
 
95
static inline void TexVertex( REAL x, REAL y, REAL h)
 
96
{
 
97
    glTexCoord2f(x, y);
 
98
    glVertex3f  (x, y, h);
 
99
}
 
100
 
 
101
// renders a finite rectangle
 
102
static void finite_xy_plane( const eCoord &pos,const eCoord &dir,REAL h, eRectangle rect )
 
103
{
 
104
    // expand plane to camera position to avoid embarrasing reflection bug
 
105
    if ( sr_floorMirror )
 
106
        rect.Include( pos );
 
107
 
 
108
    // fetch rectangle coordinates
 
109
    REAL lx = rect.GetLow().x;
 
110
    REAL ly = rect.GetLow().y;
 
111
    REAL hx = rect.GetHigh().x;
 
112
    REAL hy = rect.GetHigh().y;
 
113
 
 
114
    // draw rectangle as triangle fan (good for avoiding artefacts near pos)
 
115
    BeginTriangleFan();
 
116
    TexVertex( pos.x-dir.x, pos.y-dir.y, h );
 
117
    TexVertex(lx, ly, h);
 
118
    TexVertex(lx, hy, h);
 
119
    TexVertex(hx, hy, h);
 
120
    TexVertex(hx, ly, h);
 
121
    TexVertex(lx, ly, h);
 
122
    RenderEnd();
 
123
}
 
124
 
 
125
static void infinity_xy_plane(eCoord const & pos, const eCoord &dir,REAL h=0){
 
126
    glEdgeFlag(GL_FALSE);
 
127
 
 
128
    bool use_rim=false;
 
129
    REAL zero=0;
 
130
 
 
131
    if (sr_highRim)
 
132
        use_rim=true;
 
133
 
 
134
    if ( se_bugRip )
 
135
        use_rim=false;
 
136
 
 
137
    // always use the rim if infinity rendering is turned off
 
138
    use_rim |= !sr_infinityPlane;
 
139
 
 
140
    if (use_rim){
 
141
        /*
 
142
          // the rim wall based rendering does not work properly for shaped arenas, so
 
143
          // it's been replaced.
 
144
 
 
145
                BeginTriangles();
 
146
                for(int i=se_rimWalls.Len()-1;i>=0;i--){
 
147
                    eCoord p1=se_rimWalls(i)->EndPoint(0);
 
148
                    eCoord p2=se_rimWalls(i)->EndPoint(1);
 
149
 
 
150
                    glTexCoord2f(pos.x, pos.y);
 
151
                    glVertex3f  (pos.x, pos.y, h);
 
152
 
 
153
                    glTexCoord2f(p1.x, p1.y);
 
154
                    glVertex3f  (p1.x, p1.y, h);
 
155
 
 
156
                    glTexCoord2f(p2.x, p2.y);
 
157
                    glVertex3f  (p2.x, p2.y, h);
 
158
                }
 
159
                RenderEnd();
 
160
        */
 
161
        finite_xy_plane( pos, dir, h, eWallRim::GetBounds() );
 
162
    }
 
163
    else
 
164
    {
 
165
        if (!sr_infinityPlane)
 
166
            zero=.001;
 
167
 
 
168
        BeginTriangleFan();
 
169
 
 
170
        glTexCoord4f(pos.x-dir.x, pos.y-dir.y, h, 1);
 
171
        glVertex4f  (pos.x-dir.x, pos.y-dir.y, h, 1);
 
172
 
 
173
        glTexCoord4f(1,0.1,zero*h,zero);
 
174
        glVertex4f  (1,0.1,zero*h,zero);
 
175
 
 
176
        glTexCoord4f(0.1,1.1,zero*h,zero);
 
177
        glVertex4f  (0.1,1.1,zero*h,zero);
 
178
 
 
179
        glTexCoord4f(-1,0.1,zero*h,zero);
 
180
        glVertex4f  (-1,0.1,zero*h,zero);
 
181
 
 
182
        glTexCoord4f(0.1,-1.1,zero*h,zero);
 
183
        glVertex4f  (0.1,-1.1,zero*h,zero);
 
184
 
 
185
        glTexCoord4f(1,0.1,zero*h,zero);
 
186
        glVertex4f  (1,0.1,zero*h,zero);
 
187
 
 
188
        RenderEnd();
 
189
    }
 
190
}
 
191
 
 
192
static REAL z=0;
 
193
 
 
194
 
 
195
int           eGrid::NumberOfCameras(){return cameras.Len();}
 
196
const eCoord& eGrid::CameraPos(int i){return cameras(i)->CameraPos();}
 
197
eCoord eGrid::CameraGlancePos(int i){return cameras(i)->CameraGlancePos();}
 
198
const eCoord& eGrid::CameraDir(int i){return cameras(i)->CameraDir();}
 
199
REAL          eGrid::CameraHeight(int i){return cameras(i)->CameraZ();}
 
200
 
 
201
 
 
202
 
 
203
 
 
204
eWall *displayed_eWall=0;
 
205
 
 
206
void draw_eWall(eGrid* grid, int v,int i, REAL& zNear, eCamera const * cam)
 
207
{
 
208
    if (i<se_wallsVisible[v].Len())
 
209
    {
 
210
        eWallView *view=se_wallsVisible[v](i);
 
211
#ifdef DEBUG
 
212
        if (view->Value()<=z)
 
213
        {
 
214
#endif
 
215
            displayed_eWall = view->Belongs();
 
216
            REAL len = displayed_eWall->Len();
 
217
            if ( len > .01)
 
218
            {
 
219
                REAL zDist = z - displayed_eWall->Height();
 
220
                if ( zDist < zNear )
 
221
                {
 
222
                    const eCoord& camPos = grid->CameraPos( v );
 
223
                    const eCoord& camDir = grid->CameraDir( v );
 
224
                    eCoord base = displayed_eWall->EndPoint(0);
 
225
                    eCoord end = displayed_eWall->EndPoint(1);
 
226
 
 
227
                    if ( eCoord::F( base-camPos, camDir ) > 0.01f || eCoord::F( end-camPos, camDir ) > 0.01f )
 
228
                    {
 
229
                        eCoord dirNorm = end - base;
 
230
                        dirNorm.Normalize();
 
231
                        eCoord camRelative = ( camPos - base ).Turn( dirNorm.Conj() );
 
232
                        REAL dist = fabs( camRelative.y );
 
233
                        if ( camRelative.x < 0 )
 
234
                        {
 
235
                            dist -= camRelative.x;
 
236
                        }
 
237
                        if ( camRelative.x > len )
 
238
                        {
 
239
                            dist += camRelative.x - len;
 
240
                        }
 
241
                        if ( dist < zDist )
 
242
                        {
 
243
                            dist = zDist;
 
244
                        }
 
245
                        // TODO: better criterion for ingoring of walls
 
246
                        if ( dist < zNear && dist > 0.001f )
 
247
                        {
 
248
                            zNear = dist;
 
249
                        }
 
250
                    }
 
251
                }
 
252
 
 
253
                displayed_eWall->Render(cam);
 
254
            }
 
255
            displayed_eWall=0;
 
256
 
 
257
            draw_eWall(grid,v,tHeapBase::UpperL(i),zNear,cam);
 
258
            draw_eWall(grid,v,tHeapBase::UpperR(i),zNear,cam);
 
259
 
 
260
#ifdef DEBUG
 
261
        }
 
262
#endif 
 
263
    }
 
264
}
 
265
 
 
266
 
 
267
void paint_sr_lowerSky(eGrid *grid, int viewer,bool sr_upperSky, eCoord const & camPos){
 
268
    TexMatrix();
 
269
    glLoadIdentity();
 
270
    glScalef(.005,.005,.005);
 
271
    glEnable(GL_TEXTURE_2D);
 
272
    glDisable(GL_CULL_FACE);
 
273
 
 
274
    if (sr_skyWobble){
 
275
        glTranslatef(se_GameTime()*.1,se_GameTime()*.07145,0);
 
276
        glScalef(1+.2*sin(se_GameTime()),1+.1*cos(se_GameTime()),1);
 
277
        glTranslatef(-300,-200,0);
 
278
    }
 
279
 
 
280
    sky_select();
 
281
 
 
282
    REAL sa=(lower_height-z)*.1;
 
283
    if (sa>1) sa=1;
 
284
    if (!sr_upperSky){
 
285
        sa=1;
 
286
        glBlendFunc(GL_SRC_ALPHA,GL_ZERO);
 
287
    }
 
288
    if (sa>0){
 
289
        glColor4f(1,1,1,sa);
 
290
        infinity_xy_plane(camPos,grid->CameraDir(viewer),lower_height);
 
291
    }
 
292
    if (!sr_upperSky && sr_alphaBlend)
 
293
        glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
 
294
}
 
295
 
 
296
void eGrid::display_simple( int viewer,bool floor,
 
297
                            bool sr_upperSky,bool sr_lowerSky,
 
298
                            REAL flooralpha,
 
299
                            bool eWalls,bool gameObjects,
 
300
                            REAL& zNear){
 
301
    /*
 
302
    static GLfloat S[]={1,0,0,0};
 
303
    static GLfloat T[]={0,1,0,0};
 
304
    static GLfloat R[]={0,0,1,0};
 
305
    static GLfloat Q[]={0,0,0,1};
 
306
 
 
307
    glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR);
 
308
    glTexGenfv(GL_S,GL_OBJECT_PLANE,S);
 
309
 
 
310
    glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR);
 
311
    glTexGenfv(GL_T,GL_OBJECT_PLANE,T);
 
312
 
 
313
    glTexGeni(GL_R,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR);
 
314
    glTexGenfv(GL_R,GL_OBJECT_PLANE,R);
 
315
 
 
316
    glTexGeni(GL_Q,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR);
 
317
    glTexGenfv(GL_Q,GL_OBJECT_PLANE,Q);
 
318
 
 
319
    glDisable(GL_TEXTURE_GEN_T);
 
320
    glDisable(GL_TEXTURE_GEN_S);
 
321
    glDisable(GL_TEXTURE_GEN_R);
 
322
    glDisable(GL_TEXTURE_GEN_Q);
 
323
    */
 
324
 
 
325
 
 
326
    glEdgeFlag(GL_FALSE);
 
327
 
 
328
    glDisable(GL_DEPTH_TEST);
 
329
 
 
330
    glDisable(GL_CULL_FACE);
 
331
 
 
332
    eCoord camPos = CameraGlancePos( viewer );
 
333
    // eWallRim::Bound( camPos, 10 );
 
334
 
 
335
    if (sr_upperSky || se_BlackSky()){
 
336
        if (se_BlackSky()){
 
337
            //glDisable(GL_TEXTURE);
 
338
            glDisable(GL_TEXTURE_2D);
 
339
 
 
340
            glColor3f(0,0,0);
 
341
 
 
342
            if ( z < lower_height )
 
343
                infinity_xy_plane(camPos, this->CameraDir(viewer),lower_height);
 
344
 
 
345
            glEnable(GL_TEXTURE_2D);
 
346
        }
 
347
        else {
 
348
            TexMatrix();
 
349
            glLoadIdentity();
 
350
            //      glScalef(.25,.25,.25);
 
351
 
 
352
            se_glFloorTexture();
 
353
 
 
354
            glColor3f(.5,.5,1);
 
355
 
 
356
            if ( z < upper_height )
 
357
                infinity_xy_plane(camPos, this->CameraDir(viewer),upper_height);
 
358
        }
 
359
    }
 
360
 
 
361
    if (sr_lowerSky && !sr_highRim){
 
362
        paint_sr_lowerSky(this, viewer,sr_upperSky, camPos);
 
363
    }
 
364
 
 
365
    if (floor){
 
366
        su_FetchAndStoreSDLInput();
 
367
        int floorDetail = sr_floorDetail;
 
368
 
 
369
        // no multitexturing without alpha blending
 
370
        if ( !sr_alphaBlend && floorDetail > rFLOOR_TEXTURE )
 
371
            floorDetail = rFLOOR_TEXTURE;
 
372
 
 
373
        switch(floorDetail){
 
374
        case rFLOOR_OFF:
 
375
            break;
 
376
        case rFLOOR_GRID:
 
377
            {
 
378
        #define SIDELEN   (se_GridSize())
 
379
        #define EXTENSION 10
 
380
 
 
381
                eCoord center = CameraPos(viewer) + CameraDir(viewer) * (SIDELEN * EXTENSION * .8);
 
382
 
 
383
                REAL x=center.x;
 
384
                REAL y=center.y;
 
385
                int xn=static_cast<int>(x/SIDELEN);
 
386
                int yn=static_cast<int>(y/SIDELEN);
 
387
 
 
388
 
 
389
                //glDisable(GL_TEXTURE);
 
390
                glDisable(GL_TEXTURE_2D);
 
391
 
 
392
        #define INTENSITY(x,xx) (1-(((x)-(xx))*((x)-(xx))/(EXTENSION*SIDELEN*EXTENSION*SIDELEN)))
 
393
 
 
394
 
 
395
                BeginLines();
 
396
                for(int i=xn-EXTENSION;i<=xn+EXTENSION;i++){
 
397
                    REAL intens=INTENSITY(i*SIDELEN,x);
 
398
                    if (intens<0) intens=0;
 
399
                    se_glFloorColor(intens,intens);
 
400
                    glVertex2f(i*SIDELEN,y-SIDELEN*(EXTENSION+1));
 
401
                    glVertex2f(i*SIDELEN,y+SIDELEN*(EXTENSION+1));
 
402
                }
 
403
                for(int j=yn-EXTENSION;j<=yn+EXTENSION;j++){
 
404
                    REAL intens=INTENSITY(j*SIDELEN,y);
 
405
                    if (intens<0) intens=0;
 
406
                    se_glFloorColor(intens,intens);
 
407
                    glVertex2f(x-(EXTENSION+1)*SIDELEN,j*SIDELEN);
 
408
                    glVertex2f(x+(EXTENSION+1)*SIDELEN,j*SIDELEN);
 
409
                }
 
410
                RenderEnd();
 
411
            }
 
412
            break;
 
413
 
 
414
        case rFLOOR_TEXTURE:
 
415
            TexMatrix();
 
416
            glLoadIdentity();
 
417
            glScalef(1/se_GridSize(),1/se_GridSize(),1/se_GridSize());
 
418
 
 
419
            se_glFloorTexture();
 
420
            se_glFloorColor(flooralpha);
 
421
 
 
422
            infinity_xy_plane( camPos, CameraDir(viewer) );
 
423
 
 
424
            /* old way: draw every triangle
 
425
            for(int i=eFace::faces.Len()-1;i>=0;i--){
 
426
            eFace *f=eFace::faces(i);
 
427
 
 
428
            if (f->visHeight[viewer]<z){
 
429
            glBegin(GL_TRIANGLES);
 
430
            for(int j=0;j<=2;j++){
 
431
            glVertex3f(f->p[j]->x,f->p[j]->y,0);
 
432
            }
 
433
            glEnd();
 
434
            }
 
435
            }
 
436
            */
 
437
 
 
438
            break;
 
439
 
 
440
        case rFLOOR_TWOTEXTURE:
 
441
            se_glFloorColor(flooralpha);
 
442
 
 
443
            TexMatrix();
 
444
            glLoadIdentity();
 
445
            REAL gs = 1/se_GridSize();
 
446
            glScalef(0.01*gs,gs,gs);
 
447
 
 
448
            se_glFloorTexture_a();
 
449
            infinity_xy_plane( camPos, CameraDir(viewer) );
 
450
 
 
451
            se_glFloorColor(flooralpha);
 
452
 
 
453
            TexMatrix();
 
454
            glLoadIdentity();
 
455
            glScalef(gs,.01*gs,gs);
 
456
 
 
457
            se_glFloorTexture_b();
 
458
 
 
459
            glDepthFunc(GL_LEQUAL);
 
460
            glBlendFunc(GL_SRC_ALPHA,GL_ONE);
 
461
            infinity_xy_plane( camPos, CameraDir(viewer) );
 
462
            glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
 
463
 
 
464
            break;
 
465
        }
 
466
    }
 
467
 
 
468
    TexMatrix();
 
469
    glLoadIdentity();
 
470
    ModelMatrix();
 
471
 
 
472
    //  glDisable(GL_TEXTURE_GEN_S);
 
473
    //  glDisable(GL_TEXTURE_GEN_T);
 
474
    //  glDisable(GL_TEXTURE_GEN_Q);
 
475
    //  glDisable(GL_TEXTURE_GEN_R);
 
476
 
 
477
    glEnable(GL_DEPTH_TEST);
 
478
 
 
479
    if(eWalls){
 
480
        for(int i=se_rimWalls.Len()-1;i>=0;i--){
 
481
            su_FetchAndStoreSDLInput();
 
482
            se_rimWalls(i)->RenderReal(cameras(viewer));
 
483
        }
 
484
 
 
485
        if (sr_lowerSky && sr_highRim){
 
486
            //      glEnable(GL_TEXTURE_GEN_S);
 
487
            //      glEnable(GL_TEXTURE_GEN_T);
 
488
            //      glEnable(GL_TEXTURE_GEN_Q);
 
489
            //      glEnable(GL_TEXTURE_GEN_R);
 
490
 
 
491
            paint_sr_lowerSky(this, viewer,sr_upperSky, camPos);
 
492
 
 
493
            //      glDisable(GL_TEXTURE_GEN_S);
 
494
            //      glDisable(GL_TEXTURE_GEN_T);
 
495
            //      glDisable(GL_TEXTURE_GEN_Q);
 
496
            //      glDisable(GL_TEXTURE_GEN_R);
 
497
 
 
498
            TexMatrix();
 
499
            glLoadIdentity();
 
500
            ModelMatrix();
 
501
        }
 
502
 
 
503
        glEnable(GL_DEPTH_TEST);
 
504
    }
 
505
    else
 
506
        glEnable(GL_DEPTH_TEST);
 
507
 
 
508
    if (eWalls){
 
509
        glDisable(GL_CULL_FACE);
 
510
        draw_eWall(this,viewer,0,zNear,cameras(viewer));
 
511
 
 
512
        /*
 
513
        #ifdef DEBUG
 
514
        for(int i=sg_netPlayerWalls.Len()-1;i>=0;i--){
 
515
          glMatrixMode(GL_MODELVIEW);
 
516
          glPushMatrix();
 
517
          if (sg_netPlayerWalls(i)->Preliminary())
 
518
        glTranslatef(0,0,4);
 
519
          else
 
520
        glTranslatef(0,0,8);
 
521
          if (sg_netPlayerWalls(i)->Wall())
 
522
        sg_netPlayerWalls(i)->Wall()->RenderList(false);
 
523
          glPopMatrix();
 
524
          }
 
525
        #endif
 
526
        */
 
527
 
 
528
        /*
 
529
        static int oldlen=0;
 
530
        int newlen=sg_netPlayerWalls.Len();
 
531
        if (newlen!=oldlen){
 
532
          con << "Number of player eWalls now " << newlen << '\n';
 
533
          oldlen=newlen;
 
534
        }
 
535
        */
 
536
 
 
537
    }
 
538
 
 
539
    if (gameObjects)
 
540
        eGameObject::RenderAll(this, cameras(viewer));
 
541
 
 
542
    eDebugLine::Render();
 
543
#ifdef DEBUG
 
544
 
 
545
    ePath::RenderLast();
 
546
 
 
547
    if (debug_grid){
 
548
        //glDisable(GL_TEXTURE);
 
549
        glDisable(GL_TEXTURE_2D);
 
550
        glDisable(GL_LIGHTING);
 
551
        BeginLines();
 
552
 
 
553
        int i;
 
554
        for(i=edges.Len()-1;i>=0;i--){
 
555
            eHalfEdge *e=edges[i];
 
556
            if (e->Face())
 
557
                glColor4f(1,1,1,1);
 
558
            else
 
559
                glColor4f(0,0,1,1);
 
560
 
 
561
            glVertex3f(e->Point()->x,e->Point()->y,10);
 
562
            glVertex3f(e->Point()->x,e->Point()->y,15);
 
563
            glVertex3f(e->Point()->x,e->Point()->y,.1);
 
564
            glVertex3f(e->other->Point()->x,e->other->Point()->y,.1);
 
565
            glVertex3f(e->other->Point()->x,e->other->Point()->y,10);
 
566
            glVertex3f(e->other->Point()->x,e->other->Point()->y,15);
 
567
 
 
568
        }
 
569
 
 
570
        for(i=points.Len()-1;i>=0;i--){
 
571
            ePoint *p=points[i];
 
572
            glColor4f(1,0,0,1);
 
573
            glVertex3f(p->x,p->y,0);
 
574
            glVertex3f(p->x,p->y,(p->GetRefcount()+1)*5);
 
575
        }
 
576
        /*
 
577
        for(int i=sg_netPlayerWalls.Len()-1;i>=0;i--){
 
578
          eEdge *e=sg_netPlayerWalls[i]->Edge();
 
579
        glColor4f(0,1,0,1);
 
580
 
 
581
          glVertex3f(e->Point()->x,e->Point()->y,5);
 
582
          glVertex3f(e->Point()->x,e->Point()->y,10);
 
583
          glVertex3f(e->Point()->x,e->Point()->y,10);
 
584
          glVertex3f(e->other->Point()->x,e->other->Point()->y,10);
 
585
          glVertex3f(e->other->Point()->x,e->other->Point()->y,10);
 
586
          glVertex3f(e->other->Point()->x,e->other->Point()->y,5);
 
587
        }
 
588
        */
 
589
        RenderEnd();
 
590
    }
 
591
#endif
 
592
 
 
593
}
 
594
#endif
 
595
 
 
596
void eGrid::Render( eCamera* cam, int viewer, REAL& zNear ){
 
597
    if (!sr_glOut)
 
598
        return;
 
599
#ifndef DEDICATED
 
600
    ProjMatrix();
 
601
 
 
602
    z=CameraHeight(viewer);
 
603
    if ( zNear > z )
 
604
    {
 
605
        zNear = z;
 
606
    }
 
607
 
 
608
    if (sr_floorMirror){
 
609
        ModelMatrix();
 
610
        glScalef(1,1,-1);
 
611
 
 
612
        if (z>10) z=10;
 
613
        glFrontFace(GL_CW);
 
614
 
 
615
        bool us=false;
 
616
        bool ls=false;
 
617
 
 
618
        if (sr_floorMirror>=rMIRROR_ALL){
 
619
            us=sr_upperSky;
 
620
            ls=sr_lowerSky;
 
621
        }
 
622
        else if (sr_floorMirror>=rMIRROR_WALLS){
 
623
            if (sr_lowerSky)
 
624
                ls=true;
 
625
            else if (sr_upperSky)
 
626
                us=true;
 
627
        }
 
628
 
 
629
        cam->SetRenderingMain(false);
 
630
        display_simple(viewer,false,
 
631
                       us,ls,
 
632
                       0,
 
633
                       sr_floorMirror>=rMIRROR_WALLS,
 
634
                       sr_floorMirror>=rMIRROR_OBJECTS,
 
635
                       zNear);
 
636
        z=CameraHeight(viewer);
 
637
        glFrontFace(GL_CCW);
 
638
        ModelMatrix();
 
639
        glScalef(1,1,-1);
 
640
 
 
641
 
 
642
        cam->SetRenderingMain(true);
 
643
        display_simple(viewer,true,
 
644
                       sr_upperSky,sr_lowerSky,
 
645
                       1-sr_floorMirror_strength,
 
646
                       true,true,zNear);
 
647
 
 
648
    }
 
649
    else
 
650
    {
 
651
        cam->SetRenderingMain(true);
 
652
        display_simple(viewer,true,
 
653
                       sr_upperSky,sr_lowerSky,
 
654
                       1,
 
655
                       true,true,zNear);
 
656
    }
 
657
 
 
658
 
 
659
#ifdef EVENT_DEB
 
660
    //  for(int i=eEdge_crossing.Len()-1;i>=0;i--){
 
661
    //    eEdge_crossing(i)->Render();
 
662
    //  }
 
663
#endif
 
664
#endif
 
665
}
 
666
 
 
667
 
 
668
//void eEdgeViewer::Render(){}
 
669
 
 
670
/*
 
671
void eViewerCrossesEdge::Render(){
 
672
#ifndef DEDICATED
 
673
  ePoint *p1=e->Point();
 
674
  ePoint *p2=e->other->Point();
 
675
 
 
676
  REAL timeLeft=value-se_GameTime();
 
677
 
 
678
  REAL h;
 
679
 
 
680
  if (viewer==1){
 
681
    if (timeLeft>0){
 
682
      h=timeLeft+4;
 
683
      glColor4f(0,0,1,.5);
 
684
    }
 
685
    else{
 
686
      h=-timeLeft+4;
 
687
      glColor4f(1,0,0,.5);
 
688
    }
 
689
 
 
690
    //  else
 
691
    //glColor4f(1,0,0,.5);
 
692
 
 
693
    static rTexture ArmageTron_invis_eWall(rTEX_WALL,"textures/eWall2.png",1,0);
 
694
    
 
695
    ArmageTron_invis_eWall.Select();
 
696
    
 
697
    eWall::Render_helper(e,(p1->x+p1->y)/4,(p2->x+p2->y)/4,h,1,4);
 
698
  }
 
699
#endif
 
700
}
 
701
*/
 
702
 
 
703
#endif
 
704
 
 
705