-BlockAllocator is no longer template

-Multithreaded IDManager.getNewID()
 *use implementation with free IDs stack (instead of classic pool)
-support for multiple UpdatePasses. Passes are added by name, and must be called between begin() end() functions.
-removed mutex from addEntity()
-commit() function added. Used to commit all changes made while update() call. Called automatically by begin() end() functions.
This commit is contained in:
Mergul 2018-10-25 11:46:08 +02:00
parent 430ce8074c
commit d3f7593afc
6 changed files with 406 additions and 189 deletions

View file

@ -175,7 +175,7 @@ int main()
void initialize(ref Entity entity, ref TestComp comp)
{
int o = 1;
}
void update(EntitiesData data)
@ -284,6 +284,8 @@ import std.meta;
gEM.setJobDispachFunc(&dispatch);
assert(gEM !is null);
gEM.registerPass("fixed");
MonoTime time = MonoTime.currTime;
gEM.registerComponent!TestComp2;
@ -299,7 +301,7 @@ import std.meta;
time = MonoTime.currTime;
gEM.registerSystem!TestSystemWithHighPriority(100);
gEM.registerSystem!TestSystemWithHighPriority(100,"fixed");
gEM.registerSystem!TestSystem(0);
//gEM.registerSystem!TestSystemWithHighPriority(100);
//gEM.registerSystem!TestSystem2(0);
@ -346,6 +348,7 @@ import std.meta;
gEM.removeEntity(idss[j]);
gEM.end();
}
gEM.commit();
dur = (MonoTime.currTime - time).total!"usecs";
writeln("Entities adding: ", dur, " usecs");
@ -373,12 +376,18 @@ import std.meta;
Entity entity2;
time = MonoTime.currTime;
foreach (i; 0 .. 500_000)
{
entity2 = gEM.addEntity(tmpl);
gEM.addEntity(tmpl2);
}
gEM.commit();
dur = (MonoTime.currTime - time).total!"usecs";
writeln("Entities adding2: ", dur, " usecs");
time = MonoTime.currTime;
gEM.begin();
@ -441,6 +450,7 @@ import std.meta;
gEM.begin();
gEM.update();
gEM.update("fixed");
gEM.end();
writeEntityComponents(gEM.getEntity(entity.id));