summaryrefslogtreecommitdiff
path: root/Runtime/Filters/Particles/ParticleStruct.h
blob: cafd2dce4ece3c5811c8989f1f789aaec00abb62 (plain)
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
#ifndef PARTICLESTRUCT_H
#define PARTICLESTRUCT_H

#include "Runtime/Math/Vector3.h"
#include "Runtime/Math/Color.h"
#include "Runtime/Geometry/AABB.h"
#if UNITY_WII
#include "Runtime/Misc/Allocator.h"
#endif

struct Particle
{
	Vector3f		position;			//12
	Vector3f		velocity;			//12
	float			size;				//4
	float			rotation;			//4
	float			angularVelocity;	//4	
	float			energy;				//4
	float			startEnergy;		//4
	ColorRGBA32		color;				//4
};

struct SimpleParticle
{
	Vector3f		position;
	Vector3f		velocity;
	float			size;
	float			rotation;
	float			angularVelocity;
	float			energy;
	float			startEnergy;
	ColorRGBAf		color;
};


// 24 bytes
typedef UNITY_VECTOR(kMemParticles, Particle) ParticleArray;

struct PrivateParticleInfo
{
	MinMaxAABB		aabb;
	float			maxEmitterParticleSize;// Maximum size of any particle of emitted particles
	float			maxParticleSize;// max particle size of any particle after particle animation is done
	float			maxEnergy;
	bool			useWorldSpace;
	bool			hadEverEmitOn; // had "emit" flag ever set?
	bool			isEmitOn; // is "emit" flag currently set?
};


const float kTimeEpsilon = 0.001f;

inline void KillParticle (ParticleArray& array, int i)
{
	array[i] = array.back ();
	array.pop_back ();
}

#endif