Simple 3D morphing with _MAPTRIANGLE
#6
(01-10-2023, 11:41 PM)RokCoder Wrote: I went on a complete tangent from what I was intending to do this evening when I stumbled upon _MAPTRIANGLE!

First this project creates the vertices of a cube - but it does this based on a hard-coded TESSELATION constant. If this is set to one then each face of the cube has four vertices, if it's set to two then each face has nine vertices, 16 vertices for a value of 4, etc.

The reason for allowing the tessellation is that the project continually morphs between a cube and a sphere (while rotating on three axes). The higher the tessellation value, the better the quality of the sphere but also the greater the number of vertices, calculations, triangles to render, etc. I wanted the code to be clear and well commented so it isn't optimised at all (which is why I've set the tessellation value quite low).

The ZIP file containing the project and its assets is attached. As always, you can also find the code over at my GitHub.





On a side note, does anyone know if _CLOCKWISE and _ANTICLOCKWISE actually do anything at the moment in _MAPTRIANGLE? I tried using it to do the back-face culling but it didn't seem to have any effect so I ended up using cross-products for the culling.

On a second side note, is there any command for altering the brightness while rendering? I had a brief go with _SETALPHA for each triangle being rendered but (a) it didn't seem to affect _MAPTRIANGLE and (b) the performance impact was horrendous.

_CLockWise and _AntiClockWise only work with hardware images, and not with software screens.  Wink
Reply


Messages In This Thread
RE: Simple 3D morphing with _MAPTRIANGLE - by SMcNeill - 01-11-2023, 03:33 AM



Users browsing this thread: 2 Guest(s)