I have a 1D array and I wish to access it like a 3D array.
If I know the values of the 3 dimensions
then I can create the 1D array using array[width * height * depth].
How can I now access the indices of the 1D array correctly if I have 3D indices (x, y, z)?
I thought it would be something along the lines of
index1D = x * width + y * height + z;
but that doesn't work. I'm still thinking in 2D though.