MeshRenderer.Core.ColorManager.MakeRegionMap C# (CSharp) Method

MakeRegionMap() public method

Setup a region map.
public MakeRegionMap ( int partition, int size ) : void
partition int Mesh partition (size = number of triangles in mesh)
size int Number of partitions / regions.
return void
        public void MakeRegionMap(int[] partition, int size)
        {
            if (regions == null || regions.Length != size)
            {
                int n = regionColors.Length;

                regions = new SolidBrush[size];

                for (int j = 0; j < size; j++)
                {
                    regions[j] = new SolidBrush(regionColors[j % n]);
                }
            }

            if (regionMap == null)
            {
                regionMap = new Dictionary<int, int>(size);
            }
            else
            {
                regionMap.Clear();
            }

            int k = 0;
            for (int i = 0; i < partition.Length; i++)
            {
                if (!regionMap.ContainsKey(partition[i]))
                {
                    regionMap.Add(partition[i], k++);
                }
            }
        }