- Timestamp:
- Dec 19, 2006, 7:24:04 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/effects/trail.cc
r10095 r10102 32 32 33 33 #include "class_id_DEPRECATED.h" 34 35 #define trailAlphaMax 1.0f 36 #define trailAlphaMin 0.2f 34 37 35 38 ObjectListDefinition(Trail); … … 166 169 float radzero, radone; 167 170 168 //glPushAttrib(GL_ENABLE_BIT);171 glPushAttrib(GL_ENABLE_BIT); 169 172 170 173 glPushMatrix(); 171 174 //glMatrixMode(GL_MODELVIEW); 172 175 //glLoadIdentity(); 176 177 glEnable( GL_BLEND); 178 glBlendFunc(GL_SRC_ALPHA,GL_ONE) 179 glDisable( GL_ALPHA_TEST); 180 173 181 glTranslatef(-this->getAbsCoor().x,-this->getAbsCoor().y,-this->getAbsCoor().z); 174 182 glScalef(1,1,1); 175 183 this->material->select(); 176 /* 177 glBegin(GL_TRIANGLESTRIP); 178 for( int i = 0; i < this->sections-1; i++) 179 { 180 rad1 = this->radius * (1.0-i*fact); 181 rad0 = this->radius * (1.0-(i+1)*fact); 184 185 float alphaStep = (trailAlphaMax - trailAlphaMin)/this->sections; 186 187 glBegin(GL_TRIANGLE_STRIP); 188 189 // Alpha goes from 1.0 to 0.4 -> alphastep = .6 / this->sections 190 for( int i = 1; i < this->sections-1; i++) 191 { 192 radone = this->radius * (1.0-i*fact); 193 radzero = this->radius * (1.0-(i+1)*fact); 182 194 183 195 now = this->nodeList[i]; … … 188 200 targ = (this->getAbsCoor() - now).getNormalized(); 189 201 190 // vertical polygon 191 Q[0] = now + Vector(0,rad1,0) ; 192 Q[1] = later + Vector(0,rad0,0) ; 193 Q[2] = later + Vector(0,-rad0,0) ; 194 Q[3] = now + Vector(0,-rad1,0) ; 195 //PRINTF(0)("Debug output: Q0 (%f,%f,%f) :: Q1 (%f,%f,%f) :: Q2 (%f,%f,%f) :: Q3 (%f,%f,%f)\n",Q[0].x,Q[0].y,Q[0].z,Q[1].x,Q[1].y,Q[1].z,Q[2].x,Q[2].y,Q[2].z,Q[3].x,Q[3].y,Q[3].z); 196 197 glTexCoord2f(0.0f, 0.0f); glVertex3f(Q[0].x,Q[0].y,Q[0].z); 198 glTexCoord2f(0.0f, 1.0f); glVertex3f(Q[1].x,Q[1].y,Q[1].z); 199 glTexCoord2f(1.0f, 1.0f); glVertex3f(Q[2].x,Q[2].y,Q[2].z); 200 glTexCoord2f(1.0f, 0.0f); glVertex3f(Q[3].x,Q[3].y,Q[3].z); 202 // horizontal polygon 203 Q[0] = now + Vector(0,radone,0) ; 204 Q[3] = now + Vector(0,-radone,0) ; 201 205 202 } 203 glEnd(); 204 glBegin(GL_TRIANGLESTRIP); 205 for( int i = 0; i < this->sections-1; i++) 206 { 207 rad1 = this->radius * (1.0-i*fact); 208 rad0 = this->radius * (1.0-(i+1)*fact); 206 glTexCoord2f(0.0f, 0.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[0].x,Q[0].y,Q[0].z); 207 glTexCoord2f(1.0f, 0.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[3].x,Q[3].y,Q[3].z); 208 209 if( i == this->sections - 1) 210 { 211 212 Q[1] = later + Vector(0,radzero,0) ; 213 Q[2] = later + Vector(0,-radzero,0) ; 214 glTexCoord2f(0.0f, 1.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[1].x,Q[1].y,Q[1].z); 215 glTexCoord2f(1.0f, 1.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[2].x,Q[2].y,Q[2].z); 216 } 217 218 219 } 220 glEnd(); 221 glBegin(GL_TRIANGLE_STRIP); 222 for( int i = this->sections-1; i > 0; i--) 223 { 224 radone = this->radius * (1.0-i*fact); 225 radzero = this->radius * (1.0-(i-1)*fact); 226 227 now = this->nodeList[i]; 228 later = this->nodeList[i-1]; 229 if( i == 0) 230 targ = this->getAbsDir().apply(Vector(1,0,0)).getNormalized(); 231 else 232 targ = (this->getAbsCoor() - now).getNormalized(); 233 234 // horizontal polygon 235 Q[0] = now + Vector(0,radone,0) ; 236 Q[3] = now + Vector(0,-radone,0) ; 237 238 glTexCoord2f(1.0f, 0.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[3].x,Q[3].y,Q[3].z+0.01f); 239 glTexCoord2f(0.0f, 0.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[0].x,Q[0].y,Q[0].z+0.01f); 240 241 if( i == 1) 242 { 243 Q[1] = later + Vector(0,radzero,0) ; 244 Q[2] = later + Vector(0,-radzero,0) ; 245 glTexCoord2f(1.0f, 1.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[2].x,Q[2].y,Q[2].z+0.01f); 246 glTexCoord2f(0.0f, 1.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[1].x,Q[1].y,Q[1].z+0.01f); 247 } 248 249 } 250 glEnd(); 251 252 253 glBegin(GL_TRIANGLE_STRIP); 254 for( int i = 1; i < this->sections-1; i++) 255 { 256 radone = this->radius * (1.0-i*fact); 257 radzero = this->radius * (1.0-(i+1)*fact); 209 258 210 259 now = this->nodeList[i]; … … 215 264 targ = (this->getAbsCoor() - now).getNormalized(); 216 265 217 // vertical polygon 218 Q[0] = now + Vector(0,rad1,0) ; 219 Q[1] = later + Vector(0,rad0,0) ; 220 Q[2] = later + Vector(0,-rad0,0) ; 221 Q[3] = now + Vector(0,-rad1,0) ; 222 //PRINTF(0)("Debug output: Q0 (%f,%f,%f) :: Q1 (%f,%f,%f) :: Q2 (%f,%f,%f) :: Q3 (%f,%f,%f)\n",Q[0].x,Q[0].y,Q[0].z,Q[1].x,Q[1].y,Q[1].z,Q[2].x,Q[2].y,Q[2].z,Q[3].x,Q[3].y,Q[3].z); 223 224 glTexCoord2f(0.0f, 0.0f); glVertex3f(Q[0].x,Q[0].y,Q[0].z); 225 glTexCoord2f(1.0f, 1.0f); glVertex3f(Q[2].x,Q[2].y,Q[2].z); 226 glTexCoord2f(0.0f, 1.0f); glVertex3f(Q[1].x,Q[1].y,Q[1].z); 227 glTexCoord2f(1.0f, 0.0f); glVertex3f(Q[3].x,Q[3].y,Q[3].z); 266 // horizontal polygon 267 Q[0] = now + targ.cross(Vector(0,radone,0)) ; 268 Q[3] = now + targ.cross(Vector(0,-radone,0)) ; 228 269 229 } 230 glEnd();*/ 231 glBegin(GL_TRIANGLE_STRIP); 232 for( int i = 1; i < this->sections-1; i++) 233 { 234 radone = this->radius * (1.0-i*fact); 235 radzero = this->radius * (1.0-(i+1)*fact); 236 237 now = this->nodeList[i]; 238 later = this->nodeList[i+1]; 239 if( i == 0) 240 targ = this->getAbsDir().apply(Vector(1,0,0)).getNormalized(); 241 else 242 targ = (this->getAbsCoor() - now).getNormalized(); 243 244 // horizontal polygon 245 Q[0] = now + Vector(0,radone,0) ; 246 Q[3] = now + Vector(0,-radone,0) ; 247 248 glTexCoord2f(0.0f, 0.0f); glVertex3f(Q[0].x,Q[0].y,Q[0].z); 249 glTexCoord2f(1.0f, 0.0f); glVertex3f(Q[3].x,Q[3].y,Q[3].z); 250 251 if( i == this->sections - 1) 270 glTexCoord2f(0.0f, 0.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[0].x,Q[0].y,Q[0].z); 271 glTexCoord2f(1.0f, 0.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[3].x,Q[3].y,Q[3].z); 272 273 if( i == this->sections-1) 252 274 { 253 254 Q[1] = later + Vector(0,radzero,0) ; 255 Q[2] = later + Vector(0,-radzero,0) ; 256 glTexCoord2f(0.0f, 1.0f); glVertex3f(Q[1].x,Q[1].y,Q[1].z); 257 glTexCoord2f(1.0f, 1.0f); glVertex3f(Q[2].x,Q[2].y,Q[2].z); 275 Q[1] = later + targ.cross(Vector(0,radzero,0)) ; 276 Q[2] = later + targ.cross(Vector(0,-radzero,0)) ; 277 glTexCoord2f(0.0f, 1.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[1].x,Q[1].y,Q[1].z); 278 glTexCoord2f(1.0f, 1.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[2].x,Q[2].y,Q[2].z); 258 279 } 259 280 … … 275 296 276 297 // horizontal polygon 277 Q[0] = now + Vector(0,radone,0) ;278 Q[3] = now + Vector(0,-radone,0) ;279 280 glTexCoord2f(1.0f, 0.0f); glVertex3f(Q[3].x,Q[3].y,Q[3].z+0.0001f);281 glTexCoord2f(0.0f, 0.0f); glVertex3f(Q[0].x,Q[0].y,Q[0].z+0.0001f);282 283 if( i == 1)284 {285 Q[1] = later + Vector(0,radzero,0) ;286 Q[2] = later + Vector(0,-radzero,0) ;287 glTexCoord2f(1.0f, 1.0f); glVertex3f(Q[2].x,Q[2].y,Q[2].z+0.0001f);288 glTexCoord2f(0.0f, 1.0f); glVertex3f(Q[1].x,Q[1].y,Q[1].z+0.0001f);289 }290 291 }292 glEnd();293 294 295 glBegin(GL_TRIANGLE_STRIP);296 for( int i = 1; i < this->sections-1; i++)297 {298 radone = this->radius * (1.0-i*fact);299 radzero = this->radius * (1.0-(i+1)*fact);300 301 now = this->nodeList[i];302 later = this->nodeList[i+1];303 if( i == 0)304 targ = this->getAbsDir().apply(Vector(1,0,0)).getNormalized();305 else306 targ = (this->getAbsCoor() - now).getNormalized();307 308 // horizontal polygon309 298 Q[0] = now + targ.cross(Vector(0,radone,0)) ; 310 299 Q[3] = now + targ.cross(Vector(0,-radone,0)) ; 311 312 glTexCoord2f(0.0f, 0.0f); glVertex3f(Q[0].x,Q[0].y,Q[0].z); 313 glTexCoord2f(1.0f, 0.0f); glVertex3f(Q[3].x,Q[3].y,Q[3].z); 314 315 if( i == this->sections-1) 316 { 317 Q[1] = later + targ.cross(Vector(0,radzero,0)) ; 318 Q[2] = later + targ.cross(Vector(0,-radzero,0)) ; 319 glTexCoord2f(0.0f, 1.0f); glVertex3f(Q[1].x,Q[1].y,Q[1].z); 320 glTexCoord2f(1.0f, 1.0f); glVertex3f(Q[2].x,Q[2].y,Q[2].z); 321 } 322 323 324 } 325 glEnd(); 326 glBegin(GL_TRIANGLE_STRIP); 327 for( int i = this->sections-1; i > 0; i--) 328 { 329 radone = this->radius * (1.0-i*fact); 330 radzero = this->radius * (1.0-(i-1)*fact); 331 332 now = this->nodeList[i]; 333 later = this->nodeList[i-1]; 334 if( i == 0) 335 targ = this->getAbsDir().apply(Vector(1,0,0)).getNormalized(); 336 else 337 targ = (this->getAbsCoor() - now).getNormalized(); 338 339 // horizontal polygon 340 Q[0] = now + targ.cross(Vector(0,radone,0)) ; 341 Q[3] = now + targ.cross(Vector(0,-radone,0)) ; 342 343 glTexCoord2f(0.0f, 0.0f); glVertex3f(Q[0].x+0.0001f,Q[0].y,Q[0].z); 344 glTexCoord2f(1.0f, 0.0f); glVertex3f(Q[3].x+0.0001f,Q[3].y,Q[3].z); 300 301 glTexCoord2f(0.0f, 0.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[0].x+0.01f,Q[0].y,Q[0].z); 302 glTexCoord2f(1.0f, 0.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[3].x+0.01f,Q[3].y,Q[3].z); 345 303 346 304 if( i == 1) … … 348 306 Q[1] = later + targ.cross(Vector(0,radzero,0)) ; 349 307 Q[2] = later + targ.cross(Vector(0,-radzero,0)) ; 350 glTexCoord2f(0.0f, 1.0f); gl Vertex3f(Q[1].x+0.0001f,Q[1].y,Q[1].z);351 glTexCoord2f(1.0f, 1.0f); gl Vertex3f(Q[2].x+0.0001f,Q[2].y,Q[2].z);308 glTexCoord2f(0.0f, 1.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[1].x+0.01f,Q[1].y,Q[1].z); 309 glTexCoord2f(1.0f, 1.0f); glColor4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[2].x+0.01f,Q[2].y,Q[2].z); 352 310 } 353 311 … … 357 315 358 316 glPopMatrix(); 359 //glPopAttrib();317 glPopAttrib(); 360 318 /* 361 319 //glTranslatef(this->getAbsCoor().x, this->getAbsCoor().y, this->getAbsCoor().z); -
branches/playability/src/world_entities/world_entity.h
r10101 r10102 24 24 // FORWARD DECLARATION 25 25 namespace OrxSound { class SoundBuffer; class SoundSource; } 26 namespace OrxGui { class GLGuiWidget; class GLGuiBar; class GLGuiEnergyWidget; };26 namespace OrxGui { class GLGuiWidget; class GLGuiBar; class GLGuiEnergyWidget; class GLGuiEnergyWidgetVertical; }; 27 27 28 28 class BVTree;
Note: See TracChangeset
for help on using the changeset viewer.