This code was slow*:
D3DTLVERTEX* pvert = LocalMem;
for(int c = 0; c < CopiedIn; c++)
{
pvert[c].dvSX -= TransformX;
pvert[c].dvSY -= TransformY;
pvert[c].dvSX *= TransformZoom;
pvert[c].dvSY *= TransformZoom;
}
This code runs in one quarter of the time:
D3DTLVERTEX* pvert = LocalMem;
for(int c = 0; c < CopiedIn; c++)
{
pvert->dvSX -= TransformX;
pvert->dvSY -= TransformY;
pvert->dvSX *= TransformZoom;
pvert->dvSY *= TransformZoom;
pvert++;
}
Pointers FTW!
I’m doing this sort of stuff now, which isn’t as fast as actually using hardware T&L, but is better than my older, hacky software transforms which happened on individual sprites, rather than at the VB level. Yeah I know… everyone uses world matrices and hardware T&L, I won’t bore you with the reasons I’m not, but there ya go. It works! (GSB uses a per-object world -> screen software transform for each object).
EDIT: These measurements may be a glitch. I’ve run and re-run, and re-run the profiler on both versions and now cannot get as big a discrepancy (although there is still a speed difference). Getting accurate measurements on a multi-core PC that has a live internet connection and various background services running is hell. Now I know why people like console dev :D
*relatively speaking.