Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7515 in orxonox.OLD for branches


Ignore:
Timestamp:
May 3, 2006, 3:25:38 PM (19 years ago)
Author:
hdavid
Message:
 
Location:
branches/atmospheric_engine/src/lib/graphics/effects
Files:
3 edited

Legend:

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

    r7503 r7515  
    9292
    9393
    94 
    9594bool FogEffect::deactivate()
    9695{
  • branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc

    r7504 r7515  
    2121
    2222#include "shell_command.h"
    23 /*SHELL_COMMAND(activateVolFog, VolFogEffect, VolFogEffect::activate)
    24   ->setAlias("aVolFog");
    25 SHELL_COMMAND(deactivateVolFog, VolFogEffect, VolFogEffect::deactivate)
    26   ->setAlias("dVolFog");*/
    2723
    2824using namespace std;
     
    3430  this->setClassID(CL_VOLFOG_EFFECT, "VolFogEffect");
    3531
    36   this->volfogMode = GL_LINEAR;
    37   this->volfogDensity = 0.001f;
    38   this->volfogStart = 10.0f;
    39   this->volfogEnd = 1000.0f;
    40 
    4132  if (root != NULL)
    4233    this->loadParams(root);
    43 
     34jhljkhlkjhlkjh   
    4435  this->activate();
    4536}
     
    4738
    4839
    49 VolFogEffect::~VolFogEffect()
     40VolFogEffect::~VolFogEffdect()
    5041{
    5142  this->deactivate();
     
    5647{
    5748  WeatherEffect::loadParams(root);
    58 
    59   LoadParam(root, "volfog-mode", this, VolFogEffect, setVolFogMode);
    60   LoadParam(root, "volfog-density", this, VolFogEffect, setVolFogDensity);
    61   LoadParam(root, "volfog-color", this, VolFogEffect, setVolFogColor);
    62 
    63 
    6449}
    6550
     
    7156bool VolFogEffect::activate()
    7257{
    73   PRINTF(0)( "Enabling VolFog Effect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->volfogMode, this->volfogDensity,
    74              this->volfogStart, this->volfogEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z);
    7558
    76   glEnable(GL_FOG);
    77   {
    78     //GLfloat volfogColor[4] = {0.7, 0.6, 0.6, 1.0};
    79     GLfloat volfogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};
    80 
    81     glFogi(GL_FOG_MODE, this->volfogMode);
    82     glFogfv(GL_FOG_COLOR, volfogColor);
    83     glFogf(GL_FOG_DENSITY, this->volfogDensity);
    84     glHint(GL_FOG_HINT, GL_DONT_CARE);
    85     glFogf(GL_FOG_START, this->volfogStart);
    86     glFogf(GL_FOG_END, this->volfogEnd);
    87 
    88     //glVolFogi(GL_VOLFOG_COORDINATE_SOURCE, GL_VOLFOG_COORDINATE);
    89   }
    90   glClearColor(0.5, 0.5, 0.5, 1.0);
    9159}
    9260
     
    9563bool VolFogEffect::deactivate()
    9664{
    97   PRINTF(0)("Deactivating VolFog Effect");
    98         glDisable(GL_FOG);
     65
    9966}
    10067
    10168
    102 
    103 GLint VolFogEffect::stringToVolFogMode(const std::string& mode)
    104 {
    105   if(mode == "GL_LINEAR")
    106     return GL_LINEAR;
    107   else if(mode == "GL_EXP")
    108     return GL_EXP;
    109   else if(mode == "GL_EXP2" )
    110     return GL_EXP2;
    111   else
    112     return -1;
    113 }
    114 
    115 
  • branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.h

    r7505 r7515  
    2323    virtual bool deactivate();
    2424
    25     inline void setVolFogMode(const std::string& mode) { this->volfogMode = this->stringToVolFogMode(mode); }
    26     inline void setVolFogDensity(float density) { this->volfogDensity = density; }
    27     inline void setVolFogRange(float start, float end) { this->volfogStart = start; this->volfogEnd = end; }
    28     inline void setVolFogColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); }
    29 
    3025
    3126  private:
    32     GLint stringToVolFogMode(const std::string& mode);
    3327
    34 
    35   private:
    36     GLint                   volfogMode;
    37     GLfloat                 volfogDensity;
    38     GLfloat                 volfogStart;
    39     GLfloat                 volfogEnd;
    40     Vector                  colorVector;
    4128};
    4229
Note: See TracChangeset for help on using the changeset viewer.