Class XMesh
- Namespace
- OmegaEngine.Assets
- Assembly
- OmegaEngine.dll
A mesh loaded from an .X file.
public class XMesh : Asset, IReferenceCount, IDisposable, INamed, IComparable<Asset>
- Inheritance
-
XMesh
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
XMesh(Engine, Stream, string)
Loads a static mesh from an .X file.
protected XMesh(Engine engine, Stream stream, string meshName)
Parameters
engine
EngineThe Engine providing rendering capabilities.
stream
StreamThe .X file to load the mesh from.
meshName
stringThe name of the mesh. This is used for finding associated textures.
Remarks
This should only be called by Get(Engine, string) to prevent unnecessary duplicates.
Exceptions
- InvalidDataException
stream
does not contain a valid mesh.
Fields
Materials
Materials (diffuse/normal/height/specular map, lighting settings) associated with the mesh
public readonly XMaterial[] Materials
Field Value
Properties
BoundingBox
A bounding box surrounding this mesh
public BoundingBox BoundingBox { get; protected set; }
Property Value
- BoundingBox
BoundingSphere
A bounding sphere surrounding this mesh
public BoundingSphere BoundingSphere { get; protected set; }
Property Value
- BoundingSphere
Mesh
public Mesh Mesh { get; }
Property Value
- Mesh
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)
Returns a cached XMesh or creates a new one if the requested ID is not cached.
public static XMesh? Get(Engine engine, string id)
Parameters
engine
EngineThe Engine providing the cache and rendering capabilities.
id
stringThe ID of the asset to be returned.
Returns
- XMesh
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 mesh.
HoldReference()
Increments the ReferenceCount by one.
public override void HoldReference()
ReleaseReference()
Decrements the ReferenceCount by one.
public override void ReleaseReference()