Inheritance: ShaderResourceI
Exemple #1
0
        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);
        }
Exemple #2
0
        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;
        }