private void CreateTexture(IImageAsset imageAsset) { var image = new Veldrid.ImageSharp.ImageSharpTexture(imageAsset.OpenAsync().Result); var texture = image.CreateDeviceTexture(_veldrid.GraphicsDevice, _veldrid.ResourceFactory); _textures[imageAsset] = texture; }
public ImageInfo GetImage(string path) { Texture?tx = null; if (!_textureAtlas.TryGetValue(path, out tx)) { var fullPath = System.IO.Path.IsPathFullyQualified(path) ? path : System.IO.Path.Combine(Tools.GetExeDir(), path); var imgSharpTx = new Veldrid.ImageSharp.ImageSharpTexture(fullPath); tx = imgSharpTx.CreateDeviceTexture(_gd, _gd.ResourceFactory); _textureAtlas[path] = tx; } return(new ImageInfo(tx, _controller.GetOrCreateImGuiBinding(_gd.ResourceFactory, tx))); }