From 2f180e52fce6403d3064a017a6f8a4810e6e71ce Mon Sep 17 00:00:00 2001 From: bmatthieu3 Date: Tue, 6 Sep 2022 11:48:41 +0200 Subject: [PATCH] fix pixel missing --- examples/al-distortion.html | 2 +- src/core/src/camera/viewport.rs | 13 +++++-------- src/core/src/survey/mod.rs | 8 ++++++-- src/core/src/survey/render/rasterizer/uv.rs | 3 +-- src/core/src/survey/view.rs | 2 +- src/js/View.js | 12 ++++++------ 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/al-distortion.html b/examples/al-distortion.html index 7e1ea244..96d76248 100644 --- a/examples/al-distortion.html +++ b/examples/al-distortion.html @@ -27,7 +27,7 @@ aladin.setBaseImageLayer("P/PanSTARRS/DR1/g", {imgFormat: "fits"}); aladin.getBaseImageLayer().setColormap('redtemperature', {stretch: "Asinh"});*/ - aladin = A.aladin('#aladin-lite-div', {survey: 'P/PanSTARRS/DR1/g', fov: 360, target: '0 90', fullScreen: true, cooFrame: 'equatorial', showCooGridControl: true, showSimbadPointerControl: true, showCooGrid: true}); + aladin = A.aladin('#aladin-lite-div', {survey: 'CDS/P/SDSS9/color', fov: 60, target: '0 90', fullScreen: true, cooFrame: 'equatorial', showCooGridControl: true, showSimbadPointerControl: true, showCooGrid: true}); aladin.setProjection('SIN'); //let survey = aladin.createImageSurvey("P/PanSTARRS/DR1/g", null, null, null, null, ); diff --git a/src/core/src/camera/viewport.rs b/src/core/src/camera/viewport.rs index 9ee236a2..83558c73 100644 --- a/src/core/src/camera/viewport.rs +++ b/src/core/src/camera/viewport.rs @@ -93,16 +93,12 @@ impl CameraViewPort { let window = web_sys::window().unwrap(); let width = window.inner_width().unwrap().as_f64().unwrap() as f32; let height = window.inner_height().unwrap().as_f64().unwrap() as f32; + // Clamp it to 3 at maximum, this for limiting the number of pixels drawn let dpi = if window.device_pixel_ratio() as f32 > MAX_DPI_LIMIT { MAX_DPI_LIMIT } else { window.device_pixel_ratio() as f32 }; - // Clamp it to 3 at maximum, this for limiting the number of pixels drawn - - /*if width < height { - dpi = 1.0; - }*/ let width = width * dpi; let height = height * dpi; @@ -286,10 +282,11 @@ impl CameraViewPort { } aperture - } else if !P::ALLOW_UNZOOM_MORE { - P::aperture_start() } else { - self.clip_zoom_factor = (aperture / P::aperture_start()).0; + if P::ALLOW_UNZOOM_MORE { + self.clip_zoom_factor = (aperture / P::aperture_start()).0; + } + P::aperture_start() }; diff --git a/src/core/src/survey/mod.rs b/src/core/src/survey/mod.rs index a5371500..27e0ea8b 100644 --- a/src/core/src/survey/mod.rs +++ b/src/core/src/survey/mod.rs @@ -70,6 +70,11 @@ fn num_subdivision(cell: &HEALPixCell, delta_depth: u8, camera: & let skewed_factor = (center_to_vertex_dist - smallest_center_to_vertex_dist) / (largest_center_to_vertex_dist - smallest_center_to_vertex_dist); + if is_too_large::

(cell, camera) || cell.is_on_pole() || skewed_factor > 0.25 { + num_sub += 1; + } + + /* if skewed_factor > 0.25 { num_sub += 1; } @@ -77,6 +82,7 @@ fn num_subdivision(cell: &HEALPixCell, delta_depth: u8, camera: & if is_too_large::

(cell, camera) || cell.is_on_pole() { num_sub += 1; } + */ num_sub } @@ -1229,8 +1235,6 @@ impl ImageSurveys { (survey.is_allsky() || survey.get_config().get_format() == ImageFormatType::RGB8U) && meta.opacity == 1.0 }); - - if !not_render_transparency_font { let shader_font = get_fontcolor_shader(&self.gl, shaders).bind(&self.gl); shader_font diff --git a/src/core/src/survey/render/rasterizer/uv.rs b/src/core/src/survey/render/rasterizer/uv.rs index 64e5e7b9..0f330268 100644 --- a/src/core/src/survey/render/rasterizer/uv.rs +++ b/src/core/src/survey/render/rasterizer/uv.rs @@ -51,8 +51,7 @@ impl TileUVW { let u = ((idx_row_in_slice as f32) + ((idx_row_in_tex as f32) / nside)) / num_textures_by_side_slice_f32; let v = ((idx_col_in_slice as f32) + ((idx_col_in_tex as f32) / nside)) / num_textures_by_side_slice_f32; - - let ds = 1_f32 / (num_textures_by_side_slice_f32 * nside) - 1_f32 / (texture_slice_px as f32); + let ds = 1_f32 / (num_textures_by_side_slice_f32 * nside); let w = (texture_idx as f32) / (num_textures_by_slice as f32); TileUVW([ diff --git a/src/core/src/survey/view.rs b/src/core/src/survey/view.rs index bc384676..5610ddcc 100644 --- a/src/core/src/survey/view.rs +++ b/src/core/src/survey/view.rs @@ -31,7 +31,7 @@ pub fn depth_from_pixels_on_screen(camera: &CameraViewPort, num_p let two_power_two_times_depth_pixel = std::f32::consts::PI / (3.0 * angle_per_pixel * angle_per_pixel); - let depth_pixel = (two_power_two_times_depth_pixel.log2() / 2.0).floor() as u32; + let depth_pixel = (two_power_two_times_depth_pixel.log2() / 2.0).ceil() as u32; //let survey_max_depth = conf.get_max_depth(); // The depth of the texture diff --git a/src/js/View.js b/src/js/View.js index 7a1a93a2..401a07ad 100644 --- a/src/js/View.js +++ b/src/js/View.js @@ -79,7 +79,7 @@ export let View = (function() { this.mode = View.PAN; this.minFOV = this.maxFOV = null; // by default, no restriction - this.fov_limit = 1000.0; + this.fovLimit = 1000.0; this.healpixGrid = new HealpixGrid(); this.then = Date.now(); @@ -678,7 +678,7 @@ export let View = (function() { // zoom const dist = Math.sqrt(Math.pow(e.originalEvent.touches[0].clientX - e.originalEvent.touches[1].clientX, 2) + Math.pow(e.originalEvent.touches[0].clientY - e.originalEvent.touches[1].clientY, 2)); - const fov = Math.min(Math.max(view.pinchZoomParameters.initialFov * view.pinchZoomParameters.initialDistance / dist, 0.00002777777), view.fov_limit); + const fov = Math.min(Math.max(view.pinchZoomParameters.initialFov * view.pinchZoomParameters.initialDistance / dist, 0.00002777777), view.fovLimit); view.setZoom(fov); return; @@ -1372,8 +1372,8 @@ export let View = (function() { } let new_fov = si / Math.pow(this.pinchZoomParameters.initialAccDelta, alpha); - if (new_fov > this.fov_limit) { - new_fov = this.fov_limit; + if (new_fov > this.fovLimit) { + new_fov = this.fovLimit; //this.pinchZoomParameters.initialAccDelta = Math.pow(si / new_fov, 1.0/alpha); } if (new_fov < 0.00002777777) { @@ -1397,8 +1397,8 @@ export let View = (function() { let new_fov = si / Math.pow(this.pinchZoomParameters.initialAccDelta, alpha); - if (new_fov > this.fov_limit) { - new_fov = this.fov_limit; + if (new_fov > this.fovLimit) { + new_fov = this.fovLimit; //this.pinchZoomParameters.initialAccDelta = Math.pow(si / new_fov, 1.0/alpha); } if (new_fov < 0.00002777777) {