Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 3, 2006, 5:01:22 PM (19 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine:

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

    r7515 r7523  
    2020#include "glincl.h"
    2121
    22 #include "shell_command.h"
    23 /*SHELL_COMMAND(activateFog, FogEffect, FogEffect::activate)
     22/*#include "shell_command.h"
     23SHELL_COMMAND(activateFog, FogEffect, FogEffect::activate)
    2424  ->setAlias("aFog");
    2525SHELL_COMMAND(deactivateFog, FogEffect, FogEffect::deactivate)
     
    7171bool FogEffect::activate()
    7272{
    73   PRINTF(0)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->fogMode, this->fogDensity,
    74              this->fogStart, this->fogEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z);
     73  PRINTF(0)( "Enabling Fog Effect, 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);
    7574
    7675  glEnable(GL_FOG);
  • branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc

    r7520 r7523  
    3232
    3333world_vector vertices[NUM_PANELS*4] = {
    34         {-5.0, -10.0, 0.0},{5.0, -10.0, 0.0},{5.0, 0.0, 0.0},{-5.0, 0.0, 0.0},
    35         {-5.0, -10.0, 10.0},{-5.0, -10.0, 0.0},{-5.0, 0.0, 0.0},{-5.0, 0.0, 10.0},
    36         {-5.0, -10.0, 20.0},{-5.0, -10.0, 10.0},{-5.0, 0.0, 10.0},{-5.0, 0.0, 20.0},
    37         {5.0, -10.0, 0.0},{5.0, -10.0, 10.0},{5.0, 0.0, 10.0},{5.0, 0.0, 0.0},
    38         {5.0, -10.0, 10.0},{5.0, -10.0, 20.0},{5.0, 0.0, 20.0},{5.0, 0.0, 10.0},
    39         {-5.0, -10.0, 10.0},{5.0, -10.0, 10.0},{5.0, -10.0, 0.0},{-5.0, -10.0, 0.0}
     34        {-50.0, -60.0, 0.0},{50.0, -60.0, 0.0},{50.0, 0.0, 0.0},{-50.0, 0.0, 0.0},
     35        {-50.0, -60.0, 60.0},{-50.0, -60.0, 0.0},{-50.0, 0.0, 0.0},{-50.0, 0.0, 60.0},
     36        {-50.0, -60.0, 20.0},{-50.0, -60.0, 60.0},{-50.0, 0.0, 60.0},{-50.0, 0.0, 20.0},
     37        {50.0, -60.0, 0.0},{50.0, -60.0, 60.0},{50.0, 0.0, 60.0},{50.0, 0.0, 0.0},
     38        {50.0, -60.0, 60.0},{50.0, -60.0, 20.0},{50.0, 0.0, 20.0},{50.0, 0.0, 60.0},
     39        {-50.0, -60.0, 60.0},{50.0, -60.0, 60.0},{50.0, -60.0, 0.0},{-50.0, -60.0, 0.0}
    4040};
    4141
     
    6565  WeatherEffect::loadParams(root);
    6666
    67   LoadParam(root, "test", this, VolFogEffect, test);
     67  LoadParam(root, "fog-altitude", this, VolFogEffect, setFogAltitude);
     68  LoadParam(root, "fog-color", this, VolFogEffect, startFogColor);
    6869}
    6970
    70 void VolFogEffect::test(int t)
    71 {
    72 PRINTF(0)("test\n\n");
    73 }
    7471
    7572bool VolFogEffect::init()
    7673{
    77 
     74  PRINTF(0)("Initalize VolFogEffect\n");
    7875};
    7976
     
    8279bool VolFogEffect::activate()
    8380{
    84   PRINTF(0)("Activate VolFogEffect\n");
     81  PRINTF(0)( "Enabling Volumetric Fog Effect, altitude: %i, color %f, %f, %f\n", this->fogAltitude, this->colorVector.x, this->colorVector.y, this->colorVector.z);
     82
    8583}
    8684
     
    9189
    9290
    93 void setFogColor(int v)
     91void VolFogEffect::setFogColor(int v)
    9492{
    9593        float z;        /* distance of vertex from edge of fog volume */
     
    9795
    9896        z = 0.0 - vertices[v].y;
    99         f = (10.0 - z) / (10.0 - 0.0);  /* linear fog: f = (end - z)/(end - start) */
    100         glColor4f(0.6, 0.2, 0.0, f);
     97        f = (60.0 - z) / (60.0 - 0.0);  /* linear fog: f = (end - z)/(end - start) */
     98        glColor4f(this->colorVector.x, this->colorVector.y, this->colorVector.z, f);
    10199}
    102100
    103         int v;          /* store of next vertex ref */
     101// int v;               /* store of next vertex ref */
    104102
    105103/**
     
    108106void VolFogEffect::draw() const
    109107{
    110         // int v;               /* store of next vertex ref */
     108        int v;          /* store of next vertex ref */
    111109        int ref;
    112110
     
    118116                glDepthMask(GL_FALSE);
    119117       
    120                 v = ref * 4;
    121 
    122118                /* restore z buffer writes, set blend params & disable texturing */
    123119
     
    131127                v = ref * 4;
    132128                glBegin(GL_QUADS);
    133                 setFogColor(v);
     129                //this->setFogColor(v);
    134130                glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z); v++;
    135                 setFogColor(v);
     131                //this->setFogColor(v);
    136132                glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z); v++;
    137                 setFogColor(v);
     133                //this->setFogColor(v);
    138134                glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z); v++;
    139                 setFogColor(v);
     135                //this->setFogColor(v);
    140136                glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z);
    141137                glEnd();
  • branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.h

    r7520 r7523  
    2323    virtual bool deactivate();
    2424
    25     void test(int t);
    26 
    27 
    2825    virtual void draw() const;
    2926    virtual void tick(float dt);
    3027
     28    inline void startFogColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); }
     29    inline void setFogAltitude(float altitude) { this->fogAltitude = altitude; }
     30
     31
    3132  private:
    32     void set_fog_colour(int v);
    33 
     33    void setFogColor(int v);
     34    GLfloat                 fogAltitude;
     35    Vector                  colorVector;
    3436};
    3537
Note: See TracChangeset for help on using the changeset viewer.