/// <summary> /// Clones from the specified <see cref="ShaderMixinSource"/>. /// </summary> /// <param name="parent">The parent mixin to clone from.</param> /// <exception cref="System.ArgumentNullException">parent</exception> public void CloneFrom(ShaderMixinSource parent) { if (parent == null) { throw new ArgumentNullException("parent", string.Format("Cannot clone mixin [{0}] from a null parent")); } Mixins.AddRange(parent.Mixins); Macros.AddRange(parent.Macros); foreach (var shaderBasic in parent.Compositions) { Compositions[shaderBasic.Key] = shaderBasic.Value; } }
/// <summary> /// Clones from the specified <see cref="ShaderMixinSource"/>. Clones members too. /// </summary> /// <param name="parent">The parent mixin to clone from.</param> /// <exception cref="System.ArgumentNullException">parent</exception> public void DeepCloneFrom(ShaderMixinSource parent) { if (parent == null) { throw new ArgumentNullException("parent", string.Format("Cannot deep clone mixin [{0}] from a null parent")); } foreach (var mixin in parent.Mixins) { Mixins.Add((ShaderClassSource)mixin.Clone()); } Macros.AddRange(parent.Macros); foreach (var shaderBasic in parent.Compositions) { Compositions[shaderBasic.Key] = (ShaderSource)shaderBasic.Value.Clone(); } }