private void CameraPostRender(Camera camera) { if (WeatherMakerCommandBufferManagerScript.CameraStack == 0 && WeatherMakerScript.GetCameraType(camera) == WeatherMakerCameraType.Normal) { RenderTexture.ReleaseTemporary(tempShadowBuffer); #if UNITY_LWRP if (_commandBufferDepthShadows != null) { camera.RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, _commandBufferDepthShadows); } if (_commandBufferScreenSpaceShadows1 != null) { camera.RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, _commandBufferScreenSpaceShadows1); } if (_commandBufferScreenSpaceShadows2 != null) { camera.RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, _commandBufferScreenSpaceShadows2); } #else RemoveCommandBuffer(LightEvent.AfterScreenspaceMask, ref _commandBufferScreenSpaceShadows1, false); RemoveCommandBuffer(LightEvent.AfterScreenspaceMask, ref _commandBufferScreenSpaceShadows2, false); #endif } }
/// <summary> /// Camera post render event /// </summary> /// <param name="camera">Camera</param> protected virtual void CameraPostRender(Camera camera) { if (Effect != null && Effect.Enabled && !WeatherMakerScript.ShouldIgnoreCamera(this, camera, !AllowReflections)) { Effect.PostRenderCamera(camera); } }
public void PostRenderFrame(Camera camera) { if (TemporalReprojectionMaterial == null) { return; } WeatherMakerCameraType cameraType = WeatherMakerScript.GetCameraType(camera); if (cameraType == WeatherMakerCameraType.Other) { return; } // turn off first frame handling NeedsFirstFrameHandling = false; prevView[0] = view[0]; prevView[1] = view[1]; // move to next temporal reprojection frame unchecked { //if (++debugCount % 60 == 0) { if (++frameIndex == frameNumbers.Length) { frameIndex = 0; } SubFrameNumber = frameNumbers[frameIndex]; } } }
private void CameraPreCull(Camera camera) { if (!WeatherMakerScript.ShouldIgnoreCamera(this, camera)) { commandBuffer.Clear(); if (BlurMaterial != null) { RenderTextureFormat format = (camera.allowHDR ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default); RenderTextureDescriptor desc1 = WeatherMakerFullScreenEffect.GetRenderTextureDescriptor((int)Scale, 1, 1, format, 0, camera); RenderTextureDescriptor desc2 = WeatherMakerFullScreenEffect.GetRenderTextureDescriptor(1, 1, 1, format, 0, camera); commandBuffer.GetTemporaryRT(WMS._MainTex2, desc1); commandBuffer.GetTemporaryRT(WMS._MainTex3, desc2); commandBuffer.SetRenderTarget(WMS._MainTex2); commandBuffer.ClearRenderTarget(true, true, Color.clear); commandBuffer.SetGlobalFloat(WMS._WeatherMakerDownsampleScale, (float)Scale); commandBuffer.DrawRenderer(Renderer, Renderer.sharedMaterial, 0, 0); // draw pass commandBuffer.SetRenderTarget(WMS._MainTex3); commandBuffer.ClearRenderTarget(true, true, Color.clear); commandBuffer.DrawRenderer(Renderer, Renderer.sharedMaterial, 0, 1); // depth pass commandBuffer.SetGlobalTexture(WMS._WeatherMakerTemporaryDepthTexture, WMS._MainTex3); commandBuffer.SetGlobalFloat(WMS._DstBlendMode, (float)BlendMode.OneMinusSrcAlpha); commandBuffer.Blit(WMS._MainTex2, WeatherMakerFullScreenEffect.CameraTargetIdentifier(), BlurMaterial, 0); commandBuffer.ReleaseTemporaryRT(WMS._MainTex2); commandBuffer.ReleaseTemporaryRT(WMS._MainTex3); camera.AddCommandBuffer(CameraEvent, commandBuffer); } } }
private void CameraPostRender(Camera camera) { if (!WeatherMakerScript.ShouldIgnoreCamera(this, camera) && commandBuffer != null) { camera.RemoveCommandBuffer(CameraEvent, commandBuffer); } }
private void OnTriggerEnter(Collider other) { if (gameObject.activeInHierarchy && enabled && WeatherMakerScript.IsLocalPlayer(other.transform) && ++triggers == 1) { // if this is the first trigger entered, run it TweenFactory.Tween("WeatherMakerDampeningZoneScript", 0.0f, 1.0f, TransitionDuration, TweenScaleFunctions.Linear, (t) => { if (WeatherMakerAudioManagerScript.Instance != null) { float currentValue; if (!WeatherMakerAudioManagerScript.Instance.VolumeModifierDictionary.TryGetValue("WeatherMakerDampeningZoneScript", out currentValue)) { currentValue = 1.0f; } WeatherMakerAudioManagerScript.Instance.VolumeModifierDictionary["WeatherMakerDampeningZoneScript"] = Mathf.Lerp(currentValue, SoundDampening, t.CurrentValue); } if (WeatherMakerScript.Instance != null) { float currentValue; if (!WeatherMakerScript.Instance.IntensityModifierDictionary.TryGetValue("WeatherMakerDampeningZoneScript", out currentValue)) { currentValue = 1.0f; } WeatherMakerScript.Instance.IntensityModifierDictionary["WeatherMakerDampeningZoneScript"] = Mathf.Lerp(currentValue, IntensityDampening, t.CurrentValue); } if (WeatherMakerThunderAndLightningScript.Instance != null) { WeatherMakerThunderAndLightningScript.Instance.LightningBoltScript.LightParameters.LightIntensityMultiplier = Mathf.Lerp(WeatherMakerThunderAndLightningScript.Instance.LightningBoltScript.LightParameters.LightIntensityMultiplier, LightDampening, t.CurrentValue); } }); } }
private void NotifyThoseInZoneOfProfileChange(WeatherMakerProfileScript oldProfile, WeatherMakerProfileScript newProfile, float transitionDuration) { // anyone in this zone gets a new profile List <Transform> playersInZone; if (!zonesAndPlayers.TryGetValue(this, out playersInZone) || !PruneNulls(playersInZone)) { // no players in zone, we are done return; } List <string> connectionIds = new List <string>(); bool hasLocalPlayer = false; for (int i = 0; i < playersInZone.Count; i++) { Transform player = playersInZone[i]; hasLocalPlayer = WeatherMakerScript.IsLocalPlayer(player); connectionIds.Add(WeatherMakerScript.Instance.NetworkConnection.GetConnectionId(player)); } if (hasLocalPlayer) { WeatherMakerScript.Instance.LastLocalProfile = newProfile; } // send notification that those in this zone need a new weather profile WeatherMakerScript.Instance.RaiseWeatherProfileChanged(oldProfile, newProfile, secondsRemainingTransition, secondsRemainingHold, false, connectionIds.ToArray()); }
private void CameraPostRender(Camera camera) { if (WeatherMakerScript.Instance == null || WeatherMakerScript.Instance.PerformanceProfile == null) { return; } WeatherMakerCameraType cameraType = WeatherMakerScript.GetCameraType(camera); if ((WeatherMakerCommandBufferManagerScript.CameraStack == 0 && cameraType == WeatherMakerCameraType.Normal) || (cameraType == WeatherMakerCameraType.Reflection && WeatherMakerScript.Instance.PerformanceProfile.VolumetricCloudReflectionShadows)) { RenderTexture.ReleaseTemporary(tempShadowBuffer); #if UNITY_URP if (_commandBufferDepthShadows != null) { camera.RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, _commandBufferDepthShadows); } if (_commandBufferScreenSpaceShadows1 != null) { camera.RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, _commandBufferScreenSpaceShadows1); } if (_commandBufferScreenSpaceShadows2 != null) { camera.RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, _commandBufferScreenSpaceShadows2); } #else RemoveCommandBuffer(LightEvent.AfterScreenspaceMask, ref _commandBufferScreenSpaceShadows1, false); RemoveCommandBuffer(LightEvent.AfterScreenspaceMask, ref _commandBufferScreenSpaceShadows2, false); #endif } }
private void SetupCommandBufferForCamera(Camera camera) { #if !UNITY_SERVER if (camera == null) { return; } WeatherMakerCameraProperties props = GetCameraProperties(camera); WeatherMakerCameraType cameraType = WeatherMakerScript.GetCameraType(camera); Camera baseCamera = WeatherMakerCommandBufferManagerScript.BaseCamera; UpdateDeferredShadingKeyword(camera); CalculateMatrixes(camera, baseCamera); CalculateFrustumCorners(camera); Shader.SetGlobalMatrixArray(WMS._WeatherMakerInverseView, inverseView); Shader.SetGlobalMatrixArray(WMS._WeatherMakerInverseProj, inverseProj); Shader.SetGlobalMatrixArray(WMS._WeatherMakerView, view); Shader.SetGlobalVectorArray(WMS._WeatherMakerCameraFrustumCorners, cameraFrustumCorners); Shader.SetGlobalVector(WMS._WeatherMakerCameraOriginOffset, props.OriginOffsetCumulative); Shader.SetGlobalVector(WMS._WeatherMakerCameraPosComputeShader, camera.transform.position); if (cameraType == WeatherMakerCameraType.CubeMap) { Shader.SetGlobalFloat(WMS._WeatherMakerCameraRenderMode, 2.0f); } else if (cameraType == WeatherMakerCameraType.Reflection) { Shader.SetGlobalFloat(WMS._WeatherMakerCameraRenderMode, 1.0f); } else { Shader.SetGlobalFloat(WMS._WeatherMakerCameraRenderMode, 0.0f); } #endif }
private void CameraPostRender(Camera camera) { if (effect != null && !WeatherMakerScript.ShouldIgnoreCamera(this, camera, !AllowReflections)) { effect.PostRenderCamera(camera); } }
private void Update() { // only take input from local player if (!WeatherMakerScript.IsLocalPlayer(transform)) { return; } UpdateMovement(); UpdateMouseLook(); if (Flashlight != null && WeatherMakerLightManagerScript.Instance != null) { if (Input.GetKeyDown(KeyCode.F)) { // hack: Bug in Unity, doesn't recognize that the light was enabled unless we rotate the camera transform.Rotate(0.0f, 0.01f, 0.0f); transform.Rotate(0.0f, -0.01f, 0.0f); Flashlight.enabled = !Flashlight.enabled; GameObject toggleObj = GameObject.Find("FlashlightCheckbox"); if (toggleObj != null) { UnityEngine.UI.Toggle toggle = toggleObj.GetComponent <UnityEngine.UI.Toggle>(); if (toggle != null) { toggle.isOn = !toggle.isOn; } } } WeatherMakerLightManagerScript.Instance.AddLight(Flashlight); } }
private void SetupCommandBufferForCamera(Camera camera) { if (camera == null) { return; } WeatherMakerCameraType cameraType = WeatherMakerScript.GetCameraType(camera); Camera baseCamera = WeatherMakerCommandBufferManagerScript.BaseCamera; UpdateDeferredShadingKeyword(camera); CalculateMatrixes(camera, baseCamera); CalculateFrustumCorners(camera); Shader.SetGlobalMatrixArray(WMS._WeatherMakerInverseView, inverseView); Shader.SetGlobalMatrixArray(WMS._WeatherMakerInverseProj, inverseProj); Shader.SetGlobalMatrixArray(WMS._WeatherMakerView, view); Shader.SetGlobalVectorArray(WMS._WeatherMakerCameraFrustumCorners, cameraFrustumCorners); Shader.SetGlobalVector(WMS._WeatherMakerCameraPos, camera.transform.position); if (cameraType == WeatherMakerCameraType.CubeMap || camera == WeatherMakerCommandBufferManagerScript.CubemapCamera) { Shader.SetGlobalFloat(WMS._WeatherMakerCameraRenderMode, 2.0f); } else if (cameraType == WeatherMakerCameraType.Reflection) { Shader.SetGlobalFloat(WMS._WeatherMakerCameraRenderMode, 1.0f); } else { Shader.SetGlobalFloat(WMS._WeatherMakerCameraRenderMode, 0.0f); } }
/// <summary> /// Get a gradient lookup value given directional light position /// </summary> /// <returns>Value</returns> public float GetGradientLookup() { if (!LightIsActive) { return(1.0f); } float sunGradientLookup; CameraMode mode = WeatherMakerScript.ResolveCameraMode(); if (mode == CameraMode.OrthographicXY && !OrbitTypeIsPerspective) { sunGradientLookup = transform.forward.z; } else if (mode == CameraMode.OrthographicXZ && !OrbitTypeIsPerspective) { sunGradientLookup = transform.forward.x; } else { // TODO: Support full spherical world sunGradientLookup = -transform.forward.y; } sunGradientLookup = ((sunGradientLookup + 1.0f) * 0.5f); return(sunGradientLookup); }
public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); CameraMode mode = WeatherMakerScript.ResolveCameraMode(); //2D settings toggle on and off depending if the target camera is orthographic if (mode == CameraMode.OrthographicXY || mode == CameraMode.OrthographicXZ) { EditorGUILayout.BeginVertical("box"); EditorGUILayout.LabelField("2D Settings:"); GUIContent layerTip = new GUIContent("Sorting Layer", "Layer name for custom sorting"); chosenIndex = EditorGUILayout.Popup(layerTip, chosenIndex, sortingLayerNames); layerName = (sortingLayerNames[chosenIndex] == null ? null : sortingLayerNames[chosenIndex].text); GUIContent orderTip = new GUIContent("Sort Order", "Sort order in the sort layer"); orderInLayer = EditorGUILayout.IntField(orderTip, inspectorTarget.SortOrderInLayer); EditorGUILayout.EndVertical(); } //Draw the rest of the inspector. The fields above are marked not to be drawn in the default inspector so that we don't have duplicates DrawDefaultInspector(); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(inspectorTarget, "Edit Lightning"); inspectorTarget.SortLayerName = layerName; inspectorTarget.SortOrderInLayer = orderInLayer; EditorUtility.SetDirty(inspectorTarget); } }
/// <summary> /// Sound manager weather profile change handler /// </summary> /// <param name="oldProfile">Old profile</param> /// <param name="newProfile">New profile</param> /// <param name="transitionDelay">Transition delay</param> /// <param name="transitionDuration">Transition duration</param> public void WeatherProfileChanged(WeatherMakerProfileScript oldProfile, WeatherMakerProfileScript newProfile, float transitionDelay, float transitionDuration) { // override sound zones if (WeatherProfileSoundFadeOutMultiplier > 0.0f) { foreach (Camera camera in Camera.allCameras) { if (WeatherMakerScript.IsLocalPlayer(camera.transform)) { WeatherMakerSoundZoneScript soundZone = camera.GetComponentInChildren <WeatherMakerSoundZoneScript>(); if (soundZone != null && soundZone.enabled) { float stopSeconds = transitionDuration * WeatherProfileSoundFadeOutMultiplier; soundZone.StopSounds(stopSeconds, true); // add new sounds if (newProfile.SoundProfile != null) { foreach (WeatherMakerSoundGroupScript soundScript in newProfile.SoundProfile.Sounds) { soundZone.AddSound(soundScript, true); } } } } } } }
private void OnEnable() { if (WeatherMakerScript.Instance == null) { return; } WeatherMakerScript.EnsureInstance(this, ref instance); if (WeatherMakerCommandBufferManagerScript.Instance != null) { WeatherMakerCommandBufferManagerScript.Instance.RegisterPreCull(CameraPreCull, this); WeatherMakerCommandBufferManagerScript.Instance.RegisterPreRender(CameraPreRender, this); WeatherMakerCommandBufferManagerScript.Instance.RegisterPostRender(CameraPostRender, this); } skySphereMaterial.Update(MeshRenderer.sharedMaterial); if (SkySphereProfile == null) { SkySphereProfile = WeatherMakerScript.Instance.LoadResource <WeatherMakerSkyProfileScript>("WeatherMakerSkyProfile_Procedural"); } if (SkySphereProfile.AtmosphereProfile == null) { SkySphereProfile.AtmosphereProfile = WeatherMakerScript.Instance.LoadResource <WeatherMakerAtmosphereProfileScript>("WeatherMakerAtmosphereProfile_Default"); } if (SkySphereProfile.AtmosphereProfile != null) { SkySphereProfile.AtmosphereProfile.UpdateShaderVariables(null, AtmosphereLookupMaterial, AtmosphereComputeShader); } }
public void PreRenderFrame(Camera camera, Camera lastNormalCamera, CommandBuffer commandBuffer) { if (TemporalReprojectionMaterial == null) { return; } WeatherMakerCameraType cameraType = WeatherMakerScript.GetCameraType(camera); if (cameraType == WeatherMakerCameraType.Other) { return; } lastNormalCamera = (cameraType == WeatherMakerCameraType.Normal ? camera : (lastNormalCamera ?? camera)); // assign current matrixes, only normal stereo cameras use the stereo methods // reflection cameras are rendered one eye at a time without stereo if (camera.stereoEnabled) { view[0] = camera.GetStereoViewMatrix(Camera.StereoscopicEye.Left); view[1] = camera.GetStereoViewMatrix(Camera.StereoscopicEye.Right); projection[0] = lastNormalCamera.GetStereoProjectionMatrix(Camera.StereoscopicEye.Left); projection[1] = lastNormalCamera.GetStereoProjectionMatrix(Camera.StereoscopicEye.Right); inverseView[0] = view[0].inverse; inverseView[1] = view[1].inverse; inverseProjection[0] = projection[0].inverse; inverseProjection[1] = projection[1].inverse; inverseProjectionView[0] = inverseProjection[0] * inverseView[0]; inverseProjectionView[1] = inverseProjection[1] * inverseView[1]; prevViewProjection[0] = (projection[0] * prevView[0]); prevViewProjection[1] = (projection[1] * prevView[1]); ipivpvp[0] = projection[0] * prevView[0] * inverseView[0] * inverseProjection[0]; ipivpvp[1] = projection[1] * prevView[1] * inverseView[1] * inverseProjection[1]; } else { view[0] = view[1] = camera.worldToCameraMatrix; inverseView[0] = inverseView[1] = camera.cameraToWorldMatrix; projection[0] = projection[1] = lastNormalCamera.projectionMatrix; inverseProjection[0] = inverseProjection[1] = lastNormalCamera.projectionMatrix.inverse; inverseProjectionView[0] = inverseProjectionView[1] = inverseView[0] * inverseProjection[0]; prevViewProjection[0] = prevViewProjection[1] = (projection[0] * prevView[0]); ipivpvp[0] = ipivpvp[1] = projection[0] * prevView[0] * inverseView[0] * inverseProjection[0]; } commandBuffer.SetGlobalTexture(WMS._TemporalReprojection_SubFrame, SubFrameTexture); commandBuffer.SetGlobalTexture(WMS._TemporalReprojection_PrevFrame, PrevFrameTexture); commandBuffer.SetGlobalFloat(WMS._TemporalReprojection_BlendMode, (float)BlendMode); commandBuffer.SetGlobalFloat(WMS._TemporalReprojection_SubPixelSize, ReprojectionSize); commandBuffer.SetGlobalFloat(WMS._TemporalReprojection_SubFrameNumber, SubFrameNumber); commandBuffer.SetGlobalFloat(WMS._TemporalReprojection_SimilarityMax, TemporalReprojectionMaterial.GetFloat(WMS._TemporalReprojection_SimilarityMax)); commandBuffer.SetGlobalMatrixArray(WMS._TemporalReprojection_PreviousView, prevView); commandBuffer.SetGlobalMatrixArray(WMS._TemporalReprojection_View, view); commandBuffer.SetGlobalMatrixArray(WMS._TemporalReprojection_InverseView, inverseView); commandBuffer.SetGlobalMatrixArray(WMS._TemporalReprojection_Projection, projection); commandBuffer.SetGlobalMatrixArray(WMS._TemporalReprojection_InverseProjection, inverseProjection); commandBuffer.SetGlobalMatrixArray(WMS._TemporalReprojection_InverseProjectionView, inverseProjectionView); commandBuffer.SetGlobalMatrixArray(WMS._TemporalReprojection_PreviousViewProjection, prevViewProjection); commandBuffer.SetGlobalMatrixArray(WMS._TemporalReprojection_ipivpvp, ipivpvp); }
private void AttachDepthCommandBuffer(Camera camera) { if (DownsampleDepthMaterial != null && !WeatherMakerScript.ShouldIgnoreCamera(this, camera, false) && CameraStack < 2) { CreateAndAddDepthCommandBuffer(camera); } }
private void UpdateSeason() { WeatherMakerScript.AssertExists(); int month = WeatherMakerScript.Instance.DayNightScript.Month - 1; if (month < 0 || month > 11) { return; } float season; if (WeatherMakerScript.Instance.DayNightScript.Latitude > 0.0f) { season = monthToSeasonLookupNorth[month]; } else { season = monthToSeasonLookupSouth[month]; } if (season != lastSeason) { lastSeason = season; OnUpdateSeason(season); } }
private void OnTriggerExit(Collider other) { if (!WeatherMakerScript.IsLocalPlayer(other.transform)) { return; } StopSounds(); soundZoneStack.Remove(this); // the next item on the stack can play if (soundZoneStack.Count != 0) { int index = soundZoneStack.Count - 1; WeatherMakerSoundZoneScript script = soundZoneStack[index]; if (script == null) { soundZoneStack.RemoveAt(index); } else { script.StartSounds(); } } }
private void OnTriggerExit(Collider other) { if (WeatherMakerScript.IsLocalPlayer(other.transform)) { HasEntered = false; } }
private void CameraPreCull(Camera camera) { if (WeatherMakerCommandBufferManagerScript.CameraStack == 1 && WeatherMakerScript.GetCameraType(camera) == WeatherMakerCameraType.Normal) { // render cloud shadows at half scale for large screens int scale = (WeatherMakerScript.Instance == null || WeatherMakerScript.Instance.PerformanceProfile == null ? (UnityEngine.XR.XRDevice.isPresent || Screen.width > 2000 ? 4 : 2) : (int)WeatherMakerScript.Instance.PerformanceProfile.VolumetricCloudShadowDownsampleScale); tempShadowBuffer = RenderTexture.GetTemporary(WeatherMakerFullScreenEffect.GetRenderTextureDescriptor(scale, 0, 1, RenderTextureFormat.ARGB32, 0, camera)); tempShadowBuffer.wrapMode = TextureWrapMode.Clamp; tempShadowBuffer.filterMode = FilterMode.Bilinear; AddScreenSpaceShadowsCommandBuffer(camera); // ensure that the any shader using cloud shadows knows the correct cloud shadow parameters if (CloudShadowMaterial != null) { Shader.SetGlobalFloat(WMS._CloudShadowMapAdder, CloudShadowMaterial.GetFloat(WMS._CloudShadowMapAdder)); Shader.SetGlobalFloat(WMS._CloudShadowMapMultiplier, CloudShadowMaterial.GetFloat(WMS._CloudShadowMapMultiplier)); Shader.SetGlobalFloat(WMS._CloudShadowMapPower, CloudShadowMaterial.GetFloat(WMS._CloudShadowMapPower)); Shader.SetGlobalFloat(WMS._WeatherMakerCloudVolumetricShadowDither, CloudShadowMaterial.GetFloat(WMS._WeatherMakerCloudVolumetricShadowDither)); Shader.SetGlobalTexture(WMS._WeatherMakerCloudShadowDetailTexture, CloudShadowMaterial.GetTexture(WMS._WeatherMakerCloudShadowDetailTexture)); Shader.SetGlobalFloat(WMS._WeatherMakerCloudShadowDetailScale, CloudShadowMaterial.GetFloat(WMS._WeatherMakerCloudShadowDetailScale)); Shader.SetGlobalFloat(WMS._WeatherMakerCloudShadowDetailIntensity, CloudShadowMaterial.GetFloat(WMS._WeatherMakerCloudShadowDetailIntensity)); Shader.SetGlobalFloat(WMS._WeatherMakerCloudShadowDetailFalloff, CloudShadowMaterial.GetFloat(WMS._WeatherMakerCloudShadowDetailFalloff)); Shader.SetGlobalFloat(WMS._WeatherMakerCloudShadowDistanceFade, CloudShadowMaterial.GetFloat(WMS._WeatherMakerCloudShadowDistanceFade)); } } }
private void CameraPostRender(Camera camera) { if (Application.isPlaying && !WeatherMakerScript.ShouldIgnoreCamera(this, camera) && WeatherMakerCommandBufferManagerScript.CameraStack < 2) { OnCameraPostRender(camera); } }
private void CameraPreCull(Camera camera) { if (IsFirstPerson && !WeatherMakerScript.ShouldIgnoreCamera(this, camera)) { transform.position = camera.transform.position; } }
private void CameraPreCull(Camera camera) { if (effect != null && !WeatherMakerScript.ShouldIgnoreCamera(this, camera, !AllowReflections)) { UpdateFogProperties(camera); effect.PreCullCamera(camera); } }
private void OnDestroy() { if (WeatherMakerCommandBufferManagerScript.Instance != null) { WeatherMakerCommandBufferManagerScript.Instance.UnregisterPreCull(this); } WeatherMakerScript.ReleaseInstance(ref instance); }
private void SetupReferences() { Instance = this; UpdateCollision(); WeatherMakerShaderIds.Initialize(); VolumeModifier = volumeModifier; Camera = (Camera == null ? Camera.main : Camera); }
private void OnEnable() { WeatherMakerScript.EnsureInstance(this, ref instance); if (WeatherMakerCommandBufferManagerScript.Instance != null) { WeatherMakerCommandBufferManagerScript.Instance.RegisterPreCull(CameraPreCull, this); } }
private void OnEnable() { WeatherMakerScript.EnsureInstance(this, ref instance); if (cloudParticleSystem != null && wasPlaying) { cloudParticleSystem.Play(); } }
private void CameraPostRender(Camera camera) { if (WeatherMakerScript.ShouldIgnoreCamera(this, camera) || camera.orthographic || WeatherMakerCommandBufferManagerScript.CameraStack > 1) { return; } MeshRenderer.sharedMaterial = skySphereMaterial.Original; }