Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple 3D morphing with _MAPTRIANGLE
#1
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.

   


.zip   morph.zip (Size: 419.28 KB / Downloads: 51)

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.
RokCoder - dabbling in QB64pe for fun
Reply


Messages In This Thread
Simple 3D morphing with _MAPTRIANGLE - by RokCoder - 01-10-2023, 11:41 PM



Users browsing this thread: 2 Guest(s)