예제 #1
0
 public static void CopyTo <T>(T[] src, IEncodedArray <T> dst, int dstOffset = 0)
 {
     for (int i = 0; i < src.Length; ++i)
     {
         dst[i + dstOffset] = src[i];
     }
 }
예제 #2
0
 public static void FillFrom <T>(this IEncodedArray <T> dst, int dstIndex, params T[] src)
     where T : unmanaged
 {
     for (int i = 0; i < src.Length; ++i)
     {
         dst[dstIndex + i] = src[i];
     }
 }
예제 #3
0
        public static void Copy <T>(IEncodedArray <T> src, ArraySegment <T> dst)
        {
            var c = src.Count;

            for (int i = 0; i < c; ++i)
            {
                dst.Array[dst.Offset + i] = src[i];
            }
        }
예제 #4
0
 public static void FillFrom <T>(this IEncodedArray <T> dst, int dstIndex, IEnumerable <T> src)
 {
     using (var ator = src.GetEnumerator())
     {
         while (dstIndex < dst.Count && ator.MoveNext())
         {
             dst[dstIndex++] = ator.Current;
         }
     }
 }
예제 #5
0
        public SparseArray(IEncodedArray <T> bottom, IEncodedArray <T> top, IntegerArray topMapping)
        {
            _BottomItems = bottom;
            _TopItems    = top;
            _Mapping     = new Dictionary <int, int>();

            for (int val = 0; val < topMapping.Count; ++val)
            {
                var key = (int)topMapping[val];
                _Mapping[key] = val;
            }
        }
예제 #6
0
        public static (Vector4, Vector4) GetBounds(IEncodedArray <Vector4> accesor)
        {
            var min = new Vector4(Single.MaxValue);
            var max = new Vector4(Single.MinValue);

            int c = accesor.Count;

            for (int i = 0; i < c; ++i)
            {
                var v = accesor[i];
                min = Vector4.Min(min, v);
                max = Vector4.Max(max, v);
            }

            return(min, max);
        }
예제 #7
0
 public EncodedArrayEnumerator(IEncodedArray <T> accessor)
 {
     this._Accessor = accessor;
     this._Count    = accessor.Count;
     this._Index    = -1;
 }
예제 #8
0
 public static void Copy <T>(IEncodedArray <T> src, T[] dst)
 {
     Copy <T>(src, new ArraySegment <T>(dst));
 }