I’m trying out a Marching Cubes algorithm as described in the [Nvidia GPU Gems][1]:
However, I’m hitting a wall with my knowledge of working directly with bits, and concating them into a workable byte of information.
As the diagram shows, each corner is represented by the algorithm as being a 1 or a 0 based on a predefined density function. 1 means the corner lies within the volume, and 0 means it is outside the volume.
My problem, though, is that I’m unclear on how exactly I should go about converting the bit information into a usable uint8. Do I store the 8-digit bit string as an FString, a TCHAR, or an array of some sort that I can convert to an int?
I done this before, trying to implement marching cubes, This can be done by getting your grid points, and if the value is =>0, then add 1, like so
(GridPoints are your voxels in the cube)
Byte Caseindex = 0
If GridPoint[0] => 0 Then Caseindex =+ 1
If GridPoint[1] => 0 Then Caseindex =+ 2
If GridPoint[2] => 0 Then Caseindex =+ 4
If GridPoint[3] => 0 Then Caseindex =+ 8
If GridPoint[4] => 0 Then Caseindex =+ 16
If GridPoint[5] => 0 Then Caseindex =+ 32
If GridPoint[6] => 0 Then Caseindex =+ 64
If GridPoint[7] => 0 Then Caseindex =+ 128
Return(CaseIndex)