Here is my code so far:
for (int x=0; x < bX; x++) //x axis
{
for (int y=0; y < bY; y++) //y axis
{
for (int z=0; z < bZ; z++) //z axis
{
bool cubeVerts[8];
cubeVerts[0] = points[x][y][z]; // Back top left vert.
cubeVerts[1] = points[x+1][y][z]; // Back top right vert.
cubeVerts[2] = points[x][y+1][z]; // Back bottom left vert.
cubeVerts[3] = points[x+1][y+1][z]; // Back bottom right vert.
cubeVerts[4] = points[x][y][z+1]; // Front top left vert.
cubeVerts[5] = points[x+1][y][z+1]; // Front top right vert.
cubeVerts[6] = points[x][y+1][z+1]; // Front bottom left vert.
cubeVerts[7] = points[x+1][y+1][z+1]; // Front bottom right vert.
int cubeIndex = int(0);
for (int n=0; n < 8; n++)
{
if(cubeVerts[n])
cubeIndex |= (1 << n);
}
if ((cubeIndex != 0) && (cubeIndex != 255))
{
// Do interpolating stuff.
}
}
}
}
Can anybody help me or point me to a resource that explains the process simply? Thanks.