revert to non-benchmark
This commit is contained in:
+16
-11
@@ -1,7 +1,7 @@
|
||||
use std::process::exit;
|
||||
|
||||
use crate::constants::*;
|
||||
use crate::tile::{FixtureTile, FloorTile, NeedsOccluded, TileState};
|
||||
use crate::{constants::*, game};
|
||||
use bevy::utils::HashMap;
|
||||
use bevy::{prelude::*, transform};
|
||||
|
||||
@@ -98,6 +98,7 @@ pub fn build_world_sprites(
|
||||
mut cwss: ResMut<CurrentWorldSpriteState>,
|
||||
textures: Res<Textures>,
|
||||
texture_ids: Res<TextureIDs>,
|
||||
z_index: ResMut<game::ZIndex>,
|
||||
) {
|
||||
if cwss.state != WorldSpriteState::WaitingForRender {
|
||||
return;
|
||||
@@ -105,24 +106,28 @@ pub fn build_world_sprites(
|
||||
let now = Instant::now();
|
||||
if cwss.state == WorldSpriteState::WaitingForRender {
|
||||
cwss.state = WorldSpriteState::InProgress;
|
||||
// async/thread this so we don't block the main thread
|
||||
let z_index = (z_index.0 as i32 + 150) as usize;
|
||||
println!("z_index = {}", z_index);
|
||||
|
||||
for (floortile, transform) in query.iter_mut() {
|
||||
let id = floortile.id;
|
||||
let texture_id = texture_ids.refs.get(&id).unwrap();
|
||||
let texture = textures.handles.get(texture_id).unwrap();
|
||||
let sprite = Sprite {
|
||||
image: texture.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
commands.spawn((sprite, *transform));
|
||||
let is_visible =
|
||||
(floortile.visible_range[z_index / 32] & (1 << (z_index % 32) as u32)) != 0;
|
||||
if is_visible {
|
||||
let id = floortile.id;
|
||||
let texture_id = texture_ids.refs.get(&id).unwrap();
|
||||
let texture = textures.handles.get(texture_id).unwrap();
|
||||
let sprite = Sprite {
|
||||
image: texture.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
commands.spawn((sprite, *transform));
|
||||
}
|
||||
}
|
||||
cwss.state = WorldSpriteState::RenderReady;
|
||||
}
|
||||
println!("{:?}", cwss.state);
|
||||
let elapsed = now.elapsed();
|
||||
println!("Elapsed: {:.2?}", elapsed);
|
||||
// exit(0);
|
||||
}
|
||||
|
||||
#[derive(Bundle)]
|
||||
|
||||
Reference in New Issue
Block a user