-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathParticle.h
More file actions
94 lines (71 loc) · 2.53 KB
/
Particle.h
File metadata and controls
94 lines (71 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef __PARTICLE_H__
#define __PARTICLE_H__
#include <iostream>
//#include "/apps/sidefx/hfs12.5.436/toolkit/include/OpenEXR/ImathVec.h" //for work env
//#include "/opt/hfs12.5.449/toolkit/include/OpenEXR/ImathVec.h" //for home env
#include "ofMain.h"
#include "Utility.h"
using std::cin ;
using std::cout ;
using std::endl ;
//using namespace IMATH_INTERNAL_NAMESPACE ;
class Particle
{
public:
protected:
int ptnum ;
ofVec3f position ;
ofVec3f velocity ;
ofVec3f forces ;
float mass ;
float radius ;
ofColor color ;
// float life ;
// float maxLife ;
// float lifeVariance ;
/*---------------OP OVERLOADS---------------------------*/
public:
void operator = (const Particle &other) ;
//////////////////////////////////////////////////////////
public:
Particle();
~Particle();
//COPY INITIALIZER
Particle(const Particle &other) ;
//setting variance using particle constructors..
//this will clean up the code for emitters and reduce redundant code..
Particle(int _ptnum, const ofVec3f &pos, const ofVec3f &initialVel, float xvelVar, float yvelVar, float zvelVar, float _mass, float massVar) ;
Particle(int _ptnum, float xpos, float ypos, float zpos, float xvel, float yvel, float zvel, float xvelVar, float yvelVar, float zvelVar, float _mass, float massVar) ;
int getPtnum() const ;
void setPtnum(int _ptnum) ;
/*-------POSITION------------------------------------*/
ofVec3f& getPosition() ;
//setters for position field
void setPosition(const ofVec3f &pos) ;
void setPosition(float x, float y, float z) ;
///////////////////////////////////////////////////////
/*------VELOCITY--------------------------------------*/
ofVec3f& getVelocity() ;
//setters for velocity field
void setVelocity(const ofVec3f &vel) ;
void setVelocity(float x, float y, float z) ;
///////////////////////////////////////////////////////
/*------FORCES---------------------------------------*/
//so getters as force is used internally.
//However we will use setters to add forces into the
//system
void addForce(const ofVec3f &force) ;
void addForce(float x, float y, float z) ;
///////////////////////////////////////////////////////
/*--------COLOR--------------------------------------*/
void setColor(const ofColor &_color) ;
//for setting colors using vectors like vel etc
void setColor(const ofVec3f &_color) ;
void setColor(float r, float g, float b) ;
ofColor& getColor() ;
//////////////////////////////////////////////////////
void update(float timeStep) ;
void update(float timeStep, float maxSpeed) ;
void draw() ;
};
#endif