private void handleFoundTextureBinder(MaterialI material, FieldInfo materialField, IDictionary values, MaterialFieldBinder binder, string contentDirectory, Dictionary <string, string> fileExtOverrides) { var textureFileName = ((Dictionary <string, string>)values)[binder.InputID]; if (fileExtOverrides != null) { string ext = Streams.GetFileExt(textureFileName); if (fileExtOverrides.ContainsKey(ext)) { textureFileName = Streams.GetFileNameWithoutExt(textureFileName) + fileExtOverrides[ext]; } else { textureFileName = Streams.GetFileNameWithExt(textureFileName); } } else { textureFileName = Streams.GetFileNameWithExt(textureFileName); } // TODO load texture unless already loaded... //texture = parent.FindChild<Texture2D> //( // "NewReference", // new ConstructorParam(typeof(IDisposableResource), parent), // new ConstructorParam(typeof(string), filename), // new ConstructorParam(typeof(Loader.LoadedCallbackMethod), null) //); //if (texture != null) //{ // ++texture.referenceCount; // return texture; //} //return new Texture2D(parent, filename, loadedCallback); //var texture = Texture2DAPI.New(Parent, contentDirectory + textureFileName, null); //texture.AddReference(); ITexture2D texture = null; if (!Textures.Contains(texture)) { Textures.Add(texture); } materialField.SetValue(material, texture); }