~ubuntu-branches/ubuntu/natty/spring/natty

« back to all changes in this revision

Viewing changes to rts/Rendering/Env/BasicSky.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Ritchie
  • Date: 2010-09-23 18:56:03 UTC
  • mfrom: (3.1.9 experimental)
  • Revision ID: james.westby@ubuntu.com-20100923185603-st97s5chplo42y7w
Tags: 0.82.5.1+dfsg1-1ubuntu1
* Latest upstream version for online play
* debian/control: Replace (rather than conflict) spring-engine
  - spring-engine will be a dummy package (LP: #612905)
  - also set maintainer to MOTU

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Sky.cpp: implementation of the CBasicSky class.
2
 
//
3
 
//////////////////////////////////////////////////////////////////////
 
1
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
 
2
 
4
3
#ifdef _MSC_VER
5
4
#pragma warning(disable:4258)
6
5
#endif
14
13
#include "Game/Camera.h"
15
14
#include "Map/MapInfo.h"
16
15
#include "Map/ReadMap.h"
 
16
#include "Rendering/GlobalRendering.h"
17
17
#include "Rendering/Textures/Bitmap.h"
18
18
#include "TimeProfiler.h"
19
19
#include "ConfigHandler.h"
64
64
        skyColor = mapInfo->atmosphere.skyColor;
65
65
        sunColor = mapInfo->atmosphere.sunColor;
66
66
        fogStart = mapInfo->atmosphere.fogStart;
67
 
        if (fogStart>0.99f) gu->drawFog = false;
 
67
        if (fogStart>0.99f) globalRendering->drawFog = false;
68
68
 
69
69
        for(int a=0;a<CLOUD_DETAIL;a++)
70
70
                cloudDown[a]=false;
262
262
 
263
263
        glFogfv(GL_FOG_COLOR,mapInfo->atmosphere.fogColor);
264
264
        glFogi(GL_FOG_MODE,GL_LINEAR);
265
 
        glFogf(GL_FOG_START,gu->viewRange*fogStart);
266
 
        glFogf(GL_FOG_END,gu->viewRange);
 
265
        glFogf(GL_FOG_START,globalRendering->viewRange*fogStart);
 
266
        glFogf(GL_FOG_END,globalRendering->viewRange);
267
267
        glFogf(GL_FOG_DENSITY,1.00f);
268
 
        if (gu->drawFog) {
 
268
        if (globalRendering->drawFog) {
269
269
                glEnable(GL_FOG);
270
270
        } else {
271
271
                glDisable(GL_FOG);
366
366
 
367
367
        int yam2 = ydif[(ast - 2) & CLOUD_MASK];
368
368
        int yam1 = ydif[(ast - 1) & CLOUD_MASK];
369
 
        int yaa  = ydif[(ast) & CLOUD_MASK];
 
369
        int yaa  = ydif[(ast)     & CLOUD_MASK];
370
370
        int ap1 = (ast + 1) & CLOUD_MASK;
371
371
 
372
372
        aed = aed * 4 + 3;
378
378
        for (int a = ast; a < aed; ++rc, ++ct) {
379
379
                int yap1 = ydif[ap1] += (int) cloudThickness[a3c += 4] - cloudThickness[a += 4] * 2 + cloudThickness[a4c += 4];
380
380
 
381
 
                int dif = (yam2 >> 2) +
382
 
                        ((yam2 = yam1) >> 1) +
383
 
                        (yam1 = yaa) +
384
 
                        ((yaa = yap1) >> 1) +
385
 
                        (ydif[(++ap1) &= CLOUD_MASK] >> 2);
 
381
                ap1++;
 
382
                ap1 = (ap1 & CLOUD_MASK);
 
383
                int dif =
 
384
                        (yam2 >> 2) +
 
385
                        (yam1 >> 1) +
 
386
                        (yaa) +
 
387
                        (yap1 >> 1) +
 
388
                        (ydif[ap1] >> 2);
386
389
                dif >>= 4;
387
390
 
 
391
                yam2 = yam1;
 
392
                yam1 = yaa;
 
393
                yaa  = yap1;
 
394
 
388
395
                *ct++ = 128 + dif;
389
396
                *ct++ = thicknessTransform[(*rc) >> 7];
390
397
                *ct++ = 255;
522
529
                for(int a=0; a<CLOUD_SIZE; ++a) {
523
530
                cloudThickness[(a*CLOUD_SIZE+int(gs->frameNum*0.00009f*256+camera->pos.x*CLOUD_SIZE*0.000025f))*4+3]=0;
524
531
                }
525
 
                /**/
 
532
                */
526
533
                glBindTexture(GL_TEXTURE_2D, cloudDot3Tex);
527
534
                glTexSubImage2D(GL_TEXTURE_2D,0, 0,0,CLOUD_SIZE, CLOUD_SIZE,GL_RGBA, GL_UNSIGNED_BYTE, cloudThickness);
528
535
                break;
684
691
                        glVertexf3(modSunDir*5+ldir*dx*4+udir*dy*4);
685
692
                }
686
693
                glEnd();
687
 
                if (gu->drawFog) glEnable(GL_FOG);
 
694
                if (globalRendering->drawFog) glEnable(GL_FOG);
688
695
 
689
696
        glEndList();
690
697
}