#include "LuciolGenerator.h"

#include <math.h>
#include <stdlib.h>

using namespace ParticleSystem;

LuciolGenerator::LuciolGenerator(float size){
	this->size = size;
	maxGeneration = 9999;
	this->generationDelay = 0.0f;
	this->previousTime = 0.0f;
	loop = true;
}

LuciolGenerator::~LuciolGenerator(void){

}

void LuciolGenerator::generate(ParticleEngine::Particle * particle){
	if (canGenerate()){
		float deltaX = cos((float)rand());
		float deltaY = cos((float)rand());
		float deltaZ = cos((float)rand());
		float scale = cos((float)rand());
		float posScale = scale*(size/2.0f) + (size/2.0f);
		particle->pos[0] = pos[0] + deltaX*posScale;
		particle->pos[1] = pos[1] + (deltaY*posScale);
		particle->pos[2] = pos[2] + deltaZ*posScale;
		particle->direction[0] = cos((float)rand());
		particle->direction[1] = cos((float)rand());
		particle->direction[2] = cos((float)rand());
		particle->maxLife = 20 + fabs(cos((float)rand()))*50;
		particle->life = 0;
		particle->beginCouleur[0] = 0.0f;
		particle->beginCouleur[1] = 0.0f;
		particle->beginCouleur[2] = 0.0f;
		particle->beginCouleur[3] = particle->maxLife-1;
		particle->endCouleur[0] = 3.0f;
		particle->endCouleur[1] = 3.0f;
		particle->endCouleur[2] = 3.0f;
		particle->endCouleur[3] = 0.0f;
		particle->masse = fabs(cos((float)rand()))+0.75f;
		particle->size = fabs(cos((float)rand()))*0.30f + 0.40f;
		generation++;
	}
}

