Class UnpackedDecoder

Class Documentation

class UnpackedDecoder

Decoder for unpacked file formats.

Public Functions

std::array<libcacaoimage::Image, 6> DecodeCubemap(std::istream &data, std::function<std::unique_ptr<std::istream>(const std::string&)> loader)

Extract and decode the images in a cubemap.

Parameters:
  • data – A stream to load cubemap YAML data from

  • loader – A function to get streams from names referenced in the main cubemap file. Set the “badbit” flag on the stream before returning to indicate a failed load.

Throws:

std::runtime_error – If the data does not represent a valid cubemap or the provided IO callback fails to load faces

Returns:

Decoded cubemap faces in the order of +X face, -X face, +Y face, -Y face, +Z face, -Z face

Material DecodeMaterial(std::istream &data)

Extract the data from an unpacked material.

Parameters:

data – A stream to load material YAML data from

Throws:

std::runtime_error – If the data does not represent a valid material

Returns:

Material object with shader reference string and data

World DecodeWorld(std::istream &data)

Extract the data from an unpacked world.

Parameters:

data – A stream to load world YAML data from

Throws:

std::runtime_error – If the data does not represent a valid world

Returns:

World object containing the initial state of the world