comparison examples/stagerunner.rs @ 742:0a250ddfae79

examples: Update luminance.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 07 Jan 2020 00:23:15 +0100
parents 3555845f8cf4
children 0fed350d1778
comparison
equal deleted inserted replaced
741:3555845f8cf4 742:0a250ddfae79
1 use luminance::blending::{Equation, Factor}; 1 use luminance::blending::{Equation, Factor};
2 use luminance::context::GraphicsContext; 2 use luminance::context::GraphicsContext;
3 use luminance::pipeline::BoundTexture; 3 use luminance::pipeline::{BoundTexture, PipelineState};
4 use luminance::pixel::NormUnsigned; 4 use luminance::pixel::NormUnsigned;
5 use luminance::render_state::RenderState; 5 use luminance::render_state::RenderState;
6 use luminance::shader::program::{Program, Uniform}; 6 use luminance::shader::program::{Program, Uniform};
7 use luminance::tess::{Mode, TessBuilder}; 7 use luminance::tess::{Mode, TessBuilder};
8 use luminance::texture::{Dim2, Flat}; 8 use luminance::texture::{Dim2, Flat};
201 201
202 // here, we need to bind the pipeline variable; it will enable us to bind the texture to the GPU 202 // here, we need to bind the pipeline variable; it will enable us to bind the texture to the GPU
203 // and use it in the shader 203 // and use it in the shader
204 surface 204 surface
205 .pipeline_builder() 205 .pipeline_builder()
206 .pipeline(&back_buffer, [0., 0., 0., 0.], |pipeline, mut shd_gate| { 206 .pipeline(&back_buffer, &PipelineState::default(), |pipeline, mut shd_gate| {
207 // bind our fancy texture to the GPU: it gives us a bound texture we can use with the shader 207 // bind our fancy texture to the GPU: it gives us a bound texture we can use with the shader
208 let bound_tex = match &tex { 208 let bound_tex = match &tex {
209 LoadedTexture::Rgb(tex) => pipeline.bind_texture(tex), 209 LoadedTexture::Rgb(tex) => pipeline.bind_texture(tex),
210 LoadedTexture::Rgba(tex) => pipeline.bind_texture(tex), 210 LoadedTexture::Rgba(tex) => pipeline.bind_texture(tex),
211 }; 211 };
223 iface.mvp.update(*mvp.borrow_inner()); 223 iface.mvp.update(*mvp.borrow_inner());
224 224
225 let render_state = RenderState::default() 225 let render_state = RenderState::default()
226 .set_blending((Equation::Additive, Factor::SrcAlpha, Factor::SrcAlphaComplement)); 226 .set_blending((Equation::Additive, Factor::SrcAlpha, Factor::SrcAlphaComplement));
227 227
228 rdr_gate.render(render_state, |mut tess_gate| { 228 rdr_gate.render(&render_state, |mut tess_gate| {
229 let mut game = game.borrow_mut(); 229 let mut game = game.borrow_mut();
230 game.run_frame(); 230 game.run_frame();
231 231
232 for (x, y, z, sprite) in game.get_sprites() { 232 for (x, y, z, sprite) in game.get_sprites() {
233 { 233 {