Common Point Rotation / Dot Cube (PB2DLL Example)
This demo shows a cube of uniformly spaced vertex rotating in front of a viewer. The demo use common point rotations to trim around 6 mults from each rotated point. The demo includes two versions of the rendering function, one which is included in the project as normal and compiled to byte code and the other version has been converted to machine code using PlayBASIC2DLL
It's important to understand that the machine code version is 'as is' the code wasn't tweaked to give better performance from the DLL, I say this as you probably could improve performance by writing your own dot function, and getting rid of the array accesses, but that's another story.
The goal of this little is to show one possible structure when creating games & apps with machine code accelerated parts in them. Note:
The demo has no z clipping, so if you move the cube or bump the vertex counts and a point falls on 'zero', it'll crash from a divide by zero. Tweak the spacing /sections
variables accordingly. Attached:
Built and Running in PlayBASIC V1.64P
(pictured demo running on 2005 vintage Althon FX64 computer