change drawing event order
This commit is contained in:
@@ -8,12 +8,12 @@ use player::Player;
|
||||
|
||||
use crate::game::entities::{FpsCounter, UiQuad, WorldQuad};
|
||||
use crate::text::create_brush;
|
||||
use crate::vulkan::pipelines::vs;
|
||||
use crate::{config::LogConfig, vulkan};
|
||||
use crate::input::InputState;
|
||||
use crate::vulkan::{Game, MeshHandle, TextVertex, Vertex, VulkanRenderer};
|
||||
use crate::vulkan::gameobject::{GameObject, GameObjectHandle, Updatable};
|
||||
use crate::vulkan::mesh;
|
||||
use crate::vulkan::pipelines::vs::ty::ObjectUniformData;
|
||||
|
||||
pub mod player;
|
||||
mod level;
|
||||
@@ -44,6 +44,7 @@ pub struct TestGame {
|
||||
pub last_time: f32,
|
||||
pub components: Vec<Box<dyn Updatable>>,
|
||||
pub game_state: GameState,
|
||||
pub ubo: vs::ty::ObjectUniformData,
|
||||
}
|
||||
|
||||
impl Game for TestGame {
|
||||
@@ -55,7 +56,7 @@ impl Game for TestGame {
|
||||
self.input.on_window_event(event);
|
||||
}
|
||||
|
||||
fn update(self: &mut Self, renderer: &mut VulkanRenderer) -> ObjectUniformData {
|
||||
fn update(self: &mut Self, renderer: &mut VulkanRenderer) {
|
||||
let precise_start = Instant::now();
|
||||
|
||||
// Input and timing
|
||||
@@ -113,10 +114,7 @@ impl Game for TestGame {
|
||||
self.last_time = time;
|
||||
self.input.frame_end();
|
||||
|
||||
let precise_duration = precise_start.elapsed().as_micros();
|
||||
renderer.game_data.update_perf_counters[renderer.game_data.performance_counter_index] = precise_duration;
|
||||
|
||||
ObjectUniformData {
|
||||
self.ubo = vs::ty::ObjectUniformData {
|
||||
view: self.player.camera.view.into(),
|
||||
projection: self.player.camera.proj.into(),
|
||||
ortho_projection: self.player.camera.ortho_proj.into(),
|
||||
@@ -127,7 +125,14 @@ impl Game for TestGame {
|
||||
_dummy0: [0; 12],
|
||||
_dummy1: [0; 4],
|
||||
_dummy2: [0; 4],
|
||||
}
|
||||
};
|
||||
|
||||
let precise_duration = precise_start.elapsed().as_micros();
|
||||
renderer.game_data.update_perf_counters[renderer.game_data.performance_counter_index] = precise_duration;
|
||||
}
|
||||
|
||||
fn get_ubo(&self) -> &vs::ty::ObjectUniformData {
|
||||
&self.ubo
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +146,19 @@ impl TestGame {
|
||||
texture_index_counter: 0,
|
||||
last_time: 0.0,
|
||||
components: vec![],
|
||||
game_state: GameState::new()
|
||||
game_state: GameState::new(),
|
||||
ubo: vs::ty::ObjectUniformData {
|
||||
view: [[0.; 4]; 4],
|
||||
projection: [[0.; 4]; 4],
|
||||
ortho_projection: [[0.; 4]; 4],
|
||||
time: 0.,
|
||||
light_position: [0.; 3],
|
||||
light_directional_rotation: [0.; 3],
|
||||
camera_position: [0.; 3],
|
||||
_dummy0: [0; 12],
|
||||
_dummy1: [0; 4],
|
||||
_dummy2: [0; 4],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user