|
using System;
using System.Collections.Generic;
using System.Text;
namespace Endogine.ResourceManagement
{
public abstract class Shaders
{
protected Dictionary<string, Shader> _aliasToEffect;
protected Dictionary<string, Shader> _filenameToEffect;
public Shaders()
{
this._aliasToEffect = new Dictionary<string, Shader>();
this._filenameToEffect = new Dictionary<string, Shader>();
}
public abstract Shader Load(string filename, string alias);
public Shader Load(string filename)
{
return this.Load(filename, filename);
}
public abstract Shader Create(string implementation, string alias);
public void Reload(string alias)
{
}
public abstract void Unload(string alias);
protected bool CheckLoad(string filename, string alias)
{
//TODO: keep track of file date - we might want to reload the same file after changes.
if (this._filenameToEffect.ContainsKey(filename))
return false;
if (!System.IO.File.Exists(filename))
throw new System.IO.FileNotFoundException("D3D shader file not found: " + filename);
return true;
}
protected void AddShader(Shader shader, string filename, string alias)
{
this._aliasToEffect.Add(alias, shader);
this._filenameToEffect.Add(filename, shader);
}
public Shader this[string alias]
{
get
{
if (this._aliasToEffect.ContainsKey(alias))
return this._aliasToEffect[alias];
if (this._filenameToEffect.ContainsKey(alias))
return this._filenameToEffect[alias];
return null;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.