diff --git a/src/ColorMap.js b/src/ColorMap.js index 97154a9..3d56b24 100644 --- a/src/ColorMap.js +++ b/src/ColorMap.js @@ -18,7 +18,7 @@ * along with GlobWeb. If not, see . ***************************************/ -define([], function() { +define(["./Numeric"], function(Numeric) { /**************************************************************************************************************/ var transferFonctions = { @@ -335,6 +335,48 @@ function _textureFromPixelArray(gl, dataArray, format, dataType, width, height) return { + /** + * Create custom colormap with equidistant intervals + * + * @param name Colormap name + * @param colors The array of colors defining the colormap(must have length at least >=2) + */ + addCustomColormap : function(name, colors) + { + if ( colors.length < 2 ) + { + console.error("Colors length must be >= 2"); + return null; + } + + var colormapSize = 256; + var colormap = { + red: [], + green: [], + blue: [] + }; + + var nbIntervals = colors.length-1; + for ( var i=0; i