-added SimpleVector (vector with only ubyte data)

-components adding and removing now use SimpleVector (optimalization)
This commit is contained in:
Mergul 2019-06-18 20:12:18 +02:00
parent b04ab77e0c
commit 01ff3962b5
2 changed files with 70 additions and 2 deletions

View file

@ -20,6 +20,7 @@ import ecs.hash_map;
import ecs.id_manager;
import ecs.system;
import ecs.vector;
import ecs.simple_vector;
import ecs.events;
import ecs.traits;
@ -1387,7 +1388,7 @@ export class EntityManager
data.change_entities_list.add(0);
data.change_entities_list.add((cast(ubyte*)&entity_id)[0 .. EntityID.sizeof]);
data.change_entities_list.add((cast(ubyte*)&num)[0 .. uint.sizeof]);
data.change_entities_list.add(cast(ubyte[]) del_ids);
data.change_entities_list.add((cast(ubyte*)del_ids.ptr)[0 .. num * 2]);
}
private void __removeComponents(EntityID entity_id, ushort[] del_ids)
@ -2685,7 +2686,8 @@ export class EntityManager
struct ThreadData
{
Vector!EntityID entities_to_remove;
Vector!ubyte change_entities_list;
//Vector!ubyte change_entities_list;
SimpleVector change_entities_list;
Vector!(EntitiesBlock*) blocks_to_update;
}