summaryrefslogtreecommitdiff
path: root/src/particleemitterprop.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-08 22:35:09 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-09 17:14:25 +0100
commit1b041ecccfbe44a4f50ffc086e3996e2b6eea4f7 (patch)
tree74cff7036d1ecfb4df5a79a7ca68bedce5bea47e /src/particleemitterprop.h
parent0ca05c54dd814f294617eda286ef175f01baa542 (diff)
downloadmana-1b041ecccfbe44a4f50ffc086e3996e2b6eea4f7.tar.gz
mana-1b041ecccfbe44a4f50ffc086e3996e2b6eea4f7.tar.bz2
mana-1b041ecccfbe44a4f50ffc086e3996e2b6eea4f7.tar.xz
mana-1b041ecccfbe44a4f50ffc086e3996e2b6eea4f7.zip
C++11: Use default member initializers
This patch is not exhaustive.
Diffstat (limited to 'src/particleemitterprop.h')
-rw-r--r--src/particleemitterprop.h22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/particleemitterprop.h b/src/particleemitterprop.h
index 2bd92d17..eb719e57 100644
--- a/src/particleemitterprop.h
+++ b/src/particleemitterprop.h
@@ -35,14 +35,10 @@ enum ChangeFunc
template <typename T> struct ParticleEmitterProp
{
- ParticleEmitterProp():
- changeFunc(FUNC_NONE)
- {
- }
-
void set(T min, T max)
{
- minVal=min; maxVal=max;
+ minVal = min;
+ maxVal = max;
}
void set(T val)
@@ -66,24 +62,24 @@ template <typename T> struct ParticleEmitterProp
switch (changeFunc)
{
case FUNC_SINE:
- val += (T) std::sin(PI * 2 * ((double)(tick%changePeriod) / (double)changePeriod)) * changeAmplitude;
+ val += (T) std::sin(PI * 2 * ((double)(tick % changePeriod) / (double)changePeriod)) * changeAmplitude;
break;
case FUNC_SAW:
- val += (T) (changeAmplitude * ((double)(tick%changePeriod) / (double)changePeriod)) * 2 - changeAmplitude;
+ val += (T) (changeAmplitude * ((double)(tick % changePeriod) / (double)changePeriod)) * 2 - changeAmplitude;
break;
case FUNC_TRIANGLE:
- if ((tick%changePeriod) * 2 < changePeriod)
+ if ((tick % changePeriod) * 2 < changePeriod)
{
- val += changeAmplitude - (T)((tick%changePeriod) / (double)changePeriod) * changeAmplitude * 4;
+ val += changeAmplitude - (T)((tick % changePeriod) / (double)changePeriod) * changeAmplitude * 4;
}
else
{
- val += changeAmplitude * -3 + (T)((tick%changePeriod) / (double)changePeriod) * changeAmplitude * 4;
+ val += changeAmplitude * -3 + (T)((tick % changePeriod) / (double)changePeriod) * changeAmplitude * 4;
// I have no idea why this works but it does
}
break;
case FUNC_SQUARE:
- if ((tick%changePeriod) * 2 < changePeriod)
+ if ((tick % changePeriod) * 2 < changePeriod)
val += changeAmplitude;
else
val -= changeAmplitude;
@@ -100,7 +96,7 @@ template <typename T> struct ParticleEmitterProp
T minVal;
T maxVal;
- ChangeFunc changeFunc;
+ ChangeFunc changeFunc = FUNC_NONE;
T changeAmplitude;
int changePeriod;
int changePhase;