Work on back projection, f32 -> f64

This commit is contained in:
2018-07-23 10:12:37 +02:00
parent 674b49430f
commit 6807773b38
11 changed files with 89 additions and 109 deletions
+2 -2
View File
@@ -47,10 +47,10 @@ pub enum Element {
/// First string is the name of the map.
/// Second string is the path to the image file.
/// Vector3 is the size of the texture.
Texture(String, String, Vector3<f32>),
Texture(String, String, Vector3<f64>),
/// Change the main color of the current material.
Diffuse(Vector3<f32>),
Diffuse(Vector3<f64>),
/// An unknown material instruction that will be copied into the mtl file.
UnknownMaterialInstruction(String),
+6 -6
View File
@@ -46,9 +46,9 @@ impl LineParser for MtlParser {
"Kd" => {
let values = parse_values(line_number, line, path, 3)?;
Ok(Element::Diffuse(Vector3::new(
values[0] as f32,
values[1] as f32,
values[2] as f32,
values[0] as f64,
values[1] as f64,
values[2] as f64,
)))
},
@@ -63,9 +63,9 @@ impl LineParser for MtlParser {
Ok(Element::Texture(first.to_owned(), full_path.to_str().unwrap().to_owned(), Vector3::new(1.0, 1.0, 1.0)))
} else if split[0] == "-s" {
let size = Vector3::new(
if let Ok(f) = split[1].parse::<f32>() { f } else { return Err(ParserError::ParseNumberError(path.to_owned(), line_number, split[1].to_owned())); },
if let Ok(f) = split[2].parse::<f32>() { f } else { return Err(ParserError::ParseNumberError(path.to_owned(), line_number, split[2].to_owned())); },
if let Ok(f) = split[3].parse::<f32>() { f } else { return Err(ParserError::ParseNumberError(path.to_owned(), line_number, split[3].to_owned())); },
if let Ok(f) = split[1].parse::<f64>() { f } else { return Err(ParserError::ParseNumberError(path.to_owned(), line_number, split[1].to_owned())); },
if let Ok(f) = split[2].parse::<f64>() { f } else { return Err(ParserError::ParseNumberError(path.to_owned(), line_number, split[2].to_owned())); },
if let Ok(f) = split[3].parse::<f64>() { f } else { return Err(ParserError::ParseNumberError(path.to_owned(), line_number, split[3].to_owned())); },
);
let mut full_path = root.clone();
full_path.push(split[4].to_owned());