mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-21 14:28:43 -06:00
enable depth texture
This commit is contained in:
parent
8a4549efea
commit
6e9e3fa445
|
@ -7,7 +7,7 @@ use crate::{
|
|||
settings::GameSettings,
|
||||
world::{ChunkMeshStorage, ChunkStorage},
|
||||
};
|
||||
use super::{camera::{self, CameraUniformBuffer}, RenderCtx};
|
||||
use super::{camera::{self, CameraUniformBuffer}, depth::DepthTexture, RenderCtx};
|
||||
|
||||
mod pipeline;
|
||||
mod vertex;
|
||||
|
@ -29,12 +29,13 @@ pub fn init_world_render_state(storages: AllStoragesView) {
|
|||
pub fn draw_world(
|
||||
ctx: &mut RenderCtx,
|
||||
mut state: UniqueViewMut<WorldRenderState>,
|
||||
camera_ubo: UniqueView<CameraUniformBuffer>,
|
||||
depth: UniqueView<DepthTexture>,
|
||||
textures: UniqueView<TexturePrefabs>,
|
||||
camera: View<Camera>,
|
||||
chunks: UniqueView<ChunkStorage>,
|
||||
meshes: NonSendSync<UniqueView<ChunkMeshStorage>>,
|
||||
camera_ubo: UniqueView<CameraUniformBuffer>,
|
||||
settings: UniqueView<GameSettings>,
|
||||
//settings: UniqueView<GameSettings>,
|
||||
) {
|
||||
let camera = camera.iter().next().expect("No cameras in the scene");
|
||||
|
||||
|
@ -48,6 +49,14 @@ pub fn draw_world(
|
|||
store: wgpu::StoreOp::Store,
|
||||
},
|
||||
})],
|
||||
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
|
||||
view: &depth.depth_view,
|
||||
depth_ops: Some(wgpu::Operations {
|
||||
load: wgpu::LoadOp::Clear(1.0),
|
||||
store: wgpu::StoreOp::Store,
|
||||
}),
|
||||
stencil_ops: None,
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use shipyard::{Unique, UniqueView};
|
||||
use shipyard::UniqueView;
|
||||
use crate::{
|
||||
prefabs::TexturePrefabs,
|
||||
rendering::{camera::CameraUniformBuffer, world::ChunkVertex, Renderer}
|
||||
rendering::{camera::CameraUniformBuffer, depth::DepthTexture, world::ChunkVertex, Renderer}
|
||||
};
|
||||
|
||||
pub fn init_world_pipeline(
|
||||
ren: UniqueView<Renderer>,
|
||||
depth: UniqueView<DepthTexture>,
|
||||
textures: UniqueView<TexturePrefabs>,
|
||||
camera_ubo: UniqueView<CameraUniformBuffer>,
|
||||
) -> wgpu::RenderPipeline {
|
||||
|
@ -52,7 +53,13 @@ pub fn init_world_pipeline(
|
|||
polygon_mode: wgpu::PolygonMode::Fill,
|
||||
conservative: false,
|
||||
},
|
||||
depth_stencil: None,
|
||||
depth_stencil: Some(wgpu::DepthStencilState {
|
||||
format: depth.depth_texture.format(),
|
||||
depth_write_enabled: true,
|
||||
depth_compare: wgpu::CompareFunction::Less,
|
||||
stencil: wgpu::StencilState::default(),
|
||||
bias: wgpu::DepthBiasState::default(),
|
||||
}),
|
||||
multisample: wgpu::MultisampleState::default(),
|
||||
multiview: None,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue