script to make colormaps
43
dist/index-color-composite.html
vendored
@@ -53,23 +53,17 @@
|
||||
<td>
|
||||
<label for="colormap_c1">Colormap</label>
|
||||
<select id="colormap_c1">
|
||||
<option value="BlackWhiteLinear">BlackWhiteLinear</option>
|
||||
<option value="RedTemperature">RedTemperature</option>
|
||||
<option value="IDLCBGnBu">IDLCBGnBu</option>
|
||||
<option value="IDLCBYIGnBu">IDLCBYIGnBu</option>
|
||||
<option value="IDLCBBrBG">IDLCBBrBG</option>
|
||||
<option value="BluePastelRed">BluePastelRed</option>
|
||||
<option value="Viridis">Viridis</option>
|
||||
<option value="Plasma">Plasma</option>
|
||||
<option value="Magma">Magma</option>
|
||||
<option value="Inferno">Inferno</option>
|
||||
<option value="Turbo">Turbo</option>
|
||||
<option value="YIOrBr">YIOrBr</option>
|
||||
<option value="Stern">Stern</option>
|
||||
<option value="Parula">Parula</option>
|
||||
<option value="EOSB">EOSB</option>
|
||||
<option value="Spectral">Spectral</option>
|
||||
<option value="blackwhite">blackwhite</option>
|
||||
<option value="blues">blues</option>
|
||||
<option value="parula">parula</option>
|
||||
<option value="rainbow">rainbow</option>
|
||||
<option value="redtemperature">redtemperature</option>
|
||||
<option value="RdBu">RdBu</option>
|
||||
<option value="RdYiBu">RdYiBu</option>
|
||||
<option value="spectral">spectral</option>
|
||||
<option value="summer">summer</option>
|
||||
<option value="YIGnBu">YIGnBu</option>
|
||||
<option value="YIOrBr">YIOrBr</option>
|
||||
<option value="Nothing" selected>Nothing</option>
|
||||
</select>
|
||||
<br>
|
||||
@@ -205,12 +199,17 @@
|
||||
<br />
|
||||
<label for="colormap_cat">Colormap</label>
|
||||
<select id="colormap_cat">
|
||||
<option value="BlackWhiteLinear">BlackWhiteLinear</option>
|
||||
<option value="RedTemperature">RedTemperature</option>
|
||||
<option value="IDLCBGnBu">IDLCBGnBu</option>
|
||||
<option value="IDLCBYIGnBu">IDLCBYIGnBu</option>
|
||||
<option value="IDLCBBrBG">IDLCBBrBG</option>
|
||||
<option value="BluePastelRed" selected>BluePastelRed</option>
|
||||
<option value="blackwhite">blackwhite</option>
|
||||
<option value="blues">blues</option>
|
||||
<option value="parula">parula</option>
|
||||
<option value="rainbow">rainbow</option>
|
||||
<option value="RdBu">RdBu</option>
|
||||
<option value="RdYiBu">RdYiBu</option>
|
||||
<option value="redtemperature">redtemperature</option>
|
||||
<option value="spectral">spectral</option>
|
||||
<option value="summer">summer</option>
|
||||
<option value="YIGnBu">YIGnBu</option>
|
||||
<option value="YIOrBr">YIOrBr</option>
|
||||
</select>
|
||||
<p id="loading"></p>
|
||||
</div>
|
||||
|
||||
BIN
src/core/img/colormaps/RdBu.png
Normal file
|
After Width: | Height: | Size: 332 B |
BIN
src/core/img/colormaps/RdYiBu.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
src/core/img/colormaps/YIGnBu.png
Normal file
|
After Width: | Height: | Size: 319 B |
BIN
src/core/img/colormaps/YIOrBr.png
Normal file
|
After Width: | Height: | Size: 280 B |
BIN
src/core/img/colormaps/blackwhite.png
Normal file
|
After Width: | Height: | Size: 121 B |
BIN
src/core/img/colormaps/blues.png
Normal file
|
After Width: | Height: | Size: 255 B |
BIN
src/core/img/colormaps/colormaps.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
10
src/core/img/colormaps/makecolormap.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
rm -rf colormaps.png
|
||||
|
||||
for colormap_filename in `ls *.png | sort -V`; do
|
||||
convert "$colormap_filename" -crop 256x1+0+0 +repage "$colormap_filename"s
|
||||
done
|
||||
|
||||
convert -append *.pngs colormaps.png
|
||||
|
||||
rm -rf *.pngs
|
||||
|
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 346 B |
BIN
src/core/img/colormaps/rainbow.png
Normal file
|
After Width: | Height: | Size: 253 B |
BIN
src/core/img/colormaps/redtemperature.png
Normal file
|
After Width: | Height: | Size: 196 B |
BIN
src/core/img/colormaps/spectral.png
Normal file
|
After Width: | Height: | Size: 309 B |
BIN
src/core/img/colormaps/summer.png
Normal file
|
After Width: | Height: | Size: 137 B |
@@ -18,6 +18,7 @@ use crate::{
|
||||
},
|
||||
resources::Resources,
|
||||
shader::ShaderManager,
|
||||
shaders::Colormaps,
|
||||
time::DeltaTime,
|
||||
utils,
|
||||
webgl_ctx::WebGl2Context,
|
||||
@@ -71,6 +72,7 @@ pub struct App {
|
||||
catalog_loaded: bool,
|
||||
|
||||
pub system: CooSystem,
|
||||
pub colormaps: Colormaps,
|
||||
}
|
||||
|
||||
use cgmath::{Vector2, Vector3};
|
||||
@@ -175,7 +177,7 @@ impl App {
|
||||
let downloader = TileDownloader::new();
|
||||
// The surveys storing the textures of the resolved tiles
|
||||
let surveys =
|
||||
ImageSurveys::new::<Orthographic>(&gl, &camera, &mut shaders, &resources, &system);
|
||||
ImageSurveys::new::<Orthographic>(&gl, &camera, &mut shaders, &system);
|
||||
|
||||
//let color = sdss.color();
|
||||
//let survey = sdss.create(&gl, &camera, &surveys, exec.clone())?;
|
||||
@@ -202,6 +204,8 @@ impl App {
|
||||
let out_of_fov = false;
|
||||
let catalog_loaded = false;
|
||||
|
||||
let colormaps = Colormaps::new(&gl, &resources)?;
|
||||
|
||||
let app = App {
|
||||
gl,
|
||||
|
||||
@@ -233,6 +237,8 @@ impl App {
|
||||
tasks_finished,
|
||||
catalog_loaded,
|
||||
system,
|
||||
|
||||
colormaps
|
||||
};
|
||||
|
||||
Ok(app)
|
||||
@@ -520,12 +526,11 @@ impl App {
|
||||
self.gl.clear(WebGl2RenderingContext::COLOR_BUFFER_BIT);
|
||||
|
||||
//self.gl.blend_func(WebGl2RenderingContext::SRC_ALPHA, WebGl2RenderingContext::ONE);
|
||||
self.surveys.draw::<P>(&self.camera, &mut self.shaders);
|
||||
self.surveys.draw::<P>(&self.camera, &mut self.shaders, &self.colormaps);
|
||||
self.gl.enable(WebGl2RenderingContext::BLEND);
|
||||
|
||||
// Draw the catalog
|
||||
self.manager
|
||||
.draw::<P>(&self.gl, &mut self.shaders, &self.camera);
|
||||
self.manager.draw::<P>(&self.gl, &mut self.shaders, &self.camera, &self.colormaps)?;
|
||||
|
||||
self.grid.draw::<P>(&self.camera, &mut self.shaders)?;
|
||||
self.gl.disable(WebGl2RenderingContext::BLEND);
|
||||
@@ -540,7 +545,7 @@ impl App {
|
||||
pub fn set_image_surveys(&mut self, hipses: Vec<SimpleHiPS>) -> Result<(), JsValue> {
|
||||
let new_survey_ids =
|
||||
self.surveys
|
||||
.set_image_surveys(hipses, &self.gl, &self.camera, self.exec.clone())?;
|
||||
.set_image_surveys(hipses, &self.gl, &self.camera, self.exec.clone(), &self.colormaps)?;
|
||||
self.downloader.clear_requests();
|
||||
|
||||
if !new_survey_ids.is_empty() {
|
||||
@@ -605,9 +610,9 @@ impl App {
|
||||
pub fn add_catalog(&mut self, name: String, table: JsValue, colormap: String) {
|
||||
let mut exec_ref = self.exec.borrow_mut();
|
||||
let table = table;
|
||||
let colormap = Colormap::new(&self.gl, &self.resources, &colormap).unwrap();
|
||||
let c = self.colormaps.get(&colormap);
|
||||
|
||||
exec_ref.spawner().spawn(TaskType::ParseTable, async {
|
||||
exec_ref.spawner().spawn(TaskType::ParseTable, async move {
|
||||
let mut stream = ParseTable::<[f32; 2]>::new(table);
|
||||
let mut results: Vec<Source> = vec![];
|
||||
|
||||
@@ -625,7 +630,7 @@ impl App {
|
||||
TaskResult::TableParsed {
|
||||
name,
|
||||
sources: results,
|
||||
colormap,
|
||||
colormap: c,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ use crate::{
|
||||
renderable::{image_survey::ImageSurveys, projection::Projection, Angle, ArcDeg},
|
||||
resources::Resources,
|
||||
shader::{Shader, ShaderManager},
|
||||
shaders::Colormap,
|
||||
shaders::Colormaps,
|
||||
time::DeltaTime,
|
||||
webgl_ctx::WebGl2Context,
|
||||
};
|
||||
@@ -495,7 +495,7 @@ impl WebClient {
|
||||
name_catalog: String,
|
||||
colormap: String,
|
||||
) -> Result<(), JsValue> {
|
||||
let colormap = Colormap::new(&self.app.gl, &self.app.resources, &name_catalog)?;
|
||||
let colormap = self.app.colormaps.get(&colormap);
|
||||
self.projection
|
||||
.set_catalog_colormap(&mut self.app, name_catalog, colormap)?;
|
||||
|
||||
@@ -552,7 +552,7 @@ impl WebClient {
|
||||
|
||||
#[wasm_bindgen(js_name = getAvailableColormapList)]
|
||||
pub fn get_available_colormap_list(&self) -> Result<JsValue, JsValue> {
|
||||
let colormaps = Colormap::get_list_available_colormaps()
|
||||
let colormaps = Colormaps::get_list_available_colormaps()
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -120,7 +120,7 @@ impl Manager {
|
||||
let indices: Vec<u16> = vec![0, 1, 2, 0, 2, 3];
|
||||
|
||||
let mut vao = VertexArrayObject::new(gl);
|
||||
let shader = Colormap::get_catalog_shader(gl, shaders);
|
||||
let shader = Colormap::get_catalog_shader(gl, shaders)?;
|
||||
shader
|
||||
.bind(gl)
|
||||
.bind_vertex_array_object(&mut vao)
|
||||
@@ -244,10 +244,13 @@ impl Manager {
|
||||
gl: &WebGl2Context,
|
||||
shaders: &mut ShaderManager,
|
||||
camera: &CameraViewPort,
|
||||
) {
|
||||
colormaps: &Colormaps
|
||||
) -> Result<(), JsValue> {
|
||||
for catalog in self.catalogs.values() {
|
||||
catalog.draw::<P>(&gl, shaders, self, camera);
|
||||
catalog.draw::<P>(&gl, shaders, self, camera, colormaps)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +274,7 @@ const MAX_SOURCES_PER_CATALOG: f32 = 50000.0;
|
||||
|
||||
use crate::renderable::view_on_surveys::depth_from_pixels_on_screen;
|
||||
use crate::renderable::{HEALPixCells, HEALPixCellsInView};
|
||||
|
||||
use crate::shaders::Colormaps;
|
||||
impl Catalog {
|
||||
fn new<P: Projection>(
|
||||
gl: &WebGl2Context,
|
||||
@@ -455,82 +458,87 @@ impl Catalog {
|
||||
shaders: &mut ShaderManager,
|
||||
manager: &Manager, // catalog manager
|
||||
camera: &CameraViewPort,
|
||||
) {
|
||||
colormaps: &Colormaps,
|
||||
) -> Result<(), JsValue> {
|
||||
// If the catalog is transparent, simply discard the draw
|
||||
if self.alpha == 0_f32 {
|
||||
return;
|
||||
if self.alpha > 0_f32 {
|
||||
// Render to the FRAMEBUFFER
|
||||
gl.blend_func_separate(
|
||||
WebGl2RenderingContext::SRC_ALPHA,
|
||||
WebGl2RenderingContext::ONE,
|
||||
WebGl2RenderingContext::ONE,
|
||||
WebGl2RenderingContext::ONE,
|
||||
);
|
||||
{
|
||||
// bind the FBO
|
||||
gl.bind_framebuffer(WebGl2RenderingContext::FRAMEBUFFER, manager.fbo.as_ref());
|
||||
let (fbo_width, fbo_height) = manager.fbo_texture.get_size();
|
||||
// Set the camera
|
||||
gl.viewport(0, 0, fbo_width as i32, fbo_height as i32);
|
||||
gl.scissor(0, 0, fbo_width as i32, fbo_height as i32);
|
||||
|
||||
gl.clear_color(0.0, 0.0, 0.0, 1.0);
|
||||
gl.clear(WebGl2RenderingContext::COLOR_BUFFER_BIT);
|
||||
|
||||
let shader = P::get_catalog_shader(gl, shaders);
|
||||
let shader_bound = shader.bind(gl);
|
||||
|
||||
shader_bound
|
||||
.attach_uniforms_from(camera)
|
||||
// Attach catalog specialized uniforms
|
||||
.attach_uniform("kernel_texture", &manager.kernel_texture) // Gaussian kernel texture
|
||||
.attach_uniform("strength", &self.strength) // Strengh of the kernel
|
||||
.attach_uniform("current_time", &utils::get_current_time())
|
||||
.attach_uniform("kernel_size", &manager.kernel_size)
|
||||
.attach_uniform("max_density", &self.max_density)
|
||||
.bind_vertex_array_object_ref(&self.vertex_array_object_catalog)
|
||||
.draw_elements_instanced_with_i32(
|
||||
WebGl2RenderingContext::TRIANGLES,
|
||||
0,
|
||||
self.num_instances,
|
||||
);
|
||||
|
||||
// Unbind the FBO
|
||||
gl.bind_framebuffer(WebGl2RenderingContext::FRAMEBUFFER, None);
|
||||
}
|
||||
//gl.disable(WebGl2RenderingContext::BLEND);
|
||||
gl.blend_func_separate(
|
||||
WebGl2RenderingContext::SRC_ALPHA,
|
||||
WebGl2RenderingContext::ONE_MINUS_SRC_ALPHA,
|
||||
WebGl2RenderingContext::ONE,
|
||||
WebGl2RenderingContext::ONE,
|
||||
);
|
||||
|
||||
// Render to the heatmap to the screen
|
||||
{
|
||||
// Set the camera
|
||||
let size = camera.get_screen_size();
|
||||
gl.viewport(0, 0, size.x as i32, size.y as i32);
|
||||
|
||||
let shader = shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapCatalogVS"),
|
||||
Cow::Borrowed("ColormapCatalogFS"),
|
||||
),
|
||||
)?;
|
||||
//self.colormap.get_shader(gl, shaders);
|
||||
shader.bind(gl)
|
||||
.attach_uniform("texture_fbo", &manager.fbo_texture) // FBO density texture computed just above
|
||||
.attach_uniform("alpha", &self.alpha) // Alpha channel
|
||||
.attach_uniforms_from(&self.colormap)
|
||||
.attach_uniforms_from(colormaps)
|
||||
.attach_uniform("reversed", &false)
|
||||
.bind_vertex_array_object_ref(&manager.vertex_array_object_screen)
|
||||
.draw_elements_with_i32(
|
||||
WebGl2RenderingContext::TRIANGLES,
|
||||
None,
|
||||
WebGl2RenderingContext::UNSIGNED_SHORT,
|
||||
);
|
||||
}
|
||||
}
|
||||
// Render to the FRAMEBUFFER
|
||||
gl.blend_func_separate(
|
||||
WebGl2RenderingContext::SRC_ALPHA,
|
||||
WebGl2RenderingContext::ONE,
|
||||
WebGl2RenderingContext::ONE,
|
||||
WebGl2RenderingContext::ONE,
|
||||
);
|
||||
{
|
||||
// bind the FBO
|
||||
gl.bind_framebuffer(WebGl2RenderingContext::FRAMEBUFFER, manager.fbo.as_ref());
|
||||
let (fbo_width, fbo_height) = manager.fbo_texture.get_size();
|
||||
// Set the camera
|
||||
gl.viewport(0, 0, fbo_width as i32, fbo_height as i32);
|
||||
gl.scissor(0, 0, fbo_width as i32, fbo_height as i32);
|
||||
|
||||
gl.clear_color(0.0, 0.0, 0.0, 1.0);
|
||||
gl.clear(WebGl2RenderingContext::COLOR_BUFFER_BIT);
|
||||
|
||||
let shader = P::get_catalog_shader(gl, shaders);
|
||||
let shader_bound = shader.bind(gl);
|
||||
|
||||
shader_bound
|
||||
.attach_uniforms_from(camera)
|
||||
// Attach catalog specialized uniforms
|
||||
.attach_uniform("kernel_texture", &manager.kernel_texture) // Gaussian kernel texture
|
||||
.attach_uniform("strength", &self.strength) // Strengh of the kernel
|
||||
.attach_uniform("current_time", &utils::get_current_time())
|
||||
.attach_uniform("kernel_size", &manager.kernel_size)
|
||||
.attach_uniform("max_density", &self.max_density)
|
||||
.bind_vertex_array_object_ref(&self.vertex_array_object_catalog)
|
||||
.draw_elements_instanced_with_i32(
|
||||
WebGl2RenderingContext::TRIANGLES,
|
||||
0,
|
||||
self.num_instances,
|
||||
);
|
||||
|
||||
// Unbind the FBO
|
||||
gl.bind_framebuffer(WebGl2RenderingContext::FRAMEBUFFER, None);
|
||||
}
|
||||
//gl.disable(WebGl2RenderingContext::BLEND);
|
||||
gl.blend_func_separate(
|
||||
WebGl2RenderingContext::SRC_ALPHA,
|
||||
WebGl2RenderingContext::ONE_MINUS_SRC_ALPHA,
|
||||
WebGl2RenderingContext::ONE,
|
||||
WebGl2RenderingContext::ONE,
|
||||
);
|
||||
|
||||
// Render to the heatmap to the screen
|
||||
{
|
||||
// Set the camera
|
||||
let size = camera.get_screen_size();
|
||||
gl.viewport(0, 0, size.x as i32, size.y as i32);
|
||||
|
||||
let shader = shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapCatalogVS"),
|
||||
Cow::Borrowed("ColormapCatalogFS"),
|
||||
),
|
||||
).unwrap();
|
||||
//self.colormap.get_shader(gl, shaders);
|
||||
shader.bind(gl)
|
||||
.attach_uniform("texture_fbo", &manager.fbo_texture) // FBO density texture computed just above
|
||||
.attach_uniform("alpha", &self.alpha) // Alpha channel
|
||||
.bind_vertex_array_object_ref(&manager.vertex_array_object_screen)
|
||||
.draw_elements_with_i32(
|
||||
WebGl2RenderingContext::TRIANGLES,
|
||||
None,
|
||||
WebGl2RenderingContext::UNSIGNED_SHORT,
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub trait CatalogShaderProjection {
|
||||
|
||||
@@ -243,7 +243,7 @@ trait Draw {
|
||||
color: &Color,
|
||||
opacity: f32,
|
||||
blank_pixel_color: &color::Color,
|
||||
colormap: &Colormap,
|
||||
colormaps: &Colormaps,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ impl SendUniforms for GrayscaleParameter {
|
||||
pub enum Color {
|
||||
Colored,
|
||||
Grayscale2Colormap {
|
||||
colormap: Rc<Colormap>,
|
||||
colormap: Colormap,
|
||||
param: GrayscaleParameter,
|
||||
reversed: bool,
|
||||
},
|
||||
@@ -346,7 +346,7 @@ impl SendUniforms for Color {
|
||||
reversed,
|
||||
} => {
|
||||
shader
|
||||
.attach_uniforms_from(&**colormap)
|
||||
.attach_uniforms_from(colormap)
|
||||
.attach_uniforms_from(param)
|
||||
.attach_uniform("reversed", reversed);
|
||||
}
|
||||
@@ -824,7 +824,7 @@ impl Draw for ImageSurvey {
|
||||
color: &Color,
|
||||
opacity: f32,
|
||||
blank_pixel_color: &color::Color,
|
||||
colormap: &Colormap,
|
||||
colormaps: &Colormaps,
|
||||
) {
|
||||
if !self.textures.is_ready() {
|
||||
// Do not render while the 12 base cell textures
|
||||
@@ -849,7 +849,8 @@ impl Draw for ImageSurvey {
|
||||
.attach_uniform("blank_color", &blank_pixel_color)
|
||||
.attach_uniform("current_depth", &(self.view.get_cells().get_depth() as i32))
|
||||
.attach_uniform("current_time", &utils::get_current_time())
|
||||
.attach_uniform("opacity", &opacity);
|
||||
.attach_uniform("opacity", &opacity)
|
||||
.attach_uniforms_from(colormaps);
|
||||
|
||||
raytracer.draw(&shader);
|
||||
|
||||
@@ -894,7 +895,8 @@ impl Draw for ImageSurvey {
|
||||
.attach_uniform("blank_color", &blank_pixel_color)
|
||||
.attach_uniform("current_depth", &(self.view.get_cells().get_depth() as i32))
|
||||
.attach_uniform("current_time", &utils::get_current_time())
|
||||
.attach_uniform("opacity", &opacity);
|
||||
.attach_uniform("opacity", &opacity)
|
||||
.attach_uniforms_from(colormaps);
|
||||
|
||||
// The raster vao is bound at the lib.rs level
|
||||
self.gl.draw_elements_with_i32(
|
||||
@@ -919,16 +921,15 @@ pub trait HiPS {
|
||||
) -> Result<ImageSurvey, JsValue>;
|
||||
fn color(
|
||||
&self,
|
||||
colormap_tex: Rc<Colormap>
|
||||
colormaps: &Colormaps
|
||||
) -> Color;
|
||||
}
|
||||
|
||||
use crate::{HiPSColor, SimpleHiPS};
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use crate::core::Texture2D;
|
||||
impl HiPS for SimpleHiPS {
|
||||
fn color(&self, colormap_tex: Rc<Colormap>) -> Color {
|
||||
fn color(&self, colormaps: &Colormaps) -> Color {
|
||||
let color = match self.color.clone() {
|
||||
HiPSColor::Color => Color::Colored,
|
||||
HiPSColor::Grayscale2Color { color, transfer, k } => Color::Grayscale2Color {
|
||||
@@ -945,7 +946,7 @@ impl HiPS for SimpleHiPS {
|
||||
transfer,
|
||||
reversed,
|
||||
} => Color::Grayscale2Colormap {
|
||||
colormap: colormap_tex,
|
||||
colormap: colormaps.get(&colormap),
|
||||
reversed,
|
||||
param: GrayscaleParameter {
|
||||
h: transfer.into(),
|
||||
@@ -992,8 +993,6 @@ pub struct ImageSurveys {
|
||||
|
||||
raytracer: RayTracer,
|
||||
gl: WebGl2Context,
|
||||
|
||||
colormap: Rc<Colormap>,
|
||||
}
|
||||
|
||||
use crate::buffer::Tiles;
|
||||
@@ -1002,12 +1001,12 @@ use crate::buffer::{TileArrayBufferImage, TileHTMLImage};
|
||||
|
||||
use crate::coo_conversion::CooSystem;
|
||||
use crate::Resources;
|
||||
use crate::shaders::Colormaps;
|
||||
impl ImageSurveys {
|
||||
pub fn new<P: Projection>(
|
||||
gl: &WebGl2Context,
|
||||
camera: &CameraViewPort,
|
||||
shaders: &mut ShaderManager,
|
||||
rs: &Resources,
|
||||
system: &CooSystem,
|
||||
) -> Self {
|
||||
let surveys = HashMap::new();
|
||||
@@ -1024,7 +1023,6 @@ impl ImageSurveys {
|
||||
|
||||
let ordered_layer_names = vec![];
|
||||
|
||||
let colormap = Rc::new(Colormap::new(&gl, rs, "parula").unwrap());
|
||||
ImageSurveys {
|
||||
surveys,
|
||||
ordered_layer_names,
|
||||
@@ -1033,8 +1031,6 @@ impl ImageSurveys {
|
||||
|
||||
raytracer,
|
||||
gl,
|
||||
|
||||
colormap,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1094,7 +1090,7 @@ impl ImageSurveys {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn draw<P: Projection>(&mut self, camera: &CameraViewPort, shaders: &mut ShaderManager) {
|
||||
pub fn draw<P: Projection>(&mut self, camera: &CameraViewPort, shaders: &mut ShaderManager, colormaps: &Colormaps) {
|
||||
let raytracing = camera.get_aperture() > P::RASTER_THRESHOLD_ANGLE;
|
||||
|
||||
if raytracing {
|
||||
@@ -1148,7 +1144,7 @@ impl ImageSurveys {
|
||||
color,
|
||||
*opacity,
|
||||
&blank_pixel_color,
|
||||
&self.colormap,
|
||||
&colormaps,
|
||||
);
|
||||
|
||||
idx_survey += 1;
|
||||
@@ -1171,6 +1167,7 @@ impl ImageSurveys {
|
||||
gl: &WebGl2Context,
|
||||
camera: &CameraViewPort,
|
||||
exec: Rc<RefCell<TaskExecutor>>,
|
||||
colormaps: &Colormaps,
|
||||
) -> Result<Vec<String>, JsValue> {
|
||||
// Limit the number of HiPS received to 4
|
||||
// The number of texture units accepted by the large majority of machine
|
||||
@@ -1213,7 +1210,7 @@ impl ImageSurveys {
|
||||
layer_name.clone(),
|
||||
ImageSurveyLayer {
|
||||
names: vec![url.clone()],
|
||||
colors: vec![hips.color(self.colormap.clone())],
|
||||
colors: vec![hips.color(colormaps)],
|
||||
opacity,
|
||||
name_most_precised_survey: url.clone(),
|
||||
},
|
||||
@@ -1225,7 +1222,7 @@ impl ImageSurveys {
|
||||
continue;
|
||||
} else {
|
||||
layer.names.push(url.clone());
|
||||
layer.colors.push(hips.color(self.colormap.clone()));
|
||||
layer.colors.push(hips.color(&colormaps));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -341,6 +341,23 @@ pub enum Error {
|
||||
FileNotFound { message: String },
|
||||
}
|
||||
|
||||
use wasm_bindgen::JsValue;
|
||||
impl From<Error> for JsValue {
|
||||
fn from(e: Error) -> Self {
|
||||
match e {
|
||||
Error::ShaderAlreadyInserted { message } => {
|
||||
JsValue::from_str(&format!("Shader already inserted: {:?}", message))
|
||||
},
|
||||
Error::ShaderNotFound { message } => {
|
||||
JsValue::from_str(&format!("Shader not found: {:?}", message))
|
||||
},
|
||||
Error::FileNotFound { message } => {
|
||||
JsValue::from_str(&format!("Shader not found: {:?}", message))
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
use serde::Deserialize;
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct FileSrc {
|
||||
|
||||
@@ -1,983 +1,12 @@
|
||||
/*// Blue & Pastel & Red
|
||||
float colormap_red(float x) {
|
||||
if (x < 0.1131206452846527) {
|
||||
return (-9.40943766883858E+02 * x - 1.84146720562529E+02) * x + 3.28713709677420E+01;
|
||||
} else if (x < 0.5116005837917328) {
|
||||
return 0.0;
|
||||
} else if (x < 0.5705677568912506) {
|
||||
return (-2.22507913165263E+03 * x + 2.76053354341733E+03) * x - 8.29909138655453E+02;
|
||||
} else if (x < 0.622047244) {
|
||||
return (-1.84774532967032E+04 * x + 2.30647002747253E+04) * x - 7.12389120879120E+03;
|
||||
} else if (x < 0.7922459542751312) {
|
||||
return ((((1.29456468589020E+06 * x - 4.64095889653844E+06) * x + 6.62951004830418E+06) * x - 4.71587036142377E+06) * x + 1.67048886368434E+06) * x - 2.35682532934682E+05;
|
||||
} else {
|
||||
return 3.34889230769210E+02 * x - 1.41006123680226E+02;
|
||||
}
|
||||
}
|
||||
|
||||
float colormap_green(float x) {
|
||||
if (x < 0.114394336938858) {
|
||||
return 0.0;
|
||||
} else if (x < 0.4417250454425812) {
|
||||
return (9.43393359191585E+02 * x + 1.86774918014536E+02) * x - 3.37113020096108E+01;
|
||||
} else if (x < 0.4964917968308496) {
|
||||
return 3.11150000000070E+02 * x + 9.54249999999731E+01;
|
||||
} else if (x < 0.6259051214039278) {
|
||||
return -1.03272635599706E+03 * x + 7.62648586707481E+02;
|
||||
} else if (x < 0.8049814403057098) {
|
||||
return -2.92799028677160E+02 * x + 2.99524283071235E+02;
|
||||
} else {
|
||||
return (1.34145201311283E+03 * x - 2.75066701126586E+03) * x + 1.40880802982723E+03;
|
||||
}
|
||||
}
|
||||
|
||||
float colormap_blue(float x) {
|
||||
if (x < 0.4424893036638088) {
|
||||
return 3.09636968527514E+02 * x + 9.62203074056821E+01;
|
||||
} else if (x < 0.5) {
|
||||
return -4.59921428571535E+02 * x + 4.36741666666678E+02;
|
||||
} else if (x < 0.5691165986930345) {
|
||||
return -1.81364912280674E+03 * x + 1.05392982456125E+03;
|
||||
} else if (x < 0.6279306709766388) {
|
||||
return 1.83776470588197E+02 * x - 8.28382352940910E+01;
|
||||
} else {
|
||||
return ((-1.14087926835422E+04 * x + 2.47091243363548E+04) * x - 1.80428756181930E+04) * x + 4.44421976986281E+03;
|
||||
}
|
||||
}
|
||||
|
||||
vec4 bluepastelred_f(float x) {
|
||||
float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);
|
||||
float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);
|
||||
float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);
|
||||
return vec4(r, g, b, 1.0);
|
||||
}
|
||||
|
||||
// Red
|
||||
float c_red(float x) {
|
||||
return 1.448953446096850 * x - 5.02253539008443e-1;
|
||||
}
|
||||
|
||||
float c_green(float x) {
|
||||
return 1.889376646180860 * x - 2.272028094820020e2;
|
||||
}
|
||||
|
||||
float c_blue(float x) {
|
||||
return 3.92613636363636 * x - 7.46528409090909e+2;
|
||||
}
|
||||
|
||||
vec4 red_f(float x) {
|
||||
float t = x * 255.0;
|
||||
float r = clamp(c_red(t) / 255.0, 0.0, 1.0);
|
||||
float g = clamp(c_green(t) / 255.0, 0.0, 1.0);
|
||||
float b = clamp(c_blue(t) / 255.0, 0.0, 1.0);
|
||||
|
||||
return vec4(r, g, b, 1.0);
|
||||
}
|
||||
// Gray
|
||||
vec4 blackw_f(float x) {
|
||||
float d = clamp(x, 0.0, 1.0);
|
||||
return vec4(d, d, d, 1.0);
|
||||
}
|
||||
// IDLCBGnBu
|
||||
float cbgnbu_red(float x) {
|
||||
float v = ((((-2.83671754639782E+03 * x + 6.51753994553536E+03) * x - 5.00110948171466E+03) * x + 1.30359712298773E+03) * x - 2.89958300810074E+02) * x + 2.48458039402758E+02;
|
||||
if (v < 8.0) {
|
||||
return 8.0;
|
||||
} else {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
float cbgnbu_green(float x) {
|
||||
return (((((-1.36304822155833E+03 * x + 4.37691418182849E+03) * x - 5.01802019417285E+03) * x + 2.39971481269598E+03) * x - 5.65401491984724E+02) * x - 1.48189675724133E+01) * x + 2.50507618187374E+02;
|
||||
}
|
||||
|
||||
float cbgnbu_blue(float x) {
|
||||
if (x < 0.3756393599187693) {
|
||||
return (9.62948273917718E+01 * x - 1.96136874142438E+02) * x + 2.41033490809633E+02;
|
||||
} else if (x < 0.6215448666633865) {
|
||||
return 1.21184043778803E+02 * x + 1.35422939068100E+02;
|
||||
} else if (x < 0.8830064316178203) {
|
||||
return -1.53052165744713E+02 * x + 3.05873047350666E+02;
|
||||
} else {
|
||||
return -3.49468965517114E+02 * x + 4.79310344827486E+02;
|
||||
}
|
||||
}
|
||||
|
||||
vec4 cbgnbu_f(float x) {
|
||||
float r = clamp(cbgnbu_red(x) / 255.0, 0.0, 1.0);
|
||||
float g = clamp(cbgnbu_green(x) / 255.0, 0.0, 1.0);
|
||||
float b = clamp(cbgnbu_blue(x) / 255.0, 0.0, 1.0);
|
||||
return vec4(r, g, b, 1.0);
|
||||
}
|
||||
// IDLCBYIGnBu
|
||||
float CBYIGnBu_red(float x) {
|
||||
if (x < 0.2523055374622345) {
|
||||
return (-5.80630393656902E+02 * x - 8.20261301968494E+01) * x + 2.53829637096771E+02;
|
||||
} else if (x < 0.6267540156841278) {
|
||||
return (((-4.07958939010649E+03 * x + 8.13296992114899E+03) * x - 5.30725139102868E+03) * x + 8.58474724851723E+02) * x + 2.03329669375107E+02;
|
||||
} else if (x < 0.8763731146612115) {
|
||||
return 3.28717357910916E+01 * x + 8.82117255504255E+00;
|
||||
} else {
|
||||
return -2.29186583577707E+02 * x + 2.38482038123159E+02;
|
||||
}
|
||||
}
|
||||
|
||||
float CBYIGnBu_green(float x) {
|
||||
if (x < 0.4578040540218353) {
|
||||
return ((4.49001704856054E+02 * x - 5.56217473429394E+02) * x + 2.09812296466262E+01) * x + 2.52987561849833E+02;
|
||||
} else {
|
||||
return ((1.28031059709139E+03 * x - 2.71007279113343E+03) * x + 1.52699334501816E+03) * x - 6.48190622715140E+01;
|
||||
}
|
||||
}
|
||||
|
||||
float CBYIGnBu_blue(float x) {
|
||||
if (x < 0.1239372193813324) {
|
||||
return (1.10092779856059E+02 * x - 3.41564374557536E+02) * x + 2.17553885630496E+02;
|
||||
} else if (x < 0.7535201013088226) {
|
||||
return ((((3.86204601547122E+03 * x - 8.79126469446648E+03) * x + 6.80922226393264E+03) * x - 2.24007302003438E+03) * x + 3.51344388740066E+02) * x + 1.56774650431396E+02;
|
||||
} else {
|
||||
return (((((-7.46693234167480E+06 * x + 3.93327773566702E+07) * x - 8.61050867447971E+07) * x + 1.00269040461745E+08) * x - 6.55080846112976E+07) * x + 2.27664953009389E+07) * x - 3.28811994253461E+06;
|
||||
}
|
||||
}
|
||||
|
||||
vec4 CBYIGnBu_f(float x) {
|
||||
float r = clamp(CBYIGnBu_red(x) / 255.0, 0.0, 1.0);
|
||||
float g = clamp(CBYIGnBu_green(x) / 255.0, 0.0, 1.0);
|
||||
float b = clamp(CBYIGnBu_blue(x) / 255.0, 0.0, 1.0);
|
||||
return vec4(r, g, b, 1.0);
|
||||
}
|
||||
// IDLCBBrBG
|
||||
float cbbrbg_red(float x) {
|
||||
if (x < 0.4128910005092621) {
|
||||
return (-6.30796693758704E+02 * x + 6.59139629181867E+02) * x + 8.16592339699109E+01;
|
||||
} else if (x < 0.5004365747118258) {
|
||||
return -1.99292307692284E+01 * x + 2.54503076923075E+02;
|
||||
} else if (x < 0.6000321805477142) {
|
||||
return -4.46903540903651E+02 * x + 4.68176638176691E+02;
|
||||
} else {
|
||||
return ((2.43537534073204E+03 * x - 5.03831150657605E+03) * x + 2.73595321475367E+03) * x - 1.53778856560153E+02;
|
||||
}
|
||||
}
|
||||
|
||||
float cbbrbg_green(float x) {
|
||||
if (x < 0.3067105114459991) {
|
||||
return (((((-1.43558931121826E+06 * x + 1.21789289489746E+06) * x - 3.88754308517456E+05) * x + 5.87745165729522E+04) * x - 3.61237992835044E+03) * x + 4.00139210969209E+02) * x + 4.80612502318691E+01;
|
||||
} else if (x < 0.4045854562297116) {
|
||||
return 3.64978461538455E+02 * x + 8.50984615384636E+01;
|
||||
} else if (x < 0.5035906732082367) {
|
||||
return 1.25827692307720E+02 * x + 1.81855384615367E+02;
|
||||
} else {
|
||||
return ((((-2.83948052403926E+04 * x + 1.08768529946603E+05) * x - 1.62569302478295E+05) * x + 1.17919256227845E+05) * x - 4.16776268978779E+04) * x + 6.01529271177582E+03;
|
||||
}
|
||||
}
|
||||
|
||||
float cbbrbg_blue(float x) {
|
||||
if (x < 0.1012683545126085) {
|
||||
return 5.85993431855501E+01 * x + 4.56403940886700E+00;
|
||||
} else if (x < 0.2050940692424774) {
|
||||
return 3.51072173913048E+02 * x - 2.50542028985514E+01;
|
||||
} else if (x < 0.5022056996822357) {
|
||||
return (-7.65121475963620E+02 * x + 1.20827362856208E+03) * x - 1.68677387505814E+02;
|
||||
} else if (x < 0.5970333516597748) {
|
||||
return -1.62299487179500E+02 * x + 3.26660512820525E+02;
|
||||
} else {
|
||||
return ((1.27993125066091E+03 * x - 3.19799978871341E+03) * x + 2.16242391471484E+03) * x - 1.93738146367890E+02;
|
||||
}
|
||||
}
|
||||
|
||||
vec4 cbbrbg_f(float x) {
|
||||
float r = clamp(cbbrbg_red(x) / 255.0, 0.0, 1.0);
|
||||
float g = clamp(cbbrbg_green(x) / 255.0, 0.0, 1.0);
|
||||
float b = clamp(cbbrbg_blue(x) / 255.0, 0.0, 1.0);
|
||||
return vec4(r, g, b, 1.0);
|
||||
}
|
||||
|
||||
// source: https://www.shadertoy.com/view/WlfXRN
|
||||
vec4 viridis_f(float x) {
|
||||
const vec4 c0 = vec4(0.2777273272234177, 0.005407344544966578, 0.3340998053353061, 1.0);
|
||||
const vec4 c1 = vec4(0.1050930431085774, 1.404613529898575, 1.384590162594685, 1.0);
|
||||
const vec4 c2 = vec4(-0.3308618287255563, 0.214847559468213, 0.09509516302823659, 1.0);
|
||||
const vec4 c3 = vec4(-4.634230498983486, -5.799100973351585, -19.33244095627987, 1.0);
|
||||
const vec4 c4 = vec4(6.228269936347081, 14.17993336680509, 56.69055260068105, 1.0);
|
||||
vec4 c5 = vec4(4.776384997670288, -13.74514537774601, -65.35303263337234, 1.0);
|
||||
const vec4 c6 = vec4(-5.435455855934631, 4.645852612178535, 26.3124352495832, 1.0);
|
||||
|
||||
return c0 + x*(c1+x*(c2+x*(c3+x*(c4+x*(c5+x*c6)))));
|
||||
}
|
||||
|
||||
// source: https://www.shadertoy.com/view/3lBXR3
|
||||
vec4 plasma_f(float x) {
|
||||
const vec4 c0 = vec4(0.05873234392399702, 0.02333670892565664, 0.5433401826748754, 1.0);
|
||||
const vec4 c1 = vec4(2.176514634195958, 0.2383834171260182, 0.7539604599784036, 1.0);
|
||||
const vec4 c2 = vec4(-2.689460476458034, -7.455851135738909, 3.110799939717086, 1.0);
|
||||
const vec4 c3 = vec4(6.130348345893603, 42.3461881477227, -28.51885465332158, 1.0);
|
||||
const vec4 c4 = vec4(-11.10743619062271, -82.66631109428045, 60.13984767418263, 1.0);
|
||||
const vec4 c5 = vec4(10.02306557647065, 71.41361770095349, -54.07218655560067, 1.0);
|
||||
const vec4 c6 = vec4(-3.658713842777788, -22.93153465461149, 18.19190778539828, 1.0);
|
||||
|
||||
return c0+x*(c1+x*(c2+x*(c3+x*(c4+x*(c5+x*c6)))));
|
||||
}
|
||||
|
||||
// source: https://www.shadertoy.com/view/3lBXR3
|
||||
vec4 magma_f(float x) {
|
||||
const vec4 c0 = vec4(-0.002136485053939582, -0.000749655052795221, -0.005386127855323933, 1.0);
|
||||
const vec4 c1 = vec4(0.2516605407371642, 0.6775232436837668, 2.494026599312351, 1.0);
|
||||
const vec4 c2 = vec4(8.353717279216625, -3.577719514958484, 0.3144679030132573, 1.0);
|
||||
const vec4 c3 = vec4(-27.66873308576866, 14.26473078096533, -13.64921318813922, 1.0);
|
||||
const vec4 c4 = vec4(52.17613981234068, -27.94360607168351, 12.94416944238394, 1.0);
|
||||
const vec4 c5 = vec4(-50.76852536473588, 29.04658282127291, 4.23415299384598, 1.0);
|
||||
const vec4 c6 = vec4(18.65570506591883, -11.48977351997711, -5.601961508734096, 1.0);
|
||||
|
||||
return c0+x*(c1+x*(c2+x*(c3+x*(c4+x*(c5+x*c6)))));
|
||||
}
|
||||
|
||||
// source: https://www.shadertoy.com/view/3lBXR3
|
||||
vec4 inferno_f(float x) {
|
||||
const vec4 c0 = vec4(0.0002189403691192265, 0.001651004631001012, -0.01948089843709184, 1.0);
|
||||
const vec4 c1 = vec4(0.1065134194856116, 0.5639564367884091, 3.932712388889277, 1.0);
|
||||
const vec4 c2 = vec4(11.60249308247187, -3.972853965665698, -15.9423941062914, 1.0);
|
||||
const vec4 c3 = vec4(-41.70399613139459, 17.43639888205313, 44.35414519872813, 1.0);
|
||||
const vec4 c4 = vec4(77.162935699427, -33.40235894210092, -81.80730925738993, 1.0);
|
||||
const vec4 c5 = vec4(-71.31942824499214, 32.62606426397723, 73.20951985803202, 1.0);
|
||||
const vec4 c6 = vec4(25.13112622477341, -12.24266895238567, -23.07032500287172, 1.0);
|
||||
|
||||
return c0+x*(c1+x*(c2+x*(c3+x*(c4+x*(c5+x*c6)))));
|
||||
}
|
||||
|
||||
// source: https://www.shadertoy.com/view/3lBXR3
|
||||
vec4 turbo_f(float x) {
|
||||
const vec4 c0 = vec4(0.1140890109226559, 0.06288340699912215, 0.2248337216805064, 1.0);
|
||||
const vec4 c1 = vec4(6.716419496985708, 3.182286745507602, 7.571581586103393, 1.0);
|
||||
const vec4 c2 = vec4(-66.09402360453038, -4.9279827041226, -10.09439367561635, 1.0);
|
||||
const vec4 c3 = vec4(228.7660791526501, 25.04986699771073, -91.54105330182436, 1.0);
|
||||
const vec4 c4 = vec4(-334.8351565777451, -69.31749712757485, 288.5858850615712, 1.0);
|
||||
const vec4 c5 = vec4(218.7637218434795, 67.52150567819112, -305.2045772184957, 1.0);
|
||||
const vec4 c6 = vec4(-52.88903478218835, -21.54527364654712, 110.5174647748972, 1.0);
|
||||
|
||||
return c0+x*(c1+x*(c2+x*(c3+x*(c4+x*(c5+x*c6)))));
|
||||
}
|
||||
|
||||
|
||||
vec4 YIOrBr_f(float x) {
|
||||
float r = ((((1.30858855846896E+03 * x - 2.84649723684787E+03) * x + 1.76048857883363E+03) * x - 3.99775093706324E+02) * x + 2.69759225316811E+01) * x + 2.54587325383574E+02;
|
||||
float g = ((((-8.85605750526301E+02 * x + 2.20590941129997E+03) * x - 1.50123293069936E+03) * x + 2.38490009587258E+01) * x - 6.03460495073813E+01) * x + 2.54768707485247E+02;
|
||||
float b = 0.0f;
|
||||
|
||||
if (x < 0.2363454401493073) {
|
||||
b = (-3.68734834041388E+01 * x - 3.28163398692792E+02) * x + 2.27342862588147E+02;
|
||||
} else if (x < 0.7571054399013519) {
|
||||
b = ((((1.60988309475108E+04 * x - 4.18782706486673E+04) * x + 4.14508040221340E+04) * x - 1.88926043556059E+04) * x + 3.50108270140290E+03) * x - 5.28541997751406E+01;
|
||||
} else {
|
||||
b = 1.68513761929930E+01 * x - 1.06424668227935E+01;
|
||||
}
|
||||
|
||||
r = clamp(r / 255.0, 0.0, 1.0);
|
||||
g = clamp(g / 255.0, 0.0, 1.0);
|
||||
b = clamp(b / 255.0, 0.0, 1.0);
|
||||
|
||||
return vec4(r, g, b, 1.0);
|
||||
}
|
||||
|
||||
vec4 stern_f(float x) {
|
||||
float t = x * 255.0;
|
||||
|
||||
float red;
|
||||
if (t < (3.27037346938775E+02 + 9.33750000000000E+00) / (1.81250000000000E+01 + 5.18306122448980E+00)) { // 14.0428817217
|
||||
red = 1.81250000000000E+01 * t - 9.33750000000000E+00;
|
||||
} else if (t <= 64.0) {
|
||||
red = -5.18306122448980E+00 * t + 3.27037346938775E+02;
|
||||
} else {
|
||||
red = t;
|
||||
}
|
||||
|
||||
float blue;
|
||||
if (t < (8.01533134203946E+02 + 1.96917113893858E+00) / (1.99964221824687E+00 + 4.25020839121978E+00)) { // 128.063441841
|
||||
blue = 1.99964221824687E+00 * t - 1.96917113893858E+00;
|
||||
} else if (t < (8.01533134203946E+02 + 7.17997825045893E+02) / (3.80632931598691E+00 + 4.25020839121978E+00)) {
|
||||
blue = -4.25020839121978E+00 * t + 8.01533134203946E+02;
|
||||
} else {
|
||||
blue = 3.80632931598691E+00 * t - 7.17997825045893E+02;
|
||||
}
|
||||
|
||||
red = clamp(red / 255.0, 0.0, 1.0);
|
||||
blue = clamp(blue / 255.0, 0.0, 1.0);
|
||||
|
||||
return vec4(red, x, blue, 1.0);
|
||||
}
|
||||
|
||||
vec4 colormap_hsv2rgb(float h, float s, float v) {
|
||||
float r = v;
|
||||
float g = v;
|
||||
float b = v;
|
||||
if (s > 0.0) {
|
||||
h *= 6.0;
|
||||
int i = int(h);
|
||||
float f = h - float(i);
|
||||
if (i == 1) {
|
||||
r *= 1.0 - s * f;
|
||||
b *= 1.0 - s;
|
||||
} else if (i == 2) {
|
||||
r *= 1.0 - s;
|
||||
b *= 1.0 - s * (1.0 - f);
|
||||
} else if (i == 3) {
|
||||
r *= 1.0 - s;
|
||||
g *= 1.0 - s * f;
|
||||
} else if (i == 4) {
|
||||
r *= 1.0 - s * (1.0 - f);
|
||||
g *= 1.0 - s;
|
||||
} else if (i == 5) {
|
||||
g *= 1.0 - s;
|
||||
b *= 1.0 - s * f;
|
||||
} else {
|
||||
g *= 1.0 - s * (1.0 - f);
|
||||
b *= 1.0 - s;
|
||||
}
|
||||
}
|
||||
return vec4(r, g, b, 1.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
vec4 EOSB_f(float x) {
|
||||
x = clamp(x, 0.0, 1.0);
|
||||
|
||||
float h;
|
||||
if (x < 0.1167535483837128) {
|
||||
h = 2.0 / 3.0; // H1
|
||||
} else if (x < 0.1767823398113251) {
|
||||
h = ((-3.19659402385354E+02 * x + 1.14469539590179E+02) * x - 1.52210982227697E+01) * x + 1.39214703883044E+00; // H2
|
||||
} else if (x < 0.2266354262828827) {
|
||||
h = ((-3.55166097640991E+02 * x + 2.51218596935272E+02) * x - 6.08853752315044E+01) * x + 5.38727123476564E+00; // H3
|
||||
} else if (x < (6.95053970124612E-01 - 4.13725796136428E-01) / (1.48914458632691E+00 - 6.97458630656247E-01)) {
|
||||
h = -1.48914458632691E+00 * x + 6.95053970124612E-01; // H4
|
||||
} else if (x < (4.13725796136428E-01 - 2.48329223043123E-01) / (6.97458630656247E-01 - 3.48617475202321E-01)) {
|
||||
h = -6.97458630656247E-01 * x + 4.13725796136428E-01; // H5
|
||||
} else {
|
||||
h = -3.48617475202321E-01 * x + 2.48329223043123E-01; // H6
|
||||
}
|
||||
|
||||
float s = 1.0;
|
||||
|
||||
float v = 1.0;
|
||||
if (x < 0.115834504365921) {
|
||||
v = 4.18575376272140E+00 * x + 5.15145240089963E-01; // V1-Hi
|
||||
} else if (x < (1.90980360972022E+00 + 9.13724751363001E-01) / (7.87450639585523E+00 + 7.87450803534638E+00)) {
|
||||
v = -7.87450803534638E+00 * x + 1.90980360972022E+00; // V2-Hi
|
||||
} else if (x < 0.5) {
|
||||
v = 7.87450639585523E+00 * x - 9.13724751363001E-01; // V3-Hi
|
||||
} else {
|
||||
v = -1.87540494049556E+00 * x + 2.33603077812338E+00; // V4-Hi
|
||||
}
|
||||
v = clamp(v, 0.0, 1.0);
|
||||
|
||||
float period = 4.0 / 105.0;
|
||||
float len = 3.0 / 252.0;
|
||||
float t = mod(x + 7.0 / 252.0, period);
|
||||
if (0.0 <= t && t < len) {
|
||||
if (x < 0.115834504365921) {
|
||||
v = 3.74113124408467E+00 * x + 4.64654322955584E-01; // V1-Lo
|
||||
} else if (x < (1.90980360972022E+00 + 9.13724751363001E-01) / (7.87450639585523E+00 + 7.87450803534638E+00)) {
|
||||
v = -3.97326878048783E+00 * x + 1.25308500609757E+00; // V2-Lo
|
||||
} else if (x < 0.25) {
|
||||
v = 6.99297032967038E+00 * x - 8.03946549450558E-01; // V3-Lo
|
||||
} else if (x < 0.72) {
|
||||
v -= 26.0 / 255.0;
|
||||
} else {
|
||||
v = -1.67870020621040E+00 * x + 2.09414636280895E+00; // V4-Lo
|
||||
}
|
||||
}
|
||||
|
||||
return colormap_hsv2rgb(h, s, v);
|
||||
}
|
||||
|
||||
vec4 spectral_f(float x) {
|
||||
float r, g, b;
|
||||
|
||||
if (x < 0.09752005946586478) {
|
||||
r = 5.63203907203907E+02 * x + 1.57952380952381E+02;
|
||||
} else if (x < 0.2005235116443438) {
|
||||
r = 3.02650769230760E+02 * x + 1.83361538461540E+02;
|
||||
} else if (x < 0.2974133397506856) {
|
||||
r = 9.21045429665647E+01 * x + 2.25581007115501E+02;
|
||||
} else if (x < 0.5003919130598823) {
|
||||
r = 9.84288115246108E+00 * x + 2.50046722689075E+02;
|
||||
} else if (x < 0.5989021956920624) {
|
||||
r = -2.48619704433547E+02 * x + 3.79379310344861E+02;
|
||||
} else if (x < 0.902860552072525) {
|
||||
r = ((2.76764884219295E+03 * x - 6.08393126459837E+03) * x + 3.80008072407485E+03) * x - 4.57725185424742E+02;
|
||||
} else {
|
||||
r = 4.27603478260530E+02 * x - 3.35293188405479E+02;
|
||||
}
|
||||
|
||||
if (x < 0.09785836420571035) {
|
||||
g = 6.23754529914529E+02 * x + 7.26495726495790E-01;
|
||||
} else if (x < 0.2034012006283468) {
|
||||
g = 4.60453201970444E+02 * x + 1.67068965517242E+01;
|
||||
} else if (x < 0.302409765476316) {
|
||||
g = 6.61789401709441E+02 * x - 2.42451282051364E+01;
|
||||
} else if (x < 0.4005965758690823) {
|
||||
g = 4.82379130434784E+02 * x + 3.00102898550747E+01;
|
||||
} else if (x < 0.4981907026473237) {
|
||||
g = 3.24710622710631E+02 * x + 9.31717541717582E+01;
|
||||
} else if (x < 0.6064345916502067) {
|
||||
g = -9.64699507389807E+01 * x + 3.03000000000023E+02;
|
||||
} else if (x < 0.7987472620841592) {
|
||||
g = -2.54022986425337E+02 * x + 3.98545610859729E+02;
|
||||
} else {
|
||||
g = -5.71281628959223E+02 * x + 6.51955082956207E+02;
|
||||
}
|
||||
|
||||
if (x < 0.0997359608740309) {
|
||||
b = 1.26522393162393E+02 * x + 6.65042735042735E+01;
|
||||
} else if (x < 0.1983790695667267) {
|
||||
b = -1.22037851037851E+02 * x + 9.12946682946686E+01;
|
||||
} else if (x < 0.4997643530368805) {
|
||||
b = (5.39336225400169E+02 * x + 3.55461986381562E+01) * x + 3.88081126069087E+01;
|
||||
} else if (x < 0.6025972254407099) {
|
||||
b = -3.79294261294313E+02 * x + 3.80837606837633E+02;
|
||||
} else if (x < 0.6990141388105746) {
|
||||
b = 1.15990231990252E+02 * x + 8.23805453805459E+01;
|
||||
} else if (x < 0.8032653181119567) {
|
||||
b = 1.68464957265204E+01 * x + 1.51683418803401E+02;
|
||||
} else if (x < 0.9035796343050095) {
|
||||
b = 2.40199023199020E+02 * x - 2.77279202279061E+01;
|
||||
} else {
|
||||
b = -2.78813846153774E+02 * x + 4.41241538461485E+02;
|
||||
}
|
||||
|
||||
r = clamp(r / 255.0, 0.0, 1.0);
|
||||
g = clamp(g / 255.0, 0.0, 1.0);
|
||||
b = clamp(b / 255.0, 0.0, 1.0);
|
||||
|
||||
return vec4(r, g, b, 1.0);
|
||||
}
|
||||
|
||||
vec4 RdBu_f(float x) {
|
||||
float r, g, b;
|
||||
|
||||
if (x < 0.09771832105856419) {
|
||||
r = 7.60263247863246E+02 * x + 1.02931623931624E+02;
|
||||
} else if (x < 0.3017162107441106) {
|
||||
r = (-2.54380938558548E+02 * x + 4.29911571188803E+02) * x + 1.37642085716717E+02;
|
||||
} else if (x < 0.4014205790737471) {
|
||||
r = 8.67103448276151E+01 * x + 2.18034482758611E+02;
|
||||
} else if (x < 0.5019932233215039) {
|
||||
r = -6.15461538461498E+01 * x + 2.77547692307680E+02;
|
||||
} else if (x < 0.5969483882550937) {
|
||||
r = -3.77588522588624E+02 * x + 4.36198819698878E+02;
|
||||
} else if (x < 0.8046060096654594) {
|
||||
r = (-6.51345897546620E+02 * x + 2.09780968434337E+02) * x + 3.17674951640855E+02;
|
||||
} else {
|
||||
r = -3.08431855203590E+02 * x + 3.12956742081421E+02;
|
||||
}
|
||||
|
||||
if (x < 0.09881640500975222) {
|
||||
g = 2.41408547008547E+02 * x + 3.50427350427364E-01;
|
||||
} else if (x < 0.5000816285610199) {
|
||||
g = ((((1.98531871433258E+04 * x - 2.64108262469187E+04) * x + 1.10991785969817E+04) * x - 1.92958444776211E+03) * x + 8.39569642882186E+02) * x - 4.82944517518776E+01;
|
||||
} else if (x < 0.8922355473041534) {
|
||||
g = (((6.16712686949223E+03 * x - 1.59084026055125E+04) * x + 1.45172137257997E+04) * x - 5.80944127411621E+03) * x + 1.12477959061948E+03;
|
||||
} else {
|
||||
g = -5.28313797313699E+02 * x + 5.78459299959206E+02;
|
||||
}
|
||||
|
||||
if (x < 0.1033699568661857) {
|
||||
b = 1.30256410256410E+02 * x + 3.08518518518519E+01;
|
||||
} else if (x < 0.2037526071071625) {
|
||||
b = 3.38458128078815E+02 * x + 9.33004926108412E+00;
|
||||
} else if (x < 0.2973267734050751) {
|
||||
b = (-1.06345054944861E+02 * x + 5.93327252747168E+02) * x - 3.81852747252658E+01;
|
||||
} else if (x < 0.4029109179973602) {
|
||||
b = 6.68959706959723E+02 * x - 7.00740740740798E+01;
|
||||
} else if (x < 0.5006715489526758) {
|
||||
b = 4.87348695652202E+02 * x + 3.09898550724286E+00;
|
||||
} else if (x < 0.6004396902588283) {
|
||||
b = -6.85799999999829E+01 * x + 2.81436666666663E+02;
|
||||
} else if (x < 0.702576607465744) {
|
||||
b = -1.81331701891043E+02 * x + 3.49137263626287E+02;
|
||||
} else if (x < 0.9010407030582428) {
|
||||
b = (2.06124143164576E+02 * x - 5.78166906665595E+02) * x + 5.26198653917172E+02;
|
||||
} else {
|
||||
b = -7.36990769230737E+02 * x + 8.36652307692262E+02;
|
||||
}
|
||||
|
||||
r = clamp(r / 255.0, 0.0, 1.0);
|
||||
g = clamp(g / 255.0, 0.0, 1.0);
|
||||
b = clamp(b / 255.0, 0.0, 1.0);
|
||||
|
||||
return vec4(r, g, b, 1.0);
|
||||
}
|
||||
|
||||
vec4 parula_f(float x) {
|
||||
if (x < 0.0) {
|
||||
return vec4(0.0, 0.0, 0.0, 0.0);
|
||||
} else if (1.0 < x) {
|
||||
return vec4(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
if (x < 3.1250000000000000e-02) {
|
||||
float dx = x - 1.5625000000000000e-02;
|
||||
return ((vec4(-1.4151576683620706e+02, 2.4271369358056621e+01, 4.5510373586485706e+01, 1.0) * dx
|
||||
+ vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx
|
||||
+ vec4( 2.6007355728658488e-01, 1.4968553250962457e+00, 3.0913652594248364e+00, 1.0)) * dx
|
||||
+ vec4( 2.0810000000000001e-01, 1.6630000000000000e-01, 5.2920000000000000e-01, 1.0);
|
||||
} else if (x < 4.6875000000000000e-02) {
|
||||
float dx = x - 3.1250000000000000e-02;
|
||||
return ((vec4(-5.1390461057291191e+01, 1.2211762733842230e+01, -1.2843448884986955e+01, 1.0) * dx
|
||||
+ vec4(-6.6335515704472066e+00, 1.1377204386589042e+00, 2.1332987618665173e+00, 1.0)) * dx
|
||||
+ vec4( 1.5642431399834725e-01, 1.5146322069502911e+00, 3.1246980525790007e+00, 1.0)) * dx
|
||||
+ vec4( 2.1162380952380999e-01, 1.8978095238095199e-01, 5.7767619047619101e-01, 1.0);
|
||||
} else if (x < 6.2500000000000000e-02) {
|
||||
float dx = x - 4.6875000000000000e-02;
|
||||
return ((vec4(-1.4725107464858192e+02, 1.3014608277362621e+01, 5.8634219534912217e+00, 1.0) * dx
|
||||
+ vec4(-9.0424794325077311e+00, 1.7101468168077587e+00, 1.5312620953827538e+00, 1.0)) * dx
|
||||
+ vec4(-8.8513670422823654e-02, 1.5591301328169576e+00, 3.1819568159735203e+00, 1.0)) * dx
|
||||
+ vec4( 2.1225238095238100e-01, 2.1377142857142900e-01, 6.2697142857142896e-01, 1.0);
|
||||
} else if (x < 7.8125000000000000e-02) {
|
||||
float dx = x - 6.2500000000000000e-02;
|
||||
return ((vec4(-2.1469400225321081e+02, -1.4338005366630648e+01, -4.1817857976177763e+01, 1.0) * dx
|
||||
+ vec4(-1.5944873556660008e+01, 2.3202065798091316e+00, 1.8061099994526548e+00, 1.0)) * dx
|
||||
+ vec4(-4.7894106087856969e-01, 1.6221044046390967e+00, 3.2341032549553237e+00, 1.0)) * dx
|
||||
+ vec4( 2.0810000000000001e-01, 2.3860000000000001e-01, 6.7708571428571396e-01, 1.0);
|
||||
} else if (x < 9.3750000000000000e-02) {
|
||||
float dx = x - 7.8125000000000000e-02;
|
||||
return ((vec4(-2.8846495443400278e+02, 2.0037550842697090e+02, 1.1771734328417965e+02, 1.0) * dx
|
||||
+ vec4(-2.6008654912279265e+01, 1.6481125782483199e+00, -1.5410209318067788e-01, 1.0)) * dx
|
||||
+ vec4(-1.1344649432057459e+00, 1.6841093914837442e+00, 3.2599158784908235e+00, 1.0)) * dx
|
||||
+ vec4( 1.9590476190476200e-01, 2.6445714285714300e-01, 7.2789999999999999e-01, 1.0);
|
||||
} else if (x < 1.0937500000000000e-01) {
|
||||
float dx = x - 9.3750000000000000e-02;
|
||||
return ((vec4(-5.4509738001026233e+02, 5.1696771659011155e+01, -6.5374637230314454e+02, 1.0) * dx
|
||||
+ vec4(-3.9530449651373146e+01, 1.1040714535762580e+01, 5.3638983732652425e+00, 1.0)) * dx
|
||||
+ vec4(-2.1585134520128149e+00, 1.8823723151401646e+00, 3.3413189453671448e+00, 1.0)) * dx
|
||||
+ vec4( 1.7072857142857101e-01, 2.9193809523809500e-01, 7.7924761904761897e-01, 1.0);
|
||||
} else if (x < 1.2500000000000000e-01) {
|
||||
float dx = x - 1.0937500000000000e-01;
|
||||
return ((vec4( 2.3639968744743715e+03, -8.1036503315845437e+02, -8.1573269216733058e+02, 1.0) * dx
|
||||
+ vec4(-6.5081889339354191e+01, 1.3464000707278728e+01, -2.5280462828444659e+01, 1.0)) * dx
|
||||
+ vec4(-3.7930812487429293e+00, 2.2652584908126849e+00, 3.0301226257549660e+00, 1.0)) * dx
|
||||
+ vec4( 1.2527142857142901e-01, 3.2424285714285700e-01, 8.3027142857142899e-01, 1.0);
|
||||
} else if (x < 1.4062500000000000e-01) {
|
||||
float dx = x - 1.2500000000000000e-01;
|
||||
return ((vec4( 1.4125902630655582e+03, 2.5375056097507152e+02, 9.0826266478267496e+02, 1.0) * dx
|
||||
+ vec4( 4.5730464151631985e+01, -2.4521860222023822e+01, -6.3517932773788282e+01, 1.0)) * dx
|
||||
+ vec4(-4.0954472673010889e+00, 2.0924794358947931e+00, 1.6426476944700765e+00, 1.0)) * dx
|
||||
+ vec4( 5.9133333333333399e-02, 3.5983333333333301e-01, 8.6833333333333296e-01, 1.0);
|
||||
} else if (x < 1.5625000000000000e-01) {
|
||||
float dx = x - 1.4062500000000000e-01;
|
||||
return ((vec4(-1.9850459267366693e+03, 1.4738473211499172e+02, 2.4976683303608979e+02, 1.0) * dx
|
||||
+ vec4( 1.1194563273283002e+02, -1.2627302676317344e+01, -2.0943120362100398e+01, 1.0)) * dx
|
||||
+ vec4(-1.6317582534813697e+00, 1.5120237656082123e+00, 3.2294373922181602e-01, 1.0)) * dx
|
||||
+ vec4( 1.1695238095238101e-02, 3.8750952380952403e-01, 8.8195714285714299e-01, 1.0);
|
||||
} else if (x < 1.7187500000000000e-01) {
|
||||
float dx = x - 1.5625000000000000e-01;
|
||||
return ((vec4(-1.3211246088080517e+02, 6.1731462945951478e+01, 9.6199145930320853e+01, 1.0) * dx
|
||||
+ vec4( 1.8896604917048652e+01, -5.7186433584271068e+00, -9.2353000635336890e+00, 1.0)) * dx
|
||||
+ vec4( 4.1265170979798449e-01, 1.2253683588153301e+00, -1.4859407992871662e-01, 1.0)) * dx
|
||||
+ vec4( 5.9571428571428596e-03, 4.0861428571428599e-01, 8.8284285714285704e-01, 1.0);
|
||||
} else if (x < 1.8750000000000000e-01) {
|
||||
float dx = x - 1.7187500000000000e-01;
|
||||
return ((vec4(-2.4276114402580023e+02, 1.8878292291818184e+01, 5.4500811814199913e+01, 1.0) * dx
|
||||
+ vec4( 1.2703833313260910e+01, -2.8249810328356313e+00, -4.7259650980498993e+00, 1.0)) * dx
|
||||
+ vec4( 9.0640855714657143e-01, 1.0918742277018498e+00, -3.6673884807846019e-01, 1.0)) * dx
|
||||
+ vec4( 1.6514285714285700e-02, 4.2659999999999998e-01, 8.7863333333333304e-01, 1.0);
|
||||
} else if (x < 2.0312500000000000e-01) {
|
||||
float dx = x - 1.8750000000000000e-01;
|
||||
return ((vec4(-2.4875702015890445e+02, 2.7531596458333780e+01, 1.1605149669749400e+01, 1.0) * dx
|
||||
+ vec4( 1.3244046870515243e+00, -1.9400610816566539e+00, -2.1712395442592785e+00, 1.0)) * dx
|
||||
+ vec4( 1.1255997759014531e+00, 1.0174204446629080e+00, -4.7450767061454108e-01, 1.0)) * dx
|
||||
+ vec4( 3.2852380952381001e-02, 4.4304285714285702e-01, 8.7195714285714299e-01, 1.0);
|
||||
} else if (x < 2.1875000000000000e-01) {
|
||||
float dx = x - 2.0312500000000000e-01;
|
||||
return ((vec4( 6.6879357994795782e+01, 3.3156266362545779e+00, 3.1398894268734253e+01, 1.0) * dx
|
||||
+ vec4(-1.0336080632897122e+01, -6.4951749767225808e-01, -1.6272481534897754e+00, 1.0)) * dx
|
||||
+ vec4( 9.8479233924761567e-01, 9.7695827936089374e-01, -5.3385904089187008e-01, 1.0)) * dx
|
||||
+ vec4( 4.9814285714285700e-02, 4.5857142857142902e-01, 8.6405714285714297e-01, 1.0);
|
||||
} else if (x < 2.3437500000000000e-01) {
|
||||
float dx = x - 2.1875000000000000e-01;
|
||||
return ((vec4(-3.7807546774099214e+00, 2.9110963663947160e+01, 2.0085673255558202e+01, 1.0) * dx
|
||||
+ vec4(-7.2011107268910699e+00, -4.9409749909782474e-01, -1.5542498464285720e-01, 1.0)) * dx
|
||||
+ vec4( 7.1077372425092522e-01, 9.5908929503636120e-01, -5.6171330867519242e-01, 1.0)) * dx
|
||||
+ vec4( 6.2933333333333299e-02, 4.7369047619047600e-01, 8.5543809523809500e-01, 1.0);
|
||||
} else if (x < 2.5000000000000000e-01) {
|
||||
float dx = x - 2.3437500000000000e-01;
|
||||
return ((vec4(-1.8052110713761824e+01, 7.5676044216235097e+00, 2.6820241280346455e+01, 1.0) * dx
|
||||
+ vec4(-7.3783336023946600e+00, 8.7047892264969851e-01, 7.8609094921143352e-01, 1.0)) * dx
|
||||
+ vec4( 4.8296990660583561e-01, 9.6497025477935916e-01, -5.5185915297880839e-01, 1.0)) * dx
|
||||
+ vec4( 7.2266666666666701e-02, 4.8866666666666703e-01, 8.4670000000000001e-01, 1.0);
|
||||
} else if (x < 2.6562500000000000e-01) {
|
||||
float dx = x - 2.5000000000000000e-01;
|
||||
return ((vec4(-8.5042116753280467e+01, 3.9234694840689350e+01, 6.3623990194130904e+01, 1.0) * dx
|
||||
+ vec4(-8.2245262921022455e+00, 1.2252103799133005e+00, 2.0432897592276738e+00, 1.0)) * dx
|
||||
+ vec4( 2.3917522075432149e-01, 9.9771540013190607e-01, -5.0765007940944740e-01, 1.0)) * dx
|
||||
+ vec4( 7.7942857142857203e-02, 5.0398571428571404e-01, 8.3837142857142899e-01, 1.0);
|
||||
} else if (x < 2.8125000000000000e-01) {
|
||||
float dx = x - 2.6562500000000000e-01;
|
||||
return ((vec4(-4.4981860368289709e+01, 3.5222378119677195e+01, 1.8276940800992332e+01, 1.0) * dx
|
||||
+ vec4(-1.2210875514912267e+01, 3.0643367005706139e+00, 5.0256642995775600e+00, 1.0)) * dx
|
||||
+ vec4(-8.0127932480280273e-02, 1.0647395732644671e+00, -3.9719767224061564e-01, 1.0)) * dx
|
||||
+ vec4( 7.9347619047619000e-02, 5.2002380952381000e-01, 8.3118095238095202e-01, 1.0);
|
||||
} else if (x < 2.9687500000000000e-01) {
|
||||
float dx = x - 2.8125000000000000e-01;
|
||||
return ((vec4( 8.8958586797831074e+01, -6.4031864461777545e+01, -5.4343639113056135e+01, 1.0) * dx
|
||||
+ vec4(-1.4319400219675847e+01, 4.7153856749304826e+00, 5.8823958996240755e+00, 1.0)) * dx
|
||||
+ vec4(-4.9466349083321959e-01, 1.1862977353816719e+00, -2.2675923162809006e-01, 1.0)) * dx
|
||||
+ vec4( 7.4942857142857103e-02, 5.3754285714285699e-01, 8.2627142857142899e-01, 1.0);
|
||||
} else if (x < 3.1250000000000000e-01) {
|
||||
float dx = x - 2.9687500000000000e-01;
|
||||
return ((vec4( 2.3465669412937996e+02, -7.4943148843863256e+01, -1.7040059387215410e+02, 1.0) * dx
|
||||
+ vec4(-1.0149466463527515e+01, 1.7138920282846606e+00, 3.3350378161995691e+00, 1.0)) * dx
|
||||
+ vec4(-8.7698953275827207e-01, 1.2867551994944084e+00, -8.2736829818345611e-02, 1.0)) * dx
|
||||
+ vec4( 6.4057142857142799e-02, 5.5698571428571397e-01, 8.2395714285714305e-01, 1.0);
|
||||
} else if (x < 3.2812500000000000e-01) {
|
||||
float dx = x - 3.1250000000000000e-01;
|
||||
return ((vec4( 3.5054309382746595e+02, -7.5598816353949772e+01, -5.9224118732067950e+01, 1.0) * dx
|
||||
+ vec4( 8.5006607378717081e-01, -1.7990680737714295e+00, -4.6524900215576546e+00, 1.0)) * dx
|
||||
+ vec4(-1.0222926638479650e+00, 1.2854243237836778e+00, -1.0332202052706571e-01, 1.0)) * dx
|
||||
+ vec4( 4.8771428571428597e-02, 5.7722380952381003e-01, 8.2282857142857202e-01, 1.0);
|
||||
} else if (x < 3.4375000000000000e-01) {
|
||||
float dx = x - 3.2812500000000000e-01;
|
||||
return ((vec4(-1.3511844086782639e+02, 2.1571557117596814e+01, 6.5912402293741552e+00, 1.0) * dx
|
||||
+ vec4( 1.7281773596949638e+01, -5.3427625903628249e+00, -7.4286205871233397e+00, 1.0)) * dx
|
||||
+ vec4(-7.3898266899270237e-01, 1.1738332196565799e+00, -2.9208937378770627e-01, 1.0)) * dx
|
||||
+ vec4( 3.4342857142857203e-02, 5.9658095238095199e-01, 8.1985238095238100e-01, 1.0);
|
||||
} else if (x < 3.5937500000000000e-01) {
|
||||
float dx = x - 3.4375000000000000e-01;
|
||||
return ((vec4(-1.6458788273706924e+02, 1.0533768835542057e+01, 3.0362548290707878e+01, 1.0) * dx
|
||||
+ vec4( 1.0948096681270275e+01, -4.3315958504754741e+00, -7.1196562013714262e+00, 1.0)) * dx
|
||||
+ vec4(-2.9789094589551629e-01, 1.0226713690184817e+00, -5.1940619860793691e-01, 1.0)) * dx
|
||||
+ vec4( 2.6499999999999999e-02, 6.1370000000000002e-01, 8.1350000000000000e-01, 1.0);
|
||||
} else if (x < 3.7500000000000000e-01) {
|
||||
float dx = x - 3.5937500000000000e-01;
|
||||
return ((vec4(-1.0406115199344315e+02, 1.9929786587720105e+01, 3.6734795179105028e+01, 1.0) * dx
|
||||
+ vec4( 3.2330396779701545e+00, -3.8378254363094402e+00, -5.6964117502444944e+00, 1.0)) * dx
|
||||
+ vec4(-7.6310690282384588e-02, 8.9502416141246732e-01, -7.1965726035193567e-01, 1.0)) * dx
|
||||
+ vec4( 2.3890476190476202e-02, 6.2866190476190498e-01, 8.0376190476190501e-01, 1.0);
|
||||
} else if (x < 3.9062500000000000e-01) {
|
||||
float dx = x - 3.7500000000000000e-01;
|
||||
return ((vec4( 2.3255546213942225e+02, 1.8349599099637384e+01, 1.7433813849989207e+01, 1.0) * dx
|
||||
+ vec4(-1.6448268217224928e+00, -2.9036166900100602e+00, -3.9744682262239461e+00, 1.0)) * dx
|
||||
+ vec4(-5.1494864403514876e-02, 7.8968912818872505e-01, -8.7076475998425507e-01, 1.0)) * dx
|
||||
+ vec4( 2.3090476190476199e-02, 6.4178571428571396e-01, 7.9126666666666701e-01, 1.0);
|
||||
} else if (x < 4.0625000000000000e-01) {
|
||||
float dx = x - 3.9062500000000000e-01;
|
||||
return ((vec4( 1.5126193200717549e+02, 2.0267550346934740e+01, 2.0857035135376179e+01, 1.0) * dx
|
||||
+ vec4( 9.2562104660629245e+00, -2.0434792322145579e+00, -3.1572582020057021e+00, 1.0)) * dx
|
||||
+ vec4( 6.7433005039304356e-02, 7.1239075440396538e-01, -9.8219798542534331e-01, 1.0)) * dx
|
||||
+ vec4( 2.2771428571428599e-02, 6.5348571428571400e-01, 7.7675714285714303e-01, 1.0);
|
||||
} else if (x < 4.2187500000000000e-01) {
|
||||
float dx = x - 4.0625000000000000e-01;
|
||||
return ((vec4( 1.0861181935568159e+02, -5.7969433444380156e+00, 3.9956456082908054e+00, 1.0) * dx
|
||||
+ vec4( 1.6346613528899276e+01, -1.0934378097019919e+00, -2.1795846800349437e+00, 1.0)) * dx
|
||||
+ vec4( 4.6747712996058871e-01, 6.6337642562401933e-01, -1.0655861554572283e+00, 1.0)) * dx
|
||||
+ vec4( 2.6661904761904800e-02, 6.6419523809523795e-01, 7.6071904761904796e-01, 1.0);
|
||||
} else if (x < 4.3750000000000000e-01) {
|
||||
float dx = x - 4.2187500000000000e-01;
|
||||
return ((vec4(-3.0484063800132168e+02, 1.4154965887634640e+01, -3.1353889969814710e+00, 1.0) * dx
|
||||
+ vec4( 2.1437792561196851e+01, -1.3651695289725239e+00, -1.9922887921463122e+00, 1.0)) * dx
|
||||
+ vec4( 1.0578584751183406e+00, 6.2496068595722998e-01, -1.1307716784600605e+00, 1.0)) * dx
|
||||
+ vec4( 3.8371428571428598e-02, 6.7427142857142897e-01, 7.4355238095238096e-01, 1.0);
|
||||
} else if (x < 4.5312500000000000e-01) {
|
||||
float dx = x - 4.3750000000000000e-01;
|
||||
return ((vec4( 1.9732370744832981e+01, -3.3873392535419122e+00, -5.1854420010455629e+00, 1.0) * dx
|
||||
+ vec4( 7.1483876548848961e+00, -7.0165550298965007e-01, -2.1392601513798186e+00, 1.0)) * dx
|
||||
+ vec4( 1.5045175409946179e+00, 5.9266654483282100e-01, -1.1953271307026563e+00, 1.0)) * dx
|
||||
+ vec4( 5.8971428571428598e-02, 6.8375714285714295e-01, 7.2538571428571397e-01, 1.0);
|
||||
} else if (x < 4.6875000000000000e-01) {
|
||||
float dx = x - 4.5312500000000000e-01;
|
||||
return ((vec4(-5.2460806882781675e+01, -6.0560887320505685e-01, 1.3890718905419471e+01, 1.0) * dx
|
||||
+ vec4( 8.0733425335489422e+00, -8.6043703049942721e-01, -2.3823277451788294e+00, 1.0)) * dx
|
||||
+ vec4( 1.7423570751888966e+00, 5.6825884899705426e-01, -1.2659769415863851e+00, 1.0)) * dx
|
||||
+ vec4( 8.4300000000000000e-02, 6.9283333333333297e-01, 7.0616666666666705e-01, 1.0);
|
||||
} else if (x < 4.8437500000000000e-01) {
|
||||
float dx = x - 4.6875000000000000e-01;
|
||||
return ((vec4( 1.0354971072183483e+01, 5.8097747460711062e+00, -5.4384621916749820e+00, 1.0) * dx
|
||||
+ vec4( 5.6142422109185510e+00, -8.8882494643091425e-01, -1.7312002964872917e+00, 1.0)) * dx
|
||||
+ vec4( 1.9562255868212013e+00, 5.4092663060751767e-01, -1.3302508172374183e+00, 1.0)) * dx
|
||||
+ vec4( 1.1329523809523800e-01, 7.0150000000000001e-01, 6.8585714285714305e-01, 1.0);
|
||||
} else if (x < 5.0000000000000000e-01) {
|
||||
float dx = x - 4.8437500000000000e-01;
|
||||
return ((vec4(-1.3925172644537971e+01, -8.9021377300786071e+00, -4.6199177582688593e+00, 1.0) * dx
|
||||
+ vec4( 6.0996314799271518e+00, -6.1649175520883115e-01, -1.9861282117220564e+00, 1.0)) * dx
|
||||
+ vec4( 2.1392548632406654e+00, 5.1740605714439658e-01, -1.3883340751781894e+00, 1.0)) * dx
|
||||
+ vec4( 1.4527142857142900e-01, 7.0975714285714298e-01, 6.6462857142857201e-01, 1.0);
|
||||
} else if (x < 5.1562500000000000e-01) {
|
||||
float dx = x - 5.0000000000000000e-01;
|
||||
return ((vec4( 3.1614367125520630e+01, -1.1395280968671647e+01, 2.1421523701702025e+01, 1.0) * dx
|
||||
+ vec4( 5.4468890122144344e+00, -1.0337794613062659e+00, -2.2026868566409092e+00, 1.0)) * dx
|
||||
+ vec4( 2.3196692459303776e+00, 4.9162056938634824e-01, -1.4537843106213608e+00, 1.0)) * dx
|
||||
+ vec4( 1.8013333333333301e-01, 7.1765714285714299e-01, 6.4243333333333297e-01, 1.0);
|
||||
} else if (x < 5.3125000000000000e-01) {
|
||||
float dx = x - 5.1562500000000000e-01;
|
||||
return ((vec4(-3.7634010143333590e+01, 2.0544616050328934e+00, 1.3219372364175872e+00, 1.0) * dx
|
||||
+ vec4( 6.9288124712232140e+00, -1.5679332567127493e+00, -1.1985529331236269e+00, 1.0)) * dx
|
||||
+ vec4( 2.5130395816090907e+00, 4.5096880816730112e-01, -1.5069286823364316e+00, 1.0)) * dx
|
||||
+ vec4( 2.1782857142857101e-01, 7.2504285714285699e-01, 6.1926190476190501e-01, 1.0);
|
||||
} else if (x < 5.4687500000000000e-01) {
|
||||
float dx = x - 5.3125000000000000e-01;
|
||||
return ((vec4( 1.2815768685879013e+01, -1.4298832118473902e+01, 3.9450879734146490e+01, 1.0) * dx
|
||||
+ vec4( 5.1647182457544520e+00, -1.4716303689768324e+00, -1.1365871251665525e+00, 1.0)) * dx
|
||||
+ vec4( 2.7020009990618670e+00, 4.0347562651590141e-01, -1.5434152457472157e+00, 1.0)) * dx
|
||||
+ vec4( 2.5864285714285701e-01, 7.3171428571428598e-01, 5.9542857142857097e-01, 1.0);
|
||||
} else if (x < 5.6250000000000000e-01) {
|
||||
float dx = x - 5.4687500000000000e-01;
|
||||
return ((vec4(-7.8540912219456771e+01, -1.8509114083431125e+01, 3.3113477160250433e+01, 1.0) * dx
|
||||
+ vec4( 5.7654574029050307e+00, -2.1418881245302965e+00, 7.1267286237156402e-01, 1.0)) * dx
|
||||
+ vec4( 2.8727849935721714e+00, 3.4701440005485251e-01, -1.5500389061033872e+00, 1.0)) * dx
|
||||
+ vec4( 3.0217142857142898e-01, 7.3760476190476199e-01, 5.7118571428571396e-01, 1.0);
|
||||
} else if (x < 5.7812500000000000e-01) {
|
||||
float dx = x - 5.6250000000000000e-01;
|
||||
return ((vec4(-5.8163891236508938e+01, 9.6920884524980497e+00, 3.0320583052976861e+01, 1.0) * dx
|
||||
+ vec4( 2.0838521426179946e+00, -3.0095028471911305e+00, 2.2648671042583031e+00, 1.0)) * dx
|
||||
+ vec4( 2.9954304552209687e+00, 2.6652391612170523e-01, -1.5035148441247956e+00, 1.0)) * dx
|
||||
+ vec4( 3.4816666666666701e-01, 7.4243333333333295e-01, 5.4726666666666701e-01, 1.0);
|
||||
} else if (x < 5.9375000000000000e-01) {
|
||||
float dx = x - 5.7812500000000000e-01;
|
||||
return ((vec4(-6.4543256167712116e+01, -2.8636353652780144e-01, 2.8905906284068501e+00, 1.0) * dx
|
||||
+ vec4(-6.4258025909336181e-01, -2.5551862009802844e+00, 3.6861444348665935e+00, 1.0)) * dx
|
||||
+ vec4( 3.0179503284010409e+00, 1.7957564974402687e-01, -1.4105302888259692e+00, 1.0)) * dx
|
||||
+ vec4( 3.9525714285714297e-01, 7.4590000000000001e-01, 5.2444285714285699e-01, 1.0);
|
||||
} else if (x < 6.0937500000000000e-01) {
|
||||
float dx = x - 5.9375000000000000e-01;
|
||||
return ((vec4(-2.4450284092939786e+01, 1.3922851408411924e+01, -1.6916850328844372e+01, 1.0) * dx
|
||||
+ vec4(-3.6680453919548675e+00, -2.5686094917550251e+00, 3.8216408705731646e+00, 1.0)) * dx
|
||||
+ vec4( 2.9505968026034126e+00, 9.9516342045037676e-02, -1.2932211434284731e+00, 1.0)) * dx
|
||||
+ vec4( 4.4200952380952402e-01, 7.4808095238095196e-01, 5.0331428571428605e-01, 1.0);
|
||||
} else if (x < 6.2500000000000000e-01) {
|
||||
float dx = x - 6.0937500000000000e-01;
|
||||
return ((vec4( 1.2547821111311350e+01, 1.5748329330961459e+01, -1.7611303598786566e+01, 1.0) * dx
|
||||
+ vec4(-4.8141524588114200e+00, -1.9159758319857161e+00, 3.0286635114085847e+00, 1.0)) * dx
|
||||
+ vec4( 2.8180624611851890e+00, 2.9444696361588602e-02, -1.1861851374600081e+00, 1.0)) * dx
|
||||
+ vec4( 4.8712380952380901e-01, 7.4906190476190504e-01, 4.8397619047619100e-01, 1.0);
|
||||
} else if (x < 6.4062500000000000e-01) {
|
||||
float dx = x - 6.2500000000000000e-01;
|
||||
return ((vec4( 9.2115329809656430e+00, -3.2661877796437579e+00, -1.2675733711774058e+00, 1.0) * dx
|
||||
+ vec4(-4.2259733442187004e+00, -1.1777728945968977e+00, 2.2031336552154643e+00, 1.0)) * dx
|
||||
+ vec4( 2.6768104955128438e+00, -1.8895127491264742e-02, -1.1044383067315073e+00, 1.0)) * dx
|
||||
+ vec4( 5.3002857142857096e-01, 7.4911428571428595e-01, 4.6611428571428598e-01, 1.0);
|
||||
} else if (x < 6.5625000000000000e-01) {
|
||||
float dx = x - 6.4062500000000000e-01;
|
||||
return ((vec4( 1.4269589821681299e+01, 7.3028598827757278e+00, -8.5260219639800940e+00, 1.0) * dx
|
||||
+ vec4(-3.7941827357359359e+00, -1.3308754467676989e+00, 2.1437161534415234e+00, 1.0)) * dx
|
||||
+ vec4( 2.5514955567635522e+00, -5.8092757825086563e-02, -1.0365187784712420e+00, 1.0)) * dx
|
||||
+ vec4( 5.7085714285714295e-01, 7.4851904761904797e-01, 4.4939047619047601e-01, 1.0);
|
||||
} else if (x < 6.7187500000000000e-01) {
|
||||
float dx = x - 6.5625000000000000e-01;
|
||||
return ((vec4( 8.6083934467238432e+00, 2.6914824850885094e-01, -1.7057138772896455e+01, 1.0) * dx
|
||||
+ vec4(-3.1252957128446250e+00, -9.8855388976258662e-01, 1.7440588738799565e+00, 1.0)) * dx
|
||||
+ vec4( 2.4433787060044811e+00, -9.4333841208372265e-02, -9.7577229366934382e-01, 1.0)) * dx
|
||||
+ vec4( 6.0985238095238103e-01, 7.4731428571428604e-01, 4.3368571428571401e-01, 1.0);
|
||||
} else if (x < 6.8750000000000000e-01) {
|
||||
float dx = x - 6.7187500000000000e-01;
|
||||
return ((vec4( 8.7188554392023345e+00, 1.7834947123447904e+01, -1.8886229447019101e+00, 1.0) * dx
|
||||
+ vec4(-2.7217772700294449e+00, -9.7593756561373424e-01, 9.4450549390043514e-01, 1.0)) * dx
|
||||
+ vec4( 2.3520181906470738e+00, -1.2502902019862727e-01, -9.3376347542277516e-01, 1.0)) * dx
|
||||
+ vec4( 6.4729999999999999e-01, 7.4560000000000004e-01, 4.1880000000000001e-01, 1.0);
|
||||
} else if (x < 7.0312500000000000e-01) {
|
||||
float dx = x - 6.8750000000000000e-01;
|
||||
return ((vec4( 8.9449847961700044e+00, -2.1676746266635202e+01, -4.0993789718798466e+00, 1.0) * dx
|
||||
+ vec4(-2.3130809213168355e+00, -1.3992441920211368e-01, 8.5597629336753311e-01, 1.0)) * dx
|
||||
+ vec4( 2.2733485314072883e+00, -1.4246436371137491e-01, -9.0563094749671313e-01, 1.0)) * dx
|
||||
+ vec4( 6.8341904761904804e-01, 7.4347619047619096e-01, 4.0443333333333298e-01, 1.0);
|
||||
} else if (x < 7.1875000000000000e-01) {
|
||||
float dx = x - 7.0312500000000000e-01;
|
||||
return ((vec4( 1.1674919661892304e+01, 2.3933066515154213e+01, -1.1673175453308831e+01, 1.0) * dx
|
||||
+ vec4(-1.8937847589963666e+00, -1.1560219004506387e+00, 6.6381790406066532e-01, 1.0)) * dx
|
||||
+ vec4( 2.2076162551523946e+00, -1.6271352495594915e-01, -8.8188416316189755e-01, 1.0)) * dx
|
||||
+ vec4( 7.1840952380952405e-01, 7.4113333333333298e-01, 3.9047619047618998e-01, 1.0);
|
||||
} else if (x < 7.3437500000000000e-01) {
|
||||
float dx = x - 7.1875000000000000e-01;
|
||||
return ((vec4(-4.4641682053710623e+00, 2.0910706819426692e+00, 4.6048045942407727e+00, 1.0) * dx
|
||||
+ vec4(-1.3465228998451648e+00, -3.4159407552784897e-02, 1.1663780468681384e-01, 1.0)) * dx
|
||||
+ vec4( 2.1569864479829954e+00, -1.8131010789350266e-01, -8.6968954271271826e-01, 1.0)) * dx
|
||||
+ vec4( 7.5248571428571398e-01, 7.3839999999999995e-01, 3.7681428571428599e-01, 1.0);
|
||||
} else if (x < 7.5000000000000000e-01) {
|
||||
float dx = x - 7.3437500000000000e-01;
|
||||
return ((vec4( 1.2423276968973711e+01, -6.0829492432479162e+00, -2.1725700066572116e+01, 1.0) * dx
|
||||
+ vec4(-1.5557807844719334e+00, 6.3859530663277708e-02, 3.3248802004185007e-01, 1.0)) * dx
|
||||
+ vec4( 2.1116379529155407e+00, -1.8084604346990121e-01, -8.6267195170133282e-01, 1.0)) * dx
|
||||
+ vec4( 7.8584285714285695e-01, 7.3556666666666704e-01, 3.6327142857142902e-01, 1.0);
|
||||
} else if (x < 7.6562500000000000e-01) {
|
||||
float dx = x - 7.5000000000000000e-01;
|
||||
return ((vec4( 3.4549460436900552e+00, 2.2240726291601970e+01, -7.5799471847609725e+00, 1.0) * dx
|
||||
+ vec4(-9.7343967655129060e-01, -2.2127871511396835e-01, -6.8590417057871789e-01, 1.0)) * dx
|
||||
+ vec4( 2.0721188832120530e+00, -1.8330571822694325e-01, -8.6819407905347146e-01, 1.0)) * dx
|
||||
+ vec4( 8.1850476190476196e-01, 7.3273333333333301e-01, 3.4979047619047599e-01, 1.0);
|
||||
} else if (x < 7.8125000000000000e-01) {
|
||||
float dx = x - 7.6562500000000000e-01;
|
||||
return ((vec4( 8.7094721894791203e+00, 1.3239510743088688e+01, -2.2852796908624047e+01, 1.0) * dx
|
||||
+ vec4(-8.1148908075331927e-01, 8.2125532980487381e-01, -1.0412141948643885e+00, 1.0)) * dx
|
||||
+ vec4( 2.0442293713791684e+00, -1.7393108362239784e-01, -8.9518030351351996e-01, 1.0)) * dx
|
||||
+ vec4( 8.5065714285714300e-01, 7.2989999999999999e-01, 3.3602857142857101e-01, 1.0);
|
||||
} else if (x < 7.9687500000000000e-01) {
|
||||
float dx = x - 7.8125000000000000e-01;
|
||||
return ((vec4(-1.2078434801289291e+01, 4.3390183117236198e+01, -3.9570693752303733e+01, 1.0) * dx
|
||||
+ vec4(-4.0323257187148548e-01, 1.4418573958871561e+00, -2.1124390499561407e+00, 1.0)) * dx
|
||||
+ vec4( 2.0252493455569058e+00, -1.3856994728345987e-01, -9.4445613546384066e-01, 1.0)) * dx
|
||||
+ vec4( 8.8243333333333296e-01, 7.2743333333333304e-01, 3.2169999999999999e-01, 1.0);
|
||||
} else if (x < 8.1250000000000000e-01) {
|
||||
float dx = x - 7.9687500000000000e-01;
|
||||
return ((vec4(-1.2824532984374384e+01, 1.1653781393088177e+02, -1.1096774236821523e+02, 1.0) * dx
|
||||
+ vec4(-9.6940920318192092e-01, 3.4757722295076028e+00, -3.9673153195953783e+00, 1.0)) * dx
|
||||
+ vec4( 2.0038018178216963e+00, -6.1731984386666772e-02, -1.0394522974880831e+00, 1.0)) * dx
|
||||
+ vec4( 9.1393333333333304e-01, 7.2578571428571403e-01, 3.0627619047619098e-01, 1.0);
|
||||
} else if (x < 8.2812500000000000e-01) {
|
||||
float dx = x - 8.1250000000000000e-01;
|
||||
return ((vec4(-3.5855044278532131e+02, 2.7064903734930277e+02, -8.0792089155266083e+01, 1.0) * dx
|
||||
+ vec4(-1.5705591868244702e+00, 8.9384822575176859e+00, -9.1689282431054675e+00, 1.0)) * dx
|
||||
+ vec4( 1.9641148117278464e+00, 1.3224074197310332e-01, -1.2447061031552840e+00, 1.0)) * dx
|
||||
+ vec4( 9.4495714285714305e-01, 7.2611428571428605e-01, 2.8864285714285698e-01, 1.0);
|
||||
} else if (x < 8.4375000000000000e-01) {
|
||||
float dx = x - 8.2812500000000000e-01;
|
||||
return ((vec4(-3.8174017206443654e+02, -1.9549693475620506e+02, 4.4911575613188438e+02, 1.0) * dx
|
||||
+ vec4(-1.8377611192386407e+01, 2.1625155883266252e+01, -1.2956057422258565e+01, 1.0)) * dx
|
||||
+ vec4( 1.6524246495526764e+00, 6.0979758792285232e-01, -1.5904090041765968e+00, 1.0)) * dx
|
||||
+ vec4( 9.7389523809523804e-01, 7.3139523809523799e-01, 2.6664761904761902e-01, 1.0);
|
||||
} else if (x < 8.5937500000000000e-01) {
|
||||
float dx = x - 8.4375000000000000e-01;
|
||||
return ((vec4( 4.3248438818547703e+02, -2.7134838403902307e+02, 3.3204036056432756e+01, 1.0) * dx
|
||||
+ vec4(-3.6271681757906869e+01, 1.2461237066569140e+01, 8.0962436464235150e+00, 1.0)) * dx
|
||||
+ vec4( 7.9852944720434427e-01, 1.1423974777640304e+00, -1.6663435944240195e+00, 1.0)) * dx
|
||||
+ vec4( 9.9377142857142897e-01, 7.4545714285714304e-01, 2.4034761904761900e-01, 1.0);
|
||||
} else if (x < 8.7500000000000000e-01) {
|
||||
float dx = x - 8.5937500000000000e-01;
|
||||
return ((vec4( 1.7847934313241271e+02, -6.1117386114828536e+00, -1.0882439559595376e+02, 1.0) * dx
|
||||
+ vec4(-1.5998976061712632e+01, -2.5821843526006538e-01, 9.6526828365688004e+00, 1.0)) * dx
|
||||
+ vec4(-1.8199581227210410e-02, 1.3330696438782346e+00, -1.3890166181272647e+00, 1.0)) * dx
|
||||
+ vec4( 9.9904285714285701e-01, 7.6531428571428595e-01, 2.1641428571428600e-01, 1.0);
|
||||
} else if (x < 8.9062500000000000e-01) {
|
||||
float dx = x - 8.7500000000000000e-01;
|
||||
return ((vec4( 1.0065469642774150e+02, 1.1181852770679304e+01, -4.2302948910418884e+01, 1.0) * dx
|
||||
+ vec4(-7.6327568523807861e+00, -5.4470618267332416e-01, 4.5515392930084682e+00, 1.0)) * dx
|
||||
+ vec4(-3.8744540800992006e-01, 1.3205239467230254e+00, -1.1670756473526198e+00, 1.0)) * dx
|
||||
+ vec4( 9.9553333333333305e-01, 7.8605714285714301e-01, 1.9665238095238100e-01, 1.0);
|
||||
} else if (x < 9.0625000000000000e-01) {
|
||||
float dx = x - 8.9062500000000000e-01;
|
||||
return ((vec4( 5.1792385442186948e+01, 1.3813127528788970e+01, -4.7771351619749993e+01, 1.0) * dx
|
||||
+ vec4(-2.9145679573304033e+00, -2.0556834047731776e-02, 2.5685885628325829e+00, 1.0)) * dx
|
||||
+ vec4(-5.5224735816165738e-01, 1.3116917120867588e+00, -1.0558236496051034e+00, 1.0)) * dx
|
||||
+ vec4( 9.8799999999999999e-01, 8.0659999999999998e-01, 1.7936666666666701e-01, 1.0);
|
||||
} else if (x < 9.2187500000000000e-01) {
|
||||
float dx = x - 9.0625000000000000e-01;
|
||||
return ((vec4( 1.1035785704157649e+02, 5.2154589495154021e+01, -3.9990387467675163e+01, 1.0) * dx
|
||||
+ vec4(-4.8679988972789023e-01, 6.2693351886425119e-01, 3.2930645565680206e-01, 1.0)) * dx
|
||||
+ vec4(-6.0539373077194325e-01, 1.3211663477870170e+00, -1.0105440399412067e+00, 1.0)) * dx
|
||||
+ vec4( 9.7885714285714298e-01, 8.2714285714285696e-01, 1.6331428571428599e-01, 1.0);
|
||||
} else if (x < 9.3750000000000000e-01) {
|
||||
float dx = x - 9.2187500000000000e-01;
|
||||
return ((vec4( 4.6043843534396274e+01, 2.0987943062129727e+01, -2.3203479461840441e+01, 1.0) * dx
|
||||
+ vec4( 4.6862246590960082e+00, 3.0716799014495959e+00, -1.5452429568904713e+00, 1.0)) * dx
|
||||
+ vec4(-5.3977771875056635e-01, 1.3789571824794209e+00, -1.0295430477729828e+00, 1.0)) * dx
|
||||
+ vec4( 9.6970000000000001e-01, 8.4813809523809502e-01, 1.4745238095238100e-01, 1.0);
|
||||
} else if (x < 9.5312500000000000e-01) {
|
||||
float dx = x - 9.3750000000000000e-01;
|
||||
return ((vec4( 6.1233625963980650e+01, 2.8669866827404956e+01, 2.4201791029260814e+01, 1.0) * dx
|
||||
+ vec4( 6.8445298247708335e+00, 4.0554897324869268e+00, -2.6329060566642419e+00, 1.0)) * dx
|
||||
+ vec4(-3.5960967994014698e-01, 1.4903192080096790e+00, -1.0948266261097752e+00, 1.0)) * dx
|
||||
+ vec4( 9.6258571428571404e-01, 8.7051428571428602e-01, 1.3089999999999999e-01, 1.0);
|
||||
} else if (x < 9.6875000000000000e-01) {
|
||||
float dx = x - 9.5312500000000000e-01;
|
||||
return ((vec4( 4.1070719275903762e+01, 5.3910277236601019e+00, 2.0019172487757277e+01, 1.0) * dx
|
||||
+ vec4( 9.7148560418324266e+00, 5.3993897400215340e+00, -1.4984471021676413e+00, 1.0)) * dx
|
||||
+ vec4(-1.0086927577447102e-01, 1.6380516997676238e+00, -1.1593790192165234e+00, 1.0)) * dx
|
||||
+ vec4( 9.5887142857142904e-01, 8.9490000000000003e-01, 1.1324285714285701e-01, 1.0);
|
||||
} else if (x < 9.8437500000000000e-01) {
|
||||
float dx = x - 9.6875000000000000e-01;
|
||||
return ((vec4(-5.3250445924665847e+01, -1.6529749150400146e+01, -1.4422423336140781e+02, 1.0) * dx
|
||||
+ vec4( 1.1640046007890415e+01, 5.6520941645681013e+00, -5.6004839180401900e-01, 1.0)) * dx
|
||||
+ vec4( 2.3280106875244833e-01, 1.8107311357768368e+00, -1.1915430113098306e+00, 1.0)) * dx
|
||||
+ vec4( 9.5982380952380997e-01, 9.2183333333333295e-01, 9.4838095238095305e-02, 1.0);
|
||||
} else if (x < 1.0000000000000000e+00) {
|
||||
float dx = x - 9.8437500000000000e-01;
|
||||
return ((vec4(-1.9507053557699635e+02, -1.0404825969371934e+02, 1.5617193238656020e+02, 1.0) * dx
|
||||
+ vec4( 9.1439313551717039e+00, 4.8772621731430945e+00, -7.3205593306200099e+00, 1.0)) * dx
|
||||
+ vec4( 5.5755071505029385e-01, 1.9752523285535741e+00, -1.3146775069727061e+00, 1.0)) * dx
|
||||
+ vec4( 9.6609999999999996e-01, 9.5144285714285703e-01, 7.5533333333333300e-02, 1.0);
|
||||
} else {
|
||||
float dx = x - 1.0000000000000000e+00;
|
||||
return ((vec4( 0.0000000000000000e+00, 3.4202936336155174e+00, 3.0625241907655076e+00, 1.0) * dx
|
||||
+ vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx
|
||||
+ vec4( 0.0000000000000000e+00, 0.0000000000000000e+00, 0.0000000000000000e+00, 1.0)) * dx
|
||||
+ vec4( 9.7629999999999995e-01, 9.8309999999999997e-01, 5.3800000000000001e-02, 1.0);
|
||||
}
|
||||
}
|
||||
*/
|
||||
uniform sampler2D colormap;
|
||||
uniform sampler2D colormaps;
|
||||
uniform int num_colormaps;
|
||||
uniform int colormap_id;
|
||||
// can be either 0 or 1
|
||||
uniform int reversed;
|
||||
/*
|
||||
BlackWhiteLinear = 0,
|
||||
RedTemperature = 1,
|
||||
IDLCBGnBu = 2,
|
||||
IDLCBYIGnBu = 3,
|
||||
BluePastelRed = 4,
|
||||
IDLCBBrBG = 5,
|
||||
viridis = 6,
|
||||
plasma = 7,
|
||||
magma = 8,
|
||||
inferno = 9,
|
||||
turbo = 10,
|
||||
YIOrBr = 11,
|
||||
stern = 12,
|
||||
EOSB = 13,
|
||||
spectral = 14,
|
||||
RdBu = 15,
|
||||
parula = 16,
|
||||
*/
|
||||
|
||||
vec4 colormap_f(float x) {
|
||||
x = mix(x, 1.0 - x, float(reversed));
|
||||
/*// BlackWhiteLinear = 0,
|
||||
if (colormap == 0) {
|
||||
return blackw_f(x);
|
||||
// RedTemperature = 1,
|
||||
} else if (colormap == 1) {
|
||||
return red_f(x);
|
||||
// IDLCBGnBu = 2,
|
||||
} else if (colormap == 2) {
|
||||
return cbgnbu_f(x);
|
||||
// IDLCBYIGnBu = 3,
|
||||
} else if (colormap == 3) {
|
||||
return CBYIGnBu_f(x);
|
||||
// BluePastelRed = 4,
|
||||
} else if (colormap == 4) {
|
||||
return bluepastelred_f(x);
|
||||
// IDLCBBrBG = 5,
|
||||
} else if (colormap == 5) {
|
||||
return cbbrbg_f(x);
|
||||
// viridis = 6,
|
||||
} else if (colormap == 6) {
|
||||
return viridis_f(x);
|
||||
// plasma = 7,
|
||||
} else if (colormap == 7) {
|
||||
return plasma_f(x);
|
||||
// magma = 8,
|
||||
} else if (colormap == 8) {
|
||||
return magma_f(x);
|
||||
// inferno = 9,
|
||||
} else if (colormap == 9) {
|
||||
return inferno_f(x);
|
||||
// turbo = 10,
|
||||
} else if (colormap == 10) {
|
||||
return turbo_f(x);
|
||||
// YIOrBr = 11,
|
||||
} else if (colormap == 11) {
|
||||
return YIOrBr_f(x);
|
||||
// stern = 12,
|
||||
} else if (colormap == 12) {
|
||||
return stern_f(x);
|
||||
// EOSB = 13,
|
||||
} else if (colormap == 13) {
|
||||
return EOSB_f(x);
|
||||
// spectral = 14,
|
||||
} else if (colormap == 14) {
|
||||
return spectral_f(x);
|
||||
// RdBu = 15,
|
||||
} else if (colormap == 15) {
|
||||
return RdBu_f(x);
|
||||
// parula = 16,
|
||||
} else if (colormap == 16) {
|
||||
return parula_f(x);
|
||||
}*/
|
||||
float id = (float(colormap_id) + 0.5) / float(num_colormaps);
|
||||
|
||||
return texture(colormap, vec2(x, 0.5));
|
||||
return texture(colormaps, vec2(x, id));
|
||||
}
|
||||
|
||||
@@ -1,49 +1,38 @@
|
||||
/*#[derive(Clone, Copy, Debug)]
|
||||
pub enum Colormap {
|
||||
BlackWhiteLinear = 0,
|
||||
RedTemperature = 1,
|
||||
IDLCBGnBu = 2,
|
||||
IDLCBYIGnBu = 3,
|
||||
BluePastelRed = 4,
|
||||
IDLCBBrBG = 5,
|
||||
Viridis = 6,
|
||||
Plasma = 7,
|
||||
Magma = 8,
|
||||
Inferno = 9,
|
||||
Turbo = 10,
|
||||
YIOrBr = 11,
|
||||
Stern = 12,
|
||||
EOSB = 13,
|
||||
Spectral = 14,
|
||||
RdBu = 15,
|
||||
Parula = 16,
|
||||
}
|
||||
use std::borrow::Cow;
|
||||
/*
|
||||
blackwhite = 0,
|
||||
blues = 1,
|
||||
parula = 2,
|
||||
rainbow = 3,
|
||||
redtemperature = 4,
|
||||
RdBu = 5,
|
||||
RdYiBu = 6,
|
||||
spectral = 7,
|
||||
summer = 8,
|
||||
YIGnBu = 9,
|
||||
YIOrBr = 10,
|
||||
*/
|
||||
use std::rc::Rc;
|
||||
pub struct Colormap {
|
||||
name: String,
|
||||
tex: Texture2D
|
||||
use std::collections::HashMap;
|
||||
pub struct Colormaps {
|
||||
tex: Texture2D,
|
||||
colormaps: HashMap<&'static str, Colormap>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for Colormap {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Colormap")
|
||||
.field("name", &self.name)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
use crate::WebGl2Context;
|
||||
use wasm_bindgen::JsValue;
|
||||
use crate::core::Texture2D;
|
||||
use crate::resources::Resources;
|
||||
use web_sys::WebGl2RenderingContext;
|
||||
use crate::image_fmt::FormatImageType;
|
||||
use crate::shader::ShaderId;
|
||||
use std::borrow::Cow;
|
||||
impl Colormap {
|
||||
pub fn new(gl: &WebGl2Context, rs: &Resources, name: &str) -> Result<Self, JsValue> {
|
||||
let colormap_filename = rs.get_filename(name).unwrap();
|
||||
impl Colormaps {
|
||||
pub fn new(gl: &WebGl2Context, rs: &Resources) -> Result<Self, JsValue> {
|
||||
let colormaps: HashMap<&str, Colormap> = [
|
||||
("blackwhite", Colormap { name: "blackwhite", id: 0 }),
|
||||
("blues", Colormap { name: "blues", id: 1 }),
|
||||
("parula", Colormap { name: "parula", id: 2 }),
|
||||
("rainbow", Colormap { name: "rainbow", id: 3 }),
|
||||
("RdBu", Colormap { name: "RdBu", id: 4 }),
|
||||
("RdYiBu", Colormap { name: "RdYiBu", id: 5 }),
|
||||
("redtemperature", Colormap { name: "redtemperature", id: 6 }),
|
||||
("spectral", Colormap { name: "spectral", id: 7 }),
|
||||
("summer", Colormap { name: "summer", id: 8 }),
|
||||
("YIGnBu", Colormap { name: "YIGnBu", id: 9 }),
|
||||
("YIOrBr", Colormap { name: "YIOrBr", id: 10 }),
|
||||
].iter().cloned().collect();
|
||||
let colormap_filename = rs.get_filename("colormaps").unwrap();
|
||||
let tex = Texture2D::create(
|
||||
gl,
|
||||
"colormap",
|
||||
@@ -70,249 +59,86 @@ impl Colormap {
|
||||
],
|
||||
FormatImageType::PNG,
|
||||
)?;
|
||||
Ok(Colormap {
|
||||
name: name.to_string(),
|
||||
tex: tex
|
||||
|
||||
Ok(Self {
|
||||
colormaps,
|
||||
tex
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn get_list_available_colormaps() -> &'static [&'static str] {
|
||||
&[
|
||||
"RedTemperature",
|
||||
"BluePastelRed",
|
||||
"IDLCBGnBu",
|
||||
"IDLCBYIGnBu",
|
||||
"IDLCBBrBG",
|
||||
"YIOrBr",
|
||||
"Viridis",
|
||||
"Plasma",
|
||||
"Magma",
|
||||
"Inferno",
|
||||
"Turbo",
|
||||
"Stern",
|
||||
"EOSB",
|
||||
"Spectral",
|
||||
"blackwhite",
|
||||
"blues",
|
||||
"parula",
|
||||
"rainbow",
|
||||
"RdBu",
|
||||
"Parula",
|
||||
"BlackWhiteLinear",
|
||||
"RdYiBu",
|
||||
"redtemperature",
|
||||
"spectral",
|
||||
"summer",
|
||||
"YIGnBu",
|
||||
"YIOrBr",
|
||||
]
|
||||
}
|
||||
|
||||
pub fn get_catalog_shader<'a>(gl: &WebGl2Context, shaders: &'a mut ShaderManager) -> &'a Shader {
|
||||
|
||||
pub fn get(&self, name: &str) -> Colormap {
|
||||
let c = if let Some(c) = self.colormaps.get(name) {
|
||||
c
|
||||
} else {
|
||||
self.colormaps.get("blackwhite").unwrap()
|
||||
};
|
||||
|
||||
*c
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
pub struct Colormap {
|
||||
pub name: &'static str,
|
||||
pub id: i32,
|
||||
}
|
||||
|
||||
use crate::WebGl2Context;
|
||||
use wasm_bindgen::JsValue;
|
||||
use crate::core::Texture2D;
|
||||
use crate::resources::Resources;
|
||||
use web_sys::WebGl2RenderingContext;
|
||||
use crate::image_fmt::FormatImageType;
|
||||
use crate::shader::ShaderId;
|
||||
use std::borrow::Cow;
|
||||
impl Colormap {
|
||||
pub fn get_catalog_shader<'a>(gl: &WebGl2Context, shaders: &'a mut ShaderManager) -> Result<&'a Shader, JsValue> {
|
||||
shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapCatalogVS"),
|
||||
Cow::Borrowed("ColormapCatalogFS"),
|
||||
),
|
||||
).unwrap()
|
||||
}
|
||||
}
|
||||
use std::fmt;
|
||||
impl fmt::Display for Colormap {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "Colormap name: {}", self.name)
|
||||
).map_err(|e| e.into())
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
use crate::{shader::ShaderId, WebGl2Context};
|
||||
impl Colormap {
|
||||
pub fn new(id: &str) -> Self {
|
||||
if id.contains("RedTemperature") {
|
||||
Colormap::RedTemperature
|
||||
} else if id.contains("BluePastelRed") {
|
||||
Colormap::BluePastelRed
|
||||
} else if id.contains("IDLCBGnBu") {
|
||||
Colormap::IDLCBGnBu
|
||||
} else if id.contains("IDLCBYIGnBu") {
|
||||
Colormap::IDLCBYIGnBu
|
||||
} else if id.contains("IDLCBBrBG") {
|
||||
Colormap::IDLCBBrBG
|
||||
} else if id.contains("Viridis") {
|
||||
Colormap::Viridis
|
||||
} else if id.contains("Plasma") {
|
||||
Colormap::Plasma
|
||||
} else if id.contains("Magma") {
|
||||
Colormap::Magma
|
||||
} else if id.contains("Inferno") {
|
||||
Colormap::Inferno
|
||||
} else if id.contains("Turbo") {
|
||||
Colormap::Turbo
|
||||
} else if id.contains("YIOrBr") {
|
||||
Colormap::YIOrBr
|
||||
} else if id.contains("Stern") {
|
||||
Colormap::Stern
|
||||
} else if id.contains("EOSB") {
|
||||
Colormap::EOSB
|
||||
} else if id.contains("Spectral") {
|
||||
Colormap::Spectral
|
||||
} else if id.contains("RdBu") {
|
||||
Colormap::RdBu
|
||||
} else if id.contains("Parula") {
|
||||
Colormap::Parula
|
||||
} else {
|
||||
Colormap::BlackWhiteLinear
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub fn get_shader<'a>(&self, gl: &WebGl2Context, shaders: &'a mut ShaderManager) -> &'a Shader {
|
||||
let shader = match self {
|
||||
Colormap::BlackWhiteLinear => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapBlackWhiteFS"),
|
||||
),
|
||||
),
|
||||
Colormap::RedTemperature => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapRedTemperatureFS"),
|
||||
),
|
||||
),
|
||||
Colormap::IDLCBGnBu => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_GnBuFS"),
|
||||
),
|
||||
),
|
||||
Colormap::IDLCBYIGnBu => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_YIGnBuFS"),
|
||||
),
|
||||
),
|
||||
Colormap::BluePastelRed => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapBluePastelRedFS"),
|
||||
),
|
||||
),
|
||||
Colormap::IDLCBBrBG => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::Viridis => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::Plasma => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::Magma => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::Inferno => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::Turbo => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::YIOrBr => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::Stern => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::EOSB => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::Spectral => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::RdBu => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
// TODO: update with correct shader
|
||||
Colormap::Parula => shaders.get(
|
||||
gl,
|
||||
&ShaderId(
|
||||
Cow::Borrowed("ColormapVS"),
|
||||
Cow::Borrowed("ColormapIDL_CB_BrBGFS"),
|
||||
),
|
||||
),
|
||||
};
|
||||
|
||||
shader.unwrap()
|
||||
}
|
||||
}
|
||||
*/
|
||||
use crate::shader::SendUniforms;
|
||||
use crate::shader::ShaderBound;
|
||||
|
||||
impl SendUniforms for Colormap {
|
||||
impl SendUniforms for Colormaps {
|
||||
fn attach_uniforms<'a>(&self, shader: &'a ShaderBound<'a>) -> &'a ShaderBound<'a> {
|
||||
shader.attach_uniform("colormap", &self.tex);
|
||||
shader.attach_uniform("colormaps", &self.tex)
|
||||
.attach_uniform("num_colormaps", &(self.colormaps.len() as i32));
|
||||
|
||||
shader
|
||||
}
|
||||
}
|
||||
/*
|
||||
impl From<String> for Colormap {
|
||||
fn from(id: String) -> Self {
|
||||
Colormap::new(&id)
|
||||
|
||||
impl SendUniforms for Colormap {
|
||||
fn attach_uniforms<'a>(&self, shader: &'a ShaderBound<'a>) -> &'a ShaderBound<'a> {
|
||||
shader.attach_uniform("colormap_id", &self.id);
|
||||
|
||||
shader
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
use crate::Shader;
|
||||
use crate::ShaderManager;
|
||||
|
||||
@@ -54,7 +54,7 @@ import { requestAnimFrame } from "./libs/RequestAnimationFrame.js";
|
||||
import { loadShaders } from './Shaders.js';
|
||||
// Import kernel image
|
||||
import kernel from '../core/img/kernel.png';
|
||||
import parula from '../core/img/parula.png';
|
||||
import colormaps from '../core/img/colormaps/colormaps.png';
|
||||
|
||||
import { ImageSurveyLayer } from "./ImageSurveyLayer.js";
|
||||
|
||||
@@ -78,7 +78,7 @@ export let View = (function() {
|
||||
// Start our Rust application. You can find `WebClient` in `src/lib.rs`
|
||||
let resources = {
|
||||
'kernel': kernel,
|
||||
'parula': parula,
|
||||
'colormaps': colormaps,
|
||||
};
|
||||
this.aladin.webglAPI = new Aladin.wasmLibs.webgl.WebClient(this.aladinDiv.id, shaders, resources);
|
||||
|
||||
|
||||