Table of Contents

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 Engine

The Engine providing rendering capabilities.

stream Stream

The 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 bool

true 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 Engine

The Engine providing the cache and rendering capabilities.

id string

The ID of the asset to be returned.

meshTexture bool

Shall the texture be loaded from the meshes directory instead of the textures directory?

Returns

XTexture

The requested asset; null if id 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