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