diff --git a/src/parser/obj.rs b/src/parser/obj.rs index cfa25fc..119a026 100644 --- a/src/parser/obj.rs +++ b/src/parser/obj.rs @@ -75,11 +75,19 @@ impl ObjParser { /// ``` pub fn parse_texture_coordinate(&self, line_number: usize, line: &str, path: &str) -> Result { - let values = parse_values(line_number, line, path, 2)?; - Ok(Element::TextureCoordinate(Vector2::::new( - values[0], - values[1], - ))) + if let Ok(values) = parse_values(line_number,line, path, 2) { + Ok(Element::TextureCoordinate(Vector2::::new( + values[0], + values[1], + ))) + } else { + let values = parse_values(line_number, line, path, 3)?; + logln!("Warning: expected 2 coordinates, but received 3, ignoring the last one..."); + Ok(Element::TextureCoordinate(Vector2::::new( + values[0], + values[1], + ))) + } } /// Parses an obj normal line.