Exemplo n.º 1
0
        public void OnFrame(RGBTextureFrame frame)
        {
            // Render every camera
            TargetCamera.Render();

            switch (BlendMode)
            {
            case BlendMode.RGBOnly:
                Graphics.Blit(frame.texture, BlendTexture);
                break;

            case BlendMode.VirtualOnly:
                Graphics.Blit(TargetCamera.targetTexture, BlendTexture);
                break;

            case BlendMode.Blend:
                BlendMaterial.SetTexture("_MainTex", TargetCamera.targetTexture);
                BlendMaterial.SetTexture("_BcakGroundTex", frame.texture);
                Graphics.Blit(TargetCamera.targetTexture, BlendTexture, BlendMaterial);
                break;

            case BlendMode.WidescreenBlend:
                // TODO

                break;

            default:
                break;
            }

            // Commit frame
            Encoder.Commit(BlendTexture, frame.timeStamp);
        }
Exemplo n.º 2
0
        // Border generation
        private void OnRenderImage(RenderTexture src, RenderTexture dest)
        {
            MapMaterial.SetBuffer(ProvColorBuffer, _provLookup);
            // Passing which border to render.
            MapMaterial.SetFloat(CountryBorderToggle, _orthographicSize > 1.5f ? 0 : 1);

            var terrainTemp = RenderTexture.GetTemporary(src.descriptor);
            var oceanTemp   = RenderTexture.GetTemporary(src.descriptor);

            // Province coloring.
            Graphics.Blit(src, terrainTemp, MapMaterial);
            // Overlay combination. F**k Unity.
            // Terrain
            BlendMaterial.SetTexture(SecondTex, TerrainTexture);
            BlendMaterial.SetFloat(SkipDirection, 1);
            BlendMaterial.SetFloat(BlendStrength, 0.5f);
            Graphics.Blit(terrainTemp, oceanTemp, BlendMaterial);
            // Ocean
            BlendMaterial.SetTexture(SecondTex, OceanTexture);
            BlendMaterial.SetFloat(SkipDirection, 0);
            BlendMaterial.SetFloat(BlendStrength, 0.75f);
            Graphics.Blit(oceanTemp, dest, BlendMaterial);

            terrainTemp.Release();
            oceanTemp.Release();
        }
Exemplo n.º 3
0
 // lerps between previous and next weather texture
 IEnumerator LerpWeatherTexture()
 {
     isChangingWeather = true;
     for (float t = 0f; t <= blendTime; t += Time.deltaTime * (clouds.globalMultiplier == 0.0 ? blendTime : Mathf.Abs(clouds.globalMultiplier)))
     {
         BlendMaterial.SetTexture("_PrevWeather", prevWeatherTexture);
         BlendMaterial.SetTexture("_NextWeather", nextWeatherTexture);
         BlendMaterial.SetFloat("_Alpha", t / blendTime);
         Graphics.Blit(null, rt, BlendMaterial, 0);
         setWeatherTexture();
         yield return(null);
     }
     Graphics.Blit(nextWeatherTexture, rt);
     setWeatherTexture();
     isChangingWeather = false;
 }