Mercurial > touhou
diff examples/anmrenderer.rs @ 706:bca515da9047
examples: use common module.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 23 Aug 2019 19:46:47 +0200 |
parents | ed65f9412bc0 |
children | 987409d48991 |
line wrap: on
line diff
--- a/examples/anmrenderer.rs +++ b/examples/anmrenderer.rs @@ -21,8 +21,7 @@ use std::path::Path; #[path = "common.rs"] mod common; - -use common::{load_file_into_vec, load_rgb_png, load_rgb_a_pngs, LoadedTexture}; +use common::{load_file_into_vec, load_anm_image, LoadedTexture}; const VS: &str = r#" in ivec3 in_position; @@ -135,16 +134,7 @@ fn main() { let mut surface = GlfwSurface::new(WindowDim::Windowed(384, 448), "Touhou", WindowOpt::default()).unwrap(); // Open the image atlas matching this ANM. - let png_filename = anm_filename.with_file_name(Path::new(&anm0.png_filename).file_name().unwrap()); - let tex = match anm0.alpha_filename { - Some(ref filename) => { - let alpha_filename = anm_filename.with_file_name(Path::new(filename).file_name().unwrap()); - load_rgb_a_pngs(&mut surface, &png_filename, &alpha_filename).expect("texture loading") - }, - None => { - load_rgb_png(&mut surface, &png_filename).expect("texture loading") - } - }; + let tex = load_anm_image(&mut surface, &anm0, anm_filename); // set the uniform interface to our type so that we can read textures from the shader let (program, _) =