protected static void OnGUIBase(SerializableDynamicObject simplifierOptions) { EditorGUI.indentLevel += 1; dynamic options = simplifierOptions; if (options.SimplifyPolygonRatio == null) { options.SimplifyPolygonRatio = 0.8f; } if (options.SimplifyMinPolygonCount == null) { options.SimplifyMinPolygonCount = 10; } if (options.SimplifyMaxPolygonCount == null) { options.SimplifyMaxPolygonCount = 500; } options.SimplifyPolygonRatio = EditorGUILayout.Slider("Polygon Ratio", options.SimplifyPolygonRatio, 0.0f, 1.0f); EditorGUILayout.LabelField("Triangle Range"); EditorGUI.indentLevel += 1; options.SimplifyMinPolygonCount = EditorGUILayout.IntSlider("Min", options.SimplifyMinPolygonCount, 10, 100); options.SimplifyMaxPolygonCount = EditorGUILayout.IntSlider("Max", options.SimplifyMaxPolygonCount, 10, 5000); EditorGUI.indentLevel -= 1; EditorGUI.indentLevel -= 1; }
private int TestImpl(float ratio, int min, int max, int level) { SerializableDynamicObject dynamicObject = new SerializableDynamicObject(); dynamic options = dynamicObject; options.SimplifyPolygonRatio = ratio; options.SimplifyMinPolygonCount = min; options.SimplifyMaxPolygonCount = max; //original tri count is 1200. //level 0 test using (HLODBuildInfo info = new HLODBuildInfo()) { info.WorkingObjects.Add(s_testMeshRenderer.ToWorkingObject(Collections.Allocator.Persistent)); info.Distances.Add(level); var simplifer = new Simplifier.UnityMeshSimplifier(options); simplifer.SimplifyImmidiate(info); int afterTriCount = info.WorkingObjects[0].Mesh.triangles.Length; return(afterTriCount / 3); } }
private SerializableDynamicObject CreateSimpleBatcherOptions() { SerializableDynamicObject options = new SerializableDynamicObject(); dynamic batcherOptions = options; batcherOptions.PackTextureSize = 1024; batcherOptions.LimitTextureSize = 128; batcherOptions.MaterialGUID = ""; batcherOptions.TextureInfoList = new List <SimpleBatcher.TextureInfo>(); batcherOptions.TextureInfoList.Add(new SimpleBatcher.TextureInfo() { InputName = "_MainTex", OutputName = "_MainTex", Type = SimpleBatcher.PackingType.White }); batcherOptions.EnableTintColor = false; batcherOptions.TintColorName = ""; return(options); }
public AddressableStreaming(IGeneratedResourceManager manager, SerializableDynamicObject streamingOptions) { m_manager = manager; m_streamingOptions = streamingOptions; }
public static void OnGUI(SerializableDynamicObject streamingOptions) { dynamic options = streamingOptions; #region Setup default values if (options.OutputDirectory == null) { string path = Application.dataPath; path = "Assets" + path.Substring(Application.dataPath.Length); path = path.Replace('\\', '/'); if (path.EndsWith("/") == false) { path += "/"; } options.OutputDirectory = path; } if (options.AddressablesGroupName == null) { options.AddressablesGroupName = "HLOD"; } if (options.PCCompression == null) { options.PCCompression = TextureFormat.BC7; } if (options.WebGLCompression == null) { options.WebGLCompression = TextureFormat.DXT5; } if (options.AndroidCompression == null) { options.AndroidCompression = TextureFormat.ETC2_RGBA8; } if (options.iOSCompression == null) { options.iOSCompression = TextureFormat.PVRTC_RGBA4; } if (options.tvOSCompression == null) { options.tvOSCompression = TextureFormat.ASTC_4x4; } #endregion EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("OutputDirectory"); if (GUILayout.Button(options.OutputDirectory)) { string selectPath = EditorUtility.OpenFolderPanel("Select output folder", "Assets", ""); if (selectPath.StartsWith(Application.dataPath)) { selectPath = "Assets" + selectPath.Substring(Application.dataPath.Length); selectPath = selectPath.Replace('\\', '/'); if (selectPath.EndsWith("/") == false) { selectPath += "/"; } options.OutputDirectory = selectPath; } else { EditorUtility.DisplayDialog("Error", $"Select directory under {Application.dataPath}", "OK"); } } EditorGUILayout.EndHorizontal(); options.AddressablesGroupName = EditorGUILayout.TextField("Addressables Group", options.AddressablesGroupName); // It stores return value from foldout and uses it as a condition. if (showFormat = EditorGUILayout.Foldout(showFormat, "Compress Format")) { EditorGUI.indentLevel += 1; options.PCCompression = PopupFormat("PC & Console", (TextureFormat)options.PCCompression); options.WebGLCompression = PopupFormat("WebGL", (TextureFormat)options.WebGLCompression); options.AndroidCompression = PopupFormat("Android", (TextureFormat)options.AndroidCompression); options.iOSCompression = PopupFormat("iOS", (TextureFormat)options.iOSCompression); options.tvOSCompression = PopupFormat("tvOS", (TextureFormat)options.tvOSCompression); EditorGUI.indentLevel -= 1; } }
protected static void OnGUIBase(SerializableDynamicObject simplifierOptions) { EditorGUI.indentLevel += 1; dynamic options = simplifierOptions; if (options.SimplifyPolygonRatio == null) { options.SimplifyPolygonRatio = 0.8f; } if (options.SimplifyMinPolygonCount == null) { options.SimplifyMinPolygonCount = 10; } if (options.SimplifyMaxPolygonCount == null) { options.SimplifyMaxPolygonCount = 500; } if (options.PreserveBorderEdges == null) { options.PreserveBorderEdges = false; } if (options.PreserveUVSeamEdges == null) { options.PreserveUVSeamEdges = false; } if (options.PreserveUVFoldoverEdges == null) { options.PreserveUVFoldoverEdges = false; } if (options.PreserveSurfaceCurvature == null) { options.PreserveSurfaceCurvature = false; } if (options.EnableSmartLink == null) { options.EnableSmartLink = true; } if (options.VertexLinkDistance == null) { options.VertexLinkDistance = 4.94065645841247e-324; } if (options.MaxIterationCount == null) { options.MaxIterationCount = 1; } if (options.Agressiveness == null) { options.Agressiveness = 7; } if (options.ManualUVComponentCount == null) { options.ManualUVComponentCount = false; } if (options.UVComponentCount == null) { options.UVComponentCount = 2; } options.SimplifyPolygonRatio = EditorGUILayout.Slider("Polygon Ratio", options.SimplifyPolygonRatio, 0.0f, 1.0f); EditorGUILayout.LabelField("Triangle Range"); EditorGUI.indentLevel += 1; options.SimplifyMinPolygonCount = EditorGUILayout.IntSlider("Min", options.SimplifyMinPolygonCount, 10, 100); options.SimplifyMaxPolygonCount = EditorGUILayout.IntSlider("Max", options.SimplifyMaxPolygonCount, 10, 5000); options.PreserveBorderEdges = EditorGUILayout.Toggle("Preserve Border Edges", options.PreserveBorderEdges); options.PreserveUVSeamEdges = EditorGUILayout.Toggle("Preserve UV Seam Edges", options.PreserveUVSeamEdges); options.PreserveUVFoldoverEdges = EditorGUILayout.Toggle("Preserve UV Foldove rEdges", options.PreserveUVFoldoverEdges); options.PreserveSurfaceCurvature = EditorGUILayout.Toggle("Preserve Surface Curvature", options.PreserveSurfaceCurvature); options.EnableSmartLink = EditorGUILayout.Toggle("Enable Smart Link", options.EnableSmartLink); options.VertexLinkDistance = EditorGUILayout.DoubleField("Vertex Link Distance", options.VertexLinkDistance); options.MaxIterationCount = EditorGUILayout.IntField("Max Iteration Count", options.MaxIterationCount); options.Agressiveness = EditorGUILayout.FloatField("Agressiveness", options.Agressiveness); options.ManualUVComponentCount = EditorGUILayout.Toggle("Manual UV Component Count", options.ManualUVComponentCount); options.UVComponentCount = EditorGUILayout.IntField("UV Component Count", options.UVComponentCount); EditorGUI.indentLevel -= 1; EditorGUI.indentLevel -= 1; }
public SimplifierBase(SerializableDynamicObject simplifierOptions) { m_options = simplifierOptions; }
public static void OnGUI(SerializableDynamicObject simplifierOptions) { OnGUIBase(simplifierOptions); }
public UnityMeshSimplifier(SerializableDynamicObject simplifierOptions) : base(simplifierOptions) { }
public None(SerializableDynamicObject simplifierOptions) { }
public Unsupported(IGeneratedResourceManager manager, SerializableDynamicObject streamingOptions) { m_manager = manager; m_streamingOptions = streamingOptions; }
public List <SerializableDynamicObject> Execute(DbContext dbContext, Query query) { var results = new List <SerializableDynamicObject>(); using (var context = dbContext) { context.Database.Log = s => Console.WriteLine(string.Format("EFApp : {0}", s)); var entityProperty = context.GetType() .GetProperties() .FirstOrDefault(x => x.Name == query.Entity.Name); if (entityProperty == null) { return(results); } var entity = entityProperty.GetValue(context, null) as IQueryable; if (entity == null) { return(results); } var data = entity; if (query.Filters.Any()) { data = ExecuteWhere(data, query); } var keySelector = BuildKeySelector(query); var selector = BuildSelector(query); data = data .GroupBy(keySelector, "it") .Select(selector); var groupingDimensionProperties = new Dictionary <Dimension, PropertyInfo>(); var measureProperties = new Dictionary <Measure, PropertyInfo>(); // To enable original order to be reserved long recordIndex = 0; foreach (var record in data) { if (!groupingDimensionProperties.Any() && !measureProperties.Any()) { var type = record.GetType(); var properties = type.GetProperties(); foreach (var dimension in query.GroupingDimensions) { groupingDimensionProperties.Add(dimension, properties.Single(x => x.Name == dimension.Name)); } foreach (var measure in query.Entity.Measures) { measureProperties.Add(measure, properties.Single(x => x.Name == measure.Name)); } } var result = new SerializableDynamicObject(); foreach (var groupingDimensionProperty in groupingDimensionProperties) { result.SetValue(groupingDimensionProperty.Key.Name, groupingDimensionProperty.Value.GetValue(record, null)); } foreach (var measureProperty in measureProperties) { result.SetValue(measureProperty.Key.Name, measureProperty.Value.GetValue(record, null)); } result.SetValue("RecordIndex", recordIndex); recordIndex++; results.Add(result); } } return(results); }