Example #1
0
        public static bool CheckSupport()
        {
            RenderTextureFormat?format = Compatibility.GetFormat(RenderTextureFormat.RGHalf, new RenderTextureFormat[]
            {
                RenderTextureFormat.RGFloat
            });

            if (!SystemInfo.supportsComputeShaders || !SystemInfo.supports3DTextures || format == null)
            {
                WaterLogger.Warning("Dynamic Smoothness", "Check Support", "Dynamic Smoothness not supported");
                if (!SystemInfo.supportsComputeShaders)
                {
                    WaterLogger.Warning("Dynamic Smoothness", "Check Support", " - compute shaders not supported");
                }
                if (!SystemInfo.supports3DTextures)
                {
                    WaterLogger.Warning("Dynamic Smoothness", "Check Support", " - 3D textures not supported");
                }
                if (format == null)
                {
                    WaterLogger.Warning("Dynamic Smoothness", "Check Support", " - necessary RenderTexture formats not found");
                }
                return(false);
            }
            DynamicSmoothness._Format = format.Value;
            return(true);
        }
Example #2
0
        public void OnEnable(WaterCamera waterCamera)
        {
            if (!Application.isPlaying)
            {
                return;
            }
            RenderTextureFormat preferred = RenderTextureFormat.Depth;

            RenderTextureFormat[] array = new RenderTextureFormat[3];
            RuntimeHelpers.InitializeArray(array, fieldof(< PrivateImplementationDetails >.$field - 2BEF801ABDD507D9EA15BD732E2FD447518DF1B3).FieldHandle);
            RenderTextureFormat?format  = Compatibility.GetFormat(preferred, array);
            RenderTextureFormat?format2 = Compatibility.GetFormat(RenderTextureFormat.RFloat, new RenderTextureFormat[]
            {
                RenderTextureFormat.RHalf
            });

            if (format == null || format2 == null)
            {
                return;
            }
            this._Commands = new CommandBuffer
            {
                name = "[UWS] DepthModule - Render Depth"
            };
            this._CameraDepthTextureId = ShaderVariables.CameraDepthTexture2;
            this._WaterDepthTextureId  = ShaderVariables.WaterDepthTexture;
            this._WaterlessDepthId     = ShaderVariables.WaterlessDepthTexture;
            this._DepthFormat          = format.Value;
            this._BlendedDepthFormat   = format.Value;
            if (SystemInfo.graphicsShaderLevel < 50)
            {
                this._BlendedDepthFormat = format2.Value;
                if (this._BlendedDepthFormat == RenderTextureFormat.RFloat && waterCamera.BaseEffectsQuality < 0.2f)
                {
                    RenderTextureFormat?format3 = Compatibility.GetFormat(RenderTextureFormat.RHalf, null);
                    if (format3 == null)
                    {
                        return;
                    }
                    this._BlendedDepthFormat = format3.Value;
                }
            }
        }