コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }