00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00021
00022
00023 #ifndef H_SPK_SPHERICEMITTER
00024 #define H_SPK_SPHERICEMITTER
00025
00026 #include "Core/SPK_Emitter.h"
00027
00028
00029 namespace SPK
00030 {
00050 class SPK_PREFIX SphericEmitter : public Emitter
00051 {
00052 SPK_IMPLEMENT_REGISTERABLE(SphericEmitter)
00053
00054 public :
00055
00057
00059
00066 SphericEmitter(const Vector3D& direction = Vector3D(0.0f,0.0f,-1.0f),float angleA = 0.0f,float angleB = 0.0f);
00067
00075 static SphericEmitter* create(const Vector3D& direction = Vector3D(0.0f,0.0f,-1.0f),float angleA = 0.0f,float angleB = 0.0f);
00076
00078
00080
00089 void setDirection(const Vector3D& direction);
00090
00100 void setAngles(float angleA,float angleB);
00101
00103
00105
00110 const Vector3D& getDirection() const;
00111
00116 const Vector3D& getTransformedDirection() const;
00117
00122 float getAngleMin() const;
00123
00128 float getAngleMax() const;
00129
00130 protected :
00131
00132 virtual void innerUpdateTransform();
00133
00134 private :
00135
00136 static const float PI;
00137
00138 Vector3D direction;
00139 Vector3D tDirection;
00140
00141 float angleMin;
00142 float angleMax;
00143
00144 float cosAngleMin;
00145 float cosAngleMax;
00146
00147 float matrix[9];
00148
00149 void computeMatrix();
00150
00151 virtual void generateVelocity(Particle& particle,float speed) const;
00152 };
00153
00154
00155 inline SphericEmitter* SphericEmitter::create(const Vector3D& direction,float angleA,float angleB)
00156 {
00157 SphericEmitter* obj = new SphericEmitter(direction,angleA,angleB);
00158 registerObject(obj);
00159 return obj;
00160 }
00161
00162 inline const Vector3D& SphericEmitter::getDirection() const
00163 {
00164 return direction;
00165 }
00166
00167 inline const Vector3D& SphericEmitter::getTransformedDirection() const
00168 {
00169 return tDirection;
00170 }
00171
00172 inline float SphericEmitter::getAngleMin() const
00173 {
00174 return angleMin;
00175 }
00176
00177 inline float SphericEmitter::getAngleMax() const
00178 {
00179 return angleMax;
00180 }
00181 }
00182
00183 #endif