コード例 #1
0
ファイル: UIQuad.cs プロジェクト: slb1988/agame
        private UIQuad Split(UIQuad another, int anotherUIid, List <UIQuad> unOverlappedList, int dir, bool revertUVid)
        {
            float splitPoint = Mathf.Max(this.min[dir], another.min[dir]);
            float num2       = Mathf.Min(this.max[dir], another.max[dir]);

            if ((this.min[dir] < splitPoint) && (unOverlappedList != null))
            {
                unOverlappedList.Add(this.GetLowerPart(splitPoint, dir, anotherUIid, revertUVid));
            }
            if ((num2 < this.max[dir]) && (unOverlappedList != null))
            {
                unOverlappedList.Add(this.GetHigherPart(num2, dir, anotherUIid, revertUVid));
            }
            UIQuad quad = null;

            if (splitPoint < num2)
            {
                quad = this.GetMiddlePart(splitPoint, num2, anotherUIid, dir);
                if (!revertUVid)
                {
                    quad.uvMin[anotherUIid][dir] = Mathf.Lerp(another.uvMin[anotherUIid][dir], another.uvMax[anotherUIid][dir], (splitPoint - another.min[dir]) / (another.max[dir] - another.min[dir]));
                    quad.uvMax[anotherUIid][dir] = Mathf.Lerp(another.uvMin[anotherUIid][dir], another.uvMax[anotherUIid][dir], (num2 - another.min[dir]) / (another.max[dir] - another.min[dir]));
                }
            }
            return(quad);
        }
コード例 #2
0
ファイル: UIQuad.cs プロジェクト: slb1988/agame
        public UIQuad Split(UIQuad another, int anotherUIid = 1, List <UIQuad> unOverlappedList = null, bool revertUVid = false)
        {
            UIQuad quad  = null;
            UIQuad quad2 = this.Split(another, anotherUIid, unOverlappedList, 0, revertUVid);

            if (quad2 != null)
            {
                quad = quad2.Split(another, anotherUIid, unOverlappedList, 1, revertUVid);
            }
            return(quad);
        }
コード例 #3
0
ファイル: UIQuad.cs プロジェクト: slb1988/agame
        private UIQuad GetMiddlePart(float splitPoint1, float splitPoint2, int anotherUIid, int dir)
        {
            UIQuad quad = new UIQuad(this);

            quad.min[dir] = splitPoint1;
            quad.max[dir] = splitPoint2;
            float t    = (splitPoint1 - this.min[dir]) / (this.max[dir] - this.min[dir]);
            float num2 = (splitPoint2 - this.min[dir]) / (this.max[dir] - this.min[dir]);

            for (int i = 0; i < MAX_UV_COUNT; i++)
            {
                quad.uvMin[i][dir] = Mathf.Lerp(this.uvMin[i][dir], this.uvMax[i][dir], t);
                quad.uvMax[i][dir] = Mathf.Lerp(this.uvMin[i][dir], this.uvMax[i][dir], num2);
            }
            return(quad);
        }
コード例 #4
0
ファイル: UIQuad.cs プロジェクト: slb1988/agame
        private UIQuad GetLowerPart(float splitPoint, int dir, int anotherUIid, bool revertUIid)
        {
            splitPoint = Mathf.Min(this.max[dir], splitPoint);
            UIQuad quad = new UIQuad(this);

            quad.max[dir] = splitPoint;
            float t = (splitPoint - this.min[dir]) / (this.max[dir] - this.min[dir]);

            if (!revertUIid)
            {
                for (int j = 0; j < MAX_UV_COUNT; j++)
                {
                    if (j != anotherUIid)
                    {
                        quad.uvMax[j][dir] = Mathf.Lerp(this.uvMin[j][dir], this.uvMax[j][dir], t);
                    }
                    else
                    {
                        quad.uvMax[j][dir] = -1f;
                    }
                }
                return(quad);
            }
            for (int i = 0; i < MAX_UV_COUNT; i++)
            {
                if (i != anotherUIid)
                {
                    quad.uvMax[i][dir] = -1f;
                }
                else
                {
                    quad.uvMax[i][dir] = Mathf.Lerp(this.uvMin[i][dir], this.uvMax[i][dir], t);
                }
            }
            return(quad);
        }
コード例 #5
0
ファイル: UIQuad.cs プロジェクト: slb1988/agame
 public UIQuad(UIQuad quad)
 {
     this.Set(quad.min, quad.max, quad.uvMin[0], quad.uvMax[0], quad.uvMin[1], quad.uvMax[1], quad.uvMin[2], quad.uvMax[2], quad.uvMin[3], quad.uvMax[3]);
 }