Esempio n. 1
0
    void TriangulateCornerTerraces(
        Vector3 begin, HexCell beginCell,
        Vector3 left, HexCell leftCell,
        Vector3 right, HexCell rightCell
        )
    {
        Vector3 vert3 = Hexmetrics.TerraceLerp(begin, left, 1);
        Vector3 vert4 = Hexmetrics.TerraceLerp(begin, right, 1);
        Color   c3    = Hexmetrics.TerraceLerp(beginCell.color, leftCell.color, 1);
        Color   c4    = Hexmetrics.TerraceLerp(beginCell.color, rightCell.color, 1);

        terrain.AddTriangle(begin, vert3, vert4);
        terrain.AddTriangleColor(beginCell.color, c3, c4);

        for (int i = 2; i < Hexmetrics.terraceSteps; i++)
        {
            Vector3 vert1 = vert3;
            Vector3 vert2 = vert4;
            Color   c1    = c3;
            Color   c2    = c4;
            vert3 = Hexmetrics.TerraceLerp(begin, left, i);
            vert4 = Hexmetrics.TerraceLerp(begin, right, i);
            c3    = Hexmetrics.TerraceLerp(beginCell.color, leftCell.color, i);
            c4    = Hexmetrics.TerraceLerp(beginCell.color, rightCell.color, i);
            terrain.AddQuad(vert1, vert2, vert3, vert4);
            terrain.AddQuadColor(c1, c2, c3, c4);
        }

        terrain.AddQuad(vert3, vert4, left, right);
        terrain.AddQuadColor(c3, c4, leftCell.color, rightCell.color);
    }
Esempio n. 2
0
    void TriangulateEdgeTerraces(
        Vector3 beginLeft, Vector3 beginRight, HexCell beginCell,
        Vector3 endLeft, Vector3 endRight, HexCell endCell
        )
    {
        Vector3 vert3 = Hexmetrics.TerraceLerp(beginLeft, endLeft, 1);
        Vector3 vert4 = Hexmetrics.TerraceLerp(beginRight, endRight, 1);
        Color   c2    = Hexmetrics.TerraceLerp(beginCell.color, endCell.color, 1);

        terrain.AddQuad(beginLeft, beginRight, vert3, vert4);
        terrain.AddQuadColor(beginCell.color, c2);

        for (int i = 2; i < Hexmetrics.terraceSteps; i++)
        {
            Vector3 vert1 = vert3;
            Vector3 vert2 = vert4;
            Color   c1    = c2;
            vert3 = Hexmetrics.TerraceLerp(beginLeft, endLeft, i);
            vert4 = Hexmetrics.TerraceLerp(beginRight, endRight, i);
            c2    = Hexmetrics.TerraceLerp(beginCell.color, endCell.color, i);
            terrain.AddQuad(vert1, vert2, vert3, vert4);
            terrain.AddQuadColor(c1, c2);
        }

        terrain.AddQuad(vert3, vert4, endLeft, endRight);
        terrain.AddQuadColor(c2, endCell.color);
    }