OmegaEngine API  1.0.3
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Static Public Member Functions | Protected Member Functions | Properties | List of all members
OmegaEngine.Assets.XTexture Class Reference

A texture loaded from one of DirectX's natively supported image formats (PNG, JPG, DDS, ...). More...

Inheritance diagram for OmegaEngine.Assets.XTexture:
OmegaEngine.Assets.Asset OmegaEngine.Graphics.ITextureProvider OmegaEngine.Assets.IReferenceCount OmegaEngine.Assets.IReferenceCount

Static Public Member Functions

static XTexture Get (Engine engine, string id, bool meshTexture=false)
 Returns a cached XTexture or creates a new one if the requested ID is not cached. More...
 
static implicit operator Texture (XTexture xTexture)
 Convert a XTexture into its contained SlimDX.Direct3D9.Texture. More...
 

Protected Member Functions

 XTexture (Engine engine, Stream stream)
 Loads a texture from an image file. More...
 
override void Dispose (bool disposing)
 To be called by IDisposable.Dispose and the object destructor. More...
 

Properties

Texture Texture [get]
 The SlimDX.Direct3D9.Texture inside this asset. More...
 
- Properties inherited from OmegaEngine.Assets.Asset
string Name [get, set]
 The filename More...
 
int ReferenceCount [get, set]
 How many Renderables use this asset More...
 
bool Disposed [get, set]
 Was this asset already disposed? More...
 
- Properties inherited from OmegaEngine.Graphics.ITextureProvider
Texture Texture [get]
 The SlimDX.Direct3D9.Texture this object represents. More...
 

Additional Inherited Members

- Public Member Functions inherited from OmegaEngine.Assets.Asset
override string ToString ()
 
virtual void HoldReference ()
 Increments the ReferenceCount by one. More...
 
virtual void ReleaseReference ()
 Decrements the ReferenceCount by one. More...
 
void Dispose ()
 Disposes the internal DirectX resources of this asset. More...
 

Detailed Description

A texture loaded from one of DirectX's natively supported image formats (PNG, JPG, DDS, ...).

Constructor & Destructor Documentation

OmegaEngine.Assets.XTexture.XTexture ( Engine  engine,
Stream  stream 
)
inlineprotected

Loads a texture from an image file.

Parameters
engineThe Engine providing rendering capabilities.
streamThe image file to load the texture from.
Exceptions
InvalidDataExceptionstream does not contain a texture file.

This should only be called by Get to prevent unnecessary duplicates.

Member Function Documentation

override void OmegaEngine.Assets.XTexture.Dispose ( bool  disposing)
inlineprotectedvirtual

To be called by IDisposable.Dispose and the object destructor.

Parameters
disposingtrue if called manually and not by the garbage collector.

Reimplemented from OmegaEngine.Assets.Asset.

static XTexture OmegaEngine.Assets.XTexture.Get ( Engine  engine,
string  id,
bool  meshTexture = false 
)
inlinestatic

Returns a cached XTexture or creates a new one if the requested ID is not cached.

Parameters
engineThe Engine providing the cache and rendering capabilities.
idThe ID of the asset to be returned.
meshTextureShall the texture be loaded from the meshes directory instead of the textures directory?
Returns
The requested asset; null if id was empty.
Exceptions
FileNotFoundExceptionThe specified file could not be found.
IOExceptionThere was an error reading the file.
UnauthorizedAccessExceptionRead access to the file is not permitted.
InvalidDataExceptionThe file does not contain a valid texture.

Remember to call CacheManager.Clean when done, otherwise this object will never be released.

static implicit OmegaEngine.Assets.XTexture.operator Texture ( XTexture  xTexture)
inlinestatic

Convert a XTexture into its contained SlimDX.Direct3D9.Texture.

Property Documentation

Texture OmegaEngine.Assets.XTexture.Texture
get

The SlimDX.Direct3D9.Texture inside this asset.


The documentation for this class was generated from the following file: