Example #1
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void UpdateClipInfo()
    {
        //
        Rect a = clippedRect;

        a.x += transform.position.x;
        a.y += transform.position.y;

        // DELME {
        // switch ( plane ) {
        // case exSprite.Plane.XY:
        //     a.x += transform.position.x;
        //     a.y += transform.position.y;
        //     break;
        // case exSprite.Plane.XZ:
        //     a.x += transform.position.x;
        //     a.y += transform.position.z;
        //     break;
        // case exSprite.Plane.ZY:
        //     a.x += transform.position.z;
        //     a.y += transform.position.y;
        //     break;
        // }
        // } DELME end

        //
        for (int i = 0; i < planes.Count; ++i)
        {
            exPlane p = planes[i];
            if (p == null)
            {
                planes.RemoveAt(i);
                --i;
                continue;
            }

            exPlane.ClipInfo newClipInfo = new exPlane.ClipInfo();

            //
            Rect b = p.boundingRect;
            b.x += p.transform.position.x;
            b.y += p.transform.position.y;

            // DELME {
            // switch ( plane ) {
            // case exSprite.Plane.XY:
            //     b.x += p.transform.position.x;
            //     b.y += p.transform.position.y;
            //     break;
            // case exSprite.Plane.XZ:
            //     b.x += p.transform.position.x;
            //     b.y += p.transform.position.z;
            //     break;
            // case exSprite.Plane.ZY:
            //     b.x += p.transform.position.z;
            //     b.y += p.transform.position.y;
            //     break;
            // }
            // } DELME end

            //
            if (a.xMin > b.xMin)
            {
                newClipInfo.left    = (a.xMin - b.xMin) / b.width;
                newClipInfo.clipped = true;
            }
            if (b.xMax > a.xMax)
            {
                newClipInfo.right   = (b.xMax - a.xMax) / b.width;
                newClipInfo.clipped = true;
            }

            if (a.yMin > b.yMin)
            {
                newClipInfo.top     = (a.yMin - b.yMin) / b.height;
                newClipInfo.clipped = true;
            }
            if (b.yMax > a.yMax)
            {
                newClipInfo.bottom  = (b.yMax - a.yMax) / b.height;
                newClipInfo.clipped = true;
            }
            p.clipInfo = newClipInfo;
        }
    }
Example #2
0
    // ------------------------------------------------------------------ 
    // Desc: 
    // ------------------------------------------------------------------ 

    public void UpdateClipInfo () {
        //
        Rect a = clippedRect;
        a.x += transform.position.x;
        a.y += transform.position.y;

        // DELME { 
        // switch ( plane ) {
        // case exSprite.Plane.XY:
        //     a.x += transform.position.x;
        //     a.y += transform.position.y;
        //     break;
        // case exSprite.Plane.XZ:
        //     a.x += transform.position.x;
        //     a.y += transform.position.z;
        //     break;
        // case exSprite.Plane.ZY:
        //     a.x += transform.position.z;
        //     a.y += transform.position.y;
        //     break;
        // }
        // } DELME end 

        //
        for ( int i = 0; i < planes.Count; ++i ) {
            exPlane p = planes[i];
            if ( p == null ) {
                planes.RemoveAt(i);
                --i;
                continue;
            }

            exPlane.ClipInfo newClipInfo = new exPlane.ClipInfo(); 

            //
            Rect b = p.boundingRect;
            b.x += p.transform.position.x;
            b.y += p.transform.position.y;

            // DELME { 
            // switch ( plane ) {
            // case exSprite.Plane.XY:
            //     b.x += p.transform.position.x;
            //     b.y += p.transform.position.y;
            //     break;
            // case exSprite.Plane.XZ:
            //     b.x += p.transform.position.x;
            //     b.y += p.transform.position.z;
            //     break;
            // case exSprite.Plane.ZY:
            //     b.x += p.transform.position.z;
            //     b.y += p.transform.position.y;
            //     break;
            // }
            // } DELME end 

            //
            if ( a.xMin > b.xMin ) {
                newClipInfo.left = (a.xMin - b.xMin) / b.width;
                newClipInfo.clipped = true;
            }
            if ( b.xMax > a.xMax ) {
                newClipInfo.right = (b.xMax - a.xMax) / b.width;
                newClipInfo.clipped = true;
            }

            if ( a.yMin > b.yMin ) {
                newClipInfo.top = (a.yMin - b.yMin) / b.height;
                newClipInfo.clipped = true;
            }
            if ( b.yMax > a.yMax ) {
                newClipInfo.bottom = (b.yMax - a.yMax) / b.height;
                newClipInfo.clipped = true;
            }
            p.clipInfo = newClipInfo;
        }
    }