robvandenbogaard/elm-obj-file/1.1.0

Mtl.Decode

Decoding

{ createMaterial : MaterialCreator material }
-> String
-> Result String (MaterialLibrary material)

Decode an mtl data string into a material library. This can fail so a Result is returned which can hold an error message if parsing fails.

Material

type alias MaterialCreator material =
String -> List String -> Maybe material -> Maybe material

A MaterialCreator is a function that takes a name, a list of words from the current Mtl line, and maybe the material that was already in the material library under the name. It outputs a material if successfully created from the given information, but it can also decide to not return a material even though it could, leaving the library unchanged.

This is subject to change as the rationale for it is not entirely clear, suspecting the mechanism can be simpler.

type alias MaterialLibrary material =
Dict String material

A library of materials, a dictionary mapping names to materials.