00001
00002
00003
00004
00005
00006 #ifndef __BS_EMITTER_H__
00007 #define __BS_EMITTER_H__
00008
00009 #include "bsPrerequisites.h"
00010 #include "bsCore.h"
00011 #include "bsEmitterDefinition.h"
00012
00013 namespace BS_NMSP
00014 {
00015 class ScriptMachine;
00016
00024 class _BSAPI Emitter : public DeepMemoryPoolObject
00025 {
00026 friend class EmitType;
00027
00028
00029 struct MemberController
00030 {
00031 float time;
00032 bstype speed;
00033 };
00034
00035
00036 bool mEnabled;
00037
00038
00039
00040
00041
00042 int mAnchorIndex, mLastAnchorIndex;
00043
00044
00045 MemberController mMemberControllers[BS_MAX_USER_MEMBERS];
00046
00047
00048
00049
00050 uint32 mActiveControllers;
00051
00052 int mNumUserMembers;
00053
00054 bstype mLastX, mLastY;
00055 #ifdef BS_Z_DIMENSION
00056 bstpe mLastZ;
00057 #endif
00058 bstype mLastAngle;
00059
00060 ScriptMachine* mScriptMachine;
00061
00062 ScriptRecord* mRecord;
00063
00064
00065 void* mUserObject;
00066
00067 private:
00068
00069 void runScript(float frameTime);
00070
00071 public:
00072
00076 explicit Emitter(ScriptMachine* machine);
00077
00084 void onRelease();
00085
00090 int _getAnchorIndex() const;
00091
00092 #ifndef BS_Z_DIMENSION
00093
00104 void setDefinition(EmitterDefinition* def, bstype x, bstype y, bstype angle);
00105 #else
00106
00118 void setDefinition(EmitterDefinition* def, bstype x, bstype y, bstype z, bstype angle);
00119 #endif
00120
00125 void enable(bool enable);
00126
00131 bool isEnabled() const;
00132
00137 void setX(bstype x);
00138
00143 void setY(bstype y);
00144
00145 #ifdef BS_Z_DIMENSION
00146
00150 void setZ(bstype z);
00151 #endif
00152
00153 #ifndef BS_Z_DIMENSION
00154
00159 void setPosition(bstype x, bstype y);
00160 #else
00161
00167 void setPosition(bstype x, bstype y, bstype z);
00168 #endif
00169
00174 void setAngle(bstype angle);
00175
00181 void setSpecialMember(int member, bstype value);
00182
00191 void setMember(int member, bstype value);
00192
00203 void setMember(int member, bstype value, float time);
00204
00213 bstype getMember(int member) const;
00214
00219 bstype getX() const;
00220
00225 bstype getY() const;
00226
00227 #ifdef BS_Z_DIMENSION
00228
00232 bstype getZ() const;
00233 #endif
00234
00239 bstype getAngle() const;
00240
00247 bstype _getDeltaX() const;
00248
00255 bstype _getDeltaY() const;
00256
00257 #ifdef BS_Z_DIMENSION
00258
00264 bstype _getDeltaZ() const;
00265 #endif
00266
00273 bstype _getDeltaAngle() const;
00274
00277 void _updateLastMembers();
00278
00284 void setUserObject(void* userObject);
00285
00294 void* getUserObject() const;
00295
00303 void setState(int state);
00304
00311 void update(float frameTime);
00312
00313 };
00314
00315 }
00316
00317 #endif