Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 27, 2006, 9:49:33 AM (19 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine: glFog implemented in AtmosEngine

Location:
branches/atmospheric_engine/src/lib/graphics/effects
Files:
4 edited

Legend:

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

    r7381 r7392  
    2727using namespace std;
    2828
    29 
    30 
    3129/**
    3230 * @param root The XML-element to load the AtmosphericEngine from
     
    3432AtmosphericEngine::AtmosphericEngine()
    3533{
    36   //this->setClassID(CL_ATMOSPHERIC_ENGINE, "AtmosphericEngine");
    37   this->bActivated = false;
     34  // this->setClassID(CL_ATMOSPHERIC_ENGINE, "AtmosphericEngine");
     35  // this->bActivated = false;
    3836}
    3937
     
    9290 *  initializes the graphics effect
    9391 */
    94 bool AtmosphericEngine::init()
    95 {}
     92//bool AtmosphericEngine::init()
     93//{}
    9694
    9795
  • branches/atmospheric_engine/src/lib/graphics/effects/atmospheric_engine.h

    r7381 r7392  
    1515{
    1616  public:
    17     virtual ~AtmosphericEngine();
     17    ~AtmosphericEngine();
    1818
    1919    /** @returns a Pointer to the only object of this Class */
    2020    inline static AtmosphericEngine* getInstance() { if (!AtmosphericEngine::singletonRef) AtmosphericEngine::singletonRef = new AtmosphericEngine();  return AtmosphericEngine::singletonRef; };
    2121
    22     virtual void loadParams(const TiXmlElement* root);
     22    void loadParams(const TiXmlElement* root);
    2323
    24     virtual bool init();
     24    // bool init();
    2525
    26     //virtual bool activate() = 0;
    27     //virtual bool deactivate() = 0;
     26    void draw() const;
     27    void tick(float dt);
    2828
    29     virtual void draw() const;
    30     virtual void tick(float dt);
    31 
    32     inline bool isActivated() const { return this->bActivated; }
     29    // inline bool isActivated() const { return this->bActivated; }
    3330
    3431    void loadWeatherEffect(const TiXmlElement* root);
     
    4138    static AtmosphericEngine*     singletonRef;       //!< Pointer to the only instance of this Class
    4239
    43   protected:
    44     bool              bActivated;
     40  //protected:
     41  //  bool              bActivated;
    4542};
    4643
  • branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc

    r7381 r7392  
    2020#include "glincl.h"
    2121
    22 
     22#include "shell_command.h"
     23/*SHELL_COMMAND(activateFog, FogEffect, FogEffect::activate)
     24  ->setAlias("aFog");
     25SHELL_COMMAND(deactivateFog, FogEffect, FogEffect::deactivate)
     26  ->setAlias("dFog");*/
    2327
    2428using namespace std;
     
    2630CREATE_FACTORY(FogEffect, CL_FOG_EFFECT);
    2731
    28 
    2932FogEffect::FogEffect(const TiXmlElement* root)
    3033{
    3134  //this->setClassID(CL_FOG_EFFECT, "FogEffect");
    32 /*
     35
    3336  this->fogMode = GL_LINEAR;
    3437  this->fogDensity = 0.001f;
    3538  this->fogStart = 10.0f;
    3639  this->fogEnd = 1000.0f;
    37 */
     40
    3841  if (root != NULL)
    3942    this->loadParams(root);
     
    5457  WeatherEffect::loadParams(root);
    5558
    56 /*
    5759  LoadParam(root, "fog-mode", this, FogEffect, setFogMode);
    5860
    5961  LoadParam(root, "fog-density", this, FogEffect, setFogDensity);
    6062
    61   LoadParam(root, "fog-color", this, FogEffect, setFogColor);*/
     63  LoadParam(root, "fog-color", this, FogEffect, setFogColor);
    6264
    63   LoadParam(root, "test", this, FogEffect, setTest);
     65  // LoadParam(root, "test", this, FogEffect, setTest);
    6466
    6567
     
    7779
    7880bool FogEffect::activate()
    79 {/*
     81{
    8082  PRINTF(0)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->fogMode, this->fogDensity,
    8183             this->fogStart, this->fogEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z);
    8284
     85  /*PRINTF(0)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f\n", this->fogMode, this->fogDensity,
     86             this->fogStart, this->fogEnd);*/
     87
    8388  glEnable(GL_FOG);
    8489  {
    85 //     GLfloat fogColor[4] = {0.7, 0.6, 0.6, 1.0};
     90    //GLfloat fogColor[4] = {0.7, 0.6, 0.6, 1.0};
    8691    GLfloat fogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};
    8792
     
    95100    //glFogi(GL_FOG_COORDINATE_SOURCE, GL_FOG_COORDINATE);
    96101  }
    97   glClearColor(0.5, 0.5, 0.5, 1.0);*/
     102  glClearColor(0.5, 0.5, 0.5, 1.0);
    98103}
    99104
     
    102107bool FogEffect::deactivate()
    103108{
    104   //glDisable(GL_FOG);
     109        glDisable(GL_FOG);
    105110}
    106111
    107112
    108 /*
     113
    109114GLint FogEffect::stringToFogMode(const std::string& mode)
    110115{
     
    118123    return -1;
    119124}
    120 */
    121125
     126
  • branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h

    r7381 r7392  
    55#ifndef _FOG_EFFECT
    66#define _FOG_EFFECT
     7
     8#include "vector.h"
    79
    810#include "weather_effect.h"
     
    2426    void setTest(int test);
    2527
    26     /*inline void setFogMode(const std::string& mode) { this->fogMode = this->stringToFogMode(mode); }
     28    inline void setFogMode(const std::string& mode) { this->fogMode = this->stringToFogMode(mode); }
    2729    inline void setFogDensity(float density) { this->fogDensity = density; }
    2830    inline void setFogRange(float start, float end) { this->fogStart = start; this->fogEnd = end; }
    2931    inline void setFogColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); }
    30 */
    31 
    32   private:
    33     //GLint stringToFogMode(const std::string& mode);
    3432
    3533
    3634  private:
    37    /* GLint                   fogMode;
     35    GLint stringToFogMode(const std::string& mode);
     36
     37
     38  private:
     39    GLint                   fogMode;
    3840    GLfloat                 fogDensity;
    3941    GLfloat                 fogStart;
    4042    GLfloat                 fogEnd;
    41     Vector                  colorVector;*/
     43    Vector                  colorVector;
    4244};
    4345
Note: See TracChangeset for help on using the changeset viewer.