Namespace Apogee.Content.Import¶
Classes¶
Turns the assets of a game into the engine's own formats. It is a small registry: each res://imported/ beside an index.xml that says which source each came from (.import.xml settings, the asset, and every file the import read for it (a model's
buffers and textures, the modules a shader imports). Artifacts whose source is gone are deleted. Importers run in the order of the list, and a file that an earlier import read (a model's
image) is not imported on its own. res:// has to be writable.
Importing also gives assets their UID (.import.xml (made if there is none), an authored one (imported/assets.xml lists them all for
Encodes an RGBA8 texture and its mip chain as UASTC in a KTX 2 file, with libktx's Basis Universal encoder: the blocks go through RDO (rate-distortion optimization, which makes them compress better) and the levels are supercompressed with zstd. A color or data texture and a normal map get different settings: normal maps skip RDO and take a slower, more accurate encoder level, because errors in a normal are visible as lighting noise. Normal maps stay RGB (libktx's own "normal map" mode would keep two channels as RRRG, which the shaders do not read). The encoder is slow, which is what the import cache is for; it is deterministic.
Loads models and textures the way a game wants them: the imported artifact when there is one (imported/ is at
mod://id/imported). It does not check that the artifact is current: importing is the step that does.
PNG and JPEG images into KTX 2 files with their mip chains, GPU-compressed (
An asset being imported: its bytes, its settings, and the files it reads, which become the artifact's dependencies.
One artifact of the import: the source it came from, what it was made from, and the file.
What
What an importer made: the artifact's bytes and the extension that is added to the source's name (.amodel).
What an <asset>.import.xml file next to an asset says about importing it.
Writes a 2D texture of 8-bit RGBA with its mip chain as a KTX 2 file, uncompressed (supercompressionScheme 0): the header, the level index, a data format descriptor that
says what the bytes are (RGBA, sRGB or linear), and the levels, smallest first as the format requires. zstdLevel each level is compressed with zstd (supercompressionScheme 2, which libktx inflates when it loads): the file is smaller, the texture the same. This is not GPU
texture compression: the texture is RGBA8 in memory and on the GPU. That is compression="none" and for textures too small to compress.
The engine's own model file (.amodel): a
glTF models into
A shader compiled with one set of preprocessor defines, listed in a shader's .import.xml as <Variant><Define name="" value=""/></Variant>.
Interfaces¶
One kind of asset
Enums¶
Where one asset stands: what an asset browser shows next to a file.
How an imported texture is stored: GPU-compressed (Basis Universal UASTC inside KTX 2, transcoded when it is loaded) or as 8-bit RGBA.