Ejemplo n.º 1
0
    void FillFlipTriangleOverBound(ref FillFlipData flip)
    {
        TriangleData data;

        data.pt1.x = (0 < flip.dragDir.x ? halfSize.x : -halfSize.x);
        data.pt1.y = (0 < flip.dragDir.y ? halfSize.y : -halfSize.y);

        if (Mathf.Sign(flip.dragDir.x) == Mathf.Sign(flip.dragDir.y))
        {
            data.pt2.x = flip.crossX.x;
            data.pt2.y = flip.crossX.y;
            data.pt3.x = flip.crossY.x;
            data.pt3.y = flip.crossY.y;
        }
        else
        {
            data.pt2.x = flip.crossY.x;
            data.pt2.y = flip.crossY.y;
            data.pt3.x = flip.crossX.x;
            data.pt3.y = flip.crossX.y;
        }

        data.uv1.x = ((data.pt1.x + halfSize.x) / texSize.x);
        data.uv1.y = (data.pt1.y + halfSize.y) / texSize.y;
        data.uv2.x = ((data.pt2.x + halfSize.x) / texSize.x);
        data.uv2.y = (data.pt2.y + halfSize.y) / texSize.y;
        data.uv3.x = ((data.pt3.x + halfSize.x) / texSize.x);
        data.uv3.y = (data.pt3.y + halfSize.y) / texSize.y;


        FillTriangle(ref mCardBack, ref data);
    }
Ejemplo n.º 2
0
    void FillFlipDiamondOverBound(ref FillFlipData flip, ref Vector2 symmertyX, ref Vector2 symmertyY)
    {
        DiamondData data;

        if (Mathf.Sign(flip.dragDir.x) == Mathf.Sign(flip.dragDir.y))
        {
            data.pt1.x = flip.crossY.x;
            data.pt1.y = flip.crossY.y;

            data.pt2.x = symmertyY.x;
            data.pt2.y = symmertyY.y;

            data.pt3.x = flip.dragPt.x;
            data.pt3.y = flip.dragPt.y;

            data.pt4.x = flip.crossX.x;
            data.pt4.y = flip.crossX.y;

            data.pt5.x = symmertyX.x;
            data.pt5.y = symmertyX.y;

            data.uv2.x = (0 < flip.dragDir.x ? 1f : 0f);
            data.uv2.y = (0 < flip.dragDir.y ? 1f : 0f);
            data.uv5.x = (0 < flip.dragDir.x ? 0f : 1f);
            data.uv5.y = (0 < flip.dragDir.y ? 0f : 1f);
        }
        else
        {
            data.pt1.x = flip.crossX.x;
            data.pt1.y = flip.crossX.y;

            data.pt2.x = symmertyX.x;
            data.pt2.y = symmertyX.y;

            data.pt3.x = flip.dragPt.x;
            data.pt3.y = flip.dragPt.y;

            data.pt4.x = flip.crossY.x;
            data.pt4.y = flip.crossY.y;

            data.pt5.x = symmertyY.x;
            data.pt5.y = symmertyY.y;

            data.uv2.x = (0 < flip.dragDir.x ? 0f : 1f);
            data.uv2.y = (0 < flip.dragDir.y ? 0f : 1f);
            data.uv5.x = (0 < flip.dragDir.x ? 1f : 0f);
            data.uv5.y = (0 < flip.dragDir.y ? 1f : 0f);
        }

        data.uv1.x = 1f - (data.pt1.x + halfSize.x) / texSize.x;
        data.uv1.y = (data.pt1.y + halfSize.y) / texSize.y;

        data.uv3.x = (0 < flip.dragDir.x ? 1f : 0f);
        data.uv3.y = (0 < flip.dragDir.y ? 0f : 1f);

        data.uv4.x = 1f - (data.pt4.x + halfSize.x) / texSize.x;
        data.uv4.y = (data.pt4.y + halfSize.y) / texSize.y;

        FillDiamond(ref mCardFront, ref data);
    }
Ejemplo n.º 3
0
    void FillFlipTriangle(ref FillFlipData flip)
    {
        TriangleData data;

        data.pt1.x = flip.dragPt.x;
        data.pt1.y = flip.dragPt.y;
        data.uv1.x = flip.dragDir.x < 0 ? 0f : 1f;
        data.uv1.y = flip.dragDir.y < 0 ? 1f : 0f;

        if (Mathf.Sign(flip.dragDir.x) == Mathf.Sign(flip.dragDir.y))
        {
            data.pt2.x = flip.crossX.x;
            data.pt2.y = flip.crossX.y;
            data.pt3.x = flip.crossY.x;
            data.pt3.y = flip.crossY.y;
        }
        else
        {
            data.pt2.x = flip.crossY.x;
            data.pt2.y = flip.crossY.y;
            data.pt3.x = flip.crossX.x;
            data.pt3.y = flip.crossX.y;
        }

        data.uv2.x = 1f - ((data.pt2.x + halfSize.x) / texSize.x);
        data.uv2.y = (data.pt2.y + halfSize.y) / texSize.y;
        data.uv3.x = 1f - ((data.pt3.x + halfSize.x) / texSize.x);
        data.uv3.y = (data.pt3.y + halfSize.y) / texSize.y;


        FillTriangle(ref mCardFront, ref data);
    }
Ejemplo n.º 4
0
    void FillFlipQuadBackOverX(ref FillFlipData flip)
    {
        QuadData data;

        if (Mathf.Sign(flip.dragDir.x) == Mathf.Sign(flip.dragDir.y))
        {
            data.pt1.x = (0 < flip.dragDir.x ? -halfSize.x : halfSize.x);
            data.pt1.y = (0 < flip.dragDir.y ? halfSize.y : -halfSize.y);

            data.pt2.x = (0 < flip.dragDir.x ? halfSize.x : -halfSize.x);
            data.pt2.y = (0 < flip.dragDir.y ? halfSize.y : -halfSize.y);

            data.pt3.x = flip.crossX.x;
            data.pt3.y = flip.crossX.y;

            data.pt4.x = flip.crossY.x;
            data.pt4.y = flip.crossY.y;
        }
        else
        {
            data.pt1.x = (0 < flip.dragDir.x ? halfSize.x : -halfSize.x);
            data.pt1.y = (0 < flip.dragDir.y ? halfSize.y : -halfSize.y);

            data.pt2.x = (0 < flip.dragDir.x ? -halfSize.x : halfSize.x);
            data.pt2.y = (0 < flip.dragDir.y ? halfSize.y : -halfSize.y);

            data.pt3.x = flip.crossY.x;
            data.pt3.y = flip.crossY.y;

            data.pt4.x = flip.crossX.x;
            data.pt4.y = flip.crossX.y;
        }

        data.uv1.x = (data.pt1.x + halfSize.x) / texSize.x;
        data.uv1.y = (data.pt1.y + halfSize.y) / texSize.y;

        data.uv2.x = (data.pt2.x + halfSize.x) / texSize.x;
        data.uv2.y = (data.pt2.y + halfSize.y) / texSize.y;

        data.uv3.x = (data.pt3.x + halfSize.x) / texSize.x;
        data.uv3.y = (data.pt3.y + halfSize.y) / texSize.y;

        data.uv4.x = (data.pt4.x + halfSize.x) / texSize.x;
        data.uv4.y = (data.pt4.y + halfSize.y) / texSize.y;

        //Debug.LogFormat("pt1 = {0}, pt2 = {1}, pt3 = {2}, pt4 = {3}", data.pt1, data.pt2, data.pt3, data.pt4);
        //Debug.LogFormat("uv1 = {0}, uv2 = {1}, uv3 = {2}, uv4 = {3}", data.uv1, data.uv2, data.uv3, data.uv4);

        FillQuad(ref mCardBack, ref data);
    }
Ejemplo n.º 5
0
    void FillFlipQuadBackOverY(ref FillFlipData flip)
    {
        QuadData data;

        if (Mathf.Sign(flip.dragDir.x) == Mathf.Sign(flip.dragDir.y))
        {
            data.pt1.x = (0 < flip.dragDir.x ? halfSize.x : -halfSize.x);
            data.pt1.y = (0 < flip.dragDir.y ? halfSize.y : -halfSize.y);

            data.pt2.x = (0 < flip.dragDir.x ? halfSize.x : -halfSize.x);
            data.pt2.y = (0 < flip.dragDir.y ? -halfSize.y : halfSize.y);

            data.pt3.x = flip.crossX.x;
            data.pt3.y = flip.crossX.y;

            data.pt4.x = flip.crossY.x;
            data.pt4.y = flip.crossY.y;
        }
        else
        {
            data.pt1.x = (0 < flip.dragDir.x ? halfSize.x : -halfSize.x);
            data.pt1.y = (0 < flip.dragDir.y ? -halfSize.y : halfSize.y);

            data.pt2.x = (0 < flip.dragDir.x ? halfSize.x : -halfSize.x);
            data.pt2.y = (0 < flip.dragDir.y ? halfSize.y : -halfSize.y);

            data.pt3.x = flip.crossY.x;
            data.pt3.y = flip.crossY.y;

            data.pt4.x = flip.crossX.x;
            data.pt4.y = flip.crossX.y;
        }

        data.uv1.x = (data.pt1.x + halfSize.x) / texSize.x;
        data.uv1.y = (data.pt1.y + halfSize.y) / texSize.y;

        data.uv2.x = (data.pt2.x + halfSize.x) / texSize.x;
        data.uv2.y = (data.pt2.y + halfSize.y) / texSize.y;

        data.uv3.x = (data.pt3.x + halfSize.x) / texSize.x;
        data.uv3.y = (data.pt3.y + halfSize.y) / texSize.y;

        data.uv4.x = (data.pt4.x + halfSize.x) / texSize.x;
        data.uv4.y = (data.pt4.y + halfSize.y) / texSize.y;

        FillQuad(ref mCardBack, ref data);
    }
Ejemplo n.º 6
0
    void FillFlipDiamond(ref FillFlipData flip)
    {
        DiamondData data;

        if (0 < flip.dragDir.x && 0 < flip.dragDir.y)
        {
            // 0 < x  0 < y
            data.pt1.x = flip.crossY.x;
            data.pt1.y = flip.crossY.y;

            data.pt2.x = -halfSize.x;
            data.pt2.y = halfSize.y;

            data.pt3.x = halfSize.x;
            data.pt3.y = halfSize.y;

            data.pt4.x = flip.crossX.x;
            data.pt4.y = flip.crossX.y;

            data.pt5.x = halfSize.x;
            data.pt5.y = -halfSize.y;
        }
        else if (0 < flip.dragDir.x && flip.dragDir.y < 0)
        {
            // 0 < x  y < 0
            data.pt1.x = flip.crossX.x;
            data.pt1.y = flip.crossX.y;

            data.pt2.x = halfSize.x;
            data.pt2.y = halfSize.y;

            data.pt3.x = halfSize.x;
            data.pt3.y = -halfSize.y;

            data.pt4.x = flip.crossY.x;
            data.pt4.y = flip.crossY.y;

            data.pt5.x = -halfSize.x;
            data.pt5.y = -halfSize.y;
        }
        else if (flip.dragDir.x < 0 && flip.dragDir.y < 0)
        {
            // x < 0  y < 0
            data.pt1.x = flip.crossY.x;
            data.pt1.y = flip.crossY.y;

            data.pt2.x = halfSize.x;
            data.pt2.y = -halfSize.y;

            data.pt3.x = -halfSize.x;
            data.pt3.y = -halfSize.y;

            data.pt4.x = flip.crossX.x;
            data.pt4.y = flip.crossX.y;

            data.pt5.x = -halfSize.x;
            data.pt5.y = halfSize.y;
        }
        //else if(dragDir.x < 0 && 0 < dragDir.y)
        else
        {
            // x < 0  0 < y
            data.pt1.x = flip.crossX.x;
            data.pt1.y = flip.crossX.y;

            data.pt2.x = -halfSize.x;
            data.pt2.y = -halfSize.y;

            data.pt3.x = -halfSize.x;
            data.pt3.y = halfSize.y;

            data.pt4.x = flip.crossY.x;
            data.pt4.y = flip.crossY.y;

            data.pt5.x = halfSize.x;
            data.pt5.y = halfSize.y;
        }

        data.uv1.x = (data.pt1.x + halfSize.x) / texSize.x;
        data.uv1.y = (data.pt1.y + halfSize.y) / texSize.y;
        data.uv2.x = (data.pt2.x + halfSize.x) / texSize.x;
        data.uv2.y = (data.pt2.y + halfSize.y) / texSize.y;
        data.uv3.x = (data.pt3.x + halfSize.x) / texSize.x;
        data.uv3.y = (data.pt3.y + halfSize.y) / texSize.y;
        data.uv4.x = (data.pt4.x + halfSize.x) / texSize.x;
        data.uv4.y = (data.pt4.y + halfSize.y) / texSize.y;
        data.uv5.x = (data.pt5.x + halfSize.x) / texSize.x;
        data.uv5.y = (data.pt5.y + halfSize.y) / texSize.y;

        FillDiamond(ref mCardBack, ref data);
    }