Пример #1
0
    /// <summary>
    /// 修改摄像头抗锯齿
    /// </summary>
    /// <param name="antialiasingEnum"></param>
    /// <param name="qualityLevel"></param>
    public void ChangeAntialiasing(AntialiasingEnum antialiasingEnum, int qualityLevel = 1)
    {
        HDAdditionalCameraData hdAdditionalCamera = manager.mainCamera.GetComponent <HDAdditionalCameraData>();

        HDAdditionalCameraData.AntialiasingMode antialiasingMode = HDAdditionalCameraData.AntialiasingMode.None;
        switch (antialiasingEnum)
        {
        case AntialiasingEnum.None:
            break;

        case AntialiasingEnum.FXAA:
            antialiasingMode = HDAdditionalCameraData.AntialiasingMode.FastApproximateAntialiasing;
            break;

        case AntialiasingEnum.TAA:
            antialiasingMode = HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing;
            break;

        case AntialiasingEnum.SMAA:
            antialiasingMode = HDAdditionalCameraData.AntialiasingMode.SubpixelMorphologicalAntiAliasing;
            break;
        }
        hdAdditionalCamera.antialiasing = antialiasingMode;
        switch (qualityLevel)
        {
        case 0:
            hdAdditionalCamera.SMAAQuality = HDAdditionalCameraData.SMAAQualityLevel.Low;
            hdAdditionalCamera.TAAQuality  = HDAdditionalCameraData.TAAQualityLevel.Low;
            break;

        case 1:
            hdAdditionalCamera.SMAAQuality = HDAdditionalCameraData.SMAAQualityLevel.Medium;
            hdAdditionalCamera.TAAQuality  = HDAdditionalCameraData.TAAQualityLevel.Medium;
            break;

        case 2:
            hdAdditionalCamera.SMAAQuality = HDAdditionalCameraData.SMAAQualityLevel.High;
            hdAdditionalCamera.TAAQuality  = HDAdditionalCameraData.TAAQualityLevel.High;
            break;

        default:
            hdAdditionalCamera.SMAAQuality = HDAdditionalCameraData.SMAAQualityLevel.Low;
            hdAdditionalCamera.TAAQuality  = HDAdditionalCameraData.TAAQualityLevel.Low;
            break;
        }
    }
Пример #2
0
 /// <summary>
 /// 设置抗锯齿模式
 /// </summary>
 /// <param name="antialiasing"></param>
 public void SetAntialiasingMode(AntialiasingEnum antialiasing)
 {
     antialiasingMode = (int)antialiasing;
 }