Class Texture
Texture asset contains an image that is usually stored on a GPU and is used during rendering graphics.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Content/Assets/Texture.h
Syntax
public class Texture : public TextureBase
Methods
FromFile(const StringView& path, bool generateMips=false)
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
public static Texture* FromFile(const StringView& path, bool generateMips=false)
Parameters
StringView
path
The source image file path. |
bool
generateMips
True if generate mipmaps for the imported texture. |
Returns
Texture
The loaded texture (virtual asset) or null if fails. |
LoadFile(const StringView& path, bool generateMips=false)
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.
Valid only for virtual assets.
Declaration
public bool LoadFile(const StringView& path, bool generateMips=false)
Parameters
StringView
path
The source image file path. |
bool
generateMips
True if generate mipmaps for the imported texture. |
Returns
bool
True if fails, otherwise false. |
Save(const StringView& path, const InitData* customData)
Saves this asset to the file. Supported only in Editor.
Declaration
public bool Save(const StringView& path, const InitData* customData)
Parameters
StringView
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. |
InitData
customData
The custom texture data container. Can be used to override the data stored in the asset. Use null to ignore this argument. |
Returns
bool
True if cannot save data, otherwise false. |
Save(const StringView& path=StringView::Empty)
Saves this asset to the file. Supported only in Editor.
Declaration
public virtual bool Save(const StringView& path=StringView::Empty) override
Parameters
StringView
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
bool
True when cannot save data, otherwise false. |