-
Notifications
You must be signed in to change notification settings - Fork 0
/
particleSystem.cpp
123 lines (85 loc) · 1.93 KB
/
particleSystem.cpp
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#pragma warning(disable : 4786)
#include "particleSystem.h"
#include "modelerui.h"
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cmath>
//#include <limits>
using namespace std;
static float prevT;
/***************
* Constructors
***************/
ParticleSystem::ParticleSystem()
{
// YOUR CODE HERE
// Leave these here; the UI needs them to work correctly.
dirty = false;
simulate = false;
}
/*************
* Destructor
*************/
ParticleSystem::~ParticleSystem()
{
// TODO
}
/******************
* Simulation fxns
******************/
/** Start the simulation */
void ParticleSystem::startSimulation(float t)
{
// YOUR CODE HERE
// These values are used by the UI ...
// negative bake_end_time indicates that simulation
// is still progressing, and allows the
// indicator window above the time slider
// to correctly show the "baked" region
// in grey.
bake_end_time = -1;
simulate = true;
dirty = true;
}
/** Stop the simulation */
void ParticleSystem::stopSimulation(float t)
{
// YOUR CODE HERE
// These values are used by the UI
simulate = false;
dirty = true;
}
/** Reset the simulation */
void ParticleSystem::resetSimulation(float t)
{
// YOUR CODE HERE
// These values are used by the UI
simulate = false;
dirty = true;
}
/** Compute forces and update particles **/
void ParticleSystem::computeForcesAndUpdateParticles(float t)
{
// YOUR CODE HERE
// Debugging info
/*if( t - prevT > .08 )
printf("(!!) Dropped Frame %lf (!!)\n", t-prevT);*/
prevT = t;
}
/** Render particles */
void ParticleSystem::drawParticles(float t)
{
// YOUR CODE HERE
}
/** Adds the current configuration of particles to
* your data structure for storing baked particles **/
void ParticleSystem::bakeParticles(float t)
{
// TODO (baking is extra credit)
}
/** Clears out your data structure of baked particles */
void ParticleSystem::clearBaked()
{
// TODO (baking is extra credit)
}