53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
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;
|
|
}
|
|
}
|