├── LICENSE
├── README.md
├── decoder.html
├── decoder.js
├── img
├── LitSphere_test_02.jpg
├── RadialGradient.png
├── bars.jpg
├── checkers.jpg
├── checkers2.jpg
├── color1
├── color1.jpg
├── color2.jpg
├── color3.jpg
├── color_wheel.jpg
├── decoder.png
├── elevation0.png
├── env1bg.jpg
├── env2bg.jpg
├── env3bg.jpg
├── env4bg.jpg
├── gradient-ocean.png
├── gradient.png
├── hypsometric01.png
├── imhof.psd
├── imhof5.jpg
├── mad-pano.jpg
├── mad-pano1-blur.jpg
├── mad-pano1-blur2.jpg
├── mad-pano1.jpg
├── matball01.jpg
├── office-pano1-blur.jpg
├── office-pano1.jpg
├── rings.jpg
├── rings2.jpg
├── shade1.png
├── skylight.jpg
├── sunrise.jpg
├── sunrise2.jpg
├── sunrise3.jpg
├── sunset.jpg
└── wheel.png
├── index.html
├── kernel.glsl
├── lib
├── dat.gui.min.js
├── key.js
├── leaflet-hash.js
├── tangram.debug.js
└── tangram.min.js
├── main.js
└── styles
├── blurred-normal.yaml
├── combo.yaml
├── contours.yaml
├── contours2.yaml
├── elevation-difference.yaml
├── elevation-extrude.yaml
├── elevation-tiles.yaml
├── elevation-zoom-adjust.yaml
├── environment-map1.yaml
├── grayscale.yaml
├── green-avg.yaml
├── green-selectiveblur.yaml
├── green-stdev-adjusted.yaml
├── green-stdev-opt.yaml
├── green-stdev.yaml
├── green.yaml
├── heightmap.yaml
├── hypsometric-adjusted.yaml
├── hypsometric-spheremap.yaml
├── hypsometric-spheremap2.yaml
├── hypsometric-texture.yaml
├── hypsometric.yaml
├── imhof.yaml
├── imhof2.yaml
├── kinkade-style.yaml
├── median-normal.yaml
├── median.yaml
├── metal.yaml
├── normal-alpha-elevation.yaml
├── normals-averaged.yaml
├── normals-manual.yaml
├── normals-tiles.yaml
├── raster-normal.yaml
├── reference-elevation.yaml
├── sharpen-normals.yaml
├── sharpened.yaml
├── single-light.yaml
├── slope.yaml
├── sunrise.yaml
├── sunset.yaml
├── terrarium-elevation.yaml
├── three-lights.yaml
├── two-lights.yaml
└── weighted-average.yaml
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Mapzen
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # terrain-demos
2 |
3 | Ways to manipulate heightmap data in [Tangram](http://github.com/tangrams/tangram) as seen in the [Mapping Mountains](https://mapzen.com/blog/mapping-mountains/) post on the [Mapzen blog](http://mapzen.com/blog).
4 |
5 |
6 |
7 | ## Style gallery
8 |
9 | - elevation tiles: http://tangrams.github.io/terrain-demos/?url=styles/elevation-tiles.yaml
10 | - basic green: http://tangrams.github.io/terrain-demos/?url=styles/green.yaml
11 | - animated contours: http://tangrams.github.io/terrain-demos/?url=styles/contours.yaml
12 | - grayscale hypsometric: http://tangrams.github.io/terrain-demos/?url=styles/grayscale.yaml
13 | - classic hypsometric: http://tangrams.github.io/terrain-demos/?url=styles/hypsometric.yaml
14 | - slopemap: http://tangrams.github.io/terrain-demos/?url=styles/slope.yaml
15 | - heightmap: http://tangrams.github.io/terrain-demos/?url=styles/heightmap.yaml
16 | - manual normal derivation: http://tangrams.github.io/terrain-demos/?url=styles/normals-manual.yaml
17 | - normal tiles: http://tangrams.github.io/terrain-demos/?url=styles/normals-tiles.yaml
18 | - single light: http://tangrams.github.io/terrain-demos/?url=styles/single-light.yaml
19 | - two lights: http://tangrams.github.io/terrain-demos/?url=styles/two-lights.yaml
20 | - three lights: http://tangrams.github.io/terrain-demos/?url=styles/three-lights.yaml
21 | - environment map: http://tangrams.github.io/terrain-demos/?url=styles/environment-map1.yaml
22 | - metal spheremap: http://tangrams.github.io/terrain-demos/?url=styles/metal.yaml
23 | - sunrise spheremap: http://tangrams.github.io/terrain-demos/?url=styles/sunrise.yaml
24 | - sunset spheremap: http://tangrams.github.io/terrain-demos/?url=styles/sunset.yaml
25 | - swiss style: http://tangrams.github.io/terrain-demos/?url=styles/imhof.yaml
26 |
27 | Check out the source code for these and more examples in the [styles directory](https://github.com/tangrams/terrain-demos/tree/gh-pages/styles).
28 |
29 | ### Elevation tiles vs. Normal tiles alpha elevation
30 |
31 | Mapzen offers two sources of elevation data: the ["terrarium" elevation tiles](https://mapzen.com/documentation/terrain-tiles/formats/#terrarium), and also the [alpha channel of the normal tiles](https://mapzen.com/documentation/terrain-tiles/formats/#normal). Most of the examples in this repo are based on the elevation tiles, but some of them (such as normal-alpha-elevation.yaml) use the alpha channel of the normal tiles. This source is a bit trickier to use, but if you don't need the 24-bit resolution of the elevation tiles, and are already loading the normal tiles, it will make your styles faster.
32 |
33 | The elevation tiles use a relatively simple linear encoding, but the normal tiles alpha channel is quantized, non-linear, and 8-bit. (More information about this encoding can be found in [the documentation for our elevation datasource](https://mapzen.com/documentation/terrain-tiles/formats/#normal).)
34 |
35 | To make this source simpler to interpret, we're using a "[decoder ring](https://wikipedia.org/wiki/Secret_decoder_ring)" image which maps the quantized range to the unquantized range as best it can. This image is generated with [a piece of JavaScript](decoder.js) which runs the quantize function in reverse, and creates a new image in a canvas element with the decoded output values for each input value. [You can run this script here](tangrams.github.io/terrain-demos/decoder.html). This image has also been pregenerated for your convenience, and is stored in this repo as [decoder.png](https://github.com/tangrams/terrain-demos/blob/master/img/decoder.png). It looks like this:
36 |
37 | 
38 |
39 | This image can be used as a texture in a heightmap shader, for easier decoding.
40 |
41 | ### To run locally:
42 |
43 | Start a web server in the repo's directory:
44 |
45 | python -m SimpleHTTPServer 8000
46 |
47 | If that doesn't work, try:
48 |
49 | python -m http.server 8000
50 |
51 | Then navigate to, eg: [http://localhost:8000/?url=styles/contours.yaml](http://localhost:8000/?url=styles/contours.yaml)
52 |
--------------------------------------------------------------------------------
/decoder.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/decoder.js:
--------------------------------------------------------------------------------
1 | // wait until the page loads to run the script
2 | // (otherwise there won't be a document to write to)
3 | window.onload = function() {
4 | table = [];
5 | for (i = 0; i < 11; i++) {
6 | table.push(-11000 + i * 1000);
7 | }
8 | table.push(-100)
9 | table.push( -50)
10 | table.push( -20)
11 | table.push( -10)
12 | table.push( -1)
13 | for (i = 0; i < 150; i++) {
14 | table.push(20 * i);
15 | }
16 | for (i = 0; i < 60; i++) {
17 | table.push(3000 + 50 * i);
18 | }
19 | for (i = 0; i < 29; i++) {
20 | table.push(6000 + 100 * i);
21 | }
22 | console.log(table);
23 |
24 | function bisectLeft (array, x) {
25 | for (var i = 0; i < array.length; i++) {
26 | if (array[i] >= x) return i;
27 | }
28 | return array.length;
29 | }
30 |
31 | // make a new canvas element to draw into
32 | var canvas = document.createElement('canvas');
33 | canvas.id = "canvas";
34 | canvas.width = 255;
35 | canvas.height = 10;
36 |
37 | var ctx=canvas.getContext("2d");
38 | var imgData=ctx.createImageData(255,1);
39 |
40 | // all 10 rows are identical, just to make it easier to see
41 | for (j=0; j< 10; j++){
42 | // save data in the columns
43 | for (i = 0; i < 255; i++) {
44 | v = table[i];
45 | console.log('starting value:', v);
46 | // o = offset
47 | o = v + 11000;
48 | // r = red channel
49 | r = o % 256;
50 | g = Math.floor(o / 256);
51 | console.log('r:', r, 'g:', g);
52 | console.log('reconstructed, r + g*256 - 11000:', (r+g*256)-11000);
53 |
54 | // build each pixel's color value
55 | id = i * 4;
56 | {
57 | imgData.data[id+0]=r;
58 | imgData.data[id+1]=g;
59 | imgData.data[id+2]=0; // don't use b channel
60 | imgData.data[id+3]=255; // solid alpha
61 | }
62 | }
63 | ctx.putImageData(imgData,0,j);
64 | }
65 | // grab the contents of the otherwise invisible canvas
66 | var d=canvas.toDataURL("image/png");
67 | // add a new image with the contents of the canvas to the document
68 | document.write("");
69 | }
70 |
--------------------------------------------------------------------------------
/img/LitSphere_test_02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/LitSphere_test_02.jpg
--------------------------------------------------------------------------------
/img/RadialGradient.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/RadialGradient.png
--------------------------------------------------------------------------------
/img/bars.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/bars.jpg
--------------------------------------------------------------------------------
/img/checkers.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/checkers.jpg
--------------------------------------------------------------------------------
/img/checkers2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/checkers2.jpg
--------------------------------------------------------------------------------
/img/color1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/color1
--------------------------------------------------------------------------------
/img/color1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/color1.jpg
--------------------------------------------------------------------------------
/img/color2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/color2.jpg
--------------------------------------------------------------------------------
/img/color3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/color3.jpg
--------------------------------------------------------------------------------
/img/color_wheel.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/color_wheel.jpg
--------------------------------------------------------------------------------
/img/decoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/decoder.png
--------------------------------------------------------------------------------
/img/elevation0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/elevation0.png
--------------------------------------------------------------------------------
/img/env1bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/env1bg.jpg
--------------------------------------------------------------------------------
/img/env2bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/env2bg.jpg
--------------------------------------------------------------------------------
/img/env3bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/env3bg.jpg
--------------------------------------------------------------------------------
/img/env4bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/env4bg.jpg
--------------------------------------------------------------------------------
/img/gradient-ocean.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/gradient-ocean.png
--------------------------------------------------------------------------------
/img/gradient.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/gradient.png
--------------------------------------------------------------------------------
/img/hypsometric01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/hypsometric01.png
--------------------------------------------------------------------------------
/img/imhof.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/imhof.psd
--------------------------------------------------------------------------------
/img/imhof5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/imhof5.jpg
--------------------------------------------------------------------------------
/img/mad-pano.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/mad-pano.jpg
--------------------------------------------------------------------------------
/img/mad-pano1-blur.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/mad-pano1-blur.jpg
--------------------------------------------------------------------------------
/img/mad-pano1-blur2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/mad-pano1-blur2.jpg
--------------------------------------------------------------------------------
/img/mad-pano1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/mad-pano1.jpg
--------------------------------------------------------------------------------
/img/matball01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/matball01.jpg
--------------------------------------------------------------------------------
/img/office-pano1-blur.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/office-pano1-blur.jpg
--------------------------------------------------------------------------------
/img/office-pano1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/office-pano1.jpg
--------------------------------------------------------------------------------
/img/rings.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/rings.jpg
--------------------------------------------------------------------------------
/img/rings2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/rings2.jpg
--------------------------------------------------------------------------------
/img/shade1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/shade1.png
--------------------------------------------------------------------------------
/img/skylight.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/skylight.jpg
--------------------------------------------------------------------------------
/img/sunrise.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/sunrise.jpg
--------------------------------------------------------------------------------
/img/sunrise2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/sunrise2.jpg
--------------------------------------------------------------------------------
/img/sunrise3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/sunrise3.jpg
--------------------------------------------------------------------------------
/img/sunset.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/sunset.jpg
--------------------------------------------------------------------------------
/img/wheel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tangrams/terrain-demos/9de91d85b1279512b7cd3b2944f484b9c513fb1e/img/wheel.png
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 | Tangram
14 |
15 |
16 |
17 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/kernel.glsl:
--------------------------------------------------------------------------------
1 | #ifdef GL_ES
2 | precision mediump float;
3 | #endif
4 |
5 | float normpdf(in float x, in float sigma)
6 | {
7 | return 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma;
8 | }
9 |
10 |
11 | void mainImage( out vec4 fragColor, in vec2 fragCoord )
12 | {
13 | //declare stuff
14 | const int mSize = 11;
15 | const int kSize = (mSize-1)/2;
16 | float kernel[mSize];
17 | vec3 final_colour = vec3(0.0);
18 |
19 | //create the 1-D kernel
20 | float sigma = 7.0;
21 | float Z = 0.0;
22 | for (int j = 0; j <= kSize; ++j)
23 | {
24 | kernel[kSize+j] = kernel[kSize-j] = normpdf(float(j), sigma);
25 | }
26 |
27 | //get the normalization factor (as the gaussian has been clamped)
28 | for (int j = 0; j < mSize; ++j)
29 | {
30 | Z += kernel[j];
31 | }
32 |
33 | //read out the texels
34 | for (int i=-kSize; i <= kSize; ++i)
35 | {
36 | for (int j=-kSize; j <= kSize; ++j)
37 | {
38 | final_colour += kernel[kSize+j]*kernel[kSize+i]*texture2D(iChannel0, (fragCoord.xy+vec2(float(i),float(j))) / iResolution.xy).rgb;
39 |
40 | }
41 | }
42 |
43 | fragColor = vec4(final_colour/(Z*Z), 1.0);
44 | }
--------------------------------------------------------------------------------
/lib/dat.gui.min.js:
--------------------------------------------------------------------------------
1 | var dat=dat||{};dat.gui=dat.gui||{};dat.utils=dat.utils||{};dat.controllers=dat.controllers||{};dat.dom=dat.dom||{};dat.color=dat.color||{};dat.utils.css=function(){return{load:function(e,a){a=a||document;var b=a.createElement("link");b.type="text/css";b.rel="stylesheet";b.href=e;a.getElementsByTagName("head")[0].appendChild(b)},inject:function(e,a){a=a||document;var b=document.createElement("style");b.type="text/css";b.innerHTML=e;a.getElementsByTagName("head")[0].appendChild(b)}}}();
2 | dat.utils.common=function(){var e=Array.prototype.forEach,a=Array.prototype.slice;return{BREAK:{},extend:function(b){this.each(a.call(arguments,1),function(a){for(var f in a)this.isUndefined(a[f])||(b[f]=a[f])},this);return b},defaults:function(b){this.each(a.call(arguments,1),function(a){for(var f in a)this.isUndefined(b[f])&&(b[f]=a[f])},this);return b},compose:function(){var b=a.call(arguments);return function(){for(var d=a.call(arguments),f=b.length-1;0<=f;f--)d=[b[f].apply(this,d)];return d[0]}},
3 | each:function(a,d,f){if(e&&a.forEach===e)a.forEach(d,f);else if(a.length===a.length+0)for(var c=0,p=a.length;c
this.__max&&(a=this.__max);void 0!==this.__step&&0!=a%this.__step&&(a=Math.round(a/this.__step)*this.__step);return b.superclass.prototype.setValue.call(this,a)},min:function(a){this.__min=a;return this},max:function(a){this.__max=a;return this},step:function(a){this.__step=a;return this}});return b}(dat.controllers.Controller,dat.utils.common);
17 | dat.controllers.NumberControllerBox=function(e,a,b){var d=function(f,c,e){function k(){var a=parseFloat(n.__input.value);b.isNaN(a)||n.setValue(a)}function l(a){var c=r-a.clientY;n.setValue(n.getValue()+c*n.__impliedStep);r=a.clientY}function q(){a.unbind(window,"mousemove",l);a.unbind(window,"mouseup",q)}this.__truncationSuspended=!1;d.superclass.call(this,f,c,e);var n=this,r;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"change",k);a.bind(this.__input,
18 | "blur",function(){k();n.__onFinishChange&&n.__onFinishChange.call(n,n.getValue())});a.bind(this.__input,"mousedown",function(c){a.bind(window,"mousemove",l);a.bind(window,"mouseup",q);r=c.clientY});a.bind(this.__input,"keydown",function(a){13===a.keyCode&&(n.__truncationSuspended=!0,this.blur(),n.__truncationSuspended=!1)});this.updateDisplay();this.domElement.appendChild(this.__input)};d.superclass=e;b.extend(d.prototype,e.prototype,{updateDisplay:function(){var a=this.__input,c;if(this.__truncationSuspended)c=
19 | this.getValue();else{c=this.getValue();var b=Math.pow(10,this.__precision);c=Math.round(c*b)/b}a.value=c;return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.NumberController,dat.dom.dom,dat.utils.common);
20 | dat.controllers.NumberControllerSlider=function(e,a,b,d,f){function c(a,c,d,b,f){return b+(a-c)/(d-c)*(f-b)}var p=function(d,b,f,e,r){function y(d){d.preventDefault();var b=a.getOffset(h.__background),f=a.getWidth(h.__background);h.setValue(c(d.clientX,b.left,b.left+f,h.__min,h.__max));return!1}function g(){a.unbind(window,"mousemove",y);a.unbind(window,"mouseup",g);h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}p.superclass.call(this,d,b,{min:f,max:e,step:r});var h=this;this.__background=
21 | document.createElement("div");this.__foreground=document.createElement("div");a.bind(this.__background,"mousedown",function(c){a.bind(window,"mousemove",y);a.bind(window,"mouseup",g);y(c)});a.addClass(this.__background,"slider");a.addClass(this.__foreground,"slider-fg");this.updateDisplay();this.__background.appendChild(this.__foreground);this.domElement.appendChild(this.__background)};p.superclass=e;p.useDefaultStyles=function(){b.inject(f)};d.extend(p.prototype,e.prototype,{updateDisplay:function(){var a=
22 | (this.getValue()-this.__min)/(this.__max-this.__min);this.__foreground.style.width=100*a+"%";return p.superclass.prototype.updateDisplay.call(this)}});return p}(dat.controllers.NumberController,dat.dom.dom,dat.utils.css,dat.utils.common,"/**\n * dat-gui JavaScript Controller Library\n * http://code.google.com/p/dat-gui\n *\n * Copyright 2011 Data Arts Team, Google Creative Lab\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n */\n\n.slider {\n box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);\n height: 1em;\n border-radius: 1em;\n background-color: #eee;\n padding: 0 0.5em;\n overflow: hidden;\n}\n\n.slider-fg {\n padding: 1px 0 2px 0;\n background-color: #aaa;\n height: 1em;\n margin-left: -0.5em;\n padding-right: 0.5em;\n border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n display: inline-block;\n border-radius: 1em;\n background-color: #fff;\n border: 1px solid #aaa;\n content: '';\n float: right;\n margin-right: -1em;\n margin-top: -1px;\n height: 0.9em;\n width: 0.9em;\n}");
23 | dat.controllers.FunctionController=function(e,a,b){var d=function(b,c,e){d.superclass.call(this,b,c);var k=this;this.__button=document.createElement("div");this.__button.innerHTML=void 0===e?"Fire":e;a.bind(this.__button,"click",function(a){a.preventDefault();k.fire();return!1});a.addClass(this.__button,"button");this.domElement.appendChild(this.__button)};d.superclass=e;b.extend(d.prototype,e.prototype,{fire:function(){this.__onChange&&this.__onChange.call(this);this.__onFinishChange&&this.__onFinishChange.call(this,
24 | this.getValue());this.getValue().call(this.object)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);
25 | dat.controllers.BooleanController=function(e,a,b){var d=function(b,c){d.superclass.call(this,b,c);var e=this;this.__prev=this.getValue();this.__checkbox=document.createElement("input");this.__checkbox.setAttribute("type","checkbox");a.bind(this.__checkbox,"change",function(){e.setValue(!e.__prev)},!1);this.domElement.appendChild(this.__checkbox);this.updateDisplay()};d.superclass=e;b.extend(d.prototype,e.prototype,{setValue:function(a){a=d.superclass.prototype.setValue.call(this,a);this.__onFinishChange&&
26 | this.__onFinishChange.call(this,this.getValue());this.__prev=this.getValue();return a},updateDisplay:function(){!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0):this.__checkbox.checked=!1;return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);
27 | dat.color.toString=function(e){return function(a){if(1==a.a||e.isUndefined(a.a)){for(a=a.hex.toString(16);6>a.length;)a="0"+a;return"#"+a}return"rgba("+Math.round(a.r)+","+Math.round(a.g)+","+Math.round(a.b)+","+a.a+")"}}(dat.utils.common);
28 | dat.color.interpret=function(e,a){var b,d,f=[{litmus:a.isString,conversions:{THREE_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null===a?!1:{space:"HEX",hex:parseInt("0x"+a[1].toString()+a[1].toString()+a[2].toString()+a[2].toString()+a[3].toString()+a[3].toString())}},write:e},SIX_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9]{6})$/i);return null===a?!1:{space:"HEX",hex:parseInt("0x"+a[1].toString())}},write:e},CSS_RGB:{read:function(a){a=a.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
29 | return null===a?!1:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3])}},write:e},CSS_RGBA:{read:function(a){a=a.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return null===a?!1:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3]),a:parseFloat(a[4])}},write:e}}},{litmus:a.isNumber,conversions:{HEX:{read:function(a){return{space:"HEX",hex:a,conversionName:"HEX"}},write:function(a){return a.hex}}}},{litmus:a.isArray,conversions:{RGB_ARRAY:{read:function(a){return 3!=
30 | a.length?!1:{space:"RGB",r:a[0],g:a[1],b:a[2]}},write:function(a){return[a.r,a.g,a.b]}},RGBA_ARRAY:{read:function(a){return 4!=a.length?!1:{space:"RGB",r:a[0],g:a[1],b:a[2],a:a[3]}},write:function(a){return[a.r,a.g,a.b,a.a]}}}},{litmus:a.isObject,conversions:{RGBA_OBJ:{read:function(c){return a.isNumber(c.r)&&a.isNumber(c.g)&&a.isNumber(c.b)&&a.isNumber(c.a)?{space:"RGB",r:c.r,g:c.g,b:c.b,a:c.a}:!1},write:function(a){return{r:a.r,g:a.g,b:a.b,a:a.a}}},RGB_OBJ:{read:function(c){return a.isNumber(c.r)&&
31 | a.isNumber(c.g)&&a.isNumber(c.b)?{space:"RGB",r:c.r,g:c.g,b:c.b}:!1},write:function(a){return{r:a.r,g:a.g,b:a.b}}},HSVA_OBJ:{read:function(c){return a.isNumber(c.h)&&a.isNumber(c.s)&&a.isNumber(c.v)&&a.isNumber(c.a)?{space:"HSV",h:c.h,s:c.s,v:c.v,a:c.a}:!1},write:function(a){return{h:a.h,s:a.s,v:a.v,a:a.a}}},HSV_OBJ:{read:function(d){return a.isNumber(d.h)&&a.isNumber(d.s)&&a.isNumber(d.v)?{space:"HSV",h:d.h,s:d.s,v:d.v}:!1},write:function(a){return{h:a.h,s:a.s,v:a.v}}}}}];return function(){d=!1;
32 | var c=1\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n \n