// Hook to let client prepare and check if we should render before trying. protected override bool IsRenderingEnabled() { if (m_SkyProfile == null || m_SkyProfile.IsFeatureEnabled(ProfileFeatureKeys.LightningFeature) == false) { return(false); } if (m_SpawnAreas.Count == 0) { return(false); } return(true); }
public void Update() { if (m_SkyProfile == null || m_SkyProfile.IsFeatureEnabled(ProfileFeatureKeys.LightningFeature) == false) { ClearLightningRenderers(); return; } if (m_SkyProfile.lightningArtSet == null || m_SkyProfile.lightningArtSet.lightingStyleItems == null || m_SkyProfile.lightningArtSet.lightingStyleItems.Count == 0) { return; } if (m_SkyProfile.lightningArtSet.lightingStyleItems.Count != m_LightningRenderers.Count) { ClearLightningRenderers(); CreateLightningRenderers(); } // Assign a style to each renderer. for (int i = 0; i < m_SkyProfile.lightningArtSet.lightingStyleItems.Count; i++) { LightningArtItem style = m_SkyProfile.lightningArtSet.lightingStyleItems[i]; LightningRenderer lr = m_LightningRenderers[i]; lr.UpdateForTimeOfDay(m_SkyProfile, m_TimeOfDay, style); } }
// Update all of the weather systems. public void UpdateForTimeOfDay(SkyProfile skyProfile, float timeOfDay) { if (!skyProfile) { return; } m_Profile = skyProfile; m_TimeOfDay = timeOfDay; // Update all the controllers state. if (weatherDepthCamera != null) { weatherDepthCamera.enabled = skyProfile.IsFeatureEnabled(ProfileFeatureKeys.RainSplashFeature); } if (rainDownfallController != null) { rainDownfallController.UpdateForTimeOfDay(skyProfile, timeOfDay); } if (rainSplashController != null) { rainSplashController.UpdateForTimeOfDay(skyProfile, timeOfDay); } if (lightningController != null) { lightningController.UpdateForTimeOfDay(skyProfile, timeOfDay); } }
void Update() { if (m_SkyProfile == null || m_SkyProfile.IsFeatureEnabled(ProfileFeatureKeys.RainSplashFeature) == false) { ClearSplashRenderers(); return; } if (m_SkyProfile.rainSplashArtSet == null || m_SkyProfile.rainSplashArtSet.rainSplashArtItems == null || m_SkyProfile.rainSplashArtSet.rainSplashArtItems.Count == 0) { ClearSplashRenderers(); return; } if (m_SkyProfile.rainSplashArtSet.rainSplashArtItems.Count != m_SplashRenderers.Count) { ClearSplashRenderers(); CreateSplashRenderers(); } // Assign a style to each renderer. for (int i = 0; i < m_SkyProfile.rainSplashArtSet.rainSplashArtItems.Count; i++) { RainSplashArtItem style = m_SkyProfile.rainSplashArtSet.rainSplashArtItems[i]; RainSplashRenderer r = m_SplashRenderers[i]; r.UpdateForTimeOfDay(m_SkyProfile, m_TimeOfDay, style); } }
private bool RenderProfileDefinitions() { bool didChangeProfile = false; foreach (ProfileGroupSection groupSection in m_Profile.groupDefinitions) { if (groupSection.dependsOnFeature != null && groupSection.dependsOnValue != m_Profile.IsFeatureEnabled(groupSection.dependsOnFeature)) { continue; } bool valueChanged = RenderSection(groupSection.sectionKey); if (valueChanged) { didChangeProfile = true; } } return(didChangeProfile); }
public static void ApplyKeywordsToMaterial(SkyProfile profile, Material skyboxMaterial) { foreach (ProfileFeatureSection section in profile.featureDefinitions) { foreach (ProfileFeatureDefinition definition in section.featureDefinitions) { SetShaderKeyword( definition.shaderKeyword, profile.IsFeatureEnabled(definition.featureKey), skyboxMaterial); } } }
private void LateUpdate() { if (m_Profile == null) { return; } if (m_EnclosureMeshRenderer && rainDownfallController && m_Profile.IsFeatureEnabled(ProfileFeatureKeys.RainFeature)) { m_EnclosureMeshRenderer.enabled = true; } else { m_EnclosureMeshRenderer.enabled = false; } }
protected override bool IsRenderingEnabled() { if (m_SkyProfile == null) { return(false); } if (m_SkyProfile.IsFeatureEnabled(ProfileFeatureKeys.RainSplashFeature) == false) { return(false); } if (m_ViewerCamera == null) { Debug.LogError("Can't render ground raindrops since no active camera has the MainCamera tag applied."); return(false); } return(true); }
public void UpdateForTimeOfDay(SkyProfile skyProfile, float timeOfDay) { m_SkyProfile = skyProfile; m_TimeOfDay = timeOfDay; if (!skyProfile) { return; } // Update the volume. if (m_RainAudioSource == null) { m_RainAudioSource = GetComponent <AudioSource>(); } // Suppress rain sounds if rain isn't enabled. if (skyProfile == null || m_SkyProfile.IsFeatureEnabled(ProfileFeatureKeys.RainFeature) == false) { if (m_RainAudioSource != null) { m_RainAudioSource.enabled = false; } return; } if (!rainMaterial) { Debug.LogError("Can't render rain without a rain material"); return; } if (!rainMeshRenderer) { Debug.LogError("Can't show rain without an enclosure mesh renderer."); return; } if (m_PropertyBlock == null) { m_PropertyBlock = new MaterialPropertyBlock(); } rainMeshRenderer.enabled = true; rainMeshRenderer.material = rainMaterial; rainMeshRenderer.GetPropertyBlock(m_PropertyBlock); float rainNearIntensity = skyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainNearIntensityKey, timeOfDay); float rainFarIntensity = skyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainFarIntensityKey, timeOfDay); Texture rainNearTexture = skyProfile.GetTexturePropertyValue(ProfilePropertyKeys.RainNearTextureKey, timeOfDay); Texture rainFarTexture = skyProfile.GetTexturePropertyValue(ProfilePropertyKeys.RainFarTextureKey, timeOfDay); float rainNearSpeed = skyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainNearSpeedKey, timeOfDay); float rainFarSpeed = skyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainFarSpeedKey, timeOfDay); Color tintColor = m_SkyProfile.GetColorPropertyValue(ProfilePropertyKeys.RainTintColorKey, m_TimeOfDay); float turbulence = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainWindTurbulence, m_TimeOfDay); float turbulenceSpeed = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainWindTurbulenceSpeed, m_TimeOfDay); float nearTiling = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainNearTextureTiling, m_TimeOfDay); float farTiling = m_SkyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainFarTextureTiling, m_TimeOfDay); if (rainNearTexture != null) { m_PropertyBlock.SetTexture("_NearTex", rainNearTexture); m_PropertyBlock.SetVector("_NearTex_ST", new Vector4(nearTiling, nearTiling, nearTiling, 1)); } m_PropertyBlock.SetFloat("_NearDensity", rainNearIntensity); m_PropertyBlock.SetFloat("_NearRainSpeed", rainNearSpeed); if (rainFarTexture != null) { m_PropertyBlock.SetTexture("_FarTex", rainFarTexture); m_PropertyBlock.SetVector("_FarTex_ST", new Vector4(farTiling, farTiling, farTiling, 1)); } m_PropertyBlock.SetFloat("_FarDensity", rainFarIntensity); m_PropertyBlock.SetFloat("_FarRainSpeed", rainFarSpeed); m_PropertyBlock.SetColor("_TintColor", tintColor); m_PropertyBlock.SetFloat("_Turbulence", turbulence); m_PropertyBlock.SetFloat("_TurbulenceSpeed", turbulenceSpeed); rainMeshRenderer.SetPropertyBlock(m_PropertyBlock); if (skyProfile.IsFeatureEnabled(ProfileFeatureKeys.RainSoundFeature)) { m_RainAudioSource.enabled = true; m_RainAudioSource.volume = skyProfile.GetNumberPropertyValue(ProfilePropertyKeys.RainSoundVolumeKey, timeOfDay); } else { m_RainAudioSource.enabled = false; } }