Class Texture
Texture asset contains an image that is usually stored on a GPU and is used during rendering graphics.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public class Texture : TextureBase
Constructors
Texture()
Properties
IsNormalMap
Returns true if texture is a normal map.
Declaration
[Unmanaged]
public bool IsNormalMap { get; }
Property Value
System.Boolean
|
Methods
FromFile(String, Boolean)
Loads the texture from the image file and creates the virtual texture asset for it. Supported file formats depend on a runtime platform. All platform support loading PNG, BMP, TGA, HDR and JPEG files.
Declaration
[Unmanaged]
public static Texture FromFile(string path, bool generateMips = false)
Parameters
System.String
path
The source image file path. |
System.Boolean
generateMips
True if generate mipmaps for the imported texture. |
Returns
Texture
The loaded texture (virtual asset) or null if fails. |
LoadFile(String, Boolean)
Loads the texture from the image file. Supported file formats depend on a runtime platform. All platform support loading PNG, BMP, TGA, HDR and JPEG files.
Declaration
[Unmanaged]
public bool LoadFile(string path, bool generateMips = false)
Parameters
System.String
path
The source image file path. |
System.Boolean
generateMips
True if generate mipmaps for the imported texture. |
Returns
System.Boolean
True if fails, otherwise false. |
Remarks
Valid only for virtual assets.
Save(String)
Saves this asset to the file. Supported only in Editor.
Declaration
[Unmanaged]
public bool Save(string path = null)
Parameters
System.String
path
The custom asset path to use for the saving. Use empty value to save this asset to its own storage location. Can be used to duplicate asset. Must be specified when saving virtual asset. |
Returns
System.Boolean
True if cannot save data, otherwise false. |