Merge branch '138-toggle-free-look-with-hotkey' into main/gingo-test
[ryzomcore.git] / ryzom / client / src / streamable_entity_composite.h
blob93c71cd82c235ce306532120646a5a98ca61270e
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_STREAMABLE_ENTITY_COMPOSITE
20 #define CL_STREAMABLE_ENTITY_COMPOSITE
22 #include "streamable_entity.h"
23 #include <vector>
25 /** A group of streamable entity
27 class CStreamableEntityComposite : public IStreamableEntity
29 public:
30 // dtor
31 ~CStreamableEntityComposite();
32 /// Add an entity. it is then owned by this obj.
33 void add(IStreamableEntity *entity);
34 /// optimisation : make room for further adds
35 void reserve(uint size);
36 /// Remove an entity (& delete it)
37 void remove(IStreamableEntity *entity);
38 /// Remove all entities (& elte them)
39 void removeAll();
40 /// Get the number of entity
41 uint getNumEntities() const { return (uint)_Entities.size(); }
42 /// Get an entity by its index
43 IStreamableEntity *getEntity(uint index) const { return _Entities[index]; }
44 //\name from IStreamableEntity
45 //@{
46 /** Given a pos, test whether one entity needs to be loaded now.
47 * It it returns true, the next call to update will return only when the loading of an entity is completed.
49 virtual bool needCompleteLoading(const NLMISC::CVector &pos) const;
50 /// Load / Unload entity depeneding on the player position
51 virtual void update(const NLMISC::CVector &pos);
52 virtual void forceUpdate(const NLMISC::CVector &pos, NLMISC::IProgressCallback &progress);
53 /// Force unloading of all entitie
54 virtual void forceUnload();
55 //@}
56 private:
57 typedef std::vector<IStreamableEntity *> TStreambleEntities;
58 TStreambleEntities _Entities;
68 #endif