示例#1
0
        public DispCornerNeighbors GetCornerNeighbor(NeighborCorner corner)
        {
            switch ((int)corner)
            {
            case 0:
                return(_cornerNeighbors0);

            case 1:
                return(_cornerNeighbors1);

            case 2:
                return(_cornerNeighbors2);

            case 3:
                return(_cornerNeighbors3);

            default:
                throw new IndexOutOfRangeException();
            }
        }
示例#2
0
        private void AddCornerNeighbor(NeighborCorner corner, ushort index)
        {
            var min  = new Vector2(0f, 0f);
            var size = 1f;

            switch (corner)
            {
            case NeighborCorner.LowerLeft:
                min.X -= size;
                min.Y -= size;
                break;

            case NeighborCorner.LowerRight:
                min.X += 1f;
                min.Y -= size;
                break;

            case NeighborCorner.UpperLeft:
                min.X -= size;
                min.Y += 1f;
                break;

            case NeighborCorner.UpperRight:
                min.X += 1f;
                min.Y += 1f;
                break;
            }

            var disp = _bspFile.DisplacementManager[index];

            if (_neighbors.Any(x => x.Displacement == disp))
            {
                return;
            }

            _neighbors.Add(new Neighbor(this, disp, NeighborOrientation.Unknown, min, min + new Vector2(size, size)));
        }