예제 #1
0
        private void OnGUI()
        {
            if (Ocean.Instance == null)
            {
                return;
            }
            UnderWaterPostEffect component  = this.m_camera.GetComponent <UnderWaterPostEffect>();
            WaveSpectrum         component2 = Ocean.Instance.GetComponent <WaveSpectrum>();
            PlanarReflection     component3 = Ocean.Instance.GetComponent <PlanarReflection>();
            UnderWater           component4 = Ocean.Instance.GetComponent <UnderWater>();
            ProjectedGrid        component5 = Ocean.Instance.GetComponent <ProjectedGrid>();

            GUILayout.BeginArea(this.m_hideToggle);
            GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
            this.m_hide = GUILayout.Toggle(this.m_hide, " Hide GUI", new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
            if (this.m_hide)
            {
                return;
            }
            if (component3 != null)
            {
                bool flag = component3.enabled;
                GUILayout.BeginArea(this.m_reflectionsToggle);
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                flag = GUILayout.Toggle(flag, " Reflection", new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
                component3.enabled = flag;
            }
            if (component4 != null)
            {
                bool flag2 = component4.enabled;
                GUILayout.BeginArea(this.m_refractionToggle);
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                flag2 = GUILayout.Toggle(flag2, " Refraction", new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
                component4.enabled = flag2;
            }
            if (component2 != null && component5 != null)
            {
                GUILayout.BeginArea(this.m_detailToggle);
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                this.m_ultraDetailOn = GUILayout.Toggle(this.m_ultraDetailOn, " Ultra Detail", new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
                if (this.m_ultraDetailOn)
                {
                    component5.resolution      = MESH_RESOLUTION.ULTRA;
                    component2.fourierSize     = FOURIER_SIZE.ULTRA_256_GPU;
                    component2.disableReadBack = !this.m_supportsDX11;
                }
                else
                {
                    component5.resolution      = MESH_RESOLUTION.HIGH;
                    component2.fourierSize     = FOURIER_SIZE.MEDIUM_64_CPU;
                    component2.disableReadBack = true;
                }
            }
            GUILayout.BeginArea(this.m_settings);
            GUILayout.BeginVertical("Box", new GUILayoutOption[0]);
            float num = Ocean.Instance.windDir;

            GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
            GUILayout.Label("Wind Direction", new GUILayoutOption[]
            {
                GUILayout.MaxWidth(this.m_textWidth)
            });
            num = GUILayout.HorizontalSlider(num, 0f, 360f, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            Ocean.Instance.windDir = num;
            if (component2 != null)
            {
                float num2 = component2.windSpeed;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Wind Speed", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num2 = GUILayout.HorizontalSlider(num2, 0f, 30f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component2.windSpeed = num2;
            }
            if (component2 != null)
            {
                float num3 = component2.waveAge;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Wave Age", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num3 = GUILayout.HorizontalSlider(num3, 0.5f, 1f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component2.waveAge = num3;
            }
            if (component2 != null)
            {
                float num4 = component2.waveSpeed;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Wave Speed", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num4 = GUILayout.HorizontalSlider(num4, 0f, 10f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component2.waveSpeed = num4;
            }
            if (component2 != null)
            {
                float num5 = component2.choppyness;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Choppyness", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num5 = GUILayout.HorizontalSlider(num5, 0f, 1.2f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component2.choppyness = num5;
            }
            if (component2 != null)
            {
                float num6 = component2.foamAmount;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Foam Amount", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num6 = GUILayout.HorizontalSlider(num6, 0f, 6f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component2.foamAmount = num6;
            }
            if (component2 != null)
            {
                float num7 = component2.foamCoverage;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Foam Coverage", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num7 = GUILayout.HorizontalSlider(num7, 0f, 0.5f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component2.foamCoverage = num7;
            }
            if (component3 != null)
            {
                int num8 = component3.blurIterations;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Reflection blur", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num8 = (int)GUILayout.HorizontalSlider((float)num8, 0f, 4f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component3.blurIterations = num8;
            }
            if (component3 != null)
            {
                float num9 = component3.reflectionIntensity;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Reflection Intensity", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num9 = GUILayout.HorizontalSlider(num9, 0f, 200f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component3.reflectionIntensity = num9;
            }
            if (component4 != null)
            {
                float num10 = component4.refractionIntensity;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Refraction Intensity", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num10 = GUILayout.HorizontalSlider(num10, 0f, 2f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component4.refractionIntensity = num10;
            }
            if (component2 != null)
            {
                int num11 = component2.numberOfGrids;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Num Grids", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num11 = (int)GUILayout.HorizontalSlider((float)num11, 1f, 4f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component2.numberOfGrids = num11;
            }
            if (component2 != null)
            {
                float num12 = component2.gridScale;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Grid Scale", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num12 = GUILayout.HorizontalSlider(num12, 0.1f, 1f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component2.gridScale = num12;
            }
            if (component4 != null)
            {
                float num13 = component4.subSurfaceScatterModifier.intensity;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("SSS Intensity", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num13 = GUILayout.HorizontalSlider(num13, 0f, 10f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component4.subSurfaceScatterModifier.intensity = num13;
            }
            if (component != null)
            {
                int num14 = component.blurIterations;
                GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
                GUILayout.Label("Underwater Blur", new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(this.m_textWidth)
                });
                num14 = (int)GUILayout.HorizontalSlider((float)num14, 0f, 4f, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                component.blurIterations = num14;
            }
            string text = "W to move ship forward.\r\nA/D to turn.\r\nLeft click and drag to rotate camera.\r\nF2 to toggle wireframe.\r\nKeypad +/- to move sun.";

            if (this.m_fps != null)
            {
                text = text + "\nCurrent FPS = " + this.m_fps.FrameRate.ToString("F2");
            }
            GUILayout.BeginHorizontal("Box", new GUILayoutOption[0]);
            GUILayout.TextArea(text, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
예제 #2
0
        void OnGUI()
        {
            if (Ocean.Instance == null)
            {
                return;
            }

            UnderWaterPostEffect postEffect = m_camera.GetComponent <UnderWaterPostEffect>();

            WaveSpectrum     spectrum   = Ocean.Instance.GetComponent <WaveSpectrum>();
            PlanarReflection reflection = Ocean.Instance.GetComponent <PlanarReflection>();
            UnderWater       underWater = Ocean.Instance.GetComponent <UnderWater>();
            ProjectedGrid    grid       = Ocean.Instance.GetComponent <ProjectedGrid>();

            if (true)
            {
                GUILayout.BeginArea(m_hideToggle);
                GUILayout.BeginHorizontal("Box");
                m_hide = GUILayout.Toggle(m_hide, " Hide GUI");
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }

            if (m_hide)
            {
                return;
            }

            if (reflection != null)
            {
                bool on = reflection.enabled;

                GUILayout.BeginArea(m_reflectionsToggle);
                GUILayout.BeginHorizontal("Box");
                on = GUILayout.Toggle(on, " Reflection");
                GUILayout.EndHorizontal();
                GUILayout.EndArea();

                reflection.enabled = on;
            }

            if (underWater != null)
            {
                bool on = underWater.enabled;

                GUILayout.BeginArea(m_refractionToggle);
                GUILayout.BeginHorizontal("Box");
                on = GUILayout.Toggle(on, " Refraction");
                GUILayout.EndHorizontal();
                GUILayout.EndArea();

                underWater.enabled = on;
            }

            if (spectrum != null && grid != null)
            {
                GUILayout.BeginArea(m_detailToggle);
                GUILayout.BeginHorizontal("Box");
                m_ultraDetailOn = GUILayout.Toggle(m_ultraDetailOn, " Ultra Detail");
                GUILayout.EndHorizontal();
                GUILayout.EndArea();

                if (m_ultraDetailOn)
                {
                    grid.resolution          = MESH_RESOLUTION.ULTRA;
                    spectrum.fourierSize     = FOURIER_SIZE.ULTRA_256_GPU;
                    spectrum.disableReadBack = !m_supportsDX11;
                }
                else
                {
                    grid.resolution          = MESH_RESOLUTION.HIGH;
                    spectrum.fourierSize     = FOURIER_SIZE.MEDIUM_64_CPU;
                    spectrum.disableReadBack = true;
                }
            }

            GUILayout.BeginArea(m_settings);
            GUILayout.BeginVertical("Box");

            if (true)
            {
                float windDir = Ocean.Instance.windDir;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Wind Direction", GUILayout.MaxWidth(m_textWidth));
                windDir = GUILayout.HorizontalSlider(windDir, 0.0f, 360.0f);
                GUILayout.EndHorizontal();

                Ocean.Instance.windDir = windDir;
            }

            /*
             * if (m_uSky != null)
             * {
             *  float timeLine = m_uSky.GetComponent<uSkyManager>().Timeline;
             *
             *  GUILayout.BeginHorizontal("Box");
             *  GUILayout.Label("Sun Dir", GUILayout.MaxWidth(m_textWidth));
             *  timeLine = GUILayout.HorizontalSlider(timeLine, 0.0f, 23.0f);
             *  GUILayout.EndHorizontal();
             *
             *  m_uSky.GetComponent<uSkyManager>().Timeline = timeLine;
             * }
             */

            if (spectrum != null)
            {
                float windSpeed = spectrum.windSpeed;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Wind Speed", GUILayout.MaxWidth(m_textWidth));
                windSpeed = GUILayout.HorizontalSlider(windSpeed, 0.0f, WaveSpectrum.MAX_WIND_SPEED);
                GUILayout.EndHorizontal();

                spectrum.windSpeed = windSpeed;
            }

            if (spectrum != null)
            {
                float waveAge = spectrum.waveAge;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Wave Age", GUILayout.MaxWidth(m_textWidth));
                waveAge = GUILayout.HorizontalSlider(waveAge, WaveSpectrum.MIN_WAVE_AGE, WaveSpectrum.MAX_WAVE_AGE);
                GUILayout.EndHorizontal();

                spectrum.waveAge = waveAge;
            }

            if (spectrum != null)
            {
                float waveSpeed = spectrum.waveSpeed;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Wave Speed", GUILayout.MaxWidth(m_textWidth));
                waveSpeed = GUILayout.HorizontalSlider(waveSpeed, 0.0f, WaveSpectrum.MAX_WAVE_SPEED);
                GUILayout.EndHorizontal();

                spectrum.waveSpeed = waveSpeed;
            }

            if (spectrum != null)
            {
                float choppyness = spectrum.choppyness;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Choppyness", GUILayout.MaxWidth(m_textWidth));
                choppyness = GUILayout.HorizontalSlider(choppyness, 0.0f, WaveSpectrum.MAX_CHOPPYNESS);
                GUILayout.EndHorizontal();

                spectrum.choppyness = choppyness;
            }

            if (spectrum != null)
            {
                float foamAmount = spectrum.foamAmount;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Foam Amount", GUILayout.MaxWidth(m_textWidth));
                foamAmount = GUILayout.HorizontalSlider(foamAmount, 0.0f, WaveSpectrum.MAX_FOAM_AMOUNT);
                GUILayout.EndHorizontal();

                spectrum.foamAmount = foamAmount;
            }

            if (spectrum != null)
            {
                float foamCoverage = spectrum.foamCoverage;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Foam Coverage", GUILayout.MaxWidth(m_textWidth));
                foamCoverage = GUILayout.HorizontalSlider(foamCoverage, 0.0f, WaveSpectrum.MAX_FOAM_COVERAGE);
                GUILayout.EndHorizontal();

                spectrum.foamCoverage = foamCoverage;
            }

            if (reflection != null)
            {
                int iterations = reflection.blurIterations;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Reflection blur", GUILayout.MaxWidth(m_textWidth));
                iterations = (int)GUILayout.HorizontalSlider(iterations, 0, 4);
                GUILayout.EndHorizontal();

                reflection.blurIterations = iterations;
            }

            if (reflection != null)
            {
                float intensity = reflection.reflectionIntensity;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Reflection Intensity", GUILayout.MaxWidth(m_textWidth));
                intensity = GUILayout.HorizontalSlider(intensity, 0.0f, PlanarReflection.MAX_REFLECTION_INTENSITY);
                GUILayout.EndHorizontal();

                reflection.reflectionIntensity = intensity;
            }

            if (underWater != null)
            {
                float intensity = underWater.aboveRefractionIntensity;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Refraction Intensity", GUILayout.MaxWidth(m_textWidth));
                intensity = GUILayout.HorizontalSlider(intensity, 0.0f, UnderWater.MAX_REFRACTION_INTENSITY);
                GUILayout.EndHorizontal();

                underWater.aboveRefractionIntensity = intensity;
            }

            if (spectrum != null)
            {
                int numGrids = spectrum.numberOfGrids;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Num Grids", GUILayout.MaxWidth(m_textWidth));
                numGrids = (int)GUILayout.HorizontalSlider(numGrids, 1, 4);
                GUILayout.EndHorizontal();

                spectrum.numberOfGrids = numGrids;
            }

            if (spectrum != null)
            {
                float scale = spectrum.gridScale;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Grid Scale", GUILayout.MaxWidth(m_textWidth));
                scale = GUILayout.HorizontalSlider(scale, WaveSpectrum.MIN_GRID_SCALE, WaveSpectrum.MAX_GRID_SCALE);
                GUILayout.EndHorizontal();

                spectrum.gridScale = scale;
            }


            if (underWater != null)
            {
                float intensity = underWater.subSurfaceScatterModifier.intensity;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("SSS Intensity", GUILayout.MaxWidth(m_textWidth));
                intensity = GUILayout.HorizontalSlider(intensity, 0.0f, 10.0f);
                GUILayout.EndHorizontal();

                underWater.subSurfaceScatterModifier.intensity = intensity;
            }

            if (postEffect != null)
            {
                int blur = postEffect.blurIterations;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Underwater Blur", GUILayout.MaxWidth(m_textWidth));
                blur = (int)GUILayout.HorizontalSlider(blur, 0, 4);
                GUILayout.EndHorizontal();

                postEffect.blurIterations = blur;
            }

            if (true)
            {
                string info =
                    @"W to move ship forward. A/D to turn.
Left click and drag to rotate camera.
Keypad +/- to move sun.
Ceto Version " + Ocean.VERSION;

                if (m_fps != null)
                {
                    info += "\nCurrent FPS = " + m_fps.FrameRate.ToString("F2");
                }

                GUILayout.BeginHorizontal("Box");
                GUILayout.TextArea(info);
                GUILayout.EndHorizontal();
            }

            GUILayout.EndVertical();
            GUILayout.EndArea();
        }