diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CParticleGravityAffector.cpp')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CParticleGravityAffector.cpp | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CParticleGravityAffector.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CParticleGravityAffector.cpp deleted file mode 100644 index 0385828..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/CParticleGravityAffector.cpp +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
2 | // This file is part of the "Irrlicht Engine". | ||
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | ||
4 | |||
5 | #include "CParticleGravityAffector.h" | ||
6 | #include "os.h" | ||
7 | #include "IAttributes.h" | ||
8 | |||
9 | namespace irr | ||
10 | { | ||
11 | namespace scene | ||
12 | { | ||
13 | |||
14 | //! constructor | ||
15 | CParticleGravityAffector::CParticleGravityAffector( | ||
16 | const core::vector3df& gravity, u32 timeForceLost) | ||
17 | : IParticleGravityAffector(), TimeForceLost(static_cast<f32>(timeForceLost)), Gravity(gravity) | ||
18 | { | ||
19 | #ifdef _DEBUG | ||
20 | setDebugName("CParticleGravityAffector"); | ||
21 | #endif | ||
22 | } | ||
23 | |||
24 | |||
25 | //! Affects an array of particles. | ||
26 | void CParticleGravityAffector::affect(u32 now, SParticle* particlearray, u32 count) | ||
27 | { | ||
28 | if (!Enabled) | ||
29 | return; | ||
30 | f32 d; | ||
31 | |||
32 | for (u32 i=0; i<count; ++i) | ||
33 | { | ||
34 | d = (now - particlearray[i].startTime) / TimeForceLost; | ||
35 | if (d > 1.0f) | ||
36 | d = 1.0f; | ||
37 | if (d < 0.0f) | ||
38 | d = 0.0f; | ||
39 | d = 1.0f - d; | ||
40 | |||
41 | particlearray[i].vector = particlearray[i].startVector.getInterpolated(Gravity, d); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | //! Writes attributes of the object. | ||
46 | void CParticleGravityAffector::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const | ||
47 | { | ||
48 | out->addVector3d("Gravity", Gravity); | ||
49 | out->addFloat("TimeForceLost", TimeForceLost); | ||
50 | } | ||
51 | |||
52 | |||
53 | //! Reads attributes of the object. | ||
54 | void CParticleGravityAffector::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) | ||
55 | { | ||
56 | Gravity = in->getAttributeAsVector3d("Gravity"); | ||
57 | TimeForceLost = in->getAttributeAsFloat("TimeForceLost"); | ||
58 | } | ||
59 | |||
60 | |||
61 | |||
62 | } // end namespace scene | ||
63 | } // end namespace irr | ||
64 | |||