コード例 #1
0
ファイル: ShaderMixinSource.cs プロジェクト: vvvv/stride
        /// <summary>
        /// Adds a composition to this mixin.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="shaderSourceElement">The shader source element.</param>
        /// <returns>Returns the index of the composition in the array.</returns>
        public int AddCompositionToArray(string name, ShaderSource shaderSourceElement)
        {
            ShaderSource shaderSource;
            if (!Compositions.TryGetValue(name, out shaderSource))
                Compositions.Add(name, shaderSource = new ShaderArraySource());

            var shaderArraySource = (ShaderArraySource)shaderSource;
            shaderArraySource.Add(shaderSourceElement);
            return shaderArraySource.Values.Count - 1;
        }