|
TextureLoaderLoadShaderResourceView(Device, String, Boolean, Boolean, Boolean) Method |
LoadShaderResourceViewFrom can load image png, jpg, tiff, gif, bmp, ico or dds file into ShaderResourceView.
When loadDdsIfPresent is set to true and file extension is not dds, the loader checked if there is a dds file with the same name but dds file extension.
If dds file exist, it is loaded instead of the file specified with fileName. This can greatly improve load performance and memory usage.
Namespace: Ab3d.DirectXAssembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.0.8865.1045
Syntax public static ShaderResourceView LoadShaderResourceView(
Device device,
string fileName,
bool loadDdsIfPresent = false,
bool convertTo32bppPRGBA = true,
bool generateMipMaps = true
)
Parameters
- device Device
- Direct11 Device
- fileName String
- file name with full path to the file
- loadDdsIfPresent Boolean (Optional)
- When loadDdsIfPresent is set to true and file extension is not dds, the loader checked if there is a dds file with the same name but dds file extension. If dds file exist, it is loaded instead of the file specified with fileName. This can greatly improve load performance and memory usage. Default value is false.
- convertTo32bppPRGBA Boolean (Optional)
- When true (by default) the image is converted into 32 bit pre-multiplied RGBA format (Format.R8G8B8A8_UNorm). Note that when file name is saved into a format that is not supported by DirectX, it will be always converted into R8G8B8A8_UNorm.
- generateMipMaps Boolean (Optional)
- When true (by default) the mipmaps are generated before a ShaderResourceView is created. Mipmaps are recommended because they can greatly improve texture quality.
Return Value
ShaderResourceViewShaderResourceView that can be used as DirectX shader resource.
Remarks LoadShaderResourceViewFrom can load image png, jpg, tiff, gif, bmp, ico or dds file into ShaderResourceView.
When loadDdsIfPresent is set to true and file extension is not dds, the loader check if there is a dds file with the same name but dds file extension.
If dds file exist, it is loaded instead of the file specified with fileName. This can greatly improve load performance and memory usage.
When loading dds textures for diffuse texture, it is recommended to use the BC7_UNORM format with pre-multiplied alpha (it is also possible to use BC3 or when no alpha channel is used BC1).
See Also