diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/CParticleAttractionAffector.cpp | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CParticleAttractionAffector.cpp')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CParticleAttractionAffector.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CParticleAttractionAffector.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CParticleAttractionAffector.cpp index 83887c9..f47ce28 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CParticleAttractionAffector.cpp +++ b/libraries/irrlicht-1.8/source/Irrlicht/CParticleAttractionAffector.cpp | |||
@@ -1,84 +1,84 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #include "CParticleAttractionAffector.h" | 5 | #include "CParticleAttractionAffector.h" |
6 | #include "IAttributes.h" | 6 | #include "IAttributes.h" |
7 | 7 | ||
8 | namespace irr | 8 | namespace irr |
9 | { | 9 | { |
10 | namespace scene | 10 | namespace scene |
11 | { | 11 | { |
12 | 12 | ||
13 | //! constructor | 13 | //! constructor |
14 | CParticleAttractionAffector::CParticleAttractionAffector( | 14 | CParticleAttractionAffector::CParticleAttractionAffector( |
15 | const core::vector3df& point, f32 speed, bool attract, | 15 | const core::vector3df& point, f32 speed, bool attract, |
16 | bool affectX, bool affectY, bool affectZ ) | 16 | bool affectX, bool affectY, bool affectZ ) |
17 | : Point(point), Speed(speed), AffectX(affectX), AffectY(affectY), | 17 | : Point(point), Speed(speed), AffectX(affectX), AffectY(affectY), |
18 | AffectZ(affectZ), Attract(attract), LastTime(0) | 18 | AffectZ(affectZ), Attract(attract), LastTime(0) |
19 | { | 19 | { |
20 | #ifdef _DEBUG | 20 | #ifdef _DEBUG |
21 | setDebugName("CParticleAttractionAffector"); | 21 | setDebugName("CParticleAttractionAffector"); |
22 | #endif | 22 | #endif |
23 | } | 23 | } |
24 | 24 | ||
25 | 25 | ||
26 | //! Affects an array of particles. | 26 | //! Affects an array of particles. |
27 | void CParticleAttractionAffector::affect(u32 now, SParticle* particlearray, u32 count) | 27 | void CParticleAttractionAffector::affect(u32 now, SParticle* particlearray, u32 count) |
28 | { | 28 | { |
29 | if( LastTime == 0 ) | 29 | if( LastTime == 0 ) |
30 | { | 30 | { |
31 | LastTime = now; | 31 | LastTime = now; |
32 | return; | 32 | return; |
33 | } | 33 | } |
34 | 34 | ||
35 | f32 timeDelta = ( now - LastTime ) / 1000.0f; | 35 | f32 timeDelta = ( now - LastTime ) / 1000.0f; |
36 | LastTime = now; | 36 | LastTime = now; |
37 | 37 | ||
38 | if( !Enabled ) | 38 | if( !Enabled ) |
39 | return; | 39 | return; |
40 | 40 | ||
41 | for(u32 i=0; i<count; ++i) | 41 | for(u32 i=0; i<count; ++i) |
42 | { | 42 | { |
43 | core::vector3df direction = (Point - particlearray[i].pos).normalize(); | 43 | core::vector3df direction = (Point - particlearray[i].pos).normalize(); |
44 | direction *= Speed * timeDelta; | 44 | direction *= Speed * timeDelta; |
45 | 45 | ||
46 | if( !Attract ) | 46 | if( !Attract ) |
47 | direction *= -1.0f; | 47 | direction *= -1.0f; |
48 | 48 | ||
49 | if( AffectX ) | 49 | if( AffectX ) |
50 | particlearray[i].pos.X += direction.X; | 50 | particlearray[i].pos.X += direction.X; |
51 | 51 | ||
52 | if( AffectY ) | 52 | if( AffectY ) |
53 | particlearray[i].pos.Y += direction.Y; | 53 | particlearray[i].pos.Y += direction.Y; |
54 | 54 | ||
55 | if( AffectZ ) | 55 | if( AffectZ ) |
56 | particlearray[i].pos.Z += direction.Z; | 56 | particlearray[i].pos.Z += direction.Z; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | //! Writes attributes of the object. | 60 | //! Writes attributes of the object. |
61 | void CParticleAttractionAffector::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const | 61 | void CParticleAttractionAffector::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const |
62 | { | 62 | { |
63 | out->addVector3d("Point", Point); | 63 | out->addVector3d("Point", Point); |
64 | out->addFloat("Speed", Speed); | 64 | out->addFloat("Speed", Speed); |
65 | out->addBool("AffectX", AffectX); | 65 | out->addBool("AffectX", AffectX); |
66 | out->addBool("AffectY", AffectY); | 66 | out->addBool("AffectY", AffectY); |
67 | out->addBool("AffectZ", AffectZ); | 67 | out->addBool("AffectZ", AffectZ); |
68 | out->addBool("Attract", Attract); | 68 | out->addBool("Attract", Attract); |
69 | } | 69 | } |
70 | 70 | ||
71 | //! Reads attributes of the object. | 71 | //! Reads attributes of the object. |
72 | void CParticleAttractionAffector::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) | 72 | void CParticleAttractionAffector::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) |
73 | { | 73 | { |
74 | Point = in->getAttributeAsVector3d("Point"); | 74 | Point = in->getAttributeAsVector3d("Point"); |
75 | Speed = in->getAttributeAsFloat("Speed"); | 75 | Speed = in->getAttributeAsFloat("Speed"); |
76 | AffectX = in->getAttributeAsBool("AffectX"); | 76 | AffectX = in->getAttributeAsBool("AffectX"); |
77 | AffectY = in->getAttributeAsBool("AffectY"); | 77 | AffectY = in->getAttributeAsBool("AffectY"); |
78 | AffectZ = in->getAttributeAsBool("AffectZ"); | 78 | AffectZ = in->getAttributeAsBool("AffectZ"); |
79 | Attract = in->getAttributeAsBool("Attract"); | 79 | Attract = in->getAttributeAsBool("Attract"); |
80 | } | 80 | } |
81 | 81 | ||
82 | } // end namespace scene | 82 | } // end namespace scene |
83 | } // end namespace irr | 83 | } // end namespace irr |
84 | 84 | ||