Class XTexture
- Namespace
- OmegaEngine.Assets
- Assembly
- OmegaEngine.dll
A texture loaded from one of DirectX's natively supported image formats (PNG, JPG, DDS, ...).
public class XTexture : Asset, IDisposable, INamed, IComparable<Asset>, ITextureProvider, IReferenceCount
- Inheritance
-
XTexture
- Implements
- Inherited Members
- Extension Methods
Constructors
XTexture(Engine, Stream)
Loads a texture from an image file.
protected XTexture(Engine engine, Stream stream)
Parameters
engine
EngineThe Engine providing rendering capabilities.
stream
StreamThe image file to load the texture from.
Remarks
This should only be called by Get(Engine, string?, bool) to prevent unnecessary duplicates.
Exceptions
- InvalidDataException
stream
does not contain a texture file.
Properties
Texture
The SlimDX.Direct3D9.Texture inside this asset.
public Texture Texture { get; }
Property Value
- Texture
Methods
Dispose(bool)
To be called by Dispose() and the object destructor.
protected override void Dispose(bool disposing)
Parameters
disposing
booltrue
if called manually and not by the garbage collector.
Get(Engine, string?, bool)
Returns a cached XTexture or creates a new one if the requested ID is not cached.
public static XTexture? Get(Engine engine, string? id, bool meshTexture = false)
Parameters
engine
EngineThe Engine providing the cache and rendering capabilities.
id
stringThe ID of the asset to be returned.
meshTexture
boolShall the texture be loaded from the meshes directory instead of the textures directory?
Returns
- XTexture
The requested asset;
null
ifid
was empty.
Remarks
Remember to call Clean() when done, otherwise this object will never be released.
Exceptions
- FileNotFoundException
The specified file could not be found.
- IOException
There was an error reading the file.
- UnauthorizedAccessException
Read access to the file is not permitted.
- InvalidDataException
The file does not contain a valid texture.
Operators
implicit operator Texture(XTexture)
Convert a XTexture into its contained SlimDX.Direct3D9.Texture.
public static implicit operator Texture(XTexture xTexture)
Parameters
xTexture
XTexture
Returns
- Texture