Beispiel #1
0
        public static MaterialPtr CloneMaterial(String orgName, String cloneName)
        {
            if (MaterialManager.Singleton.ResourceExists(cloneName))
            {
                using (ResourcePtr res = MaterialManager.Singleton.GetByName(cloneName))
                    using (MaterialPtr matPtr = res)
                    {
                        if (matPtr.CompilationRequired)
                        {
                            matPtr.Compile();
                        }
                        return(matPtr);
                    }
            }


            using (ResourcePtr res = MaterialManager.Singleton.GetByName(orgName))
                using (MaterialPtr matPtr = res)
                {
                    if (matPtr.IsLoaded)
                    {
                        matPtr.Load();
                    }
                    if (matPtr.CompilationRequired)
                    {
                        matPtr.Compile();
                    }

                    return(matPtr.Clone(cloneName));
                }
        }