Fix commit

* HiPS3D in fits black artifact removed
* accepts fits ext files when searching for a FITS image to display
This commit is contained in:
Matthieu Baumann
2026-03-04 14:34:17 +01:00
parent cf8c793312
commit f41765adcd
6 changed files with 21 additions and 19 deletions

View File

@@ -58,11 +58,20 @@ impl Texture3D {
pixel_type: F::PIXEL_TYPE,
})));
Ok(Texture3D {
let s = Texture3D {
texture,
gl: gl.clone(),
metadata,
})
};
let voxel_count = F::NUM_CHANNELS * (width as usize) * (height as usize) * (depth as usize);
let zeros = vec![0xff; voxel_count as usize];
s.bind().tex_sub_image_3d_with_opt_u8_array(0, 0, 0,
width,
height,
depth,
Some(&zeros[..])
);
Ok(s)
}
pub fn generate_mipmap(&self) {

View File

@@ -256,6 +256,9 @@ impl App {
// 🚨 VERY IMPORTANT: prevent the closure from being dropped
onmessage.forget();
gl.blend_func(WebGl2RenderingContext::SRC_ALPHA, WebGl2RenderingContext::ONE_MINUS_SRC_ALPHA);
Ok(App {
gl,
//ui,

View File

@@ -19,17 +19,6 @@ use wasm_bindgen::JsValue;
mod subdivide;
/*
pub(crate) trait HpxTile {
// Getter
// Returns the current time if the texture is not full
fn start_time(&self) -> Time;
fn time_request(&self) -> Time;
fn cell(&self) -> &HEALPixCell;
}*/
pub(crate) trait HpxTileBuffer {
type T;
type C;

View File

@@ -21,7 +21,7 @@ vec4 val2c_f32(float x) {
// apply reversed
alpha = mix(alpha, 1.0 - alpha, reversed);
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(isinf(x)));
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(isinf(x) || isnan(x)));
return apply_tonal(new_color);
}
@@ -32,7 +32,7 @@ vec4 val2c(float x) {
// apply reversed
alpha = mix(alpha, 1.0 - alpha, reversed);
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(x == blank || isnan(x)));
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(x == blank));
return apply_tonal(new_color);
}

View File

@@ -74,7 +74,7 @@ vec4 val2c_f32(float x) {
// apply reversed
alpha = mix(alpha, 1.0 - alpha, reversed);
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(isinf(x)));
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(isinf(x) || isnan(x)));
return apply_tonal(new_color);
}
@@ -85,7 +85,7 @@ vec4 val2c(float x) {
// apply reversed
alpha = mix(alpha, 1.0 - alpha, reversed);
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(x == blank || isnan(x)));
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(x == blank));
return apply_tonal(new_color);
}
@@ -96,12 +96,12 @@ vec4 uvw2c_f32(vec3 uv) {
vec4 uvw2c_i32(vec3 uv) {
float val = float(decode_i32(texture(tex, uv).rgba));
return val2c(val);
return mix(val2c(val), vec4(0.0), float(val == -1.0));
}
vec4 uvw2c_i16(vec3 uv) {
float val = float(decode_i16(texture(tex, uv).rg));
return val2c(val);
return mix(val2c(val), vec4(0.0), float(val == -1.0));
}
vec4 uvw2c_u8(vec3 uv) {

View File

@@ -129,6 +129,7 @@ export let DefaultActionsForContextMenu = (function () {
label: 'FITS image', action(o) {
let input = document.createElement('input');
input.type = 'file';
input.accept = ".fits";
input.onchange = _ => {
let files = Array.from(input.files);