comparison examples/stdrenderer.rs @ 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 ccb739c5b66c
comparison
equal deleted inserted replaced
679:6020e33d4fc4 680:ef2dbd676a91
10 use luminance_derive::{Semantics, Vertex, UniformInterface}; 10 use luminance_derive::{Semantics, Vertex, UniformInterface};
11 use luminance_glfw::event::{Action, Key, WindowEvent}; 11 use luminance_glfw::event::{Action, Key, WindowEvent};
12 use luminance_glfw::surface::{GlfwSurface, Surface, WindowDim, WindowOpt}; 12 use luminance_glfw::surface::{GlfwSurface, Surface, WindowDim, WindowOpt};
13 use touhou::th06::anm0::Anm0; 13 use touhou::th06::anm0::Anm0;
14 use touhou::th06::anm0_vm::{AnmRunner, Sprite, Vertex as FakeVertex}; 14 use touhou::th06::anm0_vm::{AnmRunner, Sprite, Vertex as FakeVertex};
15 use touhou::th06::std::{Stage, Position}; 15 use touhou::th06::std::{Stage, Position, Box2D};
16 use touhou::th06::std_vm::StageRunner; 16 use touhou::th06::std_vm::StageRunner;
17 use touhou::util::prng::Prng; 17 use touhou::util::prng::Prng;
18 use touhou::util::math::perspective; 18 use touhou::util::math::perspective;
19 use std::cell::RefCell; 19 use std::cell::RefCell;
20 use std::fs::File; 20 use std::fs::File;
142 { 142 {
143 for model in stage.models.iter() { 143 for model in stage.models.iter() {
144 let begin = vertices.len(); 144 let begin = vertices.len();
145 for quad in model.quads.iter() { 145 for quad in model.quads.iter() {
146 let Position { x, y, z } = quad.pos; 146 let Position { x, y, z } = quad.pos;
147 let Box2D { width, height } = quad.size_override;
147 148
148 // Create the AnmRunner from the ANM and the sprite. 149 // Create the AnmRunner from the ANM and the sprite.
149 let sprite = Rc::new(RefCell::new(Sprite::new())); 150 let sprite = Rc::new(RefCell::new(Sprite::with_size(width, height)));
150 let _anm_runner = AnmRunner::new(&anm0, quad.anm_script as u8, sprite.clone(), Rc::downgrade(&prng), 0); 151 let _anm_runner = AnmRunner::new(&anm0, quad.anm_script as u8, sprite.clone(), Rc::downgrade(&prng), 0);
151 let mut new_vertices: [Vertex; 6] = unsafe { std::mem::uninitialized() }; 152 let mut new_vertices: [Vertex; 6] = unsafe { std::mem::uninitialized() };
152 fill_vertices(sprite.clone(), &mut new_vertices, x, y, z); 153 fill_vertices(sprite.clone(), &mut new_vertices, x, y, z);
153 new_vertices[4] = new_vertices[0]; 154 new_vertices[4] = new_vertices[0];
154 new_vertices[5] = new_vertices[2]; 155 new_vertices[5] = new_vertices[2];