Пример #1
0
        /// <summary>
        /// Create collections of groups sharing same Material ID. Also ensures collection's MaterialID is valid!
        /// </summary>
        /// <param name="groups"></param>
        /// <returns></returns>
        List <SamplePointsMaterialGroupCollection> getMaterialIDGroups(CGVolume volume)
        {
            var matCollections = new Dictionary <int, SamplePointsMaterialGroupCollection>();

            SamplePointsMaterialGroupCollection col;

            for (int g = 0; g < volume.CrossMaterialGroups.Count; g++)
            {
                int matID = Mathf.Min(volume.CrossMaterialGroups[g].MaterialID, MaterialCount - 1);
                if (!matCollections.TryGetValue(matID, out col))
                {
                    col            = new SamplePointsMaterialGroupCollection();
                    col.MaterialID = matID;
                    matCollections.Add(matID, col);
                }
                col.Add(volume.CrossMaterialGroups[g]);
            }

            var res = new List <SamplePointsMaterialGroupCollection>();

            foreach (var item in matCollections.Values)
            {
                item.CalculateAspectCorrection(volume, MaterialSetttings[item.MaterialID]);
                res.Add(item);
            }
            return(res);
        }
Пример #2
0
        /// <summary>
        /// Create collections of groups sharing same Material ID. Also ensures collection's MaterialID is valid!
        /// </summary>
        /// <param name="groups"></param>
        /// <returns></returns>
        List<SamplePointsMaterialGroupCollection> getMaterialIDGroups(CGVolume volume)
        {
            
            var matCollections = new Dictionary<int, SamplePointsMaterialGroupCollection>();

            SamplePointsMaterialGroupCollection col;

            for (int g = 0; g < volume.CrossMaterialGroups.Count;g++)
            {
                int matID = Mathf.Min(volume.CrossMaterialGroups[g].MaterialID,MaterialCount-1);
                if (!matCollections.TryGetValue(matID,out col))
                {
                    col = new SamplePointsMaterialGroupCollection();
                    col.MaterialID = matID;
                    matCollections.Add(matID,col);
                }
                col.Add(volume.CrossMaterialGroups[g]);
            }

            var res = new List<SamplePointsMaterialGroupCollection>();
            
            foreach (var item in matCollections.Values)
            {
                item.CalculateAspectCorrection(volume, MaterialSetttings[item.MaterialID]);
                res.Add(item);
            }
            return res;
            
        }