Remove the wavefront object loader for now...
[mandelwow.git] / support / mod.rs
index b71f50d7c50a2f84c18b4bfb2702771087623f82..add172f33632c53ebec10cc9947c561fb34fe67a 100644 (file)
@@ -1,8 +1,5 @@
 #![allow(dead_code)]
 
-extern crate genmesh;
-extern crate obj;
-
 use glium::{self, Display};
 use glium::vertex::VertexBufferAny;
 
@@ -22,46 +19,3 @@ pub fn start_loop<F>(mut callback: F) where F: FnMut() -> Action {
         };
     }
 }
-
-/// Returns a vertex buffer that should be rendered as `TrianglesList`.
-pub fn load_wavefront(display: &Display, data: &[u8]) -> VertexBufferAny {
-    #[derive(Copy, Clone)]
-    struct Vertex {
-        position: [f32; 3],
-        normal: [f32; 3],
-        texture: [f32; 2],
-    }
-
-    implement_vertex!(Vertex, position, normal, texture);
-
-    let mut data = ::std::io::BufReader::new(data);
-    let data = obj::Obj::load(&mut data);
-
-    let mut vertex_data = Vec::new();
-
-    for object in data.object_iter() {
-        for shape in object.group_iter().flat_map(|g| g.indices().iter()) {
-            match shape {
-                &genmesh::Polygon::PolyTri(genmesh::Triangle { x: v1, y: v2, z: v3 }) => {
-                    for v in [v1, v2, v3].iter() {
-                        let position = data.position()[v.0];
-                        let texture = v.1.map(|index| data.texture()[index]);
-                        let normal = v.2.map(|index| data.normal()[index]);
-
-                        let texture = texture.unwrap_or([0.0, 0.0]);
-                        let normal = normal.unwrap_or([0.0, 0.0, 0.0]);
-
-                        vertex_data.push(Vertex {
-                            position: position,
-                            normal: normal,
-                            texture: texture,
-                        })
-                    }
-                },
-                _ => unimplemented!()
-            }
-        }
-    }
-
-    glium::vertex::VertexBuffer::new(display, &vertex_data).unwrap().into_vertex_buffer_any()
-}