Exemplo n.º 1
0
 public Quad(ImageSmoothMask.Quad quad)
 {
     this.min    = quad.min;
     this.max    = quad.max;
     this.uvMin0 = quad.uvMin0;
     this.uvMax0 = quad.uvMax0;
     this.uvMin1 = quad.uvMin1;
     this.uvMax1 = quad.uvMax1;
 }
Exemplo n.º 2
0
 public ImageSmoothMask.Quad Split(ImageSmoothMask.Quad another, List <ImageSmoothMask.Quad> unOverlappedList = null)
 {
     ImageSmoothMask.Quad quad  = null;
     ImageSmoothMask.Quad quad2 = this.Split(another, unOverlappedList, 0);
     if (quad2 != null)
     {
         quad = quad2.Split(another, unOverlappedList, 1);
     }
     return(quad);
 }
Exemplo n.º 3
0
            private ImageSmoothMask.Quad GetLowerPart(float splitPoint, float uv1, int dir)
            {
                splitPoint = Mathf.Min(this.max[dir], splitPoint);
                ImageSmoothMask.Quad quad = new ImageSmoothMask.Quad(this);
                quad.max[dir] = splitPoint;
                float t = (splitPoint - this.min[dir]) / (this.max[dir] - this.min[dir]);

                quad.uvMax0[dir] = Mathf.Lerp(this.uvMin0[dir], this.uvMax0[dir], t);
                quad.uvMax1[dir] = uv1;
                return(quad);
            }
Exemplo n.º 4
0
            private ImageSmoothMask.Quad GetMiddlePart(float splitPoint1, float splitPoint2, int dir)
            {
                ImageSmoothMask.Quad quad = new ImageSmoothMask.Quad(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]);

                quad.uvMin0[dir] = Mathf.Lerp(this.uvMin0[dir], this.uvMax0[dir], t);
                quad.uvMin1[dir] = Mathf.Lerp(this.uvMin1[dir], this.uvMax1[dir], t);
                quad.uvMax0[dir] = Mathf.Lerp(this.uvMin0[dir], this.uvMax0[dir], num2);
                quad.uvMax1[dir] = Mathf.Lerp(this.uvMin1[dir], this.uvMax1[dir], num2);
                return(quad);
            }
Exemplo n.º 5
0
            public ImageSmoothMask.Quad GridSplit(ImageSmoothMask.Quad another, List <ImageSmoothMask.Quad> unOverlappedList)
            {
                ImageSmoothMask.Quad        quad = null;
                List <ImageSmoothMask.Quad> list = new List <ImageSmoothMask.Quad>();

                ImageSmoothMask.Quad item = this.Split(another, list, 0);
                if (item != null)
                {
                    quad = item.Split(another, unOverlappedList, 1);
                }
                foreach (ImageSmoothMask.Quad quad3 in list)
                {
                    item = quad3.Split(another, unOverlappedList, 1);
                    if (item != null)
                    {
                        unOverlappedList.Add(item);
                    }
                }
                return(quad);
            }
Exemplo n.º 6
0
            private ImageSmoothMask.Quad Split(ImageSmoothMask.Quad another, List <ImageSmoothMask.Quad> unOverlappedList, int dir)
            {
                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, another.uvMin1[dir], dir));
                }
                if ((num2 < this.max[dir]) && (unOverlappedList != null))
                {
                    unOverlappedList.Add(this.GetHigherPart(num2, another.uvMax1[dir], dir));
                }
                ImageSmoothMask.Quad quad = null;
                if (splitPoint < num2)
                {
                    quad             = this.GetMiddlePart(splitPoint, num2, dir);
                    quad.uvMin1[dir] = Mathf.Lerp(another.uvMin1[dir], another.uvMax1[dir], (splitPoint - another.min[dir]) / (another.max[dir] - another.min[dir]));
                    quad.uvMax1[dir] = Mathf.Lerp(another.uvMin1[dir], another.uvMax1[dir], (num2 - another.min[dir]) / (another.max[dir] - another.min[dir]));
                }
                return(quad);
            }