/// <summary> /// Register all /// </summary> public void RegisterAll() { for (int k = 0; k < _cloudLayers.Count; k++) { using (MaterialPtr mat = (MaterialPtr)MaterialManager.Singleton.GetByName(this.SkyX.GpuManager.SkydomeMaterialName)){ _cloudLayers[k].RegisterCloudLayer(mat.GetTechnique(0).CreatePass()); mat.Reload(); } } }
/// <summary> /// Add a cloud layer /// </summary> /// <param name="options">Cloud layer options</param> public CloudLayer Add(CloudLayer.Options options) { CloudLayer newCloudLayer = new CloudLayer(this.SkyX, options); // TODO using (MaterialPtr mat = (MaterialPtr)MaterialManager.Singleton.GetByName(this.SkyX.GpuManager.SkydomeMaterialName)) { newCloudLayer.RegisterCloudLayer(mat.GetTechnique(0).CreatePass()); mat.Reload(); _cloudLayers.Add(newCloudLayer); } bool changeOrder = false; // Short layers by height for (int k = 0; k < _cloudLayers.Count; k++) { if (k + 1 < _cloudLayers.Count) { if (_cloudLayers[k].LayerOptions.Height < _cloudLayers[k + 1].LayerOptions.Height) { // Swap CloudLayer cl = _cloudLayers[k]; _cloudLayers[k] = _cloudLayers[k + 1]; _cloudLayers[k + 1] = cl; changeOrder = true; k = 0; } } } if (changeOrder) { UnregisterAll(); RegisterAll(); } return(newCloudLayer); }