comparison examples/anmrenderer.rs @ 743:0fed350d1778

examples: Remove deprecated std::mem::uninitialized().
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 07 Jan 2020 12:34:11 +0100
parents 0a250ddfae79
children 5e5e7136ac92
comparison
equal deleted inserted replaced
742:0a250ddfae79 743:0fed350d1778
130 // Create the AnmRunner from the ANM and the sprite. 130 // Create the AnmRunner from the ANM and the sprite.
131 let anms = Rc::new(RefCell::new([anm0])); 131 let anms = Rc::new(RefCell::new([anm0]));
132 let mut anm_runner = AnmRunner::new(anms, script, sprite.clone(), Rc::downgrade(&prng), 0); 132 let mut anm_runner = AnmRunner::new(anms, script, sprite.clone(), Rc::downgrade(&prng), 0);
133 133
134 assert_eq!(std::mem::size_of::<Vertex>(), std::mem::size_of::<FakeVertex>()); 134 assert_eq!(std::mem::size_of::<Vertex>(), std::mem::size_of::<FakeVertex>());
135 let mut vertices: [Vertex; 4] = unsafe { std::mem::uninitialized() }; 135 let mut vertices: [Vertex; 4] = {
136 let data = std::mem::MaybeUninit::uninit();
137 unsafe { data.assume_init() }
138 };
136 fill_vertices(sprite.clone(), &mut vertices); 139 fill_vertices(sprite.clone(), &mut vertices);
137 140
138 // set the uniform interface to our type so that we can read textures from the shader 141 // set the uniform interface to our type so that we can read textures from the shader
139 let program = 142 let program =
140 Program::<Semantics, (), ShaderInterface>::from_strings(None, VS, None, FS).expect("program creation").ignore_warnings(); 143 Program::<Semantics, (), ShaderInterface>::from_strings(None, VS, None, FS).expect("program creation").ignore_warnings();