Exemplo n.º 1
0
        public void RemoveProjector(GeometryProjector projector)
        {
            this.renderInstances.Remove(projector);
            int projectorIndex = projector.ProjectorIndex;

            if (this.unusedIndices.Count == 0)
            {
                this.unusedIndices.Add(projectorIndex);
            }
            else if (!this.unusedIndices.Contains(projectorIndex))
            {
                int index = ProjectorManager.BinarySearch(ref this.unusedIndices, 0, this.unusedIndices.Count, projectorIndex);
                this.unusedIndices.Insert(index, projectorIndex);
            }
        }
Exemplo n.º 2
0
        private static int BinarySearch(ref List <int> list, int leftPosition, int rightPosition, int item)
        {
            if (rightPosition - leftPosition <= 1)
            {
                return(rightPosition);
            }
            int num = (rightPosition - leftPosition) / 2 + leftPosition;

            if (item == list[num])
            {
                return(num);
            }
            if (item > num)
            {
                return(ProjectorManager.BinarySearch(ref list, num, rightPosition, item));
            }
            return(ProjectorManager.BinarySearch(ref list, leftPosition, num, item));
        }