|
TextureLoaderCreateStandardTextureMaterial(DXDevice, String, Boolean, Boolean, Boolean) Method |
CreateStandardTextureMaterial method can load image png, jpg, tiff, gif, bmp, ico or dds file and create a
StandardMaterial.
The loaded texture is set to the DiffuseTextures property. The method also sets the TextureBlendState and HasTransparency properties.
The returned StandardMaterial and the ShaderResourceView that is set to the DiffuseTextures must be manually disposed by the user.
Namespace: Ab3d.DirectXAssembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.0.8865.1045
Syntax public static StandardMaterial CreateStandardTextureMaterial(
DXDevice dxDevice,
string fileName,
bool loadDdsIfPresent,
bool convertTo32bppPRGBA,
bool generateMipMaps
)
Parameters
- dxDevice DXDevice
- DXEngine DXDevice
- fileName String
- file name with full path to the file
- loadDdsIfPresent Boolean
- When loadDdsIfPresent is set to true and file extension is not dds, then loader checks if there is a dds file with the same name but dds file extension present in the same folder as the specified fileName. 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
- 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
- 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
StandardMaterialStandardMaterial with loaded texture set to DiffuseTextures
Remarks
CreateStandardTextureMaterial method can load image png, jpg, tiff, gif, bmp, ico or dds file and create a StandardMaterial.
The loaded texture is set to the DiffuseTextures property. The method also sets the TextureBlendState and HasTransparency properties.
The returned StandardMaterial and the ShaderResourceView that is set to the DiffuseTextures must be manually disposed by the user.
This method is first calling the LoadShaderResourceView(Device, String, Boolean, Boolean, Boolean, Boolean, TextureInfo) method
and then GetRecommendedBlendState(Boolean, Boolean) method to get the recommended BlendState.
See Also