startMaterial method
Implementation
ParseStateMaterial startMaterial(String? name, libraries) {
final ParseStateMaterial? previous = _finalize(false);
// New usemtl declaration overwrites an inherited material, except if faces were declared
// after the material, then it must be preserved for proper MultiMaterial continuation.
if (previous != null && (previous.inherited || previous.groupCount <= 0)) {
materials.removeAt(previous.index);
}
final material = ParseStateMaterial({
"index": materials.length,
"name": name ?? '',
"mtllib": (libraries is List && libraries.isNotEmpty? libraries[libraries.length - 1]: ''),
"smooth": (previous != null ? previous.smooth : smooth),
"groupStart": (previous != null ? previous.groupEnd : 0),
"groupEnd": -1,
"groupCount": -1,
"inherited": false
});
materials.add(material);
return material;
}