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

PointParticle.cpp

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

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