Add infos into target window
[ryzomcore.git] / ryzom / client / src / fx_manager.h
blobe41171e9ef144791af7c13077e86ecad4ba82729
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef CL_FX_MANAGER_H
20 #define CL_FX_MANAGER_H
23 /////////////
24 // INCLUDE //
25 /////////////
26 // Misc
27 #include "nel/misc/types_nl.h"
28 // 3D
29 #include "nel/3d/u_particle_system_instance.h"
30 // Std
31 #include <map>
32 #include <string>
35 ///////////
36 // CLASS //
37 ///////////
38 namespace NL3D
40 class UParticleSystemInstance;
43 // when a fx has a timeout, it is
44 const float FX_MANAGER_DEFAULT_TIMEOUT = 12.f;
46 /**
47 * Class to manage FXs.
48 * \author Guillaume PUZIN
49 * \author Nevrax France
50 * \date 2003
52 class CFXManager
54 public:
55 /// Constructor
56 CFXManager();
57 /// Destructor
58 ~CFXManager();
60 // create and managed an fx (e.g destroy its model when it is finished)
61 NL3D::UParticleSystemInstance instantFX(const std::string &fxName, float timeOut = FX_MANAGER_DEFAULT_TIMEOUT);
62 // Add an fx that will be created some time later
63 void deferFX(const std::string &fxName, const NLMISC::CMatrix &matrix, float delayInSeconds, float timeOut = FX_MANAGER_DEFAULT_TIMEOUT);
64 // add an externally created fx to be managed
65 void addFX(NL3D::UParticleSystemInstance fx, float timeOut = FX_MANAGER_DEFAULT_TIMEOUT, bool testNoMoreParticles = false);
66 void fx2remove(NL3D::UParticleSystemInstance fx, float timeOut = FX_MANAGER_DEFAULT_TIMEOUT);
67 void update();
68 // instantly removes all fxs that need to
69 void reset();
70 // get the number of fx that are currently to be removed
71 uint getNumFXtoRemove() const { return _NumFXToRemove; }
72 protected:
73 class CFX2Remove
75 public:
76 NL3D::UParticleSystemInstance Instance;
77 float TimeOut;
78 bool TestNoMoreParticles;
79 public:
80 CFX2Remove(NL3D::UParticleSystemInstance instance=NL3D::UParticleSystemInstance(), float timeOut = 0.f, bool testNoMoreParticles = false)
82 Instance = instance;
83 TimeOut = timeOut;
84 TestNoMoreParticles = testNoMoreParticles;
87 // List of FXs to remove as soon as possible.
88 std::list<CFX2Remove> _FX2RemoveList;
89 uint _NumFXToRemove;
92 struct CDeferredFX
94 NLMISC::CMatrix Matrix;
95 std::string FXName;
96 float TimeOut;
99 CHashMultiMap<uint64, CDeferredFX> _DeferredFXByDate;
103 ////////////
104 // EXTERN //
105 ////////////
106 // FX manager.
107 extern CFXManager FXMngr;
110 #endif // CL_FX_MANAGER_H
112 /* End of fx_manager.h */