Torque3D Documentation / _generateds / particleEmitterNode.h

particleEmitterNode.h

Engine/source/T3D/fx/particleEmitterNode.h

More...

Classes:

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _PARTICLEEMITTERDUMMY_H_
 25#define _PARTICLEEMITTERDUMMY_H_
 26
 27#ifndef _GAMEBASE_H_
 28#include "T3D/gameBase/gameBase.h"
 29#endif
 30
 31class ParticleEmitterData;
 32class ParticleEmitter;
 33
 34//*****************************************************************************
 35// ParticleEmitterNodeData
 36//*****************************************************************************
 37class ParticleEmitterNodeData : public GameBaseData
 38{
 39   typedef GameBaseData Parent;
 40
 41  protected:
 42   bool onAdd();
 43
 44   //-------------------------------------- Console set variables
 45  public:
 46   F32 timeMultiple;
 47
 48   //-------------------------------------- load set variables
 49  public:
 50
 51  public:
 52   ParticleEmitterNodeData();
 53   ~ParticleEmitterNodeData();
 54
 55   void packData(BitStream*);
 56   void unpackData(BitStream*);
 57   bool preload(bool server, String &errorStr);
 58
 59   DECLARE_CONOBJECT(ParticleEmitterNodeData);
 60   static void initPersistFields();
 61};
 62
 63
 64//*****************************************************************************
 65// ParticleEmitterNode
 66//*****************************************************************************
 67class ParticleEmitterNode : public GameBase
 68{
 69   typedef GameBase Parent;
 70
 71   enum MaskBits
 72   {
 73      StateMask      = Parent::NextFreeMask << 0,
 74      EmitterDBMask  = Parent::NextFreeMask << 1,
 75      NextFreeMask   = Parent::NextFreeMask << 2,
 76   };
 77
 78  private:
 79   ParticleEmitterNodeData* mDataBlock;
 80
 81  protected:
 82   bool onAdd();
 83   void onRemove();
 84   bool onNewDataBlock( GameBaseData *dptr, bool reload );
 85   void inspectPostApply();
 86
 87   ParticleEmitterData* mEmitterDatablock;
 88   S32                  mEmitterDatablockId;
 89
 90   bool             mActive;
 91
 92   SimObjectPtr<ParticleEmitter> mEmitter;
 93   F32              mVelocity;
 94
 95  public:
 96   ParticleEmitterNode();
 97   ~ParticleEmitterNode();
 98   
 99   ParticleEmitter *getParticleEmitter() {return mEmitter;}
100   
101   // Time/Move Management
102  public:
103   void processTick(const Move* move);
104   void advanceTime(F32 dt);
105
106   DECLARE_CONOBJECT(ParticleEmitterNode);
107   static void initPersistFields();
108
109   U32  packUpdate  (NetConnection *conn, U32 mask, BitStream* stream);
110   void unpackUpdate(NetConnection *conn,           BitStream* stream);
111
112   inline bool getActive( void )        { return mActive;                             };
113   inline void setActive( bool active ) { mActive = active; setMaskBits( StateMask ); };
114
115   void setEmitterDataBlock(ParticleEmitterData* data);
116};
117
118#endif // _H_PARTICLEEMISSIONDUMMY
119
120