Ejemplo n.º 1
0
    private GameObject CreateZAxisExtrudeMapping(float x, float z)
    {
        GameObject obj = CreateChild(x, z);

        obj.name = "ZAxisExtrudeMapping";

        float z_2 = 0.5f;
        float w_2 = 0.3f;

        PointList pointsA = new PointList();

        pointsA.Add(w_2, -w_2, -z_2);
        pointsA.Add(w_2, w_2, -z_2);
        pointsA.Add(-w_2, w_2, -z_2);
        pointsA.Add(-w_2, -w_2, -z_2);

        PointList        pointsB = pointsA.Translate(new Vector3(0, 0, 2f * z_2));
        List <PointList> list    = pointsA.Bridge(pointsB, PointList.BridgeMode.CloseDuplicate);

        AutoMapper.ComputeUVMapper(ref list);
        AutoMapper.Connect(ref list);

        MeshBuilder builder = new MeshBuilder();

        builder.Cap(list);
        Mesh mesh = builder.Build();

        NodeBuilder.SetMesh(obj, mesh);
        NodeBuilder.SetMaterial(obj, material);
        return(obj);
    }
Ejemplo n.º 2
0
    private GameObject CreateYZFlatMapping(float x, float z)
    {
        GameObject obj = CreateChild(x, z);

        obj.name = "YZFlatMapping";

        float w_2 = 0.3f;

        PointList points = new PointList();

        points.Add(0, -w_2, -w_2);
        points.Add(0, -w_2, w_2);
        points.Add(0, w_2, w_2);
        points.Add(0, w_2, -w_2);

        AutoMapper.ComputeUVMapper(ref points);

        MeshBuilder builder = new MeshBuilder();

        builder.Cap(points);
        Mesh mesh = builder.Build();

        NodeBuilder.SetMesh(obj, mesh);
        NodeBuilder.SetMaterial(obj, material);

        return(obj);
    }