Skip to content

Class ModelFile

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

The engine's own model file (.amodel): a as it is after import, ready to load without a glTF parser, its files, or any decoding of images. Vertex and index buffers are compressed with meshoptimizer's codecs (lossless: the model comes back bit for bit), textures are embedded KTX 2 files (), the rest is plain little-endian fields. Loading is far faster than reading the glTF, and the file is smaller than the sources it replaces.

public static class ModelFile

Inheritance

object ← ModelFile

Inherited Members

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

Fields

Magic

public const uint Magic = 1279544641

Field Value

uint

Version

public const uint Version = 1

Field Value

uint

Methods

IsModelFile(ReadOnlySpan<byte>)

public static bool IsModelFile(ReadOnlySpan<byte> file)

Parameters

file ReadOnlySpan<byte>

Returns

bool

Read(ReadOnlySpan<byte>, string, TextureCaps)

public static ModelData Read(ReadOnlySpan<byte> file, string name = "model", TextureCaps caps = default)

Parameters

file ReadOnlySpan<byte>

name string

caps TextureCaps

Returns

ModelData

Exceptions

ContentException

The file is not a model file of this version, or it is damaged.

Write(ModelData, TextureCompression)

public static byte[] Write(ModelData model, TextureCompression compression = TextureCompression.None)

Parameters

model ModelData

The model; its textures are RGBA8.

compression TextureCompression

How the embedded textures are stored. With those that a material uses as a normal map are encoded for accuracy.

Returns

byte[]