Пример #1
0
    public void Generate()
    {
        poly = Grids.Grids.MakeGrid(GridType, GridShape, width, depth);
        poly.ClearTags();
        poly.TagFaces("#FFFFFF", filter: whiteFilter);
        poly.TagFaces("#000000", filter: blackFilter);

        if (ApplyOp)
        {
            var o1 = new OpParams {
                valueA = op1Amount1, valueB = op1Amount2, facesel = op1Facesel
            };
            poly = poly.ApplyOp(op1, o1);
            var o2 = new OpParams {
                valueA = op2Amount1, valueB = op2Amount2, facesel = op2Facesel
            };
            poly = poly.ApplyOp(op2, o2);
            var o3 = new OpParams {
                valueA = op3Amount1, valueB = op3Amount2, facesel = op3Facesel
            };
            poly = poly.ApplyOp(op3, o3);
        }
        var mesh = PolyMeshBuilder.BuildMeshFromConwayPoly(poly, false, meshColors, ColorMethod);

        GetComponent <MeshFilter>().mesh = mesh;
    }
Пример #2
0
    public void Generate()
    {
        poly = JohnsonPoly.Polygon(sides);
        poly = poly.Loft(new OpParams(0.5f));
        var gableSel = FaceSelections.Existing;

        for (int i = 0; i < Iterations; i++)
        {
            poly = poly.Gable(new OpParams(Bud1, Bud2, FaceSelections.Existing));

            poly.ClearTags();
            var newFaces = poly.GetFaceSelection(FaceSelections.New);
            poly.TagFaces("fork1", filter: x => x.index == newFaces.FirstOrDefault(), introvert: true);
            poly.TagFaces("fork2", filter: x => x.index == newFaces.LastOrDefault(), introvert: true);

            poly = poly.Loft(new OpParams(BranchLengthScale, BranchLength, FaceSelections.New));
            // poly = poly.Loft(new OpParams((5f-i)/10f, (BranchLength-i)/BranchLengthScale, FaceSelections.New));
            poly = poly.FaceSlide(new OpParams(amount1, direction1 * i, selectByTags: "fork1"));
            poly = poly.FaceSlide(new OpParams(amount2, direction2 * i, selectByTags: "fork2"));
        }

        // poly = poly.Transform(Position, Rotation, Scale);
        var mesh = PolyMeshBuilder.BuildMeshFromConwayPoly(poly, false, null, ColorMethod);

        GetComponent <MeshFilter>().mesh = mesh;
    }
Пример #3
0
    public void Generate()
    {
        poly = JohnsonPoly.Polygon(sides);
        poly = poly.Loft(new OpParams(0.5f));

        for (int i = 0; i < 3; i++)
        {
            poly = poly.SplitFaces(new OpParams(FaceSelections.Existing));

            poly.ClearTags();
            poly.TagFaces("split1", FaceSelections.New, introvert: true);
            poly.TagFaces("split2", FaceSelections.New, introvert: true);

            poly = poly.Loft(new OpParams(0.01f, 1f, FaceSelections.AllNew));
            poly = poly.FaceSlide(new OpParams(amount1, direction1 * i, selectByTags: "split1"));
            poly = poly.FaceSlide(new OpParams(amount2, direction2 * i, selectByTags: "split2"));
        }

        poly = poly.Transform(Position, Rotation, Scale);
        var mesh = PolyMeshBuilder.BuildMeshFromConwayPoly(poly, false, null, ColorMethod);

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