/// <summary> /// Copies the details of this material into another, preserving the target's handle and name /// (unlike operator=) but copying everything else. /// </summary> /// <param name="target">Material which will receive this material's settings.</param> public void CopyTo(Material target, bool copyUniqueInfo) { if (copyUniqueInfo) { target.name = name; target.handle = handle; target.isLoaded = isLoaded; target.isManual = isManual; } // copy basic data target.size = size; target.lastAccessed = lastAccessed; target.receiveShadows = receiveShadows; target.transparencyCastsShadows = transparencyCastsShadows; target.RemoveAllTechniques(); // clone a copy of all the techniques for (int i = 0; i < techniques.Count; i++) { Technique technique = (Technique)techniques[i]; Technique newTechnique = target.CreateTechnique(); technique.CopyTo(newTechnique); // only add this technique to supported techniques if its...well....supported :-) if (newTechnique.IsSupported) { target.InsertSupportedTechnique(newTechnique); } } // clear LOD distances target.lodDistances.Clear(); // copy LOD distances for (int i = 0; i < lodDistances.Count; i++) { target.lodDistances.Add(lodDistances[i]); } target.compilationRequired = compilationRequired; }
/// <summary> /// Copies the details of this material into another, preserving the target's handle and name /// (unlike operator=) but copying everything else. /// </summary> /// <param name="target">Material which will receive this material's settings.</param> public void CopyTo(Material target, bool copyUniqueInfo) { if(copyUniqueInfo) { target.name = name; target.handle = handle; target.isLoaded = isLoaded; target.isManual = isManual; } // copy basic data target.size = size; target.lastAccessed = lastAccessed; target.receiveShadows = receiveShadows; target.transparencyCastsShadows = transparencyCastsShadows; target.RemoveAllTechniques(); // clone a copy of all the techniques for(int i = 0; i < techniques.Count; i++) { Technique technique = (Technique)techniques[i]; Technique newTechnique = target.CreateTechnique(); technique.CopyTo(newTechnique); // only add this technique to supported techniques if its...well....supported :-) if(newTechnique.IsSupported) target.InsertSupportedTechnique(newTechnique); } // clear LOD distances target.lodDistances.Clear(); // copy LOD distances for(int i = 0; i < lodDistances.Count; i++) { target.lodDistances.Add(lodDistances[i]); } target.compilationRequired = compilationRequired; }
/// <param name="target"></param> /// <param name="copyUniqueInfo">preserves the target's handle, group, name, and loading properties (unlike operator=) but copying everything else.</param> public void CopyTo( Material target, bool copyUniqueInfo ) { if ( copyUniqueInfo ) { target.Name = this.Name; target.Handle = this.Handle; target.Group = this.Group; target.IsManuallyLoaded = this.IsManuallyLoaded; target.loader = this.loader; } // copy basic data target.Size = this.Size; target.LastAccessed = this.LastAccessed; target.ReceiveShadows = this.ReceiveShadows; target.TransparencyCastsShadows = this.TransparencyCastsShadows; target.RemoveAllTechniques(); // clone a copy of all the techniques for ( int i = 0; i < this.techniques.Count; i++ ) { Technique technique = this.techniques[ i ]; Technique newTechnique = target.CreateTechnique(); technique.CopyTo( newTechnique ); // only add this technique to supported techniques if its...well....supported :-) if ( newTechnique.IsSupported ) { target.InsertSupportedTechnique( newTechnique ); } } // clear LOD distances target._lodValues.Clear(); target.UserLodValues.Clear(); // copy LOD distances target._lodValues.AddRange( this._lodValues ); target.UserLodValues.AddRange( this.UserLodValues ); target.LodStrategy = this.LodStrategy; target.compilationRequired = this.compilationRequired; }