Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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)));
        }