305 lines
8.4 KiB
C#
305 lines
8.4 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace UnityStandardAssets.CinematicEffects
|
|
{
|
|
// Token: 0x02000004 RID: 4
|
|
[Serializable]
|
|
public class FXAA : IAntiAliasing
|
|
{
|
|
// Token: 0x17000004 RID: 4
|
|
// (get) Token: 0x0600000C RID: 12 RVA: 0x0000214B File Offset: 0x0000054B
|
|
private Shader shader
|
|
{
|
|
get
|
|
{
|
|
if (this.m_Shader == null)
|
|
{
|
|
this.m_Shader = Shader.Find("Hidden/Fast Approximate Anti-aliasing");
|
|
}
|
|
return this.m_Shader;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000005 RID: 5
|
|
// (get) Token: 0x0600000D RID: 13 RVA: 0x00002174 File Offset: 0x00000574
|
|
public Material material
|
|
{
|
|
get
|
|
{
|
|
if (this.m_Material == null)
|
|
{
|
|
this.m_Material = ImageEffectHelper.CheckShaderAndCreateMaterial(this.shader);
|
|
}
|
|
return this.m_Material;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000006 RID: 6
|
|
// (get) Token: 0x0600000E RID: 14 RVA: 0x0000219E File Offset: 0x0000059E
|
|
// (set) Token: 0x0600000F RID: 15 RVA: 0x000021A6 File Offset: 0x000005A6
|
|
public bool validSourceFormat { get; private set; }
|
|
|
|
// Token: 0x06000010 RID: 16 RVA: 0x000021AF File Offset: 0x000005AF
|
|
public void OnEnable(AntiAliasing owner)
|
|
{
|
|
if (!ImageEffectHelper.IsSupported(this.shader, true, false, owner))
|
|
{
|
|
owner.enabled = false;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000011 RID: 17 RVA: 0x000021CB File Offset: 0x000005CB
|
|
public void OnDisable()
|
|
{
|
|
if (this.m_Material != null)
|
|
{
|
|
global::UnityEngine.Object.DestroyImmediate(this.m_Material);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000012 RID: 18 RVA: 0x000021E9 File Offset: 0x000005E9
|
|
public void OnPreCull(Camera camera)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06000013 RID: 19 RVA: 0x000021EB File Offset: 0x000005EB
|
|
public void OnPostRender(Camera camera)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06000014 RID: 20 RVA: 0x000021F0 File Offset: 0x000005F0
|
|
public void OnRenderImage(Camera camera, RenderTexture source, RenderTexture destination)
|
|
{
|
|
this.material.SetVector("_QualitySettings", new Vector3(this.preset.qualitySettings.subpixelAliasingRemovalAmount, this.preset.qualitySettings.edgeDetectionThreshold, this.preset.qualitySettings.minimumRequiredLuminance));
|
|
this.material.SetVector("_ConsoleSettings", new Vector4(this.preset.consoleSettings.subpixelSpreadAmount, this.preset.consoleSettings.edgeSharpnessAmount, this.preset.consoleSettings.edgeDetectionThreshold, this.preset.consoleSettings.minimumRequiredLuminance));
|
|
Graphics.Blit(source, destination, this.material, 0);
|
|
}
|
|
|
|
// Token: 0x04000008 RID: 8
|
|
private Shader m_Shader;
|
|
|
|
// Token: 0x04000009 RID: 9
|
|
private Material m_Material;
|
|
|
|
// Token: 0x0400000A RID: 10
|
|
[SerializeField]
|
|
[HideInInspector]
|
|
public FXAA.Preset preset = FXAA.Preset.defaultPreset;
|
|
|
|
// Token: 0x0400000B RID: 11
|
|
public static FXAA.Preset[] availablePresets = new FXAA.Preset[]
|
|
{
|
|
FXAA.Preset.extremePerformancePreset,
|
|
FXAA.Preset.performancePreset,
|
|
FXAA.Preset.defaultPreset,
|
|
FXAA.Preset.qualityPreset,
|
|
FXAA.Preset.extremeQualityPreset
|
|
};
|
|
|
|
// Token: 0x02000005 RID: 5
|
|
[Serializable]
|
|
public struct QualitySettings
|
|
{
|
|
// Token: 0x0400000D RID: 13
|
|
[Tooltip("The amount of desired sub-pixel aliasing removal. Effects the sharpeness of the output.")]
|
|
[Range(0f, 1f)]
|
|
public float subpixelAliasingRemovalAmount;
|
|
|
|
// Token: 0x0400000E RID: 14
|
|
[Tooltip("The minimum amount of local contrast required to qualify a region as containing an edge.")]
|
|
[Range(0.063f, 0.333f)]
|
|
public float edgeDetectionThreshold;
|
|
|
|
// Token: 0x0400000F RID: 15
|
|
[Tooltip("Local contrast adaptation value to disallow the algorithm from executing on the darker regions.")]
|
|
[Range(0f, 0.0833f)]
|
|
public float minimumRequiredLuminance;
|
|
}
|
|
|
|
// Token: 0x02000006 RID: 6
|
|
[Serializable]
|
|
public struct ConsoleSettings
|
|
{
|
|
// Token: 0x04000010 RID: 16
|
|
[Tooltip("The amount of spread applied to the sampling coordinates while sampling for subpixel information.")]
|
|
[Range(0.33f, 0.5f)]
|
|
public float subpixelSpreadAmount;
|
|
|
|
// Token: 0x04000011 RID: 17
|
|
[Tooltip("This value dictates how sharp the edges in the image are kept; a higher value implies sharper edges.")]
|
|
[Range(2f, 8f)]
|
|
public float edgeSharpnessAmount;
|
|
|
|
// Token: 0x04000012 RID: 18
|
|
[Tooltip("The minimum amount of local contrast required to qualify a region as containing an edge.")]
|
|
[Range(0.125f, 0.25f)]
|
|
public float edgeDetectionThreshold;
|
|
|
|
// Token: 0x04000013 RID: 19
|
|
[Tooltip("Local contrast adaptation value to disallow the algorithm from executing on the darker regions.")]
|
|
[Range(0.04f, 0.06f)]
|
|
public float minimumRequiredLuminance;
|
|
}
|
|
|
|
// Token: 0x02000007 RID: 7
|
|
[Serializable]
|
|
public struct Preset
|
|
{
|
|
// Token: 0x17000007 RID: 7
|
|
// (get) Token: 0x06000016 RID: 22 RVA: 0x00002319 File Offset: 0x00000719
|
|
public static FXAA.Preset extremePerformancePreset
|
|
{
|
|
get
|
|
{
|
|
return FXAA.Preset.s_ExtremePerformance;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000008 RID: 8
|
|
// (get) Token: 0x06000017 RID: 23 RVA: 0x00002320 File Offset: 0x00000720
|
|
public static FXAA.Preset performancePreset
|
|
{
|
|
get
|
|
{
|
|
return FXAA.Preset.s_Performance;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000009 RID: 9
|
|
// (get) Token: 0x06000018 RID: 24 RVA: 0x00002327 File Offset: 0x00000727
|
|
public static FXAA.Preset defaultPreset
|
|
{
|
|
get
|
|
{
|
|
return FXAA.Preset.s_Default;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700000A RID: 10
|
|
// (get) Token: 0x06000019 RID: 25 RVA: 0x0000232E File Offset: 0x0000072E
|
|
public static FXAA.Preset qualityPreset
|
|
{
|
|
get
|
|
{
|
|
return FXAA.Preset.s_Quality;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700000B RID: 11
|
|
// (get) Token: 0x0600001A RID: 26 RVA: 0x00002335 File Offset: 0x00000735
|
|
public static FXAA.Preset extremeQualityPreset
|
|
{
|
|
get
|
|
{
|
|
return FXAA.Preset.s_ExtremeQuality;
|
|
}
|
|
}
|
|
|
|
// Token: 0x04000014 RID: 20
|
|
[FXAA.Preset.LayoutAttribute]
|
|
public FXAA.QualitySettings qualitySettings;
|
|
|
|
// Token: 0x04000015 RID: 21
|
|
[FXAA.Preset.LayoutAttribute]
|
|
public FXAA.ConsoleSettings consoleSettings;
|
|
|
|
// Token: 0x04000016 RID: 22
|
|
private static readonly FXAA.Preset s_ExtremePerformance = new FXAA.Preset
|
|
{
|
|
qualitySettings = new FXAA.QualitySettings
|
|
{
|
|
subpixelAliasingRemovalAmount = 0f,
|
|
edgeDetectionThreshold = 0.333f,
|
|
minimumRequiredLuminance = 0.0833f
|
|
},
|
|
consoleSettings = new FXAA.ConsoleSettings
|
|
{
|
|
subpixelSpreadAmount = 0.33f,
|
|
edgeSharpnessAmount = 8f,
|
|
edgeDetectionThreshold = 0.25f,
|
|
minimumRequiredLuminance = 0.06f
|
|
}
|
|
};
|
|
|
|
// Token: 0x04000017 RID: 23
|
|
private static readonly FXAA.Preset s_Performance = new FXAA.Preset
|
|
{
|
|
qualitySettings = new FXAA.QualitySettings
|
|
{
|
|
subpixelAliasingRemovalAmount = 0.25f,
|
|
edgeDetectionThreshold = 0.25f,
|
|
minimumRequiredLuminance = 0.0833f
|
|
},
|
|
consoleSettings = new FXAA.ConsoleSettings
|
|
{
|
|
subpixelSpreadAmount = 0.33f,
|
|
edgeSharpnessAmount = 8f,
|
|
edgeDetectionThreshold = 0.125f,
|
|
minimumRequiredLuminance = 0.06f
|
|
}
|
|
};
|
|
|
|
// Token: 0x04000018 RID: 24
|
|
private static readonly FXAA.Preset s_Default = new FXAA.Preset
|
|
{
|
|
qualitySettings = new FXAA.QualitySettings
|
|
{
|
|
subpixelAliasingRemovalAmount = 0.75f,
|
|
edgeDetectionThreshold = 0.166f,
|
|
minimumRequiredLuminance = 0.0833f
|
|
},
|
|
consoleSettings = new FXAA.ConsoleSettings
|
|
{
|
|
subpixelSpreadAmount = 0.5f,
|
|
edgeSharpnessAmount = 8f,
|
|
edgeDetectionThreshold = 0.125f,
|
|
minimumRequiredLuminance = 0.05f
|
|
}
|
|
};
|
|
|
|
// Token: 0x04000019 RID: 25
|
|
private static readonly FXAA.Preset s_Quality = new FXAA.Preset
|
|
{
|
|
qualitySettings = new FXAA.QualitySettings
|
|
{
|
|
subpixelAliasingRemovalAmount = 1f,
|
|
edgeDetectionThreshold = 0.125f,
|
|
minimumRequiredLuminance = 0.0625f
|
|
},
|
|
consoleSettings = new FXAA.ConsoleSettings
|
|
{
|
|
subpixelSpreadAmount = 0.5f,
|
|
edgeSharpnessAmount = 4f,
|
|
edgeDetectionThreshold = 0.125f,
|
|
minimumRequiredLuminance = 0.04f
|
|
}
|
|
};
|
|
|
|
// Token: 0x0400001A RID: 26
|
|
private static readonly FXAA.Preset s_ExtremeQuality = new FXAA.Preset
|
|
{
|
|
qualitySettings = new FXAA.QualitySettings
|
|
{
|
|
subpixelAliasingRemovalAmount = 1f,
|
|
edgeDetectionThreshold = 0.063f,
|
|
minimumRequiredLuminance = 0.0312f
|
|
},
|
|
consoleSettings = new FXAA.ConsoleSettings
|
|
{
|
|
subpixelSpreadAmount = 0.5f,
|
|
edgeSharpnessAmount = 2f,
|
|
edgeDetectionThreshold = 0.125f,
|
|
minimumRequiredLuminance = 0.04f
|
|
}
|
|
};
|
|
|
|
// Token: 0x02000008 RID: 8
|
|
[AttributeUsage(AttributeTargets.Field)]
|
|
public class LayoutAttribute : PropertyAttribute
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|