public SceneStreaming(ClusterProperty property, int propertyCount, MStringBuilder msb, ClusterMatResources resources) { this.resources = resources; sb = msb; this.propertyCount = propertyCount; state = State.Unloaded; this.property = property; }
public void TryThis() { bool save = false; if (res == null) { save = true; res = ScriptableObject.CreateInstance <ClusterMatResources>(); res.name = "SceneManager"; res.clusterProperties = new List <ClusterProperty>(); } Func <ClusterProperty, ClusterProperty, bool> equalCompare = (a, b) => { return(a.name == b.name); }; ClusterProperty property = new ClusterProperty(); property.name = modelName; foreach (var i in res.clusterProperties) { if (equalCompare(property, i)) { Debug.LogError("Already Contained Scene " + modelName); return; } } LODGroup[] groups = GetComponentsInChildren <LODGroup>(); Dictionary <MeshRenderer, bool> lowLevelDict = new Dictionary <MeshRenderer, bool>(); foreach (var i in groups) { LOD[] lods = i.GetLODs(); for (int j = 1; j < lods.Length; ++j) { foreach (var k in lods[j].renderers) { if (k.GetType() == typeof(MeshRenderer)) { lowLevelDict.Add(k as MeshRenderer, true); } } } } CombinedModel model = ProcessCluster(GetComponentsInChildren <MeshRenderer>(false), lowLevelDict); property.clusterCount = ClusterGenerator.GenerateCluster(model.allPoints, model.bound, modelName, voxelCount, res.clusterProperties.Count); res.clusterProperties.Add(property); if (save) { AssetDatabase.CreateAsset(res, "Assets/SceneManager.asset"); } else { EditorUtility.SetDirty(res); } }
public SceneStreaming(ClusterProperty property) { state = State.Unloaded; this.property = property; allTextureDatas = new List <TextureInfos>(); }
public void TryThis() { bool save = false; if (res == null) { save = true; res = ScriptableObject.CreateInstance <ClusterMatResources>(); res.name = "SceneManager"; res.clusterProperties = new List <ClusterProperty>(); } ClusterProperty property = new ClusterProperty(); property.name = modelName; int containIndex = -1; for (int i = 0; i < res.clusterProperties.Count; ++i) { if (property.name == res.clusterProperties[i].name) { containIndex = i; break; } } LODGroup[] groups = GetComponentsInChildren <LODGroup>(); Dictionary <MeshRenderer, bool> lowLevelDict = new Dictionary <MeshRenderer, bool>(); foreach (var i in groups) { LOD[] lods = i.GetLODs(); for (int j = 1; j < lods.Length; ++j) { foreach (var k in lods[j].renderers) { if (k.GetType() == typeof(MeshRenderer)) { lowLevelDict.Add(k as MeshRenderer, true); } } } } CombinedModel model = ProcessCluster(GetComponentsInChildren <MeshRenderer>(false), lowLevelDict); property.vm = model.vm; property.clusterCount = ClusterGenerator.GenerateCluster(model.allPoints, model.allMatIndex, model.bound, modelName, voxelCount, containIndex < 0 ? res.clusterProperties.Count : containIndex); res.maximumMaterialCount = Mathf.Max(1, res.maximumMaterialCount); res.maximumMaterialCount = Mathf.Max(res.maximumMaterialCount, model.vm.allProperties.Count); if (containIndex < 0) { res.clusterProperties.Add(property); } else { res.clusterProperties[containIndex] = property; } if (save) { AssetDatabase.CreateAsset(res, "Assets/SceneManager.asset"); } else { EditorUtility.SetDirty(res); } }
public SceneStreaming(ClusterProperty property, int propertyCount) { this.propertyCount = propertyCount; state = State.Unloaded; this.property = property; }
public SceneStreaming(ClusterProperty property) { state = State.Unloaded; this.property = property; }