Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7107 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Feb 7, 2006, 11:06:19 PM (19 years ago)
Author:
patrick
Message:

trunk: fog patch

Location:
trunk/src/lib/graphics/effects
Files:
2 edited

Legend:

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

    r6980 r7107  
    3939  this->setClassID(CL_FOG_EFFECT, "FogEffect");
    4040
    41   this->fogMode = GL_EXP2;
     41  this->fogMode = GL_LINEAR;
    4242  this->fogDensity = 0.001f;
    4343  this->fogStart = 10.0f;
     
    4646  if (root != NULL)
    4747    this->loadParams(root);
     48
     49  this->activate();
    4850}
    4951
     
    7274      .describe("sets the the fog density of the exponentionl functions");
    7375
    74   LoadParam(root, "fog-range", this, FogEffect, setFogRange)
    75       .describe("sets the the range of the linear functions");
     76  LoadParam(root, "fog-color", this, FogEffect, setFogColor)
     77      .describe("sets the fog color");
     78
    7679}
    7780
     
    8992bool FogEffect::activate()
    9093{
    91   PRINTF(4)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f\n", this->fogMode, this->fogDensity,
    92              this->fogStart, this->fogEnd);
     94  PRINTF(0)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->fogMode, this->fogDensity,
     95             this->fogStart, this->fogEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z);
    9396
    9497  glEnable(GL_FOG);
    9598  {
    96     GLfloat fogColor[4] = {0.6, 0.6, 0.6, 1.0};
     99//     GLfloat fogColor[4] = {0.7, 0.6, 0.6, 1.0};
     100    GLfloat fogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};
    97101
    98102    glFogi(GL_FOG_MODE, this->fogMode);
  • trunk/src/lib/graphics/effects/fog_effect.h

    r6772 r7107  
    77#define _FOG_EFFECT
    88
     9#include "vector.h"
    910#include "graphics_effect.h"
    1011
     
    2526    virtual bool deactivate();
    2627
    27     void setFogMode(const char* mode) { this->fogMode = this->charToFogMode(mode); }
    28     void setFogDensity(float density) { this->fogDensity = density; }
    29     void setFogRange(float start, float end) { this->fogStart = start; this->fogEnd = end; }
     28    inline void setFogMode(const char* mode) { this->fogMode = this->charToFogMode(mode); }
     29    inline void setFogDensity(float density) { this->fogDensity = density; }
     30    inline void setFogRange(float start, float end) { this->fogStart = start; this->fogEnd = end; }
     31    inline void setFogColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); }
    3032
    3133
     
    3941    GLfloat                 fogStart;
    4042    GLfloat                 fogEnd;
     43    Vector                  colorVector;
    4144};
    4245
Note: See TracChangeset for help on using the changeset viewer.