/src/ogre/OgreMain/include/OgreParticle.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | ----------------------------------------------------------------------------- |
3 | | This source file is part of OGRE |
4 | | (Object-oriented Graphics Rendering Engine) |
5 | | For the latest info, see http://www.ogre3d.org/ |
6 | | |
7 | | Copyright (c) 2000-2014 Torus Knot Software Ltd |
8 | | |
9 | | Permission is hereby granted, free of charge, to any person obtaining a copy |
10 | | of this software and associated documentation files (the "Software"), to deal |
11 | | in the Software without restriction, including without limitation the rights |
12 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
13 | | copies of the Software, and to permit persons to whom the Software is |
14 | | furnished to do so, subject to the following conditions: |
15 | | |
16 | | The above copyright notice and this permission notice shall be included in |
17 | | all copies or substantial portions of the Software. |
18 | | |
19 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20 | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
22 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
24 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
25 | | THE SOFTWARE. |
26 | | ----------------------------------------------------------------------------- |
27 | | */ |
28 | | #ifndef __Particle_H__ |
29 | | #define __Particle_H__ |
30 | | |
31 | | #include "OgrePrerequisites.h" |
32 | | #include "OgreHeaderPrefix.h" |
33 | | |
34 | | namespace Ogre { |
35 | | |
36 | | /** \addtogroup Core |
37 | | * @{ |
38 | | */ |
39 | | /** \addtogroup Effects |
40 | | * @{ |
41 | | */ |
42 | | /** Class representing a single particle instance. */ |
43 | | class _OgreExport Particle : public FXAlloc |
44 | | { |
45 | | public: |
46 | | /// Type of particle |
47 | | enum ParticleType : uint8 |
48 | | { |
49 | | Visual, |
50 | | Emitter |
51 | | }; |
52 | | |
53 | | /// Particle width |
54 | | float mWidth; |
55 | | /// Particle height |
56 | | float mHeight; |
57 | | /// Current rotation value |
58 | | Radian mRotation; |
59 | | // Note the intentional public access to internal variables |
60 | | // Accessing via get/set would be too costly for 000's of particles |
61 | | /// World position |
62 | | Vector3 mPosition; |
63 | | /// Direction (and speed) |
64 | | Vector3 mDirection; |
65 | | /// Current colour |
66 | | RGBA mColour; |
67 | | /// Time to live, number of seconds left of particles natural life |
68 | | float mTimeToLive; |
69 | | /// Total Time to live, number of seconds of particles natural life |
70 | | float mTotalTimeToLive; |
71 | | /// Speed of rotation in radians/sec |
72 | | Radian mRotationSpeed; |
73 | | /// Determines the type of particle. |
74 | | ParticleType mParticleType; |
75 | | /// Index into the array of texture coordinates @see BillboardSet::setTextureStacksAndSlices() |
76 | | uint8 mTexcoordIndex; |
77 | | uint8 mRandomTexcoordOffset; |
78 | | |
79 | | Particle() |
80 | 0 | : mWidth(0), mHeight(0), |
81 | 0 | mRotation(0), mPosition(Vector3::ZERO), mDirection(Vector3::ZERO), |
82 | 0 | mColour(0xFFFFFFFF), mTimeToLive(10), mTotalTimeToLive(10), |
83 | 0 | mRotationSpeed(0), mParticleType(Visual), mTexcoordIndex(0), mRandomTexcoordOffset(0) |
84 | 0 | { |
85 | 0 | } |
86 | | |
87 | | /** Sets the width and height for this particle. |
88 | | */ |
89 | | void setDimensions(float width, float height) |
90 | 0 | { |
91 | 0 | mWidth = width; |
92 | 0 | mHeight = height; |
93 | 0 | } |
94 | | |
95 | | /// @deprecated do not use |
96 | 0 | OGRE_DEPRECATED bool hasOwnDimensions(void) const { return true; } |
97 | | |
98 | | /** Retrieves the particle's personal width, if hasOwnDimensions is true. */ |
99 | 0 | float getOwnWidth(void) const { return mWidth; } |
100 | | |
101 | | /** Retrieves the particle's personal width, if hasOwnDimensions is true. */ |
102 | 0 | float getOwnHeight(void) const { return mHeight; } |
103 | | |
104 | | /** Sets the current rotation */ |
105 | 0 | void setRotation(const Radian& rad) { mRotation = rad; } |
106 | | |
107 | 0 | const Radian& getRotation(void) const { return mRotation; } |
108 | | }; |
109 | | /** @} */ |
110 | | /** @} */ |
111 | | } |
112 | | |
113 | | #include "OgreHeaderSuffix.h" |
114 | | |
115 | | #endif |
116 | | |