public Texture Find(string file, TextureMagFilter magFilter, TextureMinFilter minFilter, TextureWrapMode wrapModeS, TextureWrapMode wrapModeT) { try { string key = string.Format("{0}:{1}:{2}:{3}:{4}", file, magFilter, minFilter, wrapModeS, wrapModeT); Texture texture; if(textures.TryGetValue(key, out texture))return texture; TextureLoaderParameters.MagnificationFilter = magFilter; TextureLoaderParameters.MinificationFilter = minFilter; TextureLoaderParameters.WrapModeS = wrapModeS; TextureLoaderParameters.WrapModeT = wrapModeT; uint handle; TextureTarget dimension; ImageDDS.LoadFromDisk(file, out handle, out dimension); texture = new Texture(handle); textures[key]=texture; return texture; } catch { Console.WriteLine(string.Format("TextureManager: Failed to load texture {0}", file)); return new Texture(0); // TODO remove } }
public Material(Texture texture, Vector4 ambient, Vector4 diffuse, Vector4 specular, Vector4 emissive, float shininess, float transparency) { this.texture = texture; this.ambient = ambient; this.diffuse = diffuse; this.specular = specular; this.emissive = emissive; this.shininess = shininess; this.transparency = transparency; }