changeset 680:ef2dbd676a91

Add missing quad size override to stdrenderer.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 16 Aug 2019 13:44:43 +0200
parents 6020e33d4fc4
children 1209e7f855a4
files examples/stdrenderer.rs src/th06/std.rs
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/examples/stdrenderer.rs	Fri Aug 16 13:40:38 2019 +0200
+++ b/examples/stdrenderer.rs	Fri Aug 16 13:44:43 2019 +0200
@@ -12,7 +12,7 @@
 use luminance_glfw::surface::{GlfwSurface, Surface, WindowDim, WindowOpt};
 use touhou::th06::anm0::Anm0;
 use touhou::th06::anm0_vm::{AnmRunner, Sprite, Vertex as FakeVertex};
-use touhou::th06::std::{Stage, Position};
+use touhou::th06::std::{Stage, Position, Box2D};
 use touhou::th06::std_vm::StageRunner;
 use touhou::util::prng::Prng;
 use touhou::util::math::perspective;
@@ -144,9 +144,10 @@
             let begin = vertices.len();
             for quad in model.quads.iter() {
                 let Position { x, y, z } = quad.pos;
+                let Box2D { width, height } = quad.size_override;
 
                 // Create the AnmRunner from the ANM and the sprite.
-                let sprite = Rc::new(RefCell::new(Sprite::new()));
+                let sprite = Rc::new(RefCell::new(Sprite::with_size(width, height)));
                 let _anm_runner = AnmRunner::new(&anm0, quad.anm_script as u8, sprite.clone(), Rc::downgrade(&prng), 0);
                 let mut new_vertices: [Vertex; 6] = unsafe { std::mem::uninitialized() };
                 fill_vertices(sprite.clone(), &mut new_vertices, x, y, z);
--- a/src/th06/std.rs	Fri Aug 16 13:40:38 2019 +0200
+++ b/src/th06/std.rs	Fri Aug 16 13:44:43 2019 +0200
@@ -34,8 +34,11 @@
 /// A 2D box around something.
 #[derive(Debug, Clone)]
 pub struct Box2D {
-    width: f32,
-    height: f32,
+    /// Width.
+    pub width: f32,
+
+    /// Height.
+    pub height: f32,
 }
 
 /// A quad in the 3D space.