- Timestamp:
- Nov 17, 2006, 12:57:53 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/volumetric_fog/src/world_entities/weather_effects/volfog_effect.cc
r9936 r9937 25 25 #include "debug.h" 26 26 27 //#include <GL/glext.h> 28 #include <SDL.h> 29 30 /* 31 ////////////////////////////////// 32 #ifndef APIENTRY 33 #define APIENTRY 34 #endif 35 #ifndef APIENTRYP 36 #define APIENTRYP APIENTRY * 37 #endif 38 /////////////////////////////////// 39 */ 27 40 #define GLX_GLXEXT_PROTOTYPES 28 41 … … 35 48 36 49 37 typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord); // Declare Function Prototype38 PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = NULL;// Our glFogCoordfEXT Function50 //typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord); // Declare Function Prototype 51 //PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = NULL; // Our glFogCoordfEXT Function 39 52 40 53 … … 71 84 fogColor[3] = 1.0f; 72 85 73 fogActivate = false; 86 //fogActivate = false; 87 fogActivate = true; 74 88 } 75 89 … … 84 98 return; 85 99 } 100 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 86 113 87 114 fogActivate = true; … … 102 129 if(!fogActivate) 103 130 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(); 104 178 } 105 179
Note: See TracChangeset
for help on using the changeset viewer.