Click or drag to resize
Ab4d.SharpEngine logo

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

LoadDiffuseTexture lazily loads the texture from the specified file steam, creates a GpuImage object from the file and sets it to the DiffuseTexture property. The method also sets DiffuseTextureSamplerType and DiffuseTextureSampler properties. If this material was not yet initialized when this method is called ([!:Material.Scene] is not yet set), then the creation of the texture is postponed until the InitializeSceneResources method is called. To immediately create the texture, call this method and pass a VulkanDevice as the first parameter. When the created GpuImage is not cached by the Scene (useSceneCache is false by default) or 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: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public void LoadDiffuseTexture(
	Stream fileStream,
	string? streamFileName,
	IBitmapIO? bitmapIO = null,
	CommonSamplerTypes samplerType = CommonSamplerTypes.Mirror,
	float alphaClipThreshold = 0f,
	bool useSceneCache = false,
	bool useGpuDeviceCache = true
)

Parameters

fileStream  Stream
file stream
streamFileName  String
optional file name (needs to be set when useSceneCache is true)
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)
useSceneCache  Boolean  (Optional)
when true (false by default) than before loading the image the Scene's cache is checked if this file was already loaded. Also, the create GpuImage is cached by the Scene's cache.
useGpuDeviceCache  Boolean  (Optional)
when true (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
See Also