Hi to all, interesting, sometime ago i converted this voxel
We can improve performances by :
1) Using LUT for Sin and Cos
2) Avoid one mul and 4 sub
3) Drawing directly in the "bitmap buffer" instead of in Src (except for CODE 3)
What i do
1) I've added a rendering with the help of my own lib BZScene (
https://github.com/jdelauney/BZScene) (CODE6) see GIF :
https://imgbox.com/3WIFJgE8#2) Improve BGRABitmap (CODE4)
3) Fix compatibility with TLazIntfImage (CODE5)
4) Introduce Sin and Cos LUT
5) Improve a little bit calculus (avoid one mul and 4 sub)
6) Added an auto travel throught the world (press key "A" to start)
Now the benchmark the results are the average frame speed of the travel (press key "A")
CPU : AMD A10-7870K Radeon R7, 12 Compute Cores 4C+8G
Compiled in Release mode and full optimization
Under Windows 64 bits with FPC 3.2 and Lazarus 2.0.10 :
CODE 1 : 64,6442 ms
CODE 2 : 63,2677 ms
CODE 3 : 0,3597 ms
CODE 4 : 1,3309 ms
CODE 5 : 1,3684 ms
CODE 6 : 0,9012 ms
Under Linux (Manjaro) - GTK 2 - with FPC 3.0.4 and Lazarus 2.0.8 (Bench is not accurate)
CODE 1 : 17,9941 ms
CODE 2 : 18,1594 ms
CODE 3 : N/A
CODE 4 : 3,0521 ms
CODE 5 : 3,9579 ms
CODE 6 : 2,6569 ms
See the attached ZIP for code
Cheers