Example #1
0
    public Vector2 GetUVForIndex(int i)
    {
        MC_EdgeLoop eL = (MC_EdgeLoop)edgeLoops[0];

        return(eL.GetUVForIndex(i));
        //return new Vector2(raw.x/((float)imageWidth), raw.y/((float)imageHeight));
    }
Example #2
0
    void MakeOutsideEdge()
    {
        // order the edges
        // start first edge loop with the first outside edge
        MC_EdgeLoop currentEdgeLoop = new MC_EdgeLoop((MC_Edge)edges[0]);

        edges.RemoveAt(0);
        edgeLoops.Add(currentEdgeLoop);

        while (edges.Count > 0)
        {
            // if the currentEdgeLoop is fully closed make a new edge loop
            if (currentEdgeLoop.IsClosed())
            {
                MC_EdgeLoop nextEdgeLoop = new MC_EdgeLoop((MC_Edge)edges[0]);
                //Debug.LogWarning("SimpleSurfaceEdge::MakeOutsideEdge: adding another edge loop, last one was " + currentEdgeLoop.orderedEdges.Count + " edges long");
                //Debug.LogWarning("    this means your image has islands, I hope that's what you want.");
                edges.RemoveAt(0);
                edgeLoops.Add(nextEdgeLoop);
                currentEdgeLoop = nextEdgeLoop;
            }
            // test each edge to see if it fits into the edgeloop
            ArrayList deleteEdges = new ArrayList();
            for (int i = 0; i < edges.Count; i++)
            {
                MC_Edge e = (MC_Edge)edges[i];
                if (currentEdgeLoop.AddEdge(e))                   // try to add the edge
                {
                    deleteEdges.Add(e);
                }
            }
            // delete the added edges
            for (int i = 0; i < deleteEdges.Count; i++)
            {
                edges.Remove((MC_Edge)deleteEdges[i]);
            }
        }
    }
    void MakeOutsideEdge()
    {
        // order the edges
        // start first edge loop with the first outside edge
        MC_EdgeLoop currentEdgeLoop = new MC_EdgeLoop((MC_Edge)edges[0]);
        edges.RemoveAt(0);
        edgeLoops.Add(currentEdgeLoop);

        while (edges.Count > 0) {
            // if the currentEdgeLoop is fully closed make a new edge loop
            if (currentEdgeLoop.IsClosed()) {
                MC_EdgeLoop nextEdgeLoop = new MC_EdgeLoop((MC_Edge)edges[0]);
                //Debug.LogWarning("SimpleSurfaceEdge::MakeOutsideEdge: adding another edge loop, last one was " + currentEdgeLoop.orderedEdges.Count + " edges long");
                //Debug.LogWarning("    this means your image has islands, I hope that's what you want.");
                edges.RemoveAt(0);
                edgeLoops.Add(nextEdgeLoop);
                currentEdgeLoop = nextEdgeLoop;
            }
            // test each edge to see if it fits into the edgeloop
            ArrayList deleteEdges = new ArrayList();
            for (int i = 0; i < edges.Count; i++) {
                MC_Edge e = (MC_Edge) edges[i];
                if (currentEdgeLoop.AddEdge(e)) { // try to add the edge
                    deleteEdges.Add(e);
                }
            }
            // delete the added edges
            for (int i = 0; i < deleteEdges.Count; i++) {
                edges.Remove( (MC_Edge)deleteEdges[i] );
            }
        }
    }
Example #4
0
    public Vector2[] GetOutsideEdgeVertices()
    {
        MC_EdgeLoop eL = (MC_EdgeLoop)edgeLoops[0];

        return(eL.GetVertexList());
    }