Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 17, 2006, 6:41:58 PM (19 years ago)
Author:
amaechler
Message:

branches/atmosphere_engine: cosmetics2

File:
1 edited

Legend:

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

    r7628 r7652  
    11/*
    2    orxonox - the future of 3D-vertical-scrollers
     2        orxonox - the future of 3D-vertical-scrollers
    33
    4    Copyright (C) 2004 orx
     4        Copyright (C) 2004 orx
    55
    6    This program is free software; you can redistribute it and/or modify
    7    it under the terms of the GNU General Public License as published by
    8    the Free Software Foundation; either version 2, or (at your option)
    9    any later version.
     6        This program is free software; you can redistribute it and/or modify
     7        it under the terms of the GNU General Public License as published by
     8        the Free Software Foundation; either version 2, or (at your option)
     9        any later version.
    1010
    1111### File Specific:
    12    main-programmer: hdavid, amaechler
     12        main-programmer: hdavid, amaechler
    1313*/
    1414
     
    2222/*#include "shell_command.h"
    2323SHELL_COMMAND(activateFog, FogEffect, FogEffect::activate)
    24   ->setAlias("aFog");
     24        ->setAlias("aFog");
    2525SHELL_COMMAND(deactivateFog, FogEffect, FogEffect::deactivate)
    26   ->setAlias("dFog");*/
     26        ->setAlias("dFog");*/
    2727
    2828using namespace std;
     
    3232FogEffect::FogEffect(const TiXmlElement* root)
    3333{
    34   this->setClassID(CL_FOG_EFFECT, "FogEffect");
    35  
    36   this->fogMode = GL_LINEAR;
    37   this->fogDensity = 0.001f;
    38   this->fogStart = 10.0f;
    39   this->fogEnd = 1000.0f;
     34        this->setClassID(CL_FOG_EFFECT, "FogEffect");
     35       
     36        this->fogMode = GL_LINEAR;
     37        this->fogDensity = 0.001f;
     38        this->fogStart = 10.0f;
     39        this->fogEnd = 1000.0f;
    4040
    41   if (root != NULL)
    42     this->loadParams(root);
     41        if (root != NULL)
     42                this->loadParams(root);
    4343
    44   this->activate();
     44        this->activate();
    4545}
    4646
     
    4949FogEffect::~FogEffect()
    5050{
    51   this->deactivate();
     51        this->deactivate();
    5252}
    5353
     
    5555void FogEffect::loadParams(const TiXmlElement* root)
    5656{
    57   WeatherEffect::loadParams(root);
     57        WeatherEffect::loadParams(root);
    5858
    59   LoadParam(root, "fog-mode", this, FogEffect, setFogMode);
    60   LoadParam(root, "fog-density", this, FogEffect, setFogDensity);
    61   LoadParam(root, "fog-color", this, FogEffect, setFogColor);
     59        LoadParam(root, "fog-mode", this, FogEffect, setFogMode);
     60        LoadParam(root, "fog-density", this, FogEffect, setFogDensity);
     61        LoadParam(root, "fog-color", this, FogEffect, setFogColor);
    6262
    6363
     
    7171bool FogEffect::activate()
    7272{
    73   PRINTF(0)( "Enabling FogEffect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->fogMode, this->fogDensity, this->fogStart, this->fogEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z);
     73        PRINTF(0)( "Enabling FogEffect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->fogMode, this->fogDensity, this->fogStart, this->fogEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z);
    7474
    75   glEnable(GL_FOG);
    76   {
    77     //GLfloat fogColor[4] = {0.7, 0.6, 0.6, 1.0};
    78     GLfloat fogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};
     75        glEnable(GL_FOG);
     76        {
     77                //GLfloat fogColor[4] = {0.7, 0.6, 0.6, 1.0};
     78                GLfloat fogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};
    7979
    80     glFogi(GL_FOG_MODE, this->fogMode);
    81     glFogfv(GL_FOG_COLOR, fogColor);
    82     glFogf(GL_FOG_DENSITY, this->fogDensity);
    83     glHint(GL_FOG_HINT, GL_DONT_CARE);
    84     glFogf(GL_FOG_START, this->fogStart);
    85     glFogf(GL_FOG_END, this->fogEnd);
     80                glFogi(GL_FOG_MODE, this->fogMode);
     81                glFogfv(GL_FOG_COLOR, fogColor);
     82                glFogf(GL_FOG_DENSITY, this->fogDensity);
     83                glHint(GL_FOG_HINT, GL_DONT_CARE);
     84                glFogf(GL_FOG_START, this->fogStart);
     85                glFogf(GL_FOG_END, this->fogEnd);
    8686
    87     //glFogi(GL_FOG_COORDINATE_SOURCE, GL_FOG_COORDINATE);
    88   }
    89   glClearColor(0.5, 0.5, 0.5, 1.0);
     87                //glFogi(GL_FOG_COORDINATE_SOURCE, GL_FOG_COORDINATE);
     88        }
     89        glClearColor(0.5, 0.5, 0.5, 1.0);
    9090}
    9191
     
    9393bool FogEffect::deactivate()
    9494{
    95   PRINTF(0)("Deactivating FogEffect\n");
     95        PRINTF(0)("Deactivating FogEffect\n");
    9696        glDisable(GL_FOG);
    9797}
     
    101101GLint FogEffect::stringToFogMode(const std::string& mode)
    102102{
    103   if(mode == "GL_LINEAR")
    104     return GL_LINEAR;
    105   else if(mode == "GL_EXP")
    106     return GL_EXP;
    107   else if(mode == "GL_EXP2" )
    108     return GL_EXP2;
    109   else
    110     return -1;
     103        if(mode == "GL_LINEAR")
     104                return GL_LINEAR;
     105        else if(mode == "GL_EXP")
     106                return GL_EXP;
     107        else if(mode == "GL_EXP2" )
     108                return GL_EXP2;
     109        else
     110                return -1;
    111111}
    112112
Note: See TracChangeset for help on using the changeset viewer.