Remove deprecatd emscripten option ERROR_ON_MISSING_LIBRARIES
[mandelwow.git] / mandelwow.rs
index d3b86e6ee1aa0e49779386826dfee6797fc32bc9..1a6516c36f1266e991d916f419e5de0329d63d5d 100644 (file)
@@ -1,11 +1,10 @@
 // Wow. Such fractal.
 
-use cube::Cube;
+use crate::cube::Cube;
 use glium;
 use glium::index::PrimitiveType;
-use glium::Surface;
-use support;
-
+use glium::{Display, Program, Surface, implement_vertex, uniform};
+use crate::support;
 
 /*
 fn mand(cx: f32, cy: f32) -> [f32; 3] {
@@ -28,17 +27,17 @@ fn mand(cx: f32, cy: f32) -> [f32; 3] {
 }
 */
 
-pub fn program(display: &glium::Display) -> glium::Program {
-    return program!(display,
-        140 => {
-            vertex: include_str!("mandelwow.vert"),
-            fragment: include_str!("mandelwow.frag"),
-        }).unwrap();
+pub fn program(display: &Display) -> Program {
+    Program::from_source(
+            display,
+            include_str!("shaders/mandelwow.vert"),
+            include_str!("shaders/mandelwow.frag"), None)
+        .unwrap()
 }
 
-fn mandel<U>(display: &glium::Display,
+fn mandel<U>(display: &Display,
           frame: &mut glium::Frame,
-          program: &glium::Program,
+          program: &Program,
           uniforms: &U,
           bounds: &Cube,
           z: [f32; 2]) where U: glium::uniforms::Uniforms {
@@ -104,9 +103,9 @@ fn mandel<U>(display: &glium::Display,
     frame.draw(&vb, &indices, program, uniforms, &params).unwrap();
 }
 
-pub fn draw(display: &glium::Display,
+pub fn draw(display: &Display,
              mut frame: &mut glium::Frame,
-             program: &glium::Program,
+             program: &Program,
              model: [[f32; 4]; 4],
              camera: &support::camera::CameraState,
              bounds: &Cube,
@@ -129,6 +128,6 @@ pub fn draw(display: &glium::Display,
             perspective: camera.get_perspective(),
         };
 
-        mandel(&display, &mut frame, &program, &uniforms, bounds, z0);
+        mandel(display, &mut frame, program, &uniforms, bounds, z0);
     }
 }