Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9938 in orxonox.OLD for branches/volumetric_fog/src


Ignore:
Timestamp:
Nov 17, 2006, 4:20:17 PM (18 years ago)
Author:
hdavid
Message:

branches/volumetric_fog:new try

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/volumetric_fog/src/world_entities/weather_effects/volfog_effect.cc

    r9937 r9938  
    2525#include "debug.h"
    2626
    27 //#include <GL/glext.h>
    28 #include <SDL.h>
    2927
    30 /*
    31 //////////////////////////////////
    32 #ifndef APIENTRY
    33 #define APIENTRY
    34 #endif
    35 #ifndef APIENTRYP
    36 #define APIENTRYP APIENTRY *
    37 #endif
    38 ///////////////////////////////////
    39 */
     28
    4029#define GLX_GLXEXT_PROTOTYPES
    4130
     
    4635SHELL_COMMAND(activate, VolFogEffect, activateFog);
    4736SHELL_COMMAND(deactivate, VolFogEffect, deactivateFog);
    48 
    49 
    50 //typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord);    // Declare Function Prototype
    51 //PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = NULL;                        // Our glFogCoordfEXT Function
    5237
    5338
     
    7863void VolFogEffect::init() {
    7964  PRINTF(0)("Initalize VolFogEffect\n");
    80  
    81   fogColor[0] = 0.6f;
    82   fogColor[1] = 0.3f;
    83   fogColor[2] = 0.0f;
    84   fogColor[3] = 1.0f;
    8565
    86   //fogActivate = false;
    87 fogActivate = true;
     66  fogActivate = false;
    8867}
    8968
     
    9978  }
    10079
    101   // Set Up Fog
    102   //glEnable(GL_FOG);                         // Enable Fog
    103   glFogi(GL_FOG_MODE, GL_LINEAR);           // Fog Fade Is Linear
    104   glFogfv(GL_FOG_COLOR, fogColor);          // Set The Fog Color
    105   glFogf(GL_FOG_START,  1.0f);              // Set The Fog Start
    106   glFogf(GL_FOG_END,    0.0f);              // Set The Fog End
    107   glHint(GL_FOG_HINT, GL_NICEST);           // Per-Pixel Fog Calculation
    108 
    109 
    110   glFogCoordfEXT = (PFNGLFOGCOORDFEXTPROC) SDL_GL_GetProcAddress("glFogCoordfEXT");
    111 
    112   glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);    // Set Fog Based On Vertice Coordinates
    113  
    11480  fogActivate = true;
    11581}
     
    12995  if(!fogActivate)
    13096    return;
    131 
    132   glPushAttrib(GL_ENABLE_BIT);
    133   glDisable(GL_LIGHTING);
    134   glDisable(GL_BLEND);
    135 glEnable(GL_FOG);                         // Enable Fog
    136  
    137   glPushMatrix();
    138  
    139 
    140 
    141 glBegin(GL_QUADS);                          // Back Wall
    142     glFogCoordfEXT( 0.0f); glVertex3f(-2.5f,-2.5f,-15.0f);
    143     glFogCoordfEXT( 0.0f); glVertex3f( 2.5f,-2.5f,-15.0f);
    144     glFogCoordfEXT( 0.0f); glVertex3f( 2.5f, 2.5f,-15.0f);
    145     glFogCoordfEXT( 0.0f); glVertex3f(-2.5f, 2.5f,-15.0f);
    146   glEnd();
    147 
    148   glBegin(GL_QUADS);                          // Floor
    149     glFogCoordfEXT( 0.0f); glVertex3f(-2.5f,-2.5f,-15.0f);
    150     glFogCoordfEXT( 0.0f); glVertex3f( 2.5f,-2.5f,-15.0f);
    151     glFogCoordfEXT( 1.0f); glVertex3f( 2.5f,-2.5f, 15.0f);
    152     glFogCoordfEXT( 1.0f); glVertex3f(-2.5f,-2.5f, 15.0f);
    153   glEnd();
    154 
    155   glBegin(GL_QUADS);                          // Roof
    156     glFogCoordfEXT( 0.0f); glVertex3f(-2.5f, 2.5f,-15.0f);
    157     glFogCoordfEXT( 0.0f); glVertex3f( 2.5f, 2.5f,-15.0f);
    158     glFogCoordfEXT( 1.0f); glVertex3f( 2.5f, 2.5f, 15.0f);
    159     glFogCoordfEXT( 1.0f); glVertex3f(-2.5f, 2.5f, 15.0f);
    160   glEnd();
    161 
    162   glBegin(GL_QUADS);                          // Right Wall
    163     glFogCoordfEXT( 1.0f); glVertex3f( 2.5f,-2.5f, 15.0f);
    164     glFogCoordfEXT( 1.0f); glVertex3f( 2.5f, 2.5f, 15.0f);
    165     glFogCoordfEXT( 0.0f); glVertex3f( 2.5f, 2.5f,-15.0f);
    166     glFogCoordfEXT( 0.0f); glVertex3f( 2.5f,-2.5f,-15.0f);
    167   glEnd();
    168 
    169   glBegin(GL_QUADS);                          // Left Wall
    170     glFogCoordfEXT( 1.0f); glVertex3f(-2.5f,-2.5f, 15.0f);
    171     glFogCoordfEXT( 1.0f); glVertex3f(-2.5f, 2.5f, 15.0f);
    172     glFogCoordfEXT( 0.0f); glVertex3f(-2.5f, 2.5f,-15.0f);
    173     glFogCoordfEXT( 0.0f); glVertex3f(-2.5f,-2.5f,-15.0f);
    174   glEnd();
    175 
    176   glPopMatrix();
    177   glPopAttrib();
    17897}
    17998
Note: See TracChangeset for help on using the changeset viewer.