Changeset 10107 in orxonox.OLD for branches/playability/src/world_entities
- Timestamp:
- Dec 19, 2006, 10:03:19 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/Makefile.am
r10101 r10107 11 11 extendable.cc power_ups/power_up.cc power_ups/param_power_up.cc \ 12 12 power_ups/weapon_power_up.cc spawning_point.cc effects/explosion.cc effects/billboard.cc \ 13 effects/trail.cc elements/glgui_energywidget.cc glgui_energywidget.cc13 effects/trail.cc elements/glgui_energywidget.cc elements/glgui_energywidgetvertical.cc 14 14 15 15 … … 19 19 power_ups/power_up.h power_ups/param_power_up.h power_ups/weapon_power_up.h \ 20 20 spawning_point.h effects/explosion.h effects/billboard.h effects/trail.h \ 21 elements/glgui_energywidget.h glgui_energywidget.h21 elements/glgui_energywidget.h elements/glgui_energywidgetvertical.h 22 22 23 23 -
branches/playability/src/world_entities/effects/trail.cc
r10104 r10107 174 174 //glMatrixMode(GL_MODELVIEW); 175 175 //glLoadIdentity(); 176 177 glEnable( 176 /* 177 glEnable(GL_BLEND); 178 178 glBlendFunc(GL_SRC_ALPHA,GL_ONE); 179 glDisable( GL_ALPHA_TEST); 179 glDisable( GL_ALPHA_TEST);*/ 180 180 181 181 glTranslatef(-this->getAbsCoor().x,-this->getAbsCoor().y,-this->getAbsCoor().z); … … 183 183 this->material->select(); 184 184 185 float alphaStep = (trailAlphaMax - trailAlphaMin)/this->sections;185 //float alphaStep = 1.0 / this->sections; 186 186 187 187 glBegin(GL_TRIANGLE_STRIP); … … 190 190 for( int i = 1; i < this->sections-1; i++) 191 191 { 192 radone = this->radius * (1.0-i*fact );193 radzero = this->radius * (1.0-(i+1)*fact );192 radone = this->radius * (1.0-i*fact + 0.2 * (float)rand()/(float)RAND_MAX); 193 radzero = this->radius * (1.0-(i+1)*fact + 0.2 * (float)rand()/(float)RAND_MAX); 194 194 195 195 now = this->nodeList[i]; … … 204 204 Q[3] = now + Vector(0,-radone,0) ; 205 205 206 glTexCoord2f(0.0f, 0.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[0].x,Q[0].y,Q[0].z);207 glTexCoord2f(1.0f, 0.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[3].x,Q[3].y,Q[3].z);206 glTexCoord2f(0.0f, 0.0f); glVertex3f(Q[0].x,Q[0].y,Q[0].z); 207 glTexCoord2f(1.0f, 0.0f); glVertex3f(Q[3].x,Q[3].y,Q[3].z); 208 208 209 209 if( i == this->sections - 1) … … 212 212 Q[1] = later + Vector(0,radzero,0) ; 213 213 Q[2] = later + Vector(0,-radzero,0) ; 214 glTexCoord2f(0.0f, 1.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[1].x,Q[1].y,Q[1].z);215 glTexCoord2f(1.0f, 1.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[2].x,Q[2].y,Q[2].z);214 glTexCoord2f(0.0f, 1.0f); glVertex3f(Q[1].x,Q[1].y,Q[1].z); 215 glTexCoord2f(1.0f, 1.0f); glVertex3f(Q[2].x,Q[2].y,Q[2].z); 216 216 } 217 217 … … 222 222 for( int i = this->sections-1; i > 0; i--) 223 223 { 224 radone = this->radius * (1.0-i*fact );225 radzero = this->radius * (1.0-(i-1)*fact );224 radone = this->radius * (1.0-i*fact + 0.2 * (float)rand()/(float)RAND_MAX); 225 radzero = this->radius * (1.0-(i-1)*fact + 0.2 * (float)rand()/(float)RAND_MAX); 226 226 227 227 now = this->nodeList[i]; … … 236 236 Q[3] = now + Vector(0,-radone,0) ; 237 237 238 glTexCoord2f(1.0f, 0.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[3].x,Q[3].y,Q[3].z+0.01f);239 glTexCoord2f(0.0f, 0.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[0].x,Q[0].y,Q[0].z+0.01f);238 glTexCoord2f(1.0f, 0.0f); glVertex3f(Q[3].x,Q[3].y,Q[3].z+0.01f); 239 glTexCoord2f(0.0f, 0.0f); glVertex3f(Q[0].x,Q[0].y,Q[0].z+0.01f); 240 240 241 241 if( i == 1) … … 243 243 Q[1] = later + Vector(0,radzero,0) ; 244 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); 245 246 glTexCoord2f(1.0f, 1.0f); glVertex3f(Q[2].x,Q[2].y,Q[2].z+0.01f); 247 glTexCoord2f(0.0f, 1.0f); glVertex3f(Q[1].x,Q[1].y,Q[1].z+0.01f); 247 248 } 248 249 … … 254 255 for( int i = 1; i < this->sections-1; i++) 255 256 { 256 radone = this->radius * (1.0-i*fact );257 radzero = this->radius * (1.0-(i+1)*fact );257 radone = this->radius * (1.0-i*fact + 0.2 * (float)rand()/(float)RAND_MAX); 258 radzero = this->radius * (1.0-(i+1)*fact + 0.2 * (float)rand()/(float)RAND_MAX); 258 259 259 260 now = this->nodeList[i]; … … 268 269 Q[3] = now + targ.cross(Vector(0,-radone,0)) ; 269 270 270 glTexCoord2f(0.0f, 0.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[0].x,Q[0].y,Q[0].z);271 glTexCoord2f(1.0f, 0.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[3].x,Q[3].y,Q[3].z);271 glTexCoord2f(0.0f, 0.0f); glVertex3f(Q[0].x,Q[0].y,Q[0].z); 272 glTexCoord2f(1.0f, 0.0f); glVertex3f(Q[3].x,Q[3].y,Q[3].z); 272 273 273 274 if( i == this->sections-1) … … 275 276 Q[1] = later + targ.cross(Vector(0,radzero,0)) ; 276 277 Q[2] = later + targ.cross(Vector(0,-radzero,0)) ; 277 glTexCoord2f(0.0f, 1.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[1].x,Q[1].y,Q[1].z);278 glTexCoord2f(1.0f, 1.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[2].x,Q[2].y,Q[2].z);278 glTexCoord2f(0.0f, 1.0f); glVertex3f(Q[1].x,Q[1].y,Q[1].z); 279 glTexCoord2f(1.0f, 1.0f); glVertex3f(Q[2].x,Q[2].y,Q[2].z); 279 280 } 280 281 … … 285 286 for( int i = this->sections-1; i > 0; i--) 286 287 { 287 radone = this->radius * (1.0-i*fact );288 radzero = this->radius * (1.0-(i-1)*fact );288 radone = this->radius * (1.0-i*fact + 0.2 * (float)rand()/(float)RAND_MAX); 289 radzero = this->radius * (1.0-(i-1)*fact + 0.2 * (float)rand()/(float)RAND_MAX); 289 290 290 291 now = this->nodeList[i]; … … 299 300 Q[3] = now + targ.cross(Vector(0,-radone,0)) ; 300 301 301 glTexCoord2f(0.0f, 0.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[0].x+0.01f,Q[0].y,Q[0].z);302 glTexCoord2f(1.0f, 0.0f); gl Color4f(1,1,1, trailAlphaMax - i * alphaStep); glVertex3f(Q[3].x+0.01f,Q[3].y,Q[3].z);302 glTexCoord2f(0.0f, 0.0f); glVertex3f(Q[0].x+0.01f,Q[0].y,Q[0].z); 303 glTexCoord2f(1.0f, 0.0f); glVertex3f(Q[3].x+0.01f,Q[3].y,Q[3].z); 303 304 304 305 if( i == 1) … … 306 307 Q[1] = later + targ.cross(Vector(0,radzero,0)) ; 307 308 Q[2] = later + targ.cross(Vector(0,-radzero,0)) ; 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); 309 310 glTexCoord2f(0.0f, 1.0f); glVertex3f(Q[1].x+0.01f,Q[1].y,Q[1].z); 311 glTexCoord2f(1.0f, 1.0f); glVertex3f(Q[2].x+0.01f,Q[2].y,Q[2].z); 310 312 } 311 313 … … 316 318 glPopMatrix(); 317 319 glPopAttrib(); 318 /* 319 //glTranslatef(this->getAbsCoor().x, this->getAbsCoor().y, this->getAbsCoor().z); 320 //glTranslatef(0,0,0); 321 322 const PNode* camera = State::getCameraNode(); //!< @todo MUST be different 323 Vector cameraPos = camera->getAbsCoor(); 324 Vector cameraTargetPos = State::getCameraTargetNode()->getAbsCoor(); 325 Vector view = cameraTargetPos - cameraPos; 326 Vector up = Vector(0, 1, 0); 327 up = camera->getAbsDir().apply(up); 328 Vector h = up.cross(view); 329 Vector v = h.cross(view); 330 h.normalize(); 331 v.normalize(); 332 333 v *= sizeX; 334 h *= sizeY; 335 336 //v += this->getAbsCoor(); 337 //PRINTF(0)("sizeX: %f sizeY: %f\n", sizeX, sizeY); 338 glBegin(GL_QUADS); 339 glTexCoord2f(0.0f, 0.0f); 340 glVertex3f(this->getAbsCoor().x - h.x - v.x, 341 this->getAbsCoor().y - h.y - v.y, 342 this->getAbsCoor().z - h.z - v.z); 343 glTexCoord2f(1.0f, 0.0f); 344 glVertex3f( this->getAbsCoor().x + h.x - v.x, 345 this->getAbsCoor().y + h.y - v.y, 346 this->getAbsCoor().z + h.z - v.z); 347 glTexCoord2f(1.0f, 1.0f); 348 glVertex3f(this->getAbsCoor().x + h.x + v.x, 349 this->getAbsCoor().y + h.y + v.y, 350 this->getAbsCoor().z + h.z + v.z); 351 glTexCoord2f(0.0f, 1.0f); 352 glVertex3f(this->getAbsCoor().x - h.x + v.x, 353 this->getAbsCoor().y - h.y + v.y, 354 this->getAbsCoor().z - h.z + v.z); 355 glEnd(); 356 357 358 glPopMatrix(); 359 360 glPopAttrib();*/ 361 } 320 } -
branches/playability/src/world_entities/particles/emitter_node.cc
r10098 r10107 21 21 22 22 #include "util/loading/load_param.h" 23 #include "util/loading/factory.h" 23 24 #include "debug.h" 24 25 25 26 ObjectListDefinition(EmitterNode); 27 //CREATE_FAST_FACTORY(EmitterNode); 26 28 27 29 /** … … 32 34 this->registerObject(this, EmitterNode::_objectList); 33 35 36 this->toList(OM_DEAD_TICK); 37 34 38 this->system = NULL; 35 39 this->emitter = NULL; 36 40 this->lifeCycle = 0.0; 37 41 this->lifeSpan = lifetime; 42 43 this->setParent( PNode::getNullParent()); 38 44 } 39 45 … … 64 70 { 65 71 this->started = true; 72 73 this->emitter->start(); 74 this->emitter->setSystem( this->system); 75 66 76 return this->started; 67 77 } … … 69 79 void EmitterNode::tick(float dt) 70 80 { 81 71 82 if( !this->started) 72 83 return; 73 84 74 85 this->lifeCycle += dt/this->lifeSpan; 75 if (this->lifeCycle >= 1) 86 87 if( this->lifeCycle >= 1.0f) 76 88 { 77 89 this->removeNode(); 78 this->hide();79 this->system->removeEmitter(this->emitter);80 90 this->emitter->stop(); 81 91 this->emitter->setSystem(NULL); 82 92 this->started = false; 93 94 this->destroy( NULL ); 83 95 } 84 PRINTF(0)("Coordinate Update EmitterNode: (%f,%f,%f) -> (%f,%f,%f)\n",this->getAbsCoor().x,this->getAbsCoor().y,this->getAbsCoor().z,this->velocity.x,this->velocity.y,this->velocity.z); 85 this->setAbsCoor(this->getAbsCoor() + (this->velocity * dt)); 96 this->shiftCoor(this->velocity * dt); 86 97 } -
branches/playability/src/world_entities/particles/emitter_node.h
r10098 r10107 1 1 /*! 2 * @file particle_emitter.h2 * @file emitter_node.h 3 3 * Definition of a EmitterNode 4 4 * An emitter node is a node that takes an emitter and a particle system and keeps them alive for a given amount of time. … … 32 32 inline void setVelocity(Vector velocity) { this->velocity = velocity;}; 33 33 34 inline void setupParticle(DotEmitter* emitter, ParticleSystem* system) { this->emitter = emitter; this-> system = system; this->system->setLifeSpan(this->lifeSpan);} ;34 inline void setupParticle(DotEmitter* emitter, ParticleSystem* system) { this->emitter = emitter; this->emitter->setParent( this); this->system = system;} ; 35 35 void setLifetime( float lifeTime) { this->lifeSpan = lifeTime;}; 36 36 -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10099 r10107 585 585 void SpaceShip::destroy( WorldEntity* killer ) 586 586 { 587 PRINTF( 0)("spaceship destroy\n");587 PRINTF(5)("spaceship destroy\n"); 588 588 589 589 EmitterNode* node = NULL; … … 591 591 SpriteParticles* explosionParticles = NULL; 592 592 593 explosionParticles = new SpriteParticles( 100);594 explosionParticles->setName(" MBoltExplosionParticles");595 explosionParticles->setLifeSpan(. 5, .3);593 explosionParticles = new SpriteParticles(200); 594 explosionParticles->setName("SpaceShipExplosionParticles"); 595 explosionParticles->setLifeSpan(.2, .3); 596 596 explosionParticles->setRadius(0.0, 10.0); 597 597 explosionParticles->setRadius(.5, 6.0); … … 600 600 explosionParticles->setColor(0.1, 1,1,0,.9); 601 601 explosionParticles->setColor(0.5, .8,.4,0,.5); 602 explosionParticles->setColor(1.0, .2,.2,.2,. 0);603 604 605 emitter = new DotEmitter( 200 , 200, M_2_PI);606 emitter->setSpread( 0, M_2_PI);607 emitter->setEmissionRate( 400.0);602 explosionParticles->setColor(1.0, .2,.2,.2,.5); 603 604 605 emitter = new DotEmitter( 2000, 70, 360); 606 //emitter->setSpread( 0, M_2_PI); 607 emitter->setEmissionRate( 200.0); 608 608 //emitter->setEmissionVelocity( 200.0); 609 emitter->setSystem( explosionParticles);610 emitter->setAbsCoor( this->getAbsCoor());611 612 node = new EmitterNode( 1);609 //emitter->setSystem( explosionParticles); 610 //emitter->setAbsCoor( this->getAbsCoor()); 611 612 node = new EmitterNode( .1f); 613 613 node->setupParticle( emitter, explosionParticles); 614 node->setVelocity( this->getParent()->getVelocity()); 614 node->setAbsDir( this->getAbsDir()); 615 node->setVelocity( this->getVelocity() * .9f); 615 616 node->setAbsCoor( this->getAbsCoor()); 616 node->start(); 617 if( !node->start()) 618 PRINTF(0)("Explosion node not correctly started!"); 619 617 620 /* 618 621 PNode* node = new PNode(); … … 621 624 explosion->explode( node, Vector(5,5,5)); 622 625 */ 623 this->setAbsCoor(Vector(-10000,10000,10000)); 624 //this->hide(); 625 626 this->toList( OM_DEAD); 627 PRINTF(0)("spaceship destroy == ship translated \n"); 626 627 if( this->hasPlayer()) 628 { 629 this->setAbsCoor(Vector(-10000,10000,10000)); 630 this->hide(); 631 } 632 else 633 { 634 this->setAbsCoor( this->getAbsCoor() + Vector(150,0,0) + Vector(1,0,0) * VECTOR_RAND(50).dot(Vector(1,0,0))); 635 } 636 628 637 } 629 638 630 639 void SpaceShip::respawn( ) 631 640 { 632 //this->unhide();641 this->unhide(); 633 642 /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 634 643 { -
branches/playability/src/world_entities/weapons/swarm_launcher.cc
r10104 r10107 145 145 void SwarmLauncher::fire() 146 146 { 147 bool fired = false; 148 147 149 Projectile* pj = NULL; 148 150 for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++) … … 153 155 if (pj == NULL) 154 156 return; 155 157 158 fired = true; 156 159 pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*115.0 + VECTOR_RAND(10))); 157 160 … … 164 167 } 165 168 } 169 if( !fired) 170 this->increaseEnergy( this->getProjectile()->getMinEnergy()); 166 171 } -
branches/playability/src/world_entities/world_entity.h
r10102 r10107 148 148 void increaseHealthMax(float increaseHealth); 149 149 OrxGui::GLGuiWidget* getHealthWidget(); 150 bool hasHealthWidget() const { return this->healthWidget ; };150 bool hasHealthWidget() const { return this->healthWidget != NULL; }; 151 151 152 152 virtual void varChangeHandler( std::list<int> & id );
Note: See TracChangeset
for help on using the changeset viewer.