Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

StrikeParticle.cpp

Go to the documentation of this file.
00001 
00006 #include "StrikeParticle.h"
00007 
00008 using namespace GraphicsLib;
00009 using namespace ParticleSystems;
00010 
00011 
00012 StrikeParticle::StrikeParticle(int sysId, Solver *sol) : Particle(sysId,sol) {
00013         old_Position = position;
00014 }
00015 
00016 StrikeParticle::StrikeParticle( int sysId, 
00017                                                         Solver *sol, 
00018                                                         Point3 pos, 
00019                                                         Vector vel, 
00020                                                         Colour c, 
00021                                                         Colour fc,
00022                                                         GLfloat s,
00023                                                         GLfloat fs, 
00024                                                         GLfloat ml) : Particle(sysId, sol, pos, vel, c,fc,s ,fs ,ml) {
00025         old_Position = position;
00026         
00027 }
00028 
00029 void StrikeParticle::draw(void) {
00030    
00031         glPushMatrix();
00032                 // define the particles colour
00033                 colour.Use();
00034                 //draw the strike
00035                 glBegin(GL_LINES);
00036                         glVertex3f(old_Position.x,old_Position.y,old_Position.z);
00037                         glVertex3f(position.x,position.y,position.z);
00038                 glEnd();
00039         glPopMatrix();
00040 }
00041 
00042 void StrikeParticle::update(void) {
00043 
00044         Vector *tmp = &velocity;
00045         solv->nextStep(tmp);
00046         #ifdef __COLLISION__
00047             std::cout << "In particle " << position<< std::endl;
00048         #endif
00049         //need the old_position updated first
00050         old_Position = position;
00051         position+=velocity;
00052         size -= flare_size;
00053         colour = colour - faded_colour;
00054         life+=1.0;
00055         if(life>MAXLIFE) {
00056                 dead = true;
00057         }
00058         #ifdef __COLLISION__
00059             std::cout << "In particle new" << position<< std::endl;
00060         #endif
00061 }
00062 
00063 bool StrikeParticle::isDead() {
00064         return dead;
00065 }
00066 
00067 
00068 StrikeParticle::~StrikeParticle() {
00069 
00070 }

Generated on Thu Mar 24 11:05:02 2005 for ParticleSystem by  doxygen 1.4.1