Isosurface.AdaptiveDualContouring.OctreeNode.ProcessFace C# (CSharp) Method

ProcessFace() public static method

public static ProcessFace ( OctreeNode nodes, int direction, List indexes ) : void
nodes OctreeNode
direction int
indexes List
return void
        public static void ProcessFace(OctreeNode[] nodes, int direction, List<int> indexes)
        {
            if (nodes[0] == null || nodes[1] == null)
                return;

            if (nodes[0].type == OctreeNodeType.Internal || nodes[1].type == OctreeNodeType.Internal)
            {
                for (int i = 0; i < 4; i++)
                {
                    OctreeNode[] face_nodes = new OctreeNode[2];

                    for (int j = 0; j < 2; j++)
                    {
                        if (nodes[j].type != OctreeNodeType.Internal)
                            face_nodes[j] = nodes[j];
                        else
                            face_nodes[j] = nodes[j].children[faceProcFaceMask[direction, i, j]];
                    }

                    ProcessFace(face_nodes, faceProcFaceMask[direction, i, 2], indexes);
                }

                int[,] orders =
                {
                    { 0, 0, 1, 1 },
                    { 0, 1, 0, 1 },
                };

                for (int i = 0; i < 4; i++)
                {
                    OctreeNode[] edge_nodes = new OctreeNode[4];

                    for (int j = 0; j < 4; j++)
                    {
                        if (nodes[orders[faceProcEdgeMask[direction, i, 0], j]].type == OctreeNodeType.Leaf || nodes[orders[faceProcEdgeMask[direction, i, 0], j]].type == OctreeNodeType.Pseudo)
                            edge_nodes[j] = nodes[orders[faceProcEdgeMask[direction, i, 0], j]];
                        else
                            edge_nodes[j] = nodes[orders[faceProcEdgeMask[direction, i, 0], j]].children[faceProcEdgeMask[direction, i, 1 + j]];
                    }

                    ProcessEdge(edge_nodes, faceProcEdgeMask[direction, i, 5], indexes);
                }
            }
        }