Add multiple material process
This commit is contained in:
+13
-6
@@ -214,7 +214,7 @@ struct RenderContext {
|
||||
render_pass: Arc<RenderPass>,
|
||||
framebuffers: Vec<Arc<Framebuffer>>,
|
||||
color_buffer: Arc<ImageView>,
|
||||
material: Arc<ImageView>,
|
||||
material_buffer: Arc<ImageView>,
|
||||
normal_buffer: Arc<ImageView>,
|
||||
depth_buffer: Arc<ImageView>,
|
||||
shader_modules: ShaderModules,
|
||||
@@ -840,7 +840,7 @@ impl ApplicationHandler for App {
|
||||
depth_range: 0.0..=1.0,
|
||||
};
|
||||
|
||||
let (framebuffers, color_buffer, material, normal_buffer, depth_buffer) =
|
||||
let (framebuffers, color_buffer, material_buffer, normal_buffer, depth_buffer) =
|
||||
framebuffer_generation(&images, &render_pass, &self.memory_allocator);
|
||||
|
||||
let lighting_pipeline = pipeline_recompile(
|
||||
@@ -873,7 +873,7 @@ impl ApplicationHandler for App {
|
||||
render_pass,
|
||||
framebuffers,
|
||||
color_buffer,
|
||||
material,
|
||||
material_buffer,
|
||||
normal_buffer,
|
||||
depth_buffer,
|
||||
shader_modules,
|
||||
@@ -1043,7 +1043,7 @@ impl App {
|
||||
(
|
||||
rcx.framebuffers,
|
||||
rcx.color_buffer,
|
||||
rcx.material,
|
||||
rcx.material_buffer,
|
||||
rcx.normal_buffer,
|
||||
rcx.depth_buffer,
|
||||
) = framebuffer_generation(&new_images, &rcx.render_pass, &self.memory_allocator);
|
||||
@@ -1266,7 +1266,10 @@ impl App {
|
||||
let normals_set = DescriptorSet::new(
|
||||
self.descriptor_set_allocator.clone(),
|
||||
normals_layout.clone(),
|
||||
[WriteDescriptorSet::image_view(0, rcx.depth_buffer.clone())],
|
||||
[
|
||||
WriteDescriptorSet::image_view(0, rcx.material_buffer.clone()),
|
||||
WriteDescriptorSet::image_view(1, rcx.depth_buffer.clone()),
|
||||
],
|
||||
[],
|
||||
)
|
||||
.unwrap();
|
||||
@@ -1336,7 +1339,7 @@ impl App {
|
||||
RenderPassBeginInfo {
|
||||
clear_values: vec![
|
||||
Some([0.0, 0.0, 0.0, 1.0].into()),
|
||||
Some(ClearValue::Uint([0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF])),
|
||||
Some(ClearValue::Uint([0, 0, 0, 0])),
|
||||
Some([0.12, 0.1, 0.1, 1.0].into()),
|
||||
Some([0.0, 0.0, 0.0, 1.0].into()),
|
||||
Some(1.0.into()),
|
||||
@@ -1384,6 +1387,8 @@ impl App {
|
||||
|
||||
interval_check(csg, &mut push_constants);
|
||||
|
||||
push_constants.material = i as _;
|
||||
|
||||
builder
|
||||
.push_constants(
|
||||
rcx.implicit_pipelines[i].layout().clone(),
|
||||
@@ -1429,6 +1434,8 @@ impl App {
|
||||
* Mat4::from_scale(csg.scale * 2.0))
|
||||
.to_cols_array_2d();
|
||||
|
||||
push_constants.material = i as _;
|
||||
|
||||
builder
|
||||
.push_constants(rcx.normals_pipelines[i].layout().clone(), 0, push_constants)
|
||||
.unwrap();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
layout(location = 0) in vec2 v_pos;
|
||||
|
||||
layout(input_attachment_index = 0, set = 1, binding = 0) uniform subpassInput u_material;
|
||||
layout(input_attachment_index = 0, set = 1, binding = 0) uniform usubpassInput u_material;
|
||||
layout(input_attachment_index = 1, set = 1, binding = 1) uniform subpassInput u_depth;
|
||||
|
||||
layout(location = 0) out vec4 f_color;
|
||||
|
||||
Reference in New Issue
Block a user