Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8267 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics


Ignore:
Timestamp:
Jun 8, 2006, 4:28:24 PM (19 years ago)
Author:
amaechler
Message:

raise the number:)

Location:
branches/atmospheric_engine/src/lib/graphics
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc

    r8255 r8267  
    5858        LoadParam(root, "range", this, FogEffect, setFogRange);
    5959        LoadParam(root, "color", this, FogEffect, setFogColor);
     60        LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn);
     61        LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut);
    6062
    6163        LOAD_PARAM_START_CYCLE(root, element);
     
    7072        //default values
    7173        this->fogActivate = false;
    72         this->fogFadeDuration = 0;
     74        this->fogFadeInDuration = 0;
     75        this->fogFadeOutDuration = 0;
    7376        this->localTimer = 0;
    7477       
     
    7982        this->colorVector = Vector(0.7, 0.7, 0.7);
    8083
     84        return 0;
    8185}
    8286
     
    98102        glEnable(GL_FOG);
    99103        // glClearColor(0.5, 0.5, 0.5, 1.0);
     104
     105        return 0;
    100106}
    101107
     
    108114       
    109115        glDisable(GL_FOG);
     116
     117        return 0;
    110118}
    111119
    112120void FogEffect::draw() const {
    113121
    114         if (this->fogFadeDuration != 0 && this->localTimer < this->fogFadeDuration)
     122        if (this->fogFadeInDuration > 0 && this->localTimer < this->fogFadeInDuration)
    115123                glFogf(GL_FOG_DENSITY, this->fogFadeDensity);
    116124        //else
     
    124132               
    125133
    126         if (this->fogFadeDuration != 0 && this->localTimer < this->fogFadeDuration) {
     134        if (this->fogFadeInDuration > 0 && this->localTimer < this->fogFadeInDuration) {
    127135                this->localTimer += dt;
    128                 float progress = this->localTimer / this->fogFadeDuration;
     136                float progress = this->localTimer / this->fogFadeInDuration;
    129137                this->fogFadeDensity = progress * this->fogDensity;
    130138        }
     
    136144                this->deactivate();
    137145
    138         this->fogFadeDuration = 10;
     146        if (!this->fogFadeInDuration > 0)
     147                this->fogFadeInDuration = 20;
     148
    139149        this->localTimer = 0;
    140150        this->activate();
  • branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h

    r8255 r8267  
    3333                inline void setFogRange(float start, float end) { this->fogStart = start; this->fogEnd = end; }
    3434                inline void setFogColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); }
     35                inline void setFogFadeIn(float fadein) { this->fogFadeInDuration = fadein; }
     36                inline void setFogFadeOut(float fadeout) { this->fogFadeOutDuration = fadeout; }
     37
    3538                inline void setFogOption(const std::string& option) { if (option == "activate") this->fogActivate = true; }
    3639
     
    4144
    4245                bool                            fogActivate;
    43                 GLfloat                         fogFadeDuration;
     46                GLfloat                         fogFadeInDuration;
     47                GLfloat                         fogFadeOutDuration;
     48
    4449                float                           localTimer;
    4550               
  • branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc

    r8261 r8267  
    8686        LoadParam(root, "life", this, RainEffect, setRainLife);
    8787        LoadParam(root, "wind", this, RainEffect, setRainWind);
    88         LoadParam(root, "startraining", this, RainEffect, setRainStart);
     88        LoadParam(root, "fadeinduration", this, RainEffect, setRainFadeIn);
     89        LoadParam(root, "fadeoutduration", this, RainEffect, setRainFadeOut);
    8990
    9091        LOAD_PARAM_START_CYCLE(root, element);
     
    109110        this->rainMaxParticles = this->rainRate * this->rainLife;
    110111        this->rainWindForce  = 0;
    111         this->rainStartDuration = 0;
     112        this->rainFadeInDuration = 0;
     113        this->rainFadeOutDuration = 0;
    112114        this->localTimer = 0;
    113115        this->soundRainVolume = 0.8f;
     
    117119        lightMan = LightManager::getInstance();
    118120        this->rainAmbient = lightMan->getAmbientColor();
     121
     122        return 0;
    119123}
    120124
     
    155159
    156160        lightMan->setAmbientColor(.1,.1,.1);
     161
     162        return 0;
    157163}
    158164
     
    170176        // Restore Light Ambient
    171177        lightMan->setAmbientColor(this->rainAmbient, this->rainAmbient, this->rainAmbient);
     178
     179        return 0;
    172180}
    173181
     
    182190        }
    183191
    184         if (this->rainStartDuration != 0 && this->localTimer < this->rainStartDuration) {
     192        if (this->rainFadeInDuration != 0 && this->localTimer < this->rainFadeInDuration) {
    185193                this->localTimer += dt;
    186                 float progress = this->localTimer / this->rainStartDuration;
     194                float progress = this->localTimer / this->rainFadeInDuration;
    187195
    188196                // Dim Light
     
    210218                this->deactivate();
    211219
    212         this->rainStartDuration = 10;
     220        if (!this->rainFadeInDuration > 0)
     221                this->rainFadeInDuration = 20;
     222
    213223        this->localTimer = 0;
    214224        this->activate();
  • branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h

    r8255 r8267  
    4747                inline void setRainLife(float life) { this->rainLife = life; }
    4848                inline void setRainWind(int force) { this->rainWindForce = force; }
    49                 inline void setRainStart(float duration) { this->rainStartDuration = duration; }
     49                inline void setRainStart(float duration) { this->rainFadeInDuration = duration; }
     50
     51                inline void setRainFadeIn(float fadein) { this->rainFadeInDuration = fadein; }
     52                inline void setRainFadeOut(float fadeout) { this->rainFadeOutDuration = fadeout; }
     53
    5054
    5155                inline void setRainOption(const std::string& option) {
     
    5963                ParticleEmitter*                        emitter;
    6064
     65                GLfloat                                 rainFadeInDuration;
     66                GLfloat                                 rainFadeOutDuration;
    6167                float                                   localTimer;
    6268
     
    6874                GLfloat                                 rainMaxParticles;
    6975                int                                     rainWindForce;
    70                 GLfloat                                 rainStartDuration;
    7176                bool                                    rainMove;
    7277                bool                                    rainActivate;
  • branches/atmospheric_engine/src/lib/graphics/graphics_engine.cc

    r8148 r8267  
    145145    return -1;
    146146  this->initVideo(640, 480, 16);
     147
     148  return 0;
    147149}
    148150
     
    186188
    187189  //ge->activate();
     190
     191  return 0;
    188192}
    189193
     
    238242
    239243  this->isInit = true;
     244
     245  return 0;
    240246}
    241247
     
    289295  glEnable(GL_CULL_FACE);
    290296  glCullFace(GL_FRONT);
     297
     298  return 0;
    291299}
    292300
     
    379387  }
    380388#endif /* __WIN32__ */
     389
     390  return 0;
    381391}
    382392
     
    413423{
    414424  this->setResolution(resizeInfo.w, resizeInfo.h, this->bitsPerPixel);
     425
     426  return 0;
    415427}
    416428
Note: See TracChangeset for help on using the changeset viewer.