public static IsTreeLeafShader ( |
||
shader | ||
Résultat | bool |
private static void AddShaderFromMaterial(Material material, List <string> barkShaders, List <string> leafShaders) { if (material && material.shader) { Shader shader = material.shader; if (TreeEditorHelper.IsTreeBarkShader(shader) && !barkShaders.Contains(shader.name)) { barkShaders.Add(shader.name); } else { if (TreeEditorHelper.IsTreeLeafShader(material.shader) && !leafShaders.Contains(shader.name)) { leafShaders.Add(shader.name); } } } }
private static void ExtractOptimizedShaders(List <TreeMaterial> materials, out Shader optimizedSolidShader, out Shader optimizedCutoutShader) { List <Shader> list = new List <Shader>(); List <Shader> list2 = new List <Shader>(); foreach (TreeMaterial current in materials) { Material material = current.material; if (material && material.shader) { if (TreeEditorHelper.IsTreeBarkShader(material.shader)) { list.Add(material.shader); } else { if (TreeEditorHelper.IsTreeLeafShader(material.shader)) { list2.Add(material.shader); } } } } optimizedSolidShader = null; optimizedCutoutShader = null; if (list.Count > 0) { optimizedSolidShader = Shader.Find(TreeEditorHelper.GetOptimizedShaderName(list[0])); } if (list2.Count > 0) { optimizedCutoutShader = Shader.Find(TreeEditorHelper.GetOptimizedShaderName(list2[0])); } if (!optimizedSolidShader) { optimizedSolidShader = TreeEditorHelper.DefaultOptimizedBarkShader; } if (!optimizedCutoutShader) { optimizedCutoutShader = TreeEditorHelper.DefaultOptimizedLeafShader; } }
private static bool IsTreeShader(Shader shader) { return(TreeEditorHelper.IsTreeBarkShader(shader) || TreeEditorHelper.IsTreeLeafShader(shader)); }