//
//  NSGLParticleEngine.h
//  CocoaGL
//
//  Created by Katherine Tattersall on Thu Aug 08 2002.
//  Copyright (c) 2001 ZeroByZero. All rights reserved.
//

#import <Foundation/Foundation.h>
#import  <Cocoa/Cocoa.h>
#import  <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <OpenGL/glext.h>

#import "loadfunctions.h"

#define MAXPARTICLES 1000
#define PI           3.14

typedef struct _particle
{
        float location[3];
        float color[4]   ;	float color_vector[4];
        float velocity[3] ;
        float size;		float size_vector;
        float ttl;
} particles;

enum flags { CREATE, UPDATE, UPDATE_AND_CREATE };
enum change { COS=1, SIN, ADD, SUB, MULT, DIV };

@interface NSGLParticleEngine : NSObject {

    particles particle[MAXPARTICLES];
    int       numParticles;
    
    GLuint    texture;
    
    float particlesPerSecond;
    float emissionResidue;

    float start_color[4];	float dest_color[4];	float color_variance[4];
    float location[3];		float velocity[3]; 	float location_variance[4];
    float gravity[3];
    float start_size;		float dest_size;	float size_variance;
    
    float spin;			float rotation;
    float usevel[3];
    
    float angle;
    
    float ttl;
    
    double lastupdate;
}

- (id)   initWithFile: (NSString *) filename;
- (void) dealloc;

- (void) readFile: (NSString *) nsPath;
- (void) draw;

- (void) reduceParticles;
- (void) increaseParticles;
- (int)  numParticles;

- (void) initParticle: (int)i;
- (void) updateParticle: (int)i deltaT: (double)timecount;

- (void) updateEngineWithFlag: (int) f;

@end

