Wow, this became quite a practise for threads You are right again. But also with this change i could test how 32 threads would effect, and as expected, it seemed just as fast as 4 or 8 threads. And minor difference in the creation, to support odd particle counts aswell
Code:
for i:=0 to MAX_THREADS-2 do
pt[i]:=TPhysicsThread.Create(FParent,
i*tcount, (i+1)*tcount-1);
pt[MAX_THREADS-1]:=TPhysicsThread.Create(FParent,
(MAX_THREADS-2)*tcount, count-2);
New version is also uploaded, and there is extra test in rendering loop commented out. I tried what it looks like when full screen clear would be replaced with slow fading to black. Particles can leave kind of trails when they move. I'm not sure if it looks better than original though, so that's why it's commented.
Bookmarks