@sauskylark/potree
Version:
WebGL point cloud viewer
150 lines (145 loc) • 5.48 kB
JavaScript
import * as THREE from "../../libs/three.js/build/three.module.js";
// -------------------------------------------
// to get a ready to use gradient array from a chroma.js gradient:
// http://gka.github.io/chroma.js/
// -------------------------------------------
//
// let stops = [];
// for(let i = 0; i <= 10; i++){
// let range = chroma.scale(['yellow', 'navy']).mode('lch').domain([10,0])(i)._rgb
// .slice(0, 3)
// .map(v => (v / 255).toFixed(4))
// .join(", ");
//
// let line = `[${i / 10}, new THREE.Color(${range})],`;
//
// stops.push(line);
// }
// stops.join("\n");
//
//
//
// -------------------------------------------
// to get a ready to use gradient array from matplotlib:
// -------------------------------------------
// import matplotlib.pyplot as plt
// import matplotlib.colors as colors
//
// norm = colors.Normalize(vmin=0,vmax=1)
// cmap = plt.cm.viridis
//
// for i in range(0,11):
// u = i / 10
// rgb = cmap(norm(u))[0:3]
// rgb = ["{0:.3f}".format(v) for v in rgb]
// rgb = "[" + str(u) + ", new THREE.Color(" + ", ".join(rgb) + ")],"
// print(rgb)
let Gradients = {
// From chroma spectral http://gka.github.io/chroma.js/
SPECTRAL: [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
],
PLASMA: [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
],
YELLOW_GREEN: [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
],
VIRIDIS: [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
],
INFERNO: [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
],
GRAYSCALE: [
[],
[]
],
// 16 samples of the TURBU color scheme
// values taken from: https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f
// original file licensed under Apache-2.0
TURBO: [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
],
RAINBOW: [
[],
[],
[],
[],
[],
[],
[]
],
CONTOUR: [
[],
[],
[],
[]
],
};
export {Gradients};