Only warn when vn with 3 coordinates

This commit is contained in:
Thomas Forgione 2018-11-04 10:47:00 +01:00
parent c9ad3b05a5
commit 258470f203
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
1 changed files with 13 additions and 5 deletions

View File

@ -75,11 +75,19 @@ impl ObjParser {
/// ```
pub fn parse_texture_coordinate(&self, line_number: usize, line: &str, path: &str) -> Result<Element, ParserError> {
let values = parse_values(line_number, line, path, 2)?;
if let Ok(values) = parse_values(line_number,line, path, 2) {
Ok(Element::TextureCoordinate(Vector2::<f64>::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::<f64>::new(
values[0],
values[1],
)))
}
}
/// Parses an obj normal line.