void OnDestroy() { GameObject.Destroy(this.lightObject); this.lightObject = null; this.skyDirectionalLight = null; this.hdLight = null; this.timer = null; this.dayFlare = null; this.nightFlare = null; this.volume = null; this.pbsky = null; this.clouds = null; this.whiteBalance = null; }
public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderForCubemap, bool renderSunDisk) { var gradientSky = builtinParams.skySettings as GradientSky; m_GradientSkyMaterial.SetColor(_GradientBottom, gradientSky.bottom.value); m_GradientSkyMaterial.SetColor(_GradientMiddle, gradientSky.middle.value); m_GradientSkyMaterial.SetColor(_GradientTop, gradientSky.top.value); m_GradientSkyMaterial.SetFloat(_GradientDiffusion, gradientSky.gradientDiffusion.value); m_GradientSkyMaterial.SetFloat(HDShaderIDs._SkyIntensity, GetSkyIntensity(gradientSky, builtinParams.debugSettings)); CloudLayer.Apply(builtinParams.cloudLayer, m_GradientSkyMaterial); // This matrix needs to be updated at the draw call frequency. m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix); CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_GradientSkyMaterial, m_PropertyBlock, renderForCubemap ? 0 : 1); }
public StationObservation( string stationId, DateTimeOffset timestamp, string rawMessage, string textDescription, Measurement temperature, Measurement dewpoint, Measurement windDirection, Measurement windSpeed, Measurement windGust, Measurement barometricPressure, Measurement seaLevelPressure, Measurement visibility, Measurement maxTemperatureLast24Hours, Measurement minTemperatureLast24Hours, Measurement precipitationLastHour, Measurement precipitationLast3Hours, Measurement precipitationLast6Hours, Measurement relativeHumidity, Measurement windChill, Measurement heatIndex, CloudLayer cloudLayer0) { StationId = stationId; Timestamp = timestamp; RawMessage = rawMessage; TextDescription = textDescription; Temperature = temperature; Dewpoint = dewpoint; WindDirection = windDirection; WindSpeed = windSpeed; WindGust = windGust; BarometricPressure = barometricPressure; SeaLevelPressure = seaLevelPressure; Visibility = visibility; MaxTemperatureLast24Hours = maxTemperatureLast24Hours; MinTemperatureLast24Hours = minTemperatureLast24Hours; PrecipitationLastHour = precipitationLastHour; PrecipitationLast3Hours = precipitationLast3Hours; PrecipitationLast6Hours = precipitationLast6Hours; RelativeHumidity = relativeHumidity; WindChill = windChill; HeatIndex = heatIndex; CloudLayer0 = cloudLayer0; }
/// <summary> /// Removes an existing layer /// </summary> /// <param name="_Layer"></param> public void RemoveLayer( CloudLayer _Layer ) { if ( !m_CloudLayers.Contains( _Layer ) ) return; // Backup selection CloudLayer PreviousSelection = SelectedLayer; // Simulate Unity steps _Layer.OnDisable(); _Layer.OnDestroy(); m_CloudLayers.Remove( _Layer ); // Restore selection SelectedLayer = PreviousSelection; if ( SelectedLayer == null && m_CloudLayers.Count > 0 ) SelectedLayer = m_CloudLayers[0]; // Select first layer otherwise... NotifyLayersChanged(); }
/// <summary> /// Adds a new cloud layer at specified altitude and of specified thickness /// </summary> /// <param name="_Altitude">The altitude (in kilometers) of the cloud layer</param> /// <param name="_Thickness">The thickness (in kilometers) of the cloud layer</param> /// <returns></returns> public CloudLayer AddLayer( float _Altitude, float _Thickness ) { CloudLayer Result = new CloudLayer(); Result.Owner = this; Result.CreateRenderTargets( m_Width, m_Height ); Result.Altitude = _Altitude; Result.Thickness = _Thickness; // Simulate Unity steps Result.Awake(); Result.Start(); Result.OnEnable(); m_CloudLayers.Add( Result ); // Update selection if ( SelectedLayer == null ) SelectedLayer = Result; NotifyLayersChanged(); return Result; }
public override Dictionary <string, object> Parse(string remainingMetar, bool withCavok = false) { var consumed = Consume(remainingMetar); var found = consumed.Value; var newRemainingMetar = consumed.Key; var result = new Dictionary <string, object>(); // default case: CAVOK or clear sky, no cloud layer var layers = new List <CloudLayer>(); // handle the case where nothing has been found and metar is not cavok if (found.Count <= 1 && !withCavok) { throw new MetarChunkDecoderException(remainingMetar, newRemainingMetar, MetarChunkDecoderException.Messages.CloudsInformationBadFormat, this); } // there are clouds, handle cloud layers and visibility if (found.Count > 2 && string.IsNullOrEmpty(found[2].Value)) { for (var i = 3; i <= 15; i += 4) { if (!string.IsNullOrEmpty(found[i].Value)) { var layer = new CloudLayer(); var layerHeight = Value.ToInt(found[i + 2].Value); int?layerHeightFeet = null; if (layerHeight.HasValue) { layerHeightFeet = layerHeight * 100; } switch (found[i + 1].Value) { case "FEW": layer.Amount = CloudLayer.CloudAmount.FEW; break; case "SCT": layer.Amount = CloudLayer.CloudAmount.SCT; break; case "BKN": layer.Amount = CloudLayer.CloudAmount.BKN; break; case "OVC": layer.Amount = CloudLayer.CloudAmount.OVC; break; case "VV": layer.Amount = CloudLayer.CloudAmount.VV; break; } if (layerHeightFeet.HasValue) { layer.BaseHeight = new Value(layerHeightFeet.Value, Value.Unit.Feet); } switch (found[i + 3].Value) { case "CB": layer.Type = CloudLayer.CloudType.CB; break; case "TCU": layer.Type = CloudLayer.CloudType.TCU; break; case "///": layer.Type = CloudLayer.CloudType.CannotMeasure; break; } layers.Add(layer); } } } result.Add(CloudsParameterName, layers); return(GetResults(newRemainingMetar, result)); }
public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderForCubemap, bool renderSunDisk) { var hdriSky = builtinParams.skySettings as HDRISky; float intensity, phi, backplatePhi; GetParameters(out intensity, out phi, out backplatePhi, builtinParams, hdriSky); int passID; if (hdriSky.enableBackplate.value == false) { if (renderForCubemap) { passID = m_RenderCubemapID; } else { passID = m_RenderFullscreenSkyID; } } else { if (renderForCubemap) { passID = m_RenderCubemapWithBackplateID; } else { passID = m_RenderFullscreenSkyWithBackplateID; } } if (hdriSky.enableDistortion.value == true) { m_SkyHDRIMaterial.EnableKeyword("SKY_MOTION"); if (hdriSky.procedural.value == false) { m_SkyHDRIMaterial.EnableKeyword("USE_FLOWMAP"); m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Flowmap, hdriSky.flowmap.value); } else { m_SkyHDRIMaterial.DisableKeyword("USE_FLOWMAP"); } float rot = -Mathf.Deg2Rad * hdriSky.scrollDirection.value; bool upperHemisphereOnly = hdriSky.upperHemisphereOnly.value || hdriSky.procedural.value; Vector4 flowmapParam = new Vector4(upperHemisphereOnly ? 1.0f : 0.0f, scrollFactor, Mathf.Cos(rot), Mathf.Sin(rot)); m_SkyHDRIMaterial.SetVector(HDShaderIDs._FlowmapParam, flowmapParam); scrollFactor += hdriSky.scrollSpeed.value * (Time.time - lastTime) * 0.01f; lastTime = Time.time; } else { m_SkyHDRIMaterial.DisableKeyword("SKY_MOTION"); } m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Cubemap, hdriSky.hdriSky.value); m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(intensity, 0.0f, Mathf.Cos(phi), Mathf.Sin(phi))); m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters0, GetBackplateParameters0(hdriSky)); m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters1, GetBackplateParameters1(backplatePhi, hdriSky)); m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters2, GetBackplateParameters2(hdriSky)); m_SkyHDRIMaterial.SetColor(HDShaderIDs._BackplateShadowTint, hdriSky.shadowTint.value); uint shadowFilter = 0u; if (hdriSky.pointLightShadow.value) { shadowFilter |= unchecked ((uint)LightFeatureFlags.Punctual); } if (hdriSky.dirLightShadow.value) { shadowFilter |= unchecked ((uint)LightFeatureFlags.Directional); } if (hdriSky.rectLightShadow.value) { shadowFilter |= unchecked ((uint)LightFeatureFlags.Area); } m_SkyHDRIMaterial.SetInt(HDShaderIDs._BackplateShadowFilter, unchecked ((int)shadowFilter)); CloudLayer.Apply(builtinParams.cloudLayer, m_SkyHDRIMaterial); // This matrix needs to be updated at the draw call frequency. m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix); CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_SkyHDRIMaterial, m_PropertyBlock, passID); }