Inheritance: IShaderResource
示例#1
0
        public override IShaderResource Resource(string name)
        {
            // Try to find existing resource
            foreach (var resource in resources)
            {
                if (resource.Name == name)
                {
                    return(resource);
                }
            }

            // Otherwise add a resource instance
            int vertexIndex = vertex.Resource(name);
            int pixelIndex  = pixel.Resource(name);

            if (pixelIndex == -1 && pixelIndex == -1)
            {
                Debug.ThrowError("Shader", string.Format("Shader resource '{0}' does not exist.", name));
            }

            var newResource = new ShaderResource(name, video.com, vertex.com, pixel.com, vertexIndex, pixelIndex);

            resources.Add(newResource);
            return(newResource);
        }
示例#2
0
		public override IShaderResource Resource(string name)
		{
			// Try to find existing resource
			foreach (var resource in resources)
			{
				if (resource.Name == name) return resource;
			}

			// Otherwise add a resource instance
			int vertexIndex = vertex.Resource(name);
			int pixelIndex = pixel.Resource(name);

			if (pixelIndex == -1 && pixelIndex == -1)
			{
				Debug.ThrowError("Shader", string.Format("Shader resource '{0}' does not exist.", name));
			}

			var newResource = new ShaderResource(name, video.com, vertex.com, pixel.com, vertexIndex, pixelIndex);
			resources.Add(newResource);
			return newResource;
		}