| | 1 | | using DCL.Helpers; |
| | 2 | | using UnityEngine; |
| | 3 | | using UnityEngine.Rendering; |
| | 4 | |
|
| | 5 | | namespace DCL.Helpers |
| | 6 | | { |
| | 7 | | public static class MaterialUtils |
| | 8 | | { |
| | 9 | | public static void SetOpaque(Material material) |
| | 10 | | { |
| 78 | 11 | | material.SetInt(ShaderUtils.SrcBlend, (int)BlendMode.One); |
| 78 | 12 | | material.SetInt(ShaderUtils.DstBlend, (int)BlendMode.Zero); |
| 78 | 13 | | material.SetInt(ShaderUtils.Surface, 0); |
| 78 | 14 | | material.SetFloat(ShaderUtils.ZWrite, 1); |
| 78 | 15 | | material.EnableKeyword("_ALPHATEST_ON"); |
| 78 | 16 | | material.DisableKeyword("_ALPHABLEND_ON"); |
| 78 | 17 | | material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); |
| 78 | 18 | | material.SetOverrideTag("RenderType", "TransparentCutout"); |
| 78 | 19 | | } |
| | 20 | |
|
| | 21 | | public static void SetTransparent(Material material) |
| | 22 | | { |
| 31 | 23 | | material.SetInt(ShaderUtils.SrcBlend, (int)BlendMode.SrcAlpha); |
| 31 | 24 | | material.SetInt(ShaderUtils.DstBlend, (int)BlendMode.OneMinusSrcAlpha); |
| 31 | 25 | | material.SetInt(ShaderUtils.Surface, 1); |
| 31 | 26 | | material.SetFloat(ShaderUtils.ZWrite, 0); |
| 31 | 27 | | material.DisableKeyword("_ALPHATEST_ON"); |
| 31 | 28 | | material.EnableKeyword("_ALPHABLEND_ON"); |
| 31 | 29 | | material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); |
| 31 | 30 | | material.SetOverrideTag("RenderType", "Transparent"); |
| 31 | 31 | | } |
| | 32 | | } |
| | 33 | | } |