static Material ConvertToStaticLighting(Material material) { Shader destShader = null; Texture cubeMap = null; if (material.HasProperty("_Cube")) { cubeMap = material.GetTexture("_Cube"); } // if there is a cube map use the reflection shader if (cubeMap != null) { destShader = Shader.Find("Daydream/DiffuseAndReflections"); } else { destShader = Shader.Find("Daydream/Standard"); } if (!DaydreamMenu.StandardToDaydreamSingleMaterial(material, material.shader, destShader)) { Debug.LogWarning("No Conversion"); material.shader = destShader; } // enable static vertex lighting material.EnableKeyword("STATIC_LIGHTING"); material.DisableKeyword("LIGHTMAP"); material.EnableKeyword("VERTEX_LIGHTING"); EditorUtility.SetDirty(material); return(material); }
static Material ConvertToDynamicLighting(Material material) { // load main asset string path = AssetDatabase.GetAssetPath(material); Material mainMaterial = AssetDatabase.LoadMainAssetAtPath(path) as Material; if (mainMaterial == null) { return(null); } Shader destShader = null; Texture cubeMap = material.GetTexture("_Cube"); // if there is a cube map use the reflection shader if (cubeMap != null) { destShader = Shader.Find("Daydream/DiffuseAndReflections"); } else { destShader = Shader.Find("Daydream/Standard"); } if (!DaydreamMenu.StandardToDaydreamSingleMaterial(material, material.shader, destShader)) { Debug.Log("No Conversion for " + material.shader.name); } EditorUtility.SetDirty(material); return(material); }
static Material ConvertToStaticLighting(Material material) { Shader destShader = Shader.Find("Daydream/Standard"); if (!DaydreamMenu.StandardToDaydreamSingleMaterial(material, material.shader, destShader)) { Debug.LogWarning("No Conversion"); material.shader = destShader; } // enable static vertex lighting material.EnableKeyword("STATIC_LIGHTING"); material.DisableKeyword("LIGHTMAP"); material.EnableKeyword("VERTEX_LIGHTING"); EditorUtility.SetDirty(material); return(material); }
static Material ConvertToDynamicLighting(Material material) { // load main asset string path = AssetDatabase.GetAssetPath(material); Material mainMaterial = AssetDatabase.LoadMainAssetAtPath(path) as Material; if (mainMaterial == null) { return(null); } Shader destShader = Shader.Find("Daydream/Standard"); if (!DaydreamMenu.StandardToDaydreamSingleMaterial(material, material.shader, destShader)) { Debug.Log("No Conversion for " + material.shader.name); } EditorUtility.SetDirty(material); return(material); }