コード例 #1
0
ファイル: Color3Grading.cs プロジェクト: GameDiffs/TheForest
 public void BlendTo(Texture2D blendTargetLUT, float blendTimeInSec, Color3Grading.OnFinishBlend onFinishBlend)
 {
     this.LutBlendTexture = blendTargetLUT;
     this.BlendAmount = 0f;
     this.onFinishBlend = onFinishBlend;
     this.blendingTime = blendTimeInSec;
     this.blendingTimeCountdown = blendTimeInSec;
     this.blending = true;
 }
コード例 #2
0
    private void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        this.BlendAmount = Mathf.Clamp01(this.BlendAmount);
        if (this.colorSpace != QualitySettings.activeColorSpace)
        {
            this.CreateMaterials(false);
        }
        bool flag  = Color3Grading.ValidateLutDimensions(this.LutTexture);
        bool flag2 = Color3Grading.ValidateLutDimensions(this.LutBlendTexture);

        if (this.JustCopy || !flag || !flag2)
        {
            Graphics.Blit(source, destination);
            return;
        }
        if (this.LutTexture == null && this.lutTexture3d == null)
        {
            Graphics.Blit(source, destination);
        }
        else
        {
            Material material;
            if (this.LutBlendTexture != null || this.lutBlendTexture3d != null)
            {
                if (this.MaskTexture != null)
                {
                    material = this.materialBlendMask;
                }
                else
                {
                    material = this.materialBlend;
                }
            }
            else if (this.MaskTexture != null)
            {
                material = this.materialMask;
            }
            else
            {
                material = this.materialGrading;
            }
            int pass = (base.GetComponent <Camera>().hdr || this.BlendAmount != 0f) ? 1 : 0;
            material.SetFloat("_lerpAmount", this.BlendAmount);
            if (this.MaskTexture != null)
            {
                material.SetTexture("_MaskTex", this.MaskTexture);
            }
            if (!this.use3d)
            {
                if (this.LutTexture != null)
                {
                    material.SetTexture("_RgbTex", this.LutTexture);
                }
                if (this.LutBlendTexture != null)
                {
                    material.SetTexture("_LerpRgbTex", this.LutBlendTexture);
                }
            }
            Graphics.Blit(source, destination, material, pass);
        }
    }