diff --git a/src/graphics_gl.rs b/src/graphics_gl.rs index 4387a88567..aac95ef2bf 100644 --- a/src/graphics_gl.rs +++ b/src/graphics_gl.rs @@ -22,8 +22,8 @@ use std::ptr::null; use std::sync::Arc; use sensor_control::CaptureProvider; use point_cloud; -use point_cloud::point_cloud_compute_shader::PointCloudComputeShader; -use point_cloud::point_cloud_renderer_shader::PointCloudRendererShader; +use point_cloud::gpu_point_cloud_converter::GpuPointCloudConverter; +use point_cloud::point_cloud_renderer::PointCloudRenderer; use point_cloud::point_cloud_visualiser::{PointCloudVisualizer, PointCloudVisualizerError, ColorizationStrategy}; use point_cloud::viewer_image::ViewerImage; use opengl::debug::enable_opengl_debugging; diff --git a/src/graphics_imgui.rs b/src/graphics_imgui.rs index ad9d9b86f1..39f99c2c0a 100644 --- a/src/graphics_imgui.rs +++ b/src/graphics_imgui.rs @@ -127,8 +127,7 @@ pub fn run(capture_provider: Arc, calibration_data: k4a_sys::k4 Image::new(imgui_texture_id, [100.0, 100.0]).build(&ui); ui.separator(); - Image::new(imgui_texture_id_2, [100.0, 100.0]).build(&ui); - ui.separator(); + Image::new(imgui_texture_id_2, [1280.0, 720.0]).build(&ui); ui.separator(); diff --git a/src/point_cloud/point_cloud_compute_shader.rs b/src/point_cloud/gpu_point_cloud_converter.rs similarity index 99% rename from src/point_cloud/point_cloud_compute_shader.rs rename to src/point_cloud/gpu_point_cloud_converter.rs index befc39bdca..34830f3eeb 100644 --- a/src/point_cloud/point_cloud_compute_shader.rs +++ b/src/point_cloud/gpu_point_cloud_converter.rs @@ -104,7 +104,7 @@ void main() /// need to pass this as the format argument to glBindImageTexture(). pub const POINT_CLOUD_TEXTURE_FORMAT : GLuint = gl::RGBA32F; -pub struct PointCloudComputeShader { +pub struct GpuPointCloudConverter { /// The OpenGL program program_id: GLuint, @@ -112,10 +112,10 @@ pub struct PointCloudComputeShader { shader_id: GLuint, /// The x,y table as a texture - xy_table_texture: Texture, + pub xy_table_texture: Texture, /// Preallocated texture for depth image so we don't have to reallocate every frame. - depth_image_texture: Texture, + pub depth_image_texture: Texture, depth_image_pixel_buffer: Buffer, @@ -129,7 +129,7 @@ pub struct PointCloudComputeShader { depth_image_id: GLint, } -impl PointCloudComputeShader { +impl GpuPointCloudConverter { pub fn new() -> Self { let program_id = unsafe { gl::CreateProgram() }; @@ -163,7 +163,7 @@ impl PointCloudComputeShader { println!("Uniform: xy_table_id location = {:?}", xy_table_id); println!("Uniform: depth_image_id location = {:?}", depth_image_id); - PointCloudComputeShader { + GpuPointCloudConverter { program_id, shader_id, dest_tex_id, diff --git a/src/point_cloud/mod.rs b/src/point_cloud/mod.rs index 2e565e2bc4..834d81321b 100644 --- a/src/point_cloud/mod.rs +++ b/src/point_cloud/mod.rs @@ -1,5 +1,5 @@ -pub mod point_cloud_compute_shader; -pub mod point_cloud_renderer_shader; +pub mod gpu_point_cloud_converter; +pub mod point_cloud_renderer; pub mod point_cloud_visualiser; pub mod compile_shader; pub mod pixel_structs; diff --git a/src/point_cloud/point_cloud_renderer_shader.rs b/src/point_cloud/point_cloud_renderer.rs similarity index 98% rename from src/point_cloud/point_cloud_renderer_shader.rs rename to src/point_cloud/point_cloud_renderer.rs index 05a3c96c9f..03c1cebecc 100644 --- a/src/point_cloud/point_cloud_renderer_shader.rs +++ b/src/point_cloud/point_cloud_renderer.rs @@ -17,7 +17,7 @@ use libc; use opengl_wrapper::{Buffer, VertexArray, gl_get_error, OpenGlError}; use opengl_wrapper::Texture; use point_cloud::compile_shader::compile_shader; -use point_cloud::point_cloud_compute_shader::POINT_CLOUD_TEXTURE_FORMAT; +use point_cloud::gpu_point_cloud_converter::POINT_CLOUD_TEXTURE_FORMAT; use graphics_gl::{get_stride, get_pointer_offset}; use point_cloud::pixel_structs::BgraPixel; use point_cloud::point_cloud_visualiser::PointCloudVisualizer; @@ -197,7 +197,7 @@ void main() } "; -pub struct PointCloudRendererShader { +pub struct PointCloudRenderer { /// The OpenGL program shader_program_id: GLuint, @@ -283,7 +283,7 @@ const fn initial_projection_matrix_4x4() -> [f32; 16] { ]; } -impl PointCloudRendererShader { +impl PointCloudRenderer { pub fn new() -> Self { // TODO: Init view and projection matrices @@ -347,7 +347,7 @@ impl PointCloudRendererShader { shader_program_id: program_id, vertex_shader_id, fragment_shader_id, - point_size: 2, + point_size: 5, enable_shading: false, vertex_array_size_bytes: 0, view_index, diff --git a/src/point_cloud/point_cloud_visualiser.rs b/src/point_cloud/point_cloud_visualiser.rs index 778f4bdb72..c22b31bb64 100644 --- a/src/point_cloud/point_cloud_visualiser.rs +++ b/src/point_cloud/point_cloud_visualiser.rs @@ -9,8 +9,8 @@ use opengl_wrapper::OpenGlError; use opengl_wrapper::{Texture, Renderbuffer, Framebuffer}; use point_cloud::pixel_structs::BgraPixel; use point_cloud::pixel_structs::DepthPixel; -use point_cloud::point_cloud_compute_shader::{PointCloudComputeShader, PointCloudComputeError}; -use point_cloud::point_cloud_renderer_shader::{PointCloudRendererShader, PointCloudRendererError}; +use point_cloud::gpu_point_cloud_converter::{GpuPointCloudConverter, PointCloudComputeError}; +use point_cloud::point_cloud_renderer::{PointCloudRenderer, PointCloudRendererError}; use point_cloud::viewer_image::ViewerImage; use rand::Rng; use std::fmt::{Error, Formatter}; @@ -98,8 +98,8 @@ pub struct PointCloudVisualizer { enable_color_point_cloud: bool, colorization_strategy: ColorizationStrategy, - point_cloud_renderer: PointCloudRendererShader, - point_cloud_converter: PointCloudComputeShader, + point_cloud_renderer: PointCloudRenderer, + point_cloud_converter: GpuPointCloudConverter, calibration_data: k4a_sys::k4a_calibration_t, transformation: Transformation, // TODO: WAT k4a_sys::k4a_transformation_t @@ -167,12 +167,12 @@ impl PointCloudVisualizer { } k4a_calibration_type_t;*/ // TODO: generate color xytable only on `enable_color_point_cloud`. - let color_xy_table = PointCloudComputeShader::generate_xy_table( + let color_xy_table = GpuPointCloudConverter::generate_xy_table( calibration_data.clone(), 1, //k4a_sys::K4A_CALIBRATION_TYPE_COLOR, ).unwrap(); - let depth_xy_table = PointCloudComputeShader::generate_xy_table( + let depth_xy_table = GpuPointCloudConverter::generate_xy_table( calibration_data.clone(), 0, // k4a_sys::K4A_CALIBRATION_TYPE_DEPTH, ).unwrap(); @@ -189,8 +189,8 @@ impl PointCloudVisualizer { m_dimensions_width: 1280, // Resolution of the point cloud texture m_dimensions_height: 1152, // ImageDimensions PointCloudVisualizerTextureDimensions = { 1280, 1152 }; enable_color_point_cloud, - point_cloud_renderer: PointCloudRendererShader::new(), - point_cloud_converter: PointCloudComputeShader::new(), + point_cloud_renderer: PointCloudRenderer::new(), + point_cloud_converter: GpuPointCloudConverter::new(), frame_buffer: Framebuffer::new_initialized(), depth_buffer, color_xy_table,