コード例 #1
0
    public override void Triangulate(HexMesh mesh)
    {
        Vector3 v1 = beginCorner;
        Vector3 v2 = beginCorner;
        Color   c1 = beginCell.Color;
        Color   c2 = beginCell.Color;

        for (int step = 1; step < HexMetrics.terraceSteps + 1; ++step)
        {
            Vector3 v3 = HexMetrics.TerraceLerp(beginCorner, leftCorner, step);
            Vector3 v4 = HexMetrics.TerraceLerp(beginCorner, rightCorner, step);

            Color c3 = HexMetrics.ColorLerp(beginCell.Color, leftCell.Color, step);
            Color c4 = HexMetrics.ColorLerp(beginCell.Color, rightCell.Color, step);

            if (step == 1)
            {
                mesh.AddTriangle(v1, v3, v4);
                mesh.AddTriangleColor(c1, c3, c4);
            }
            else
            {
                mesh.AddQuad(v1, v2, v3, v4);
                mesh.AddQuadColor(c1, c2, c3, c4);
            }
            v1 = v3;
            v2 = v4;
            c1 = c3;
            c2 = c4;
        }
    }
コード例 #2
0
    public override void Triangulate(HexMesh mesh)
    {
        EdgeVertices e1 = this.edge1;
        Color        c1 = this.color1;

        for (int step = 1; step < HexMetrics.terraceSteps + 1; ++step)
        {
            EdgeVertices e2 = EdgeVertices.TerraceLerp(this.edge1, this.edge2, step);
            Color        c2 = HexMetrics.ColorLerp(this.color1, this.color2, step);
            HexEdge.TriangulateQuad(mesh, e1, e2, c1, c2);

            c1 = c2;
            e1 = e2;
        }
    }
コード例 #3
0
    protected static void TriangulateBoundaryTriangle(
        HexMesh mesh,
        Vector3 beginCorner, HexCell beginCell,
        Vector3 leftCorner, HexCell leftCell,
        Vector3 boundary, Color boundaryColor
        )
    {
        Vector3 v1 = beginCorner;
        Color   c1 = beginCell.Color;

        for (int step = 1; step < HexMetrics.terraceSteps + 1; ++step)
        {
            Vector3 v3 = HexMetrics.TerraceLerp(beginCorner, leftCorner, step);

            Color c3 = HexMetrics.ColorLerp(beginCell.Color, leftCell.Color, step);

            mesh.AddTriangle(HexMetrics.Perturb(v1), HexMetrics.Perturb(v3), boundary, false);
            mesh.AddTriangleColor(c1, c3, boundaryColor);

            v1 = v3;
            c1 = c3;
        }
    }