ribbonNode.h

Engine/source/T3D/fx/ribbonNode.h

More...

Classes:

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2014 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 _RIBBON_NODE_H_
 25#define _RIBBON_NODE_H_
 26
 27#ifndef _GAMEBASE_H_
 28#include "T3D/gameBase/gameBase.h"
 29#endif
 30
 31class RibbonData;
 32class Ribbon;
 33
 34//*****************************************************************************
 35// ParticleEmitterNodeData
 36//*****************************************************************************
 37class RibbonNodeData : public GameBaseData
 38{
 39   typedef GameBaseData Parent;
 40
 41public:
 42   F32 timeMultiple;
 43
 44public:
 45   RibbonNodeData();
 46   ~RibbonNodeData();
 47
 48   DECLARE_CONOBJECT(RibbonNodeData);
 49   static void initPersistFields();
 50};
 51
 52
 53//*****************************************************************************
 54// ParticleEmitterNode
 55//*****************************************************************************
 56class RibbonNode : public GameBase
 57{
 58   typedef GameBase Parent;
 59
 60   enum MaskBits
 61   {
 62      StateMask      = Parent::NextFreeMask << 0,
 63      EmitterDBMask  = Parent::NextFreeMask << 1,
 64      NextFreeMask   = Parent::NextFreeMask << 2,
 65   };
 66
 67   RibbonNodeData* mDataBlock;
 68
 69protected:
 70   bool onAdd();
 71   void onRemove();
 72   bool onNewDataBlock( GameBaseData *dptr, bool reload );
 73   void inspectPostApply();
 74
 75   RibbonData* mRibbonDatablock;
 76   S32 mRibbonDatablockId;
 77
 78   SimObjectPtr<Ribbon> mRibbon;
 79
 80   bool mActive;
 81
 82public:
 83   RibbonNode();
 84   ~RibbonNode();
 85
 86   Ribbon *getRibbonEmitter() {return mRibbon;}
 87
 88   // Time/Move Management
 89
 90   void processTick(const Move* move);
 91   void advanceTime(F32 dt);
 92
 93   DECLARE_CONOBJECT(RibbonNode);
 94   static void initPersistFields();
 95
 96   U32  packUpdate  (NetConnection *conn, U32 mask, BitStream* stream);
 97   void unpackUpdate(NetConnection *conn,           BitStream* stream);
 98
 99   inline bool getActive( void )        { return mActive;                             };
100   inline void setActive( bool active ) { mActive = active; setMaskBits( StateMask ); };
101
102   void setRibbonDatablock(RibbonData* data);
103};
104
105#endif // _RIBBON_NODE_H_
106
107