Exemplo n.º 1
0
    public void inset(LucygenPolygonSet polys, float interpolation)
    {
        StitchPolygons(polys);

        List <int> verts = polys.getUniqueVertices();

        //Calculate the average center of all the vertices
        //in these polygons.

        Vector3 center = Vector3.zero;

        foreach (int vert in verts)
        {
            center += m_VerticesList[vert];
        }

        center /= verts.Count;

        //Pull each vertex towards the center, then correct
        //its height so that it's as far from the center of
        //the planet as it was before.

        foreach (int vert in verts)
        {
            Vector3 v = m_VerticesList[vert];

            float height = v.magnitude;

            v = Vector3.Lerp(v, center, interpolation);

            v = v.normalized * height;

            m_VerticesList[vert] = v;
        }
    }
Exemplo n.º 2
0
    public void extrude(LucygenPolygonSet polys, float height)
    {
        StitchPolygons(polys);

        List <int> verts = polys.getUniqueVertices();

        foreach (int vert in verts)
        {
            Vector3 v = m_VerticesList[vert];

            v = v.normalized * (v.magnitude + height);

            m_VerticesList[vert] = v;
        }
    }