diff examples/eclrenderer.rs @ 742:0a250ddfae79

examples: Update luminance.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 07 Jan 2020 00:23:15 +0100
parents d5d5496e4e53
children 0fed350d1778
line wrap: on
line diff
--- a/examples/eclrenderer.rs
+++ b/examples/eclrenderer.rs
@@ -1,6 +1,6 @@
 use luminance::blending::{Equation, Factor};
 use luminance::context::GraphicsContext;
-use luminance::pipeline::BoundTexture;
+use luminance::pipeline::{BoundTexture, PipelineState};
 use luminance::pixel::NormUnsigned;
 use luminance::render_state::RenderState;
 use luminance::shader::program::{Program, Uniform};
@@ -108,7 +108,7 @@ fn main() {
     let buf = load_file_into_vec(anm_filename);
     let (_, mut anms) = Anm0::from_slice(&buf).unwrap();
     let anm0 = anms.pop().unwrap();
-    let anm0 = Rc::new(RefCell::new(anm0));
+    let anm0 = Rc::new(RefCell::new([anm0.clone(), anm0]));
 
     if ecl.subs.len() < sub as usize {
         eprintln!("This ecl doesn’t contain a sub named {}.", sub);
@@ -124,7 +124,7 @@ fn main() {
     let game = Rc::new(RefCell::new(game));
 
     // And the enemy object.
-    let enemy = Enemy::new(Position::new(0., 0.), 500, 0, 640, Rc::downgrade(&anm0), Rc::downgrade(&game));
+    let enemy = Enemy::new(Position::new(0., 0.), 500, 0, 640, false, Rc::downgrade(&anm0), Rc::downgrade(&game));
     let mut ecl_runner = EclRunner::new(&ecl, enemy.clone(), sub);
 
     assert_eq!(std::mem::size_of::<Vertex>(), std::mem::size_of::<FakeVertex>());
@@ -133,7 +133,7 @@ fn main() {
     let mut surface = GlfwSurface::new(WindowDim::Windowed(384, 448), "Touhou", WindowOpt::default()).unwrap();
 
     // Open the image atlas matching this ANM.
-    let tex = load_anm_image(&mut surface, &anm0.borrow(), anm_filename).expect("image loading");
+    let tex = load_anm_image(&mut surface, &anm0.borrow()[0], &anm_filename).expect("image loading");
 
     // set the uniform interface to our type so that we can read textures from the shader
     let program =
@@ -190,7 +190,7 @@ fn main() {
         // and use it in the shader
         surface
             .pipeline_builder()
-            .pipeline(&back_buffer, [0., 0., 0., 0.], |pipeline, mut shd_gate| {
+            .pipeline(&back_buffer, &PipelineState::default(), |pipeline, mut shd_gate| {
                 // bind our fancy texture to the GPU: it gives us a bound texture we can use with the shader
                 let bound_tex = match &tex {
                     LoadedTexture::Rgb(tex) => pipeline.bind_texture(tex),
@@ -212,7 +212,7 @@ fn main() {
                     let render_state = RenderState::default()
                         .set_blending((Equation::Additive, Factor::SrcAlpha, Factor::SrcAlphaComplement));
 
-                    rdr_gate.render(render_state, |mut tess_gate| {
+                    rdr_gate.render(&render_state, |mut tess_gate| {
                         // render the tessellation to the surface the regular way and let the vertex shader’s
                         // magic do the rest!
                         tess_gate.render(&tess);