Fix image generation
This commit is contained in:
parent
49c716e0e4
commit
5248070a0f
3 changed files with 17 additions and 28 deletions
|
@ -24,9 +24,7 @@ impl BackgroundGenerator {
|
||||||
let image = Image::empty(
|
let image = Image::empty(
|
||||||
*width as u32,
|
*width as u32,
|
||||||
*height as u32,
|
*height as u32,
|
||||||
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
|
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||||
| VK_IMAGE_USAGE_SAMPLED_BIT
|
|
||||||
| VK_IMAGE_USAGE_TRANSFER_SRC_BIT,
|
|
||||||
VK_SAMPLE_COUNT_1_BIT,
|
VK_SAMPLE_COUNT_1_BIT,
|
||||||
)
|
)
|
||||||
.format(VK_FORMAT_R8G8B8A8_UNORM)
|
.format(VK_FORMAT_R8G8B8A8_UNORM)
|
||||||
|
@ -109,38 +107,29 @@ impl BackgroundGenerator {
|
||||||
image.width() as f32,
|
image.width() as f32,
|
||||||
0.00,
|
0.00,
|
||||||
image.height() as f32,
|
image.height() as f32,
|
||||||
0.0,
|
-1.0,
|
||||||
1.0,
|
1.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
let command_buffer =
|
let command_buffer =
|
||||||
CommandBuffer::new_primary().build(device.clone(), queue.clone())?;
|
CommandBuffer::new_primary().build(device.clone(), queue.clone())?;
|
||||||
|
|
||||||
// let corners = [
|
|
||||||
// vec2(0.0, 0.0),
|
|
||||||
// vec2(0.0, image.height() as f32),
|
|
||||||
// vec2(image.width() as f32, image.height() as f32),
|
|
||||||
// vec2(image.width() as f32, 0.0),
|
|
||||||
// ];
|
|
||||||
|
|
||||||
// angle 70°
|
// angle 70°
|
||||||
let angle: Deg<f32> = Deg(70.0);
|
let angle: Deg<f32> = Deg(70.0);
|
||||||
let tan = angle.0.atan();
|
let tan = angle.0.atan();
|
||||||
|
|
||||||
let corners = [
|
let vertices = PositionOnlyVertex::from_2d_corners(
|
||||||
vec2(0.0, 0.0),
|
ortho,
|
||||||
vec2((image.height() as f32) / tan, image.height() as f32),
|
[
|
||||||
vec2(image.width() as f32, image.height() as f32),
|
vec2(0.0, image.height() as f32),
|
||||||
vec2(image.width() as f32 - (image.height() as f32) / tan, 0.0),
|
vec2((image.height() as f32) / tan, 0.0),
|
||||||
];
|
vec2(image.width() as f32, 0.0),
|
||||||
|
vec2(
|
||||||
println!("width: {} height: {}", image.width(), image.height());
|
image.width() as f32 - (image.height() as f32) / tan,
|
||||||
|
image.height() as f32,
|
||||||
for corner in corners.iter() {
|
),
|
||||||
println!("corner: {:?}", corner);
|
],
|
||||||
}
|
);
|
||||||
|
|
||||||
let vertices = PositionOnlyVertex::from_2d_corners(ortho, corners);
|
|
||||||
|
|
||||||
let vertex_buffer = Buffer::builder()
|
let vertex_buffer = Buffer::builder()
|
||||||
.set_usage(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)
|
.set_usage(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)
|
||||||
|
@ -199,7 +188,7 @@ mod test {
|
||||||
|
|
||||||
let queue_info = Queue::create_non_presentable_request_info(
|
let queue_info = Queue::create_non_presentable_request_info(
|
||||||
&physical_device,
|
&physical_device,
|
||||||
VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_TRANSFER_BIT | VK_QUEUE_COMPUTE_BIT,
|
VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_TRANSFER_BIT,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let device = Device::new(
|
let device = Device::new(
|
||||||
|
|
|
@ -89,7 +89,7 @@ impl Pedals {
|
||||||
history_image.height(),
|
history_image.height(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let ortho = ortho(0.0, history_image.width() as f32, -0.01, 1.01, 0.0, 1.0);
|
let ortho = ortho(0.0, history_image.width() as f32, -0.01, 1.01, -1.0, 1.0);
|
||||||
|
|
||||||
let descriptor_pool = DescriptorPool::builder()
|
let descriptor_pool = DescriptorPool::builder()
|
||||||
.set_layout(pipeline.descriptor_layout().clone())
|
.set_layout(pipeline.descriptor_layout().clone())
|
||||||
|
|
|
@ -105,7 +105,7 @@ impl Radar {
|
||||||
rendering.swapchain().width() as f32,
|
rendering.swapchain().width() as f32,
|
||||||
0.0,
|
0.0,
|
||||||
rendering.swapchain().height() as f32,
|
rendering.swapchain().height() as f32,
|
||||||
0.0,
|
-1.0,
|
||||||
1.0,
|
1.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue