forestWindMgr.h
Engine/source/forest/forestWindMgr.h
Classes:
class
class
Public Defines
define
WINDMGR() <>::instance()
Returns the ReflectionManager singleton.
Detailed Description
Public Defines
WINDMGR() <>::instance()
Returns the ReflectionManager singleton.
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 _FORESTWINDMGR_H_ 25#define _FORESTWINDMGR_H_ 26 27#ifndef _FORESTWINDEMITTER_H_ 28#include "forest/forestWindEmitter.h" 29#endif 30#ifndef _TDICTIONARY_H_ 31#include "core/util/tDictionary.h" 32#endif 33#ifndef _ITICKABLE_H_ 34#include "core/iTickable.h" 35#endif 36#ifndef _FORESTITEM_H_ 37#include "forest/forestItem.h" 38#endif 39#ifndef _TSINGLETON_H_ 40#include "core/util/tSingleton.h" 41#endif 42 43struct TreePlacementInfo 44{ 45 F32 scale; 46 Point3F pos; 47 ForestItemKey itemKey; 48 ForestItemData *dataBlock; 49}; 50 51class ForestWindMgr : public virtual ITickable 52{ 53protected: 54 55 ForestWindEmitterList mEmitters; 56 57 typedef HashTable<U32,ForestWindAccumulator*> IdToWindMap; 58 typedef Signal<void( const Point3F &camPos, const F32 radius, Vector<TreePlacementInfo> *placementInfo )> WindAdvanceSignal; 59 60 IdToWindMap *mSources; 61 IdToWindMap *mPrevSources; 62 Vector<TreePlacementInfo> mPlacementInfo; 63 64 static WindAdvanceSignal smAdvanceSignal; 65 66 virtual void interpolateTick( F32 delta ) {}; 67 virtual void processTick(); 68 virtual void advanceTime( F32 timeDelta ) {}; 69 70public: 71 72 ForestWindMgr(); 73 virtual ~ForestWindMgr(); 74 75 void addEmitter( ForestWindEmitter *emitter ); 76 77 void removeEmitter( ForestWindEmitter *emitter ); 78 79 void updateWind( const Point3F &camPos, 80 const TreePlacementInfo &info, 81 F32 timeDelta ); 82 83 ForestWindAccumulator* getLocalWind( ForestItemKey key ); 84 85 // Returns the first non-radial emitter in the list. 86 ForestWindEmitter* getGlobalWind(); 87 88 89 static WindAdvanceSignal& getAdvanceSignal() { return smAdvanceSignal; } 90 91 static F32 smWindEffectRadius; 92 93 static void initConsole(); 94 95 // For ManagedSingleton. 96 static const char* getSingletonName() { return "ForestWindMgr"; } 97}; 98 99/// Returns the ReflectionManager singleton. 100#define WINDMGR ManagedSingleton<ForestWindMgr>::instance() 101 102#endif // _FORESTWINDMGR_H_ 103