Esempio n. 1
0
    private void TriangulateGapCell(int i)
    {
        Voxel dummySwap = dummyT;

        dummySwap.BecomeDummyOf(xNeighbor.voxels[i + 1], gridSize, 1);
        dummyT = dummyX;
        dummyX = dummySwap;
        TriangulateCell(voxels[i], dummyT, voxels[i + resolution], dummyX);
    }
Esempio n. 2
0
    private void Triangulate()
    {
        vertices.Clear();
        triangles.Clear();
        mesh.Clear();

        if (xNeighbor != null)
        {
            dummyX.BecomeDummyOf(xNeighbor.voxels[0], gridSize, 1);
        }
        TriangulateCellRows();
        if (yNeighbor != null)
        {
            TriangulateGapRow();
        }

        mesh.vertices  = vertices.ToArray();
        mesh.triangles = triangles.ToArray();
    }
Esempio n. 3
0
    private void TriangulateGapRow()
    {
        dummyY.BecomeDummyOf(yNeighbor.voxels[0], gridSize, 0);
        int cells  = resolution - 1;
        int offset = cells * resolution;

        for (int x = 0; x < cells; x++)
        {
            Voxel dummySwap = dummyT;
            dummySwap.BecomeDummyOf(yNeighbor.voxels[x + 1], gridSize, 0);
            dummyT = dummyY;
            dummyY = dummySwap;
            TriangulateCell(voxels[x + offset], voxels[x + offset + 1], dummyT, dummyY);
        }
        if (xNeighbor != null)
        {
            dummyT.BecomeDummyOf(xyNeighbor.voxels[0], gridSize, 2);
            TriangulateCell(voxels[voxels.Length - 1], dummyX, dummyY, dummyT);
        }
    }