Texture |
public static class TextureLoader
The TextureLoader type exposes the following members.
Name | Description | |
---|---|---|
CreateTexture(String, Scene, IBitmapIO, Boolean, Boolean) | CreateTexture creates a GpuImage from the specified file. See remarks for TextureLoader for more info. | |
CreateTexture(String, VulkanDevice, IBitmapIO, Boolean, Boolean) | CreateTexture creates a GpuImage from the specified file. | |
CreateTexture(Stream, String, Scene, IBitmapIO, Boolean, Boolean) | CreateTexture creates a GpuImage from the specified file. See remarks for TextureLoader for more info. | |
CreateTexture(Stream, String, VulkanDevice, IBitmapIO, Boolean, Boolean) | CreateTexture creates a GpuImage from the specified file. See remarks for TextureLoader for more info. |
TextureLoader is a static helper class that can be used to create a texture (as GpuImage) from a file. The file can be loaded by providing the file name or the file stream.
The texture (GpuImage) can be created by calling CreateTexture method.
When the CreateTexture methods are called by providing the Scene object and when useSceneCache is true, then before reading the file, the Scene's cache is checked if the GpuImage was already created from that file. Also, the created GpuImage in added to the Scene's cache.
When the CreateTexture methods are called by providing the VulkanDevice object and when useGpuDeviceCache is true, then before reading the file, the GpuDevice's cache is checked if the GpuImage was already created from that file. Also, the created GpuImage in added to the GpuDevice's cache.
Note that when GpuImage is cached by Scene or GpuDevice objects, then it cannot be disposed by calling the Dispose method. It can be disposed only when the Scene (if cached in Scene) is disposed, when GpuDevice (if cached in GpuDevice) is disposed or if GpuImage is removed from the cache and then disposed.
When the texture is loaded from stream and if you want to use caching, then also the streamFileName must be set. Otherwise no key is provided.
Note that by default useSceneCache is set to true, but useGpuDeviceCache is by default set to false.
To create StandardMaterial or SolidColorMaterial with texture, you can use the constructor that takes texture file name or texture file stream.