diff src/th06/anm0_vm.rs @ 661:598f3125cbac

Implement enough instructions to execute sub 0 from stage 1.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 10 Aug 2019 21:04:54 +0200
parents 3a9d82a02c88
children b6c351ca0a35
line wrap: on
line diff
--- a/src/th06/anm0_vm.rs
+++ b/src/th06/anm0_vm.rs
@@ -87,7 +87,7 @@ impl Sprite {
     }
 
     /// TODO
-    pub fn fill_vertices(&self, vertices: &mut [Vertex; 4]) {
+    pub fn fill_vertices(&self, vertices: &mut [Vertex; 4], x: f32, y: f32, z: f32) {
         let mut mat = Mat4::new([[-0.5, 0.5, 0.5, -0.5],
                                  [-0.5, -0.5, 0.5, 0.5],
                                  [0., 0., 0., 0.],
@@ -127,6 +127,8 @@ impl Sprite {
             mat.translate_2d(width / 2., height / 2.);
         }
 
+        mat.translate([x, y, z]);
+
         let mat = mat.borrow_inner();
         vertices[0].pos[0] = mat[0][0] as i16;
         vertices[0].pos[1] = mat[1][0] as i16;