TDME2 1.9.121
SimplePartition.cpp
Go to the documentation of this file.
2
3#include <algorithm>
4#include <vector>
5
6#include <tdme/tdme.h>
9
10using std::find;
11using std::vector;
12
16
17SimplePartition::SimplePartition()
18{
20}
21
23{
24 entities.clear();
25}
26
28{
29 for (int i = 0; i < entities.size(); i++) {
30 if (entities[i] == entity) return;
31 }
32
33 entities.push_back(entity);
34}
35
37{
38}
39
41{
42 for (int i = 0; i < entities.size(); i++) {
43 if (entities[i] == entity) {
44 entities.erase(entities.begin() + i);
45 return;
46 }
47 }
48}
49
50const vector<Entity*>& SimplePartition::getVisibleEntities(Frustum* frustum)
51{
52 return entities;
53}
54
56 return find(entities.begin(), entities.end(), entity) != entities.end();
57}
TDME engine entity.
Definition: Entity.h:31
Frustum class.
Definition: Frustum.h:30
Bogus/Simple partition implementation.
void removeEntity(Entity *entity) override
Removes a entity.
const vector< Entity * > & getVisibleEntities(Frustum *frustum) override
Get visible entities.
VectorIteratorMultiple< Entity * > arrayListIteratorMultiple
void updateEntity(Entity *entity) override
Updates a entity.
void addEntity(Entity *entity) override
Adds a entity.
bool isVisibleEntity(Entity *entity) override
Check if entity is visible.
void reset() override
Reset.
Vector iterator template to be used to iterate multiple vectors at a single invocation.