Exemplo n.º 1
0
 public void Clear()
 {
     if (bloomBuffer == null)
     {
         return;
     }
     CameraFX.ReleaseBuffer(ref bloomBuffer);
     CameraFX.ReleaseBuffer(ref tmpBuffer);
 }
Exemplo n.º 2
0
        private void OnDestroy()
        {
            if (reflectionBuffer == null)
            {
                return;
            }

            CameraFX.ReleaseBuffer(ref reflectionBuffer);
            CameraFX.ReleaseBuffer(ref reflectionBlurBuffer);
            CameraFX.ReleaseBuffer(ref tmpBuffer);
        }
Exemplo n.º 3
0
        private void Start()
        {
            if (Activate == false)
            {
                gameObject.SetActive(false);
                return;
            }

            blurMaterial         = Instantiate(blurMaterial);
            reflectionBuffer     = CameraFX.CreateBuffer(CameraFX.Width / screenScaleFactor, CameraFX.Height / screenScaleFactor, true);
            screenScaleFactor   *= 2;
            reflectionBlurBuffer = CameraFX.CreateBuffer(CameraFX.Width / screenScaleFactor, CameraFX.Height / screenScaleFactor, false);
            tmpBuffer            = CameraFX.CreateBuffer(CameraFX.Width / screenScaleFactor, CameraFX.Height / screenScaleFactor, false);

            offsetX.x = reflectionBlurBuffer.texelSize.x;
            offsetY.y = reflectionBlurBuffer.texelSize.y;
            offsetX.z = reflectionBlurBuffer.texelSize.x * 2;
            offsetY.w = reflectionBlurBuffer.texelSize.y * 2;
        }
Exemplo n.º 4
0
        private void Initialize(RenderTexture frameBuffer)
        {
            Clear();

            downScaleMaterial = downScaleMaterial.Clone();
            blurMaterial      = blurMaterial.Clone();
            postMaterial      = postMaterial.Clone();

            bloomBuffer = CameraFX.CreateBuffer(frameBuffer.width / scaleFactor, frameBuffer.height / scaleFactor, false);
            tmpBuffer   = CameraFX.CreateBuffer(frameBuffer.width / scaleFactor, frameBuffer.height / scaleFactor, false);

            offset.z = offset.x = frameBuffer.texelSize.x * scaleFactor * 0.5f;
            offset.y = frameBuffer.texelSize.y * scaleFactor * 0.5f;
            offset.w = -offset.y;

            offsetX.x = bloomBuffer.texelSize.x * offsetFactor;
            offsetY.y = bloomBuffer.texelSize.y * offsetFactor;
            offsetX.z = bloomBuffer.texelSize.x * offsetFactor * 2;
            offsetY.w = bloomBuffer.texelSize.y * offsetFactor * 2;
        }