예제 #1
0
 public AmplifyGlare()
 {
     this.m_currentGlareIdx        = (int)this.m_currentGlareType;
     this.m_cromaticAberrationGrad = new Gradient();
     GradientColorKey[] colorKeys = new GradientColorKey[] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.blue, 0.25f), new GradientColorKey(Color.green, 0.5f), new GradientColorKey(Color.yellow, 0.75f), new GradientColorKey(Color.red, 1f) };
     GradientAlphaKey[] alphaKeys = new GradientAlphaKey[] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 0.25f), new GradientAlphaKey(1f, 0.5f), new GradientAlphaKey(1f, 0.75f), new GradientAlphaKey(1f, 1f) };
     this.m_cromaticAberrationGrad.SetKeys(colorKeys, alphaKeys);
     this._rtBuffer           = new RenderTexture[0x10];
     this.m_weigthsMat        = new Matrix4x4[4];
     this.m_offsetsMat        = new Matrix4x4[4];
     this.m_amplifyGlareCache = new AmplifyGlareCache();
     this.m_whiteReference    = new Color(0.63f, 0.63f, 0.63f, 0f);
     this.m_aTanFoV           = Mathf.Atan(0.3926991f);
     this.m_starDefArr        = new StarDefData[] { new StarDefData(StarLibType.Cross, "Cross", 2, 4, 1f, 0.85f, 0f, 0.5f, -1f, 90f), new StarDefData(StarLibType.Cross_Filter, "CrossFilter", 2, 4, 1f, 0.95f, 0f, 0.5f, -1f, 90f), new StarDefData(StarLibType.Snow_Cross, "snowCross", 3, 4, 1f, 0.96f, 0.349f, 0.5f, -1f, -1f), new StarDefData(StarLibType.Vertical, "Vertical", 1, 4, 1f, 0.96f, 0f, 0f, -1f, -1f), new StarDefData(StarLibType.Sunny_Cross, "SunnyCross", 4, 4, 1f, 0.88f, 0f, 0f, 0.95f, 45f) };
     GlareDefData[] dataArray2 = new GlareDefData[9];
     dataArray2[0]      = new GlareDefData(StarLibType.Cross, 0f, 0.5f);
     dataArray2[1]      = new GlareDefData(StarLibType.Cross_Filter, 0.44f, 0.5f);
     dataArray2[2]      = new GlareDefData(StarLibType.Cross_Filter, 1.22f, 1.5f);
     dataArray2[3]      = new GlareDefData(StarLibType.Snow_Cross, 0.17f, 0.5f);
     dataArray2[4]      = new GlareDefData(StarLibType.Snow_Cross, 0.7f, 1.5f);
     dataArray2[5]      = new GlareDefData(StarLibType.Sunny_Cross, 0f, 0.5f);
     dataArray2[6]      = new GlareDefData(StarLibType.Sunny_Cross, 0.79f, 1.5f);
     dataArray2[7]      = new GlareDefData(StarLibType.Vertical, 1.57f, 0.5f);
     dataArray2[8]      = new GlareDefData(StarLibType.Vertical, 0f, 0.5f);
     this.m_glareDefArr = dataArray2;
 }
예제 #2
0
        public AmplifyGlare()
        {
            m_currentGlareIdx = ( int )m_currentGlareType;

            m_cromaticAberrationGrad = new UnityEngine.Gradient();

            UnityEngine.GradientColorKey[] colorKeys = new UnityEngine.GradientColorKey[] { new UnityEngine.GradientColorKey(Color.white, 0f),
                                                                                            new UnityEngine.GradientColorKey(Color.blue, 0.25f),
                                                                                            new UnityEngine.GradientColorKey(Color.green, 0.5f),
                                                                                            new UnityEngine.GradientColorKey(Color.yellow, 0.75f),
                                                                                            new UnityEngine.GradientColorKey(Color.red, 1f) };
            UnityEngine.GradientAlphaKey[] alphaKeys = new UnityEngine.GradientAlphaKey[] { new UnityEngine.GradientAlphaKey(1f, 0f),
                                                                                            new UnityEngine.GradientAlphaKey(1f, 0.25f),
                                                                                            new UnityEngine.GradientAlphaKey(1f, 0.5f),
                                                                                            new UnityEngine.GradientAlphaKey(1f, 0.75f),
                                                                                            new UnityEngine.GradientAlphaKey(1f, 1f) };
            m_cromaticAberrationGrad.SetKeys(colorKeys, alphaKeys);


            _rtBuffer = new RenderTexture[MaxStarLines * MaxPasses];

            m_weigthsMat = new Matrix4x4[4];
            m_offsetsMat = new Matrix4x4[4];

            m_amplifyGlareCache = new AmplifyGlareCache();

            m_whiteReference = new Color(0.63f, 0.63f, 0.63f, 0.0f);
            m_aTanFoV        = Mathf.Atan(Mathf.PI / MaxLineSamples);


            m_starDefArr = new StarDefData[] { new StarDefData(StarLibType.Cross, "Cross", 2, 4, 1.0f, 0.85f, 0.0f, 0.5f, -1.0f, 90.0f),
                                               new StarDefData(StarLibType.Cross_Filter, "CrossFilter", 2, 4, 1.0f, 0.95f, 0.0f, 0.5f, -1.0f, 90.0f),
                                               new StarDefData(StarLibType.Snow_Cross, "snowCross", 3, 4, 1.0f, 0.96f, 0.349f, 0.5f, -1.0f, -1),
                                               new StarDefData(StarLibType.Vertical, "Vertical", 1, 4, 1.0f, 0.96f, 0.0f, 0.0f, -1.0f, -1),
                                               new StarDefData(StarLibType.Sunny_Cross, "SunnyCross", 4, 4, 1.0f, 0.88f, 0.0f, 0.0f, 0.95f, 45.0f) };

            m_glareDefArr = new GlareDefData[] { new GlareDefData(StarLibType.Cross, 0.00f, 0.5f),                        //Cheap Lens
                                                 new GlareDefData(StarLibType.Cross_Filter, 0.44f, 0.5f),                 //Cross Screen
                                                 new GlareDefData(StarLibType.Cross_Filter, 1.22f, 1.5f),                 //Cross Screen Spectral
                                                 new GlareDefData(StarLibType.Snow_Cross, 0.17f, 0.5f),                   //Snow Cross
                                                 new GlareDefData(StarLibType.Snow_Cross, 0.70f, 1.5f),                   //Snow Cross Spectral
                                                 new GlareDefData(StarLibType.Sunny_Cross, 0.00f, 0.5f),                  //Sunny Cross
                                                 new GlareDefData(StarLibType.Sunny_Cross, 0.79f, 1.5f),                  //Sunny Cross Spectral
                                                 new GlareDefData(StarLibType.Vertical, 1.57f, 0.5f),                     //Vertical Slits
                                                 new GlareDefData(StarLibType.Vertical, 0.00f, 0.5f)                      //Horizontal slits
            };
        }
예제 #3
0
 public void Destroy()
 {
     for (int i = 0; i < this.m_starDefArr.Length; i++)
     {
         this.m_starDefArr[i].Destroy();
     }
     this.m_glareDefArr = null;
     this.m_weigthsMat  = null;
     this.m_offsetsMat  = null;
     for (int j = 0; j < this._rtBuffer.Length; j++)
     {
         if (this._rtBuffer[j] != null)
         {
             AmplifyUtils.ReleaseTempRenderTarget(this._rtBuffer[j]);
             this._rtBuffer[j] = null;
         }
     }
     this._rtBuffer = null;
     this.m_amplifyGlareCache.Destroy();
     this.m_amplifyGlareCache = null;
 }
예제 #4
0
        public void Destroy()
        {
            for (int i = 0; i < m_starDefArr.Length; i++)
            {
                m_starDefArr[i].Destroy();
            }

            m_glareDefArr = null;
            m_weigthsMat  = null;
            m_offsetsMat  = null;

            for (int i = 0; i < _rtBuffer.Length; i++)
            {
                if (_rtBuffer[i] != null)
                {
                    AmplifyUtils.ReleaseTempRenderTarget(_rtBuffer[i]);
                    _rtBuffer[i] = null;
                }
            }
            _rtBuffer = null;

            m_amplifyGlareCache.Destroy();
            m_amplifyGlareCache = null;
        }