diff --git a/editor/src/buffer.rs b/editor/src/buffer.rs index 88cc9f67ff..f28cbcc27b 100644 --- a/editor/src/buffer.rs +++ b/editor/src/buffer.rs @@ -24,9 +24,9 @@ impl QuadBufferBuilder { let coords = rect.top_left_coords; self.push_quad( coords.x, - coords.y - rect.height, - coords.x + rect.width, coords.y, + coords.x + rect.width, + coords.y + rect.height, rect.color, ) } @@ -39,6 +39,10 @@ impl QuadBufferBuilder { max_y: f32, color: [f32; 3], ) -> Self { + // println!("min_x {:?}", min_x); + // println!("min_y {:?}", min_y); + // println!("max_x {:?}", max_x); + // println!("max_y {:?}", max_y); self.vertex_data.extend(&[ Vertex { position: (min_x, min_y).into(), @@ -90,21 +94,9 @@ pub fn create_rect_buffers( ) -> RectBuffers { // Test Rectangles let test_rect_1 = Rect { - top_left_coords: (-0.2, 0.6).into(), - width: 0.1, - height: 0.5, - color: [0.0, 0.0, 1.0], - }; - let test_rect_2 = Rect { - top_left_coords: (-0.5, 0.0).into(), - width: 0.5, - height: 0.5, - color: [0.0, 1.0, 0.0], - }; - let test_rect_3 = Rect { - top_left_coords: (0.3, 0.3).into(), - width: 0.6, - height: 0.1, + top_left_coords: (0.0, 0.0).into(), + width: 400.0, + height: 300.0, color: [1.0, 0.0, 0.0], }; @@ -127,8 +119,6 @@ pub fn create_rect_buffers( let num_rects = { let (stg_vertex, stg_index, num_indices) = QuadBufferBuilder::new() .push_rect(&test_rect_1) - .push_rect(&test_rect_2) - .push_rect(&test_rect_3) .build(&gpu_device); stg_vertex.copy_to_buffer(encoder, &vertex_buffer); diff --git a/editor/src/lib.rs b/editor/src/lib.rs index b15b6920a8..e2f313a74f 100644 --- a/editor/src/lib.rs +++ b/editor/src/lib.rs @@ -71,7 +71,7 @@ impl Uniforms { far: 1.0, } .into(); - + println!("{:?}", ortho); Self { ortho: ortho.into(), } @@ -124,6 +124,7 @@ fn run_event_loop() -> Result<(), Box> { // Prepare swap chain let render_format = wgpu::TextureFormat::Bgra8UnormSrgb; let mut size = window.inner_size(); + println!("size: {:?}", size); let swap_chain_descr = wgpu::SwapChainDescriptor { usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT, @@ -229,7 +230,7 @@ fn run_event_loop() -> Result<(), Box> { if rect_buffers.num_rects > 0 { render_pass.set_pipeline(&rect_pipeline); - render_pass.set_bind_group(1, &ortho_bind_group, &[]); + render_pass.set_bind_group(0, &ortho_bind_group, &[]); render_pass.set_vertex_buffer(0, rect_buffers.vertex_buffer.slice(..)); render_pass.set_index_buffer(rect_buffers.index_buffer.slice(..)); render_pass.draw_indexed(0..rect_buffers.num_rects, 0, 0..1); @@ -314,7 +315,7 @@ fn make_rect_pipeline( &ortho_bind_group_layout ], push_constant_ranges: &[], - label: Some("Pipeline Layout"), + label: Some("Rectangle Pipeline Layout"), }); let pipeline = create_render_pipeline( &gpu_device,