Inheritance: ShaderResourceI
コード例 #1
0
ファイル: Shader.cs プロジェクト: damian-666/ReignSDK
        public override ShaderResourceI Resource(string name)
        {
            // Try to find existing variable
            foreach (var resource in resources)
            {
                if (resource.Name == name)
                {
                    return(resource);
                }
            }

            // Otherwise add a variable instance
            for (int i = 0; i != program.UniformCount; ++i)
            {
                if (program.GetUniformName(i) == name)
                {
                    var newResource = new ShaderResource(video, program.GetUniformTexture(i), name);
                    resources.Add(newResource);
                    return(newResource);
                }
            }

            Debug.ThrowError("Shader", string.Format("Shader resource '{0}' does not exist", name));
            return(null);
        }
コード例 #2
0
ファイル: Shader.cs プロジェクト: reignstudios/ReignSDK
        public override ShaderResourceI Resource(string name)
        {
            // Try to find existing variable
            foreach (var resource in resources)
            {
                if (resource.Name == name) return resource;
            }

            // Otherwise add a variable instance
            for (int i = 0; i != program.UniformCount; ++i)
            {
                if (program.GetUniformName(i) == name)
                {
                    var newResource = new ShaderResource(video, program.GetUniformTexture(i), name);
                    resources.Add(newResource);
                    return newResource;
                }
            }

            Debug.ThrowError("Shader", string.Format("Shader resource '{0}' does not exist", name));
            return null;
        }