using System;
using UnityEngine;

namespace Leap.Unity
{
	[ExecuteInEditMode]
	public class EnableDepthBuffer : MonoBehaviour
	{
		private void Awake()
		{
			base.GetComponent<Camera>().depthTextureMode = this._depthTextureMode;
			if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth) && this._depthTextureMode != DepthTextureMode.None)
			{
				Shader.EnableKeyword("USE_DEPTH_TEXTURE");
			}
			else
			{
				Shader.DisableKeyword("USE_DEPTH_TEXTURE");
			}
		}

		public const string DEPTH_TEXTURE_VARIANT_NAME = "USE_DEPTH_TEXTURE";

		[SerializeField]
		private DepthTextureMode _depthTextureMode = DepthTextureMode.Depth;
	}
}
