Click or drag to resize
Ab4d.SharpEngine logo

StandardMaterialBaseLoadDiffuseTexture(VulkanDevice, String, IBitmapIO, CommonSamplerTypes, Single, Boolean) Method

LoadDiffuseTexture immediately loads the specified textureFileName, creates a GpuImage object from the file and sets it to the DiffuseTexture property. The method also sets DiffuseTexture, DiffuseTextureSamplerType and DiffuseTextureSampler properties. Calling this method requires a valid gpuDevice objects. When useGpuDeviceCache is true (by default), then before loading the image the GpuDevice's cache is checked if this file was already loaded. Also, the create GpuImage is cached by the GpuDevice's cache. If you want to use Scene case, use the method override that takes Scene objects as parameter. If you want to lazily create a diffuse texture before the device is known, call the method without the gpuDevice parameter. When the created GpuImage is not cached by the GpuDevice (useGpuDeviceCache is true by default), then it is disposed when this Material is disposed.

Namespace: Ab4d.SharpEngine.Materials
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 1.0.8740+deb2991acfe86a95cca780cd4f82bcae2805c1a5
Syntax
C#
public GpuImage? LoadDiffuseTexture(
	VulkanDevice gpuDevice,
	string textureFileName,
	IBitmapIO? bitmapIO = null,
	CommonSamplerTypes samplerType = CommonSamplerTypes.Mirror,
	float alphaClipThreshold = 0f,
	bool useGpuDeviceCache = true
)

Parameters

gpuDevice  VulkanDevice
VulkanDevice
textureFileName  String
texture file name
bitmapIO  IBitmapIO  (Optional)
Optional IBitmapIO that is used to load the texture. When null, then the DefaultBitmapIOis used
samplerType  CommonSamplerTypes  (Optional)
texture sampler type (Mirror by default)
alphaClipThreshold  Single  (Optional)
optional float that defines the AlphaClipThreshold (0 by default)
useGpuDeviceCache  Boolean  (Optional)
when true (by default) than before loading the image the GpuDevice's cache is checked if this file was already loaded. Also the create GpuImage is cached by the GpuDevice's cache

Return Value

GpuImage
returns created GpuImage
See Also