private static ShaderResourceView LoadTexture(Device device, IArchiveFile file)
 {
     using (var dataView = file.OpenDataView()) {
         DdsLoader.CreateDDSTextureFromMemory(device, dataView.DataPointer, out Resource texture, out ShaderResourceView view);
         texture.Dispose();
         return(view);
     }
 }
Example #2
0
 private ShaderResourceView Load(IArchiveFile file)
 {
     using (var dataView = file.OpenDataView()) {
         DdsLoader.CreateDDSTextureFromMemory(device, dataView.DataPointer, out var texture, out var textureView);
         texture.Dispose();
         return(textureView);
     }
 }
    public static Overlay Load(Device device, ShaderCache shaderCache, IArchiveFile textureFile)
    {
        Size2 overlaySize;
        ShaderResourceView overlayResourceView;

        using (var dataView = textureFile.OpenDataView()) {
            DdsLoader.CreateDDSTextureFromMemory(device, dataView.DataPointer, out var texture, out overlayResourceView);
            var desc = (texture as Texture2D).Description;
            overlaySize = new Size2(desc.Width, desc.Height);
            texture.Dispose();
        }

        return(new Overlay(device, shaderCache, overlaySize, overlayResourceView));
    }