Skip to content

Class ContentLoader

Namespace: Apogee.Content.Import
Assembly: Apogee.Content.dll

Loads models and textures the way a game wants them: the imported artifact when there is one (), the source file otherwise. A game that was never imported loads from its sources, so the same call works everywhere. A package's files have artifacts when the package shipped them (it was imported as a folder of its own, its imported/ is at mod://id/imported). It does not check that the artifact is current: importing is the step that does.

public sealed class ContentLoader

Inheritance

object ← ContentLoader

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

ContentLoader(VirtualFileSystem)

Loads models and textures the way a game wants them: the imported artifact when there is one (), the source file otherwise. A game that was never imported loads from its sources, so the same call works everywhere. A package's files have artifacts when the package shipped them (it was imported as a folder of its own, its imported/ is at mod://id/imported). It does not check that the artifact is current: importing is the step that does.

public ContentLoader(VirtualFileSystem files)

Parameters

files VirtualFileSystem

Properties

Assets

Which file has which UID, over the same files. The host sets its (the mounted packages) once they are mounted.

public AssetDatabase Assets { get; }

Property Value

AssetDatabase

Methods

ArtifactDependenciesFor(string)

The virtual paths of the files the artifact of the asset at path was made from (a shader's imported modules), or an empty list when it was not imported.

public IReadOnlyList<string> ArtifactDependenciesFor(string path)

Parameters

path string

Returns

IReadOnlyList<string>

ArtifactPathFor(string)

The virtual path of the artifact that replaces the asset at path, or null when it was not imported.

public string? ArtifactPathFor(string path)

Parameters

path string

Returns

string?

LoadModel(string, ContentOptions?)

The model at path. The textures of an imported one are transcoded for the GPU that options describes (BC7, ASTC, or RGBA8).

public ModelData LoadModel(string path, ContentOptions? options = null)

Parameters

path string

options ContentOptions?

Returns

ModelData

LoadTexture(string, bool, TextureCaps, SamplerData?, bool)

The image at path as a texture. An imported one has the color space and mips it was imported with (srgb and mipmaps are for the source), transcoded for caps.

public TextureData LoadTexture(string path, bool srgb, TextureCaps caps, SamplerData? sampler = null, bool mipmaps = true)

Parameters

path string

srgb bool

caps TextureCaps

sampler SamplerData?

mipmaps bool

Returns

TextureData

Refresh()

Reads the indexes (and the UIDs) again (after an import).

public void Refresh()

ResolveAssetPath(string)

What a script or a document names as a path: a uid:// becomes the file that has it ( when none does), anything else is returned as it is.

public string ResolveAssetPath(string pathOrUid)

Parameters

pathOrUid string

Returns

string