Changeset 9938 in orxonox.OLD for branches/volumetric_fog/src/world_entities
- Timestamp:
- Nov 17, 2006, 4:20:17 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/volumetric_fog/src/world_entities/weather_effects/volfog_effect.cc
r9937 r9938 25 25 #include "debug.h" 26 26 27 //#include <GL/glext.h>28 #include <SDL.h>29 27 30 /* 31 ////////////////////////////////// 32 #ifndef APIENTRY 33 #define APIENTRY 34 #endif 35 #ifndef APIENTRYP 36 #define APIENTRYP APIENTRY * 37 #endif 38 /////////////////////////////////// 39 */ 28 40 29 #define GLX_GLXEXT_PROTOTYPES 41 30 … … 46 35 SHELL_COMMAND(activate, VolFogEffect, activateFog); 47 36 SHELL_COMMAND(deactivate, VolFogEffect, deactivateFog); 48 49 50 //typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord); // Declare Function Prototype51 //PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = NULL; // Our glFogCoordfEXT Function52 37 53 38 … … 78 63 void VolFogEffect::init() { 79 64 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;85 65 86 //fogActivate = false; 87 fogActivate = true; 66 fogActivate = false; 88 67 } 89 68 … … 99 78 } 100 79 101 // Set Up Fog102 //glEnable(GL_FOG); // Enable Fog103 glFogi(GL_FOG_MODE, GL_LINEAR); // Fog Fade Is Linear104 glFogfv(GL_FOG_COLOR, fogColor); // Set The Fog Color105 glFogf(GL_FOG_START, 1.0f); // Set The Fog Start106 glFogf(GL_FOG_END, 0.0f); // Set The Fog End107 glHint(GL_FOG_HINT, GL_NICEST); // Per-Pixel Fog Calculation108 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 Coordinates113 114 80 fogActivate = true; 115 81 } … … 129 95 if(!fogActivate) 130 96 return; 131 132 glPushAttrib(GL_ENABLE_BIT);133 glDisable(GL_LIGHTING);134 glDisable(GL_BLEND);135 glEnable(GL_FOG); // Enable Fog136 137 glPushMatrix();138 139 140 141 glBegin(GL_QUADS); // Back Wall142 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); // Floor149 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); // Roof156 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 Wall163 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 Wall170 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();178 97 } 179 98
Note: See TracChangeset
for help on using the changeset viewer.