This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,23 @@
using System;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200004A RID: 74
public enum AAMode
{
// Token: 0x0400015C RID: 348
FXAA2,
// Token: 0x0400015D RID: 349
FXAA3Console,
// Token: 0x0400015E RID: 350
FXAA1PresetA,
// Token: 0x0400015F RID: 351
FXAA1PresetB,
// Token: 0x04000160 RID: 352
NFAA,
// Token: 0x04000161 RID: 353
SSAA,
// Token: 0x04000162 RID: 354
DLAA
}
}
@@ -0,0 +1,185 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200004B RID: 75
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Other/Antialiasing")]
public class Antialiasing : PostEffectsBase
{
// Token: 0x060000C9 RID: 201 RVA: 0x00007CD8 File Offset: 0x000060D8
public Material CurrentAAMaterial()
{
Material material;
switch (this.mode)
{
case AAMode.FXAA2:
material = this.materialFXAAII;
break;
case AAMode.FXAA3Console:
material = this.materialFXAAIII;
break;
case AAMode.FXAA1PresetA:
material = this.materialFXAAPreset2;
break;
case AAMode.FXAA1PresetB:
material = this.materialFXAAPreset3;
break;
case AAMode.NFAA:
material = this.nfaa;
break;
case AAMode.SSAA:
material = this.ssaa;
break;
case AAMode.DLAA:
material = this.dlaa;
break;
default:
material = null;
break;
}
return material;
}
// Token: 0x060000CA RID: 202 RVA: 0x00007D74 File Offset: 0x00006174
public override bool CheckResources()
{
base.CheckSupport(false);
this.materialFXAAPreset2 = base.CreateMaterial(this.shaderFXAAPreset2, this.materialFXAAPreset2);
this.materialFXAAPreset3 = base.CreateMaterial(this.shaderFXAAPreset3, this.materialFXAAPreset3);
this.materialFXAAII = base.CreateMaterial(this.shaderFXAAII, this.materialFXAAII);
this.materialFXAAIII = base.CreateMaterial(this.shaderFXAAIII, this.materialFXAAIII);
this.nfaa = base.CreateMaterial(this.nfaaShader, this.nfaa);
this.ssaa = base.CreateMaterial(this.ssaaShader, this.ssaa);
this.dlaa = base.CreateMaterial(this.dlaaShader, this.dlaa);
if (!this.ssaaShader.isSupported)
{
base.NotSupported();
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000CB RID: 203 RVA: 0x00007E54 File Offset: 0x00006254
public void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.mode == AAMode.FXAA3Console && this.materialFXAAIII != null)
{
this.materialFXAAIII.SetFloat("_EdgeThresholdMin", this.edgeThresholdMin);
this.materialFXAAIII.SetFloat("_EdgeThreshold", this.edgeThreshold);
this.materialFXAAIII.SetFloat("_EdgeSharpness", this.edgeSharpness);
Graphics.Blit(source, destination, this.materialFXAAIII);
}
else if (this.mode == AAMode.FXAA1PresetB && this.materialFXAAPreset3 != null)
{
Graphics.Blit(source, destination, this.materialFXAAPreset3);
}
else if (this.mode == AAMode.FXAA1PresetA && this.materialFXAAPreset2 != null)
{
source.anisoLevel = 4;
Graphics.Blit(source, destination, this.materialFXAAPreset2);
source.anisoLevel = 0;
}
else if (this.mode == AAMode.FXAA2 && this.materialFXAAII != null)
{
Graphics.Blit(source, destination, this.materialFXAAII);
}
else if (this.mode == AAMode.SSAA && this.ssaa != null)
{
Graphics.Blit(source, destination, this.ssaa);
}
else if (this.mode == AAMode.DLAA && this.dlaa != null)
{
source.anisoLevel = 0;
RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height);
Graphics.Blit(source, temporary, this.dlaa, 0);
Graphics.Blit(temporary, destination, this.dlaa, (!this.dlaaSharp) ? 1 : 2);
RenderTexture.ReleaseTemporary(temporary);
}
else if (this.mode == AAMode.NFAA && this.nfaa != null)
{
source.anisoLevel = 0;
this.nfaa.SetFloat("_OffsetScale", this.offsetScale);
this.nfaa.SetFloat("_BlurRadius", this.blurRadius);
Graphics.Blit(source, destination, this.nfaa, (!this.showGeneratedNormals) ? 0 : 1);
}
else
{
Graphics.Blit(source, destination);
}
}
// Token: 0x04000163 RID: 355
public AAMode mode = AAMode.FXAA3Console;
// Token: 0x04000164 RID: 356
public bool showGeneratedNormals;
// Token: 0x04000165 RID: 357
public float offsetScale = 0.2f;
// Token: 0x04000166 RID: 358
public float blurRadius = 18f;
// Token: 0x04000167 RID: 359
public float edgeThresholdMin = 0.05f;
// Token: 0x04000168 RID: 360
public float edgeThreshold = 0.2f;
// Token: 0x04000169 RID: 361
public float edgeSharpness = 4f;
// Token: 0x0400016A RID: 362
public bool dlaaSharp;
// Token: 0x0400016B RID: 363
public Shader ssaaShader;
// Token: 0x0400016C RID: 364
private Material ssaa;
// Token: 0x0400016D RID: 365
public Shader dlaaShader;
// Token: 0x0400016E RID: 366
private Material dlaa;
// Token: 0x0400016F RID: 367
public Shader nfaaShader;
// Token: 0x04000170 RID: 368
private Material nfaa;
// Token: 0x04000171 RID: 369
public Shader shaderFXAAPreset2;
// Token: 0x04000172 RID: 370
private Material materialFXAAPreset2;
// Token: 0x04000173 RID: 371
public Shader shaderFXAAPreset3;
// Token: 0x04000174 RID: 372
private Material materialFXAAPreset3;
// Token: 0x04000175 RID: 373
public Shader shaderFXAAII;
// Token: 0x04000176 RID: 374
private Material materialFXAAII;
// Token: 0x04000177 RID: 375
public Shader shaderFXAAIII;
// Token: 0x04000178 RID: 376
private Material materialFXAAIII;
}
}
@@ -0,0 +1,390 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200004C RID: 76
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Bloom and Glow/Bloom")]
public class Bloom : PostEffectsBase
{
// Token: 0x060000CD RID: 205 RVA: 0x00008198 File Offset: 0x00006598
public override bool CheckResources()
{
base.CheckSupport(false);
this.screenBlend = base.CheckShaderAndCreateMaterial(this.screenBlendShader, this.screenBlend);
this.lensFlareMaterial = base.CheckShaderAndCreateMaterial(this.lensFlareShader, this.lensFlareMaterial);
this.blurAndFlaresMaterial = base.CheckShaderAndCreateMaterial(this.blurAndFlaresShader, this.blurAndFlaresMaterial);
this.brightPassFilterMaterial = base.CheckShaderAndCreateMaterial(this.brightPassFilterShader, this.brightPassFilterMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000CE RID: 206 RVA: 0x00008224 File Offset: 0x00006624
public void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
this.doHdr = false;
if (this.hdr == Bloom.HDRBloomMode.Auto)
{
this.doHdr = source.format == RenderTextureFormat.ARGBHalf && base.GetComponent<Camera>().allowHDR;
}
else
{
this.doHdr = this.hdr == Bloom.HDRBloomMode.On;
}
this.doHdr = this.doHdr && this.supportHDRTextures;
Bloom.BloomScreenBlendMode bloomScreenBlendMode = this.screenBlendMode;
if (this.doHdr)
{
bloomScreenBlendMode = Bloom.BloomScreenBlendMode.Add;
}
RenderTextureFormat renderTextureFormat = ((!this.doHdr) ? RenderTextureFormat.Default : RenderTextureFormat.ARGBHalf);
int num = source.width / 2;
int num2 = source.height / 2;
int num3 = source.width / 4;
int num4 = source.height / 4;
float num5 = 1f * (float)source.width / (1f * (float)source.height);
float num6 = 0.001953125f;
RenderTexture temporary = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
RenderTexture temporary2 = RenderTexture.GetTemporary(num, num2, 0, renderTextureFormat);
if (this.quality > Bloom.BloomQuality.Cheap)
{
Graphics.Blit(source, temporary2, this.screenBlend, 2);
RenderTexture temporary3 = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
Graphics.Blit(temporary2, temporary3, this.screenBlend, 2);
Graphics.Blit(temporary3, temporary, this.screenBlend, 6);
RenderTexture.ReleaseTemporary(temporary3);
}
else
{
Graphics.Blit(source, temporary2);
Graphics.Blit(temporary2, temporary, this.screenBlend, 6);
}
RenderTexture.ReleaseTemporary(temporary2);
RenderTexture renderTexture = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
this.BrightFilter(this.bloomThreshold * this.bloomThresholdColor, temporary, renderTexture);
if (this.bloomBlurIterations < 1)
{
this.bloomBlurIterations = 1;
}
else if (this.bloomBlurIterations > 10)
{
this.bloomBlurIterations = 10;
}
for (int i = 0; i < this.bloomBlurIterations; i++)
{
float num7 = (1f + (float)i * 0.25f) * this.sepBlurSpread;
RenderTexture renderTexture2 = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(0f, num7 * num6, 0f, 0f));
Graphics.Blit(renderTexture, renderTexture2, this.blurAndFlaresMaterial, 4);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
renderTexture2 = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(num7 / num5 * num6, 0f, 0f, 0f));
Graphics.Blit(renderTexture, renderTexture2, this.blurAndFlaresMaterial, 4);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
if (this.quality > Bloom.BloomQuality.Cheap)
{
if (i == 0)
{
Graphics.SetRenderTarget(temporary);
GL.Clear(false, true, Color.black);
Graphics.Blit(renderTexture, temporary);
}
else
{
temporary.MarkRestoreExpected();
Graphics.Blit(renderTexture, temporary, this.screenBlend, 10);
}
}
}
if (this.quality > Bloom.BloomQuality.Cheap)
{
Graphics.SetRenderTarget(renderTexture);
GL.Clear(false, true, Color.black);
Graphics.Blit(temporary, renderTexture, this.screenBlend, 6);
}
if (this.lensflareIntensity > Mathf.Epsilon)
{
RenderTexture temporary4 = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
if (this.lensflareMode == Bloom.LensFlareStyle.Ghosting)
{
this.BrightFilter(this.lensflareThreshold, renderTexture, temporary4);
if (this.quality > Bloom.BloomQuality.Cheap)
{
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(0f, 1.5f / (1f * (float)temporary.height), 0f, 0f));
Graphics.SetRenderTarget(temporary);
GL.Clear(false, true, Color.black);
Graphics.Blit(temporary4, temporary, this.blurAndFlaresMaterial, 4);
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(1.5f / (1f * (float)temporary.width), 0f, 0f, 0f));
Graphics.SetRenderTarget(temporary4);
GL.Clear(false, true, Color.black);
Graphics.Blit(temporary, temporary4, this.blurAndFlaresMaterial, 4);
}
this.Vignette(0.975f, temporary4, temporary4);
this.BlendFlares(temporary4, renderTexture);
}
else
{
float num8 = 1f * Mathf.Cos(this.flareRotation);
float num9 = 1f * Mathf.Sin(this.flareRotation);
float num10 = this.hollyStretchWidth * 1f / num5 * num6;
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(num8, num9, 0f, 0f));
this.blurAndFlaresMaterial.SetVector("_Threshhold", new Vector4(this.lensflareThreshold, 1f, 0f, 0f));
this.blurAndFlaresMaterial.SetVector("_TintColor", new Vector4(this.flareColorA.r, this.flareColorA.g, this.flareColorA.b, this.flareColorA.a) * this.flareColorA.a * this.lensflareIntensity);
this.blurAndFlaresMaterial.SetFloat("_Saturation", this.lensFlareSaturation);
temporary.DiscardContents();
Graphics.Blit(temporary4, temporary, this.blurAndFlaresMaterial, 2);
temporary4.DiscardContents();
Graphics.Blit(temporary, temporary4, this.blurAndFlaresMaterial, 3);
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(num8 * num10, num9 * num10, 0f, 0f));
this.blurAndFlaresMaterial.SetFloat("_StretchWidth", this.hollyStretchWidth);
temporary.DiscardContents();
Graphics.Blit(temporary4, temporary, this.blurAndFlaresMaterial, 1);
this.blurAndFlaresMaterial.SetFloat("_StretchWidth", this.hollyStretchWidth * 2f);
temporary4.DiscardContents();
Graphics.Blit(temporary, temporary4, this.blurAndFlaresMaterial, 1);
this.blurAndFlaresMaterial.SetFloat("_StretchWidth", this.hollyStretchWidth * 4f);
temporary.DiscardContents();
Graphics.Blit(temporary4, temporary, this.blurAndFlaresMaterial, 1);
for (int j = 0; j < this.hollywoodFlareBlurIterations; j++)
{
num10 = this.hollyStretchWidth * 2f / num5 * num6;
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(num10 * num8, num10 * num9, 0f, 0f));
temporary4.DiscardContents();
Graphics.Blit(temporary, temporary4, this.blurAndFlaresMaterial, 4);
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(num10 * num8, num10 * num9, 0f, 0f));
temporary.DiscardContents();
Graphics.Blit(temporary4, temporary, this.blurAndFlaresMaterial, 4);
}
if (this.lensflareMode == Bloom.LensFlareStyle.Anamorphic)
{
this.AddTo(1f, temporary, renderTexture);
}
else
{
this.Vignette(1f, temporary, temporary4);
this.BlendFlares(temporary4, temporary);
this.AddTo(1f, temporary, renderTexture);
}
}
RenderTexture.ReleaseTemporary(temporary4);
}
int num11 = (int)bloomScreenBlendMode;
this.screenBlend.SetFloat("_Intensity", this.bloomIntensity);
this.screenBlend.SetTexture("_ColorBuffer", source);
if (this.quality > Bloom.BloomQuality.Cheap)
{
RenderTexture temporary5 = RenderTexture.GetTemporary(num, num2, 0, renderTextureFormat);
Graphics.Blit(renderTexture, temporary5);
Graphics.Blit(temporary5, destination, this.screenBlend, num11);
RenderTexture.ReleaseTemporary(temporary5);
}
else
{
Graphics.Blit(renderTexture, destination, this.screenBlend, num11);
}
RenderTexture.ReleaseTemporary(temporary);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x060000CF RID: 207 RVA: 0x000089C5 File Offset: 0x00006DC5
private void AddTo(float intensity_, RenderTexture from, RenderTexture to)
{
this.screenBlend.SetFloat("_Intensity", intensity_);
to.MarkRestoreExpected();
Graphics.Blit(from, to, this.screenBlend, 9);
}
// Token: 0x060000D0 RID: 208 RVA: 0x000089F0 File Offset: 0x00006DF0
private void BlendFlares(RenderTexture from, RenderTexture to)
{
this.lensFlareMaterial.SetVector("colorA", new Vector4(this.flareColorA.r, this.flareColorA.g, this.flareColorA.b, this.flareColorA.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorB", new Vector4(this.flareColorB.r, this.flareColorB.g, this.flareColorB.b, this.flareColorB.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorC", new Vector4(this.flareColorC.r, this.flareColorC.g, this.flareColorC.b, this.flareColorC.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorD", new Vector4(this.flareColorD.r, this.flareColorD.g, this.flareColorD.b, this.flareColorD.a) * this.lensflareIntensity);
to.MarkRestoreExpected();
Graphics.Blit(from, to, this.lensFlareMaterial);
}
// Token: 0x060000D1 RID: 209 RVA: 0x00008B40 File Offset: 0x00006F40
private void BrightFilter(float thresh, RenderTexture from, RenderTexture to)
{
this.brightPassFilterMaterial.SetVector("_Threshhold", new Vector4(thresh, thresh, thresh, thresh));
Graphics.Blit(from, to, this.brightPassFilterMaterial, 0);
}
// Token: 0x060000D2 RID: 210 RVA: 0x00008B69 File Offset: 0x00006F69
private void BrightFilter(Color threshColor, RenderTexture from, RenderTexture to)
{
this.brightPassFilterMaterial.SetVector("_Threshhold", threshColor);
Graphics.Blit(from, to, this.brightPassFilterMaterial, 1);
}
// Token: 0x060000D3 RID: 211 RVA: 0x00008B90 File Offset: 0x00006F90
private void Vignette(float amount, RenderTexture from, RenderTexture to)
{
if (this.lensFlareVignetteMask)
{
this.screenBlend.SetTexture("_ColorBuffer", this.lensFlareVignetteMask);
to.MarkRestoreExpected();
Graphics.Blit((!(from == to)) ? from : null, to, this.screenBlend, (!(from == to)) ? 3 : 7);
}
else if (from != to)
{
Graphics.SetRenderTarget(to);
GL.Clear(false, true, Color.black);
Graphics.Blit(from, to);
}
}
// Token: 0x04000179 RID: 377
public Bloom.TweakMode tweakMode;
// Token: 0x0400017A RID: 378
public Bloom.BloomScreenBlendMode screenBlendMode = Bloom.BloomScreenBlendMode.Add;
// Token: 0x0400017B RID: 379
public Bloom.HDRBloomMode hdr;
// Token: 0x0400017C RID: 380
private bool doHdr;
// Token: 0x0400017D RID: 381
public float sepBlurSpread = 2.5f;
// Token: 0x0400017E RID: 382
public Bloom.BloomQuality quality = Bloom.BloomQuality.High;
// Token: 0x0400017F RID: 383
public float bloomIntensity = 0.5f;
// Token: 0x04000180 RID: 384
public float bloomThreshold = 0.5f;
// Token: 0x04000181 RID: 385
public Color bloomThresholdColor = Color.white;
// Token: 0x04000182 RID: 386
public int bloomBlurIterations = 2;
// Token: 0x04000183 RID: 387
public int hollywoodFlareBlurIterations = 2;
// Token: 0x04000184 RID: 388
public float flareRotation;
// Token: 0x04000185 RID: 389
public Bloom.LensFlareStyle lensflareMode = Bloom.LensFlareStyle.Anamorphic;
// Token: 0x04000186 RID: 390
public float hollyStretchWidth = 2.5f;
// Token: 0x04000187 RID: 391
public float lensflareIntensity;
// Token: 0x04000188 RID: 392
public float lensflareThreshold = 0.3f;
// Token: 0x04000189 RID: 393
public float lensFlareSaturation = 0.75f;
// Token: 0x0400018A RID: 394
public Color flareColorA = new Color(0.4f, 0.4f, 0.8f, 0.75f);
// Token: 0x0400018B RID: 395
public Color flareColorB = new Color(0.4f, 0.8f, 0.8f, 0.75f);
// Token: 0x0400018C RID: 396
public Color flareColorC = new Color(0.8f, 0.4f, 0.8f, 0.75f);
// Token: 0x0400018D RID: 397
public Color flareColorD = new Color(0.8f, 0.4f, 0f, 0.75f);
// Token: 0x0400018E RID: 398
public Texture2D lensFlareVignetteMask;
// Token: 0x0400018F RID: 399
public Shader lensFlareShader;
// Token: 0x04000190 RID: 400
private Material lensFlareMaterial;
// Token: 0x04000191 RID: 401
public Shader screenBlendShader;
// Token: 0x04000192 RID: 402
private Material screenBlend;
// Token: 0x04000193 RID: 403
public Shader blurAndFlaresShader;
// Token: 0x04000194 RID: 404
private Material blurAndFlaresMaterial;
// Token: 0x04000195 RID: 405
public Shader brightPassFilterShader;
// Token: 0x04000196 RID: 406
private Material brightPassFilterMaterial;
// Token: 0x0200004D RID: 77
public enum LensFlareStyle
{
// Token: 0x04000198 RID: 408
Ghosting,
// Token: 0x04000199 RID: 409
Anamorphic,
// Token: 0x0400019A RID: 410
Combined
}
// Token: 0x0200004E RID: 78
public enum TweakMode
{
// Token: 0x0400019C RID: 412
Basic,
// Token: 0x0400019D RID: 413
Complex
}
// Token: 0x0200004F RID: 79
public enum HDRBloomMode
{
// Token: 0x0400019F RID: 415
Auto,
// Token: 0x040001A0 RID: 416
On,
// Token: 0x040001A1 RID: 417
Off
}
// Token: 0x02000050 RID: 80
public enum BloomScreenBlendMode
{
// Token: 0x040001A3 RID: 419
Screen,
// Token: 0x040001A4 RID: 420
Add
}
// Token: 0x02000051 RID: 81
public enum BloomQuality
{
// Token: 0x040001A6 RID: 422
Cheap,
// Token: 0x040001A7 RID: 423
High
}
}
}
@@ -0,0 +1,300 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000056 RID: 86
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Bloom and Glow/BloomAndFlares (3.5, Deprecated)")]
public class BloomAndFlares : PostEffectsBase
{
// Token: 0x060000D5 RID: 213 RVA: 0x00008D20 File Offset: 0x00007120
public override bool CheckResources()
{
base.CheckSupport(false);
this.screenBlend = base.CheckShaderAndCreateMaterial(this.screenBlendShader, this.screenBlend);
this.lensFlareMaterial = base.CheckShaderAndCreateMaterial(this.lensFlareShader, this.lensFlareMaterial);
this.vignetteMaterial = base.CheckShaderAndCreateMaterial(this.vignetteShader, this.vignetteMaterial);
this.separableBlurMaterial = base.CheckShaderAndCreateMaterial(this.separableBlurShader, this.separableBlurMaterial);
this.addBrightStuffBlendOneOneMaterial = base.CheckShaderAndCreateMaterial(this.addBrightStuffOneOneShader, this.addBrightStuffBlendOneOneMaterial);
this.hollywoodFlaresMaterial = base.CheckShaderAndCreateMaterial(this.hollywoodFlaresShader, this.hollywoodFlaresMaterial);
this.brightPassFilterMaterial = base.CheckShaderAndCreateMaterial(this.brightPassFilterShader, this.brightPassFilterMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000D6 RID: 214 RVA: 0x00008DF4 File Offset: 0x000071F4
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
this.doHdr = false;
if (this.hdr == HDRBloomMode.Auto)
{
this.doHdr = source.format == RenderTextureFormat.ARGBHalf && base.GetComponent<Camera>().allowHDR;
}
else
{
this.doHdr = this.hdr == HDRBloomMode.On;
}
this.doHdr = this.doHdr && this.supportHDRTextures;
BloomScreenBlendMode bloomScreenBlendMode = this.screenBlendMode;
if (this.doHdr)
{
bloomScreenBlendMode = BloomScreenBlendMode.Add;
}
RenderTextureFormat renderTextureFormat = ((!this.doHdr) ? RenderTextureFormat.Default : RenderTextureFormat.ARGBHalf);
RenderTexture temporary = RenderTexture.GetTemporary(source.width / 2, source.height / 2, 0, renderTextureFormat);
RenderTexture temporary2 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, renderTextureFormat);
RenderTexture temporary3 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, renderTextureFormat);
RenderTexture temporary4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, renderTextureFormat);
float num = 1f * (float)source.width / (1f * (float)source.height);
float num2 = 0.001953125f;
Graphics.Blit(source, temporary, this.screenBlend, 2);
Graphics.Blit(temporary, temporary2, this.screenBlend, 2);
RenderTexture.ReleaseTemporary(temporary);
this.BrightFilter(this.bloomThreshold, this.useSrcAlphaAsMask, temporary2, temporary3);
temporary2.DiscardContents();
if (this.bloomBlurIterations < 1)
{
this.bloomBlurIterations = 1;
}
for (int i = 0; i < this.bloomBlurIterations; i++)
{
float num3 = (1f + (float)i * 0.5f) * this.sepBlurSpread;
this.separableBlurMaterial.SetVector("offsets", new Vector4(0f, num3 * num2, 0f, 0f));
RenderTexture renderTexture = ((i != 0) ? temporary2 : temporary3);
Graphics.Blit(renderTexture, temporary4, this.separableBlurMaterial);
renderTexture.DiscardContents();
this.separableBlurMaterial.SetVector("offsets", new Vector4(num3 / num * num2, 0f, 0f, 0f));
Graphics.Blit(temporary4, temporary2, this.separableBlurMaterial);
temporary4.DiscardContents();
}
if (this.lensflares)
{
if (this.lensflareMode == LensflareStyle34.Ghosting)
{
this.BrightFilter(this.lensflareThreshold, 0f, temporary2, temporary4);
temporary2.DiscardContents();
this.Vignette(0.975f, temporary4, temporary3);
temporary4.DiscardContents();
this.BlendFlares(temporary3, temporary2);
temporary3.DiscardContents();
}
else
{
this.hollywoodFlaresMaterial.SetVector("_threshold", new Vector4(this.lensflareThreshold, 1f / (1f - this.lensflareThreshold), 0f, 0f));
this.hollywoodFlaresMaterial.SetVector("tintColor", new Vector4(this.flareColorA.r, this.flareColorA.g, this.flareColorA.b, this.flareColorA.a) * this.flareColorA.a * this.lensflareIntensity);
Graphics.Blit(temporary4, temporary3, this.hollywoodFlaresMaterial, 2);
temporary4.DiscardContents();
Graphics.Blit(temporary3, temporary4, this.hollywoodFlaresMaterial, 3);
temporary3.DiscardContents();
this.hollywoodFlaresMaterial.SetVector("offsets", new Vector4(this.sepBlurSpread * 1f / num * num2, 0f, 0f, 0f));
this.hollywoodFlaresMaterial.SetFloat("stretchWidth", this.hollyStretchWidth);
Graphics.Blit(temporary4, temporary3, this.hollywoodFlaresMaterial, 1);
temporary4.DiscardContents();
this.hollywoodFlaresMaterial.SetFloat("stretchWidth", this.hollyStretchWidth * 2f);
Graphics.Blit(temporary3, temporary4, this.hollywoodFlaresMaterial, 1);
temporary3.DiscardContents();
this.hollywoodFlaresMaterial.SetFloat("stretchWidth", this.hollyStretchWidth * 4f);
Graphics.Blit(temporary4, temporary3, this.hollywoodFlaresMaterial, 1);
temporary4.DiscardContents();
if (this.lensflareMode == LensflareStyle34.Anamorphic)
{
for (int j = 0; j < this.hollywoodFlareBlurIterations; j++)
{
this.separableBlurMaterial.SetVector("offsets", new Vector4(this.hollyStretchWidth * 2f / num * num2, 0f, 0f, 0f));
Graphics.Blit(temporary3, temporary4, this.separableBlurMaterial);
temporary3.DiscardContents();
this.separableBlurMaterial.SetVector("offsets", new Vector4(this.hollyStretchWidth * 2f / num * num2, 0f, 0f, 0f));
Graphics.Blit(temporary4, temporary3, this.separableBlurMaterial);
temporary4.DiscardContents();
}
this.AddTo(1f, temporary3, temporary2);
temporary3.DiscardContents();
}
else
{
for (int k = 0; k < this.hollywoodFlareBlurIterations; k++)
{
this.separableBlurMaterial.SetVector("offsets", new Vector4(this.hollyStretchWidth * 2f / num * num2, 0f, 0f, 0f));
Graphics.Blit(temporary3, temporary4, this.separableBlurMaterial);
temporary3.DiscardContents();
this.separableBlurMaterial.SetVector("offsets", new Vector4(this.hollyStretchWidth * 2f / num * num2, 0f, 0f, 0f));
Graphics.Blit(temporary4, temporary3, this.separableBlurMaterial);
temporary4.DiscardContents();
}
this.Vignette(1f, temporary3, temporary4);
temporary3.DiscardContents();
this.BlendFlares(temporary4, temporary3);
temporary4.DiscardContents();
this.AddTo(1f, temporary3, temporary2);
temporary3.DiscardContents();
}
}
}
this.screenBlend.SetFloat("_Intensity", this.bloomIntensity);
this.screenBlend.SetTexture("_ColorBuffer", source);
Graphics.Blit(temporary2, destination, this.screenBlend, (int)bloomScreenBlendMode);
RenderTexture.ReleaseTemporary(temporary2);
RenderTexture.ReleaseTemporary(temporary3);
RenderTexture.ReleaseTemporary(temporary4);
}
// Token: 0x060000D7 RID: 215 RVA: 0x0000942B File Offset: 0x0000782B
private void AddTo(float intensity_, RenderTexture from, RenderTexture to)
{
this.addBrightStuffBlendOneOneMaterial.SetFloat("_Intensity", intensity_);
Graphics.Blit(from, to, this.addBrightStuffBlendOneOneMaterial);
}
// Token: 0x060000D8 RID: 216 RVA: 0x0000944C File Offset: 0x0000784C
private void BlendFlares(RenderTexture from, RenderTexture to)
{
this.lensFlareMaterial.SetVector("colorA", new Vector4(this.flareColorA.r, this.flareColorA.g, this.flareColorA.b, this.flareColorA.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorB", new Vector4(this.flareColorB.r, this.flareColorB.g, this.flareColorB.b, this.flareColorB.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorC", new Vector4(this.flareColorC.r, this.flareColorC.g, this.flareColorC.b, this.flareColorC.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorD", new Vector4(this.flareColorD.r, this.flareColorD.g, this.flareColorD.b, this.flareColorD.a) * this.lensflareIntensity);
Graphics.Blit(from, to, this.lensFlareMaterial);
}
// Token: 0x060000D9 RID: 217 RVA: 0x00009598 File Offset: 0x00007998
private void BrightFilter(float thresh, float useAlphaAsMask, RenderTexture from, RenderTexture to)
{
if (this.doHdr)
{
this.brightPassFilterMaterial.SetVector("threshold", new Vector4(thresh, 1f, 0f, 0f));
}
else
{
this.brightPassFilterMaterial.SetVector("threshold", new Vector4(thresh, 1f / (1f - thresh), 0f, 0f));
}
this.brightPassFilterMaterial.SetFloat("useSrcAlphaAsMask", useAlphaAsMask);
Graphics.Blit(from, to, this.brightPassFilterMaterial);
}
// Token: 0x060000DA RID: 218 RVA: 0x00009628 File Offset: 0x00007A28
private void Vignette(float amount, RenderTexture from, RenderTexture to)
{
if (this.lensFlareVignetteMask)
{
this.screenBlend.SetTexture("_ColorBuffer", this.lensFlareVignetteMask);
Graphics.Blit(from, to, this.screenBlend, 3);
}
else
{
this.vignetteMaterial.SetFloat("vignetteIntensity", amount);
Graphics.Blit(from, to, this.vignetteMaterial);
}
}
// Token: 0x040001B6 RID: 438
public TweakMode34 tweakMode;
// Token: 0x040001B7 RID: 439
public BloomScreenBlendMode screenBlendMode = BloomScreenBlendMode.Add;
// Token: 0x040001B8 RID: 440
public HDRBloomMode hdr;
// Token: 0x040001B9 RID: 441
private bool doHdr;
// Token: 0x040001BA RID: 442
public float sepBlurSpread = 1.5f;
// Token: 0x040001BB RID: 443
public float useSrcAlphaAsMask = 0.5f;
// Token: 0x040001BC RID: 444
public float bloomIntensity = 1f;
// Token: 0x040001BD RID: 445
public float bloomThreshold = 0.5f;
// Token: 0x040001BE RID: 446
public int bloomBlurIterations = 2;
// Token: 0x040001BF RID: 447
public bool lensflares;
// Token: 0x040001C0 RID: 448
public int hollywoodFlareBlurIterations = 2;
// Token: 0x040001C1 RID: 449
public LensflareStyle34 lensflareMode = LensflareStyle34.Anamorphic;
// Token: 0x040001C2 RID: 450
public float hollyStretchWidth = 3.5f;
// Token: 0x040001C3 RID: 451
public float lensflareIntensity = 1f;
// Token: 0x040001C4 RID: 452
public float lensflareThreshold = 0.3f;
// Token: 0x040001C5 RID: 453
public Color flareColorA = new Color(0.4f, 0.4f, 0.8f, 0.75f);
// Token: 0x040001C6 RID: 454
public Color flareColorB = new Color(0.4f, 0.8f, 0.8f, 0.75f);
// Token: 0x040001C7 RID: 455
public Color flareColorC = new Color(0.8f, 0.4f, 0.8f, 0.75f);
// Token: 0x040001C8 RID: 456
public Color flareColorD = new Color(0.8f, 0.4f, 0f, 0.75f);
// Token: 0x040001C9 RID: 457
public Texture2D lensFlareVignetteMask;
// Token: 0x040001CA RID: 458
public Shader lensFlareShader;
// Token: 0x040001CB RID: 459
private Material lensFlareMaterial;
// Token: 0x040001CC RID: 460
public Shader vignetteShader;
// Token: 0x040001CD RID: 461
private Material vignetteMaterial;
// Token: 0x040001CE RID: 462
public Shader separableBlurShader;
// Token: 0x040001CF RID: 463
private Material separableBlurMaterial;
// Token: 0x040001D0 RID: 464
public Shader addBrightStuffOneOneShader;
// Token: 0x040001D1 RID: 465
private Material addBrightStuffBlendOneOneMaterial;
// Token: 0x040001D2 RID: 466
public Shader screenBlendShader;
// Token: 0x040001D3 RID: 467
private Material screenBlend;
// Token: 0x040001D4 RID: 468
public Shader hollywoodFlaresShader;
// Token: 0x040001D5 RID: 469
private Material hollywoodFlaresMaterial;
// Token: 0x040001D6 RID: 470
public Shader brightPassFilterShader;
// Token: 0x040001D7 RID: 471
private Material brightPassFilterMaterial;
}
}
@@ -0,0 +1,116 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000057 RID: 87
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Bloom and Glow/Bloom (Optimized)")]
public class BloomOptimized : PostEffectsBase
{
// Token: 0x060000DC RID: 220 RVA: 0x000096BC File Offset: 0x00007ABC
public override bool CheckResources()
{
base.CheckSupport(false);
this.fastBloomMaterial = base.CheckShaderAndCreateMaterial(this.fastBloomShader, this.fastBloomMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000DD RID: 221 RVA: 0x000096F5 File Offset: 0x00007AF5
private void OnDisable()
{
if (this.fastBloomMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.fastBloomMaterial);
}
}
// Token: 0x060000DE RID: 222 RVA: 0x00009714 File Offset: 0x00007B14
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
int num = ((this.resolution != BloomOptimized.Resolution.Low) ? 2 : 4);
float num2 = ((this.resolution != BloomOptimized.Resolution.Low) ? 1f : 0.5f);
this.fastBloomMaterial.SetVector("_Parameter", new Vector4(this.blurSize * num2, 0f, this.threshold, this.intensity));
source.filterMode = FilterMode.Bilinear;
int num3 = source.width / num;
int num4 = source.height / num;
RenderTexture renderTexture = RenderTexture.GetTemporary(num3, num4, 0, source.format);
renderTexture.filterMode = FilterMode.Bilinear;
Graphics.Blit(source, renderTexture, this.fastBloomMaterial, 1);
int num5 = ((this.blurType != BloomOptimized.BlurType.Standard) ? 2 : 0);
for (int i = 0; i < this.blurIterations; i++)
{
this.fastBloomMaterial.SetVector("_Parameter", new Vector4(this.blurSize * num2 + (float)i * 1f, 0f, this.threshold, this.intensity));
RenderTexture renderTexture2 = RenderTexture.GetTemporary(num3, num4, 0, source.format);
renderTexture2.filterMode = FilterMode.Bilinear;
Graphics.Blit(renderTexture, renderTexture2, this.fastBloomMaterial, 2 + num5);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
renderTexture2 = RenderTexture.GetTemporary(num3, num4, 0, source.format);
renderTexture2.filterMode = FilterMode.Bilinear;
Graphics.Blit(renderTexture, renderTexture2, this.fastBloomMaterial, 3 + num5);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
}
this.fastBloomMaterial.SetTexture("_Bloom", renderTexture);
Graphics.Blit(source, destination, this.fastBloomMaterial, 0);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x040001D8 RID: 472
[Range(0f, 1.5f)]
public float threshold = 0.25f;
// Token: 0x040001D9 RID: 473
[Range(0f, 2.5f)]
public float intensity = 0.75f;
// Token: 0x040001DA RID: 474
[Range(0.25f, 5.5f)]
public float blurSize = 1f;
// Token: 0x040001DB RID: 475
private BloomOptimized.Resolution resolution;
// Token: 0x040001DC RID: 476
[Range(1f, 4f)]
public int blurIterations = 1;
// Token: 0x040001DD RID: 477
public BloomOptimized.BlurType blurType;
// Token: 0x040001DE RID: 478
public Shader fastBloomShader;
// Token: 0x040001DF RID: 479
private Material fastBloomMaterial;
// Token: 0x02000058 RID: 88
public enum Resolution
{
// Token: 0x040001E1 RID: 481
Low,
// Token: 0x040001E2 RID: 482
High
}
// Token: 0x02000059 RID: 89
public enum BlurType
{
// Token: 0x040001E4 RID: 484
Standard,
// Token: 0x040001E5 RID: 485
Sgx
}
}
}
@@ -0,0 +1,13 @@
using System;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000055 RID: 85
public enum BloomScreenBlendMode
{
// Token: 0x040001B4 RID: 436
Screen,
// Token: 0x040001B5 RID: 437
Add
}
}
@@ -0,0 +1,108 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200005A RID: 90
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Blur/Blur")]
public class Blur : MonoBehaviour
{
// Token: 0x17000052 RID: 82
// (get) Token: 0x060000E0 RID: 224 RVA: 0x000098E4 File Offset: 0x00007CE4
protected Material material
{
get
{
if (Blur.m_Material == null)
{
Blur.m_Material = new Material(this.blurShader);
Blur.m_Material.hideFlags = HideFlags.DontSave;
}
return Blur.m_Material;
}
}
// Token: 0x060000E1 RID: 225 RVA: 0x00009917 File Offset: 0x00007D17
protected void OnDisable()
{
if (Blur.m_Material)
{
global::UnityEngine.Object.DestroyImmediate(Blur.m_Material);
}
}
// Token: 0x060000E2 RID: 226 RVA: 0x00009934 File Offset: 0x00007D34
protected void Start()
{
if (!SystemInfo.supportsImageEffects)
{
base.enabled = false;
return;
}
if (!this.blurShader || !this.material.shader.isSupported)
{
base.enabled = false;
return;
}
}
// Token: 0x060000E3 RID: 227 RVA: 0x00009980 File Offset: 0x00007D80
public void FourTapCone(RenderTexture source, RenderTexture dest, int iteration)
{
float num = 0.5f + (float)iteration * this.blurSpread;
Graphics.BlitMultiTap(source, dest, this.material, new Vector2[]
{
new Vector2(-num, -num),
new Vector2(-num, num),
new Vector2(num, num),
new Vector2(num, -num)
});
}
// Token: 0x060000E4 RID: 228 RVA: 0x00009A00 File Offset: 0x00007E00
private void DownSample4x(RenderTexture source, RenderTexture dest)
{
float num = 1f;
Graphics.BlitMultiTap(source, dest, this.material, new Vector2[]
{
new Vector2(-num, -num),
new Vector2(-num, num),
new Vector2(num, num),
new Vector2(num, -num)
});
}
// Token: 0x060000E5 RID: 229 RVA: 0x00009A78 File Offset: 0x00007E78
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
int num = source.width / 4;
int num2 = source.height / 4;
RenderTexture renderTexture = RenderTexture.GetTemporary(num, num2, 0);
this.DownSample4x(source, renderTexture);
for (int i = 0; i < this.iterations; i++)
{
RenderTexture temporary = RenderTexture.GetTemporary(num, num2, 0);
this.FourTapCone(renderTexture, temporary, i);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = temporary;
}
Graphics.Blit(renderTexture, destination);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x040001E6 RID: 486
[Range(0f, 10f)]
public int iterations = 3;
// Token: 0x040001E7 RID: 487
[Range(0f, 1f)]
public float blurSpread = 0.6f;
// Token: 0x040001E8 RID: 488
public Shader blurShader;
// Token: 0x040001E9 RID: 489
private static Material m_Material;
}
}
@@ -0,0 +1,99 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200005B RID: 91
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Blur/Blur (Optimized)")]
public class BlurOptimized : PostEffectsBase
{
// Token: 0x060000E8 RID: 232 RVA: 0x00009B0C File Offset: 0x00007F0C
public override bool CheckResources()
{
base.CheckSupport(false);
this.blurMaterial = base.CheckShaderAndCreateMaterial(this.blurShader, this.blurMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000E9 RID: 233 RVA: 0x00009B45 File Offset: 0x00007F45
public void OnDisable()
{
if (this.blurMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.blurMaterial);
}
}
// Token: 0x060000EA RID: 234 RVA: 0x00009B64 File Offset: 0x00007F64
public void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
float num = 1f / (1f * (float)(1 << this.downsample));
this.blurMaterial.SetVector("_Parameter", new Vector4(this.blurSize * num, -this.blurSize * num, 0f, 0f));
source.filterMode = FilterMode.Bilinear;
int num2 = source.width >> this.downsample;
int num3 = source.height >> this.downsample;
RenderTexture renderTexture = RenderTexture.GetTemporary(num2, num3, 0, source.format);
renderTexture.filterMode = FilterMode.Bilinear;
Graphics.Blit(source, renderTexture, this.blurMaterial, 0);
int num4 = ((this.blurType != BlurOptimized.BlurType.StandardGauss) ? 2 : 0);
for (int i = 0; i < this.blurIterations; i++)
{
float num5 = (float)i * 1f;
this.blurMaterial.SetVector("_Parameter", new Vector4(this.blurSize * num + num5, -this.blurSize * num - num5, 0f, 0f));
RenderTexture renderTexture2 = RenderTexture.GetTemporary(num2, num3, 0, source.format);
renderTexture2.filterMode = FilterMode.Bilinear;
Graphics.Blit(renderTexture, renderTexture2, this.blurMaterial, 1 + num4);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
renderTexture2 = RenderTexture.GetTemporary(num2, num3, 0, source.format);
renderTexture2.filterMode = FilterMode.Bilinear;
Graphics.Blit(renderTexture, renderTexture2, this.blurMaterial, 2 + num4);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
}
Graphics.Blit(renderTexture, destination);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x040001EA RID: 490
[Range(0f, 2f)]
public int downsample = 1;
// Token: 0x040001EB RID: 491
[Range(0f, 10f)]
public float blurSize = 3f;
// Token: 0x040001EC RID: 492
[Range(1f, 4f)]
public int blurIterations = 2;
// Token: 0x040001ED RID: 493
public BlurOptimized.BlurType blurType;
// Token: 0x040001EE RID: 494
public Shader blurShader;
// Token: 0x040001EF RID: 495
private Material blurMaterial;
// Token: 0x0200005C RID: 92
public enum BlurType
{
// Token: 0x040001F1 RID: 497
StandardGauss,
// Token: 0x040001F2 RID: 498
SgxGauss
}
}
}
@@ -0,0 +1,432 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200005D RID: 93
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Camera/Camera Motion Blur")]
public class CameraMotionBlur : PostEffectsBase
{
// Token: 0x060000EC RID: 236 RVA: 0x00009DA8 File Offset: 0x000081A8
private void CalculateViewProjection()
{
Matrix4x4 worldToCameraMatrix = this._camera.worldToCameraMatrix;
Matrix4x4 gpuprojectionMatrix = GL.GetGPUProjectionMatrix(this._camera.projectionMatrix, true);
this.currentViewProjMat = gpuprojectionMatrix * worldToCameraMatrix;
if (this._camera.stereoEnabled)
{
for (int i = 0; i < 2; i++)
{
Matrix4x4 stereoViewMatrix = this._camera.GetStereoViewMatrix((i != 0) ? Camera.StereoscopicEye.Right : Camera.StereoscopicEye.Left);
Matrix4x4 matrix4x = this._camera.GetStereoProjectionMatrix((i != 0) ? Camera.StereoscopicEye.Right : Camera.StereoscopicEye.Left);
matrix4x = GL.GetGPUProjectionMatrix(matrix4x, true);
this.currentStereoViewProjMat[i] = matrix4x * stereoViewMatrix;
}
}
}
// Token: 0x060000ED RID: 237 RVA: 0x00009E58 File Offset: 0x00008258
private new void Start()
{
this.CheckResources();
if (this._camera == null)
{
this._camera = base.GetComponent<Camera>();
}
this.wasActive = base.gameObject.activeInHierarchy;
this.currentStereoViewProjMat = new Matrix4x4[2];
this.prevStereoViewProjMat = new Matrix4x4[2];
this.CalculateViewProjection();
this.Remember();
this.wasActive = false;
}
// Token: 0x060000EE RID: 238 RVA: 0x00009EC5 File Offset: 0x000082C5
private void OnEnable()
{
if (this._camera == null)
{
this._camera = base.GetComponent<Camera>();
}
this._camera.depthTextureMode |= DepthTextureMode.Depth;
}
// Token: 0x060000EF RID: 239 RVA: 0x00009EF8 File Offset: 0x000082F8
private void OnDisable()
{
if (null != this.motionBlurMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.motionBlurMaterial);
this.motionBlurMaterial = null;
}
if (null != this.dx11MotionBlurMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.dx11MotionBlurMaterial);
this.dx11MotionBlurMaterial = null;
}
if (null != this.tmpCam)
{
global::UnityEngine.Object.DestroyImmediate(this.tmpCam);
this.tmpCam = null;
}
}
// Token: 0x060000F0 RID: 240 RVA: 0x00009F70 File Offset: 0x00008370
public override bool CheckResources()
{
base.CheckSupport(true, true);
this.motionBlurMaterial = base.CheckShaderAndCreateMaterial(this.shader, this.motionBlurMaterial);
if (this.supportDX11 && this.filterType == CameraMotionBlur.MotionBlurFilter.ReconstructionDX11)
{
this.dx11MotionBlurMaterial = base.CheckShaderAndCreateMaterial(this.dx11MotionBlurShader, this.dx11MotionBlurMaterial);
}
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000F1 RID: 241 RVA: 0x00009FE4 File Offset: 0x000083E4
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.filterType == CameraMotionBlur.MotionBlurFilter.CameraMotion)
{
this.StartFrame();
}
RenderTextureFormat renderTextureFormat = ((!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf)) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.RGHalf);
RenderTexture temporary = RenderTexture.GetTemporary(CameraMotionBlur.divRoundUp(source.width, this.velocityDownsample), CameraMotionBlur.divRoundUp(source.height, this.velocityDownsample), 0, renderTextureFormat);
this.maxVelocity = Mathf.Max(2f, this.maxVelocity);
float num = this.maxVelocity;
bool flag = this.filterType == CameraMotionBlur.MotionBlurFilter.ReconstructionDX11 && this.dx11MotionBlurMaterial == null;
int num2;
int num3;
if (this.filterType == CameraMotionBlur.MotionBlurFilter.Reconstruction || flag || this.filterType == CameraMotionBlur.MotionBlurFilter.ReconstructionDisc)
{
this.maxVelocity = Mathf.Min(this.maxVelocity, CameraMotionBlur.MAX_RADIUS);
num2 = CameraMotionBlur.divRoundUp(temporary.width, (int)this.maxVelocity);
num3 = CameraMotionBlur.divRoundUp(temporary.height, (int)this.maxVelocity);
num = (float)(temporary.width / num2);
}
else
{
num2 = CameraMotionBlur.divRoundUp(temporary.width, (int)this.maxVelocity);
num3 = CameraMotionBlur.divRoundUp(temporary.height, (int)this.maxVelocity);
num = (float)(temporary.width / num2);
}
RenderTexture temporary2 = RenderTexture.GetTemporary(num2, num3, 0, renderTextureFormat);
RenderTexture temporary3 = RenderTexture.GetTemporary(num2, num3, 0, renderTextureFormat);
temporary.filterMode = FilterMode.Point;
temporary2.filterMode = FilterMode.Point;
temporary3.filterMode = FilterMode.Point;
if (this.noiseTexture)
{
this.noiseTexture.filterMode = FilterMode.Point;
}
source.wrapMode = TextureWrapMode.Clamp;
temporary.wrapMode = TextureWrapMode.Clamp;
temporary3.wrapMode = TextureWrapMode.Clamp;
temporary2.wrapMode = TextureWrapMode.Clamp;
this.CalculateViewProjection();
if (base.gameObject.activeInHierarchy && !this.wasActive)
{
this.Remember();
}
this.wasActive = base.gameObject.activeInHierarchy;
Matrix4x4 matrix4x = Matrix4x4.Inverse(this.currentViewProjMat);
this.motionBlurMaterial.SetMatrix("_InvViewProj", matrix4x);
this.motionBlurMaterial.SetMatrix("_PrevViewProj", this.prevViewProjMat);
this.motionBlurMaterial.SetMatrix("_ToPrevViewProjCombined", this.prevViewProjMat * matrix4x);
if (this._camera.stereoEnabled)
{
Matrix4x4[] array = new Matrix4x4[]
{
Matrix4x4.Inverse(this.currentStereoViewProjMat[0]),
Matrix4x4.Inverse(this.currentStereoViewProjMat[1])
};
Matrix4x4 matrix4x2 = this.prevStereoViewProjMat[0] * array[0];
this.motionBlurMaterial.SetMatrix("_StereoToPrevViewProjCombined0", matrix4x2);
this.motionBlurMaterial.SetMatrix("_StereoToPrevViewProjCombined1", this.prevStereoViewProjMat[1] * array[1]);
}
this.motionBlurMaterial.SetFloat("_MaxVelocity", num);
this.motionBlurMaterial.SetFloat("_MaxRadiusOrKInPaper", num);
this.motionBlurMaterial.SetFloat("_MinVelocity", this.minVelocity);
this.motionBlurMaterial.SetFloat("_VelocityScale", this.velocityScale);
this.motionBlurMaterial.SetFloat("_Jitter", this.jitter);
this.motionBlurMaterial.SetTexture("_NoiseTex", this.noiseTexture);
this.motionBlurMaterial.SetTexture("_VelTex", temporary);
this.motionBlurMaterial.SetTexture("_NeighbourMaxTex", temporary3);
this.motionBlurMaterial.SetTexture("_TileTexDebug", temporary2);
if (this.preview)
{
Matrix4x4 worldToCameraMatrix = this._camera.worldToCameraMatrix;
Matrix4x4 identity = Matrix4x4.identity;
identity.SetTRS(this.previewScale * 0.3333f, Quaternion.identity, Vector3.one);
Matrix4x4 gpuprojectionMatrix = GL.GetGPUProjectionMatrix(this._camera.projectionMatrix, true);
this.prevViewProjMat = gpuprojectionMatrix * identity * worldToCameraMatrix;
this.motionBlurMaterial.SetMatrix("_PrevViewProj", this.prevViewProjMat);
this.motionBlurMaterial.SetMatrix("_ToPrevViewProjCombined", this.prevViewProjMat * matrix4x);
}
if (this.filterType == CameraMotionBlur.MotionBlurFilter.CameraMotion)
{
Vector4 zero = Vector4.zero;
float num4 = Vector3.Dot(base.transform.up, Vector3.up);
Vector3 vector = this.prevFramePos - base.transform.position;
float magnitude = vector.magnitude;
float num5 = Vector3.Angle(base.transform.up, this.prevFrameUp) / this._camera.fieldOfView * ((float)source.width * 0.75f);
zero.x = this.rotationScale * num5;
num5 = Vector3.Angle(base.transform.forward, this.prevFrameForward) / this._camera.fieldOfView * ((float)source.width * 0.75f);
zero.y = this.rotationScale * num4 * num5;
num5 = Vector3.Angle(base.transform.forward, this.prevFrameForward) / this._camera.fieldOfView * ((float)source.width * 0.75f);
zero.z = this.rotationScale * (1f - num4) * num5;
if (magnitude > Mathf.Epsilon && this.movementScale > Mathf.Epsilon)
{
zero.w = this.movementScale * Vector3.Dot(base.transform.forward, vector) * ((float)source.width * 0.5f);
zero.x += this.movementScale * Vector3.Dot(base.transform.up, vector) * ((float)source.width * 0.5f);
zero.y += this.movementScale * Vector3.Dot(base.transform.right, vector) * ((float)source.width * 0.5f);
}
if (this.preview)
{
this.motionBlurMaterial.SetVector("_BlurDirectionPacked", new Vector4(this.previewScale.y, this.previewScale.x, 0f, this.previewScale.z) * 0.5f * this._camera.fieldOfView);
}
else
{
this.motionBlurMaterial.SetVector("_BlurDirectionPacked", zero);
}
}
else
{
Graphics.Blit(source, temporary, this.motionBlurMaterial, 0);
Camera camera = null;
if (this.excludeLayers.value != 0)
{
camera = this.GetTmpCam();
}
if (camera && this.excludeLayers.value != 0 && this.replacementClear && this.replacementClear.isSupported)
{
camera.targetTexture = temporary;
camera.cullingMask = this.excludeLayers;
camera.RenderWithShader(this.replacementClear, string.Empty);
}
}
if (!this.preview && Time.frameCount != this.prevFrameCount)
{
this.prevFrameCount = Time.frameCount;
this.Remember();
}
source.filterMode = FilterMode.Bilinear;
if (this.showVelocity)
{
this.motionBlurMaterial.SetFloat("_DisplayVelocityScale", this.showVelocityScale);
Graphics.Blit(temporary, destination, this.motionBlurMaterial, 1);
}
else if (this.filterType == CameraMotionBlur.MotionBlurFilter.ReconstructionDX11 && !flag)
{
this.dx11MotionBlurMaterial.SetFloat("_MinVelocity", this.minVelocity);
this.dx11MotionBlurMaterial.SetFloat("_VelocityScale", this.velocityScale);
this.dx11MotionBlurMaterial.SetFloat("_Jitter", this.jitter);
this.dx11MotionBlurMaterial.SetTexture("_NoiseTex", this.noiseTexture);
this.dx11MotionBlurMaterial.SetTexture("_VelTex", temporary);
this.dx11MotionBlurMaterial.SetTexture("_NeighbourMaxTex", temporary3);
this.dx11MotionBlurMaterial.SetFloat("_SoftZDistance", Mathf.Max(0.00025f, this.softZDistance));
this.dx11MotionBlurMaterial.SetFloat("_MaxRadiusOrKInPaper", num);
Graphics.Blit(temporary, temporary2, this.dx11MotionBlurMaterial, 0);
Graphics.Blit(temporary2, temporary3, this.dx11MotionBlurMaterial, 1);
Graphics.Blit(source, destination, this.dx11MotionBlurMaterial, 2);
}
else if (this.filterType == CameraMotionBlur.MotionBlurFilter.Reconstruction || flag)
{
this.motionBlurMaterial.SetFloat("_SoftZDistance", Mathf.Max(0.00025f, this.softZDistance));
Graphics.Blit(temporary, temporary2, this.motionBlurMaterial, 2);
Graphics.Blit(temporary2, temporary3, this.motionBlurMaterial, 3);
Graphics.Blit(source, destination, this.motionBlurMaterial, 4);
}
else if (this.filterType == CameraMotionBlur.MotionBlurFilter.CameraMotion)
{
Graphics.Blit(source, destination, this.motionBlurMaterial, 6);
}
else if (this.filterType == CameraMotionBlur.MotionBlurFilter.ReconstructionDisc)
{
this.motionBlurMaterial.SetFloat("_SoftZDistance", Mathf.Max(0.00025f, this.softZDistance));
Graphics.Blit(temporary, temporary2, this.motionBlurMaterial, 2);
Graphics.Blit(temporary2, temporary3, this.motionBlurMaterial, 3);
Graphics.Blit(source, destination, this.motionBlurMaterial, 7);
}
else
{
Graphics.Blit(source, destination, this.motionBlurMaterial, 5);
}
RenderTexture.ReleaseTemporary(temporary);
RenderTexture.ReleaseTemporary(temporary2);
RenderTexture.ReleaseTemporary(temporary3);
}
// Token: 0x060000F2 RID: 242 RVA: 0x0000A978 File Offset: 0x00008D78
private void Remember()
{
this.prevViewProjMat = this.currentViewProjMat;
this.prevFrameForward = base.transform.forward;
this.prevFrameUp = base.transform.up;
this.prevFramePos = base.transform.position;
this.prevStereoViewProjMat[0] = this.currentStereoViewProjMat[0];
this.prevStereoViewProjMat[1] = this.currentStereoViewProjMat[1];
}
// Token: 0x060000F3 RID: 243 RVA: 0x0000AA08 File Offset: 0x00008E08
private Camera GetTmpCam()
{
if (this.tmpCam == null)
{
string text = "_" + this._camera.name + "_MotionBlurTmpCam";
GameObject gameObject = GameObject.Find(text);
if (null == gameObject)
{
this.tmpCam = new GameObject(text, new Type[] { typeof(Camera) });
}
else
{
this.tmpCam = gameObject;
}
}
this.tmpCam.hideFlags = HideFlags.DontSave;
this.tmpCam.transform.position = this._camera.transform.position;
this.tmpCam.transform.rotation = this._camera.transform.rotation;
this.tmpCam.transform.localScale = this._camera.transform.localScale;
this.tmpCam.GetComponent<Camera>().CopyFrom(this._camera);
this.tmpCam.GetComponent<Camera>().enabled = false;
this.tmpCam.GetComponent<Camera>().depthTextureMode = DepthTextureMode.None;
this.tmpCam.GetComponent<Camera>().clearFlags = CameraClearFlags.Nothing;
return this.tmpCam.GetComponent<Camera>();
}
// Token: 0x060000F4 RID: 244 RVA: 0x0000AB40 File Offset: 0x00008F40
private void StartFrame()
{
this.prevFramePos = Vector3.Slerp(this.prevFramePos, base.transform.position, 0.75f);
}
// Token: 0x060000F5 RID: 245 RVA: 0x0000AB63 File Offset: 0x00008F63
private static int divRoundUp(int x, int d)
{
return (x + d - 1) / d;
}
// Token: 0x040001F3 RID: 499
private static float MAX_RADIUS = 10f;
// Token: 0x040001F4 RID: 500
public CameraMotionBlur.MotionBlurFilter filterType = CameraMotionBlur.MotionBlurFilter.Reconstruction;
// Token: 0x040001F5 RID: 501
public bool preview;
// Token: 0x040001F6 RID: 502
public Vector3 previewScale = Vector3.one;
// Token: 0x040001F7 RID: 503
public float movementScale;
// Token: 0x040001F8 RID: 504
public float rotationScale = 1f;
// Token: 0x040001F9 RID: 505
public float maxVelocity = 8f;
// Token: 0x040001FA RID: 506
public float minVelocity = 0.1f;
// Token: 0x040001FB RID: 507
public float velocityScale = 0.375f;
// Token: 0x040001FC RID: 508
public float softZDistance = 0.005f;
// Token: 0x040001FD RID: 509
public int velocityDownsample = 1;
// Token: 0x040001FE RID: 510
public LayerMask excludeLayers = 0;
// Token: 0x040001FF RID: 511
private GameObject tmpCam;
// Token: 0x04000200 RID: 512
public Shader shader;
// Token: 0x04000201 RID: 513
public Shader dx11MotionBlurShader;
// Token: 0x04000202 RID: 514
public Shader replacementClear;
// Token: 0x04000203 RID: 515
private Material motionBlurMaterial;
// Token: 0x04000204 RID: 516
private Material dx11MotionBlurMaterial;
// Token: 0x04000205 RID: 517
public Texture2D noiseTexture;
// Token: 0x04000206 RID: 518
public float jitter = 0.05f;
// Token: 0x04000207 RID: 519
public bool showVelocity;
// Token: 0x04000208 RID: 520
public float showVelocityScale = 1f;
// Token: 0x04000209 RID: 521
private Matrix4x4 currentViewProjMat;
// Token: 0x0400020A RID: 522
private Matrix4x4[] currentStereoViewProjMat;
// Token: 0x0400020B RID: 523
private Matrix4x4 prevViewProjMat;
// Token: 0x0400020C RID: 524
private Matrix4x4[] prevStereoViewProjMat;
// Token: 0x0400020D RID: 525
private int prevFrameCount;
// Token: 0x0400020E RID: 526
private bool wasActive;
// Token: 0x0400020F RID: 527
private Vector3 prevFrameForward = Vector3.forward;
// Token: 0x04000210 RID: 528
private Vector3 prevFrameUp = Vector3.up;
// Token: 0x04000211 RID: 529
private Vector3 prevFramePos = Vector3.zero;
// Token: 0x04000212 RID: 530
private Camera _camera;
// Token: 0x0200005E RID: 94
public enum MotionBlurFilter
{
// Token: 0x04000214 RID: 532
CameraMotion,
// Token: 0x04000215 RID: 533
LocalBlur,
// Token: 0x04000216 RID: 534
Reconstruction,
// Token: 0x04000217 RID: 535
ReconstructionDX11,
// Token: 0x04000218 RID: 536
ReconstructionDisc
}
}
}
@@ -0,0 +1,244 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200005F RID: 95
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Color Correction (Curves, Saturation)")]
public class ColorCorrectionCurves : PostEffectsBase
{
// Token: 0x060000F8 RID: 248 RVA: 0x0000ADAB File Offset: 0x000091AB
private new void Start()
{
base.Start();
this.updateTexturesOnStartup = true;
}
// Token: 0x060000F9 RID: 249 RVA: 0x0000ADBA File Offset: 0x000091BA
private void Awake()
{
}
// Token: 0x060000FA RID: 250 RVA: 0x0000ADBC File Offset: 0x000091BC
public override bool CheckResources()
{
base.CheckSupport(this.mode == ColorCorrectionCurves.ColorCorrectionMode.Advanced);
this.ccMaterial = base.CheckShaderAndCreateMaterial(this.simpleColorCorrectionCurvesShader, this.ccMaterial);
this.ccDepthMaterial = base.CheckShaderAndCreateMaterial(this.colorCorrectionCurvesShader, this.ccDepthMaterial);
this.selectiveCcMaterial = base.CheckShaderAndCreateMaterial(this.colorCorrectionSelectiveShader, this.selectiveCcMaterial);
if (!this.rgbChannelTex)
{
this.rgbChannelTex = new Texture2D(256, 4, TextureFormat.ARGB32, false, true);
}
if (!this.rgbDepthChannelTex)
{
this.rgbDepthChannelTex = new Texture2D(256, 4, TextureFormat.ARGB32, false, true);
}
if (!this.zCurveTex)
{
this.zCurveTex = new Texture2D(256, 1, TextureFormat.ARGB32, false, true);
}
this.rgbChannelTex.hideFlags = HideFlags.DontSave;
this.rgbDepthChannelTex.hideFlags = HideFlags.DontSave;
this.zCurveTex.hideFlags = HideFlags.DontSave;
this.rgbChannelTex.wrapMode = TextureWrapMode.Clamp;
this.rgbDepthChannelTex.wrapMode = TextureWrapMode.Clamp;
this.zCurveTex.wrapMode = TextureWrapMode.Clamp;
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000FB RID: 251 RVA: 0x0000AEF0 File Offset: 0x000092F0
public void UpdateParameters()
{
this.CheckResources();
if (this.redChannel != null && this.greenChannel != null && this.blueChannel != null)
{
for (float num = 0f; num <= 1f; num += 0.003921569f)
{
float num2 = Mathf.Clamp(this.redChannel.Evaluate(num), 0f, 1f);
float num3 = Mathf.Clamp(this.greenChannel.Evaluate(num), 0f, 1f);
float num4 = Mathf.Clamp(this.blueChannel.Evaluate(num), 0f, 1f);
this.rgbChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 0, new Color(num2, num2, num2));
this.rgbChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 1, new Color(num3, num3, num3));
this.rgbChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 2, new Color(num4, num4, num4));
float num5 = Mathf.Clamp(this.zCurve.Evaluate(num), 0f, 1f);
this.zCurveTex.SetPixel((int)Mathf.Floor(num * 255f), 0, new Color(num5, num5, num5));
num2 = Mathf.Clamp(this.depthRedChannel.Evaluate(num), 0f, 1f);
num3 = Mathf.Clamp(this.depthGreenChannel.Evaluate(num), 0f, 1f);
num4 = Mathf.Clamp(this.depthBlueChannel.Evaluate(num), 0f, 1f);
this.rgbDepthChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 0, new Color(num2, num2, num2));
this.rgbDepthChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 1, new Color(num3, num3, num3));
this.rgbDepthChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 2, new Color(num4, num4, num4));
}
this.rgbChannelTex.Apply();
this.rgbDepthChannelTex.Apply();
this.zCurveTex.Apply();
}
}
// Token: 0x060000FC RID: 252 RVA: 0x0000B113 File Offset: 0x00009513
private void UpdateTextures()
{
this.UpdateParameters();
}
// Token: 0x060000FD RID: 253 RVA: 0x0000B11C File Offset: 0x0000951C
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.updateTexturesOnStartup)
{
this.UpdateParameters();
this.updateTexturesOnStartup = false;
}
if (this.useDepthCorrection)
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
}
RenderTexture renderTexture = destination;
if (this.selectiveCc)
{
renderTexture = RenderTexture.GetTemporary(source.width, source.height);
}
if (this.useDepthCorrection)
{
this.ccDepthMaterial.SetTexture("_RgbTex", this.rgbChannelTex);
this.ccDepthMaterial.SetTexture("_ZCurve", this.zCurveTex);
this.ccDepthMaterial.SetTexture("_RgbDepthTex", this.rgbDepthChannelTex);
this.ccDepthMaterial.SetFloat("_Saturation", this.saturation);
Graphics.Blit(source, renderTexture, this.ccDepthMaterial);
}
else
{
this.ccMaterial.SetTexture("_RgbTex", this.rgbChannelTex);
this.ccMaterial.SetFloat("_Saturation", this.saturation);
Graphics.Blit(source, renderTexture, this.ccMaterial);
}
if (this.selectiveCc)
{
this.selectiveCcMaterial.SetColor("selColor", this.selectiveFromColor);
this.selectiveCcMaterial.SetColor("targetColor", this.selectiveToColor);
Graphics.Blit(renderTexture, destination, this.selectiveCcMaterial);
RenderTexture.ReleaseTemporary(renderTexture);
}
}
// Token: 0x04000219 RID: 537
public AnimationCurve redChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x0400021A RID: 538
public AnimationCurve greenChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x0400021B RID: 539
public AnimationCurve blueChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x0400021C RID: 540
public bool useDepthCorrection;
// Token: 0x0400021D RID: 541
public AnimationCurve zCurve = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x0400021E RID: 542
public AnimationCurve depthRedChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x0400021F RID: 543
public AnimationCurve depthGreenChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x04000220 RID: 544
public AnimationCurve depthBlueChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x04000221 RID: 545
private Material ccMaterial;
// Token: 0x04000222 RID: 546
private Material ccDepthMaterial;
// Token: 0x04000223 RID: 547
private Material selectiveCcMaterial;
// Token: 0x04000224 RID: 548
private Texture2D rgbChannelTex;
// Token: 0x04000225 RID: 549
private Texture2D rgbDepthChannelTex;
// Token: 0x04000226 RID: 550
private Texture2D zCurveTex;
// Token: 0x04000227 RID: 551
public float saturation = 1f;
// Token: 0x04000228 RID: 552
public bool selectiveCc;
// Token: 0x04000229 RID: 553
public Color selectiveFromColor = Color.white;
// Token: 0x0400022A RID: 554
public Color selectiveToColor = Color.white;
// Token: 0x0400022B RID: 555
public ColorCorrectionCurves.ColorCorrectionMode mode;
// Token: 0x0400022C RID: 556
public bool updateTextures = true;
// Token: 0x0400022D RID: 557
public Shader colorCorrectionCurvesShader;
// Token: 0x0400022E RID: 558
public Shader simpleColorCorrectionCurvesShader;
// Token: 0x0400022F RID: 559
public Shader colorCorrectionSelectiveShader;
// Token: 0x04000230 RID: 560
private bool updateTexturesOnStartup = true;
// Token: 0x02000060 RID: 96
public enum ColorCorrectionMode
{
// Token: 0x04000232 RID: 562
Simple,
// Token: 0x04000233 RID: 563
Advanced
}
}
}
@@ -0,0 +1,153 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000061 RID: 97
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Color Correction (3D Lookup Texture)")]
public class ColorCorrectionLookup : PostEffectsBase
{
// Token: 0x060000FF RID: 255 RVA: 0x0000B29C File Offset: 0x0000969C
public override bool CheckResources()
{
base.CheckSupport(false);
this.material = base.CheckShaderAndCreateMaterial(this.shader, this.material);
if (!this.isSupported || !SystemInfo.supports3DTextures)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000100 RID: 256 RVA: 0x0000B2EA File Offset: 0x000096EA
private void OnDisable()
{
if (this.material)
{
global::UnityEngine.Object.DestroyImmediate(this.material);
this.material = null;
}
}
// Token: 0x06000101 RID: 257 RVA: 0x0000B30E File Offset: 0x0000970E
private void OnDestroy()
{
if (this.converted3DLut)
{
global::UnityEngine.Object.DestroyImmediate(this.converted3DLut);
}
this.converted3DLut = null;
}
// Token: 0x06000102 RID: 258 RVA: 0x0000B334 File Offset: 0x00009734
public void SetIdentityLut()
{
int num = 16;
Color[] array = new Color[num * num * num];
float num2 = 1f / (1f * (float)num - 1f);
for (int i = 0; i < num; i++)
{
for (int j = 0; j < num; j++)
{
for (int k = 0; k < num; k++)
{
array[i + j * num + k * num * num] = new Color((float)i * 1f * num2, (float)j * 1f * num2, (float)k * 1f * num2, 1f);
}
}
}
if (this.converted3DLut)
{
global::UnityEngine.Object.DestroyImmediate(this.converted3DLut);
}
this.converted3DLut = new Texture3D(num, num, num, TextureFormat.ARGB32, false);
this.converted3DLut.SetPixels(array);
this.converted3DLut.Apply();
this.basedOnTempTex = string.Empty;
}
// Token: 0x06000103 RID: 259 RVA: 0x0000B434 File Offset: 0x00009834
public bool ValidDimensions(Texture2D tex2d)
{
if (!tex2d)
{
return false;
}
int height = tex2d.height;
return height == Mathf.FloorToInt(Mathf.Sqrt((float)tex2d.width));
}
// Token: 0x06000104 RID: 260 RVA: 0x0000B470 File Offset: 0x00009870
public void Convert(Texture2D temp2DTex, string path)
{
if (temp2DTex)
{
int num = temp2DTex.width * temp2DTex.height;
num = temp2DTex.height;
if (!this.ValidDimensions(temp2DTex))
{
Debug.LogWarning("The given 2D texture " + temp2DTex.name + " cannot be used as a 3D LUT.");
this.basedOnTempTex = string.Empty;
return;
}
Color[] pixels = temp2DTex.GetPixels();
Color[] array = new Color[pixels.Length];
for (int i = 0; i < num; i++)
{
for (int j = 0; j < num; j++)
{
for (int k = 0; k < num; k++)
{
int num2 = num - j - 1;
array[i + j * num + k * num * num] = pixels[k * num + i + num2 * num * num];
}
}
}
if (this.converted3DLut)
{
global::UnityEngine.Object.DestroyImmediate(this.converted3DLut);
}
this.converted3DLut = new Texture3D(num, num, num, TextureFormat.ARGB32, false);
this.converted3DLut.SetPixels(array);
this.converted3DLut.Apply();
this.basedOnTempTex = path;
}
else
{
Debug.LogError("Couldn't color correct with 3D LUT texture. Image Effect will be disabled.");
}
}
// Token: 0x06000105 RID: 261 RVA: 0x0000B5B0 File Offset: 0x000099B0
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources() || !SystemInfo.supports3DTextures)
{
Graphics.Blit(source, destination);
return;
}
if (this.converted3DLut == null)
{
this.SetIdentityLut();
}
int width = this.converted3DLut.width;
this.converted3DLut.wrapMode = TextureWrapMode.Clamp;
this.material.SetFloat("_Scale", (float)(width - 1) / (1f * (float)width));
this.material.SetFloat("_Offset", 1f / (2f * (float)width));
this.material.SetTexture("_ClutTex", this.converted3DLut);
Graphics.Blit(source, destination, this.material, (QualitySettings.activeColorSpace != ColorSpace.Linear) ? 0 : 1);
}
// Token: 0x04000234 RID: 564
public Shader shader;
// Token: 0x04000235 RID: 565
private Material material;
// Token: 0x04000236 RID: 566
public Texture3D converted3DLut;
// Token: 0x04000237 RID: 567
public string basedOnTempTex = string.Empty;
}
}
@@ -0,0 +1,21 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000062 RID: 98
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Color Correction (Ramp)")]
public class ColorCorrectionRamp : ImageEffectBase
{
// Token: 0x06000107 RID: 263 RVA: 0x0000B718 File Offset: 0x00009B18
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
base.material.SetTexture("_RampTex", this.textureRamp);
Graphics.Blit(source, destination, base.material);
}
// Token: 0x04000238 RID: 568
public Texture textureRamp;
}
}
@@ -0,0 +1,79 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000063 RID: 99
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Color Adjustments/Contrast Enhance (Unsharp Mask)")]
public class ContrastEnhance : PostEffectsBase
{
// Token: 0x06000109 RID: 265 RVA: 0x0000B75C File Offset: 0x00009B5C
public override bool CheckResources()
{
base.CheckSupport(false);
this.contrastCompositeMaterial = base.CheckShaderAndCreateMaterial(this.contrastCompositeShader, this.contrastCompositeMaterial);
this.separableBlurMaterial = base.CheckShaderAndCreateMaterial(this.separableBlurShader, this.separableBlurMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600010A RID: 266 RVA: 0x0000B7B8 File Offset: 0x00009BB8
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
int width = source.width;
int height = source.height;
RenderTexture temporary = RenderTexture.GetTemporary(width / 2, height / 2, 0);
Graphics.Blit(source, temporary);
RenderTexture renderTexture = RenderTexture.GetTemporary(width / 4, height / 4, 0);
Graphics.Blit(temporary, renderTexture);
RenderTexture.ReleaseTemporary(temporary);
this.separableBlurMaterial.SetVector("offsets", new Vector4(0f, this.blurSpread * 1f / (float)renderTexture.height, 0f, 0f));
RenderTexture temporary2 = RenderTexture.GetTemporary(width / 4, height / 4, 0);
Graphics.Blit(renderTexture, temporary2, this.separableBlurMaterial);
RenderTexture.ReleaseTemporary(renderTexture);
this.separableBlurMaterial.SetVector("offsets", new Vector4(this.blurSpread * 1f / (float)renderTexture.width, 0f, 0f, 0f));
renderTexture = RenderTexture.GetTemporary(width / 4, height / 4, 0);
Graphics.Blit(temporary2, renderTexture, this.separableBlurMaterial);
RenderTexture.ReleaseTemporary(temporary2);
this.contrastCompositeMaterial.SetTexture("_MainTexBlurred", renderTexture);
this.contrastCompositeMaterial.SetFloat("intensity", this.intensity);
this.contrastCompositeMaterial.SetFloat("threshold", this.threshold);
Graphics.Blit(source, destination, this.contrastCompositeMaterial);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x04000239 RID: 569
[Range(0f, 1f)]
public float intensity = 0.5f;
// Token: 0x0400023A RID: 570
[Range(0f, 0.999f)]
public float threshold;
// Token: 0x0400023B RID: 571
private Material separableBlurMaterial;
// Token: 0x0400023C RID: 572
private Material contrastCompositeMaterial;
// Token: 0x0400023D RID: 573
[Range(0f, 1f)]
public float blurSpread = 1f;
// Token: 0x0400023E RID: 574
public Shader separableBlurShader;
// Token: 0x0400023F RID: 575
public Shader contrastCompositeShader;
}
}
@@ -0,0 +1,209 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000064 RID: 100
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Contrast Stretch")]
public class ContrastStretch : MonoBehaviour
{
// Token: 0x17000053 RID: 83
// (get) Token: 0x0600010C RID: 268 RVA: 0x0000B94D File Offset: 0x00009D4D
protected Material materialLum
{
get
{
if (this.m_materialLum == null)
{
this.m_materialLum = new Material(this.shaderLum);
this.m_materialLum.hideFlags = HideFlags.HideAndDontSave;
}
return this.m_materialLum;
}
}
// Token: 0x17000054 RID: 84
// (get) Token: 0x0600010D RID: 269 RVA: 0x0000B984 File Offset: 0x00009D84
protected Material materialReduce
{
get
{
if (this.m_materialReduce == null)
{
this.m_materialReduce = new Material(this.shaderReduce);
this.m_materialReduce.hideFlags = HideFlags.HideAndDontSave;
}
return this.m_materialReduce;
}
}
// Token: 0x17000055 RID: 85
// (get) Token: 0x0600010E RID: 270 RVA: 0x0000B9BB File Offset: 0x00009DBB
protected Material materialAdapt
{
get
{
if (this.m_materialAdapt == null)
{
this.m_materialAdapt = new Material(this.shaderAdapt);
this.m_materialAdapt.hideFlags = HideFlags.HideAndDontSave;
}
return this.m_materialAdapt;
}
}
// Token: 0x17000056 RID: 86
// (get) Token: 0x0600010F RID: 271 RVA: 0x0000B9F2 File Offset: 0x00009DF2
protected Material materialApply
{
get
{
if (this.m_materialApply == null)
{
this.m_materialApply = new Material(this.shaderApply);
this.m_materialApply.hideFlags = HideFlags.HideAndDontSave;
}
return this.m_materialApply;
}
}
// Token: 0x06000110 RID: 272 RVA: 0x0000BA2C File Offset: 0x00009E2C
private void Start()
{
if (!SystemInfo.supportsImageEffects)
{
base.enabled = false;
return;
}
if (!this.shaderAdapt.isSupported || !this.shaderApply.isSupported || !this.shaderLum.isSupported || !this.shaderReduce.isSupported)
{
base.enabled = false;
return;
}
}
// Token: 0x06000111 RID: 273 RVA: 0x0000BA94 File Offset: 0x00009E94
private void OnEnable()
{
for (int i = 0; i < 2; i++)
{
if (!this.adaptRenderTex[i])
{
this.adaptRenderTex[i] = new RenderTexture(1, 1, 0);
this.adaptRenderTex[i].hideFlags = HideFlags.HideAndDontSave;
}
}
}
// Token: 0x06000112 RID: 274 RVA: 0x0000BAE4 File Offset: 0x00009EE4
private void OnDisable()
{
for (int i = 0; i < 2; i++)
{
global::UnityEngine.Object.DestroyImmediate(this.adaptRenderTex[i]);
this.adaptRenderTex[i] = null;
}
if (this.m_materialLum)
{
global::UnityEngine.Object.DestroyImmediate(this.m_materialLum);
}
if (this.m_materialReduce)
{
global::UnityEngine.Object.DestroyImmediate(this.m_materialReduce);
}
if (this.m_materialAdapt)
{
global::UnityEngine.Object.DestroyImmediate(this.m_materialAdapt);
}
if (this.m_materialApply)
{
global::UnityEngine.Object.DestroyImmediate(this.m_materialApply);
}
}
// Token: 0x06000113 RID: 275 RVA: 0x0000BB88 File Offset: 0x00009F88
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
RenderTexture renderTexture = RenderTexture.GetTemporary(source.width, source.height);
Graphics.Blit(source, renderTexture, this.materialLum);
while (renderTexture.width > 1 || renderTexture.height > 1)
{
int num = renderTexture.width / 2;
if (num < 1)
{
num = 1;
}
int num2 = renderTexture.height / 2;
if (num2 < 1)
{
num2 = 1;
}
RenderTexture temporary = RenderTexture.GetTemporary(num, num2);
Graphics.Blit(renderTexture, temporary, this.materialReduce);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = temporary;
}
this.CalculateAdaptation(renderTexture);
this.materialApply.SetTexture("_AdaptTex", this.adaptRenderTex[this.curAdaptIndex]);
Graphics.Blit(source, destination, this.materialApply);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x06000114 RID: 276 RVA: 0x0000BC4C File Offset: 0x0000A04C
private void CalculateAdaptation(Texture curTexture)
{
int num = this.curAdaptIndex;
this.curAdaptIndex = (this.curAdaptIndex + 1) % 2;
float num2 = 1f - Mathf.Pow(1f - this.adaptationSpeed, 30f * Time.deltaTime);
num2 = Mathf.Clamp(num2, 0.01f, 1f);
this.materialAdapt.SetTexture("_CurTex", curTexture);
this.materialAdapt.SetVector("_AdaptParams", new Vector4(num2, this.limitMinimum, this.limitMaximum, 0f));
Graphics.SetRenderTarget(this.adaptRenderTex[this.curAdaptIndex]);
GL.Clear(false, true, Color.black);
Graphics.Blit(this.adaptRenderTex[num], this.adaptRenderTex[this.curAdaptIndex], this.materialAdapt);
}
// Token: 0x04000240 RID: 576
[Range(0.0001f, 1f)]
public float adaptationSpeed = 0.02f;
// Token: 0x04000241 RID: 577
[Range(0f, 1f)]
public float limitMinimum = 0.2f;
// Token: 0x04000242 RID: 578
[Range(0f, 1f)]
public float limitMaximum = 0.6f;
// Token: 0x04000243 RID: 579
private RenderTexture[] adaptRenderTex = new RenderTexture[2];
// Token: 0x04000244 RID: 580
private int curAdaptIndex;
// Token: 0x04000245 RID: 581
public Shader shaderLum;
// Token: 0x04000246 RID: 582
private Material m_materialLum;
// Token: 0x04000247 RID: 583
public Shader shaderReduce;
// Token: 0x04000248 RID: 584
private Material m_materialReduce;
// Token: 0x04000249 RID: 585
public Shader shaderAdapt;
// Token: 0x0400024A RID: 586
private Material m_materialAdapt;
// Token: 0x0400024B RID: 587
public Shader shaderApply;
// Token: 0x0400024C RID: 588
private Material m_materialApply;
}
}
@@ -0,0 +1,90 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000065 RID: 101
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Edge Detection/Crease Shading")]
public class CreaseShading : PostEffectsBase
{
// Token: 0x06000116 RID: 278 RVA: 0x0000BD40 File Offset: 0x0000A140
public override bool CheckResources()
{
base.CheckSupport(true);
this.blurMaterial = base.CheckShaderAndCreateMaterial(this.blurShader, this.blurMaterial);
this.depthFetchMaterial = base.CheckShaderAndCreateMaterial(this.depthFetchShader, this.depthFetchMaterial);
this.creaseApplyMaterial = base.CheckShaderAndCreateMaterial(this.creaseApplyShader, this.creaseApplyMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000117 RID: 279 RVA: 0x0000BDB4 File Offset: 0x0000A1B4
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
int width = source.width;
int height = source.height;
float num = 1f * (float)width / (1f * (float)height);
float num2 = 0.001953125f;
RenderTexture temporary = RenderTexture.GetTemporary(width, height, 0);
RenderTexture renderTexture = RenderTexture.GetTemporary(width / 2, height / 2, 0);
Graphics.Blit(source, temporary, this.depthFetchMaterial);
Graphics.Blit(temporary, renderTexture);
for (int i = 0; i < this.softness; i++)
{
RenderTexture renderTexture2 = RenderTexture.GetTemporary(width / 2, height / 2, 0);
this.blurMaterial.SetVector("offsets", new Vector4(0f, this.spread * num2, 0f, 0f));
Graphics.Blit(renderTexture, renderTexture2, this.blurMaterial);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
renderTexture2 = RenderTexture.GetTemporary(width / 2, height / 2, 0);
this.blurMaterial.SetVector("offsets", new Vector4(this.spread * num2 / num, 0f, 0f, 0f));
Graphics.Blit(renderTexture, renderTexture2, this.blurMaterial);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
}
this.creaseApplyMaterial.SetTexture("_HrDepthTex", temporary);
this.creaseApplyMaterial.SetTexture("_LrDepthTex", renderTexture);
this.creaseApplyMaterial.SetFloat("intensity", this.intensity);
Graphics.Blit(source, destination, this.creaseApplyMaterial);
RenderTexture.ReleaseTemporary(temporary);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x0400024D RID: 589
public float intensity = 0.5f;
// Token: 0x0400024E RID: 590
public int softness = 1;
// Token: 0x0400024F RID: 591
public float spread = 1f;
// Token: 0x04000250 RID: 592
public Shader blurShader;
// Token: 0x04000251 RID: 593
private Material blurMaterial;
// Token: 0x04000252 RID: 594
public Shader depthFetchShader;
// Token: 0x04000253 RID: 595
private Material depthFetchMaterial;
// Token: 0x04000254 RID: 596
public Shader creaseApplyShader;
// Token: 0x04000255 RID: 597
private Material creaseApplyMaterial;
}
}
@@ -0,0 +1,390 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000066 RID: 102
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Camera/Depth of Field (Lens Blur, Scatter, DX11)")]
public class DepthOfField : PostEffectsBase
{
// Token: 0x06000119 RID: 281 RVA: 0x0000BFD8 File Offset: 0x0000A3D8
public override bool CheckResources()
{
base.CheckSupport(true);
this.dofHdrMaterial = base.CheckShaderAndCreateMaterial(this.dofHdrShader, this.dofHdrMaterial);
if (this.supportDX11 && this.blurType == DepthOfField.BlurType.DX11)
{
this.dx11bokehMaterial = base.CheckShaderAndCreateMaterial(this.dx11BokehShader, this.dx11bokehMaterial);
this.CreateComputeResources();
}
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600011A RID: 282 RVA: 0x0000C051 File Offset: 0x0000A451
private void OnEnable()
{
this.cachedCamera = base.GetComponent<Camera>();
this.cachedCamera.depthTextureMode |= DepthTextureMode.Depth;
}
// Token: 0x0600011B RID: 283 RVA: 0x0000C074 File Offset: 0x0000A474
private void OnDisable()
{
this.ReleaseComputeResources();
if (this.dofHdrMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.dofHdrMaterial);
}
this.dofHdrMaterial = null;
if (this.dx11bokehMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.dx11bokehMaterial);
}
this.dx11bokehMaterial = null;
}
// Token: 0x0600011C RID: 284 RVA: 0x0000C0CB File Offset: 0x0000A4CB
private void ReleaseComputeResources()
{
if (this.cbDrawArgs != null)
{
this.cbDrawArgs.Release();
}
this.cbDrawArgs = null;
if (this.cbPoints != null)
{
this.cbPoints.Release();
}
this.cbPoints = null;
}
// Token: 0x0600011D RID: 285 RVA: 0x0000C108 File Offset: 0x0000A508
private void CreateComputeResources()
{
if (this.cbDrawArgs == null)
{
this.cbDrawArgs = new ComputeBuffer(1, 16, ComputeBufferType.DrawIndirect);
int[] array = new int[] { 0, 1, 0, 0 };
this.cbDrawArgs.SetData(array);
}
if (this.cbPoints == null)
{
this.cbPoints = new ComputeBuffer(90000, 28, ComputeBufferType.Append);
}
}
// Token: 0x0600011E RID: 286 RVA: 0x0000C174 File Offset: 0x0000A574
private float FocalDistance01(float worldDist)
{
return this.cachedCamera.WorldToViewportPoint((worldDist - this.cachedCamera.nearClipPlane) * this.cachedCamera.transform.forward + this.cachedCamera.transform.position).z / (this.cachedCamera.farClipPlane - this.cachedCamera.nearClipPlane);
}
// Token: 0x0600011F RID: 287 RVA: 0x0000C1E4 File Offset: 0x0000A5E4
private void WriteCoc(RenderTexture fromTo, bool fgDilate)
{
this.dofHdrMaterial.SetTexture("_FgOverlap", null);
if (this.nearBlur && fgDilate)
{
int num = fromTo.width / 2;
int num2 = fromTo.height / 2;
RenderTexture renderTexture = RenderTexture.GetTemporary(num, num2, 0, fromTo.format);
Graphics.Blit(fromTo, renderTexture, this.dofHdrMaterial, 4);
float num3 = this.internalBlurWidth * this.foregroundOverlap;
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, num3, 0f, num3));
RenderTexture temporary = RenderTexture.GetTemporary(num, num2, 0, fromTo.format);
Graphics.Blit(renderTexture, temporary, this.dofHdrMaterial, 2);
RenderTexture.ReleaseTemporary(renderTexture);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(num3, 0f, 0f, num3));
renderTexture = RenderTexture.GetTemporary(num, num2, 0, fromTo.format);
Graphics.Blit(temporary, renderTexture, this.dofHdrMaterial, 2);
RenderTexture.ReleaseTemporary(temporary);
this.dofHdrMaterial.SetTexture("_FgOverlap", renderTexture);
fromTo.MarkRestoreExpected();
Graphics.Blit(fromTo, fromTo, this.dofHdrMaterial, 13);
RenderTexture.ReleaseTemporary(renderTexture);
}
else
{
fromTo.MarkRestoreExpected();
Graphics.Blit(fromTo, fromTo, this.dofHdrMaterial, 0);
}
}
// Token: 0x06000120 RID: 288 RVA: 0x0000C324 File Offset: 0x0000A724
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.aperture < 0f)
{
this.aperture = 0f;
}
if (this.maxBlurSize < 0.1f)
{
this.maxBlurSize = 0.1f;
}
this.focalSize = Mathf.Clamp(this.focalSize, 0f, 2f);
this.internalBlurWidth = Mathf.Max(this.maxBlurSize, 0f);
this.focalDistance01 = ((!this.focalTransform) ? this.FocalDistance01(this.focalLength) : (this.cachedCamera.WorldToViewportPoint(this.focalTransform.position).z / this.cachedCamera.farClipPlane));
this.dofHdrMaterial.SetVector("_CurveParams", new Vector4(1f, this.focalSize, 1f / (1f - this.aperture) - 1f, this.focalDistance01));
RenderTexture renderTexture = null;
RenderTexture renderTexture2 = null;
float num = this.internalBlurWidth * this.foregroundOverlap;
if (this.visualizeFocus)
{
this.WriteCoc(source, true);
Graphics.Blit(source, destination, this.dofHdrMaterial, 16);
}
else if (this.blurType == DepthOfField.BlurType.DX11 && this.dx11bokehMaterial)
{
if (this.highResolution)
{
this.internalBlurWidth = ((this.internalBlurWidth >= 0.1f) ? this.internalBlurWidth : 0.1f);
num = this.internalBlurWidth * this.foregroundOverlap;
renderTexture = RenderTexture.GetTemporary(source.width, source.height, 0, source.format);
RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0, source.format);
this.WriteCoc(source, false);
RenderTexture renderTexture3 = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
RenderTexture renderTexture4 = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
Graphics.Blit(source, renderTexture3, this.dofHdrMaterial, 15);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, 1.5f, 0f, 1.5f));
Graphics.Blit(renderTexture3, renderTexture4, this.dofHdrMaterial, 19);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(1.5f, 0f, 0f, 1.5f));
Graphics.Blit(renderTexture4, renderTexture3, this.dofHdrMaterial, 19);
if (this.nearBlur)
{
Graphics.Blit(source, renderTexture4, this.dofHdrMaterial, 4);
}
this.dx11bokehMaterial.SetTexture("_BlurredColor", renderTexture3);
this.dx11bokehMaterial.SetFloat("_SpawnHeuristic", this.dx11SpawnHeuristic);
this.dx11bokehMaterial.SetVector("_BokehParams", new Vector4(this.dx11BokehScale, this.dx11BokehIntensity, Mathf.Clamp(this.dx11BokehThreshold, 0.005f, 4f), this.internalBlurWidth));
this.dx11bokehMaterial.SetTexture("_FgCocMask", (!this.nearBlur) ? null : renderTexture4);
Graphics.SetRandomWriteTarget(1, this.cbPoints);
Graphics.Blit(source, renderTexture, this.dx11bokehMaterial, 0);
Graphics.ClearRandomWriteTargets();
if (this.nearBlur)
{
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, num, 0f, num));
Graphics.Blit(renderTexture4, renderTexture3, this.dofHdrMaterial, 2);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(num, 0f, 0f, num));
Graphics.Blit(renderTexture3, renderTexture4, this.dofHdrMaterial, 2);
Graphics.Blit(renderTexture4, renderTexture, this.dofHdrMaterial, 3);
}
Graphics.Blit(renderTexture, temporary, this.dofHdrMaterial, 20);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(this.internalBlurWidth, 0f, 0f, this.internalBlurWidth));
Graphics.Blit(renderTexture, source, this.dofHdrMaterial, 5);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, this.internalBlurWidth, 0f, this.internalBlurWidth));
Graphics.Blit(source, temporary, this.dofHdrMaterial, 21);
Graphics.SetRenderTarget(temporary);
ComputeBuffer.CopyCount(this.cbPoints, this.cbDrawArgs, 0);
this.dx11bokehMaterial.SetBuffer("pointBuffer", this.cbPoints);
this.dx11bokehMaterial.SetTexture("_MainTex", this.dx11BokehTexture);
this.dx11bokehMaterial.SetVector("_Screen", new Vector3(1f / (1f * (float)source.width), 1f / (1f * (float)source.height), this.internalBlurWidth));
this.dx11bokehMaterial.SetPass(2);
Graphics.DrawProceduralIndirect(MeshTopology.Points, this.cbDrawArgs, 0);
Graphics.Blit(temporary, destination);
RenderTexture.ReleaseTemporary(temporary);
RenderTexture.ReleaseTemporary(renderTexture3);
RenderTexture.ReleaseTemporary(renderTexture4);
}
else
{
renderTexture = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
renderTexture2 = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
num = this.internalBlurWidth * this.foregroundOverlap;
this.WriteCoc(source, false);
source.filterMode = FilterMode.Bilinear;
Graphics.Blit(source, renderTexture, this.dofHdrMaterial, 6);
RenderTexture renderTexture3 = RenderTexture.GetTemporary(renderTexture.width >> 1, renderTexture.height >> 1, 0, renderTexture.format);
RenderTexture renderTexture4 = RenderTexture.GetTemporary(renderTexture.width >> 1, renderTexture.height >> 1, 0, renderTexture.format);
Graphics.Blit(renderTexture, renderTexture3, this.dofHdrMaterial, 15);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, 1.5f, 0f, 1.5f));
Graphics.Blit(renderTexture3, renderTexture4, this.dofHdrMaterial, 19);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(1.5f, 0f, 0f, 1.5f));
Graphics.Blit(renderTexture4, renderTexture3, this.dofHdrMaterial, 19);
RenderTexture renderTexture5 = null;
if (this.nearBlur)
{
renderTexture5 = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
Graphics.Blit(source, renderTexture5, this.dofHdrMaterial, 4);
}
this.dx11bokehMaterial.SetTexture("_BlurredColor", renderTexture3);
this.dx11bokehMaterial.SetFloat("_SpawnHeuristic", this.dx11SpawnHeuristic);
this.dx11bokehMaterial.SetVector("_BokehParams", new Vector4(this.dx11BokehScale, this.dx11BokehIntensity, Mathf.Clamp(this.dx11BokehThreshold, 0.005f, 4f), this.internalBlurWidth));
this.dx11bokehMaterial.SetTexture("_FgCocMask", renderTexture5);
Graphics.SetRandomWriteTarget(1, this.cbPoints);
Graphics.Blit(renderTexture, renderTexture2, this.dx11bokehMaterial, 0);
Graphics.ClearRandomWriteTargets();
RenderTexture.ReleaseTemporary(renderTexture3);
RenderTexture.ReleaseTemporary(renderTexture4);
if (this.nearBlur)
{
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, num, 0f, num));
Graphics.Blit(renderTexture5, renderTexture, this.dofHdrMaterial, 2);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(num, 0f, 0f, num));
Graphics.Blit(renderTexture, renderTexture5, this.dofHdrMaterial, 2);
Graphics.Blit(renderTexture5, renderTexture2, this.dofHdrMaterial, 3);
}
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(this.internalBlurWidth, 0f, 0f, this.internalBlurWidth));
Graphics.Blit(renderTexture2, renderTexture, this.dofHdrMaterial, 5);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, this.internalBlurWidth, 0f, this.internalBlurWidth));
Graphics.Blit(renderTexture, renderTexture2, this.dofHdrMaterial, 5);
Graphics.SetRenderTarget(renderTexture2);
ComputeBuffer.CopyCount(this.cbPoints, this.cbDrawArgs, 0);
this.dx11bokehMaterial.SetBuffer("pointBuffer", this.cbPoints);
this.dx11bokehMaterial.SetTexture("_MainTex", this.dx11BokehTexture);
this.dx11bokehMaterial.SetVector("_Screen", new Vector3(1f / (1f * (float)renderTexture2.width), 1f / (1f * (float)renderTexture2.height), this.internalBlurWidth));
this.dx11bokehMaterial.SetPass(1);
Graphics.DrawProceduralIndirect(MeshTopology.Points, this.cbDrawArgs, 0);
this.dofHdrMaterial.SetTexture("_LowRez", renderTexture2);
this.dofHdrMaterial.SetTexture("_FgOverlap", renderTexture5);
this.dofHdrMaterial.SetVector("_Offsets", 1f * (float)source.width / (1f * (float)renderTexture2.width) * this.internalBlurWidth * Vector4.one);
Graphics.Blit(source, destination, this.dofHdrMaterial, 9);
if (renderTexture5)
{
RenderTexture.ReleaseTemporary(renderTexture5);
}
}
}
else
{
source.filterMode = FilterMode.Bilinear;
if (this.highResolution)
{
this.internalBlurWidth *= 2f;
}
this.WriteCoc(source, true);
renderTexture = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
renderTexture2 = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
int num2 = ((this.blurSampleCount != DepthOfField.BlurSampleCount.High && this.blurSampleCount != DepthOfField.BlurSampleCount.Medium) ? 11 : 17);
if (this.highResolution)
{
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, this.internalBlurWidth, 0.025f, this.internalBlurWidth));
Graphics.Blit(source, destination, this.dofHdrMaterial, num2);
}
else
{
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, this.internalBlurWidth, 0.1f, this.internalBlurWidth));
Graphics.Blit(source, renderTexture, this.dofHdrMaterial, 6);
Graphics.Blit(renderTexture, renderTexture2, this.dofHdrMaterial, num2);
this.dofHdrMaterial.SetTexture("_LowRez", renderTexture2);
this.dofHdrMaterial.SetTexture("_FgOverlap", null);
this.dofHdrMaterial.SetVector("_Offsets", Vector4.one * (1f * (float)source.width / (1f * (float)renderTexture2.width)) * this.internalBlurWidth);
Graphics.Blit(source, destination, this.dofHdrMaterial, (this.blurSampleCount != DepthOfField.BlurSampleCount.High) ? 12 : 18);
}
}
if (renderTexture)
{
RenderTexture.ReleaseTemporary(renderTexture);
}
if (renderTexture2)
{
RenderTexture.ReleaseTemporary(renderTexture2);
}
}
// Token: 0x04000256 RID: 598
public bool visualizeFocus;
// Token: 0x04000257 RID: 599
public float focalLength = 10f;
// Token: 0x04000258 RID: 600
public float focalSize = 0.05f;
// Token: 0x04000259 RID: 601
public float aperture = 0.5f;
// Token: 0x0400025A RID: 602
public Transform focalTransform;
// Token: 0x0400025B RID: 603
public float maxBlurSize = 2f;
// Token: 0x0400025C RID: 604
public bool highResolution;
// Token: 0x0400025D RID: 605
public DepthOfField.BlurType blurType;
// Token: 0x0400025E RID: 606
public DepthOfField.BlurSampleCount blurSampleCount = DepthOfField.BlurSampleCount.High;
// Token: 0x0400025F RID: 607
public bool nearBlur;
// Token: 0x04000260 RID: 608
public float foregroundOverlap = 1f;
// Token: 0x04000261 RID: 609
public Shader dofHdrShader;
// Token: 0x04000262 RID: 610
private Material dofHdrMaterial;
// Token: 0x04000263 RID: 611
public Shader dx11BokehShader;
// Token: 0x04000264 RID: 612
private Material dx11bokehMaterial;
// Token: 0x04000265 RID: 613
public float dx11BokehThreshold = 0.5f;
// Token: 0x04000266 RID: 614
public float dx11SpawnHeuristic = 0.0875f;
// Token: 0x04000267 RID: 615
public Texture2D dx11BokehTexture;
// Token: 0x04000268 RID: 616
public float dx11BokehScale = 1.2f;
// Token: 0x04000269 RID: 617
public float dx11BokehIntensity = 2.5f;
// Token: 0x0400026A RID: 618
private float focalDistance01 = 10f;
// Token: 0x0400026B RID: 619
private ComputeBuffer cbDrawArgs;
// Token: 0x0400026C RID: 620
private ComputeBuffer cbPoints;
// Token: 0x0400026D RID: 621
private float internalBlurWidth = 1f;
// Token: 0x0400026E RID: 622
private Camera cachedCamera;
// Token: 0x02000067 RID: 103
public enum BlurType
{
// Token: 0x04000270 RID: 624
DiscBlur,
// Token: 0x04000271 RID: 625
DX11
}
// Token: 0x02000068 RID: 104
public enum BlurSampleCount
{
// Token: 0x04000273 RID: 627
Low,
// Token: 0x04000274 RID: 628
Medium,
// Token: 0x04000275 RID: 629
High
}
}
}
@@ -0,0 +1,525 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000069 RID: 105
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Camera/Depth of Field (deprecated)")]
public class DepthOfFieldDeprecated : PostEffectsBase
{
// Token: 0x06000122 RID: 290 RVA: 0x0000CF18 File Offset: 0x0000B318
private void CreateMaterials()
{
this.dofBlurMaterial = base.CheckShaderAndCreateMaterial(this.dofBlurShader, this.dofBlurMaterial);
this.dofMaterial = base.CheckShaderAndCreateMaterial(this.dofShader, this.dofMaterial);
this.bokehSupport = this.bokehShader.isSupported;
if (this.bokeh && this.bokehSupport && this.bokehShader)
{
this.bokehMaterial = base.CheckShaderAndCreateMaterial(this.bokehShader, this.bokehMaterial);
}
}
// Token: 0x06000123 RID: 291 RVA: 0x0000CFA4 File Offset: 0x0000B3A4
public override bool CheckResources()
{
base.CheckSupport(true);
this.dofBlurMaterial = base.CheckShaderAndCreateMaterial(this.dofBlurShader, this.dofBlurMaterial);
this.dofMaterial = base.CheckShaderAndCreateMaterial(this.dofShader, this.dofMaterial);
this.bokehSupport = this.bokehShader.isSupported;
if (this.bokeh && this.bokehSupport && this.bokehShader)
{
this.bokehMaterial = base.CheckShaderAndCreateMaterial(this.bokehShader, this.bokehMaterial);
}
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000124 RID: 292 RVA: 0x0000D04F File Offset: 0x0000B44F
private void OnDisable()
{
Quads.Cleanup();
}
// Token: 0x06000125 RID: 293 RVA: 0x0000D056 File Offset: 0x0000B456
private void OnEnable()
{
this._camera = base.GetComponent<Camera>();
this._camera.depthTextureMode |= DepthTextureMode.Depth;
}
// Token: 0x06000126 RID: 294 RVA: 0x0000D078 File Offset: 0x0000B478
private float FocalDistance01(float worldDist)
{
return this._camera.WorldToViewportPoint((worldDist - this._camera.nearClipPlane) * this._camera.transform.forward + this._camera.transform.position).z / (this._camera.farClipPlane - this._camera.nearClipPlane);
}
// Token: 0x06000127 RID: 295 RVA: 0x0000D0E8 File Offset: 0x0000B4E8
private int GetDividerBasedOnQuality()
{
int num = 1;
if (this.resolution == DepthOfFieldDeprecated.DofResolution.Medium)
{
num = 2;
}
else if (this.resolution == DepthOfFieldDeprecated.DofResolution.Low)
{
num = 2;
}
return num;
}
// Token: 0x06000128 RID: 296 RVA: 0x0000D11C File Offset: 0x0000B51C
private int GetLowResolutionDividerBasedOnQuality(int baseDivider)
{
int num = baseDivider;
if (this.resolution == DepthOfFieldDeprecated.DofResolution.High)
{
num *= 2;
}
if (this.resolution == DepthOfFieldDeprecated.DofResolution.Low)
{
num *= 2;
}
return num;
}
// Token: 0x06000129 RID: 297 RVA: 0x0000D14C File Offset: 0x0000B54C
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.smoothness < 0.1f)
{
this.smoothness = 0.1f;
}
this.bokeh = this.bokeh && this.bokehSupport;
float num = ((!this.bokeh) ? 1f : DepthOfFieldDeprecated.BOKEH_EXTRA_BLUR);
bool flag = this.quality > DepthOfFieldDeprecated.Dof34QualitySetting.OnlyBackground;
float num2 = this.focalSize / (this._camera.farClipPlane - this._camera.nearClipPlane);
if (this.simpleTweakMode)
{
this.focalDistance01 = ((!this.objectFocus) ? this.FocalDistance01(this.focalPoint) : (this._camera.WorldToViewportPoint(this.objectFocus.position).z / this._camera.farClipPlane));
this.focalStartCurve = this.focalDistance01 * this.smoothness;
this.focalEndCurve = this.focalStartCurve;
flag = flag && this.focalPoint > this._camera.nearClipPlane + Mathf.Epsilon;
}
else
{
if (this.objectFocus)
{
Vector3 vector = this._camera.WorldToViewportPoint(this.objectFocus.position);
vector.z /= this._camera.farClipPlane;
this.focalDistance01 = vector.z;
}
else
{
this.focalDistance01 = this.FocalDistance01(this.focalZDistance);
}
this.focalStartCurve = this.focalZStartCurve;
this.focalEndCurve = this.focalZEndCurve;
flag = flag && this.focalPoint > this._camera.nearClipPlane + Mathf.Epsilon;
}
this.widthOverHeight = 1f * (float)source.width / (1f * (float)source.height);
this.oneOverBaseSize = 0.001953125f;
this.dofMaterial.SetFloat("_ForegroundBlurExtrude", this.foregroundBlurExtrude);
this.dofMaterial.SetVector("_CurveParams", new Vector4((!this.simpleTweakMode) ? this.focalStartCurve : (1f / this.focalStartCurve), (!this.simpleTweakMode) ? this.focalEndCurve : (1f / this.focalEndCurve), num2 * 0.5f, this.focalDistance01));
this.dofMaterial.SetVector("_InvRenderTargetSize", new Vector4(1f / (1f * (float)source.width), 1f / (1f * (float)source.height), 0f, 0f));
int dividerBasedOnQuality = this.GetDividerBasedOnQuality();
int lowResolutionDividerBasedOnQuality = this.GetLowResolutionDividerBasedOnQuality(dividerBasedOnQuality);
this.AllocateTextures(flag, source, dividerBasedOnQuality, lowResolutionDividerBasedOnQuality);
Graphics.Blit(source, source, this.dofMaterial, 3);
this.Downsample(source, this.mediumRezWorkTexture);
this.Blur(this.mediumRezWorkTexture, this.mediumRezWorkTexture, DepthOfFieldDeprecated.DofBlurriness.Low, 4, this.maxBlurSpread);
if (this.bokeh && (DepthOfFieldDeprecated.BokehDestination.Foreground & this.bokehDestination) != (DepthOfFieldDeprecated.BokehDestination)0)
{
this.dofMaterial.SetVector("_Threshhold", new Vector4(this.bokehThresholdContrast, this.bokehThresholdLuminance, 0.95f, 0f));
Graphics.Blit(this.mediumRezWorkTexture, this.bokehSource2, this.dofMaterial, 11);
Graphics.Blit(this.mediumRezWorkTexture, this.lowRezWorkTexture);
this.Blur(this.lowRezWorkTexture, this.lowRezWorkTexture, this.bluriness, 0, this.maxBlurSpread * num);
}
else
{
this.Downsample(this.mediumRezWorkTexture, this.lowRezWorkTexture);
this.Blur(this.lowRezWorkTexture, this.lowRezWorkTexture, this.bluriness, 0, this.maxBlurSpread);
}
this.dofBlurMaterial.SetTexture("_TapLow", this.lowRezWorkTexture);
this.dofBlurMaterial.SetTexture("_TapMedium", this.mediumRezWorkTexture);
Graphics.Blit(null, this.finalDefocus, this.dofBlurMaterial, 3);
if (this.bokeh && (DepthOfFieldDeprecated.BokehDestination.Foreground & this.bokehDestination) != (DepthOfFieldDeprecated.BokehDestination)0)
{
this.AddBokeh(this.bokehSource2, this.bokehSource, this.finalDefocus);
}
this.dofMaterial.SetTexture("_TapLowBackground", this.finalDefocus);
this.dofMaterial.SetTexture("_TapMedium", this.mediumRezWorkTexture);
Graphics.Blit(source, (!flag) ? destination : this.foregroundTexture, this.dofMaterial, (!this.visualize) ? 0 : 2);
if (flag)
{
Graphics.Blit(this.foregroundTexture, source, this.dofMaterial, 5);
this.Downsample(source, this.mediumRezWorkTexture);
this.BlurFg(this.mediumRezWorkTexture, this.mediumRezWorkTexture, DepthOfFieldDeprecated.DofBlurriness.Low, 2, this.maxBlurSpread);
if (this.bokeh && (DepthOfFieldDeprecated.BokehDestination.Foreground & this.bokehDestination) != (DepthOfFieldDeprecated.BokehDestination)0)
{
this.dofMaterial.SetVector("_Threshhold", new Vector4(this.bokehThresholdContrast * 0.5f, this.bokehThresholdLuminance, 0f, 0f));
Graphics.Blit(this.mediumRezWorkTexture, this.bokehSource2, this.dofMaterial, 11);
Graphics.Blit(this.mediumRezWorkTexture, this.lowRezWorkTexture);
this.BlurFg(this.lowRezWorkTexture, this.lowRezWorkTexture, this.bluriness, 1, this.maxBlurSpread * num);
}
else
{
this.BlurFg(this.mediumRezWorkTexture, this.lowRezWorkTexture, this.bluriness, 1, this.maxBlurSpread);
}
Graphics.Blit(this.lowRezWorkTexture, this.finalDefocus);
this.dofMaterial.SetTexture("_TapLowForeground", this.finalDefocus);
Graphics.Blit(source, destination, this.dofMaterial, (!this.visualize) ? 4 : 1);
if (this.bokeh && (DepthOfFieldDeprecated.BokehDestination.Foreground & this.bokehDestination) != (DepthOfFieldDeprecated.BokehDestination)0)
{
this.AddBokeh(this.bokehSource2, this.bokehSource, destination);
}
}
this.ReleaseTextures();
}
// Token: 0x0600012A RID: 298 RVA: 0x0000D768 File Offset: 0x0000BB68
private void Blur(RenderTexture from, RenderTexture to, DepthOfFieldDeprecated.DofBlurriness iterations, int blurPass, float spread)
{
RenderTexture temporary = RenderTexture.GetTemporary(to.width, to.height);
if (iterations > DepthOfFieldDeprecated.DofBlurriness.Low)
{
this.BlurHex(from, to, blurPass, spread, temporary);
if (iterations > DepthOfFieldDeprecated.DofBlurriness.High)
{
this.dofBlurMaterial.SetVector("offsets", new Vector4(0f, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(to, temporary, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, 0f, 0f, 0f));
Graphics.Blit(temporary, to, this.dofBlurMaterial, blurPass);
}
}
else
{
this.dofBlurMaterial.SetVector("offsets", new Vector4(0f, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(from, temporary, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, 0f, 0f, 0f));
Graphics.Blit(temporary, to, this.dofBlurMaterial, blurPass);
}
RenderTexture.ReleaseTemporary(temporary);
}
// Token: 0x0600012B RID: 299 RVA: 0x0000D8AC File Offset: 0x0000BCAC
private void BlurFg(RenderTexture from, RenderTexture to, DepthOfFieldDeprecated.DofBlurriness iterations, int blurPass, float spread)
{
this.dofBlurMaterial.SetTexture("_TapHigh", from);
RenderTexture temporary = RenderTexture.GetTemporary(to.width, to.height);
if (iterations > DepthOfFieldDeprecated.DofBlurriness.Low)
{
this.BlurHex(from, to, blurPass, spread, temporary);
if (iterations > DepthOfFieldDeprecated.DofBlurriness.High)
{
this.dofBlurMaterial.SetVector("offsets", new Vector4(0f, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(to, temporary, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, 0f, 0f, 0f));
Graphics.Blit(temporary, to, this.dofBlurMaterial, blurPass);
}
}
else
{
this.dofBlurMaterial.SetVector("offsets", new Vector4(0f, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(from, temporary, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, 0f, 0f, 0f));
Graphics.Blit(temporary, to, this.dofBlurMaterial, blurPass);
}
RenderTexture.ReleaseTemporary(temporary);
}
// Token: 0x0600012C RID: 300 RVA: 0x0000DA00 File Offset: 0x0000BE00
private void BlurHex(RenderTexture from, RenderTexture to, int blurPass, float spread, RenderTexture tmp)
{
this.dofBlurMaterial.SetVector("offsets", new Vector4(0f, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(from, tmp, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, 0f, 0f, 0f));
Graphics.Blit(tmp, to, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(to, tmp, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, -spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(tmp, to, this.dofBlurMaterial, blurPass);
}
// Token: 0x0600012D RID: 301 RVA: 0x0000DB1C File Offset: 0x0000BF1C
private void Downsample(RenderTexture from, RenderTexture to)
{
this.dofMaterial.SetVector("_InvRenderTargetSize", new Vector4(1f / (1f * (float)to.width), 1f / (1f * (float)to.height), 0f, 0f));
Graphics.Blit(from, to, this.dofMaterial, DepthOfFieldDeprecated.SMOOTH_DOWNSAMPLE_PASS);
}
// Token: 0x0600012E RID: 302 RVA: 0x0000DB80 File Offset: 0x0000BF80
private void AddBokeh(RenderTexture bokehInfo, RenderTexture tempTex, RenderTexture finalTarget)
{
if (this.bokehMaterial)
{
Mesh[] meshes = Quads.GetMeshes(tempTex.width, tempTex.height);
RenderTexture.active = tempTex;
GL.Clear(false, true, new Color(0f, 0f, 0f, 0f));
GL.PushMatrix();
GL.LoadIdentity();
bokehInfo.filterMode = FilterMode.Point;
float num = (float)bokehInfo.width * 1f / ((float)bokehInfo.height * 1f);
float num2 = 2f / (1f * (float)bokehInfo.width);
num2 += this.bokehScale * this.maxBlurSpread * DepthOfFieldDeprecated.BOKEH_EXTRA_BLUR * this.oneOverBaseSize;
this.bokehMaterial.SetTexture("_Source", bokehInfo);
this.bokehMaterial.SetTexture("_MainTex", this.bokehTexture);
this.bokehMaterial.SetVector("_ArScale", new Vector4(num2, num2 * num, 0.5f, 0.5f * num));
this.bokehMaterial.SetFloat("_Intensity", this.bokehIntensity);
this.bokehMaterial.SetPass(0);
foreach (Mesh mesh in meshes)
{
if (mesh)
{
Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
}
}
GL.PopMatrix();
Graphics.Blit(tempTex, finalTarget, this.dofMaterial, 8);
bokehInfo.filterMode = FilterMode.Bilinear;
}
}
// Token: 0x0600012F RID: 303 RVA: 0x0000DCF4 File Offset: 0x0000C0F4
private void ReleaseTextures()
{
if (this.foregroundTexture)
{
RenderTexture.ReleaseTemporary(this.foregroundTexture);
}
if (this.finalDefocus)
{
RenderTexture.ReleaseTemporary(this.finalDefocus);
}
if (this.mediumRezWorkTexture)
{
RenderTexture.ReleaseTemporary(this.mediumRezWorkTexture);
}
if (this.lowRezWorkTexture)
{
RenderTexture.ReleaseTemporary(this.lowRezWorkTexture);
}
if (this.bokehSource)
{
RenderTexture.ReleaseTemporary(this.bokehSource);
}
if (this.bokehSource2)
{
RenderTexture.ReleaseTemporary(this.bokehSource2);
}
}
// Token: 0x06000130 RID: 304 RVA: 0x0000DDA4 File Offset: 0x0000C1A4
private void AllocateTextures(bool blurForeground, RenderTexture source, int divider, int lowTexDivider)
{
this.foregroundTexture = null;
if (blurForeground)
{
this.foregroundTexture = RenderTexture.GetTemporary(source.width, source.height, 0);
}
this.mediumRezWorkTexture = RenderTexture.GetTemporary(source.width / divider, source.height / divider, 0);
this.finalDefocus = RenderTexture.GetTemporary(source.width / divider, source.height / divider, 0);
this.lowRezWorkTexture = RenderTexture.GetTemporary(source.width / lowTexDivider, source.height / lowTexDivider, 0);
this.bokehSource = null;
this.bokehSource2 = null;
if (this.bokeh)
{
this.bokehSource = RenderTexture.GetTemporary(source.width / (lowTexDivider * this.bokehDownsample), source.height / (lowTexDivider * this.bokehDownsample), 0, RenderTextureFormat.ARGBHalf);
this.bokehSource2 = RenderTexture.GetTemporary(source.width / (lowTexDivider * this.bokehDownsample), source.height / (lowTexDivider * this.bokehDownsample), 0, RenderTextureFormat.ARGBHalf);
this.bokehSource.filterMode = FilterMode.Bilinear;
this.bokehSource2.filterMode = FilterMode.Bilinear;
RenderTexture.active = this.bokehSource2;
GL.Clear(false, true, new Color(0f, 0f, 0f, 0f));
}
source.filterMode = FilterMode.Bilinear;
this.finalDefocus.filterMode = FilterMode.Bilinear;
this.mediumRezWorkTexture.filterMode = FilterMode.Bilinear;
this.lowRezWorkTexture.filterMode = FilterMode.Bilinear;
if (this.foregroundTexture)
{
this.foregroundTexture.filterMode = FilterMode.Bilinear;
}
}
// Token: 0x04000276 RID: 630
private static int SMOOTH_DOWNSAMPLE_PASS = 6;
// Token: 0x04000277 RID: 631
private static float BOKEH_EXTRA_BLUR = 2f;
// Token: 0x04000278 RID: 632
public DepthOfFieldDeprecated.Dof34QualitySetting quality = DepthOfFieldDeprecated.Dof34QualitySetting.OnlyBackground;
// Token: 0x04000279 RID: 633
public DepthOfFieldDeprecated.DofResolution resolution = DepthOfFieldDeprecated.DofResolution.Low;
// Token: 0x0400027A RID: 634
public bool simpleTweakMode = true;
// Token: 0x0400027B RID: 635
public float focalPoint = 1f;
// Token: 0x0400027C RID: 636
public float smoothness = 0.5f;
// Token: 0x0400027D RID: 637
public float focalZDistance;
// Token: 0x0400027E RID: 638
public float focalZStartCurve = 1f;
// Token: 0x0400027F RID: 639
public float focalZEndCurve = 1f;
// Token: 0x04000280 RID: 640
private float focalStartCurve = 2f;
// Token: 0x04000281 RID: 641
private float focalEndCurve = 2f;
// Token: 0x04000282 RID: 642
private float focalDistance01 = 0.1f;
// Token: 0x04000283 RID: 643
public Transform objectFocus;
// Token: 0x04000284 RID: 644
public float focalSize;
// Token: 0x04000285 RID: 645
public DepthOfFieldDeprecated.DofBlurriness bluriness = DepthOfFieldDeprecated.DofBlurriness.High;
// Token: 0x04000286 RID: 646
public float maxBlurSpread = 1.75f;
// Token: 0x04000287 RID: 647
public float foregroundBlurExtrude = 1.15f;
// Token: 0x04000288 RID: 648
public Shader dofBlurShader;
// Token: 0x04000289 RID: 649
private Material dofBlurMaterial;
// Token: 0x0400028A RID: 650
public Shader dofShader;
// Token: 0x0400028B RID: 651
private Material dofMaterial;
// Token: 0x0400028C RID: 652
public bool visualize;
// Token: 0x0400028D RID: 653
public DepthOfFieldDeprecated.BokehDestination bokehDestination = DepthOfFieldDeprecated.BokehDestination.Background;
// Token: 0x0400028E RID: 654
private float widthOverHeight = 1.25f;
// Token: 0x0400028F RID: 655
private float oneOverBaseSize = 0.001953125f;
// Token: 0x04000290 RID: 656
public bool bokeh;
// Token: 0x04000291 RID: 657
public bool bokehSupport = true;
// Token: 0x04000292 RID: 658
public Shader bokehShader;
// Token: 0x04000293 RID: 659
public Texture2D bokehTexture;
// Token: 0x04000294 RID: 660
public float bokehScale = 2.4f;
// Token: 0x04000295 RID: 661
public float bokehIntensity = 0.15f;
// Token: 0x04000296 RID: 662
public float bokehThresholdContrast = 0.1f;
// Token: 0x04000297 RID: 663
public float bokehThresholdLuminance = 0.55f;
// Token: 0x04000298 RID: 664
public int bokehDownsample = 1;
// Token: 0x04000299 RID: 665
private Material bokehMaterial;
// Token: 0x0400029A RID: 666
private Camera _camera;
// Token: 0x0400029B RID: 667
private RenderTexture foregroundTexture;
// Token: 0x0400029C RID: 668
private RenderTexture mediumRezWorkTexture;
// Token: 0x0400029D RID: 669
private RenderTexture finalDefocus;
// Token: 0x0400029E RID: 670
private RenderTexture lowRezWorkTexture;
// Token: 0x0400029F RID: 671
private RenderTexture bokehSource;
// Token: 0x040002A0 RID: 672
private RenderTexture bokehSource2;
// Token: 0x0200006A RID: 106
public enum Dof34QualitySetting
{
// Token: 0x040002A2 RID: 674
OnlyBackground = 1,
// Token: 0x040002A3 RID: 675
BackgroundAndForeground
}
// Token: 0x0200006B RID: 107
public enum DofResolution
{
// Token: 0x040002A5 RID: 677
High = 2,
// Token: 0x040002A6 RID: 678
Medium,
// Token: 0x040002A7 RID: 679
Low
}
// Token: 0x0200006C RID: 108
public enum DofBlurriness
{
// Token: 0x040002A9 RID: 681
Low = 1,
// Token: 0x040002AA RID: 682
High,
// Token: 0x040002AB RID: 683
VeryHigh = 4
}
// Token: 0x0200006D RID: 109
public enum BokehDestination
{
// Token: 0x040002AD RID: 685
Background = 1,
// Token: 0x040002AE RID: 686
Foreground,
// Token: 0x040002AF RID: 687
BackgroundAndForeground
}
}
}
@@ -0,0 +1,121 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200006E RID: 110
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Edge Detection/Edge Detection")]
public class EdgeDetection : PostEffectsBase
{
// Token: 0x06000133 RID: 307 RVA: 0x0000DFA0 File Offset: 0x0000C3A0
public override bool CheckResources()
{
base.CheckSupport(true);
this.edgeDetectMaterial = base.CheckShaderAndCreateMaterial(this.edgeDetectShader, this.edgeDetectMaterial);
if (this.mode != this.oldMode)
{
this.SetCameraFlag();
}
this.oldMode = this.mode;
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000134 RID: 308 RVA: 0x0000E007 File Offset: 0x0000C407
private new void Start()
{
this.oldMode = this.mode;
}
// Token: 0x06000135 RID: 309 RVA: 0x0000E018 File Offset: 0x0000C418
private void SetCameraFlag()
{
if (this.mode == EdgeDetection.EdgeDetectMode.SobelDepth || this.mode == EdgeDetection.EdgeDetectMode.SobelDepthThin)
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
}
else if (this.mode == EdgeDetection.EdgeDetectMode.TriangleDepthNormals || this.mode == EdgeDetection.EdgeDetectMode.RobertsCrossDepthNormals)
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.DepthNormals;
}
}
// Token: 0x06000136 RID: 310 RVA: 0x0000E07F File Offset: 0x0000C47F
private void OnEnable()
{
this.SetCameraFlag();
}
// Token: 0x06000137 RID: 311 RVA: 0x0000E088 File Offset: 0x0000C488
[ImageEffectOpaque]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
Vector2 vector = new Vector2(this.sensitivityDepth, this.sensitivityNormals);
this.edgeDetectMaterial.SetVector("_Sensitivity", new Vector4(vector.x, vector.y, 1f, vector.y));
this.edgeDetectMaterial.SetFloat("_BgFade", this.edgesOnly);
this.edgeDetectMaterial.SetFloat("_SampleDistance", this.sampleDist);
this.edgeDetectMaterial.SetVector("_BgColor", this.edgesOnlyBgColor);
this.edgeDetectMaterial.SetFloat("_Exponent", this.edgeExp);
this.edgeDetectMaterial.SetFloat("_Threshold", this.lumThreshold);
Graphics.Blit(source, destination, this.edgeDetectMaterial, (int)this.mode);
}
// Token: 0x040002B0 RID: 688
public EdgeDetection.EdgeDetectMode mode = EdgeDetection.EdgeDetectMode.SobelDepthThin;
// Token: 0x040002B1 RID: 689
public float sensitivityDepth = 1f;
// Token: 0x040002B2 RID: 690
public float sensitivityNormals = 1f;
// Token: 0x040002B3 RID: 691
public float lumThreshold = 0.2f;
// Token: 0x040002B4 RID: 692
public float edgeExp = 1f;
// Token: 0x040002B5 RID: 693
public float sampleDist = 1f;
// Token: 0x040002B6 RID: 694
public float edgesOnly;
// Token: 0x040002B7 RID: 695
public Color edgesOnlyBgColor = Color.white;
// Token: 0x040002B8 RID: 696
public Shader edgeDetectShader;
// Token: 0x040002B9 RID: 697
private Material edgeDetectMaterial;
// Token: 0x040002BA RID: 698
private EdgeDetection.EdgeDetectMode oldMode = EdgeDetection.EdgeDetectMode.SobelDepthThin;
// Token: 0x0200006F RID: 111
public enum EdgeDetectMode
{
// Token: 0x040002BC RID: 700
TriangleDepthNormals,
// Token: 0x040002BD RID: 701
RobertsCrossDepthNormals,
// Token: 0x040002BE RID: 702
SobelDepth,
// Token: 0x040002BF RID: 703
SobelDepthThin,
// Token: 0x040002C0 RID: 704
TriangleLuminance
}
}
}
@@ -0,0 +1,52 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000070 RID: 112
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Displacement/Fisheye")]
public class Fisheye : PostEffectsBase
{
// Token: 0x06000139 RID: 313 RVA: 0x0000E18E File Offset: 0x0000C58E
public override bool CheckResources()
{
base.CheckSupport(false);
this.fisheyeMaterial = base.CheckShaderAndCreateMaterial(this.fishEyeShader, this.fisheyeMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600013A RID: 314 RVA: 0x0000E1C8 File Offset: 0x0000C5C8
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
float num = 0.15625f;
float num2 = (float)source.width * 1f / ((float)source.height * 1f);
this.fisheyeMaterial.SetVector("intensity", new Vector4(this.strengthX * num2 * num, this.strengthY * num, this.strengthX * num2 * num, this.strengthY * num));
Graphics.Blit(source, destination, this.fisheyeMaterial);
}
// Token: 0x040002C1 RID: 705
[Range(0f, 1.5f)]
public float strengthX = 0.05f;
// Token: 0x040002C2 RID: 706
[Range(0f, 1.5f)]
public float strengthY = 0.05f;
// Token: 0x040002C3 RID: 707
public Shader fishEyeShader;
// Token: 0x040002C4 RID: 708
private Material fisheyeMaterial;
}
}
@@ -0,0 +1,153 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000071 RID: 113
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Rendering/Global Fog")]
internal class GlobalFog : PostEffectsBase
{
// Token: 0x0600013C RID: 316 RVA: 0x0000E283 File Offset: 0x0000C683
public override bool CheckResources()
{
base.CheckSupport(true);
this.fogMaterial = base.CheckShaderAndCreateMaterial(this.fogShader, this.fogMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600013D RID: 317 RVA: 0x0000E2BC File Offset: 0x0000C6BC
[ImageEffectOpaque]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources() || (!this.distanceFog && !this.heightFog))
{
Graphics.Blit(source, destination);
return;
}
Camera component = base.GetComponent<Camera>();
Transform transform = component.transform;
float nearClipPlane = component.nearClipPlane;
float farClipPlane = component.farClipPlane;
float fieldOfView = component.fieldOfView;
float aspect = component.aspect;
Matrix4x4 identity = Matrix4x4.identity;
float num = fieldOfView * 0.5f;
Vector3 vector = transform.right * nearClipPlane * Mathf.Tan(num * 0.017453292f) * aspect;
Vector3 vector2 = transform.up * nearClipPlane * Mathf.Tan(num * 0.017453292f);
Vector3 vector3 = transform.forward * nearClipPlane - vector + vector2;
float num2 = vector3.magnitude * farClipPlane / nearClipPlane;
vector3.Normalize();
vector3 *= num2;
Vector3 vector4 = transform.forward * nearClipPlane + vector + vector2;
vector4.Normalize();
vector4 *= num2;
Vector3 vector5 = transform.forward * nearClipPlane + vector - vector2;
vector5.Normalize();
vector5 *= num2;
Vector3 vector6 = transform.forward * nearClipPlane - vector - vector2;
vector6.Normalize();
vector6 *= num2;
identity.SetRow(0, vector3);
identity.SetRow(1, vector4);
identity.SetRow(2, vector5);
identity.SetRow(3, vector6);
Vector3 position = transform.position;
float num3 = position.y - this.height;
float num4 = ((num3 > 0f) ? 0f : 1f);
float num5 = ((!this.excludeFarPixels) ? 2f : 1f);
this.fogMaterial.SetMatrix("_FrustumCornersWS", identity);
this.fogMaterial.SetVector("_CameraWS", position);
this.fogMaterial.SetVector("_HeightParams", new Vector4(this.height, num3, num4, this.heightDensity * 0.5f));
this.fogMaterial.SetVector("_DistanceParams", new Vector4(-Mathf.Max(this.startDistance, 0f), num5, 0f, 0f));
FogMode fogMode = RenderSettings.fogMode;
float fogDensity = RenderSettings.fogDensity;
float fogStartDistance = RenderSettings.fogStartDistance;
float fogEndDistance = RenderSettings.fogEndDistance;
bool flag = fogMode == FogMode.Linear;
float num6 = ((!flag) ? 0f : (fogEndDistance - fogStartDistance));
float num7 = ((Mathf.Abs(num6) <= 0.0001f) ? 0f : (1f / num6));
Vector4 vector7;
vector7.x = fogDensity * 1.2011224f;
vector7.y = fogDensity * 1.442695f;
vector7.z = ((!flag) ? 0f : (-num7));
vector7.w = ((!flag) ? 0f : (fogEndDistance * num7));
this.fogMaterial.SetVector("_SceneFogParams", vector7);
this.fogMaterial.SetVector("_SceneFogMode", new Vector4((float)fogMode, (float)((!this.useRadialDistance) ? 0 : 1), 0f, 0f));
int num8;
if (this.distanceFog && this.heightFog)
{
num8 = 0;
}
else if (this.distanceFog)
{
num8 = 1;
}
else
{
num8 = 2;
}
GlobalFog.CustomGraphicsBlit(source, destination, this.fogMaterial, num8);
}
// Token: 0x0600013E RID: 318 RVA: 0x0000E694 File Offset: 0x0000CA94
private static void CustomGraphicsBlit(RenderTexture source, RenderTexture dest, Material fxMaterial, int passNr)
{
RenderTexture.active = dest;
fxMaterial.SetTexture("_MainTex", source);
GL.PushMatrix();
GL.LoadOrtho();
fxMaterial.SetPass(passNr);
GL.Begin(7);
GL.MultiTexCoord2(0, 0f, 0f);
GL.Vertex3(0f, 0f, 3f);
GL.MultiTexCoord2(0, 1f, 0f);
GL.Vertex3(1f, 0f, 2f);
GL.MultiTexCoord2(0, 1f, 1f);
GL.Vertex3(1f, 1f, 1f);
GL.MultiTexCoord2(0, 0f, 1f);
GL.Vertex3(0f, 1f, 0f);
GL.End();
GL.PopMatrix();
}
// Token: 0x040002C5 RID: 709
[Tooltip("Apply distance-based fog?")]
public bool distanceFog = true;
// Token: 0x040002C6 RID: 710
[Tooltip("Exclude far plane pixels from distance-based fog? (Skybox or clear color)")]
public bool excludeFarPixels = true;
// Token: 0x040002C7 RID: 711
[Tooltip("Distance fog is based on radial distance from camera when checked")]
public bool useRadialDistance;
// Token: 0x040002C8 RID: 712
[Tooltip("Apply height-based fog?")]
public bool heightFog = true;
// Token: 0x040002C9 RID: 713
[Tooltip("Fog top Y coordinate")]
public float height = 1f;
// Token: 0x040002CA RID: 714
[Range(0.001f, 10f)]
public float heightDensity = 2f;
// Token: 0x040002CB RID: 715
[Tooltip("Push fog away from the camera by this amount")]
public float startDistance;
// Token: 0x040002CC RID: 716
public Shader fogShader;
// Token: 0x040002CD RID: 717
private Material fogMaterial;
}
}
@@ -0,0 +1,26 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000072 RID: 114
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Grayscale")]
public class Grayscale : ImageEffectBase
{
// Token: 0x06000140 RID: 320 RVA: 0x0000E76D File Offset: 0x0000CB6D
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
base.material.SetTexture("_RampTex", this.textureRamp);
base.material.SetFloat("_RampOffset", this.rampOffset);
Graphics.Blit(source, destination, base.material);
}
// Token: 0x040002CE RID: 718
public Texture textureRamp;
// Token: 0x040002CF RID: 719
[Range(-1f, 1f)]
public float rampOffset;
}
}
@@ -0,0 +1,15 @@
using System;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000054 RID: 84
public enum HDRBloomMode
{
// Token: 0x040001B0 RID: 432
Auto,
// Token: 0x040001B1 RID: 433
On,
// Token: 0x040001B2 RID: 434
Off
}
}
@@ -0,0 +1,55 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000073 RID: 115
[RequireComponent(typeof(Camera))]
[AddComponentMenu("")]
public class ImageEffectBase : MonoBehaviour
{
// Token: 0x06000142 RID: 322 RVA: 0x0000B681 File Offset: 0x00009A81
protected virtual void Start()
{
if (!SystemInfo.supportsImageEffects)
{
base.enabled = false;
return;
}
if (!this.shader || !this.shader.isSupported)
{
base.enabled = false;
}
}
// Token: 0x17000057 RID: 87
// (get) Token: 0x06000143 RID: 323 RVA: 0x0000B6BC File Offset: 0x00009ABC
protected Material material
{
get
{
if (this.m_Material == null)
{
this.m_Material = new Material(this.shader);
this.m_Material.hideFlags = HideFlags.HideAndDontSave;
}
return this.m_Material;
}
}
// Token: 0x06000144 RID: 324 RVA: 0x0000B6F3 File Offset: 0x00009AF3
protected virtual void OnDisable()
{
if (this.m_Material)
{
global::UnityEngine.Object.DestroyImmediate(this.m_Material);
}
}
// Token: 0x040002D0 RID: 720
public Shader shader;
// Token: 0x040002D1 RID: 721
private Material m_Material;
}
}
@@ -0,0 +1,40 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000074 RID: 116
[AddComponentMenu("")]
public class ImageEffects
{
// Token: 0x06000146 RID: 326 RVA: 0x0000E7B0 File Offset: 0x0000CBB0
public static void RenderDistortion(Material material, RenderTexture source, RenderTexture destination, float angle, Vector2 center, Vector2 radius)
{
bool flag = source.texelSize.y < 0f;
if (flag)
{
center.y = 1f - center.y;
angle = -angle;
}
Matrix4x4 matrix4x = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0f, 0f, angle), Vector3.one);
material.SetMatrix("_RotationMatrix", matrix4x);
material.SetVector("_CenterRadius", new Vector4(center.x, center.y, radius.x, radius.y));
material.SetFloat("_Angle", angle * 0.017453292f);
Graphics.Blit(source, destination, material);
}
// Token: 0x06000147 RID: 327 RVA: 0x0000E863 File Offset: 0x0000CC63
[Obsolete("Use Graphics.Blit(source,dest) instead")]
public static void Blit(RenderTexture source, RenderTexture dest)
{
Graphics.Blit(source, dest);
}
// Token: 0x06000148 RID: 328 RVA: 0x0000E86C File Offset: 0x0000CC6C
[Obsolete("Use Graphics.Blit(source, destination, material) instead")]
public static void BlitWithMaterial(Material material, RenderTexture source, RenderTexture dest)
{
Graphics.Blit(source, dest, material);
}
}
}
@@ -0,0 +1,15 @@
using System;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000052 RID: 82
public enum LensflareStyle34
{
// Token: 0x040001A9 RID: 425
Ghosting,
// Token: 0x040001AA RID: 426
Anamorphic,
// Token: 0x040001AB RID: 427
Combined
}
}
@@ -0,0 +1,55 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000075 RID: 117
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Blur/Motion Blur (Color Accumulation)")]
[RequireComponent(typeof(Camera))]
public class MotionBlur : ImageEffectBase
{
// Token: 0x0600014A RID: 330 RVA: 0x0000E889 File Offset: 0x0000CC89
protected override void OnDisable()
{
base.OnDisable();
global::UnityEngine.Object.DestroyImmediate(this.accumTexture);
}
// Token: 0x0600014B RID: 331 RVA: 0x0000E89C File Offset: 0x0000CC9C
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (this.accumTexture == null || this.accumTexture.width != source.width || this.accumTexture.height != source.height)
{
global::UnityEngine.Object.DestroyImmediate(this.accumTexture);
this.accumTexture = new RenderTexture(source.width, source.height, 0);
this.accumTexture.hideFlags = HideFlags.HideAndDontSave;
Graphics.Blit(source, this.accumTexture);
}
if (this.extraBlur)
{
RenderTexture temporary = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0);
this.accumTexture.MarkRestoreExpected();
Graphics.Blit(this.accumTexture, temporary);
Graphics.Blit(temporary, this.accumTexture);
RenderTexture.ReleaseTemporary(temporary);
}
this.blurAmount = Mathf.Clamp(this.blurAmount, 0f, 0.92f);
base.material.SetTexture("_MainTex", this.accumTexture);
base.material.SetFloat("_AccumOrig", 1f - this.blurAmount);
this.accumTexture.MarkRestoreExpected();
Graphics.Blit(source, this.accumTexture, base.material);
Graphics.Blit(this.accumTexture, destination);
}
// Token: 0x040002D2 RID: 722
[Range(0f, 0.92f)]
public float blurAmount = 0.8f;
// Token: 0x040002D3 RID: 723
public bool extraBlur;
// Token: 0x040002D4 RID: 724
private RenderTexture accumTexture;
}
}
@@ -0,0 +1,239 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000076 RID: 118
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Noise/Noise And Grain (Filmic)")]
public class NoiseAndGrain : PostEffectsBase
{
// Token: 0x0600014D RID: 333 RVA: 0x0000EA74 File Offset: 0x0000CE74
private void Awake()
{
this.mesh = new Mesh();
}
// Token: 0x0600014E RID: 334 RVA: 0x0000EA84 File Offset: 0x0000CE84
public override bool CheckResources()
{
base.CheckSupport(false);
this.noiseMaterial = base.CheckShaderAndCreateMaterial(this.noiseShader, this.noiseMaterial);
if (this.dx11Grain && this.supportDX11)
{
this.dx11NoiseMaterial = base.CheckShaderAndCreateMaterial(this.dx11NoiseShader, this.dx11NoiseMaterial);
}
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600014F RID: 335 RVA: 0x0000EAF8 File Offset: 0x0000CEF8
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources() || null == this.noiseTexture)
{
Graphics.Blit(source, destination);
if (null == this.noiseTexture)
{
Debug.LogWarning("Noise & Grain effect failing as noise texture is not assigned. please assign.", base.transform);
}
return;
}
this.softness = Mathf.Clamp(this.softness, 0f, 0.99f);
if (this.dx11Grain && this.supportDX11)
{
this.dx11NoiseMaterial.SetFloat("_DX11NoiseTime", (float)Time.frameCount);
this.dx11NoiseMaterial.SetTexture("_NoiseTex", this.noiseTexture);
this.dx11NoiseMaterial.SetVector("_NoisePerChannel", (!this.monochrome) ? this.intensities : Vector3.one);
this.dx11NoiseMaterial.SetVector("_MidGrey", new Vector3(this.midGrey, 1f / (1f - this.midGrey), -1f / this.midGrey));
this.dx11NoiseMaterial.SetVector("_NoiseAmount", new Vector3(this.generalIntensity, this.blackIntensity, this.whiteIntensity) * this.intensityMultiplier);
if (this.softness > Mathf.Epsilon)
{
RenderTexture temporary = RenderTexture.GetTemporary((int)((float)source.width * (1f - this.softness)), (int)((float)source.height * (1f - this.softness)));
NoiseAndGrain.DrawNoiseQuadGrid(source, temporary, this.dx11NoiseMaterial, this.noiseTexture, this.mesh, (!this.monochrome) ? 2 : 3);
this.dx11NoiseMaterial.SetTexture("_NoiseTex", temporary);
Graphics.Blit(source, destination, this.dx11NoiseMaterial, 4);
RenderTexture.ReleaseTemporary(temporary);
}
else
{
NoiseAndGrain.DrawNoiseQuadGrid(source, destination, this.dx11NoiseMaterial, this.noiseTexture, this.mesh, (!this.monochrome) ? 0 : 1);
}
}
else
{
if (this.noiseTexture)
{
this.noiseTexture.wrapMode = TextureWrapMode.Repeat;
this.noiseTexture.filterMode = this.filterMode;
}
this.noiseMaterial.SetTexture("_NoiseTex", this.noiseTexture);
this.noiseMaterial.SetVector("_NoisePerChannel", (!this.monochrome) ? this.intensities : Vector3.one);
this.noiseMaterial.SetVector("_NoiseTilingPerChannel", (!this.monochrome) ? this.tiling : (Vector3.one * this.monochromeTiling));
this.noiseMaterial.SetVector("_MidGrey", new Vector3(this.midGrey, 1f / (1f - this.midGrey), -1f / this.midGrey));
this.noiseMaterial.SetVector("_NoiseAmount", new Vector3(this.generalIntensity, this.blackIntensity, this.whiteIntensity) * this.intensityMultiplier);
if (this.softness > Mathf.Epsilon)
{
RenderTexture temporary2 = RenderTexture.GetTemporary((int)((float)source.width * (1f - this.softness)), (int)((float)source.height * (1f - this.softness)));
NoiseAndGrain.DrawNoiseQuadGrid(source, temporary2, this.noiseMaterial, this.noiseTexture, this.mesh, 2);
this.noiseMaterial.SetTexture("_NoiseTex", temporary2);
Graphics.Blit(source, destination, this.noiseMaterial, 1);
RenderTexture.ReleaseTemporary(temporary2);
}
else
{
NoiseAndGrain.DrawNoiseQuadGrid(source, destination, this.noiseMaterial, this.noiseTexture, this.mesh, 0);
}
}
}
// Token: 0x06000150 RID: 336 RVA: 0x0000EED4 File Offset: 0x0000D2D4
private static void DrawNoiseQuadGrid(RenderTexture source, RenderTexture dest, Material fxMaterial, Texture2D noise, Mesh mesh, int passNr)
{
RenderTexture.active = dest;
fxMaterial.SetTexture("_MainTex", source);
GL.PushMatrix();
GL.LoadOrtho();
fxMaterial.SetPass(passNr);
NoiseAndGrain.BuildMesh(mesh, source, noise);
Transform transform = Camera.main.transform;
Vector3 position = transform.position;
Quaternion rotation = transform.rotation;
transform.position = Vector3.zero;
transform.rotation = Quaternion.identity;
Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
transform.position = position;
transform.rotation = rotation;
GL.PopMatrix();
}
// Token: 0x06000151 RID: 337 RVA: 0x0000EF60 File Offset: 0x0000D360
private static void BuildMesh(Mesh mesh, RenderTexture source, Texture2D noise)
{
float num = (float)noise.width * 1f;
float num2 = 1f * (float)source.width / NoiseAndGrain.TILE_AMOUNT;
float num3 = 1f * (float)source.width / (1f * (float)source.height);
float num4 = 1f / num2;
float num5 = num4 * num3;
int num6 = (int)Mathf.Ceil(num2);
int num7 = (int)Mathf.Ceil(1f / num5);
if (mesh.vertices.Length != num6 * num7 * 4)
{
Vector3[] array = new Vector3[num6 * num7 * 4];
Vector2[] array2 = new Vector2[num6 * num7 * 4];
int[] array3 = new int[num6 * num7 * 6];
int num8 = 0;
int num9 = 0;
for (float num10 = 0f; num10 < 1f; num10 += num4)
{
for (float num11 = 0f; num11 < 1f; num11 += num5)
{
array[num8] = new Vector3(num10, num11, 0.1f);
array[num8 + 1] = new Vector3(num10 + num4, num11, 0.1f);
array[num8 + 2] = new Vector3(num10 + num4, num11 + num5, 0.1f);
array[num8 + 3] = new Vector3(num10, num11 + num5, 0.1f);
array2[num8] = new Vector2(0f, 0f);
array2[num8 + 1] = new Vector2(1f, 0f);
array2[num8 + 2] = new Vector2(1f, 1f);
array2[num8 + 3] = new Vector2(0f, 1f);
array3[num9] = num8;
array3[num9 + 1] = num8 + 1;
array3[num9 + 2] = num8 + 2;
array3[num9 + 3] = num8;
array3[num9 + 4] = num8 + 2;
array3[num9 + 5] = num8 + 3;
num8 += 4;
num9 += 6;
}
}
mesh.vertices = array;
mesh.uv2 = array2;
mesh.triangles = array3;
}
NoiseAndGrain.BuildMeshUV0(mesh, num6, num7, num, noise.width);
}
// Token: 0x06000152 RID: 338 RVA: 0x0000F1C0 File Offset: 0x0000D5C0
private static void BuildMeshUV0(Mesh mesh, int width, int height, float noiseSize, int noiseWidth)
{
float num = noiseSize / ((float)noiseWidth * 1f);
float num2 = 1f / noiseSize;
Vector2[] array = new Vector2[width * height * 4];
int num3 = 0;
for (int i = 0; i < width * height; i++)
{
float num4 = global::UnityEngine.Random.Range(0f, noiseSize);
float num5 = global::UnityEngine.Random.Range(0f, noiseSize);
num4 = Mathf.Floor(num4) * num2;
num5 = Mathf.Floor(num5) * num2;
array[num3] = new Vector2(num4, num5);
array[num3 + 1] = new Vector2(num4 + num * num2, num5);
array[num3 + 2] = new Vector2(num4 + num * num2, num5 + num * num2);
array[num3 + 3] = new Vector2(num4, num5 + num * num2);
num3 += 4;
}
mesh.uv = array;
}
// Token: 0x040002D5 RID: 725
public float intensityMultiplier = 0.25f;
// Token: 0x040002D6 RID: 726
public float generalIntensity = 0.5f;
// Token: 0x040002D7 RID: 727
public float blackIntensity = 1f;
// Token: 0x040002D8 RID: 728
public float whiteIntensity = 1f;
// Token: 0x040002D9 RID: 729
public float midGrey = 0.2f;
// Token: 0x040002DA RID: 730
public bool dx11Grain;
// Token: 0x040002DB RID: 731
public float softness;
// Token: 0x040002DC RID: 732
public bool monochrome;
// Token: 0x040002DD RID: 733
public Vector3 intensities = new Vector3(1f, 1f, 1f);
// Token: 0x040002DE RID: 734
public Vector3 tiling = new Vector3(64f, 64f, 64f);
// Token: 0x040002DF RID: 735
public float monochromeTiling = 64f;
// Token: 0x040002E0 RID: 736
public FilterMode filterMode = FilterMode.Bilinear;
// Token: 0x040002E1 RID: 737
public Texture2D noiseTexture;
// Token: 0x040002E2 RID: 738
public Shader noiseShader;
// Token: 0x040002E3 RID: 739
private Material noiseMaterial;
// Token: 0x040002E4 RID: 740
public Shader dx11NoiseShader;
// Token: 0x040002E5 RID: 741
private Material dx11NoiseMaterial;
// Token: 0x040002E6 RID: 742
private static float TILE_AMOUNT = 64f;
// Token: 0x040002E7 RID: 743
private Mesh mesh;
}
}
@@ -0,0 +1,162 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000077 RID: 119
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Noise/Noise and Scratches")]
public class NoiseAndScratches : MonoBehaviour
{
// Token: 0x06000155 RID: 341 RVA: 0x0000F320 File Offset: 0x0000D720
protected void Start()
{
if (!SystemInfo.supportsImageEffects)
{
base.enabled = false;
return;
}
if (this.shaderRGB == null || this.shaderYUV == null)
{
Debug.Log("Noise shaders are not set up! Disabling noise effect.");
base.enabled = false;
}
else if (!this.shaderRGB.isSupported)
{
base.enabled = false;
}
else if (!this.shaderYUV.isSupported)
{
this.rgbFallback = true;
}
}
// Token: 0x17000058 RID: 88
// (get) Token: 0x06000156 RID: 342 RVA: 0x0000F3AC File Offset: 0x0000D7AC
protected Material material
{
get
{
if (this.m_MaterialRGB == null)
{
this.m_MaterialRGB = new Material(this.shaderRGB);
this.m_MaterialRGB.hideFlags = HideFlags.HideAndDontSave;
}
if (this.m_MaterialYUV == null && !this.rgbFallback)
{
this.m_MaterialYUV = new Material(this.shaderYUV);
this.m_MaterialYUV.hideFlags = HideFlags.HideAndDontSave;
}
return (this.rgbFallback || this.monochrome) ? this.m_MaterialRGB : this.m_MaterialYUV;
}
}
// Token: 0x06000157 RID: 343 RVA: 0x0000F449 File Offset: 0x0000D849
protected void OnDisable()
{
if (this.m_MaterialRGB)
{
global::UnityEngine.Object.DestroyImmediate(this.m_MaterialRGB);
}
if (this.m_MaterialYUV)
{
global::UnityEngine.Object.DestroyImmediate(this.m_MaterialYUV);
}
}
// Token: 0x06000158 RID: 344 RVA: 0x0000F484 File Offset: 0x0000D884
private void SanitizeParameters()
{
this.grainIntensityMin = Mathf.Clamp(this.grainIntensityMin, 0f, 5f);
this.grainIntensityMax = Mathf.Clamp(this.grainIntensityMax, 0f, 5f);
this.scratchIntensityMin = Mathf.Clamp(this.scratchIntensityMin, 0f, 5f);
this.scratchIntensityMax = Mathf.Clamp(this.scratchIntensityMax, 0f, 5f);
this.scratchFPS = Mathf.Clamp(this.scratchFPS, 1f, 30f);
this.scratchJitter = Mathf.Clamp(this.scratchJitter, 0f, 1f);
this.grainSize = Mathf.Clamp(this.grainSize, 0.1f, 50f);
}
// Token: 0x06000159 RID: 345 RVA: 0x0000F550 File Offset: 0x0000D950
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
this.SanitizeParameters();
if (this.scratchTimeLeft <= 0f)
{
this.scratchTimeLeft = global::UnityEngine.Random.value * 2f / this.scratchFPS;
this.scratchX = global::UnityEngine.Random.value;
this.scratchY = global::UnityEngine.Random.value;
}
this.scratchTimeLeft -= Time.deltaTime;
Material material = this.material;
material.SetTexture("_GrainTex", this.grainTexture);
material.SetTexture("_ScratchTex", this.scratchTexture);
float num = 1f / this.grainSize;
material.SetVector("_GrainOffsetScale", new Vector4(global::UnityEngine.Random.value, global::UnityEngine.Random.value, (float)Screen.width / (float)this.grainTexture.width * num, (float)Screen.height / (float)this.grainTexture.height * num));
material.SetVector("_ScratchOffsetScale", new Vector4(this.scratchX + global::UnityEngine.Random.value * this.scratchJitter, this.scratchY + global::UnityEngine.Random.value * this.scratchJitter, (float)Screen.width / (float)this.scratchTexture.width, (float)Screen.height / (float)this.scratchTexture.height));
material.SetVector("_Intensity", new Vector4(global::UnityEngine.Random.Range(this.grainIntensityMin, this.grainIntensityMax), global::UnityEngine.Random.Range(this.scratchIntensityMin, this.scratchIntensityMax), 0f, 0f));
Graphics.Blit(source, destination, material);
}
// Token: 0x040002E8 RID: 744
public bool monochrome = true;
// Token: 0x040002E9 RID: 745
private bool rgbFallback;
// Token: 0x040002EA RID: 746
[Range(0f, 5f)]
public float grainIntensityMin = 0.1f;
// Token: 0x040002EB RID: 747
[Range(0f, 5f)]
public float grainIntensityMax = 0.2f;
// Token: 0x040002EC RID: 748
[Range(0.1f, 50f)]
public float grainSize = 2f;
// Token: 0x040002ED RID: 749
[Range(0f, 5f)]
public float scratchIntensityMin = 0.05f;
// Token: 0x040002EE RID: 750
[Range(0f, 5f)]
public float scratchIntensityMax = 0.25f;
// Token: 0x040002EF RID: 751
[Range(1f, 30f)]
public float scratchFPS = 10f;
// Token: 0x040002F0 RID: 752
[Range(0f, 1f)]
public float scratchJitter = 0.01f;
// Token: 0x040002F1 RID: 753
public Texture grainTexture;
// Token: 0x040002F2 RID: 754
public Texture scratchTexture;
// Token: 0x040002F3 RID: 755
public Shader shaderRGB;
// Token: 0x040002F4 RID: 756
public Shader shaderYUV;
// Token: 0x040002F5 RID: 757
private Material m_MaterialRGB;
// Token: 0x040002F6 RID: 758
private Material m_MaterialYUV;
// Token: 0x040002F7 RID: 759
private float scratchTimeLeft;
// Token: 0x040002F8 RID: 760
private float scratchX;
// Token: 0x040002F9 RID: 761
private float scratchY;
}
}
@@ -0,0 +1,272 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000078 RID: 120
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class PostEffectsBase : MonoBehaviour
{
// Token: 0x0600015B RID: 347 RVA: 0x000076D0 File Offset: 0x00005AD0
protected Material CheckShaderAndCreateMaterial(Shader s, Material m2Create)
{
if (!s)
{
Debug.Log("Missing shader in " + this.ToString());
base.enabled = false;
return null;
}
if (s.isSupported && m2Create && m2Create.shader == s)
{
return m2Create;
}
if (!s.isSupported)
{
this.NotSupported();
Debug.Log(string.Concat(new string[]
{
"The shader ",
s.ToString(),
" on effect ",
this.ToString(),
" is not supported on this platform!"
}));
return null;
}
m2Create = new Material(s);
this.createdMaterials.Add(m2Create);
m2Create.hideFlags = HideFlags.DontSave;
return m2Create;
}
// Token: 0x0600015C RID: 348 RVA: 0x0000779C File Offset: 0x00005B9C
protected Material CreateMaterial(Shader s, Material m2Create)
{
if (!s)
{
Debug.Log("Missing shader in " + this.ToString());
return null;
}
if (m2Create && m2Create.shader == s && s.isSupported)
{
return m2Create;
}
if (!s.isSupported)
{
return null;
}
m2Create = new Material(s);
this.createdMaterials.Add(m2Create);
m2Create.hideFlags = HideFlags.DontSave;
return m2Create;
}
// Token: 0x0600015D RID: 349 RVA: 0x0000781E File Offset: 0x00005C1E
private void OnEnable()
{
this.isSupported = true;
}
// Token: 0x0600015E RID: 350 RVA: 0x00007827 File Offset: 0x00005C27
private void OnDestroy()
{
this.RemoveCreatedMaterials();
}
// Token: 0x0600015F RID: 351 RVA: 0x00007830 File Offset: 0x00005C30
private void RemoveCreatedMaterials()
{
while (this.createdMaterials.Count > 0)
{
Material material = this.createdMaterials[0];
this.createdMaterials.RemoveAt(0);
global::UnityEngine.Object.Destroy(material);
}
}
// Token: 0x06000160 RID: 352 RVA: 0x00007872 File Offset: 0x00005C72
protected bool CheckSupport()
{
return this.CheckSupport(false);
}
// Token: 0x06000161 RID: 353 RVA: 0x0000787B File Offset: 0x00005C7B
public virtual bool CheckResources()
{
Debug.LogWarning("CheckResources () for " + this.ToString() + " should be overwritten.");
return this.isSupported;
}
// Token: 0x06000162 RID: 354 RVA: 0x0000789D File Offset: 0x00005C9D
protected void Start()
{
this.CheckResources();
}
// Token: 0x06000163 RID: 355 RVA: 0x000078A8 File Offset: 0x00005CA8
protected bool CheckSupport(bool needDepth)
{
this.isSupported = true;
this.supportHDRTextures = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf);
this.supportDX11 = SystemInfo.graphicsShaderLevel >= 50 && SystemInfo.supportsComputeShaders;
if (!SystemInfo.supportsImageEffects)
{
this.NotSupported();
return false;
}
if (needDepth && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
{
this.NotSupported();
return false;
}
if (needDepth)
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
}
return true;
}
// Token: 0x06000164 RID: 356 RVA: 0x00007927 File Offset: 0x00005D27
protected bool CheckSupport(bool needDepth, bool needHdr)
{
if (!this.CheckSupport(needDepth))
{
return false;
}
if (needHdr && !this.supportHDRTextures)
{
this.NotSupported();
return false;
}
return true;
}
// Token: 0x06000165 RID: 357 RVA: 0x00007951 File Offset: 0x00005D51
public bool Dx11Support()
{
return this.supportDX11;
}
// Token: 0x06000166 RID: 358 RVA: 0x00007959 File Offset: 0x00005D59
protected void ReportAutoDisable()
{
Debug.LogWarning("The image effect " + this.ToString() + " has been disabled as it's not supported on the current platform.");
}
// Token: 0x06000167 RID: 359 RVA: 0x00007978 File Offset: 0x00005D78
private bool CheckShader(Shader s)
{
Debug.Log(string.Concat(new string[]
{
"The shader ",
s.ToString(),
" on effect ",
this.ToString(),
" is not part of the Unity 3.2+ effects suite anymore. For best performance and quality, please ensure you are using the latest Standard Assets Image Effects (Pro only) package."
}));
if (!s.isSupported)
{
this.NotSupported();
return false;
}
return false;
}
// Token: 0x06000168 RID: 360 RVA: 0x000079D3 File Offset: 0x00005DD3
protected void NotSupported()
{
base.enabled = false;
this.isSupported = false;
}
// Token: 0x06000169 RID: 361 RVA: 0x000079E4 File Offset: 0x00005DE4
protected void DrawBorder(RenderTexture dest, Material material)
{
RenderTexture.active = dest;
bool flag = true;
GL.PushMatrix();
GL.LoadOrtho();
for (int i = 0; i < material.passCount; i++)
{
material.SetPass(i);
float num;
float num2;
if (flag)
{
num = 1f;
num2 = 0f;
}
else
{
num = 0f;
num2 = 1f;
}
float num3 = 0f;
float num4 = 1f / ((float)dest.width * 1f);
float num5 = 0f;
float num6 = 1f;
GL.Begin(7);
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 1f - 1f / ((float)dest.width * 1f);
num4 = 1f;
num5 = 0f;
num6 = 1f;
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 0f;
num4 = 1f;
num5 = 0f;
num6 = 1f / ((float)dest.height * 1f);
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 0f;
num4 = 1f;
num5 = 1f - 1f / ((float)dest.height * 1f);
num6 = 1f;
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
GL.End();
}
GL.PopMatrix();
}
// Token: 0x040002FA RID: 762
protected bool supportHDRTextures = true;
// Token: 0x040002FB RID: 763
protected bool supportDX11;
// Token: 0x040002FC RID: 764
protected bool isSupported = true;
// Token: 0x040002FD RID: 765
private List<Material> createdMaterials = new List<Material>();
}
}
@@ -0,0 +1,181 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000079 RID: 121
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
internal class PostEffectsHelper : MonoBehaviour
{
// Token: 0x0600016B RID: 363 RVA: 0x0000F6D5 File Offset: 0x0000DAD5
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
Debug.Log("OnRenderImage in Helper called ...");
}
// Token: 0x0600016C RID: 364 RVA: 0x0000F6E4 File Offset: 0x0000DAE4
private static void DrawLowLevelPlaneAlignedWithCamera(float dist, RenderTexture source, RenderTexture dest, Material material, Camera cameraForProjectionMatrix)
{
RenderTexture.active = dest;
material.SetTexture("_MainTex", source);
bool flag = true;
GL.PushMatrix();
GL.LoadIdentity();
GL.LoadProjectionMatrix(cameraForProjectionMatrix.projectionMatrix);
float num = cameraForProjectionMatrix.fieldOfView * 0.5f * 0.017453292f;
float num2 = Mathf.Cos(num) / Mathf.Sin(num);
float aspect = cameraForProjectionMatrix.aspect;
float num3 = aspect / -num2;
float num4 = aspect / num2;
float num5 = 1f / -num2;
float num6 = 1f / num2;
float num7 = 1f;
num3 *= dist * num7;
num4 *= dist * num7;
num5 *= dist * num7;
num6 *= dist * num7;
float num8 = -dist;
for (int i = 0; i < material.passCount; i++)
{
material.SetPass(i);
GL.Begin(7);
float num9;
float num10;
if (flag)
{
num9 = 1f;
num10 = 0f;
}
else
{
num9 = 0f;
num10 = 1f;
}
GL.TexCoord2(0f, num9);
GL.Vertex3(num3, num5, num8);
GL.TexCoord2(1f, num9);
GL.Vertex3(num4, num5, num8);
GL.TexCoord2(1f, num10);
GL.Vertex3(num4, num6, num8);
GL.TexCoord2(0f, num10);
GL.Vertex3(num3, num6, num8);
GL.End();
}
GL.PopMatrix();
}
// Token: 0x0600016D RID: 365 RVA: 0x0000F84C File Offset: 0x0000DC4C
private static void DrawBorder(RenderTexture dest, Material material)
{
RenderTexture.active = dest;
bool flag = true;
GL.PushMatrix();
GL.LoadOrtho();
for (int i = 0; i < material.passCount; i++)
{
material.SetPass(i);
float num;
float num2;
if (flag)
{
num = 1f;
num2 = 0f;
}
else
{
num = 0f;
num2 = 1f;
}
float num3 = 0f;
float num4 = 1f / ((float)dest.width * 1f);
float num5 = 0f;
float num6 = 1f;
GL.Begin(7);
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 1f - 1f / ((float)dest.width * 1f);
num4 = 1f;
num5 = 0f;
num6 = 1f;
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 0f;
num4 = 1f;
num5 = 0f;
num6 = 1f / ((float)dest.height * 1f);
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 0f;
num4 = 1f;
num5 = 1f - 1f / ((float)dest.height * 1f);
num6 = 1f;
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
GL.End();
}
GL.PopMatrix();
}
// Token: 0x0600016E RID: 366 RVA: 0x0000FAEC File Offset: 0x0000DEEC
private static void DrawLowLevelQuad(float x1, float x2, float y1, float y2, RenderTexture source, RenderTexture dest, Material material)
{
RenderTexture.active = dest;
material.SetTexture("_MainTex", source);
bool flag = true;
GL.PushMatrix();
GL.LoadOrtho();
for (int i = 0; i < material.passCount; i++)
{
material.SetPass(i);
GL.Begin(7);
float num;
float num2;
if (flag)
{
num = 1f;
num2 = 0f;
}
else
{
num = 0f;
num2 = 1f;
}
GL.TexCoord2(0f, num);
GL.Vertex3(x1, y1, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(x2, y1, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(x2, y2, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(x1, y2, 0.1f);
GL.End();
}
GL.PopMatrix();
}
}
}
@@ -0,0 +1,115 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200007A RID: 122
internal class Quads
{
// Token: 0x06000170 RID: 368 RVA: 0x0000FBD4 File Offset: 0x0000DFD4
private static bool HasMeshes()
{
if (Quads.meshes == null)
{
return false;
}
foreach (Mesh mesh in Quads.meshes)
{
if (null == mesh)
{
return false;
}
}
return true;
}
// Token: 0x06000171 RID: 369 RVA: 0x0000FC1C File Offset: 0x0000E01C
public static void Cleanup()
{
if (Quads.meshes == null)
{
return;
}
for (int i = 0; i < Quads.meshes.Length; i++)
{
if (null != Quads.meshes[i])
{
global::UnityEngine.Object.DestroyImmediate(Quads.meshes[i]);
Quads.meshes[i] = null;
}
}
Quads.meshes = null;
}
// Token: 0x06000172 RID: 370 RVA: 0x0000FC78 File Offset: 0x0000E078
public static Mesh[] GetMeshes(int totalWidth, int totalHeight)
{
if (Quads.HasMeshes() && Quads.currentQuads == totalWidth * totalHeight)
{
return Quads.meshes;
}
int num = 10833;
int num2 = totalWidth * totalHeight;
Quads.currentQuads = num2;
int num3 = Mathf.CeilToInt(1f * (float)num2 / (1f * (float)num));
Quads.meshes = new Mesh[num3];
int num4 = 0;
for (int i = 0; i < num2; i += num)
{
int num5 = Mathf.FloorToInt((float)Mathf.Clamp(num2 - i, 0, num));
Quads.meshes[num4] = Quads.GetMesh(num5, i, totalWidth, totalHeight);
num4++;
}
return Quads.meshes;
}
// Token: 0x06000173 RID: 371 RVA: 0x0000FD1C File Offset: 0x0000E11C
private static Mesh GetMesh(int triCount, int triOffset, int totalWidth, int totalHeight)
{
Mesh mesh = new Mesh();
mesh.hideFlags = HideFlags.DontSave;
Vector3[] array = new Vector3[triCount * 4];
Vector2[] array2 = new Vector2[triCount * 4];
Vector2[] array3 = new Vector2[triCount * 4];
int[] array4 = new int[triCount * 6];
for (int i = 0; i < triCount; i++)
{
int num = i * 4;
int num2 = i * 6;
int num3 = triOffset + i;
float num4 = Mathf.Floor((float)(num3 % totalWidth)) / (float)totalWidth;
float num5 = Mathf.Floor((float)(num3 / totalWidth)) / (float)totalHeight;
Vector3 vector = new Vector3(num4 * 2f - 1f, num5 * 2f - 1f, 1f);
array[num] = vector;
array[num + 1] = vector;
array[num + 2] = vector;
array[num + 3] = vector;
array2[num] = new Vector2(0f, 0f);
array2[num + 1] = new Vector2(1f, 0f);
array2[num + 2] = new Vector2(0f, 1f);
array2[num + 3] = new Vector2(1f, 1f);
array3[num] = new Vector2(num4, num5);
array3[num + 1] = new Vector2(num4, num5);
array3[num + 2] = new Vector2(num4, num5);
array3[num + 3] = new Vector2(num4, num5);
array4[num2] = num;
array4[num2 + 1] = num + 1;
array4[num2 + 2] = num + 2;
array4[num2 + 3] = num + 1;
array4[num2 + 4] = num + 2;
array4[num2 + 5] = num + 3;
}
mesh.vertices = array;
mesh.triangles = array4;
mesh.uv = array2;
mesh.uv2 = array3;
return mesh;
}
// Token: 0x040002FE RID: 766
private static Mesh[] meshes;
// Token: 0x040002FF RID: 767
private static int currentQuads;
}
}
@@ -0,0 +1,69 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200007B RID: 123
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Other/Screen Overlay")]
public class ScreenOverlay : PostEffectsBase
{
// Token: 0x06000176 RID: 374 RVA: 0x0000FF58 File Offset: 0x0000E358
public override bool CheckResources()
{
base.CheckSupport(false);
this.overlayMaterial = base.CheckShaderAndCreateMaterial(this.overlayShader, this.overlayMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000177 RID: 375 RVA: 0x0000FF94 File Offset: 0x0000E394
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
Vector4 vector = new Vector4(1f, 0f, 0f, 1f);
this.overlayMaterial.SetVector("_UV_Transform", vector);
this.overlayMaterial.SetFloat("_Intensity", this.intensity);
this.overlayMaterial.SetTexture("_Overlay", this.texture);
Graphics.Blit(source, destination, this.overlayMaterial, (int)this.blendMode);
}
// Token: 0x04000300 RID: 768
public ScreenOverlay.OverlayBlendMode blendMode = ScreenOverlay.OverlayBlendMode.Overlay;
// Token: 0x04000301 RID: 769
public float intensity = 1f;
// Token: 0x04000302 RID: 770
public Texture2D texture;
// Token: 0x04000303 RID: 771
public Shader overlayShader;
// Token: 0x04000304 RID: 772
private Material overlayMaterial;
// Token: 0x0200007C RID: 124
public enum OverlayBlendMode
{
// Token: 0x04000306 RID: 774
Additive,
// Token: 0x04000307 RID: 775
ScreenBlend,
// Token: 0x04000308 RID: 776
Multiply,
// Token: 0x04000309 RID: 777
Overlay,
// Token: 0x0400030A RID: 778
AlphaBlend
}
}
}
@@ -0,0 +1,119 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200007D RID: 125
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Rendering/Screen Space Ambient Obscurance")]
internal class ScreenSpaceAmbientObscurance : PostEffectsBase
{
// Token: 0x06000179 RID: 377 RVA: 0x0001004F File Offset: 0x0000E44F
public override bool CheckResources()
{
base.CheckSupport(true);
this.aoMaterial = base.CheckShaderAndCreateMaterial(this.aoShader, this.aoMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600017A RID: 378 RVA: 0x00010088 File Offset: 0x0000E488
private void OnDisable()
{
if (this.aoMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.aoMaterial);
}
this.aoMaterial = null;
}
// Token: 0x0600017B RID: 379 RVA: 0x000100AC File Offset: 0x0000E4AC
[ImageEffectOpaque]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
Camera component = base.GetComponent<Camera>();
Matrix4x4 projectionMatrix = component.projectionMatrix;
Matrix4x4 inverse = projectionMatrix.inverse;
Vector4 vector = new Vector4(-2f / projectionMatrix[0, 0], -2f / projectionMatrix[1, 1], (1f - projectionMatrix[0, 2]) / projectionMatrix[0, 0], (1f + projectionMatrix[1, 2]) / projectionMatrix[1, 1]);
if (component.stereoEnabled)
{
Matrix4x4 stereoProjectionMatrix = component.GetStereoProjectionMatrix(Camera.StereoscopicEye.Left);
Matrix4x4 stereoProjectionMatrix2 = component.GetStereoProjectionMatrix(Camera.StereoscopicEye.Right);
Vector4 vector2 = new Vector4(-2f / stereoProjectionMatrix[0, 0], -2f / stereoProjectionMatrix[1, 1], (1f - stereoProjectionMatrix[0, 2]) / stereoProjectionMatrix[0, 0], (1f + stereoProjectionMatrix[1, 2]) / stereoProjectionMatrix[1, 1]);
Vector4 vector3 = new Vector4(-2f / stereoProjectionMatrix2[0, 0], -2f / stereoProjectionMatrix2[1, 1], (1f - stereoProjectionMatrix2[0, 2]) / stereoProjectionMatrix2[0, 0], (1f + stereoProjectionMatrix2[1, 2]) / stereoProjectionMatrix2[1, 1]);
this.aoMaterial.SetVector("_ProjInfoLeft", vector2);
this.aoMaterial.SetVector("_ProjInfoRight", vector3);
}
this.aoMaterial.SetVector("_ProjInfo", vector);
this.aoMaterial.SetMatrix("_ProjectionInv", inverse);
this.aoMaterial.SetTexture("_Rand", this.rand);
this.aoMaterial.SetFloat("_Radius", this.radius);
this.aoMaterial.SetFloat("_Radius2", this.radius * this.radius);
this.aoMaterial.SetFloat("_Intensity", this.intensity);
this.aoMaterial.SetFloat("_BlurFilterDistance", this.blurFilterDistance);
int width = source.width;
int height = source.height;
RenderTexture renderTexture = RenderTexture.GetTemporary(width >> this.downsample, height >> this.downsample);
Graphics.Blit(source, renderTexture, this.aoMaterial, 0);
if (this.downsample > 0)
{
RenderTexture renderTexture2 = RenderTexture.GetTemporary(width, height);
Graphics.Blit(renderTexture, renderTexture2, this.aoMaterial, 4);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
}
for (int i = 0; i < this.blurIterations; i++)
{
this.aoMaterial.SetVector("_Axis", new Vector2(1f, 0f));
RenderTexture renderTexture2 = RenderTexture.GetTemporary(width, height);
Graphics.Blit(renderTexture, renderTexture2, this.aoMaterial, 1);
RenderTexture.ReleaseTemporary(renderTexture);
this.aoMaterial.SetVector("_Axis", new Vector2(0f, 1f));
renderTexture = RenderTexture.GetTemporary(width, height);
Graphics.Blit(renderTexture2, renderTexture, this.aoMaterial, 1);
RenderTexture.ReleaseTemporary(renderTexture2);
}
this.aoMaterial.SetTexture("_AOTex", renderTexture);
Graphics.Blit(source, destination, this.aoMaterial, 2);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x0400030B RID: 779
[Range(0f, 3f)]
public float intensity = 0.5f;
// Token: 0x0400030C RID: 780
[Range(0.1f, 3f)]
public float radius = 0.2f;
// Token: 0x0400030D RID: 781
[Range(0f, 3f)]
public int blurIterations = 1;
// Token: 0x0400030E RID: 782
[Range(0f, 5f)]
public float blurFilterDistance = 1.25f;
// Token: 0x0400030F RID: 783
[Range(0f, 1f)]
public int downsample;
// Token: 0x04000310 RID: 784
public Texture2D rand;
// Token: 0x04000311 RID: 785
public Shader aoShader;
// Token: 0x04000312 RID: 786
private Material aoMaterial;
}
}
@@ -0,0 +1,183 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200007E RID: 126
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Rendering/Screen Space Ambient Occlusion")]
public class ScreenSpaceAmbientOcclusion : MonoBehaviour
{
// Token: 0x0600017D RID: 381 RVA: 0x00010454 File Offset: 0x0000E854
private static Material CreateMaterial(Shader shader)
{
if (!shader)
{
return null;
}
return new Material(shader)
{
hideFlags = HideFlags.HideAndDontSave
};
}
// Token: 0x0600017E RID: 382 RVA: 0x0001047E File Offset: 0x0000E87E
private static void DestroyMaterial(Material mat)
{
if (mat)
{
global::UnityEngine.Object.DestroyImmediate(mat);
mat = null;
}
}
// Token: 0x0600017F RID: 383 RVA: 0x00010494 File Offset: 0x0000E894
private void OnDisable()
{
ScreenSpaceAmbientOcclusion.DestroyMaterial(this.m_SSAOMaterial);
}
// Token: 0x06000180 RID: 384 RVA: 0x000104A4 File Offset: 0x0000E8A4
private void Start()
{
if (!SystemInfo.supportsImageEffects || !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
{
this.m_Supported = false;
base.enabled = false;
return;
}
this.CreateMaterials();
if (!this.m_SSAOMaterial || this.m_SSAOMaterial.passCount != 5)
{
this.m_Supported = false;
base.enabled = false;
return;
}
this.m_Supported = true;
}
// Token: 0x06000181 RID: 385 RVA: 0x00010512 File Offset: 0x0000E912
private void OnEnable()
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.DepthNormals;
}
// Token: 0x06000182 RID: 386 RVA: 0x00010528 File Offset: 0x0000E928
private void CreateMaterials()
{
if (!this.m_SSAOMaterial && this.m_SSAOShader.isSupported)
{
this.m_SSAOMaterial = ScreenSpaceAmbientOcclusion.CreateMaterial(this.m_SSAOShader);
this.m_SSAOMaterial.SetTexture("_RandomTexture", this.m_RandomTexture);
}
}
// Token: 0x06000183 RID: 387 RVA: 0x0001057C File Offset: 0x0000E97C
[ImageEffectOpaque]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.m_Supported || !this.m_SSAOShader.isSupported)
{
base.enabled = false;
return;
}
this.CreateMaterials();
this.m_Downsampling = Mathf.Clamp(this.m_Downsampling, 1, 6);
this.m_Radius = Mathf.Clamp(this.m_Radius, 0.05f, 1f);
this.m_MinZ = Mathf.Clamp(this.m_MinZ, 1E-05f, 0.5f);
this.m_OcclusionIntensity = Mathf.Clamp(this.m_OcclusionIntensity, 0.5f, 4f);
this.m_OcclusionAttenuation = Mathf.Clamp(this.m_OcclusionAttenuation, 0.2f, 2f);
this.m_Blur = Mathf.Clamp(this.m_Blur, 0, 4);
RenderTexture renderTexture = RenderTexture.GetTemporary(source.width / this.m_Downsampling, source.height / this.m_Downsampling, 0);
float fieldOfView = base.GetComponent<Camera>().fieldOfView;
float farClipPlane = base.GetComponent<Camera>().farClipPlane;
float num = Mathf.Tan(fieldOfView * 0.017453292f * 0.5f) * farClipPlane;
float num2 = num * base.GetComponent<Camera>().aspect;
this.m_SSAOMaterial.SetVector("_FarCorner", new Vector3(num2, num, farClipPlane));
int num3;
int num4;
if (this.m_RandomTexture)
{
num3 = this.m_RandomTexture.width;
num4 = this.m_RandomTexture.height;
}
else
{
num3 = 1;
num4 = 1;
}
this.m_SSAOMaterial.SetVector("_NoiseScale", new Vector3((float)renderTexture.width / (float)num3, (float)renderTexture.height / (float)num4, 0f));
this.m_SSAOMaterial.SetVector("_Params", new Vector4(this.m_Radius, this.m_MinZ, 1f / this.m_OcclusionAttenuation, this.m_OcclusionIntensity));
bool flag = this.m_Blur > 0;
Graphics.Blit((!flag) ? source : null, renderTexture, this.m_SSAOMaterial, (int)this.m_SampleCount);
if (flag)
{
RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0);
this.m_SSAOMaterial.SetVector("_TexelOffsetScale", new Vector4((float)this.m_Blur / (float)source.width, 0f, 0f, 0f));
this.m_SSAOMaterial.SetTexture("_SSAO", renderTexture);
Graphics.Blit(null, temporary, this.m_SSAOMaterial, 3);
RenderTexture.ReleaseTemporary(renderTexture);
RenderTexture temporary2 = RenderTexture.GetTemporary(source.width, source.height, 0);
this.m_SSAOMaterial.SetVector("_TexelOffsetScale", new Vector4(0f, (float)this.m_Blur / (float)source.height, 0f, 0f));
this.m_SSAOMaterial.SetTexture("_SSAO", temporary);
Graphics.Blit(source, temporary2, this.m_SSAOMaterial, 3);
RenderTexture.ReleaseTemporary(temporary);
renderTexture = temporary2;
}
this.m_SSAOMaterial.SetTexture("_SSAO", renderTexture);
Graphics.Blit(source, destination, this.m_SSAOMaterial, 4);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x04000313 RID: 787
[Range(0.05f, 1f)]
public float m_Radius = 0.4f;
// Token: 0x04000314 RID: 788
public ScreenSpaceAmbientOcclusion.SSAOSamples m_SampleCount = ScreenSpaceAmbientOcclusion.SSAOSamples.Medium;
// Token: 0x04000315 RID: 789
[Range(0.5f, 4f)]
public float m_OcclusionIntensity = 1.5f;
// Token: 0x04000316 RID: 790
[Range(0f, 4f)]
public int m_Blur = 2;
// Token: 0x04000317 RID: 791
[Range(1f, 6f)]
public int m_Downsampling = 2;
// Token: 0x04000318 RID: 792
[Range(0.2f, 2f)]
public float m_OcclusionAttenuation = 1f;
// Token: 0x04000319 RID: 793
[Range(1E-05f, 0.5f)]
public float m_MinZ = 0.01f;
// Token: 0x0400031A RID: 794
public Shader m_SSAOShader;
// Token: 0x0400031B RID: 795
private Material m_SSAOMaterial;
// Token: 0x0400031C RID: 796
public Texture2D m_RandomTexture;
// Token: 0x0400031D RID: 797
private bool m_Supported;
// Token: 0x0200007F RID: 127
public enum SSAOSamples
{
// Token: 0x0400031F RID: 799
Low,
// Token: 0x04000320 RID: 800
Medium,
// Token: 0x04000321 RID: 801
High
}
}
}
@@ -0,0 +1,17 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200008A RID: 138
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Sepia Tone")]
public class SepiaTone : ImageEffectBase
{
// Token: 0x06000191 RID: 401 RVA: 0x00011D4B File Offset: 0x0001014B
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
Graphics.Blit(source, destination, base.material);
}
}
}
@@ -0,0 +1,168 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200008B RID: 139
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Rendering/Sun Shafts")]
public class SunShafts : PostEffectsBase
{
// Token: 0x06000193 RID: 403 RVA: 0x00011DCC File Offset: 0x000101CC
public override bool CheckResources()
{
base.CheckSupport(this.useDepthTexture);
this.sunShaftsMaterial = base.CheckShaderAndCreateMaterial(this.sunShaftsShader, this.sunShaftsMaterial);
this.simpleClearMaterial = base.CheckShaderAndCreateMaterial(this.simpleClearShader, this.simpleClearMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000194 RID: 404 RVA: 0x00011E30 File Offset: 0x00010230
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.useDepthTexture)
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
}
int num = 4;
if (this.resolution == SunShafts.SunShaftsResolution.Normal)
{
num = 2;
}
else if (this.resolution == SunShafts.SunShaftsResolution.High)
{
num = 1;
}
Vector3 vector = Vector3.one * 0.5f;
if (this.sunTransform)
{
vector = base.GetComponent<Camera>().WorldToViewportPoint(this.sunTransform.position);
}
else
{
vector = new Vector3(0.5f, 0.5f, 0f);
}
int num2 = source.width / num;
int num3 = source.height / num;
RenderTexture renderTexture = RenderTexture.GetTemporary(num2, num3, 0);
this.sunShaftsMaterial.SetVector("_BlurRadius4", new Vector4(1f, 1f, 0f, 0f) * this.sunShaftBlurRadius);
this.sunShaftsMaterial.SetVector("_SunPosition", new Vector4(vector.x, vector.y, vector.z, this.maxRadius));
this.sunShaftsMaterial.SetVector("_SunThreshold", this.sunThreshold);
if (!this.useDepthTexture)
{
RenderTextureFormat renderTextureFormat = ((!base.GetComponent<Camera>().allowHDR) ? RenderTextureFormat.Default : RenderTextureFormat.DefaultHDR);
RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0, renderTextureFormat);
RenderTexture.active = temporary;
GL.ClearWithSkybox(false, base.GetComponent<Camera>());
this.sunShaftsMaterial.SetTexture("_Skybox", temporary);
Graphics.Blit(source, renderTexture, this.sunShaftsMaterial, 3);
RenderTexture.ReleaseTemporary(temporary);
}
else
{
Graphics.Blit(source, renderTexture, this.sunShaftsMaterial, 2);
}
base.DrawBorder(renderTexture, this.simpleClearMaterial);
this.radialBlurIterations = Mathf.Clamp(this.radialBlurIterations, 1, 4);
float num4 = this.sunShaftBlurRadius * 0.0013020834f;
this.sunShaftsMaterial.SetVector("_BlurRadius4", new Vector4(num4, num4, 0f, 0f));
this.sunShaftsMaterial.SetVector("_SunPosition", new Vector4(vector.x, vector.y, vector.z, this.maxRadius));
for (int i = 0; i < this.radialBlurIterations; i++)
{
RenderTexture temporary2 = RenderTexture.GetTemporary(num2, num3, 0);
Graphics.Blit(renderTexture, temporary2, this.sunShaftsMaterial, 1);
RenderTexture.ReleaseTemporary(renderTexture);
num4 = this.sunShaftBlurRadius * (((float)i * 2f + 1f) * 6f) / 768f;
this.sunShaftsMaterial.SetVector("_BlurRadius4", new Vector4(num4, num4, 0f, 0f));
renderTexture = RenderTexture.GetTemporary(num2, num3, 0);
Graphics.Blit(temporary2, renderTexture, this.sunShaftsMaterial, 1);
RenderTexture.ReleaseTemporary(temporary2);
num4 = this.sunShaftBlurRadius * (((float)i * 2f + 2f) * 6f) / 768f;
this.sunShaftsMaterial.SetVector("_BlurRadius4", new Vector4(num4, num4, 0f, 0f));
}
if (vector.z >= 0f)
{
this.sunShaftsMaterial.SetVector("_SunColor", new Vector4(this.sunColor.r, this.sunColor.g, this.sunColor.b, this.sunColor.a) * this.sunShaftIntensity);
}
else
{
this.sunShaftsMaterial.SetVector("_SunColor", Vector4.zero);
}
this.sunShaftsMaterial.SetTexture("_ColorBuffer", renderTexture);
Graphics.Blit(source, destination, this.sunShaftsMaterial, (this.screenBlendMode != SunShafts.ShaftsScreenBlendMode.Screen) ? 4 : 0);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x04000379 RID: 889
public SunShafts.SunShaftsResolution resolution = SunShafts.SunShaftsResolution.Normal;
// Token: 0x0400037A RID: 890
public SunShafts.ShaftsScreenBlendMode screenBlendMode;
// Token: 0x0400037B RID: 891
public Transform sunTransform;
// Token: 0x0400037C RID: 892
public int radialBlurIterations = 2;
// Token: 0x0400037D RID: 893
public Color sunColor = Color.white;
// Token: 0x0400037E RID: 894
public Color sunThreshold = new Color(0.87f, 0.74f, 0.65f);
// Token: 0x0400037F RID: 895
public float sunShaftBlurRadius = 2.5f;
// Token: 0x04000380 RID: 896
public float sunShaftIntensity = 1.15f;
// Token: 0x04000381 RID: 897
public float maxRadius = 0.75f;
// Token: 0x04000382 RID: 898
public bool useDepthTexture = true;
// Token: 0x04000383 RID: 899
public Shader sunShaftsShader;
// Token: 0x04000384 RID: 900
private Material sunShaftsMaterial;
// Token: 0x04000385 RID: 901
public Shader simpleClearShader;
// Token: 0x04000386 RID: 902
private Material simpleClearMaterial;
// Token: 0x0200008C RID: 140
public enum SunShaftsResolution
{
// Token: 0x04000388 RID: 904
Low,
// Token: 0x04000389 RID: 905
Normal,
// Token: 0x0400038A RID: 906
High
}
// Token: 0x0200008D RID: 141
public enum ShaftsScreenBlendMode
{
// Token: 0x0400038C RID: 908
Screen,
// Token: 0x0400038D RID: 909
Add
}
}
}
@@ -0,0 +1,98 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200008E RID: 142
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Camera/Tilt Shift (Lens Blur)")]
internal class TiltShift : PostEffectsBase
{
// Token: 0x06000196 RID: 406 RVA: 0x00012249 File Offset: 0x00010649
public override bool CheckResources()
{
base.CheckSupport(true);
this.tiltShiftMaterial = base.CheckShaderAndCreateMaterial(this.tiltShiftShader, this.tiltShiftMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000197 RID: 407 RVA: 0x00012284 File Offset: 0x00010684
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
this.tiltShiftMaterial.SetFloat("_BlurSize", (this.maxBlurSize >= 0f) ? this.maxBlurSize : 0f);
this.tiltShiftMaterial.SetFloat("_BlurArea", this.blurArea);
source.filterMode = FilterMode.Bilinear;
RenderTexture renderTexture = destination;
if ((float)this.downsample > 0f)
{
renderTexture = RenderTexture.GetTemporary(source.width >> this.downsample, source.height >> this.downsample, 0, source.format);
renderTexture.filterMode = FilterMode.Bilinear;
}
int num = (int)this.quality;
num *= 2;
Graphics.Blit(source, renderTexture, this.tiltShiftMaterial, (this.mode != TiltShift.TiltShiftMode.TiltShiftMode) ? (num + 1) : num);
if (this.downsample > 0)
{
this.tiltShiftMaterial.SetTexture("_Blurred", renderTexture);
Graphics.Blit(source, destination, this.tiltShiftMaterial, 6);
}
if (renderTexture != destination)
{
RenderTexture.ReleaseTemporary(renderTexture);
}
}
// Token: 0x0400038E RID: 910
public TiltShift.TiltShiftMode mode;
// Token: 0x0400038F RID: 911
public TiltShift.TiltShiftQuality quality = TiltShift.TiltShiftQuality.Normal;
// Token: 0x04000390 RID: 912
[Range(0f, 15f)]
public float blurArea = 1f;
// Token: 0x04000391 RID: 913
[Range(0f, 25f)]
public float maxBlurSize = 5f;
// Token: 0x04000392 RID: 914
[Range(0f, 1f)]
public int downsample;
// Token: 0x04000393 RID: 915
public Shader tiltShiftShader;
// Token: 0x04000394 RID: 916
private Material tiltShiftMaterial;
// Token: 0x0200008F RID: 143
public enum TiltShiftMode
{
// Token: 0x04000396 RID: 918
TiltShiftMode,
// Token: 0x04000397 RID: 919
IrisMode
}
// Token: 0x02000090 RID: 144
public enum TiltShiftQuality
{
// Token: 0x04000399 RID: 921
Preview,
// Token: 0x0400039A RID: 922
Normal,
// Token: 0x0400039B RID: 923
High
}
}
}
@@ -0,0 +1,268 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000091 RID: 145
[ImageEffectAllowedInSceneView]
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Color Adjustments/Tonemapping")]
public class Tonemapping : PostEffectsBase
{
// Token: 0x06000199 RID: 409 RVA: 0x00012404 File Offset: 0x00010804
public override bool CheckResources()
{
base.CheckSupport(false, true);
this.tonemapMaterial = base.CheckShaderAndCreateMaterial(this.tonemapper, this.tonemapMaterial);
if (!this.curveTex && this.type == Tonemapping.TonemapperType.UserCurve)
{
this.curveTex = new Texture2D(256, 1, TextureFormat.ARGB32, false, true);
this.curveTex.filterMode = FilterMode.Bilinear;
this.curveTex.wrapMode = TextureWrapMode.Clamp;
this.curveTex.hideFlags = HideFlags.DontSave;
}
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600019A RID: 410 RVA: 0x000124A0 File Offset: 0x000108A0
public float UpdateCurve()
{
float num = 1f;
if (this.remapCurve.keys.Length < 1)
{
this.remapCurve = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(2f, 1f)
});
}
if (this.remapCurve != null)
{
if (this.remapCurve.length > 0)
{
num = this.remapCurve[this.remapCurve.length - 1].time;
}
for (float num2 = 0f; num2 <= 1f; num2 += 0.003921569f)
{
float num3 = this.remapCurve.Evaluate(num2 * 1f * num);
this.curveTex.SetPixel((int)Mathf.Floor(num2 * 255f), 0, new Color(num3, num3, num3));
}
this.curveTex.Apply();
}
return 1f / num;
}
// Token: 0x0600019B RID: 411 RVA: 0x000125B0 File Offset: 0x000109B0
private void OnDisable()
{
if (this.rt)
{
global::UnityEngine.Object.DestroyImmediate(this.rt);
this.rt = null;
}
if (this.tonemapMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.tonemapMaterial);
this.tonemapMaterial = null;
}
if (this.curveTex)
{
global::UnityEngine.Object.DestroyImmediate(this.curveTex);
this.curveTex = null;
}
}
// Token: 0x0600019C RID: 412 RVA: 0x00012624 File Offset: 0x00010A24
private bool CreateInternalRenderTexture()
{
if (this.rt)
{
return false;
}
this.rtFormat = ((!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf)) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.RGHalf);
this.rt = new RenderTexture(1, 1, 0, this.rtFormat);
this.rt.hideFlags = HideFlags.DontSave;
return true;
}
// Token: 0x0600019D RID: 413 RVA: 0x00012680 File Offset: 0x00010A80
[ImageEffectTransformsToLDR]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
this.exposureAdjustment = ((this.exposureAdjustment >= 0.001f) ? this.exposureAdjustment : 0.001f);
if (this.type == Tonemapping.TonemapperType.UserCurve)
{
float num = this.UpdateCurve();
this.tonemapMaterial.SetFloat("_RangeScale", num);
this.tonemapMaterial.SetTexture("_Curve", this.curveTex);
Graphics.Blit(source, destination, this.tonemapMaterial, 4);
return;
}
if (this.type == Tonemapping.TonemapperType.SimpleReinhard)
{
this.tonemapMaterial.SetFloat("_ExposureAdjustment", this.exposureAdjustment);
Graphics.Blit(source, destination, this.tonemapMaterial, 6);
return;
}
if (this.type == Tonemapping.TonemapperType.Hable)
{
this.tonemapMaterial.SetFloat("_ExposureAdjustment", this.exposureAdjustment);
Graphics.Blit(source, destination, this.tonemapMaterial, 5);
return;
}
if (this.type == Tonemapping.TonemapperType.Photographic)
{
this.tonemapMaterial.SetFloat("_ExposureAdjustment", this.exposureAdjustment);
Graphics.Blit(source, destination, this.tonemapMaterial, 8);
return;
}
if (this.type == Tonemapping.TonemapperType.OptimizedHejiDawson)
{
this.tonemapMaterial.SetFloat("_ExposureAdjustment", 0.5f * this.exposureAdjustment);
Graphics.Blit(source, destination, this.tonemapMaterial, 7);
return;
}
bool flag = this.CreateInternalRenderTexture();
RenderTexture temporary = RenderTexture.GetTemporary((int)this.adaptiveTextureSize, (int)this.adaptiveTextureSize, 0, this.rtFormat);
Graphics.Blit(source, temporary);
int num2 = (int)Mathf.Log((float)temporary.width * 1f, 2f);
int num3 = 2;
RenderTexture[] array = new RenderTexture[num2];
for (int i = 0; i < num2; i++)
{
array[i] = RenderTexture.GetTemporary(temporary.width / num3, temporary.width / num3, 0, this.rtFormat);
num3 *= 2;
}
RenderTexture renderTexture = array[num2 - 1];
Graphics.Blit(temporary, array[0], this.tonemapMaterial, 1);
if (this.type == Tonemapping.TonemapperType.AdaptiveReinhardAutoWhite)
{
for (int j = 0; j < num2 - 1; j++)
{
Graphics.Blit(array[j], array[j + 1], this.tonemapMaterial, 9);
renderTexture = array[j + 1];
}
}
else if (this.type == Tonemapping.TonemapperType.AdaptiveReinhard)
{
for (int k = 0; k < num2 - 1; k++)
{
Graphics.Blit(array[k], array[k + 1]);
renderTexture = array[k + 1];
}
}
this.adaptionSpeed = ((this.adaptionSpeed >= 0.001f) ? this.adaptionSpeed : 0.001f);
this.tonemapMaterial.SetFloat("_AdaptionSpeed", this.adaptionSpeed);
this.rt.MarkRestoreExpected();
Graphics.Blit(renderTexture, this.rt, this.tonemapMaterial, (!flag) ? 2 : 3);
this.middleGrey = ((this.middleGrey >= 0.001f) ? this.middleGrey : 0.001f);
this.tonemapMaterial.SetVector("_HdrParams", new Vector4(this.middleGrey, this.middleGrey, this.middleGrey, this.white * this.white));
this.tonemapMaterial.SetTexture("_SmallTex", this.rt);
if (this.type == Tonemapping.TonemapperType.AdaptiveReinhard)
{
Graphics.Blit(source, destination, this.tonemapMaterial, 0);
}
else if (this.type == Tonemapping.TonemapperType.AdaptiveReinhardAutoWhite)
{
Graphics.Blit(source, destination, this.tonemapMaterial, 10);
}
else
{
Debug.LogError("No valid adaptive tonemapper type found!");
Graphics.Blit(source, destination);
}
for (int l = 0; l < num2; l++)
{
RenderTexture.ReleaseTemporary(array[l]);
}
RenderTexture.ReleaseTemporary(temporary);
}
// Token: 0x0400039C RID: 924
public Tonemapping.TonemapperType type = Tonemapping.TonemapperType.Photographic;
// Token: 0x0400039D RID: 925
public Tonemapping.AdaptiveTexSize adaptiveTextureSize = Tonemapping.AdaptiveTexSize.Square256;
// Token: 0x0400039E RID: 926
public AnimationCurve remapCurve;
// Token: 0x0400039F RID: 927
private Texture2D curveTex;
// Token: 0x040003A0 RID: 928
public float exposureAdjustment = 1.5f;
// Token: 0x040003A1 RID: 929
public float middleGrey = 0.4f;
// Token: 0x040003A2 RID: 930
public float white = 2f;
// Token: 0x040003A3 RID: 931
public float adaptionSpeed = 1.5f;
// Token: 0x040003A4 RID: 932
public Shader tonemapper;
// Token: 0x040003A5 RID: 933
public bool validRenderTextureFormat = true;
// Token: 0x040003A6 RID: 934
private Material tonemapMaterial;
// Token: 0x040003A7 RID: 935
private RenderTexture rt;
// Token: 0x040003A8 RID: 936
private RenderTextureFormat rtFormat = RenderTextureFormat.ARGBHalf;
// Token: 0x02000092 RID: 146
public enum TonemapperType
{
// Token: 0x040003AA RID: 938
SimpleReinhard,
// Token: 0x040003AB RID: 939
UserCurve,
// Token: 0x040003AC RID: 940
Hable,
// Token: 0x040003AD RID: 941
Photographic,
// Token: 0x040003AE RID: 942
OptimizedHejiDawson,
// Token: 0x040003AF RID: 943
AdaptiveReinhard,
// Token: 0x040003B0 RID: 944
AdaptiveReinhardAutoWhite
}
// Token: 0x02000093 RID: 147
public enum AdaptiveTexSize
{
// Token: 0x040003B2 RID: 946
Square16 = 16,
// Token: 0x040003B3 RID: 947
Square32 = 32,
// Token: 0x040003B4 RID: 948
Square64 = 64,
// Token: 0x040003B5 RID: 949
Square128 = 128,
// Token: 0x040003B6 RID: 950
Square256 = 256,
// Token: 0x040003B7 RID: 951
Square512 = 512,
// Token: 0x040003B8 RID: 952
Square1024 = 1024
}
}
}
@@ -0,0 +1,108 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000094 RID: 148
internal class Triangles
{
// Token: 0x0600019F RID: 415 RVA: 0x00012A5C File Offset: 0x00010E5C
private static bool HasMeshes()
{
if (Triangles.meshes == null)
{
return false;
}
for (int i = 0; i < Triangles.meshes.Length; i++)
{
if (null == Triangles.meshes[i])
{
return false;
}
}
return true;
}
// Token: 0x060001A0 RID: 416 RVA: 0x00012AA4 File Offset: 0x00010EA4
private static void Cleanup()
{
if (Triangles.meshes == null)
{
return;
}
for (int i = 0; i < Triangles.meshes.Length; i++)
{
if (null != Triangles.meshes[i])
{
global::UnityEngine.Object.DestroyImmediate(Triangles.meshes[i]);
Triangles.meshes[i] = null;
}
}
Triangles.meshes = null;
}
// Token: 0x060001A1 RID: 417 RVA: 0x00012B00 File Offset: 0x00010F00
private static Mesh[] GetMeshes(int totalWidth, int totalHeight)
{
if (Triangles.HasMeshes() && Triangles.currentTris == totalWidth * totalHeight)
{
return Triangles.meshes;
}
int num = 21666;
int num2 = totalWidth * totalHeight;
Triangles.currentTris = num2;
int num3 = Mathf.CeilToInt(1f * (float)num2 / (1f * (float)num));
Triangles.meshes = new Mesh[num3];
int num4 = 0;
for (int i = 0; i < num2; i += num)
{
int num5 = Mathf.FloorToInt((float)Mathf.Clamp(num2 - i, 0, num));
Triangles.meshes[num4] = Triangles.GetMesh(num5, i, totalWidth, totalHeight);
num4++;
}
return Triangles.meshes;
}
// Token: 0x060001A2 RID: 418 RVA: 0x00012BA4 File Offset: 0x00010FA4
private static Mesh GetMesh(int triCount, int triOffset, int totalWidth, int totalHeight)
{
Mesh mesh = new Mesh();
mesh.hideFlags = HideFlags.DontSave;
Vector3[] array = new Vector3[triCount * 3];
Vector2[] array2 = new Vector2[triCount * 3];
Vector2[] array3 = new Vector2[triCount * 3];
int[] array4 = new int[triCount * 3];
for (int i = 0; i < triCount; i++)
{
int num = i * 3;
int num2 = triOffset + i;
float num3 = Mathf.Floor((float)(num2 % totalWidth)) / (float)totalWidth;
float num4 = Mathf.Floor((float)(num2 / totalWidth)) / (float)totalHeight;
Vector3 vector = new Vector3(num3 * 2f - 1f, num4 * 2f - 1f, 1f);
array[num] = vector;
array[num + 1] = vector;
array[num + 2] = vector;
array2[num] = new Vector2(0f, 0f);
array2[num + 1] = new Vector2(1f, 0f);
array2[num + 2] = new Vector2(0f, 1f);
array3[num] = new Vector2(num3, num4);
array3[num + 1] = new Vector2(num3, num4);
array3[num + 2] = new Vector2(num3, num4);
array4[num] = num;
array4[num + 1] = num + 1;
array4[num + 2] = num + 2;
}
mesh.vertices = array;
mesh.triangles = array4;
mesh.uv = array2;
mesh.uv2 = array3;
return mesh;
}
// Token: 0x040003B9 RID: 953
private static Mesh[] meshes;
// Token: 0x040003BA RID: 954
private static int currentTris;
}
}
@@ -0,0 +1,13 @@
using System;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000053 RID: 83
public enum TweakMode34
{
// Token: 0x040001AD RID: 429
Basic,
// Token: 0x040001AE RID: 430
Complex
}
}
@@ -0,0 +1,27 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000095 RID: 149
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Displacement/Twirl")]
public class Twirl : ImageEffectBase
{
// Token: 0x060001A5 RID: 421 RVA: 0x00012D95 File Offset: 0x00011195
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
ImageEffects.RenderDistortion(base.material, source, destination, this.angle, this.center, this.radius);
}
// Token: 0x040003BB RID: 955
public Vector2 radius = new Vector2(0.3f, 0.3f);
// Token: 0x040003BC RID: 956
[Range(0f, 360f)]
public float angle = 50f;
// Token: 0x040003BD RID: 957
public Vector2 center = new Vector2(0.5f, 0.5f);
}
}
@@ -0,0 +1,132 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000096 RID: 150
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Camera/Vignette and Chromatic Aberration")]
public class VignetteAndChromaticAberration : PostEffectsBase
{
// Token: 0x060001A7 RID: 423 RVA: 0x00012E10 File Offset: 0x00011210
public override bool CheckResources()
{
base.CheckSupport(false);
this.m_VignetteMaterial = base.CheckShaderAndCreateMaterial(this.vignetteShader, this.m_VignetteMaterial);
this.m_SeparableBlurMaterial = base.CheckShaderAndCreateMaterial(this.separableBlurShader, this.m_SeparableBlurMaterial);
this.m_ChromAberrationMaterial = base.CheckShaderAndCreateMaterial(this.chromAberrationShader, this.m_ChromAberrationMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060001A8 RID: 424 RVA: 0x00012E84 File Offset: 0x00011284
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
int width = source.width;
int height = source.height;
bool flag = Mathf.Abs(this.blur) > 0f || Mathf.Abs(this.intensity) > 0f;
float num = 1f * (float)width / (1f * (float)height);
RenderTexture renderTexture = null;
RenderTexture renderTexture2 = null;
if (flag)
{
renderTexture = RenderTexture.GetTemporary(width, height, 0, source.format);
if (Mathf.Abs(this.blur) > 0f)
{
renderTexture2 = RenderTexture.GetTemporary(width / 2, height / 2, 0, source.format);
Graphics.Blit(source, renderTexture2, this.m_ChromAberrationMaterial, 0);
for (int i = 0; i < 2; i++)
{
this.m_SeparableBlurMaterial.SetVector("offsets", new Vector4(0f, this.blurSpread * 0.001953125f, 0f, 0f));
RenderTexture temporary = RenderTexture.GetTemporary(width / 2, height / 2, 0, source.format);
Graphics.Blit(renderTexture2, temporary, this.m_SeparableBlurMaterial);
RenderTexture.ReleaseTemporary(renderTexture2);
this.m_SeparableBlurMaterial.SetVector("offsets", new Vector4(this.blurSpread * 0.001953125f / num, 0f, 0f, 0f));
renderTexture2 = RenderTexture.GetTemporary(width / 2, height / 2, 0, source.format);
Graphics.Blit(temporary, renderTexture2, this.m_SeparableBlurMaterial);
RenderTexture.ReleaseTemporary(temporary);
}
}
this.m_VignetteMaterial.SetFloat("_Intensity", 1f / (1f - this.intensity) - 1f);
this.m_VignetteMaterial.SetFloat("_Blur", 1f / (1f - this.blur) - 1f);
this.m_VignetteMaterial.SetTexture("_VignetteTex", renderTexture2);
Graphics.Blit(source, renderTexture, this.m_VignetteMaterial, 0);
}
this.m_ChromAberrationMaterial.SetFloat("_ChromaticAberration", this.chromaticAberration);
this.m_ChromAberrationMaterial.SetFloat("_AxialAberration", this.axialAberration);
this.m_ChromAberrationMaterial.SetVector("_BlurDistance", new Vector2(-this.blurDistance, this.blurDistance));
this.m_ChromAberrationMaterial.SetFloat("_Luminance", 1f / Mathf.Max(Mathf.Epsilon, this.luminanceDependency));
if (flag)
{
renderTexture.wrapMode = TextureWrapMode.Clamp;
}
else
{
source.wrapMode = TextureWrapMode.Clamp;
}
Graphics.Blit((!flag) ? source : renderTexture, destination, this.m_ChromAberrationMaterial, (this.mode != VignetteAndChromaticAberration.AberrationMode.Advanced) ? 1 : 2);
RenderTexture.ReleaseTemporary(renderTexture);
RenderTexture.ReleaseTemporary(renderTexture2);
}
// Token: 0x040003BE RID: 958
public VignetteAndChromaticAberration.AberrationMode mode;
// Token: 0x040003BF RID: 959
public float intensity = 0.036f;
// Token: 0x040003C0 RID: 960
public float chromaticAberration = 0.2f;
// Token: 0x040003C1 RID: 961
public float axialAberration = 0.5f;
// Token: 0x040003C2 RID: 962
public float blur;
// Token: 0x040003C3 RID: 963
public float blurSpread = 0.75f;
// Token: 0x040003C4 RID: 964
public float luminanceDependency = 0.25f;
// Token: 0x040003C5 RID: 965
public float blurDistance = 2.5f;
// Token: 0x040003C6 RID: 966
public Shader vignetteShader;
// Token: 0x040003C7 RID: 967
public Shader separableBlurShader;
// Token: 0x040003C8 RID: 968
public Shader chromAberrationShader;
// Token: 0x040003C9 RID: 969
private Material m_VignetteMaterial;
// Token: 0x040003CA RID: 970
private Material m_SeparableBlurMaterial;
// Token: 0x040003CB RID: 971
private Material m_ChromAberrationMaterial;
// Token: 0x02000097 RID: 151
public enum AberrationMode
{
// Token: 0x040003CD RID: 973
Simple,
// Token: 0x040003CE RID: 974
Advanced
}
}
}
@@ -0,0 +1,26 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000098 RID: 152
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Displacement/Vortex")]
public class Vortex : ImageEffectBase
{
// Token: 0x060001AA RID: 426 RVA: 0x0001318B File Offset: 0x0001158B
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
ImageEffects.RenderDistortion(base.material, source, destination, this.angle, this.center, this.radius);
}
// Token: 0x040003CF RID: 975
public Vector2 radius = new Vector2(0.4f, 0.4f);
// Token: 0x040003D0 RID: 976
public float angle = 50f;
// Token: 0x040003D1 RID: 977
public Vector2 center = new Vector2(0.5f, 0.5f);
}
}