Rename State to RenderState

This commit is contained in:
Maximilian Ammann 2022-01-13 16:06:17 +01:00
parent 697f3138f6
commit 3a230010ca
4 changed files with 11 additions and 11 deletions

View File

@ -7,7 +7,7 @@ use winit::window::Window;
use crate::input::camera_controller::CameraController;
use crate::render::camera::Camera;
use crate::render::state::State;
use crate::render::render_state::RenderState;
mod camera_controller;
@ -35,7 +35,7 @@ impl InputHandler {
pub fn device_input(
&mut self,
event: &DeviceEvent,
state: &mut State,
state: &mut RenderState,
window: &Window,
) -> bool {
match event {
@ -60,7 +60,7 @@ impl InputHandler {
pub fn window_input(
&mut self,
event: &WindowEvent,
state: &mut State,
state: &mut RenderState,
window: &Window,
) -> bool {
match event {
@ -159,7 +159,7 @@ impl InputHandler {
}
}
pub fn update_state(&mut self, state: &mut State, dt: Duration) {
pub fn update_state(&mut self, state: &mut RenderState, dt: Duration) {
let scene = &mut state.scene;
self.camera_controller.update_camera(&mut state.camera, dt);

View File

@ -6,7 +6,7 @@ use winit::event_loop::{ControlFlow, EventLoop};
use crate::input::InputHandler;
use crate::io::cache::Cache;
use crate::platform::Instant;
use crate::render::state::State;
use crate::render::render_state::RenderState;
pub async fn setup(window: winit::window::Window, event_loop: EventLoop<()>, cache: Box<Cache>) {
info!("== mapr ==");
@ -14,10 +14,10 @@ pub async fn setup(window: winit::window::Window, event_loop: EventLoop<()>, cac
fetch_munich_tiles(cache.as_ref());
let mut input = InputHandler::new();
let mut maybe_state: Option<State> = if cfg!(target_os = "android") {
let mut maybe_state: Option<RenderState> = if cfg!(target_os = "android") {
None
} else {
Some(State::new(&window).await)
Some(RenderState::new(&window).await)
};
let mut last_render_time = Instant::now();
@ -32,7 +32,7 @@ pub async fn setup(window: winit::window::Window, event_loop: EventLoop<()>, cac
use tokio::task;
let state = task::block_in_place(|| {
Handle::current().block_on(async { State::new(&window).await })
Handle::current().block_on(async { RenderState::new(&window).await })
});
maybe_state = Some(state);
return;

View File

@ -5,5 +5,5 @@ mod stencil_pattern;
mod texture;
pub mod camera;
pub mod render_state;
pub mod shader_ffi;
pub mod state;

View File

@ -35,7 +35,7 @@ const INDICES_BUFFER_SIZE: BufferAddress = 1024 * 1024 * 8;
const TILE_META_COUNT: BufferAddress = 512; // FIXME: Move this to BufferPool
const TILE_MASK_INSTANCE_COUNT: BufferAddress = 512; // FIXME: Pick reasonable size
pub struct State {
pub struct RenderState {
instance: wgpu::Instance,
device: wgpu::Device,
@ -80,7 +80,7 @@ impl SceneParams {
}
}
impl State {
impl RenderState {
pub async fn new(window: &Window) -> Self {
let mut measure = Measure::time();