コード例 #1
0
    public void Generate()
    {
        switch (ShapeType)
        {
        case ShapeTypes.Wythoff:
            var wythoff1 = new WythoffPoly(PolyType1, P1, Q1);
            wythoff1.BuildFaces();
            poly1 = new ConwayPoly(wythoff1);
            var wythoff2 = new WythoffPoly(PolyType2, P2, Q2);
            wythoff2.BuildFaces();
            poly2 = new ConwayPoly(wythoff2);
            break;

        case ShapeTypes.Johnson:
            poly1 = JohnsonPoly.Build(JohnsonPolyType1, P1);
            poly2 = JohnsonPoly.Build(JohnsonPolyType2, P2);
            break;

        case ShapeTypes.Grid:
            poly1 = Grids.Grids.MakeGrid(GridType, GridShape1, P1, Q1, false);
            poly2 = Grids.Grids.MakeGrid(GridType, GridShape2, P2, Q2, false);
            break;
        }

        var o1 = new OpParams {
            valueA = op1Amount1, valueB = op1Amount2, facesel = op1Facesel
        };

        poly1 = poly1.ApplyOp(op1, o1);

        var o2 = new OpParams {
            valueA = op2Amount1, valueB = op2Amount2, facesel = op2Facesel
        };

        poly2 = poly2.ApplyOp(op2, o2);

        poly1.Morph(poly2, morphAmount, reverseVertexOrder);

        // Final Mesh
        var mesh = PolyMeshBuilder.BuildMeshFromConwayPoly(poly1, false, null, ColorMethod);

        GetComponent <MeshFilter>().mesh = mesh;
    }