rust/lib-hedgewars-engine/src/render/gear.rs
changeset 15288 0f734fa371e1
parent 15286 16bd389fc735
child 15290 fcf0fb0cddbf
equal deleted inserted replaced
15287:3bb3fe1cf87c 15288:0f734fa371e1
    46             atlas.used_space()
    46             atlas.used_space()
    47         );
    47         );
    48 
    48 
    49         let texture = Texture2D::new(max_size, gl::RGBA8, gl::LINEAR);
    49         let texture = Texture2D::new(max_size, gl::RGBA8, gl::LINEAR);
    50 
    50 
    51         let mut pixels = Vec::with_capacity(max_size.area()).into_boxed_slice();
    51         let mut pixels = vec![0; max_size.area() * 4].into_boxed_slice();
    52         for (path, sprite_index) in lookup.drain(..) {
    52         for (path, sprite_index) in lookup.drain(..) {
    53             if let Some((atlas_index, rect)) = atlas.get_rect(sprite_index) {
    53             if let Some((atlas_index, rect)) = atlas.get_rect(sprite_index) {
    54                 load_sprite_pixels(&path, &mut pixels[..]).expect("Unable to load Graphics");
    54                 load_sprite_pixels(&path, &mut pixels[..]).expect("Unable to load Graphics");
    55                 texture.update(rect, &pixels, 0, gl::RGBA, gl::UNSIGNED_BYTE);
    55                 texture.update(rect, &pixels, 0, gl::RGBA, gl::UNSIGNED_BYTE);
    56             }
    56             }