do not call update 2x on the hipses, render the raytracer with depth=1 too

This commit is contained in:
Matthieu Baumann
2023-09-27 16:23:24 +02:00
parent 1981721b05
commit bda3e50a8d
4 changed files with 16 additions and 15 deletions

View File

@@ -721,7 +721,7 @@ impl App {
}
// The update from the camera
self.layers.update(&mut self.camera, &self.projection);
//self.layers.update(&mut self.camera, &self.projection);
if self.request_for_new_tiles
&& Time::now() - self.last_time_request_for_new_tiles > DeltaTime::from(200.0)

View File

@@ -25,6 +25,7 @@ use crate::{shader::ShaderManager, survey::config::HiPSConfig};
use crate::downloader::request::allsky::Allsky;
use crate::healpix::{cell::HEALPixCell, coverage::HEALPixCoverage};
use crate::math::angle::ToAngle;
use crate::math::lonlat::LonLat;
use crate::time::Time;
@@ -42,6 +43,8 @@ use std::fmt::Debug;
use wasm_bindgen::JsValue;
use web_sys::WebGl2RenderingContext;
use super::utils::index_patch::CCWCheckPatchIndexIter;
const M: f64 = 280.0 * 280.0;
const N: f64 = 150.0 * 150.0;
const RAP: f64 = 0.7;
@@ -586,11 +589,13 @@ impl HiPS {
self.textures.contains_tile(cell)
}
pub fn update(&mut self, camera: &mut CameraViewPort, projection: &ProjectionType) {
let raytracing = {
let depth = camera.get_tile_depth();
camera.is_allsky() || depth == 0
};
pub fn update(
&mut self,
raytracer: &RayTracer,
camera: &mut CameraViewPort,
projection: &ProjectionType,
) {
let raytracing = raytracer.is_rendering(camera);
let vertices_recomputation_needed =
!raytracing && (self.textures.reset_available_tiles() | camera.has_moved());
@@ -814,10 +819,12 @@ impl HiPS {
pos.push(ndc);
}
let patch_indices_iter = DefaultPatchIndexIter::new(
let patch_indices_iter = CCWCheckPatchIndexIter::new(
&(0..=n_segments_by_side),
&(0..=n_segments_by_side),
n_vertices_per_segment,
&pos,
camera,
)
.flatten()
.map(|indices| {

View File

@@ -242,6 +242,6 @@ impl RayTracer {
// Check whether the tile depth is 0 for square projection
// definition domains i.e. Mercator
let depth = camera.get_tile_depth();
camera.is_allsky() || depth == 0
camera.is_allsky() || depth <= 1
}
}

View File

@@ -290,7 +290,7 @@ impl Layers {
// 1. Update the survey if necessary
let url = self.urls.get(layer).expect("Url should be found");
if let Some(survey) = self.surveys.get_mut(url) {
survey.update(camera, projection);
survey.update(&self.raytracer, camera, projection);
// 2. Draw it if its opacity is not null
survey.draw(shaders, colormaps, camera, raytracer, draw_opt)?;
@@ -614,12 +614,6 @@ impl Layers {
ready
}
pub fn update(&mut self, camera: &mut CameraViewPort, proj: &ProjectionType) {
for survey in self.surveys.values_mut() {
survey.update(camera, proj);
}
}
// Accessors
// HiPSes getters
pub fn get_hips_from_layer(&self, layer: &str) -> Option<&HiPS> {