Class Assets

Namespace
Elegy.AssetSystem.API
Assembly
Elegy.AssetSystem.dll

Asset system.

public static class Assets
Inheritance
Assets
Inherited Members

Properties

AllLevels

A collection of all loaded levels.

public static IReadOnlyCollection<ElegyMapDocument> AllLevels { get; }

Property Value

IReadOnlyCollection<ElegyMapDocument>

AllMaterials

All the materials in the system.

public static IEnumerable<Material> AllMaterials { get; }

Property Value

IEnumerable<Material>

AllModels

A collection of all loaded models.

public static IReadOnlyCollection<Model> AllModels { get; }

Property Value

IReadOnlyCollection<Model>

MissingTexture

The "missing texture" texture.

public static Texture MissingTexture { get; }

Property Value

Texture

Methods

FindLevelLoader(params string[])

Finds an appropriate ILevelLoader according to one of the extensions.

public static ILevelLoader? FindLevelLoader(params string[] extensions)

Parameters

extensions string[]

Returns

ILevelLoader

FindLevelWriter(string)

Finds an appropriate ILevelWriter according to the extension.

public static ILevelWriter? FindLevelWriter(string extension)

Parameters

extension string

Returns

ILevelWriter

FindModelLoader(params string[])

Finds an appropriate IModelLoader according to one of the extensions.

public static IModelLoader? FindModelLoader(params string[] extensions)

Parameters

extensions string[]

Returns

IModelLoader

FindTextureLoader(params string[])

Finds an appropriate ITextureLoader according to one of the extensions.

public static ITextureLoader? FindTextureLoader(params string[] extensions)

Parameters

extensions string[]

Returns

ITextureLoader

GetTextureMetadata(string)

Loads and returns a TextureMetadata. This result is not cached, unlike LoadTexture(string, bool).

public static TextureMetadata? GetTextureMetadata(string texturePath)

Parameters

texturePath string

Returns

TextureMetadata

Init(in LaunchConfig)

public static bool Init(in LaunchConfig config)

Parameters

config LaunchConfig

Returns

bool

LoadLevel(string)

Loads a level from the path.

public static ElegyMapDocument? LoadLevel(string path)

Parameters

path string

Returns

ElegyMapDocument

LoadMaterial(string)

Loads a material from the material library.

public static Material? LoadMaterial(string materialName)

Parameters

materialName string

Name of the material.

Returns

Material

A valid Material instance always, missing material if not found.

LoadModel(string)

Loads a model from the path.

public static Model? LoadModel(string path)

Parameters

path string

Returns

Model

LoadTexture(string, bool)

Loads and returns a Texture. Caches the result so it can be easily retrieved if the same texture is referenced by multiple materials.

public static Texture? LoadTexture(string texturePath, bool hintSrgb = false)

Parameters

texturePath string
hintSrgb bool

Returns

Texture

PostInit()

public static bool PostInit()

Returns

bool

SetRenderFactories(Func<MaterialDefinition, IMaterial?>, Func<TextureMetadata, byte[], ITexture?>)

public static void SetRenderFactories(Func<MaterialDefinition, IMaterial?> materialFactory, Func<TextureMetadata, byte[], ITexture?> textureFactory)

Parameters

materialFactory Func<MaterialDefinition, IMaterial>
textureFactory Func<TextureMetadata, byte[], ITexture>

Shutdown()

public static void Shutdown()

UnloadMaterial(ref Material?)

Unloads the material. It is a reference, so it will become null after this.

public static bool UnloadMaterial(ref Material? material)

Parameters

material Material

Returns

bool

true on success, false if the material is invalid or otherwise.

WriteLevel(string, ElegyMapDocument)

Writes a level to the given path.

public static bool WriteLevel(string path, ElegyMapDocument data)

Parameters

path string
data ElegyMapDocument

Returns

bool