mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2025-12-25 04:16:55 -08:00
Compare commits
10 Commits
v3.7.1-bet
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5d7d2a650 | ||
|
|
d22c25ea8a | ||
|
|
acef664b45 | ||
|
|
9e8db0379b | ||
|
|
032bb57517 | ||
|
|
f0fc39d2c8 | ||
|
|
2df32cb643 | ||
|
|
904d449006 | ||
|
|
2594aff1b6 | ||
|
|
547c5422d4 |
2
.github/workflows/npm-publish.yml
vendored
2
.github/workflows/npm-publish.yml
vendored
@@ -32,7 +32,7 @@ jobs:
|
||||
npm install
|
||||
- name: "Build Aladin Lite"
|
||||
run: |
|
||||
npm run build
|
||||
npm run build:npm
|
||||
- name: "Publish Aladin Lite to npm"
|
||||
run: |
|
||||
npm publish
|
||||
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -15,9 +15,11 @@ package-lock.json
|
||||
src/core/Cargo.lock
|
||||
src/core/target/
|
||||
|
||||
# this rust file is generated when compiling the code, so it is not
|
||||
# useful to put it on git
|
||||
src/core/src/shaders.rs
|
||||
# the tmp glsl files used when minifying the shaders into the wasm (build.rs)
|
||||
src/glsl/webgl2/**/*.min
|
||||
src/glsl/webgl2/**/*.tmp
|
||||
|
||||
package/
|
||||
|
||||
## python related
|
||||
# python environment
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# [Aladin Lite](https://aladin.u-strasbg.fr/AladinLite)
|
||||
# [Aladin Lite](https://aladin.cds.unistra.fr/AladinLite)
|
||||
|
||||
**An astronomical HiPS visualizer in the browser** <img src="aladin-logo.png" alt="Aladin Lite logo" width="220">
|
||||
|
||||
@@ -8,14 +8,14 @@ See [A&A 578, A114 (2015)](https://arxiv.org/abs/1505.02291) and [IVOA HiPS Reco
|
||||
|
||||
Aladin Lite is built to be easily embeddable in any web page. It powers astronomical portals like [ESASky](https://sky.esa.int/), [ESO Science Archive portal](http://archive.eso.org/scienceportal/) and [ALMA Portal](https://almascience.eso.org/asax/).
|
||||
|
||||
More details on [Aladin Lite documentation page](http://aladin.u-strasbg.fr/AladinLite/doc/).
|
||||
More details on [Aladin Lite documentation page](http://aladin.cds.unistra.fr/AladinLite/doc/).
|
||||
A new [API technical documentation](https://cds-astro.github.io/aladin-lite/) is now available.
|
||||
|
||||
[](https://github.com/cds-astro/aladin-lite/actions/workflows/test.yml)
|
||||
[](https://cds-astro.github.io/aladin-lite)
|
||||
[](https://aladin.cds.unistra.fr/AladinLite/doc/release/)
|
||||
|
||||
Try Aladin Lite [here](https://aladin.u-strasbg.fr/AladinLite).
|
||||
Try Aladin Lite [here](https://aladin.cds.unistra.fr/AladinLite).
|
||||
|
||||
Aladin Lite is made possible thanks to pure Rust core libraries:
|
||||
* [cdshealpix](https://github.com/cds-astro/cds-healpix-rust) - for HEALPix projection and unprojection to/from sky coordinates
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"dateModified": "2023-01-31",
|
||||
"issueTracker": "https://github.com/cds-astro/aladin-lite/issues",
|
||||
"name": "Aladin Lite",
|
||||
"version": "3.7.1-beta",
|
||||
"softwareVersion": "3.7.1-beta",
|
||||
"version": "3.7.2-beta",
|
||||
"softwareVersion": "3.7.2-beta",
|
||||
"description": "An astronomical HiPS visualizer in the browser.",
|
||||
"identifier": "10.5281/zenodo.7638833",
|
||||
"applicationCategory": "Astronomy, Visualization",
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
fov *= 0.997;
|
||||
rotation += 0.07;
|
||||
|
||||
aladin.setViewCenter2NorthPoleAngle(rotation)
|
||||
aladin.setRotation(rotation)
|
||||
aladin.setFoV(fov);
|
||||
|
||||
if (fov < 3 && fov > 0.5) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
aladin.setBaseImageLayer(dss);
|
||||
|
||||
dss.setCuts(2, 10000);
|
||||
dss.setCuts(2, 100, 'jpeg');
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
let aladin;
|
||||
A.init.then(() => {
|
||||
aladin = A.aladin('#aladin-lite-div', {survey: "data/hips/CDS_P_DSS2_color", target: "05 40 59.12 -02 27 04.1", fov: 2, log: false});
|
||||
aladin = A.aladin('#aladin-lite-div', {survey: "./data/hips/CDS_P_DSS2_color", target: "05 40 59.12 -02 27 04.1", fov: 2, log: false});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<script type="text/javascript">
|
||||
var aladin;
|
||||
A.init.then(() => {
|
||||
aladin = A.aladin('#aladin-lite-div', {fullScreen: true, cooFrame: "ICRSd", showSimbadPointerControl: true, showShareControl: true, showShareControl: true, survey: 'https://alasky.cds.unistra.fr/DSS/DSSColor/', fov: 180, showContextMenu: true});
|
||||
aladin = A.aladin('#aladin-lite-div', {fullScreen: true, cooFrame: "ICRSd", showSimbadPointerControl: true, showShareControl: true, showShareControl: true, survey: 'https://jafar.astro.unistra.fr/data/jafar_hips/Surveys/CFIS/IC0750/asinh_0_1/', fov: 180, showContextMenu: true});
|
||||
// manage URL parameters
|
||||
const searchParams = new URL(document.location).searchParams;
|
||||
if (searchParams.has('baseImageLayer')) {
|
||||
|
||||
11
package.json
11
package.json
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"homepage": "https://aladin.u-strasbg.fr/",
|
||||
"homepage": "https://aladin.cds.unistra.fr/",
|
||||
"name": "aladin-lite",
|
||||
"type": "module",
|
||||
"version": "3.7.1-beta",
|
||||
"version": "3.7.2-beta",
|
||||
"description": "An astronomical HiPS visualizer in the browser",
|
||||
"author": "Thomas Boch and Matthieu Baumann",
|
||||
"license": "GPL-3",
|
||||
@@ -30,11 +30,13 @@
|
||||
"HiPS"
|
||||
],
|
||||
"scripts": {
|
||||
"wasm:npm": "wasm-pack build ./src/core --target web --release --out-name core -- --features webgl2",
|
||||
"wasm:prod": "wasm-pack build ./src/core --target web --release --out-name core -- --features \"webgl2 minify_shaders\" && wasm-opt -Oz --strip-debug --strip-producers --dce -o src/core/pkg/core_bg.wasm src/core/pkg/core_bg.wasm",
|
||||
"wasm:dev": "wasm-pack build ./src/core --target web --release --out-name core -- --features webgl2",
|
||||
"wasm:dbg": "wasm-pack build --dev ./src/core --target web --out-name core -- --features=webgl2,dbg",
|
||||
"predeploy": "npm run build:prod && rm -rf aladin-lite*.tgz && npm pack",
|
||||
"deploy": "npm run predeploy && python3 deploy/deploy.py",
|
||||
"deploy": "python3 deploy/deploy.py",
|
||||
"build:npm": "npm run wasm:npm && vite build",
|
||||
"build:prod": "npm run wasm:prod && vite build",
|
||||
"build:dev": "npm run wasm:dev && vite build",
|
||||
"build:dbg": "npm run wasm:dbg && vite build",
|
||||
@@ -47,7 +49,8 @@
|
||||
"test:playwright": "npx playwright test",
|
||||
"test:update-snapshots": "npx playwright test --update-snapshots",
|
||||
"doc": "jsdoc -c jsdoc.json src/js src/js/shapes src/js/libs/astro && cp aladin-logo.png docs/ && cp jsdoc-custom-style.css docs/ && cp jsdoc-make-responsive.js docs/",
|
||||
"doc:dev": "npm run doc && open docs/index.html"
|
||||
"doc:dev": "npm run doc && open docs/index.html",
|
||||
"analyze": "vite build --mode analyze"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.47.0",
|
||||
|
||||
@@ -3,7 +3,7 @@ name = "aladin-lite"
|
||||
description = "Aladin Lite v3 introduces a new graphical engine written in Rust with the use of WebGL"
|
||||
license = "BSD-3-Clause"
|
||||
repository = "https://github.com/cds-astro/aladin-lite"
|
||||
version = "3.7.1-beta"
|
||||
version = "3.7.2-beta"
|
||||
authors = [ "baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr",]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ fn generate_shaders() -> std::result::Result<(), Box<dyn Error>> {
|
||||
fs::write(tmp_path.clone(), &src)?;
|
||||
|
||||
Command::new("mono")
|
||||
.args(&[
|
||||
.args([
|
||||
"/Users/matthieubaumann/Downloads/shader_minifier.exe",
|
||||
"--format",
|
||||
"text",
|
||||
|
||||
@@ -87,6 +87,7 @@ pub struct App {
|
||||
time_start_dragging: Time,
|
||||
time_mouse_high_vel: Time,
|
||||
dragging: bool,
|
||||
vel_history: Vec<f32>,
|
||||
|
||||
prev_cam_position: Vector3<f64>,
|
||||
//prev_center: Vector3<f64>,
|
||||
@@ -115,7 +116,7 @@ pub struct App {
|
||||
//callback_position_changed: js_sys::Function,
|
||||
}
|
||||
|
||||
use cgmath::{Vector2, Vector3};
|
||||
use cgmath::{Vector2, Vector3, Zero};
|
||||
|
||||
use crate::math::projection::*;
|
||||
pub const BLENDING_ANIM_DURATION: DeltaTime = DeltaTime::from_millis(200.0); // in ms
|
||||
@@ -208,6 +209,7 @@ impl App {
|
||||
|
||||
let browser_features_support = BrowserFeaturesSupport::new();
|
||||
|
||||
let vel_history = vec![];
|
||||
Ok(App {
|
||||
gl,
|
||||
//ui,
|
||||
@@ -244,6 +246,7 @@ impl App {
|
||||
time_start_dragging,
|
||||
time_mouse_high_vel,
|
||||
dragging,
|
||||
vel_history,
|
||||
|
||||
prev_cam_position,
|
||||
out_of_fov,
|
||||
@@ -492,7 +495,7 @@ impl App {
|
||||
self.inertia.is_some()
|
||||
}
|
||||
|
||||
pub(crate) fn update(&mut self, dt: DeltaTime) -> Result<bool, JsValue> {
|
||||
pub(crate) fn update(&mut self, dt: f64) -> Result<bool, JsValue> {
|
||||
// a timer stopping the frame if it takes too long
|
||||
// useful for garanting a framerate
|
||||
let rendering_timer = Time::now();
|
||||
@@ -1538,7 +1541,16 @@ impl App {
|
||||
let dx = crate::math::vector::dist2(&from_mouse_pos, &to_mouse_pos).sqrt();
|
||||
self.dist_dragging += dx;
|
||||
|
||||
//let now = Time::now();
|
||||
//let dragging_duration = (now - self.time_start_dragging).as_secs();
|
||||
//let dragging_vel = self.dist_dragging / dragging_duration;
|
||||
|
||||
// 1. Use smoothed velocity instead of instantaneous velocity
|
||||
let dv = dx / (Time::now() - self.camera.get_time_of_last_move()).as_secs();
|
||||
self.vel_history.push(dv);
|
||||
if self.vel_history.len() > 5 {
|
||||
self.vel_history.remove(0);
|
||||
}
|
||||
|
||||
if dv > 10000.0 {
|
||||
self.time_mouse_high_vel = Time::now();
|
||||
@@ -1587,15 +1599,18 @@ impl App {
|
||||
}
|
||||
|
||||
let now = Time::now();
|
||||
let dragging_duration = (now - self.time_start_dragging).as_secs();
|
||||
let dragging_vel = self.dist_dragging / dragging_duration;
|
||||
let avg_vel = self.vel_history.iter().copied().sum::<f32>() / self.vel_history.len() as f32;
|
||||
|
||||
// Detect if there has been a recent acceleration
|
||||
// It is also possible that the dragging time is too short and if it is the case, trigger the inertia
|
||||
let recent_acceleration = (Time::now() - self.time_mouse_high_vel).as_secs() < 0.1
|
||||
|| (Time::now() - self.time_start_dragging).as_secs() < 0.1;
|
||||
// 2. Clamp minimum + maximum velocities
|
||||
let min_vel = 1000.0; // tweak
|
||||
|
||||
if dragging_vel < 2000.0 && !recent_acceleration {
|
||||
// 3. Better condition for “recent acceleration”
|
||||
let t_since_drag = (now - self.time_start_dragging).as_secs();
|
||||
let t_since_accel = (now - self.time_mouse_high_vel).as_secs();
|
||||
|
||||
let inertia_trigger =
|
||||
avg_vel > min_vel || ((t_since_drag < 0.15) || (t_since_accel < 0.15));
|
||||
if !inertia_trigger {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1605,10 +1620,8 @@ impl App {
|
||||
let center = self.camera.get_center();
|
||||
let axis = self.prev_cam_position.cross(*center).normalize();
|
||||
|
||||
//let delta_time = ((now - time_of_last_move).0 as f64).max(1.0);
|
||||
let delta_angle = math::vector::angle3(&self.prev_cam_position, center).to_radians();
|
||||
let ampl = delta_angle * (dragging_vel as f64) * 5e-3;
|
||||
//let ampl = (dragging_vel * 0.01) as f64;
|
||||
let ampl = (delta_angle * avg_vel as f64) * 5e-3;
|
||||
|
||||
self.inertia = Some(Inertia::new(ampl.to_radians(), axis, self.north_up))
|
||||
}
|
||||
@@ -1718,7 +1731,6 @@ impl App {
|
||||
}
|
||||
} else {
|
||||
/* 1. Rotate by computing the angle between the last and current position */
|
||||
|
||||
let d = math::vector::angle3(&prev_pos, &cur_pos);
|
||||
let axis = prev_pos.cross(cur_pos).normalize();
|
||||
|
||||
@@ -1730,7 +1742,37 @@ impl App {
|
||||
self.request_for_new_tiles = true;
|
||||
}
|
||||
} else {
|
||||
self.out_of_fov = true;
|
||||
// approx move
|
||||
let origin2next = Vector2::new(s2x - s1x, s2y - s1y);
|
||||
|
||||
if origin2next != Vector2::zero() {
|
||||
let prev_pos = self.camera.get_center();
|
||||
|
||||
let prev_cam_position = self.get_center().vector();
|
||||
|
||||
let center_screen = self
|
||||
.projection
|
||||
.model_to_screen_space(&prev_cam_position, &self.camera)
|
||||
.unwrap();
|
||||
|
||||
let next_s = origin2next + center_screen;
|
||||
|
||||
if let Some(cur_pos) = self.projection.screen_to_model_space(&next_s, &self.camera)
|
||||
{
|
||||
let d = math::vector::angle3(prev_pos, &cur_pos);
|
||||
let axis = prev_pos.cross(cur_pos).normalize();
|
||||
|
||||
self.camera
|
||||
.apply_axis_rotation(&(-axis), d, &self.projection);
|
||||
|
||||
self.prev_cam_position = prev_cam_position;
|
||||
self.request_for_new_tiles = true;
|
||||
} else {
|
||||
//self.out_of_fov = true;
|
||||
}
|
||||
} else {
|
||||
//self.out_of_fov = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,8 +133,9 @@ async fn query_html_image(
|
||||
// Set the CORS and credentials options for the image
|
||||
let cors_value = match credentials {
|
||||
RequestCredentials::Include => Some("use-credentials"),
|
||||
RequestCredentials::SameOrigin => Some("anonymous"),
|
||||
_ => Some(""),
|
||||
RequestCredentials::Omit => Some("anonymous"),
|
||||
RequestCredentials::SameOrigin => Some(""),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let promise = js_sys::Promise::new(
|
||||
|
||||
@@ -3,7 +3,7 @@ use cgmath::Vector3;
|
||||
use crate::camera::CameraViewPort;
|
||||
use crate::math::angle::ToAngle;
|
||||
use crate::math::projection::ProjectionType;
|
||||
use crate::time::{DeltaTime, Time};
|
||||
use crate::time::Time;
|
||||
/// State for inertia
|
||||
pub struct Inertia {
|
||||
// Initial angular distance
|
||||
@@ -12,21 +12,22 @@ pub struct Inertia {
|
||||
// Vector of rotation
|
||||
axis: Vector3<f64>,
|
||||
// The time when the inertia begins
|
||||
time_start: Time,
|
||||
time_prev: Time,
|
||||
north_up: bool,
|
||||
}
|
||||
|
||||
impl Inertia {
|
||||
pub fn new(ampl: f64, axis: Vector3<f64>, north_up: bool) -> Self {
|
||||
Inertia {
|
||||
time_start: Time::now(),
|
||||
time_prev: Time::now(),
|
||||
ampl,
|
||||
speed: ampl,
|
||||
speed: (ampl * 0.5).min(0.1),
|
||||
axis,
|
||||
north_up,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn apply(&mut self, camera: &mut CameraViewPort, proj: &ProjectionType, _dt: DeltaTime) {
|
||||
let t = ((Time::now() - self.time_start).as_millis() / 1000.0) as f64;
|
||||
// Undamped angular frequency of the oscillator
|
||||
@@ -46,6 +47,28 @@ impl Inertia {
|
||||
let fov = start_fov * (1_f32 - alpha) + goal_fov * alpha;*/
|
||||
camera.apply_axis_rotation(&self.axis, self.speed.to_angle(), proj);
|
||||
|
||||
if self.north_up {
|
||||
camera.set_position_angle(0.0.to_angle(), proj);
|
||||
}
|
||||
}*/
|
||||
|
||||
pub fn apply(&mut self, camera: &mut CameraViewPort, proj: &ProjectionType, dt: f64) {
|
||||
self.time_prev = Time::now();
|
||||
// Initial angular velocity
|
||||
//let v0 = self.ampl * 0.5;
|
||||
|
||||
// Friction coefficient (tweak this)
|
||||
let damping = 5e-3;
|
||||
|
||||
self.speed *= (-damping * dt).exp();
|
||||
let delta_angle = self.speed * dt;
|
||||
|
||||
// Exponential decay of angular velocity
|
||||
// self.speed = (v0 * (-damping * t).exp()).min(3.0);
|
||||
|
||||
//camera.apply_axis_rotation(&self.axis, self.speed.to_angle(), proj);
|
||||
camera.apply_axis_rotation(&self.axis, delta_angle.to_angle(), proj);
|
||||
|
||||
if self.north_up {
|
||||
camera.set_position_angle(0.0.to_angle(), proj);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,6 @@ mod time;
|
||||
|
||||
use crate::{
|
||||
camera::CameraViewPort, healpix::moc::SpaceMoc, math::lonlat::LonLatT, shader::ShaderManager,
|
||||
time::DeltaTime,
|
||||
};
|
||||
|
||||
use al_api::color::{Color, ColorRGBA};
|
||||
@@ -137,10 +136,6 @@ use math::angle::ArcDeg;
|
||||
pub struct WebClient {
|
||||
// The app
|
||||
app: App,
|
||||
|
||||
// The time between the previous and the current
|
||||
// frame
|
||||
dt: DeltaTime,
|
||||
}
|
||||
|
||||
use al_api::hips::ImageMetadata;
|
||||
@@ -167,9 +162,7 @@ impl WebClient {
|
||||
|
||||
let app = App::new(&gl, aladin_div, shaders, resources)?;
|
||||
|
||||
let dt = DeltaTime::zero();
|
||||
|
||||
let webclient = WebClient { app, dt };
|
||||
let webclient = WebClient { app };
|
||||
|
||||
Ok(webclient)
|
||||
}
|
||||
@@ -194,15 +187,15 @@ impl WebClient {
|
||||
///
|
||||
/// # Return
|
||||
/// Whether the view is moving or not
|
||||
pub fn update(&mut self, dt: f32) -> Result<bool, JsValue> {
|
||||
pub fn update(&mut self, dt: f64) -> Result<bool, JsValue> {
|
||||
// dt refers to the time taking (in ms) rendering the previous frame
|
||||
self.dt = DeltaTime::from_millis(dt);
|
||||
//self.dt = DeltaTime::from_millis(dt as f32);
|
||||
|
||||
// Update the application and get back the
|
||||
// world coordinates of the center of projection in (ra, dec)
|
||||
self.app.update(
|
||||
// Time of the previous frame rendering
|
||||
self.dt,
|
||||
dt,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -111,27 +111,50 @@ where
|
||||
// Define a rotation from an axis and a angle
|
||||
pub fn from_axis_angle(axis: &Vector3<S>, angle: Angle<S>) -> Rotation<S> {
|
||||
let angle: Rad<S> = angle.into();
|
||||
let mat = Matrix3::from_axis_angle(axis.normalize(), angle);
|
||||
(&mat).into()
|
||||
let half = angle.0 * S::from(0.5).unwrap();
|
||||
|
||||
let (s, c) = half.sin_cos();
|
||||
let axis = axis.normalize();
|
||||
|
||||
let q = Quaternion::new(c, axis.x * s, axis.y * s, axis.z * s);
|
||||
Rotation(q)
|
||||
}
|
||||
|
||||
// Define a rotation from a normalized vector
|
||||
pub fn from_sky_position(pos: &Vector3<S>) -> Rotation<S> {
|
||||
let (lon, lat) = math::lonlat::xyz_to_radec(pos);
|
||||
|
||||
let qy = Self::from_axis_angle(&Vector3::unit_y(), lon);
|
||||
let qx = Self::from_axis_angle(&Vector3::unit_x(), -lat);
|
||||
|
||||
qy * qx
|
||||
}
|
||||
|
||||
/*pub fn from_sky_position(pos: &Vector3<S>) -> Rotation<S> {
|
||||
let (lon, lat) = math::lonlat::xyz_to_radec(pos);
|
||||
|
||||
let rot_y = Matrix3::from_angle_y(lon);
|
||||
let rot_x = Matrix3::from_angle_x(-lat);
|
||||
|
||||
let mat = rot_y * rot_x;
|
||||
(&(mat)).into()
|
||||
}
|
||||
}*/
|
||||
|
||||
// Apply a rotation to a position
|
||||
pub fn rotate(&self, pos_world_space: &Vector3<S>) -> Vector3<S> {
|
||||
let w2m: &Matrix3<S> = &self.into();
|
||||
pub fn rotate(&self, v: &Vector3<S>) -> Vector3<S> {
|
||||
/*let w2m: &Matrix3<S> = &self.into();
|
||||
w2m * v*/
|
||||
let qvec = self.0.v; // vector part of the quaternion
|
||||
|
||||
w2m * pos_world_space
|
||||
// uv = qvec × v
|
||||
let uv = qvec.cross(*v);
|
||||
// uuv = qvec × uv
|
||||
let uuv = qvec.cross(uv);
|
||||
|
||||
// v' = v + 2 * (uv * q.w + uuv)
|
||||
*v + ((uv * self.0.s) + uuv) * (S::from(2.0).unwrap())
|
||||
}
|
||||
|
||||
pub fn inv_rotate(&self, pos_model_space: &Vector3<S>) -> Vector3<S> {
|
||||
let w2m: &Matrix3<S> = &self.into();
|
||||
let m2w = w2m.transpose();
|
||||
|
||||
@@ -98,7 +98,7 @@ fn get_coord_uv_it(
|
||||
)
|
||||
.chain(std::iter::once((
|
||||
xmax,
|
||||
if xmax % max_tex_size == 0 {
|
||||
if xmax.is_multiple_of(max_tex_size) {
|
||||
1.0
|
||||
} else {
|
||||
get_uv_in_tex_chunk(xmax)
|
||||
@@ -129,7 +129,7 @@ fn get_coord_uv_it(
|
||||
})
|
||||
.chain(std::iter::once((
|
||||
xmax,
|
||||
if xmax % max_tex_size == 0 {
|
||||
if xmax.is_multiple_of(max_tex_size) {
|
||||
1.0
|
||||
} else {
|
||||
get_uv_in_tex_chunk(xmax)
|
||||
|
||||
@@ -88,7 +88,7 @@ where
|
||||
|
||||
pixels_written += num_pixels_to_read;
|
||||
|
||||
if F::PIXEL_TYPE.num_channels() == 1 && y % step_cut == 0 {
|
||||
if F::PIXEL_TYPE.num_channels() == 1 && y.is_multiple_of(step_cut) {
|
||||
// on a good line
|
||||
let bytes_line = &buf[id_tx][off_bytes_dst..(off_bytes_dst + num_bytes_to_read)];
|
||||
for x_in_patch in (0..w_patch).step_by(step_cut) {
|
||||
@@ -153,7 +153,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
if (((dy + 1) % (max_tex_size as usize) == 0) && id_tx == buf.len() - 1)
|
||||
if ((dy + 1).is_multiple_of(max_tex_size as usize) && id_tx == buf.len() - 1)
|
||||
|| pixels_written >= num_pixels
|
||||
{
|
||||
// we can create new textures of size max_tex_size
|
||||
|
||||
246
src/core/src/shaders.rs
Normal file
246
src/core/src/shaders.rs
Normal file
@@ -0,0 +1,246 @@
|
||||
use std::collections::HashMap;
|
||||
#[allow(dead_code)]
|
||||
pub fn get_all() -> HashMap<&'static str, &'static str> {
|
||||
let mut out = HashMap::new();
|
||||
out.insert(
|
||||
r"hips_raytracer_u8.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;precision lowp usampler2DArray;precision lowp isampler2DArray;precision mediump int;uniform sampler2DArray tex;in vec3 frag_pos;in vec2 out_clip_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float t(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float v){v=t(v);return v*v;}float i(float v){return H==0?t(v):H==1?sqrt(t(v)):H==2?log(1e3*t(v)+1.)/log(1e3):H==3?asinh(10.*t(v))/3.:f(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 i(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 t(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 v(float v){float r=i(v*scale+offset);r=mix(r,1.-r,reversed);vec4 H=mix(texture(colormaps,vec2(r,(colormap_id+.5)/num_colormaps)),vec4(0),float(v==blank||isnan(v)));return f(i(t(vec4(H.xyz+k_brightness,H.w))));}int f(vec2 v){int H=int(v.y<0.);return int(v.x<0.)+H|H<<1;}float i(vec2 v){float H=atan(abs(v.y),abs(v.x))*1.27323954474;return v.x<0.!=v.y<0.?1.-H:H-1.;}float f(vec3 v){float H=dot(v.xy,v.xy);return H<.1?H*(.5+H*(.125+H*(.0625+H*(.0390625+H*.02734375)))):1.f-v.z;}float i(vec3 v){float H=dot(v.xy,v.xy);return H<.1f?H*(.5+H*(.125+H*(.0625+H*(.0390625+H*.02734375)))):v.z+1.;}int f(int v,int H){v|=H<<2;H=(v^v>>1)&572662306;return v^H^H<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy t(vec3 v){float H=float(1<<0)*.5,r=i(v.xy),t,e;int c=f(v.xy),o=0,u,s;vec2 m=vec2(0);if(v.z>.66666666666){float H=sqrt(3.*f(v));m=vec2(r*H,2.-H);o=c;}else if(v.z<-.66666666666){float H=sqrt(3.*i(v));m=vec2(r*H,H);o=c+8;}else{float H=v.z*1.5;int f=int(r>H),e=int(r>=-H),s=1-e;m=vec2(r-float(f+e-1),H+float(f+s));o=(f+s<<2)+(c+(f&e)&3);}t=H*(m.x+m.y);e=H*(m.y-m.x);u=int(t);s=int(e);return HashDxDy((o<<(0<<1))+f(u,s),t-float(u),e-float(s));}vec3 f(){HashDxDy v=t(normalize(frag_pos).zxy);return vec3(vec2(v.dy,v.dx),float(textures_tiles[v.idx].texture_idx));}void main(){vec3 H=f();H.y=1.-H.y;vec4 i=v(float(uint(texture(tex,H).x*255.+.5)));out_frag_color=i;out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"catalogs_aitoff.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_aitoff(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"catalogs_catalog.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;in vec2 out_uv;in vec3 out_p;out vec4 color;uniform sampler2D kernel_texture;uniform float max_density,fov,strength;void main(){color=texture(kernel_texture,out_uv)/max(log2(fov*1e2),1.);color.x*=strength;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"fits_base.vert",
|
||||
r#"#version 300 es
|
||||
precision highp float;precision highp int;layout(location=0)in vec2 ndc_pos;layout(location=1)in vec2 uv;out vec2 frag_uv;void main(){gl_Position=vec4(ndc_pos,0,1);frag_uv=uv;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"image_base.vert",
|
||||
r#"#version 300 es
|
||||
precision highp float;layout(location=0)in vec2 ndc_pos;layout(location=1)in vec2 uv;out vec2 frag_uv;void main(){gl_Position=vec4(ndc_pos,0,1);frag_uv=uv;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_rasterizer_u8.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 s(float s){float u=v(s*scale+offset);u=mix(u,1.-u,reversed);vec4 H=mix(texture(colormaps,vec2(u,(colormap_id+.5)/num_colormaps)),vec4(0),float(s==blank||isnan(s)));return f(t(v(vec4(H.xyz+k_brightness,H.w))));}vec4 f(vec3 v){return s(float(uint(texture(tex,v).x*255.+.5)));}uniform float opacity;void main(){vec3 v=frag_uv_start,H=frag_uv_end;v.y=1.-v.y;H.y=1.-H.y;vec4 s=f(v),u=f(H);out_frag_color=mix(s,u,frag_blending_factor);out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_raytracer_rgba2cmap.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;precision lowp sampler2DArray;precision lowp isampler2DArray;precision mediump int;in vec3 frag_pos;in vec2 out_clip_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float opacity;uniform sampler2DArray tex;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float t(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float v){v=t(v);return v*v;}float v(float v){return H==0?t(v):H==1?sqrt(t(v)):H==2?log(1e3*t(v)+1.)/log(1e3):H==3?asinh(10.*t(v))/3.:f(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 f(vec3 s){vec4 i=texture(colormaps,vec2(v(texture(tex,s).x),(colormap_id+.5)/num_colormaps));i.xyz=mix(i.xyz,1.-i.xyz,reversed);return f(t(v(vec4(i.xyz+k_brightness,i.w))));}int f(vec2 v){int f=int(v.y<0.);return int(v.x<0.)+f|f<<1;}float t(vec2 v){float f=atan(abs(v.y),abs(v.x))*1.27323954474;return v.x<0.!=v.y<0.?1.-f:f-1.;}float t(vec3 v){float f=dot(v.xy,v.xy);return f<.1?f*(.5+f*(.125+f*(.0625+f*(.0390625+f*.02734375)))):1.f-v.z;}float v(vec3 v){float f=dot(v.xy,v.xy);return f<.1f?f*(.5+f*(.125+f*(.0625+f*(.0390625+f*.02734375)))):v.z+1.;}int f(int v,int f){v|=f<<2;f=(v^v>>1)&572662306;return v^f^f<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy i(vec3 i){float H=float(1<<0)*.5,a=t(i.xy),e,r;int s=f(i.xy),u=0,m,x;vec2 o=vec2(0);if(i.z>.66666666666){float v=sqrt(3.*t(i));o=vec2(a*v,2.-v);u=s;}else if(i.z<-.66666666666){float f=sqrt(3.*v(i));o=vec2(a*f,f);u=s+8;}else{float v=i.z*1.5;int f=int(a>v),x=int(a>=-v),e=1-x;o=vec2(a-float(f+x-1),v+float(f+e));u=(f+e<<2)+(s+(f&x)&3);}e=H*(o.x+o.y);r=H*(o.y-o.x);m=int(e);x=int(r);return HashDxDy((u<<(0<<1))+f(m,x),e-float(m),r-float(x));}vec3 f(){HashDxDy v=i(normalize(frag_pos).zxy);return vec3(vec2(v.dy,v.dx),float(textures_tiles[v.idx].texture_idx));}void main(){vec3 v=f();out_frag_color=f(v);out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"fits_i32.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2D;precision mediump int;out vec4 out_frag_color;in vec2 frag_uv;uniform sampler2D tex;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float t(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float v){v=t(v);return v*v;}float v(float v){return H==0?t(v):H==1?sqrt(t(v)):H==2?log(1e3*t(v)+1.)/log(1e3):H==3?asinh(10.*t(v))/3.:f(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int c(vec4 v){return int(v.x*255.+.5)<<24|int(v.y*255.+.5)<<16|int(v.z*255.+.5)<<8|int(v.w*255.+.5);}vec4 c(float H){float s=v(H*scale+offset);s=mix(s,1.-s,reversed);vec4 k=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank||isnan(H)));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}void main(){out_frag_color=c(float(c(texture(tex,frag_uv).xyzw)));out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"moc_base.vert",
|
||||
r#"#version 300 es
|
||||
precision highp float;layout(location=0)in vec2 lonlat;uniform mat3 u_2world;uniform vec2 ndc_to_clip;uniform float czf;vec2 n(vec3 y){vec2 v=vec2(-y.x,y.y);return y.z>=0.f?v:normalize(v);}vec2 s(vec3 v){float a=length(v.zx),j=sqrt((1.+sqrt(a*(a+v.z)*.5f))*.5f),y=v.y/j,l=0.;if(abs(v.x)<.005){float y=v.x/a;l=-v.x*(1.-y*y/21.)/j;}else j=sqrt((a*a-a*v.z)*2.)/j,l=sign(-v.x)*j;return vec2(l*.5,y)/1.4142135623731;}float n(float v){float j=acos(-1.)*v,a=2.*asin(v);v=a+sin(a)-j;int l=0;for(;abs(v)>125e-10&&l<100;l+=1)a-=v/(1.+cos(a)),v=a+sin(a)-j;return.5*a;}vec2 v(vec3 v){float a=n(v.y);return vec2(atan(-v.x,v.z)*cos(a)/acos(-1.),sin(a));}vec2 t(vec3 v){v.z=max(v.z,.01);return vec2(-v.x,v.y)/(v.z*acos(-1.));}vec3 n(){float v=cos(lonlat.y);return vec3(v*sin(lonlat.x),sin(lonlat.y),v*cos(lonlat.x));}uniform int u_proj;vec2 l(vec3 a){return u_proj==0?t(a):u_proj==1?vec2(-a.x,a.y)/(acos(-1.)*((1.+a.z)*.5)):u_proj==2?n(a):u_proj==3?vec2(-a.x,a.y)*.5/sqrt(.5+.5*a.z):u_proj==4?s(a):u_proj==5?v(a):vec2(atan(-a.x,a.z),atanh(a.y))/acos(-1.);}void main(){gl_Position=vec4(l(u_2world*n())/(ndc_to_clip*czf),0,1);}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips3d_u8.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler3D;uniform sampler3D tex;in vec3 frag_uv;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 s(float H){float s=v(H*scale+offset);s=mix(s,1.-s,reversed);vec4 k=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank||isnan(H)));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}uniform float opacity;void main(){vec3 v=vec3(frag_uv);v.y=1.-v.y;vec4 f=s(float(uint(texture(tex,v).x*255.+.5)));out_frag_color=f;out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"fits_u8.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2D;precision mediump int;out vec4 out_frag_color;in vec2 frag_uv;uniform sampler2D tex;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 m(float H){float m=v(H*scale+offset);m=mix(m,1.-m,reversed);vec4 k=mix(texture(colormaps,vec2(m,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank||isnan(H)));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}void main(){out_frag_color=m(float(uint(texture(tex,frag_uv).x*255.+.5)));out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_raytracer_rgba.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;precision mediump int;uniform sampler2DArray tex;in vec2 out_clip_pos;in vec3 frag_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float v(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float t(float f){f=v(f);return f*f;}float f(float f){return H==0?v(f):H==1?sqrt(v(f)):H==2?log(1e3*v(f)+1.)/log(1e3):H==3?asinh(10.*v(f))/3.:t(f);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 f){return vec4(pow(f.x,k_gamma),pow(f.y,k_gamma),pow(f.z,k_gamma),f.w);}vec4 t(vec4 f){return vec4(mix(vec3(dot(f.xyz,vec3(.2126,.7152,.0722))),f.xyz,1.+k_saturation),f.w);}vec4 v(vec4 f){return vec4(.5+(1.+k_contrast)*(f.xyz-.5),f.w);}vec4 f(vec3 i){vec4 r=texture(tex,i).xyzw;r.x=f(r.x);r.y=f(r.y);r.z=f(r.z);r.xyz=mix(r.xyz,1.-r.xyz,reversed);return f(t(v(vec4(r.xyz+k_brightness,r.w))));}int f(vec2 f){int v=int(f.y<0.);return int(f.x<0.)+v|v<<1;}float t(vec2 f){float v=atan(abs(f.y),abs(f.x))*1.27323954474;return f.x<0.!=f.y<0.?1.-v:v-1.;}float t(vec3 f){float v=dot(f.xy,f.xy);return v<.1?v*(.5+v*(.125+v*(.0625+v*(.0390625+v*.02734375)))):1.f-f.z;}float v(vec3 f){float v=dot(f.xy,f.xy);return v<.1f?v*(.5+v*(.125+v*(.0625+v*(.0390625+v*.02734375)))):f.z+1.;}int f(int f,int v){f|=v<<2;v=(f^f>>1)&572662306;return f^v^v<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy i(vec3 i){float H=float(1<<0)*.5,r=t(i.xy),e,a;int n=f(i.xy),u=0,x,o;vec2 s=vec2(0);if(i.z>.66666666666){float f=sqrt(3.*t(i));s=vec2(r*f,2.-f);u=n;}else if(i.z<-.66666666666){float f=sqrt(3.*v(i));s=vec2(r*f,f);u=n+8;}else{float f=i.z*1.5;int v=int(r>f),x=int(r>=-f),a=1-x;s=vec2(r-float(v+x-1),f+float(v+a));u=(v+a<<2)+(n+(v&x)&3);}e=H*(s.x+s.y);a=H*(s.y-s.x);x=int(e);o=int(a);return HashDxDy((u<<(0<<1))+f(x,o),e-float(x),a-float(o));}vec3 f(){HashDxDy f=i(normalize(frag_pos).zxy);return vec3(vec2(f.dy,f.dx),float(textures_tiles[f.idx].texture_idx));}uniform float opacity;uniform vec4 no_tile_color;void main(){vec3 v=f();vec4 r=f(v);out_frag_color=r;out_frag_color=vec4(r.xyz,opacity*r.w);}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"passes_post_vertex_100es.vert",
|
||||
r#"#version 300 es
|
||||
precision mediump float;layout(location=0)in vec2 a_pos;out vec2 v_tc;void main(){gl_Position=vec4(a_pos*2.-1.,0,1);v_tc=a_pos;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_rasterizer_rgba.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float v(float v){v=f(v);return v*v;}float t(float t){return H==0?f(t):H==1?sqrt(f(t)):H==2?log(1e3*f(t)+1.)/log(1e3):H==3?asinh(10.*f(t))/3.:v(t);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 f){return vec4(pow(f.x,k_gamma),pow(f.y,k_gamma),pow(f.z,k_gamma),f.w);}vec4 t(vec4 f){return vec4(mix(vec3(dot(f.xyz,vec3(.2126,.7152,.0722))),f.xyz,1.+k_saturation),f.w);}vec4 v(vec4 f){return vec4(.5+(1.+k_contrast)*(f.xyz-.5),f.w);}vec4 f(vec3 a){vec4 r=texture(tex,a).xyzw;r.x=t(r.x);r.y=t(r.y);r.z=t(r.z);r.xyz=mix(r.xyz,1.-r.xyz,reversed);return f(t(v(vec4(r.xyz+k_brightness,r.w))));}void main(){out_frag_color=mix(f(frag_uv_start),f(frag_uv_end),frag_blending_factor);out_frag_color.w=opacity*out_frag_color.w;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"catalogs_ortho.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;in vec2 out_uv;in vec3 out_p;out vec4 color;uniform sampler2D kernel_texture;uniform float max_density,fov,strength;void main(){if(out_p.z<0.f)discard;color=texture(kernel_texture,out_uv)/max(log2(fov*1e2),1.);color.x*=strength;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_rasterizer_i32.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int c(vec4 v){return int(v.x*255.+.5)<<24|int(v.y*255.+.5)<<16|int(v.z*255.+.5)<<8|int(v.w*255.+.5);}vec4 c(float H){float s=v(H*scale+offset);s=mix(s,1.-s,reversed);vec4 c=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank||isnan(H)));return f(t(v(vec4(c.xyz+k_brightness,c.w))));}vec4 c(vec3 v){return c(float(c(texture(tex,v).xyzw)));}uniform float opacity;void main(){vec3 v=frag_uv_start,f=frag_uv_end;v.y=1.-v.y;f.y=1.-f.y;vec4 H=c(v),t=c(f);out_frag_color=mix(H,t,frag_blending_factor);out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"image_sampler.frag",
|
||||
r#"#version 300 es
|
||||
precision highp float;precision highp sampler2D;out vec4 out_frag_color;in vec2 frag_uv;uniform sampler2D tex;uniform float opacity;void main(){out_frag_color=texture(tex,frag_uv);out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"line_base.frag",
|
||||
r#"#version 300 es
|
||||
precision highp float;out vec4 color;in vec2 l;uniform vec4 u_color;uniform float u_thickness,u_width,u_height;void main(){if(l.x>.05)discard;else{color=u_color;float u=(u_thickness+2.)*.5;color.w=color.w*(1.-smoothstep(u-1.,u,abs((u_thickness+2.)*l.y)));}}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_raytracer_backcolor.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision mediump int;out vec4 out_frag_color;uniform vec3 color;void main(){out_frag_color=vec4(color,1);}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips3d_i32.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler3D;precision lowp isampler3D;precision lowp usampler3D;uniform sampler3D tex;in vec3 frag_uv;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int c(vec4 v){return int(v.x*255.+.5)<<24|int(v.y*255.+.5)<<16|int(v.z*255.+.5)<<8|int(v.w*255.+.5);}vec4 c(float w){float s=v(w*scale+offset);s=mix(s,1.-s,reversed);vec4 k=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(w==blank||isnan(w)));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}uniform float opacity;void main(){vec3 v=vec3(frag_uv);v.y=1.-v.y;vec4 f=c(float(c(texture(tex,v).xyzw)));out_frag_color=f;out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips3d_red.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler3D;precision lowp isampler3D;precision lowp usampler3D;uniform sampler3D tex;in vec3 frag_uv;out vec4 out_frag_color;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float v(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float f){f=v(f);return f*f;}float t(float c){return H==0?v(c):H==1?sqrt(v(c)):H==2?log(1e3*v(c)+1.)/log(1e3):H==3?asinh(10.*v(c))/3.:f(c);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 f(){vec2 c=texture(tex,vec3(frag_uv)).xy;c.x=t(c.x);c.x=mix(c.x,1.-c.x,reversed);vec3 s=texture(colormaps,vec2(c.x,(colormap_id+.5)/num_colormaps)).xyz;return f(t(v(vec4(vec4(s,c.y).xyz+k_brightness,vec4(s,c.y).w))));}void main(){out_frag_color=f();out_frag_color.w=opacity*out_frag_color.w;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"catalogs_arc.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_arc(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"colormaps_colormap.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2D;in vec2 out_uv;out vec4 color;uniform sampler2D texture_fbo;uniform float alpha;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;void main(){float s=texture(texture_fbo,out_uv).x;color=texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps));color.w=smoothstep(0.,.1,s)*alpha;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"catalogs_healpix.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_healpix(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"fits_f32.frag",
|
||||
r#"#version 300 es
|
||||
precision highp float;precision highp sampler2D;precision highp int;out vec4 out_frag_color;in vec2 frag_uv;uniform sampler2D tex;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float v(float v){v=f(v);return v*v;}float t(float t){return H==0?f(t):H==1?sqrt(f(t)):H==2?log(1e3*f(t)+1.)/log(1e3):H==3?asinh(10.*f(t))/3.:v(t);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}highp float h(highp vec4 v){highp float t=2.*mod(v[0],128.)+step(128.,v[1])-127.;return abs(t+127.)<.001?0.:(1.-step(128.,v[0])*2.)*exp2(t)*((mod(v[1],128.)*65536.+v[2]*256.+v[3]+float(8388608))*exp2(-23.));}vec4 h(float h){float s=t(h*scale+offset);s=mix(s,1.-s,reversed);vec4 H=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(isinf(h)));return f(t(v(vec4(H.xyz+k_brightness,H.w))));}void main(){out_frag_color=h(h(texture(tex,frag_uv).xyzw*255.));out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_raytracer_f32.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;precision mediump int;in vec3 frag_pos;in vec2 out_clip_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float opacity;uniform sampler2DArray tex;struct TileColor{Tile tile;vec4 color;bool found;};uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float t(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float f){f=t(f);return f*f;}float v(float v){return H==0?t(v):H==1?sqrt(t(v)):H==2?log(1e3*t(v)+1.)/log(1e3):H==3?asinh(10.*t(v))/3.:f(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}highp float s(highp vec4 v){highp float f=2.*mod(v[0],128.)+step(128.,v[1])-127.;return abs(f+127.)<.001?0.:(1.-step(128.,v[0])*2.)*exp2(f)*((mod(v[1],128.)*65536.+v[2]*256.+v[3]+float(8388608))*exp2(-23.));}vec4 s(float s){float i=v(s*scale+offset);i=mix(i,1.-i,reversed);vec4 H=mix(texture(colormaps,vec2(i,(colormap_id+.5)/num_colormaps)),vec4(0),float(isinf(s)));return f(t(v(vec4(H.xyz+k_brightness,H.w))));}int f(vec2 v){int f=int(v.y<0.);return int(v.x<0.)+f|f<<1;}float s(vec2 v){float f=atan(abs(v.y),abs(v.x))*1.27323954474;return v.x<0.!=v.y<0.?1.-f:f-1.;}float f(vec3 v){float f=dot(v.xy,v.xy);return f<.1?f*(.5+f*(.125+f*(.0625+f*(.0390625+f*.02734375)))):1.f-v.z;}float s(vec3 v){float f=dot(v.xy,v.xy);return f<.1f?f*(.5+f*(.125+f*(.0625+f*(.0390625+f*.02734375)))):v.z+1.;}int f(int v,int f){v|=f<<2;f=(v^v>>1)&572662306;return v^f^f<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy t(vec3 v){float H=float(1<<0)*.5,t=s(v.xy),e,i;int a=f(v.xy),r=0,u,m;vec2 o=vec2(0);if(v.z>.66666666666){float s=sqrt(3.*f(v));o=vec2(t*s,2.-s);r=a;}else if(v.z<-.66666666666){float f=sqrt(3.*s(v));o=vec2(t*f,f);r=a+8;}else{float f=v.z*1.5;int i=int(t>f),e=int(t>=-f),H=1-e;o=vec2(t-float(i+e-1),f+float(i+H));r=(i+H<<2)+(a+(i&e)&3);}e=H*(o.x+o.y);i=H*(o.y-o.x);u=int(e);m=int(i);return HashDxDy((r<<(0<<1))+f(u,m),e-float(u),i-float(m));}vec3 f(){HashDxDy v=t(normalize(frag_pos).zxy);return vec3(vec2(v.dy,v.dx),float(textures_tiles[v.idx].texture_idx));}void main(){vec3 v=f();v.y=1.-v.y;vec4 i=s(s(texture(tex,v).xyzw*255.));out_frag_color=i;out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"moc_base.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;out vec4 color;uniform vec4 u_color;void main(){color=u_color;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips3d_i16.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler3D;precision lowp isampler3D;precision lowp usampler3D;uniform sampler3D tex;in vec3 frag_uv;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int f(vec2 v){int f=int(v.x*255.+.5)<<8|int(v.y*255.+.5);if(f>=32768)f-=65536;return f;}vec4 l(float H){float s=v(H*scale+offset);s=mix(s,1.-s,reversed);vec4 k=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank||isnan(H)));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}uniform float opacity;void main(){vec3 v=vec3(frag_uv);v.y=1.-v.y;vec4 H=l(float(f(texture(tex,v).xy)));out_frag_color=H;out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"line_inst_lonlat.vert",
|
||||
r#"#version 300 es
|
||||
precision highp float;layout(location=0)in vec2 p_a_lonlat;layout(location=1)in vec2 p_b_lonlat;layout(location=2)in vec2 vertex;uniform mat3 u_2world;uniform vec2 ndc_to_clip;uniform float czf,u_width,u_height,u_thickness;out vec2 l;vec2 v(vec3 v){vec2 n=vec2(-v.x,v.y);return v.z>=0.f?n:normalize(n);}vec2 n(vec3 v){float n=length(v.zx),u=sqrt((1.+sqrt(n*(n+v.z)*.5f))*.5f),y=v.y/u,l=0.;if(abs(v.x)<.005){float c=v.x/n;l=-v.x*(1.-c*c/21.)/u;}else u=sqrt((n*n-n*v.z)*2.)/u,l=sign(-v.x)*u;return vec2(l*.5,y)/1.4142135623731;}float n(float v){float n=acos(-1.)*v,u=2.*asin(v);v=u+sin(u)-n;int l=0;for(;abs(v)>125e-10&&l<100;l+=1)u-=v/(1.+cos(u)),v=u+sin(u)-n;return.5*u;}vec2 s(vec3 v){float u=n(v.y);return vec2(atan(-v.x,v.z)*cos(u)/acos(-1.),sin(u));}vec2 t(vec3 v){v.z=max(v.z,.01);return vec2(-v.x,v.y)/(v.z*acos(-1.));}vec3 n(vec2 v){float u=cos(v.y);return vec3(u*sin(v.x),sin(v.y),u*cos(v.x));}uniform int u_proj;vec2 e(vec3 u){return u_proj==0?t(u):u_proj==1?vec2(-u.x,u.y)/(acos(-1.)*((1.+u.z)*.5)):u_proj==2?v(u):u_proj==3?vec2(-u.x,u.y)*.5/sqrt(.5+.5*u.z):u_proj==4?n(u):u_proj==5?s(u):vec2(atan(-u.x,u.z),atanh(u.y))/acos(-1.);}void main(){vec2 v=e(u_2world*n(p_a_lonlat)),u=e(u_2world*n(p_b_lonlat)),y=v-u,j=v/(ndc_to_clip*czf);v=u/(ndc_to_clip*czf)-j;gl_Position=vec4(j+v*vertex.x+(u_thickness+2.)*normalize(vec2(-v.y,v))*vertex.y*vec2(1,u_width/u_height)*(2./u_width),0,1);l=vec2(dot(y,y),vertex.y);}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"catalogs_mollweide.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_mollweide(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_rasterizer_f32.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float v(float v){v=f(v);return v*v;}float s(float t){return H==0?f(t):H==1?sqrt(f(t)):H==2?log(1e3*f(t)+1.)/log(1e3):H==3?asinh(10.*f(t))/3.:v(t);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 f){return vec4(pow(f.x,k_gamma),pow(f.y,k_gamma),pow(f.z,k_gamma),f.w);}vec4 s(vec4 f){return vec4(mix(vec3(dot(f.xyz,vec3(.2126,.7152,.0722))),f.xyz,1.+k_saturation),f.w);}vec4 v(vec4 f){return vec4(.5+(1.+k_contrast)*(f.xyz-.5),f.w);}highp float t(highp vec4 f){highp float t=2.*mod(f[0],128.)+step(128.,f[1])-127.;return abs(t+127.)<.001?0.:(1.-step(128.,f[0])*2.)*exp2(t)*((mod(f[1],128.)*65536.+f[2]*256.+f[3]+float(8388608))*exp2(-23.));}vec4 t(float t){float H=s(t*scale+offset);H=mix(H,1.-H,reversed);vec4 m=mix(texture(colormaps,vec2(H,(colormap_id+.5)/num_colormaps)),vec4(0),float(isinf(t)));return f(s(v(vec4(m.xyz+k_brightness,m.w))));}vec4 f(vec3 f){return t(t(texture(tex,f).xyzw*255.));}uniform float opacity;void main(){vec3 t=frag_uv_start,v=frag_uv_end;t.y=1.-t.y;v.y=1.-v.y;vec4 H=f(t),m=f(v);out_frag_color=mix(H,m,frag_blending_factor);out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips3d_raster.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;layout(location=0)in vec2 lonlat;layout(location=1)in vec3 uv;out vec3 frag_uv;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;vec2 n(vec3 v){vec2 l=vec2(-v.x,v.y);return v.z>=0.f?l:normalize(l);}vec2 s(vec3 v){float l=length(v.zx),j=sqrt((1.+sqrt(l*(l+v.z)*.5f))*.5f),y=v.y/j,a=0.;if(abs(v.x)<.005){float n=v.x/l;a=-v.x*(1.-n*n/21.)/j;}else j=sqrt((l*l-l*v.z)*2.)/j,a=sign(-v.x)*j;return vec2(a*.5,y)/1.4142135623731;}float n(float v){float j=acos(-1.)*v,l=2.*asin(v);v=l+sin(l)-j;int n=0;for(;abs(v)>125e-10&&n<100;n+=1)l-=v/(1.+cos(l)),v=l+sin(l)-j;return.5*l;}vec2 v(vec3 v){float l=n(v.y);return vec2(atan(-v.x,v.z)*cos(l)/acos(-1.),sin(l));}vec2 t(vec3 v){v.z=max(v.z,.01);return vec2(-v.x,v.y)/(v.z*acos(-1.));}vec3 n(){float v=cos(lonlat.y);return vec3(v*sin(lonlat.x),sin(lonlat.y),v*cos(lonlat.x));}uniform int u_proj;vec2 l(vec3 l){return u_proj==0?t(l):u_proj==1?vec2(-l.x,l.y)/(acos(-1.)*((1.+l.z)*.5)):u_proj==2?n(l):u_proj==3?vec2(-l.x,l.y)*.5/sqrt(.5+.5*l.z):u_proj==4?s(l):u_proj==5?v(l):vec2(atan(-l.x,l.z),atanh(l.y))/acos(-1.);}void main(){gl_Position=vec4(l((inv_model*n()).xyz)/(ndc_to_clip*czf),0,1);frag_uv=uv;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips3d_f32.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler3D;uniform sampler3D tex;in vec3 frag_uv;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float v(float v){v=f(v);return v*v;}float s(float t){return H==0?f(t):H==1?sqrt(f(t)):H==2?log(1e3*f(t)+1.)/log(1e3):H==3?asinh(10.*f(t))/3.:v(t);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 s(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}highp float t(highp vec4 v){highp float t=2.*mod(v[0],128.)+step(128.,v[1])-127.;return abs(t+127.)<.001?0.:(1.-step(128.,v[0])*2.)*exp2(t)*((mod(v[1],128.)*65536.+v[2]*256.+v[3]+float(8388608))*exp2(-23.));}vec4 t(float t){float H=s(t*scale+offset);H=mix(H,1.-H,reversed);vec4 m=mix(texture(colormaps,vec2(H,(colormap_id+.5)/num_colormaps)),vec4(0),float(isinf(t)));return f(s(v(vec4(m.xyz+k_brightness,m.w))));}uniform float opacity;void main(){vec3 v=vec3(frag_uv);v.y=1.-v.y;vec4 f=t(t(texture(tex,v).xyzw*255.));out_frag_color=f;out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_raytracer_backcolor.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision mediump int;layout(location=0)in vec2 pos_clip_space;uniform vec2 ndc_to_clip;uniform float czf;void main(){gl_Position=vec4(pos_clip_space/(ndc_to_clip*czf),0,1);}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_rasterizer_i16.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int f(vec2 v){int f=int(v.x*255.+.5)<<8|int(v.y*255.+.5);if(f>=32768)f-=65536;return f;}vec4 s(float s){float H=v(s*scale+offset);H=mix(H,1.-H,reversed);vec4 c=mix(texture(colormaps,vec2(H,(colormap_id+.5)/num_colormaps)),vec4(0),float(s==blank||isnan(s)));return f(t(v(vec4(c.xyz+k_brightness,c.w))));}vec4 f(vec3 v){return s(float(f(texture(tex,v).xy)));}uniform float opacity;void main(){vec3 v=frag_uv_start,H=frag_uv_end;v.y=1.-v.y;H.y=1.-H.y;vec4 s=f(v),t=f(H);out_frag_color=mix(s,t,frag_blending_factor);out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"colormaps_colormap.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2D;layout(location=0)in vec2 position;layout(location=1)in vec2 uv;out vec2 out_uv;void main(){gl_Position=vec4(position,0,1);out_uv=uv;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"passes_post_fragment_100es.frag",
|
||||
r#"#version 300 es
|
||||
precision mediump float;in vec2 v_tc;out vec4 color;uniform sampler2D fbo_tex;void main(){color=texture(fbo_tex,v_tc);}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"line_base.vert",
|
||||
r#"#version 300 es
|
||||
precision highp float;layout(location=0)in vec2 ndc_pos;out float l;void main(){gl_Position=vec4(ndc_pos,0,1);}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"fits_i16.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2D;precision mediump int;out vec4 out_frag_color;in vec2 frag_uv;uniform sampler2D tex;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int f(vec2 v){int f=int(v.x*255.+.5)<<8|int(v.y*255.+.5);if(f>=32768)f-=65536;return f;}vec4 m(float H){float m=v(H*scale+offset);m=mix(m,1.-m,reversed);vec4 k=mix(texture(colormaps,vec2(m,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank||isnan(H)));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}void main(){out_frag_color=m(float(f(texture(tex,frag_uv).xy)));out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_raytracer_i32.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;precision lowp usampler2DArray;precision lowp isampler2DArray;precision mediump int;uniform sampler2DArray tex;in vec3 frag_pos;in vec2 out_clip_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float opacity;int t(vec2 v){int i=int(v.y<0.);return int(v.x<0.)+i|i<<1;}float i(vec2 v){float f=atan(abs(v.y),abs(v.x))*1.27323954474;return v.x<0.!=v.y<0.?1.-f:f-1.;}float i(vec3 v){float i=dot(v.xy,v.xy);return i<.1?i*(.5+i*(.125+i*(.0625+i*(.0390625+i*.02734375)))):1.f-v.z;}float t(vec3 v){float i=dot(v.xy,v.xy);return i<.1f?i*(.5+i*(.125+i*(.0625+i*(.0390625+i*.02734375)))):v.z+1.;}int i(int v,int i){v|=i<<2;i=(v^v>>1)&572662306;return v^i^i<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy v(vec3 v){float f=float(1<<0)*.5,H=i(v.xy),e,r;int c=t(v.xy),o=0,u,s;vec2 m=vec2(0);if(v.z>.66666666666){float f=sqrt(3.*i(v));m=vec2(H*f,2.-f);o=c;}else if(v.z<-.66666666666){float i=sqrt(3.*t(v));m=vec2(H*i,i);o=c+8;}else{float i=v.z*1.5;int f=int(H>i),e=int(H>=-i),s=1-e;m=vec2(H-float(f+e-1),i+float(f+s));o=(f+s<<2)+(c+(f&e)&3);}e=f*(m.x+m.y);r=f*(m.y-m.x);u=int(e);s=int(r);return HashDxDy((o<<(0<<1))+i(u,s),e-float(u),r-float(s));}vec3 i(){HashDxDy f=v(normalize(frag_pos).zxy);return vec3(vec2(f.dy,f.dx),float(textures_tiles[f.idx].texture_idx));}uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float i(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=i(v);return v*v;}float v(float v){return H==0?i(v):H==1?sqrt(i(v)):H==2?log(1e3*i(v)+1.)/log(1e3):H==3?asinh(10.*i(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 i(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int f(vec4 v){return int(v.x*255.+.5)<<24|int(v.y*255.+.5)<<16|int(v.z*255.+.5)<<8|int(v.w*255.+.5);}vec4 f(float f){float m=v(f*scale+offset);m=mix(m,1.-m,reversed);vec4 H=mix(texture(colormaps,vec2(m,(colormap_id+.5)/num_colormaps)),vec4(0),float(f==blank||isnan(f)));return i(t(v(vec4(H.xyz+k_brightness,H.w))));}void main(){vec3 v=i();v.y=1.-v.y;vec4 H=f(float(f(texture(tex,v).xyzw)));out_frag_color=H;out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"catalogs_ortho.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_orthographic(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_raytracer_i16.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;precision mediump int;uniform sampler2DArray tex;in vec3 frag_pos;in vec2 out_clip_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float t(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float v){v=t(v);return v*v;}float i(float v){return H==0?t(v):H==1?sqrt(t(v)):H==2?log(1e3*t(v)+1.)/log(1e3):H==3?asinh(10.*t(v))/3.:f(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 i(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 t(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int f(vec2 v){int f=int(v.x*255.+.5)<<8|int(v.y*255.+.5);if(f>=32768)f-=65536;return f;}vec4 v(float v){float r=i(v*scale+offset);r=mix(r,1.-r,reversed);vec4 H=mix(texture(colormaps,vec2(r,(colormap_id+.5)/num_colormaps)),vec4(0),float(v==blank||isnan(v)));return f(i(t(vec4(H.xyz+k_brightness,H.w))));}int i(vec2 v){int f=int(v.y<0.);return int(v.x<0.)+f|f<<1;}float t(vec2 v){float f=atan(abs(v.y),abs(v.x))*1.27323954474;return v.x<0.!=v.y<0.?1.-f:f-1.;}float f(vec3 v){float f=dot(v.xy,v.xy);return f<.1?f*(.5+f*(.125+f*(.0625+f*(.0390625+f*.02734375)))):1.f-v.z;}float i(vec3 v){float f=dot(v.xy,v.xy);return f<.1f?f*(.5+f*(.125+f*(.0625+f*(.0390625+f*.02734375)))):v.z+1.;}int f(int v,int f){v|=f<<2;f=(v^v>>1)&572662306;return v^f^f<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy t(vec3 v){float H=float(1<<0)*.5,r=t(v.xy),e,a;int s=i(v.xy),u=0,x,m;vec2 o=vec2(0);if(v.z>.66666666666){float H=sqrt(3.*f(v));o=vec2(r*H,2.-H);u=s;}else if(v.z<-.66666666666){float f=sqrt(3.*i(v));o=vec2(r*f,f);u=s+8;}else{float f=v.z*1.5;int H=int(r>f),e=int(r>=-f),x=1-e;o=vec2(r-float(H+e-1),f+float(H+x));u=(H+x<<2)+(s+(H&e)&3);}e=H*(o.x+o.y);a=H*(o.y-o.x);x=int(e);m=int(a);return HashDxDy((u<<(0<<1))+f(x,m),e-float(x),a-float(m));}vec3 f(){HashDxDy v=t(normalize(frag_pos).zxy);return vec3(vec2(v.dy,v.dx),float(textures_tiles[v.idx].texture_idx));}void main(){vec3 H=f();H.y=1.-H.y;vec4 i=v(float(f(texture(tex,H).xy)));out_frag_color=i;out_frag_color.w=out_frag_color.w*opacity;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_rasterizer_rgba2cmap.frag",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float v(float v){v=f(v);return v*v;}float t(float t){return H==0?f(t):H==1?sqrt(f(t)):H==2?log(1e3*f(t)+1.)/log(1e3):H==3?asinh(10.*f(t))/3.:v(t);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 f){return vec4(pow(f.x,k_gamma),pow(f.y,k_gamma),pow(f.z,k_gamma),f.w);}vec4 t(vec4 f){return vec4(mix(vec3(dot(f.xyz,vec3(.2126,.7152,.0722))),f.xyz,1.+k_saturation),f.w);}vec4 v(vec4 f){return vec4(.5+(1.+k_contrast)*(f.xyz-.5),f.w);}vec4 f(vec3 a){vec4 m=texture(colormaps,vec2(t(texture(tex,a).x),(colormap_id+.5)/num_colormaps));m.xyz=mix(m.xyz,1.-m.xyz,reversed);return f(t(v(vec4(m.xyz+k_brightness,m.w))));}void main(){out_frag_color=mix(f(frag_uv_start),f(frag_uv_end),frag_blending_factor);out_frag_color.w=opacity*out_frag_color.w;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"catalogs_mercator.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_mercator(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_raytracer_raytracer.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;precision mediump int;layout(location=0)in vec2 pos_clip_space;layout(location=1)in vec3 pos_world_space;out vec2 out_clip_pos;out vec3 frag_pos;uniform vec2 ndc_to_clip;uniform float czf;uniform mat3 model;void main(){frag_pos=model*pos_world_space;gl_Position=vec4(pos_clip_space/(ndc_to_clip*czf),0,1);out_clip_pos=pos_clip_space;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"catalogs_tan.vert",
|
||||
r#"#version 300 es
|
||||
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_gnomonic(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"line_inst_ndc.vert",
|
||||
r#"#version 300 es
|
||||
precision highp float;layout(location=0)in vec2 p_a;layout(location=1)in vec2 p_b;layout(location=2)in vec2 vertex;out vec2 l;uniform float u_width,u_height,u_thickness;void main(){vec2 v=p_b-p_a;gl_Position=vec4(p_a+v*vertex.x+(u_thickness+2.)*normalize(vec2(-v.y,v))*vertex.y*vec2(1,u_width/u_height)*(2./u_width),0,1);l=vec2(0,vertex.y);}"#,
|
||||
);
|
||||
out.insert(
|
||||
r"hips_rasterizer_raster.vert",
|
||||
r#"#version 300 es
|
||||
precision highp float;layout(location=0)in vec3 xyz;layout(location=1)in vec3 uv_start;layout(location=2)in vec3 uv_end;layout(location=3)in float time_tile_received;out vec3 frag_uv_start,frag_uv_end;out float frag_blending_factor;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf,current_time;vec2 n(vec3 f){vec2 v=vec2(-f.x,f.y);return f.z>=0.f?v:normalize(v);}vec2 v(vec3 v){float f=length(v.zx),n=sqrt((1.+sqrt(f*(f+v.z)*.5f))*.5f),z=v.y/n,l=0.;if(abs(v.x)<.005){float t=v.x/f;l=-v.x*(1.-t*t/21.)/n;}else n=sqrt((f*f-f*v.z)*2.)/n,l=sign(-v.x)*n;return vec2(l*.5,z)/1.4142135623731;}float n(float v){float f=acos(-1.)*v,z=2.*asin(v);v=z+sin(z)-f;int n=0;for(;abs(v)>125e-10&&n<100;n+=1)z-=v/(1.+cos(z)),v=z+sin(z)-f;return.5*z;}vec2 s(vec3 v){float f=n(v.y);return vec2(atan(-v.x,v.z)*cos(f)/acos(-1.),sin(f));}vec2 t(vec3 v){v.z=max(v.z,.01);return vec2(-v.x,v.y)/(v.z*acos(-1.));}uniform int u_proj;vec2 n(){vec3 f=inv_model*xyz;return u_proj==0?t(f):u_proj==1?vec2(-f.x,f.y)/(acos(-1.)*((1.+f.z)*.5)):u_proj==2?n(f):u_proj==3?vec2(-f.x,f.y)*.5/sqrt(.5+.5*f.z):u_proj==4?v(f):u_proj==5?s(f):vec2(atan(-f.x,f.z),atanh(f.y))/acos(-1.);}void main(){gl_Position=vec4(n()/(ndc_to_clip*czf),0,1);frag_uv_start=uv_start;frag_uv_end=uv_end;frag_blending_factor=min((current_time-time_tile_received)/2e2,1.);}"#,
|
||||
);
|
||||
out
|
||||
}
|
||||
@@ -58,7 +58,7 @@ pub unsafe fn transmute_vec_to_u8<I>(mut s: Vec<I>) -> Vec<u8> {
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub unsafe fn transmute_vec<I, O>(mut s: Vec<I>) -> Result<Vec<O>, &'static str> {
|
||||
if std::mem::size_of::<I>() % std::mem::size_of::<O>() > 0 {
|
||||
if !std::mem::size_of::<I>().is_multiple_of(std::mem::size_of::<O>()) {
|
||||
Err("The input type is not a multiple of the output type")
|
||||
} else {
|
||||
s.set_len(s.len() * (std::mem::size_of::<I>() / std::mem::size_of::<O>()));
|
||||
|
||||
@@ -1117,6 +1117,14 @@ otherwise it fits its content options. If those are too big the select can go ou
|
||||
left: 0.2rem;
|
||||
}
|
||||
|
||||
.aladin-link {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.aladin-link:hover {
|
||||
color: greenyellow;
|
||||
}
|
||||
|
||||
.aladin-simbadPointer-control {
|
||||
position: absolute;
|
||||
top: 7.8rem;
|
||||
|
||||
@@ -362,7 +362,7 @@ A.graphicOverlay = function (options) {
|
||||
* @returns {ProgressiveCat} Returns a new Overlay object representing the graphic overlay.
|
||||
*
|
||||
* @example
|
||||
* let gaia = A.catalogHiPS('http://axel.u-strasbg.fr/HiPSCatService/I/345/gaia2', {onClick: 'showTable', color: 'orange', name: 'Gaia', filter: myFilterFunction});
|
||||
* let gaia = A.catalogHiPS('http://axel.cds.unistra.fr/HiPSCatService/I/345/gaia2', {onClick: 'showTable', color: 'orange', name: 'Gaia', filter: myFilterFunction});
|
||||
* aladin.addCatalog(gaia)
|
||||
*/
|
||||
A.catalogHiPS = function (url, options) {
|
||||
|
||||
@@ -941,7 +941,7 @@ export let Aladin = (function () {
|
||||
objectName +
|
||||
"'";
|
||||
var url =
|
||||
"//simbad.u-strasbg.fr/simbad/sim-tap/sync?query=" +
|
||||
"//simbad.cds.unistra.fr/simbad/sim-tap/sync?query=" +
|
||||
encodeURIComponent(query) +
|
||||
"&request=doQuery&lang=adql&format=json&phase=run";
|
||||
|
||||
@@ -1831,7 +1831,7 @@ export let Aladin = (function () {
|
||||
// Do not use proxy with CORS headers until we solve that: https://github.com/MattiasBuelens/wasm-streams/issues/20
|
||||
//url = Utils.handleCORSNotSameOrigin(url).href;
|
||||
|
||||
let imageOptions = {...options, successCallback, errorCallback};
|
||||
let imageOptions = {...options, imgFormat: 'fits', successCallback, errorCallback};
|
||||
let image = new Image(url, imageOptions);
|
||||
|
||||
return image;
|
||||
|
||||
@@ -59,9 +59,9 @@
|
||||
}
|
||||
|
||||
this.maxCut = {
|
||||
webp: 1.0,
|
||||
jpeg: 1.0,
|
||||
png: 1.0,
|
||||
webp: 255.0,
|
||||
jpeg: 255.0,
|
||||
png: 255.0,
|
||||
fits: undefined // wait the default value coming from the properties
|
||||
};
|
||||
if (options && Number.isFinite(options.maxCut)) {
|
||||
@@ -95,6 +95,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
let minCut = this.minCut[this.imgFormat]
|
||||
if (this.imgFormat !== "fits") {
|
||||
minCut /= 255.0
|
||||
}
|
||||
|
||||
let maxCut = this.maxCut[this.imgFormat]
|
||||
if (this.imgFormat !== "fits") {
|
||||
maxCut /= 255.0
|
||||
}
|
||||
|
||||
// Reset the whole meta object
|
||||
return {
|
||||
blendCfg: blend,
|
||||
@@ -107,8 +117,8 @@
|
||||
kContrast: this.kContrast,
|
||||
|
||||
stretch: this.stretch,
|
||||
minCut: this.minCut[this.imgFormat],
|
||||
maxCut: this.maxCut[this.imgFormat],
|
||||
minCut,
|
||||
maxCut,
|
||||
reversed: this.reversed,
|
||||
cmapName: this.colormap,
|
||||
}
|
||||
@@ -121,7 +131,7 @@
|
||||
|
||||
this.setColormap(options.colormap, options)
|
||||
|
||||
this.setCuts(options.minCut, options.maxCut)
|
||||
this.setCuts(options.minCut, options.maxCut, options.cutFormat)
|
||||
|
||||
this.setBrightness(options.brightness)
|
||||
this.setSaturation(options.saturation)
|
||||
@@ -249,18 +259,20 @@
|
||||
};
|
||||
|
||||
// Sets the cuts for the current image format
|
||||
ColorCfg.prototype.setCuts = function(minCut, maxCut) {
|
||||
ColorCfg.prototype.setCuts = function(minCut, maxCut, imgFormat) {
|
||||
imgFormat = imgFormat || this.imgFormat;
|
||||
|
||||
if (minCut instanceof Object) {
|
||||
// Mincut is given in the form of an javascript object with all the formats
|
||||
this.minCut = minCut
|
||||
this.minCut = {...this.minCut, ...minCut};
|
||||
} else if (minCut !== null && minCut !== undefined) {
|
||||
this.minCut[this.imgFormat] = minCut;
|
||||
this.minCut[imgFormat] = minCut;
|
||||
}
|
||||
|
||||
if (maxCut instanceof Object) {
|
||||
this.maxCut = maxCut;
|
||||
this.maxCut = {...this.maxCut, ...maxCut};
|
||||
} else if (maxCut !== null && maxCut !== undefined) {
|
||||
this.maxCut[this.imgFormat] = maxCut;
|
||||
this.maxCut[imgFormat] = maxCut;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import { HiPSProperties } from "./HiPSProperties.js";
|
||||
import { Aladin } from "./Aladin.js";
|
||||
import { CooFrameEnum } from "./CooFrameEnum.js";
|
||||
import { Utils } from "./Utils"
|
||||
import { SpectraDisplayer } from "./SpectraDisplayer.js";
|
||||
|
||||
let PropertyParser = {};
|
||||
// Utilitary functions for parsing the properties and giving default values
|
||||
@@ -180,13 +179,17 @@ PropertyParser.isPlanetaryBody = function (properties) {
|
||||
* @property {number} [brightness=0.0] - The brightness value for the color configuration.
|
||||
* @property {number} [contrast=0.0] - The contrast value for the color configuration.
|
||||
* @property {string} [requestMode='cors'] - Determines how the request will interact with cross-origin resources.
|
||||
* - 'cors' - allow cross-origin requests with proper CORS headers.
|
||||
* - 'no-cors' - send the request without CORS.
|
||||
* - 'same-origin' - only allow requests to the same origin.
|
||||
* @property {string} [requestCredentials='omit'] - Specifies whether to send cookies and HTTP credentials with the request.
|
||||
* - 'omit' - never send credentials.
|
||||
* - 'same-origin' - send only for same-origin requests.
|
||||
* - 'include' - always send, even for cross-origin requests.
|
||||
* <ul>
|
||||
* <li>'cors' - allow cross-origin requests with proper CORS headers.</li>
|
||||
* <li>'no-cors' - send the request without CORS.</li>
|
||||
* <li>'same-origin' - only allow requests to the same origin.</li>
|
||||
* </ul>
|
||||
* @property {string} [requestCredentials='same-origin'] - Specifies whether to send cookies and HTTP credentials with the request.
|
||||
* <ul>
|
||||
* <li>'omit' - never send credentials.</li>
|
||||
* <li>'same-origin' - send only for same-origin requests.</li>
|
||||
* <li>'include' - always send, even for cross-origin requests.</li>
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -270,7 +273,7 @@ export let HiPS = (function () {
|
||||
this.name = (options && options.name) || id;
|
||||
this.startUrl = options.startUrl;
|
||||
this.requestMode = options && options.requestMode || 'cors';
|
||||
this.requestCredentials = options && options.requestCredentials || 'omit';
|
||||
this.requestCredentials = options && options.requestCredentials || 'same-origin';
|
||||
|
||||
this.slice = 0;
|
||||
|
||||
@@ -729,9 +732,16 @@ export let HiPS = (function () {
|
||||
*
|
||||
* @param {number} minCut - The low cut value to set for the HiPS.
|
||||
* @param {number} maxCut - The high cut value to set for the HiPS.
|
||||
* @param {string} [imgFormat] - The image format for which one wants to set the cuts. By default, the format used is the current imageFormat
|
||||
*/
|
||||
HiPS.prototype.setCuts = function (minCut, maxCut) {
|
||||
this.setOptions({minCut, maxCut})
|
||||
HiPS.prototype.setCuts = function (minCut, maxCut, imgFormat) {
|
||||
imgFormat = imgFormat?.toLowerCase();
|
||||
|
||||
if (imgFormat === "jpg") {
|
||||
imgFormat = "jpeg";
|
||||
}
|
||||
|
||||
this.setOptions({minCut, maxCut, cutFormat: imgFormat})
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -402,6 +402,7 @@ export let Image = (function () {
|
||||
|
||||
// Set the automatic computed cuts
|
||||
let [minCut, maxCut] = self.getCuts();
|
||||
|
||||
minCut = minCut || imageParams.min_cut;
|
||||
maxCut = maxCut || imageParams.max_cut;
|
||||
self.setCuts(
|
||||
|
||||
@@ -60,7 +60,7 @@ export let SimbadPointer = (function() {
|
||||
if (Utils.isNumber(magnitude)) {
|
||||
content += '<em>Mag: </em>' + magnitude + '<br>';
|
||||
}
|
||||
content += '<br><a target="_blank" href="http://cdsportal.u-strasbg.fr/?target=' + encodeURIComponent(objName) + '">Query in CDS portal</a>';
|
||||
content += '<br><a target="_blank" href="http://cdsportal.cds.unistra.fr/?target=' + encodeURIComponent(objName) + '">Query in CDS portal</a>';
|
||||
content += '</div>';
|
||||
|
||||
aladinInstance.showPopup(objCoo.lon, objCoo.lat, title, content);
|
||||
|
||||
@@ -785,11 +785,12 @@ export let View = (function () {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
view.pinchZoomParameters.isPinching = true;
|
||||
view.pinchZoomParameters.initialZoomFactor = view.zoomFactor;
|
||||
view.pinchZoomParameters.initialDistance = Math.sqrt(Math.pow(e.targetTouches[0].clientX - e.targetTouches[1].clientX, 2) + Math.pow(e.targetTouches[0].clientY - e.targetTouches[1].clientY, 2));
|
||||
|
||||
view.fingersRotationParameters.initialViewAngleFromCenter = view.wasm.getViewCenter2NorthPoleAngle();
|
||||
view.fingersRotationParameters.initialViewAngleFromCenter = view.wasm.getRotation();
|
||||
view.fingersRotationParameters.initialFingerAngle = Math.atan2(e.targetTouches[1].clientY - e.targetTouches[0].clientY, e.targetTouches[1].clientX - e.targetTouches[0].clientX) * 180.0 / Math.PI;
|
||||
|
||||
return;
|
||||
@@ -1275,6 +1276,20 @@ export let View = (function () {
|
||||
// disable text selection on IE
|
||||
//Utils.on(view.aladinDiv, "selectstart", function () { return false; })
|
||||
|
||||
view.prevWheelTime = undefined;
|
||||
|
||||
function normalizeWheel(event) {
|
||||
// Safari/Chrome on macOS: deltaMode = 0 (pixels), but trackpad steps are tiny
|
||||
let scale = 1;
|
||||
if (event.deltaMode === WheelEvent.DOM_DELTA_LINE) {
|
||||
scale = 16; // assume ~16px per line
|
||||
} else if (event.deltaMode === WheelEvent.DOM_DELTA_PAGE) {
|
||||
scale = window.innerHeight;
|
||||
}
|
||||
return event.deltaY * scale;
|
||||
}
|
||||
view.zoomDelta = 0;
|
||||
|
||||
Utils.on(view.catalogCanvas, 'wheel', function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@@ -1295,24 +1310,13 @@ export let View = (function () {
|
||||
if (typeof onWheelTriggeredFunction === 'function') {
|
||||
onWheelTriggeredFunction(e)
|
||||
} else {
|
||||
// Default Aladin Lite zooming
|
||||
view.delta = e.deltaY || e.detail || (-e.wheelDelta);
|
||||
|
||||
if (!view.throttledTouchPadZoom) {
|
||||
view.throttledTouchPadZoom = () => {
|
||||
const factor = Utils.detectTrackPad(e) ? 1.06 : 1.2;
|
||||
const currZoomFactor = view.zoom.isZooming ? view.zoom.finalZoom : view.zoomFactor;
|
||||
let newZoomFactor = view.delta > 0 ? currZoomFactor * factor : currZoomFactor / factor;
|
||||
|
||||
// inside case
|
||||
view.zoom.apply({
|
||||
stop: newZoomFactor,
|
||||
duration: 100,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
view.throttledTouchPadZoom();
|
||||
// Default Aladin Lite zooming
|
||||
const normalizedDelta = e.deltaY && normalizeWheel(e) || e.detail || (-e.wheelDelta);
|
||||
// Accumulate the normalized delta
|
||||
// We do not zoom because we cannot rely on "wheel" event
|
||||
// being triggered at constant time steps
|
||||
// The zoom is delayed to the redraw which is animation frame requested!
|
||||
view.zoomDelta += normalizedDelta;
|
||||
|
||||
if (view.mode === View.TOOL_COLOR_PICKER) {
|
||||
pickColor(xymouse);
|
||||
@@ -1386,14 +1390,25 @@ export let View = (function () {
|
||||
/**
|
||||
* redraw the whole view
|
||||
*/
|
||||
View.prototype.redraw = function (timestamp) {
|
||||
View.prototype.redraw = function (now) {
|
||||
// request another frame
|
||||
requestAnimFrame(this.redrawClbk);
|
||||
|
||||
// Elapsed time since last loop
|
||||
const now = performance.now();
|
||||
const elapsedTime = now - timestamp;
|
||||
this.dt = elapsedTime;
|
||||
const elapsedTime = now - this.prevTime;
|
||||
this.prevTime = now;
|
||||
|
||||
if (Math.abs(this.zoomDelta) > 1e-3) {
|
||||
// Apply a fraction each frame (smoothing)
|
||||
let step = this.zoomDelta * 0.2;
|
||||
function wheelToZoomFactor(delta) {
|
||||
const sensitivity = 0.002; // tune this
|
||||
return Math.exp(-delta * sensitivity);
|
||||
}
|
||||
|
||||
this.zoomFactor /= wheelToZoomFactor(step);
|
||||
this.zoomDelta -= step;
|
||||
}
|
||||
|
||||
this.moving = this.wasm.update(elapsedTime);
|
||||
|
||||
|
||||
@@ -219,11 +219,6 @@ import { TogglerActionButton } from "../Button/Toggler.js";
|
||||
value: 0.0,
|
||||
change: (e) => {
|
||||
let minCut = +e.target.value
|
||||
let imgFormat = self.options.layer.imgFormat;
|
||||
if (imgFormat !== "fits") {
|
||||
minCut /= 255.0;
|
||||
}
|
||||
|
||||
self.options.layer.setCuts(minCut, self.options.layer.getColorCfg().getCuts()[1])
|
||||
}
|
||||
},
|
||||
@@ -238,12 +233,6 @@ import { TogglerActionButton } from "../Button/Toggler.js";
|
||||
value: 1.0,
|
||||
change: (e) => {
|
||||
let maxCut = +e.target.value
|
||||
|
||||
let imgFormat = self.options.layer.imgFormat;
|
||||
if (imgFormat !== "fits") {
|
||||
maxCut /= 255.0;
|
||||
}
|
||||
|
||||
self.options.layer.setCuts(self.options.layer.getColorCfg().getCuts()[0], maxCut)
|
||||
}
|
||||
}]
|
||||
@@ -302,10 +291,6 @@ import { TogglerActionButton } from "../Button/Toggler.js";
|
||||
let reversed = colorCfg.getReversed();
|
||||
|
||||
let [minCut, maxCut] = colorCfg.getCuts();
|
||||
if (layer.imgFormat !== "fits") {
|
||||
minCut = Math.round(minCut * 255);
|
||||
maxCut = Math.round(maxCut * 255);
|
||||
}
|
||||
this.pixelSettingsContent.set('mincut', +minCut.toFixed(4))
|
||||
this.pixelSettingsContent.set('maxcut', +maxCut.toFixed(4))
|
||||
this.pixelSettingsContent.set('stretch', stretch)
|
||||
|
||||
@@ -75,7 +75,7 @@ export class OverlayStackBox extends Box {
|
||||
};*/
|
||||
static predefinedCats = {
|
||||
simbad: {
|
||||
url: "https://axel.u-strasbg.fr/HiPSCatService/SIMBAD",
|
||||
url: "https://axel.cds.unistra.fr/HiPSCatService/SIMBAD",
|
||||
options: {
|
||||
id: "simbad",
|
||||
name: "SIMBAD",
|
||||
@@ -98,7 +98,7 @@ export class OverlayStackBox extends Box {
|
||||
},
|
||||
},
|
||||
gaia: {
|
||||
url: "https://axel.u-strasbg.fr/HiPSCatService/I/355/gaiadr3",
|
||||
url: "https://axel.cds.unistra.fr/HiPSCatService/I/355/gaiadr3",
|
||||
options: {
|
||||
id: "gaia-dr3",
|
||||
name: "Gaia DR3",
|
||||
@@ -109,7 +109,7 @@ export class OverlayStackBox extends Box {
|
||||
},
|
||||
},
|
||||
twomass: {
|
||||
url: "https://axel.u-strasbg.fr/HiPSCatService/II/246/out",
|
||||
url: "https://axel.cds.unistra.fr/HiPSCatService/II/246/out",
|
||||
options: {
|
||||
id: "2mass",
|
||||
name: "2MASS",
|
||||
@@ -781,6 +781,21 @@ export class OverlayStackBox extends Box {
|
||||
})
|
||||
);
|
||||
layout = layout.concat(this._createSurveysList());
|
||||
let self = this;
|
||||
const moreHiPSLink = document.createElement("a");
|
||||
moreHiPSLink.href = "#";
|
||||
moreHiPSLink.classList.add('aladin-link');
|
||||
moreHiPSLink.textContent = "More...";
|
||||
moreHiPSLink.title = "Open the survey browser"
|
||||
moreHiPSLink.addEventListener("click", (e) => {
|
||||
e.preventDefault();
|
||||
if (!self.hipsBrowser)
|
||||
self.hipsBrowser = new HiPSBrowserBox(self.aladin);
|
||||
|
||||
self.hipsBrowser._show({ position: { anchor: "center center" } });
|
||||
});
|
||||
layout.push(moreHiPSLink)
|
||||
|
||||
|
||||
return Layout.vertical({ layout });
|
||||
}
|
||||
|
||||
109
vite.config.ts
109
vite.config.ts
@@ -7,66 +7,61 @@ import wasm from "vite-plugin-wasm";
|
||||
import topLevelAwait from "vite-plugin-top-level-await";
|
||||
// For wasm generated by wasm-pack
|
||||
import wasmPack from 'vite-plugin-wasm-pack';
|
||||
// To include and minify glsl into the bundle
|
||||
//import glsl from 'vite-plugin-glsl';
|
||||
// To include css into the bundle
|
||||
//import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
|
||||
//import fs from 'fs';
|
||||
|
||||
import { visualizer } from "rollup-plugin-visualizer";
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
minify: 'esbuild',
|
||||
lib: {
|
||||
// Could also be a dictionary or array of multiple entry points
|
||||
entry: resolve(__dirname, 'src/js/A.js'),
|
||||
name: 'A',
|
||||
formats: ["umd", "es"],
|
||||
// the proper extensions will be added
|
||||
fileName: 'aladin',
|
||||
export default defineConfig(({mode}) => {
|
||||
return {
|
||||
build: {
|
||||
minify: 'esbuild',
|
||||
lib: {
|
||||
// Could also be a dictionary or array of multiple entry points
|
||||
entry: resolve(__dirname, 'src/js/A.js'),
|
||||
name: 'A',
|
||||
formats: ["umd", "es"],
|
||||
// the proper extensions will be added
|
||||
fileName: 'aladin',
|
||||
},
|
||||
rollupOptions: {},
|
||||
//formats: ["es"],
|
||||
target: ["es2015", "chrome58", "edge18", "firefox57", "node12", "safari11"],
|
||||
//target: ["es2015"],
|
||||
// Relative to the root
|
||||
outDir: resolve(__dirname, 'dist'),
|
||||
},
|
||||
rollupOptions: {},
|
||||
//formats: ["es"],
|
||||
target: ["es2015", "chrome58", "edge18", "firefox57", "node12", "safari11"],
|
||||
//target: ["es2015"],
|
||||
// Relative to the root
|
||||
outDir: resolve(__dirname, 'dist'),
|
||||
},
|
||||
//publicDir: resolve(__dirname, 'src/img'),
|
||||
plugins: [
|
||||
wasm(),
|
||||
wasmPack(resolve(__dirname, 'src/core')),
|
||||
topLevelAwait(),
|
||||
/*glsl({
|
||||
minify: true
|
||||
}),*/
|
||||
/*visualizer({
|
||||
filename: 'stats.html', // output file
|
||||
template: 'treemap', // "sunburst", "treemap", "network"
|
||||
gzipSize: true, // show gzip sizes
|
||||
brotliSize: true, // show brotli sizes
|
||||
open: true // open stats.html automatically
|
||||
}),*/
|
||||
],
|
||||
resolve: {
|
||||
alias: [
|
||||
{find: '@', replacement: path.resolve(__dirname, '/src')},
|
||||
{find: '#', replacement: path.resolve(__dirname, '/tests/unit')},
|
||||
{find: '$', replacement: path.resolve(__dirname, '/tests/e2e')}
|
||||
//publicDir: resolve(__dirname, 'src/img'),
|
||||
plugins: [
|
||||
wasm(),
|
||||
wasmPack(resolve(__dirname, 'src/core')),
|
||||
topLevelAwait(),
|
||||
mode === 'analyze' &&
|
||||
visualizer({
|
||||
filename: 'stats.html', // output file
|
||||
template: 'treemap', // "sunburst", "treemap", "network"
|
||||
gzipSize: true, // show gzip sizes
|
||||
brotliSize: true, // show brotli sizes
|
||||
open: true // open stats.html automatically
|
||||
}),
|
||||
],
|
||||
},
|
||||
//test: {
|
||||
// globals: true,
|
||||
// environment: 'happy-dom',
|
||||
// include: [
|
||||
// 'tests/unit/**/*.{test,spec}.{js,ts}'
|
||||
// ],
|
||||
// deps: {
|
||||
// inline: ['core/pkg'],
|
||||
// },
|
||||
//},
|
||||
server: {
|
||||
open: '/examples/index.html',
|
||||
},
|
||||
resolve: {
|
||||
alias: [
|
||||
{find: '@', replacement: path.resolve(__dirname, '/src')},
|
||||
{find: '#', replacement: path.resolve(__dirname, '/tests/unit')},
|
||||
{find: '$', replacement: path.resolve(__dirname, '/tests/e2e')}
|
||||
],
|
||||
},
|
||||
//test: {
|
||||
// globals: true,
|
||||
// environment: 'happy-dom',
|
||||
// include: [
|
||||
// 'tests/unit/**/*.{test,spec}.{js,ts}'
|
||||
// ],
|
||||
// deps: {
|
||||
// inline: ['core/pkg'],
|
||||
// },
|
||||
//},
|
||||
server: {
|
||||
open: '/examples/index.html',
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user