scripts
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user