예제 #1
0
        private TextureSparse GetNewSparse(int index)
        {
            if (index >= allSparse.Length)
            {
                throw new Exception("Out of Range!");
            }
            NativeLinkedList <TextureSparse> currentSparseList = allSparse[index];

            if (currentSparseList.Length > 0)
            {
                TextureSparse sparse = *currentSparseList.GetLast();
                currentSparseList.RemoveLast();
                return(sparse);
            }
            TextureSparse nextSparse = GetNewSparse(index + 1);
            int           size       = nextSparse.size / 2;

            currentSparseList.AddLast(new TextureSparse
            {
                offset = nextSparse.offset,
                size   = size,
            });
            currentSparseList.AddLast(new TextureSparse
            {
                offset = nextSparse.offset + int2(0, size),
                size   = size,
            });
            currentSparseList.AddLast(new TextureSparse
            {
                offset = nextSparse.offset + int2(size, 0),
                size   = size,
            });
            return(new TextureSparse
            {
                offset = nextSparse.offset + size,
                size = size,
            });
        }
예제 #2
0
 private static bool2 IsSparseAligned(TextureSparse sparse)
 {
     return(sparse.offset % (sparse.size * 2) == 0);
 }
예제 #3
0
        public void PushSparseBack(TextureSparse sparse)
        {
            int index = (int)(0.01f + log2(sparse.size));

            allSparse[index].AddLast(sparse);
        }