private void CleanUp() { LuxWater_UnderWaterRendering.instance = (LuxWater_UnderWaterRendering)null; if (Object.op_Inequality((Object)this.UnderWaterMask, (Object)null)) { this.UnderWaterMask.Release(); Object.Destroy((Object)this.UnderWaterMask); } if (Object.op_Implicit((Object)this.mat)) { Object.Destroy((Object)this.mat); } if (Object.op_Implicit((Object)this.blurMaterial)) { Object.Destroy((Object)this.blurMaterial); } if (Object.op_Implicit((Object)this.blitMaterial)) { Object.Destroy((Object)this.blitMaterial); } Shader.DisableKeyword("LUXWATER_DEEPWATERLIGHTING"); Shader.DisableKeyword("LUXWATER_DEFERREDFOG"); this.RegisteredWaterVolumesIDs.Clear(); this.RegisteredWaterVolumes.Clear(); this.WaterMeshes.Clear(); this.WaterTransforms.Clear(); this.WaterMaterials.Clear(); this.WaterIsOnScreen.Clear(); this.WaterUsesSlidingVolume.Clear(); this.activeWaterVolumeCameras.Clear(); }
void GetWaterrendermanager() { var manager = LuxWater_UnderWaterRendering.instance; if (manager != null) { waterrendermanager = manager; readyToGo = true; } }
void Register() { waterrendermanager = LuxWater_UnderWaterRendering.instance; // Check if the renderer is visible. Needed in case the script is enabled when the renderer already is on screen as OnBecameVisible will fail... var visible = GetComponent <Renderer>().isVisible; waterrendermanager.RegisterWaterVolume(this, visible); readyToGo = true; }
private void GetWaterrendermanager() { LuxWater_UnderWaterRendering instance = LuxWater_UnderWaterRendering.instance; if (!Object.op_Inequality((Object)instance, (Object)null)) { return; } this.waterrendermanager = instance; this.readyToGo = true; }
private void Register() { if (Object.op_Inequality((Object)LuxWater_UnderWaterRendering.instance, (Object)null)) { this.waterrendermanager = LuxWater_UnderWaterRendering.instance; this.waterrendermanager.RegisterWaterVolume(this, this.ID, ((Renderer)((Component)this).GetComponent <Renderer>()).get_isVisible(), this.SlidingVolume); this.readyToGo = true; } else { this.Invoke(nameof(Register), 0.0f); } }
void CleanUp() { instance = null; if (UnderWaterMask != null) { UnderWaterMask.Release(); Destroy(UnderWaterMask); } if (mat) { Destroy(mat); } if (blurMaterial) { Destroy(blurMaterial); } if (blitMaterial) { Destroy(blitMaterial); } Shader.DisableKeyword("LUXWATER_DEEPWATERLIGHTING"); Shader.DisableKeyword("LUXWATER_DEFERREDFOG"); }
private void GetWaterrendermanagerInstance() { this.waterrendermanager = LuxWater_UnderWaterRendering.instance; }
private void OnEnable() { if (Object.op_Inequality((Object)LuxWater_UnderWaterRendering.instance, (Object)null)) { Object.Destroy((Object)this); } else { LuxWater_UnderWaterRendering.instance = this; } this.mat = new Material(Shader.Find("Hidden/Lux Water/WaterMask")); this.blurMaterial = new Material(Shader.Find("Hidden/Lux Water/BlurEffectConeTap")); this.blitMaterial = new Material(Shader.Find("Hidden/Lux Water/UnderWaterPost")); if (Object.op_Equality((Object)this.cam, (Object)null)) { this.cam = (Camera)((Component)this).GetComponent <Camera>(); } Camera cam = this.cam; cam.set_depthTextureMode((DepthTextureMode)(cam.get_depthTextureMode() | 1)); this.camTransform = ((Component)this.cam).get_transform(); if (this.FindSunOnEnable) { if (this.SunGoName != string.Empty) { this.Sun = GameObject.Find(this.SunGoName).get_transform(); } else if (this.SunTagName != string.Empty) { this.Sun = GameObject.FindWithTag(this.SunTagName).get_transform(); } } this.Projection = !SystemInfo.get_usesReversedZBuffer() ? 1f : -1f; this.UnderWaterMaskPID = Shader.PropertyToID("_UnderWaterMask"); this.Lux_FrustumCornersWSPID = Shader.PropertyToID("_Lux_FrustumCornersWS"); this.Lux_CameraWSPID = Shader.PropertyToID("_Lux_CameraWS"); this.GerstnerEnabledPID = Shader.PropertyToID("_GerstnerEnabled"); this.LuxWaterMask_GerstnerVertexIntensityPID = Shader.PropertyToID("_LuxWaterMask_GerstnerVertexIntensity"); this.GerstnerVertexIntensityPID = Shader.PropertyToID("_GerstnerVertexIntensity"); this.LuxWaterMask_GAmplitudePID = Shader.PropertyToID("_LuxWaterMask_GAmplitude"); this.GAmplitudePID = Shader.PropertyToID("_GAmplitude"); this.LuxWaterMask_GFinalFrequencyPID = Shader.PropertyToID("_LuxWaterMask_GFinalFrequency"); this.GFinalFrequencyPID = Shader.PropertyToID("_GFinalFrequency"); this.LuxWaterMask_GSteepnessPID = Shader.PropertyToID("_LuxWaterMask_GSteepness"); this.GSteepnessPID = Shader.PropertyToID("_GSteepness"); this.LuxWaterMask_GFinalSpeedPID = Shader.PropertyToID("_LuxWaterMask_GFinalSpeed"); this.GFinalSpeedPID = Shader.PropertyToID("_GFinalSpeed"); this.LuxWaterMask_GDirectionABPID = Shader.PropertyToID("_LuxWaterMask_GDirectionAB"); this.GDirectionABPID = Shader.PropertyToID("_GDirectionAB"); this.LuxWaterMask_GDirectionCDPID = Shader.PropertyToID("_LuxWaterMask_GDirectionCD"); this.GDirectionCDPID = Shader.PropertyToID("_GDirectionCD"); this.LuxWaterMask_GerstnerSecondaryWaves = Shader.PropertyToID("_LuxWaterMask_GerstnerSecondaryWaves"); this.GerstnerSecondaryWaves = Shader.PropertyToID("_GerstnerSecondaryWaves"); this.Lux_UnderWaterAmbientSkyLightPID = Shader.PropertyToID("_Lux_UnderWaterAmbientSkyLight"); this.Lux_UnderWaterSunColorPID = Shader.PropertyToID("_Lux_UnderWaterSunColor"); this.Lux_UnderWaterSunDirPID = Shader.PropertyToID("_Lux_UnderWaterSunDir"); this.Lux_UnderWaterSunDirViewSpacePID = Shader.PropertyToID("_Lux_UnderWaterSunDirViewSpace"); this.Lux_EdgeLengthPID = Shader.PropertyToID("_LuxWater_EdgeLength"); this.Lux_MaxDirLightDepthPID = Shader.PropertyToID("_MaxDirLightDepth"); this.Lux_MaxFogLightDepthPID = Shader.PropertyToID("_MaxFogLightDepth"); this.Lux_CausticsEnabledPID = Shader.PropertyToID("_CausticsEnabled"); this.Lux_CausticModePID = Shader.PropertyToID("_CausticMode"); this.Lux_UnderWaterFogColorPID = Shader.PropertyToID("_Lux_UnderWaterFogColor"); this.Lux_UnderWaterFogDensityPID = Shader.PropertyToID("_Lux_UnderWaterFogDensity"); this.Lux_UnderWaterFogAbsorptionCancellationPID = Shader.PropertyToID("_Lux_UnderWaterFogAbsorptionCancellation"); this.Lux_UnderWaterAbsorptionHeightPID = Shader.PropertyToID("_Lux_UnderWaterAbsorptionHeight"); this.Lux_UnderWaterAbsorptionMaxHeightPID = Shader.PropertyToID("_Lux_UnderWaterAbsorptionMaxHeight"); this.Lux_UnderWaterAbsorptionDepthPID = Shader.PropertyToID("_Lux_UnderWaterAbsorptionDepth"); this.Lux_UnderWaterAbsorptionColorStrengthPID = Shader.PropertyToID("_Lux_UnderWaterAbsorptionColorStrength"); this.Lux_UnderWaterAbsorptionStrengthPID = Shader.PropertyToID("_Lux_UnderWaterAbsorptionStrength"); this.Lux_UnderWaterUnderwaterScatteringPowerPID = Shader.PropertyToID("_Lux_UnderWaterUnderwaterScatteringPower"); this.Lux_UnderWaterUnderwaterScatteringIntensityPID = Shader.PropertyToID("_Lux_UnderWaterUnderwaterScatteringIntensity"); this.Lux_UnderWaterUnderwaterScatteringColorPID = Shader.PropertyToID("_Lux_UnderWaterUnderwaterScatteringColor"); this.Lux_UnderWaterUnderwaterScatteringOcclusionPID = Shader.PropertyToID("_Lux_UnderwaterScatteringOcclusion"); this.Lux_UnderWaterCausticsPID = Shader.PropertyToID("_Lux_UnderWaterCaustics"); this.Lux_UnderWaterDeferredFogParams = Shader.PropertyToID("_LuxUnderWaterDeferredFogParams"); this.CausticTexPID = Shader.PropertyToID("_CausticTex"); this.islinear = QualitySettings.get_desiredColorSpace() == 1; if (Object.op_Inequality((Object)this.PrewarmedShaders, (Object)null) && !this.PrewarmedShaders.get_isWarmedUp()) { this.PrewarmedShaders.WarmUp(); } if (Object.op_Inequality((Object)this.Sun, (Object)null)) { this.SunLight = (Light)((Component)this.Sun).GetComponent <Light>(); } this.RegisteredWaterVolumesIDs.Capacity = this.ListCapacity; this.RegisteredWaterVolumes.Capacity = this.ListCapacity; this.WaterMeshes.Capacity = this.ListCapacity; this.WaterTransforms.Capacity = this.ListCapacity; this.WaterMaterials.Capacity = this.ListCapacity; this.WaterIsOnScreen.Capacity = this.ListCapacity; this.WaterUsesSlidingVolume.Capacity = this.ListCapacity; this.activeWaterVolumeCameras.Capacity = 2; this.SetDeepwaterLighting(); this.SetDeferredFogParams(); }
void GetWaterrendermanagerInstance() { waterrendermanager = LuxWater_UnderWaterRendering.instance; }
// Use this for initialization void OnEnable() { if (instance != null) { Destroy(this); } else { instance = this; } mat = new Material(Shader.Find("Hidden/Lux Water/WaterMask")); blurMaterial = new Material(Shader.Find("Hidden/Lux Water/BlurEffectConeTap")); //Ceto/BlurEffectConeTap")); blitMaterial = new Material(Shader.Find("Hidden/Lux Water/UnderWaterPost")); if (cam == null) { cam = GetComponent <Camera>(); } // Metal support – make sure the camera actually renders a depth texture cam.depthTextureMode |= DepthTextureMode.Depth; //camTransform = this.transform; camTransform = cam.transform; UnderWaterMaskPID = Shader.PropertyToID("_UnderWaterMask"); Lux_FrustumCornersWSPID = Shader.PropertyToID("_Lux_FrustumCornersWS"); Lux_CameraWSPID = Shader.PropertyToID("_Lux_CameraWS"); GerstnerEnabledPID = Shader.PropertyToID("_GerstnerEnabled"); LuxWaterMask_GerstnerVertexIntensityPID = Shader.PropertyToID("_LuxWaterMask_GerstnerVertexIntensity"); GerstnerVertexIntensityPID = Shader.PropertyToID("_GerstnerVertexIntensity"); LuxWaterMask_GAmplitudePID = Shader.PropertyToID("_LuxWaterMask_GAmplitude"); GAmplitudePID = Shader.PropertyToID("_GAmplitude"); LuxWaterMask_GFinalFrequencyPID = Shader.PropertyToID("_LuxWaterMask_GFinalFrequency"); GFinalFrequencyPID = Shader.PropertyToID("_GFinalFrequency"); LuxWaterMask_GSteepnessPID = Shader.PropertyToID("_LuxWaterMask_GSteepness"); GSteepnessPID = Shader.PropertyToID("_GSteepness"); LuxWaterMask_GFinalSpeedPID = Shader.PropertyToID("_LuxWaterMask_GFinalSpeed"); GFinalSpeedPID = Shader.PropertyToID("_GFinalSpeed"); LuxWaterMask_GDirectionABPID = Shader.PropertyToID("_LuxWaterMask_GDirectionAB"); GDirectionABPID = Shader.PropertyToID("_GDirectionAB"); LuxWaterMask_GDirectionCDPID = Shader.PropertyToID("_LuxWaterMask_GDirectionCD"); GDirectionCDPID = Shader.PropertyToID("_GDirectionCD"); Lux_UnderWaterAmbientSkyLightPID = Shader.PropertyToID("_Lux_UnderWaterAmbientSkyLight"); Lux_UnderWaterSunColorPID = Shader.PropertyToID("_Lux_UnderWaterSunColor"); Lux_UnderWaterSunDirPID = Shader.PropertyToID("_Lux_UnderWaterSunDir"); Lux_EdgeLengthPID = Shader.PropertyToID("_LuxWater_EdgeLength"); Lux_PhongPID = Shader.PropertyToID("_LuxWater_Phong"); Lux_WaterMeshScalePID = Shader.PropertyToID("_LuxWater_MeshScale"); Lux_MaxDirLightDepthPID = Shader.PropertyToID("_MaxDirLightDepth"); Lux_MaxFogLightDepthPID = Shader.PropertyToID("_MaxFogLightDepth"); Lux_CausticsEnabledPID = Shader.PropertyToID("_CausticsEnabled"); Lux_CausticModePID = Shader.PropertyToID("_CausticMode"); Lux_UnderWaterFogColorPID = Shader.PropertyToID("_Lux_UnderWaterFogColor"); Lux_UnderWaterFogDensityPID = Shader.PropertyToID("_Lux_UnderWaterFogDensity"); Lux_UnderWaterFogAbsorptionCancellationPID = Shader.PropertyToID("_Lux_UnderWaterFogAbsorptionCancellation"); Lux_UnderWaterAbsorptionHeightPID = Shader.PropertyToID("_Lux_UnderWaterAbsorptionHeight"); Lux_UnderWaterAbsorptionMaxHeightPID = Shader.PropertyToID("_Lux_UnderWaterAbsorptionMaxHeight"); Lux_UnderWaterDeferredFogParams = Shader.PropertyToID("_LuxUnderWaterDeferredFogParams"); islinear = (QualitySettings.desiredColorSpace == ColorSpace.Linear) ? true : false; // Deep Water Lighting and advanced deferred Fog SetDeepwaterLighting(); SetDeferredFogParams(); }