Пример #1
0
        void Update()
        {
            try
            {
                WindDirVector = CalculateWindDirVector();

                Projection.TightFit = tightProjectionFit;

                UpdateOceanScheduler();

                OverlayManager.Update();

                specularRoughness = Mathf.Clamp01(specularRoughness);
                specularIntensity = Mathf.Max(0.0f, specularIntensity);
                minFresnel        = Mathf.Clamp01(minFresnel);
                fresnelPower      = Mathf.Max(0.0f, fresnelPower);
                foamIntensity     = Math.Max(0.0f, foamIntensity);

                float sr = Mathf.Lerp(2e-5f, 2e-2f, specularRoughness);

                Shader.SetGlobalColor("Ceto_DefaultSkyColor", defaultSkyColor);
                Shader.SetGlobalColor("Ceto_DefaultOceanColor", defaultOceanColor);
                Shader.SetGlobalFloat("Ceto_SpecularRoughness", sr);
                Shader.SetGlobalFloat("Ceto_FresnelPower", fresnelPower);
                Shader.SetGlobalFloat("Ceto_SpecularIntensity", specularIntensity);
                Shader.SetGlobalFloat("Ceto_MinFresnel", minFresnel);
                Shader.SetGlobalFloat("Ceto_OceanLevel", level);
                Shader.SetGlobalFloat("Ceto_MaxWaveHeight", MAX_SPECTRUM_WAVE_HEIGHT);
                Shader.SetGlobalColor("Ceto_FoamTint", foamTint * foamIntensity);
                Shader.SetGlobalVector("Ceto_SunDir", SunDir());
                Shader.SetGlobalVector("Ceto_SunColor", SunColor());

                Vector4 foamParam0 = new Vector4();
                foamParam0.x = (foamTexture0.scale.x != 0.0f) ? 1.0f / foamTexture0.scale.x : 1.0f;
                foamParam0.y = (foamTexture0.scale.y != 0.0f) ? 1.0f / foamTexture0.scale.y : 1.0f;
                foamParam0.z = foamTexture0.scrollSpeed * OceanTime.Now;
                foamParam0.w = 0.0f;

                Vector4 foamParam1 = new Vector4();
                foamParam1.x = (foamTexture1.scale.x != 0.0f) ? 1.0f / foamTexture1.scale.x : 1.0f;
                foamParam1.y = (foamTexture1.scale.y != 0.0f) ? 1.0f / foamTexture1.scale.y : 1.0f;
                foamParam1.z = foamTexture1.scrollSpeed * OceanTime.Now;
                foamParam1.w = 0.0f;

                Shader.SetGlobalTexture("Ceto_FoamTexture0", ((foamTexture0.tex != null) ? foamTexture0.tex : Texture2D.whiteTexture));
                Shader.SetGlobalVector("Ceto_FoamTextureScale0", foamParam0);

                Shader.SetGlobalTexture("Ceto_FoamTexture1", ((foamTexture1.tex != null) ? foamTexture1.tex : Texture2D.whiteTexture));
                Shader.SetGlobalVector("Ceto_FoamTextureScale1", foamParam1);

                //Rest each data element so they are updated this frame.
                var e = m_cameraData.GetEnumerator();
                while (e.MoveNext())
                {
                    CameraData data = e.Current.Value;

                    if (data.mask != null)
                    {
                        data.mask.ClearUpdatedViews();
                    }
                    if (data.depth != null)
                    {
                        data.depth.ClearUpdatedViews();
                    }
                    if (data.overlay != null)
                    {
                        data.overlay.ClearUpdatedViews();
                    }
                    if (data.reflection != null)
                    {
                        data.reflection.ClearUpdatedViews();
                    }

                    if (data.projection != null)
                    {
                        data.projection.ClearUpdatedViews();
                        data.projection.checkedForFlipping = false;
                    }
                }
            }
            catch (Exception e)
            {
                LogError(e.ToString());
                DisableOcean();
            }
        }
Пример #2
0
        void Update()
        {
            // ####################################################### Modificação #######################################################################
            int    indice = 0;
            string line;

            System.IO.StreamReader file =
                new System.IO.StreamReader(@"\\VISUALIZADOR_04\server\ultimo_oceano.txt");
            while (((line = file.ReadLine()) != null) && (indice < 30))
            {
                dados [indice] = line;
                indice++;
            }
            file.Close();
            pegaDados();
            // ##############################################################################################################################################
            try
            {
                WindDirVector = CalculateWindDirVector();

                Projection.TightFit = tightProjectionFit;

                UpdateOceanScheduler();

                OverlayManager.Update();

                specularRoughness = Mathf.Clamp01(specularRoughness);
                specularIntensity = Mathf.Max(0.0f, specularIntensity);
                minFresnel        = Mathf.Clamp01(minFresnel);
                fresnelPower      = Mathf.Max(0.0f, fresnelPower);
                foamIntensity     = Math.Max(0.0f, foamIntensity);

                float sr = Mathf.Lerp(2e-5f, 2e-2f, specularRoughness);

                Shader.SetGlobalColor("Ceto_DefaultSkyColor", defaultSkyColor);
                Shader.SetGlobalColor("Ceto_DefaultOceanColor", defaultOceanColor);
                Shader.SetGlobalFloat("Ceto_SpecularRoughness", sr);
                Shader.SetGlobalFloat("Ceto_FresnelPower", fresnelPower);
                Shader.SetGlobalFloat("Ceto_SpecularIntensity", specularIntensity);
                Shader.SetGlobalFloat("Ceto_MinFresnel", minFresnel);
                Shader.SetGlobalFloat("Ceto_OceanLevel", level);
                Shader.SetGlobalFloat("Ceto_MaxWaveHeight", MAX_SPECTRUM_WAVE_HEIGHT);
                Shader.SetGlobalColor("Ceto_FoamTint", foamTint * foamIntensity); //Brian here: THIS line might give me something(duplicate it for OilTint, change shader?...Like you know how to work a shader)
                Shader.SetGlobalColor("Ceto_OilTint", oilTint);                   //proto mod
                Shader.SetGlobalVector("Ceto_SunDir", SunDir());
                Shader.SetGlobalVector("Ceto_SunColor", SunColor());

                Vector4 foamParam0 = new Vector4();
                foamParam0.x = (foamTexture0.scale.x != 0.0f) ? 1.0f / foamTexture0.scale.x : 1.0f;
                foamParam0.y = (foamTexture0.scale.y != 0.0f) ? 1.0f / foamTexture0.scale.y : 1.0f;
                foamParam0.z = foamTexture0.scrollSpeed * OceanTime.Now;
                foamParam0.w = 0.0f;

                Vector4 foamParam1 = new Vector4();
                foamParam1.x = (foamTexture1.scale.x != 0.0f) ? 1.0f / foamTexture1.scale.x : 1.0f;
                foamParam1.y = (foamTexture1.scale.y != 0.0f) ? 1.0f / foamTexture1.scale.y : 1.0f;
                foamParam1.z = foamTexture1.scrollSpeed * OceanTime.Now;
                foamParam1.w = 0.0f;

                Shader.SetGlobalTexture("Ceto_FoamTexture0", ((foamTexture0.tex != null) ? foamTexture0.tex : Texture2D.whiteTexture));
                Shader.SetGlobalVector("Ceto_FoamTextureScale0", foamParam0);

                Shader.SetGlobalTexture("Ceto_FoamTexture1", ((foamTexture1.tex != null) ? foamTexture1.tex : Texture2D.whiteTexture));
                Shader.SetGlobalVector("Ceto_FoamTextureScale1", foamParam1);

                //Rest each data element so they are updated this frame.
                var e = m_cameraData.GetEnumerator();
                while (e.MoveNext())
                {
                    CameraData data = e.Current.Value;

                    if (data.mask != null)
                    {
                        data.mask.ClearUpdatedViews();
                    }
                    if (data.depth != null)
                    {
                        data.depth.ClearUpdatedViews();
                    }
                    if (data.overlay != null)
                    {
                        data.overlay.ClearUpdatedViews();
                    }
                    if (data.reflection != null)
                    {
                        data.reflection.ClearUpdatedViews();
                    }

                    if (data.projection != null)
                    {
                        data.projection.ClearUpdatedViews();
                        data.projection.checkedForFlipping = false;
                    }
                }
            }
            catch (Exception e)
            {
                LogError(e.ToString());
                DisableOcean();
            }
        }