Inheritance: ShaderResourceI
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
        }