Beispiel #1
0
        public static ModelOverviewData CreateNew(ModelOverviewMode mode, ModelInfo modelInfo)
        {
            ModelOverviewData retData = new ModelOverviewData();

            retData.Mode             = mode;
            retData.ReadWriteEnable  = modelInfo.ReadWriteEnable;
            retData.ImportMaterials  = modelInfo.ImportMaterials;
            retData.OptimizeMesh     = modelInfo.OptimizeMesh;
            retData.MeshDataID       = modelInfo.GetMeshDataID();
            retData.MeshDataStr      = ModelInfo.GetMeshDataStr(retData.MeshDataID);
            retData.MeshCompression  = modelInfo.MeshCompression;
            retData.VertexRangeStr   = modelInfo.GetVertexRangeStr();
            retData.TriangleRangeStr = modelInfo.GetTriangleRangeStr();

            return(retData);
        }
Beispiel #2
0
        private static string GenerateMeshVerticesData(List <ModelInfo> modelInfoList)
        {
            Dictionary <int, KeyValuePair <int, long> > dict
                = new Dictionary <int, KeyValuePair <int, long> >();

            for (int i = 0; i < modelInfoList.Count; ++i)
            {
                ModelInfo mInfo = modelInfoList[i];
                var       key   = mInfo.GetMeshDataID();
                var       value = modelInfoList[i].MemSize;

                if (!dict.ContainsKey(key))
                {
                    dict.Add(key, new KeyValuePair <int, long>());
                }

                KeyValuePair <int, long> rwData = dict[key];
                dict[key] = new KeyValuePair <int, long>(rwData.Key + 1, rwData.Value + value);
            }

            List <KeyValuePair <int, KeyValuePair <int, long> > > list =
                new List <KeyValuePair <int, KeyValuePair <int, long> > >(dict);

            list.Sort((x, y) =>
            {
                return(y.Value.Key.CompareTo(x.Value.Key));
            });

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("####Mesh Data");
            sb.AppendLine("|Data|Count|Size|");
            sb.AppendLine("|-|-|-|");

            foreach (var itor in list)
            {
                int key = itor.Key;
                sb.AppendFormat("|{0}|", ModelInfo.GetMeshDataStr(key));
                sb.AppendFormat("{0}|{1}|", itor.Value.Key, EditorUtility.FormatBytes(itor.Value.Value));
                sb.AppendLine();
            }

            return(sb.ToString());
        }