diff options
author | David Walter Seikel | 2013-01-13 17:24:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:24:39 +1000 |
commit | 393b5cd1dc438872af89d334ef6e5fcc59f27d47 (patch) | |
tree | 6a14521219942a08a1b95cb2f5a923a9edd60f63 /libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp | |
parent | Add a note about rasters suggested start up code. (diff) | |
download | SledjHamr-393b5cd1dc438872af89d334ef6e5fcc59f27d47.zip SledjHamr-393b5cd1dc438872af89d334ef6e5fcc59f27d47.tar.gz SledjHamr-393b5cd1dc438872af89d334ef6e5fcc59f27d47.tar.bz2 SledjHamr-393b5cd1dc438872af89d334ef6e5fcc59f27d47.tar.xz |
Added Irrlicht 1.8, but without all the Windows binaries.
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp new file mode 100644 index 0000000..e59854a --- /dev/null +++ b/libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp | |||
@@ -0,0 +1,67 @@ | |||
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 "CParticleRotationAffector.h" | ||
6 | #include "IAttributes.h" | ||
7 | |||
8 | namespace irr | ||
9 | { | ||
10 | namespace scene | ||
11 | { | ||
12 | |||
13 | //! constructor | ||
14 | CParticleRotationAffector::CParticleRotationAffector( const core::vector3df& speed, const core::vector3df& pivotPoint ) | ||
15 | : PivotPoint(pivotPoint), Speed(speed), LastTime(0) | ||
16 | { | ||
17 | #ifdef _DEBUG | ||
18 | setDebugName("CParticleRotationAffector"); | ||
19 | #endif | ||
20 | } | ||
21 | |||
22 | |||
23 | //! Affects an array of particles. | ||
24 | void CParticleRotationAffector::affect(u32 now, SParticle* particlearray, u32 count) | ||
25 | { | ||
26 | if( LastTime == 0 ) | ||
27 | { | ||
28 | LastTime = now; | ||
29 | return; | ||
30 | } | ||
31 | |||
32 | f32 timeDelta = ( now - LastTime ) / 1000.0f; | ||
33 | LastTime = now; | ||
34 | |||
35 | if( !Enabled ) | ||
36 | return; | ||
37 | |||
38 | for(u32 i=0; i<count; ++i) | ||
39 | { | ||
40 | if( Speed.X != 0.0f ) | ||
41 | particlearray[i].pos.rotateYZBy( timeDelta * Speed.X, PivotPoint ); | ||
42 | |||
43 | if( Speed.Y != 0.0f ) | ||
44 | particlearray[i].pos.rotateXZBy( timeDelta * Speed.Y, PivotPoint ); | ||
45 | |||
46 | if( Speed.Z != 0.0f ) | ||
47 | particlearray[i].pos.rotateXYBy( timeDelta * Speed.Z, PivotPoint ); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | //! Writes attributes of the object. | ||
52 | void CParticleRotationAffector::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const | ||
53 | { | ||
54 | out->addVector3d("PivotPoint", PivotPoint); | ||
55 | out->addVector3d("Speed", Speed); | ||
56 | } | ||
57 | |||
58 | //! Reads attributes of the object. | ||
59 | void CParticleRotationAffector::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) | ||
60 | { | ||
61 | PivotPoint = in->getAttributeAsVector3d("PivotPoint"); | ||
62 | Speed = in->getAttributeAsVector3d("Speed"); | ||
63 | } | ||
64 | |||
65 | } // end namespace scene | ||
66 | } // end namespace irr | ||
67 | |||