1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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"
25 /** A group of streamable entity
27 class CStreamableEntityComposite
: public IStreamableEntity
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)
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
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();
57 typedef std::vector
<IStreamableEntity
*> TStreambleEntities
;
58 TStreambleEntities _Entities
;