- Timestamp:
- Jan 26, 2006, 2:44:26 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/defs/class_id.h
r6731 r6772 74 74 CL_STORY_ENTITY = 0x02000000, 75 75 76 CL_PHYSICS_INTERFACE = 0x04000000, 77 78 CL_EVENT_LISTENER = 0x08000000, 79 80 CL_ELEMENT_2D = 0x10000000, 81 82 CL_SYNCHRONIZEABLE = 0x20000000, 83 84 CL_WORLD_ENTITY = 0x40000000, 85 76 86 CL_GAME_WORLD = 0x50000000, 77 87 CL_GAME_WORLD_DATA = 0x60000000, 78 88 79 CL_PHYSICS_INTERFACE = 0x04000000, 80 81 CL_EVENT_LISTENER = 0x08000000, 82 83 CL_ELEMENT_2D = 0x10000000, 84 85 CL_SYNCHRONIZEABLE = 0x20000000, 86 87 CL_WORLD_ENTITY = 0x40000000, 89 CL_GRAPHICS_EFFECT = 0x70000000, 90 88 91 89 92 // subsuper-classes derivations taken : 1, 2, 3, 5, a, b, c. << THIS IS A LIST OF ALL THE DCL_MASK_SUBSUPERCLASS_ID's taken … … 258 261 CL_ENVIRONMENT = 0x00000821, 259 262 CL_SHADER = 0x00000822, 263 CL_FOG_EFFECT = 0x70000001, 264 260 265 // GL-GUI 261 266 CL_GLGUI_WIDGET = 0x00500000, -
trunk/src/lib/graphics/effects/fog_effect.cc
r6752 r6772 22 22 #include "factory.h" 23 23 24 #include "glincl.h" 25 26 24 27 25 28 using namespace std; 26 29 27 CREATE_FACTORY(FogEffect, CL_ LIGHT);30 CREATE_FACTORY(FogEffect, CL_FOG_EFFECT); 28 31 29 32 … … 35 38 FogEffect::FogEffect(const TiXmlElement* root) 36 39 { 40 41 this->fogMode = GL_EXP2; 42 this->fogDensity = 0.001f; 43 this->fogStart = 10.0f; 44 this->fogEnd = 1000.0f; 45 37 46 38 47 if (root != NULL) … … 55 64 GraphicsEffect::loadParams(root); 56 65 57 // LoadParam(root, "diffuse-color", this, FogEffect, setDiffuseColor) 58 // .describe("sets the diffuse color of the FogEffect (red [0-1], green [0-1], blue [0-1])"); 66 LoadParam(root, "fog-effect", this, FogEffect, setFogMode) 67 .describe("sets the the fog mode {GL_LINEAR, GL_EXP, GL_EXP2}"); 68 69 LoadParam(root, "fog-density", this, FogEffect, setFogDensity) 70 .describe("sets the the fog density of the exponentionl functions"); 71 72 LoadParam(root, "fog-range", this, FogEffect, setFogRange) 73 .describe("sets the the range of the linear functions"); 59 74 } 60 75 … … 72 87 bool FogEffect::activate() 73 88 { 74 /* glEnable(GL_FOG); 89 PRINTF(4)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f\n", this->fogMode, this->fogDensity, 90 this->fogStart, this->fogEnd); 91 92 glEnable(GL_FOG); 75 93 { 76 GLfloat fogColor[4] = {0.5, 0.5, 1.0};94 GLfloat fogColor[4] = {0.5, 0.5, 0.5, 1.0}; 77 95 78 GLint fogMode = GL_EXP; 79 glFogi(GL_FOG_MODE, fogMode); 96 glFogi(GL_FOG_MODE, this->fogMode); 80 97 glFogfv(GL_FOG_COLOR, fogColor); 81 gfFogf(GL_FOG_DENSITY, 0.35f); 98 glFogf(GL_FOG_DENSITY, this->fogDensity); 99 glHint(GL_FOG_HINT, GL_DONT_CARE); 100 glFogf(GL_FOG_START, this->fogStart); 101 glFogf(GL_FOG_END, this->fogEnd); 82 102 83 84 }*/ 103 //glFogi(GL_FOG_COORDINATE_SOURCE, GL_FOG_COORDINATE); 104 } 105 glClearColor(0.5, 0.5, 0.5, 1.0); 85 106 } 86 107 … … 90 111 */ 91 112 bool FogEffect::deactivate() 92 {} 113 { 114 glDisable(GL_FOG); 115 } 116 117 118 /** 119 * converts a gl mode char to a GLint 120 * @param mode the mode character 121 */ 122 GLint FogEffect::charToFogMode(const char* mode) 123 { 124 if( !strcmp( "GL_LINEAR", mode)) 125 return GL_LINEAR; 126 else if( !strcmp("GL_EXP", mode)) 127 return GL_EXP; 128 else if(!strcmp("GL_EXP2", mode) ) 129 return GL_EXP2; 130 else 131 return -1; 132 } 133 -
trunk/src/lib/graphics/effects/fog_effect.h
r6741 r6772 24 24 virtual bool activate(); 25 25 virtual bool deactivate(); 26 27 void setFogMode(const char* mode) { this->fogMode = this->charToFogMode(mode); } 28 void setFogDensity(float density) { this->fogDensity = density; } 29 void setFogRange(float start, float end) { this->fogStart = start; this->fogEnd = end; } 30 31 32 private: 33 GLint charToFogMode(const char* mode); 34 35 36 private: 37 GLint fogMode; 38 GLfloat fogDensity; 39 GLfloat fogStart; 40 GLfloat fogEnd; 26 41 }; 27 42 -
trunk/src/lib/graphics/effects/graphics_effect.cc
r6741 r6772 13 13 ### File Specific: 14 14 main-programmer: Patrick Boenzli 15 co-programmer: ...16 15 */ 17 16 … … 21 20 #include "graphics_effect.h" 22 21 22 #include "graphics_engine.h" 23 23 #include "load_param.h" 24 24 … … 35 35 GraphicsEffect::GraphicsEffect(const TiXmlElement* root) 36 36 { 37 this->bActivated = false; 38 39 this->bActivated = GraphicsEngine::getInstance()->loadGraphicsEffect(this); 37 40 38 41 if (root != NULL) … … 45 48 */ 46 49 GraphicsEffect::~GraphicsEffect() 47 {} 50 { 51 if( this->bActivated) 52 GraphicsEngine::getInstance()->unloadGraphicsEffect(this); 53 } 48 54 49 55 -
trunk/src/lib/graphics/effects/graphics_effect.h
r6741 r6772 24 24 virtual bool activate() = 0; 25 25 virtual bool deactivate() = 0; 26 27 inline bool isActivated() { return this->bActivated; } 28 29 30 protected: 31 bool bActivated; 26 32 }; 27 33 -
trunk/src/lib/graphics/graphics_engine.cc
r6753 r6772 37 37 38 38 #include "effects/graphics_effect.h" 39 #include "effects/fog_effect.h" 39 40 40 41 #include "shell_command.h" … … 148 149 149 150 this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16); 151 152 GraphicsEffect* fe = new FogEffect(NULL); 153 this->loadGraphicsEffect(fe); 154 fe->activate(); 155 PRINTF(0)("--------------------------------------------------------------\n"); 150 156 } 151 157 -
trunk/src/world_entities/camera.cc
r6426 r6772 178 178 /** 179 179 * initialize rendering perspective according to this camera 180 181 182 183 */180 * 181 * This is called immediately before the rendering cycle starts, it sets all global 182 * rendering options as well as the GL_PROJECTION matrix according to the camera. 183 */ 184 184 void Camera::apply () 185 185 { … … 193 193 this->nearClip, 194 194 this->farClip); 195 196 195 // speed-up feature 197 196 Vector cameraPosition = this->getAbsCoor(); 198 197 Vector targetPosition = this->target->getAbsCoor(); 199 198 Vector up = this->getAbsDirV(); 200 Vector delay = Vector(0, 0,0);201 if( currentMode != VIEW_FRONT) delay = (this->target->getVelocity()) /25;199 Vector delay = Vector(0, 0, 0); 200 if( currentMode != VIEW_FRONT) delay = (this->target->getVelocity()) / 25.0f; 202 201 203 202 // Setting the Camera Eye, lookAt and up Vectors … … 206 205 up.x, up.y, up.z); 207 206 208 // switching back to Modeling Matrix209 207 glMatrixMode (GL_MODELVIEW); 210 // this->target->getParent()->getParent()->debugDraw(0, 2, Vector(1,0,0));208 glLoadIdentity(); 211 209 } 212 210 -
trunk/src/world_entities/skybox.cc
r6695 r6772 225 225 glDisable(GL_LIGHTING); 226 226 227 glPushAttrib(GL_ENABLE_BIT); 228 glDisable(GL_FOG); 229 227 230 WorldEntity::draw(); 228 231 232 glPopAttrib(); 229 233 glPopAttrib(); 230 234
Note: See TracChangeset
for help on using the changeset viewer.