diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp index e59854a..1999e71 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp +++ b/libraries/irrlicht-1.8/source/Irrlicht/CParticleRotationAffector.cpp | |||
@@ -1,67 +1,67 @@ | |||
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 "CParticleRotationAffector.h" | 5 | #include "CParticleRotationAffector.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 | CParticleRotationAffector::CParticleRotationAffector( const core::vector3df& speed, const core::vector3df& pivotPoint ) | 14 | CParticleRotationAffector::CParticleRotationAffector( const core::vector3df& speed, const core::vector3df& pivotPoint ) |
15 | : PivotPoint(pivotPoint), Speed(speed), LastTime(0) | 15 | : PivotPoint(pivotPoint), Speed(speed), LastTime(0) |
16 | { | 16 | { |
17 | #ifdef _DEBUG | 17 | #ifdef _DEBUG |
18 | setDebugName("CParticleRotationAffector"); | 18 | setDebugName("CParticleRotationAffector"); |
19 | #endif | 19 | #endif |
20 | } | 20 | } |
21 | 21 | ||
22 | 22 | ||
23 | //! Affects an array of particles. | 23 | //! Affects an array of particles. |
24 | void CParticleRotationAffector::affect(u32 now, SParticle* particlearray, u32 count) | 24 | void CParticleRotationAffector::affect(u32 now, SParticle* particlearray, u32 count) |
25 | { | 25 | { |
26 | if( LastTime == 0 ) | 26 | if( LastTime == 0 ) |
27 | { | 27 | { |
28 | LastTime = now; | 28 | LastTime = now; |
29 | return; | 29 | return; |
30 | } | 30 | } |
31 | 31 | ||
32 | f32 timeDelta = ( now - LastTime ) / 1000.0f; | 32 | f32 timeDelta = ( now - LastTime ) / 1000.0f; |
33 | LastTime = now; | 33 | LastTime = now; |
34 | 34 | ||
35 | if( !Enabled ) | 35 | if( !Enabled ) |
36 | return; | 36 | return; |
37 | 37 | ||
38 | for(u32 i=0; i<count; ++i) | 38 | for(u32 i=0; i<count; ++i) |
39 | { | 39 | { |
40 | if( Speed.X != 0.0f ) | 40 | if( Speed.X != 0.0f ) |
41 | particlearray[i].pos.rotateYZBy( timeDelta * Speed.X, PivotPoint ); | 41 | particlearray[i].pos.rotateYZBy( timeDelta * Speed.X, PivotPoint ); |
42 | 42 | ||
43 | if( Speed.Y != 0.0f ) | 43 | if( Speed.Y != 0.0f ) |
44 | particlearray[i].pos.rotateXZBy( timeDelta * Speed.Y, PivotPoint ); | 44 | particlearray[i].pos.rotateXZBy( timeDelta * Speed.Y, PivotPoint ); |
45 | 45 | ||
46 | if( Speed.Z != 0.0f ) | 46 | if( Speed.Z != 0.0f ) |
47 | particlearray[i].pos.rotateXYBy( timeDelta * Speed.Z, PivotPoint ); | 47 | particlearray[i].pos.rotateXYBy( timeDelta * Speed.Z, PivotPoint ); |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | //! Writes attributes of the object. | 51 | //! Writes attributes of the object. |
52 | void CParticleRotationAffector::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const | 52 | void CParticleRotationAffector::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const |
53 | { | 53 | { |
54 | out->addVector3d("PivotPoint", PivotPoint); | 54 | out->addVector3d("PivotPoint", PivotPoint); |
55 | out->addVector3d("Speed", Speed); | 55 | out->addVector3d("Speed", Speed); |
56 | } | 56 | } |
57 | 57 | ||
58 | //! Reads attributes of the object. | 58 | //! Reads attributes of the object. |
59 | void CParticleRotationAffector::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) | 59 | void CParticleRotationAffector::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) |
60 | { | 60 | { |
61 | PivotPoint = in->getAttributeAsVector3d("PivotPoint"); | 61 | PivotPoint = in->getAttributeAsVector3d("PivotPoint"); |
62 | Speed = in->getAttributeAsVector3d("Speed"); | 62 | Speed = in->getAttributeAsVector3d("Speed"); |
63 | } | 63 | } |
64 | 64 | ||
65 | } // end namespace scene | 65 | } // end namespace scene |
66 | } // end namespace irr | 66 | } // end namespace irr |
67 | 67 | ||