Former-commit-id: 9ef456440ba27fbc09a8e61ae2f1003735c4da77
This commit is contained in:
Lynix 2015-05-26 00:08:45 +02:00
commit 3f501ec06f
5 changed files with 66 additions and 2 deletions

View File

@ -27,6 +27,7 @@ namespace Ndk
static SystemIndex systemIndex; static SystemIndex systemIndex;
private: private:
void OnEntityRemoved(Entity* entity) override;
void OnEntityValidation(Entity* entity, bool justAdded) override; void OnEntityValidation(Entity* entity, bool justAdded) override;
EntityList m_cameras; EntityList m_cameras;

View File

@ -16,6 +16,12 @@ namespace Ndk
{ {
} }
void RenderSystem::OnEntityRemoved(Entity* entity)
{
m_cameras.Remove(entity);
m_drawables.Remove(entity);
}
void RenderSystem::OnEntityValidation(Entity* entity, bool justAdded) void RenderSystem::OnEntityValidation(Entity* entity, bool justAdded)
{ {
if (entity->HasComponent<CameraComponent>()) if (entity->HasComponent<CameraComponent>())

View File

@ -42,8 +42,8 @@ return {
{ {
Title = "Stockage et gestion de champs de bits dynamiques (Bitset)", Title = "Stockage et gestion de champs de bits dynamiques (Bitset)",
Description = "Classe permettant le stockage et la manipulation optimisée d'un nombre élevé et dynamique de bits (=booléens, opérations de comptage, recherche de bits activés, opérations entre champs de bits, etc.)", Description = "Classe permettant le stockage et la manipulation optimisée d'un nombre élevé et dynamique de bits (=booléens, opérations de comptage, recherche de bits activés, opérations entre champs de bits, etc.)",
Note = "Il manque des opérateurs de comparaison et une spécialisation de la fonction de hachage", Note = "Il manque une spécialisation de la fonction de hachage",
Progress = 90 Progress = 95
} }
} }
}, },

View File

@ -110,6 +110,18 @@ bool operator==(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, All
template<typename Block, class Allocator> template<typename Block, class Allocator>
bool operator!=(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs); bool operator!=(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs);
template<typename Block, class Allocator>
bool operator<(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs);
template<typename Block, class Allocator>
bool operator<=(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs);
template<typename Block, class Allocator>
bool operator>(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs);
template<typename Block, class Allocator>
bool operator>=(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs);
template<typename Block, class Allocator> template<typename Block, class Allocator>
NzBitset<Block, Allocator> operator&(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs); NzBitset<Block, Allocator> operator&(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs);

View File

@ -555,6 +555,51 @@ bool operator!=(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, All
return !(lhs == rhs); return !(lhs == rhs);
} }
template<typename Block, class Allocator>
bool operator<(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs)
{
const NzBitset<Block, Allocator>& greater = (lhs.GetBlockCount() > rhs.GetBlockCount()) ? lhs : rhs;
const NzBitset<Block, Allocator>& lesser = (lhs.GetBlockCount() > rhs.GetBlockCount()) ? rhs : lhs;
unsigned int maxBlockCount = greater.GetBlockCount();
unsigned int minBlockCount = lesser.GetBlockCount();
// If the greatest bitset has a single bit active in a block outside the lesser bitset range, then it is greater
for (unsigned int i = maxBlockCount; i > minBlockCount; ++i)
{
if (greater.GetBlock(i))
return lhs.GetBlockCount() < rhs.GetBlockCount();
}
// Compare the common blocks
for (unsigned int i = 0; i < minBlockCount; ++i)
{
unsigned int index = (minBlockCount - i - 1); // Compare from the most significant block to the less significant block
if (lhs.GetBlock(index) < rhs.GetBlock(index))
return true;
}
return false; // They are equal
}
template<typename Block, class Allocator>
bool operator<=(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs)
{
return lhs < rhs || lhs == rhs;
}
template<typename Block, class Allocator>
bool operator>(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs)
{
return rhs < lhs;
}
template<typename Block, class Allocator>
bool operator>=(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs)
{
return rhs <= lhs;
}
template<typename Block, class Allocator> template<typename Block, class Allocator>
NzBitset<Block, Allocator> operator&(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs) NzBitset<Block, Allocator> operator&(const NzBitset<Block, Allocator>& lhs, const NzBitset<Block, Allocator>& rhs)
{ {