Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

branches/atmosphere_engine: cosmetics2

File:
1 edited

Legend:

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

    r7577 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
     
    2727VolFogEffect::VolFogEffect(const TiXmlElement* root)
    2828{
    29   this->setClassID(CL_VOLFOG_EFFECT, "VolFogEffect");
     29        this->setClassID(CL_VOLFOG_EFFECT, "VolFogEffect");
    3030
    31   if (root != NULL)
    32     this->loadParams(root);
     31        if (root != NULL)
     32                this->loadParams(root);
    3333
    34   // Initialize Effect
    35   this->init();
     34        // Initialize Effect
     35        this->init();
    3636
    37   // Activate Effect
    38   this->activate();
     37        // Activate Effect
     38        this->activate();
    3939}
    4040
     
    4242VolFogEffect::~VolFogEffect()
    4343{
    44   this->deactivate();
     44        this->deactivate();
    4545}
    4646
    4747void VolFogEffect::loadParams(const TiXmlElement* root)
    4848{
    49   WeatherEffect::loadParams(root);
     49        WeatherEffect::loadParams(root);
    5050}
    5151
    5252bool VolFogEffect::init()
    5353{
    54   PRINTF(0)("Initalize VolFogEffect\n");
    55  
    56   if (glewInit() == GLEW_OK)
    57     PRINTF(0)("glewInit OK\n");
    58   else
    59     PRINTF(0)("glewInit failed\n");
     54        PRINTF(0)("Initalize VolFogEffect\n");
     55       
     56        if (glewInit() == GLEW_OK)
     57                PRINTF(0)("glewInit OK\n");
     58        else
     59                PRINTF(0)("glewInit failed\n");
    6060
    61   // Set fog color
    62   float fogColor[4] = {0.0, 1.0, 0.0, 1.0};
     61        // Set fog color
     62        float fogColor[4] = {0.0, 1.0, 0.0, 1.0};
    6363
    64   /* set up fog params */       
    65   glEnable(GL_FOG);                                             // Enable Fog
    66   glFogi(GL_FOG_MODE, GL_LINEAR);                               // Fog Fade Is Linear
    67   glFogfv(GL_FOG_COLOR, fogColor);                              // Set The Fog Color
    68   glFogf(GL_FOG_START, 0.0f);                                   // Set The Fog Start
    69   glFogf(GL_FOG_END, 1.0f);                                     // Set The Fog End
    70   glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);  // Set The Fog based on vertice coordinates
    71   // glHint(GL_FOG_HINT, GL_NICEST);                            // Per-Pixel Fog Calculation
     64        /* set up fog params */
     65        glEnable(GL_FOG);                                               // Enable Fog
     66        glFogi(GL_FOG_MODE, GL_LINEAR);                         // Fog Fade Is Linear
     67        glFogfv(GL_FOG_COLOR, fogColor);                                // Set The Fog Color
     68        glFogf(GL_FOG_START, 0.0f);                                     // Set The Fog Start
     69        glFogf(GL_FOG_END, 1.0f);                                       // Set The Fog End
     70        glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);    // Set The Fog based on vertice coordinates
     71        // glHint(GL_FOG_HINT, GL_NICEST);                              // Per-Pixel Fog Calculation
    7272
    73   // glClearColor(0.0, 0.0, 0.0, 1.0);  //sets bg color?!
     73        // glClearColor(0.0, 0.0, 0.0, 1.0);  //sets bg color?!
    7474
    75   /* enable texturing & set texturing function */
    76   // glEnable(GL_TEXTURE_2D);
    77   // glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
     75        /* enable texturing & set texturing function */
     76        // glEnable(GL_TEXTURE_2D);
     77        // glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    7878
    79   if (glewGetExtension("GL_EXT_fog_coord"))
    80   {
    81     PRINTF(0)("GL_EXT_fog_coord extension found\n");
    82     return true;
    83   }
    84   else
    85   {
    86     PRINTF(0)("GL_EXT_fog_coord extension NOT found\n");
    87     return false;
    88   }
     79        if (glewGetExtension("GL_EXT_fog_coord"))
     80        {
     81                PRINTF(0)("GL_EXT_fog_coord extension found\n");
     82                return true;
     83        }
     84        else
     85        {
     86                PRINTF(0)("GL_EXT_fog_coord extension NOT found\n");
     87                return false;
     88        }
    8989}
    9090
     
    9292bool VolFogEffect::activate()
    9393{
    94   PRINTF(0)("Activating VolFogEffect\n");
     94        PRINTF(0)("Activating VolFogEffect\n");
    9595}
    9696
    9797bool VolFogEffect::deactivate()
    9898{
    99   PRINTF(0)("Deactivating VolFogEffect\n");
     99        PRINTF(0)("Deactivating VolFogEffect\n");
    100100}
    101101
    102102
    103103/**
    104  * draws the effect, if needed
    105  */
     104* draws the effect, if needed
     105*/
    106106void VolFogEffect::draw() const
    107107{
     
    134134
    135135        glBegin(GL_QUADS); // Back Wall
    136                 glFogCoordfEXT(0.0f);   glVertex3f(0.0f,0.0f,0.0f);
     136                glFogCoordfEXT(0.0f);   glVertex3f(0.0f,0.0f,0.0f);
    137137                glFogCoordfEXT(0.0f);   glVertex3f( 100.0f,0.0f,0.0f);
    138138                glFogCoordfEXT(1.0f);   glVertex3f( 100.0f, 100.0f,0.0f);
     
    141141
    142142        glBegin(GL_QUADS); // Front Wall
    143                 glFogCoordfEXT(0.0f);   glVertex3f(0.0f,0.0f,100.0f);
     143                glFogCoordfEXT(0.0f);   glVertex3f(0.0f,0.0f,100.0f);
    144144                glFogCoordfEXT(0.0f);   glVertex3f( 100.0f,0.0f,100.0f);
    145145                glFogCoordfEXT(1.0f);   glVertex3f( 100.0f, 100.0f,100.0f);
     
    155155
    156156        glBegin(GL_QUADS); // Left Wall
    157                 glFogCoordfEXT(0.0f);   glVertex3f(0.0f,0.0f, 100.0f);
     157                glFogCoordfEXT(0.0f);   glVertex3f(0.0f,0.0f, 100.0f);
    158158                glFogCoordfEXT(1.0f);   glVertex3f(0.0f, 100.0f, 100.0f);
    159159                glFogCoordfEXT(1.0f);   glVertex3f(0.0f, 100.0f,0.0f);
     
    169169
    170170/**
    171  * ticks the effect if there is any time dependancy
    172  */
     171* ticks the effect if there is any time dependancy
     172*/
    173173void VolFogEffect::tick(float dt)       
    174174{
Note: See TracChangeset for help on using the changeset viewer.