mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-25 08:18:43 -06:00
:3
This commit is contained in:
parent
1d4cbcc2b1
commit
c32568af1c
|
@ -79,8 +79,9 @@ use player_controller::{debug_switch_ctl_type, update_player_controllers};
|
||||||
// clear_background, entities::render_entities, init_window_size, primitives::init_primitives, resize_renderer, selection_box::render_selection_box, sumberge::render_submerged_view, update_window_size, world::{draw_current_chunk_border, draw_world, draw_world_trans, init_trans_chunk_queue}, BackgroundColor, RenderTarget, Renderer
|
// clear_background, entities::render_entities, init_window_size, primitives::init_primitives, resize_renderer, selection_box::render_selection_box, sumberge::render_submerged_view, update_window_size, world::{draw_current_chunk_border, draw_world, draw_world_trans, init_trans_chunk_queue}, BackgroundColor, RenderTarget, Renderer
|
||||||
// };
|
// };
|
||||||
use rendering::{
|
use rendering::{
|
||||||
render_master, init_window_size, resize_renderer, update_window_size,
|
init_window_size, render_master, resize_renderer, update_window_size,
|
||||||
BackgroundColor, Renderer
|
world::{init_trans_chunk_queue, TransChunkQueue},
|
||||||
|
BackgroundColor, Renderer,
|
||||||
};
|
};
|
||||||
use block_placement::update_block_placement;
|
use block_placement::update_block_placement;
|
||||||
use delta_time::{DeltaTime, init_delta_time};
|
use delta_time::{DeltaTime, init_delta_time};
|
||||||
|
@ -126,7 +127,6 @@ fn startup() -> Workload {
|
||||||
init_client_physics,
|
init_client_physics,
|
||||||
init_chat_manager,
|
init_chat_manager,
|
||||||
init_crosshair_image,
|
init_crosshair_image,
|
||||||
//init_trans_chunk_queue,
|
|
||||||
).into_sequential_workload()
|
).into_sequential_workload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@ fn update() -> Workload {
|
||||||
process_inputs,
|
process_inputs,
|
||||||
kubi_ui_begin,
|
kubi_ui_begin,
|
||||||
(
|
(
|
||||||
|
init_trans_chunk_queue.run_if_missing_unique::<TransChunkQueue>(),
|
||||||
init_game_world.run_if_missing_unique::<ChunkTaskManager>(),
|
init_game_world.run_if_missing_unique::<ChunkTaskManager>(),
|
||||||
(
|
(
|
||||||
spawn_player.run_if_storage_empty::<MainPlayer>(),
|
spawn_player.run_if_storage_empty::<MainPlayer>(),
|
||||||
|
|
|
@ -8,7 +8,7 @@ use winit::{
|
||||||
dpi::PhysicalSize
|
dpi::PhysicalSize
|
||||||
};
|
};
|
||||||
use glam::{Vec3, UVec2};
|
use glam::{Vec3, UVec2};
|
||||||
use crate::{events::WindowResizedEvent, settings::{GameSettings, FullscreenMode}};
|
use crate::{events::WindowResizedEvent, settings::{FullscreenMode, GameSettings}, state::is_ingame};
|
||||||
|
|
||||||
pub mod primitives;
|
pub mod primitives;
|
||||||
pub mod world;
|
pub mod world;
|
||||||
|
@ -188,7 +188,7 @@ pub fn render_master(storages: AllStoragesViewMut) {
|
||||||
let surface_texture = renderer.surface().get_current_texture().unwrap();
|
let surface_texture = renderer.surface().get_current_texture().unwrap();
|
||||||
let surface_view = surface_texture.texture.create_view(&wgpu::TextureViewDescriptor::default());
|
let surface_view = surface_texture.texture.create_view(&wgpu::TextureViewDescriptor::default());
|
||||||
|
|
||||||
{
|
if storages.run(is_ingame) {
|
||||||
let bg_color = storages.borrow::<UniqueView<BackgroundColor>>().unwrap();
|
let bg_color = storages.borrow::<UniqueView<BackgroundColor>>().unwrap();
|
||||||
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||||
label: Some("main0_pass"),
|
label: Some("main0_pass"),
|
||||||
|
@ -209,6 +209,10 @@ pub fn render_master(storages: AllStoragesViewMut) {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let data = (&mut render_pass, &*renderer);
|
||||||
|
|
||||||
|
storages.run_with_data(world::draw_world, data);
|
||||||
|
|
||||||
// render_pass.set_pipeline(&renderer.pipeline);
|
// render_pass.set_pipeline(&renderer.pipeline);
|
||||||
// render_pass.set_bind_group(0, &renderer.bind_group, &[]);
|
// render_pass.set_bind_group(0, &renderer.bind_group, &[]);
|
||||||
// render_pass.set_vertex_buffer(0, renderer.vertex_buffer.slice(..));
|
// render_pass.set_vertex_buffer(0, renderer.vertex_buffer.slice(..));
|
||||||
|
|
|
@ -1,29 +1,9 @@
|
||||||
// use glam::{ivec3, IVec3, Mat4, Quat, Vec3};
|
|
||||||
// use shipyard::{track, AllStoragesView, IntoIter, NonSendSync, Unique, UniqueView, UniqueViewMut, View};
|
|
||||||
// use glium::{
|
|
||||||
// draw_parameters::{
|
|
||||||
// BackfaceCullingMode, Depth, DepthTest, PolygonMode
|
|
||||||
// }, implement_vertex, uniform, uniforms::{
|
|
||||||
// MagnifySamplerFilter, MinifySamplerFilter, Sampler, SamplerBehavior, SamplerWrapFunction
|
|
||||||
// }, Blend, DrawParameters, Smooth, Surface
|
|
||||||
// };
|
|
||||||
// use crate::{
|
|
||||||
// camera::Camera,
|
|
||||||
// player::MainPlayer,
|
|
||||||
// transform::Transform,
|
|
||||||
// prefabs::{
|
|
||||||
// ChunkShaderPrefab,
|
|
||||||
// BlockTexturesPrefab,
|
|
||||||
// ColoredShaderPrefab,
|
|
||||||
// },
|
|
||||||
// world::{
|
|
||||||
// ChunkStorage,
|
|
||||||
// ChunkMeshStorage,
|
|
||||||
// chunk::CHUNK_SIZE,
|
|
||||||
// }, settings::GameSettings,
|
|
||||||
// };
|
|
||||||
// use super::{RenderTarget, primitives::cube::CubePrimitive};
|
|
||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
|
use glam::IVec3;
|
||||||
|
use shipyard::{AllStoragesView, NonSendSync, Unique, UniqueView, UniqueViewMut, View};
|
||||||
|
use kubi_shared::transform::Transform;
|
||||||
|
use crate::{camera::Camera, settings::GameSettings, world::{ChunkMeshStorage, ChunkStorage}};
|
||||||
|
use super::Renderer;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Pod, Zeroable)]
|
#[derive(Clone, Copy, Pod, Zeroable)]
|
||||||
#[repr(C, packed)]
|
#[repr(C, packed)]
|
||||||
|
@ -47,12 +27,25 @@ impl ChunkVertex {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[derive(Unique)]
|
#[derive(Unique)]
|
||||||
// pub struct TransChunkQueue(pub Vec<IVec3>);
|
pub struct TransChunkQueue(pub Vec<IVec3>);
|
||||||
|
|
||||||
|
pub fn init_trans_chunk_queue(storages: AllStoragesView) {
|
||||||
|
storages.add_unique(TransChunkQueue(Vec::with_capacity(512)));
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn draw_world(
|
||||||
|
(render_pass, renderer): (&mut wgpu::RenderPass, &Renderer),
|
||||||
|
chunks: UniqueView<ChunkStorage>,
|
||||||
|
meshes: NonSendSync<UniqueView<ChunkMeshStorage>>,
|
||||||
|
transform: View<Transform>,
|
||||||
|
camera: View<Camera>,
|
||||||
|
settings: UniqueView<GameSettings>,
|
||||||
|
mut trans_queue: UniqueViewMut<TransChunkQueue>,
|
||||||
|
) {
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
// pub fn init_trans_chunk_queue(storages: AllStoragesView) {
|
|
||||||
// storages.add_unique(TransChunkQueue(Vec::with_capacity(512)));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn draw_params(settings: &GameSettings) -> DrawParameters {
|
// fn draw_params(settings: &GameSettings) -> DrawParameters {
|
||||||
// DrawParameters {
|
// DrawParameters {
|
||||||
|
|
|
@ -102,6 +102,7 @@ impl ChunkMeshStorage {
|
||||||
pub fn init_game_world(
|
pub fn init_game_world(
|
||||||
storages: AllStoragesView,
|
storages: AllStoragesView,
|
||||||
) {
|
) {
|
||||||
|
log::info!("init_game_world called");
|
||||||
storages.add_unique_non_send_sync(ChunkMeshStorage::new());
|
storages.add_unique_non_send_sync(ChunkMeshStorage::new());
|
||||||
storages.add_unique(ChunkStorage::new());
|
storages.add_unique(ChunkStorage::new());
|
||||||
storages.add_unique(ChunkTaskManager::new());
|
storages.add_unique(ChunkTaskManager::new());
|
||||||
|
|
Loading…
Reference in a new issue