pub fn read_obj_with_materials(
text: &str,
open: &mut dyn FnMut(&str) -> Option<Vec<u8>>,
) -> OgeomResult<ObjImport>Expand description
Read an OBJ with the colours its materials give it.
The mesh is the one read_obj reads. Each library mtllib names is
asked of open by the name the OBJ gives it, and each texture a
library’s map_Kd names by the name the library gives it; open
answers with the file’s bytes, or None where there is no such file.
A triangle takes the colour of the material usemtl last named before
it: with a texture and texture coordinates at its corners, the texel at
each corner’s coordinate (after the -o offset and -s scale the
statement gives; repeating outside [0, 1], or clamped under
-clamp on); otherwise the material’s Kd. A texture stands for the
diffuse colour rather than scaling Kd, as scan textures are written
to be shown. Alpha is the material’s d (or one less its Tr), times
the texel’s. Textures are PNG or JPEG.
What cannot be opened or decoded (a library, a texture, a material the
libraries do not define) is a warning, and the triangles it would have
coloured fall back as above or go without. Colours are returned only
where every triangle has one; see ObjImport::colours.
§Errors
As read_obj.