fix bugs: rendering catalog on main fbo, recompute the fov vertices when resizing the screen

This commit is contained in:
Matthieu Baumann
2022-03-29 09:54:55 +02:00
parent 98d3589870
commit 13ba11cde0
3 changed files with 14 additions and 12 deletions

View File

@@ -656,7 +656,6 @@ where
let surveys = &mut self.surveys;
let catalogs = &self.manager;
let colormaps = &self.colormaps;
let fbo_view = &self.fbo_view;
// Render the scene
gl.clear_color(0.0, 0.0, 0.0, 1.0);
gl.clear(WebGl2RenderingContext::COLOR_BUFFER_BIT);
@@ -664,7 +663,9 @@ where
surveys.draw::<P>(camera, shaders, colormaps);
// Draw the catalog
catalogs.draw::<P>(&gl, shaders, camera, colormaps, fbo_view)?;
//let fbo_view = &self.fbo_view;
//catalogs.draw::<P>(&gl, shaders, camera, colormaps, fbo_view)?;
catalogs.draw::<P>(&gl, shaders, camera, colormaps, None)?;
grid.draw::<P>(camera, shaders)?;
let dpi = self.camera.get_dpi();
@@ -816,9 +817,9 @@ where
let h = (height as f32) * dpi;
self.camera.set_screen_size::<P>(w, h);
// resize the view fbo
self.fbo_view.resize(w as usize, h as usize);
//self.fbo_view.resize(w as usize, h as usize);
// resize the ui fbo
self.fbo_ui.resize(w as usize, h as usize);
//self.fbo_ui.resize(w as usize, h as usize);
// launch the new tile requests
self.look_for_new_tiles();

View File

@@ -184,17 +184,18 @@ impl CameraViewPort {
self.moved = true;
self.last_user_action = UserAction::Starting;
/*self.vertices.set_fov::<P>(
self.vertices.set_fov::<P>(
&self.ndc_to_clip,
self.clip_zoom_factor,
&self.w2m,
self.aperture,
self.longitude_reversed,
&self.system,
false
);
self.is_allsky = !P::is_included_inside_projection(
&crate::projection::ndc_to_clip_space(&Vector2::new(-1.0, -1.0), self),
);*/
self.is_allsky = !P::is_included_inside_projection(&crate::projection::ndc_to_clip_space(
&Vector2::new(-1.0, -1.0),
self,
));
}
pub fn set_aperture<P: Projection>(&mut self, aperture: Angle<f64>, reversed_longitude: bool) {

View File

@@ -236,7 +236,7 @@ impl Manager {
shaders: &mut ShaderManager,
camera: &CameraViewPort,
colormaps: &Colormaps,
fbo: &FrameBufferObject,
fbo: Option<&FrameBufferObject>,
) -> Result<(), JsValue> {
gl.enable(WebGl2RenderingContext::BLEND);
for catalog in self.catalogs.values() {
@@ -461,7 +461,7 @@ impl Catalog {
manager: &Manager, // catalog manager
camera: &CameraViewPort,
colormaps: &Colormaps,
fbo: &FrameBufferObject,
fbo: Option<&FrameBufferObject>,
) -> Result<(), JsValue> {
// If the catalog is transparent, simply discard the draw
if self.alpha > 0_f32 {
@@ -488,7 +488,7 @@ impl Catalog {
self.num_instances as i32,
);
Ok(())
}, Some(fbo))?;
}, fbo)?;
// Render to the heatmap to the screen
{