{"version":3,"sources":["/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/webgl/base.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/webgl/gloo2.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/webgl/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/webgl/line.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/webgl/main.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/webgl/markers.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7mCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnZA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"generated.js","sourceRoot":"","sourcesContent":["'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar color_1 = require(25 /* core/util/color */);\nexports.BaseGLGlyph = function () {\n BaseGLGlyph.prototype.GLYPH = '';\n BaseGLGlyph.prototype.VERT = '';\n BaseGLGlyph.prototype.FRAG = '';\n function BaseGLGlyph(gl, glyph) {\n this.gl = gl;\n this.glyph = glyph;\n this.nvertices = 0;\n this.size_changed = false;\n this.data_changed = false;\n this.visuals_changed = false;\n this.init();\n }\n BaseGLGlyph.prototype.set_data_changed = function (n) {\n if (n !== this.nvertices) {\n this.nvertices = n;\n this.size_changed = true;\n }\n return this.data_changed = true;\n };\n BaseGLGlyph.prototype.set_visuals_changed = function () {\n return this.visuals_changed = true;\n };\n BaseGLGlyph.prototype.render = function (ctx, indices, mainglyph) {\n var dx, dy, ref, ref1, ref2, sx, sy, trans, wx, wy;\n wx = wy = 1;\n ref = this.glyph.renderer.map_to_screen([\n 0 * wx,\n 1 * wx,\n 2 * wx\n ], [\n 0 * wy,\n 1 * wy,\n 2 * wy\n ]), dx = ref[0], dy = ref[1];\n wx = 100 / Math.min(Math.max(Math.abs(dx[1] - dx[0]), 1e-12), 1000000000000);\n wy = 100 / Math.min(Math.max(Math.abs(dy[1] - dy[0]), 1e-12), 1000000000000);\n ref1 = this.glyph.renderer.map_to_screen([\n 0 * wx,\n 1 * wx,\n 2 * wx\n ], [\n 0 * wy,\n 1 * wy,\n 2 * wy\n ]), dx = ref1[0], dy = ref1[1];\n if (Math.abs(dx[1] - dx[0] - (dx[2] - dx[1])) > 0.000001 || Math.abs(dy[1] - dy[0] - (dy[2] - dy[1])) > 0.000001) {\n return false;\n }\n ref2 = [\n (dx[1] - dx[0]) / wx,\n (dy[1] - dy[0]) / wy\n ], sx = ref2[0], sy = ref2[1];\n trans = {\n pixel_ratio: ctx.pixel_ratio,\n width: ctx.glcanvas.width,\n height: ctx.glcanvas.height,\n dx: dx[0] / sx,\n dy: dy[0] / sy,\n sx: sx,\n sy: sy\n };\n this.draw(indices, mainglyph, trans);\n return true;\n };\n return BaseGLGlyph;\n}();\nexports.line_width = function (width) {\n if (width < 2) {\n width = Math.sqrt(width * 2);\n }\n return width;\n};\nexports.fill_array_with_float = function (n, val) {\n var a, i, k, ref;\n a = new Float32Array(n);\n for (i = k = 0, ref = n; 0 <= ref ? k < ref : k > ref; i = 0 <= ref ? ++k : --k) {\n a[i] = val;\n }\n return a;\n};\nexports.fill_array_with_vec = function (n, m, val) {\n var a, i, j, k, l, ref, ref1;\n a = new Float32Array(n * m);\n for (i = k = 0, ref = n; 0 <= ref ? k < ref : k > ref; i = 0 <= ref ? ++k : --k) {\n for (j = l = 0, ref1 = m; 0 <= ref1 ? l < ref1 : l > ref1; j = 0 <= ref1 ? ++l : --l) {\n a[i * m + j] = val[j];\n }\n }\n return a;\n};\nexports.visual_prop_is_singular = function (visual, propname) {\n return visual[propname].spec.value !== void 0;\n};\nexports.attach_float = function (prog, vbo, att_name, n, visual, name) {\n var a;\n if (!visual.doit) {\n vbo.used = false;\n return prog.set_attribute(att_name, 'float', [0]);\n } else if (exports.visual_prop_is_singular(visual, name)) {\n vbo.used = false;\n return prog.set_attribute(att_name, 'float', visual[name].value());\n } else {\n vbo.used = true;\n a = new Float32Array(visual.cache[name + '_array']);\n vbo.set_size(n * 4);\n vbo.set_data(0, a);\n return prog.set_attribute(att_name, 'float', vbo);\n }\n};\nexports.attach_color = function (prog, vbo, att_name, n, visual, prefix) {\n var a, alphaname, alphas, colorname, colors, i, j, k, l, m, ref, ref1, rgba;\n m = 4;\n colorname = prefix + '_color';\n alphaname = prefix + '_alpha';\n if (!visual.doit) {\n vbo.used = false;\n return prog.set_attribute(att_name, 'vec4', [\n 0,\n 0,\n 0,\n 0\n ]);\n } else if (exports.visual_prop_is_singular(visual, colorname) && exports.visual_prop_is_singular(visual, alphaname)) {\n vbo.used = false;\n rgba = color_1.color2rgba(visual[colorname].value(), visual[alphaname].value());\n return prog.set_attribute(att_name, 'vec4', rgba);\n } else {\n vbo.used = true;\n if (exports.visual_prop_is_singular(visual, colorname)) {\n colors = function () {\n var k, ref, results;\n results = [];\n for (i = k = 0, ref = n; 0 <= ref ? k < ref : k > ref; i = 0 <= ref ? ++k : --k) {\n results.push(visual[colorname].value());\n }\n return results;\n }();\n } else {\n colors = visual.cache[colorname + '_array'];\n }\n if (exports.visual_prop_is_singular(visual, alphaname)) {\n alphas = exports.fill_array_with_float(n, visual[alphaname].value());\n } else {\n alphas = visual.cache[alphaname + '_array'];\n }\n a = new Float32Array(n * m);\n for (i = k = 0, ref = n; 0 <= ref ? k < ref : k > ref; i = 0 <= ref ? ++k : --k) {\n rgba = color_1.color2rgba(colors[i], alphas[i]);\n for (j = l = 0, ref1 = m; 0 <= ref1 ? l < ref1 : l > ref1; j = 0 <= ref1 ? ++l : --l) {\n a[i * m + j] = rgba[j];\n }\n }\n vbo.set_size(n * m * 4);\n vbo.set_data(0, a);\n return prog.set_attribute(att_name, 'vec4', vbo);\n }\n}; \n","'use strict';\n/* Do not edit, autogenerated by flexx.pyscript */\nvar _pyfunc_add = function (a, b) {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.concat(b);\n }\n return a + b;\n};\nvar _pyfunc_all = function (x) {\n for (var i = 0; i < x.length; i++) {\n if (!_pyfunc_truthy(x[i])) {\n return false;\n }\n }\n return true;\n};\nvar _pyfunc_contains = function contains(a, b) {\n if (b == null) {\n } else if (Array.isArray(b)) {\n for (var i = 0; i < b.length; i++) {\n if (_pyfunc_equals(a, b[i]))\n return true;\n }\n return false;\n } else if (b.constructor === Object) {\n for (var k in b) {\n if (a == k)\n return true;\n }\n return false;\n } else if (b.constructor == String) {\n return b.indexOf(a) >= 0;\n }\n var e = Error('Not a container: ' + b);\n e.name = 'TypeError';\n throw e;\n};\nvar _pyfunc_equals = function equals(a, b) {\n if (a == null || b == null) {\n } else if (Array.isArray(a) && Array.isArray(b)) {\n var i = 0, iseq = a.length == b.length;\n while (iseq && i < a.length) {\n iseq = equals(a[i], b[i]);\n i += 1;\n }\n return iseq;\n } else if (a.constructor === Object && b.constructor === Object) {\n var akeys = Object.keys(a), bkeys = Object.keys(b);\n akeys.sort();\n bkeys.sort();\n var i = 0, k, iseq = equals(akeys, bkeys);\n while (iseq && i < akeys.length) {\n k = akeys[i];\n iseq = equals(a[k], b[k]);\n i += 1;\n }\n return iseq;\n }\n return a == b;\n};\nvar _pyfunc_instantiate = function (ob, args) {\n if (typeof ob === 'undefined' || typeof window !== 'undefined' && window === ob || typeof global !== 'undefined' && global === ob) {\n throw 'Class constructor is called as a function.';\n }\n for (var name in ob) {\n if (Object[name] === undefined && typeof ob[name] === 'function' && !ob[name].nobind) {\n ob[name] = ob[name].bind(ob);\n }\n }\n if (ob.__init__) {\n ob.__init__.apply(ob, args);\n }\n};\nvar _pyfunc_mult = function (a, b) {\n if ((typeof a === 'number') + (typeof b === 'number') === 1) {\n if (a.constructor === String)\n return _pymeth_repeat.call(a, b);\n if (b.constructor === String)\n return _pymeth_repeat.call(b, a);\n if (Array.isArray(b)) {\n var t = a;\n a = b;\n b = t;\n }\n if (Array.isArray(a)) {\n var res = [];\n for (var i = 0; i < b; i++)\n res = res.concat(a);\n return res;\n }\n }\n return a * b;\n};\nvar _pyfunc_range = function (start, end, step) {\n var i, res = [];\n var val = start;\n var n = (end - start) / step;\n for (i = 0; i < n; i++) {\n res.push(val);\n val += step;\n }\n return res;\n};\nvar _pyfunc_truthy = function (v) {\n if (v === null || typeof v !== 'object') {\n return v;\n } else if (v.length !== undefined) {\n return v.length ? v : false;\n } else if (v.byteLength !== undefined) {\n return v.byteLength ? v : false;\n } else if (v.constructor !== Object) {\n return true;\n } else {\n return Object.getOwnPropertyNames(v).length ? v : false;\n }\n};\nvar _pymeth_append = function (x) {\n if (!Array.isArray(this))\n return this.append.apply(this, arguments);\n this.push(x);\n};\nvar _pymeth_get = function (key, d) {\n if (this.constructor !== Object)\n return this.get.apply(this, arguments);\n if (this[key] !== undefined) {\n return this[key];\n } else if (d !== undefined) {\n return d;\n } else {\n return null;\n }\n};\nvar _pymeth_keys = function () {\n if (typeof this['keys'] === 'function')\n return this.keys.apply(this, arguments);\n return Object.keys(this);\n};\nvar _pymeth_lstrip = function (chars) {\n if (this.constructor !== String)\n return this.lstrip.apply(this, arguments);\n chars = chars === undefined ? ' \\t\\r\\n' : chars;\n for (var i = 0; i < this.length; i++) {\n if (chars.indexOf(this[i]) < 0)\n return this.slice(i);\n }\n return '';\n};\nvar _pymeth_remove = function (x) {\n if (!Array.isArray(this))\n return this.remove.apply(this, arguments);\n for (var i = 0; i < this.length; i++) {\n if (_pyfunc_equals(this[i], x)) {\n this.splice(i, 1);\n return;\n }\n }\n var e = Error(x);\n e.name = 'ValueError';\n throw e;\n};\nvar _pymeth_repeat = function (count) {\n if (this.repeat)\n return this.repeat(count);\n if (count < 1)\n return '';\n var result = '', pattern = this.valueOf();\n while (count > 1) {\n if (count & 1)\n result += pattern;\n count >>= 1, pattern += pattern;\n }\n return result + pattern;\n};\nvar _pymeth_startswith = function (x) {\n if (this.constructor !== String)\n return this.startswith.apply(this, arguments);\n return this.indexOf(x) == 0;\n};\nvar Buffer, GlooObject, IndexBuffer, Program, Texture2D, Texture3DLike, VertexBuffer, __version__, check_error, console;\n// PyScript module for gloo2.js - lightweight object oriented GL.\n{\n console = window.console;\n}\n__version__ = '0.3';\ncheck_error = function (gl, when) {\n var e, err, err_3, errors, msg, stub1_seq, stub2_itr;\n when = when === undefined ? 'periodic check' : when;\n // Check this from time to time to detect GL errors.\n //\n // Parameters\n // ----------\n // when : str\n // Shown in the exception to help the developer determine when\n // this check was done.\n errors = [];\n while (true) {\n err = gl.getError();\n if (_pyfunc_equals(err, gl.NO_ERROR) || _pyfunc_truthy(errors) && _pyfunc_equals(err, errors[errors.length - 1])) {\n break;\n }\n _pymeth_append.call(errors, err);\n }\n if (errors.length) {\n msg = '';\n stub1_seq = errors;\n if (typeof stub1_seq === 'object' && !Array.isArray(stub1_seq)) {\n stub1_seq = Object.keys(stub1_seq);\n }\n for (stub2_itr = 0; stub2_itr < stub1_seq.length; stub2_itr += 1) {\n e = stub1_seq[stub2_itr];\n msg = _pyfunc_add(msg, e);\n }\n err_3 = new Error('RuntimeError:' + ('OpenGL got errors (' + when + '): ' + msg + ''));\n err_3.name = 'RuntimeError';\n throw err_3;\n }\n return null;\n};\nGlooObject = function () {\n // Abstract base class for all Gloo classes.\n _pyfunc_instantiate(this, arguments);\n};\nGlooObject.prototype._base_class = Object;\nGlooObject.prototype._class_name = 'GlooObject';\nGlooObject.prototype.__init__ = function (gl) {\n // Init by passing the webgl context object.\n this._gl = gl;\n this.handle = null;\n this._create();\n if (!(this.handle !== null)) {\n throw 'AssertionError: ' + 'this.handle !== null';\n }\n return null;\n};\nGlooObject.prototype._create = function () {\n var err_2;\n err_2 = new Error('NotImplementedError:' + '');\n err_2.name = 'NotImplementedError';\n throw err_2;\n return null;\n};\nProgram = function () {\n // The program is the central component to connect gloo objects and shaders.\n _pyfunc_instantiate(this, arguments);\n};\nProgram.prototype = Object.create(GlooObject.prototype);\nProgram.prototype._base_class = GlooObject.prototype;\nProgram.prototype._class_name = 'Program';\nProgram.prototype.UTYPEMAP = {\n 'float': 'uniform1fv',\n 'vec2': 'uniform2fv',\n 'vec3': 'uniform3fv',\n 'vec4': 'uniform4fv',\n 'int': 'uniform1iv',\n 'ivec2': 'uniform2iv',\n 'ivec3': 'uniform3iv',\n 'ivec4': 'uniform4iv',\n 'bool': 'uniform1iv',\n 'bvec2': 'uniform2iv',\n 'bvec3': 'uniform3iv',\n 'bvec4': 'uniform4iv',\n 'mat2': 'uniformMatrix2fv',\n 'mat3': 'uniformMatrix3fv',\n 'mat4': 'uniformMatrix4fv',\n 'sampler1D': 'uniform1i',\n 'sampler2D': 'uniform1i',\n 'sampler3D': 'uniform1i'\n};\nProgram.prototype.ATYPEMAP = {\n 'float': 'vertexAttrib1f',\n 'vec2': 'vertexAttrib2f',\n 'vec3': 'vertexAttrib3f',\n 'vec4': 'vertexAttrib4f'\n};\nProgram.prototype.ATYPEINFO = {\n 'float': [\n 1,\n 5126\n ],\n 'vec2': [\n 2,\n 5126\n ],\n 'vec3': [\n 3,\n 5126\n ],\n 'vec4': [\n 4,\n 5126\n ]\n};\nProgram.prototype._create = function () {\n this.handle = this._gl.createProgram();\n this.locations = {};\n this._unset_variables = [];\n this._validated = false;\n this._samplers = {};\n this._attributes = {};\n this._known_invalid = [];\n return null;\n};\nProgram.prototype.delete = function () {\n // Delete the program.\n this._gl.deleteProgram(this.handle);\n return null;\n};\nProgram.prototype.activate = function () {\n // Activate the program.\n this._gl.useProgram(this.handle);\n return null;\n};\nProgram.prototype.deactivate = function () {\n // Disable the program.\n this._gl.useProgram(0);\n return null;\n};\nProgram.prototype.set_shaders = function (vert, frag) {\n var code, err_3, err_4, errors, frag_handle, gl, handle, i, status, stub3_, tmp, type_, vert_handle;\n // Set GLSL code for the vertex and fragment shader.\n //\n // This function takes care of setting the shading code and\n // compiling+linking it into a working program object that is ready\n // to use.\n //\n // Parameters\n // ----------\n // vert : str\n // GLSL code for the vertex shader.\n // frag : str\n // GLSL code for the fragment shader.\n gl = this._gl;\n this._linked = false;\n vert_handle = gl.createShader(gl.VERTEX_SHADER);\n frag_handle = gl.createShader(gl.FRAGMENT_SHADER);\n tmp = [\n [\n vert,\n vert_handle,\n 'vertex'\n ],\n [\n frag,\n frag_handle,\n 'fragment'\n ]\n ];\n for (i = 0; i < 2; i += 1) {\n stub3_ = tmp[i];\n code = stub3_[0];\n handle = stub3_[1];\n type_ = stub3_[2];\n gl.shaderSource(handle, code);\n gl.compileShader(handle);\n status = gl.getShaderParameter(handle, gl.COMPILE_STATUS);\n if (!_pyfunc_truthy(status)) {\n errors = gl.getShaderInfoLog(handle);\n err_4 = new Error('RuntimeError:' + _pyfunc_add('errors in ' + type_ + ' shader:\\n', errors));\n err_4.name = 'RuntimeError';\n throw err_4;\n }\n }\n gl.attachShader(this.handle, vert_handle);\n gl.attachShader(this.handle, frag_handle);\n gl.linkProgram(this.handle);\n if (!_pyfunc_truthy(gl.getProgramParameter(this.handle, gl.LINK_STATUS))) {\n err_3 = new Error('RuntimeError:' + ('Program link error:\\n' + gl.getProgramInfoLog(this.handle)));\n err_3.name = 'RuntimeError';\n throw err_3;\n }\n this._unset_variables = this._get_active_attributes_and_uniforms();\n gl.detachShader(this.handle, vert_handle);\n gl.detachShader(this.handle, frag_handle);\n gl.deleteShader(vert_handle);\n gl.deleteShader(frag_handle);\n this._known_invalid = [];\n this._linked = true;\n return null;\n};\nProgram.prototype._get_active_attributes_and_uniforms = function () {\n var attributes, ca, container, count, cu, getActive, getLocation, gl, i, info, j, m, name, regex, stub4_, stub5_seq, stub6_itr, uniforms, x;\n // Retrieve active attributes and uniforms to be able to check that\n // all uniforms/attributes are set by the user.\n gl = this._gl;\n this.locations = {};\n regex = new window.RegExp('(\\\\w+)\\\\s*(\\\\[(\\\\d+)\\\\])\\\\s*');\n cu = gl.getProgramParameter(this.handle, gl.ACTIVE_UNIFORMS);\n ca = gl.getProgramParameter(this.handle, gl.ACTIVE_ATTRIBUTES);\n attributes = [];\n uniforms = [];\n stub5_seq = [\n [\n attributes,\n ca,\n gl.getActiveAttrib,\n gl.getAttribLocation\n ],\n [\n uniforms,\n cu,\n gl.getActiveUniform,\n gl.getUniformLocation\n ]\n ];\n if (typeof stub5_seq === 'object' && !Array.isArray(stub5_seq)) {\n stub5_seq = Object.keys(stub5_seq);\n }\n for (stub6_itr = 0; stub6_itr < stub5_seq.length; stub6_itr += 1) {\n x = stub5_seq[stub6_itr];\n stub4_ = x;\n container = stub4_[0];\n count = stub4_[1];\n getActive = stub4_[2];\n getLocation = stub4_[3];\n for (i = 0; i < count; i += 1) {\n info = getActive.call(gl, this.handle, i);\n name = info.name;\n m = name.match(regex);\n if (_pyfunc_truthy(m)) {\n name = m[1];\n for (j = 0; j < info.size; j += 1) {\n _pymeth_append.call(container, [\n '' + name + '[' + j + ']',\n info.type\n ]);\n }\n } else {\n _pymeth_append.call(container, [\n name,\n info.type\n ]);\n }\n this.locations[name] = getLocation.call(gl, this.handle, name);\n }\n }\n return _pyfunc_add(function list_comprehenson() {\n var res = [];\n var v, iter0, i0;\n iter0 = attributes;\n if (typeof iter0 === 'object' && !Array.isArray(iter0)) {\n iter0 = Object.keys(iter0);\n }\n for (i0 = 0; i0 < iter0.length; i0++) {\n v = iter0[i0];\n {\n res.push(v[0]);\n }\n }\n return res;\n }.apply(this), function list_comprehenson() {\n var res = [];\n var v, iter0, i0;\n iter0 = uniforms;\n if (typeof iter0 === 'object' && !Array.isArray(iter0)) {\n iter0 = Object.keys(iter0);\n }\n for (i0 = 0; i0 < iter0.length; i0++) {\n v = iter0[i0];\n {\n res.push(v[0]);\n }\n }\n return res;\n }.apply(this));\n};\nProgram.prototype.set_texture = function (name, value) {\n var err_3, handle, unit;\n // Set a texture sampler.\n //\n // A texture is a 2 dimensional grid of colors/intensities that\n // can be applied to a face (or used for other means by providing\n // a regular grid of data).\n //\n // Parameters\n // ----------\n // name : str\n // The name by which the texture is known in the GLSL code.\n // value : Texture2D\n // The gloo Texture2D object to bind.\n if (!_pyfunc_truthy(this._linked)) {\n err_3 = new Error('RuntimeError:' + 'Cannot set uniform when program has no code');\n err_3.name = 'RuntimeError';\n throw err_3;\n }\n handle = _pymeth_get.call(this.locations, name, -1);\n if (_pyfunc_truthy(handle < 0)) {\n if (!_pyfunc_contains(name, this._known_invalid)) {\n _pymeth_append.call(this._known_invalid, name);\n console.log('Variable ' + name + ' is not an active texture');\n }\n return null;\n }\n if (_pyfunc_contains(name, this._unset_variables)) {\n _pymeth_remove.call(this._unset_variables, name);\n }\n this.activate();\n if (true) {\n unit = _pymeth_keys.call(this._samplers).length;\n if (_pyfunc_contains(name, this._samplers)) {\n unit = this._samplers[name][this._samplers[name].length - 1];\n }\n this._samplers[name] = [\n value._target,\n value.handle,\n unit\n ];\n this._gl.uniform1i(handle, unit);\n }\n return null;\n};\nProgram.prototype.set_uniform = function (name, type_, value) {\n var a_type, count, err_3, funcname, handle, j, name_;\n // Set a uniform value.\n //\n // A uniform is a value that is global to both the vertex and\n // fragment shader.\n //\n // Parameters\n // ----------\n // name : str\n // The name by which the uniform is known in the GLSL code.\n // type_ : str\n // The type of the uniform, e.g. 'float', 'vec2', etc.\n // value : list of scalars\n // The value for the uniform. Should be a list even for type float.\n if (!_pyfunc_truthy(this._linked)) {\n err_3 = new Error('RuntimeError:' + 'Cannot set uniform when program has no code');\n err_3.name = 'RuntimeError';\n throw err_3;\n }\n handle = _pymeth_get.call(this.locations, name, -1);\n if (_pyfunc_truthy(handle < 0)) {\n if (!_pyfunc_contains(name, this._known_invalid)) {\n _pymeth_append.call(this._known_invalid, name);\n console.log('Variable ' + name + ' is not an active uniform');\n }\n return null;\n }\n if (_pyfunc_contains(name, this._unset_variables)) {\n _pymeth_remove.call(this._unset_variables, name);\n }\n count = 1;\n if (!_pymeth_startswith.call(type_, 'mat')) {\n a_type = _pymeth_get.call({\n 'int': 'float',\n 'bool': 'float'\n }, type_, _pymeth_lstrip.call(type_, 'ib'));\n count = Math.floor(value.length / this.ATYPEINFO[a_type][0]);\n }\n if (_pyfunc_truthy(count > 1)) {\n for (j = 0; j < count; j += 1) {\n if (_pyfunc_contains('' + name + '[' + j + ']', this._unset_variables)) {\n name_ = '' + name + '[' + j + ']';\n if (_pyfunc_contains(name_, this._unset_variables)) {\n _pymeth_remove.call(this._unset_variables, name_);\n }\n }\n }\n }\n funcname = this.UTYPEMAP[type_];\n this.activate();\n if (_pymeth_startswith.call(type_, 'mat')) {\n this._gl[funcname](handle, false, value);\n } else {\n this._gl[funcname](handle, value);\n }\n return null;\n};\nProgram.prototype.set_attribute = function (name, type_, value, stride, offset) {\n var args, err_3, funcname, gtype, handle, is_vbo, size, stub7_;\n stride = stride === undefined ? 0 : stride;\n offset = offset === undefined ? 0 : offset;\n // Set an attribute value.\n //\n // An attribute represents per-vertex data and can only be used\n // in the vertex shader.\n //\n // Parameters\n // ----------\n // name : str\n // The name by which the attribute is known in the GLSL code.\n // type_ : str\n // The type of the attribute, e.g. 'float', 'vec2', etc.\n // value : VertexBuffer, array\n // If value is a VertexBuffer, it is used (with stride and offset)\n // for the vertex data. If value is an array, its used to set\n // the value of all vertices (similar to a uniform).\n // stide : int, default 0\n // The stride to \"sample\" the vertex data inside the buffer. Unless\n // multiple vertex data are packed into a single buffer, this should\n // be zero.\n // offset : int, default 0\n // The offset to \"sample\" the vertex data inside the buffer. Unless\n // multiple vertex data are packed into a single buffer, or only\n // a part of the data must be used, this should probably be zero.\n if (!_pyfunc_truthy(this._linked)) {\n err_3 = new Error('RuntimeError:' + 'Cannot set attribute when program has no code');\n err_3.name = 'RuntimeError';\n throw err_3;\n }\n is_vbo = value instanceof VertexBuffer;\n handle = _pymeth_get.call(this.locations, name, -1);\n if (_pyfunc_truthy(handle < 0)) {\n if (!_pyfunc_contains(name, this._known_invalid)) {\n _pymeth_append.call(this._known_invalid, name);\n if (_pyfunc_truthy(is_vbo) && _pyfunc_truthy(offset > 0)) {\n } else {\n console.log('Variable ' + name + ' is not an active attribute');\n }\n }\n return null;\n }\n if (_pyfunc_contains(name, this._unset_variables)) {\n _pymeth_remove.call(this._unset_variables, name);\n }\n this.activate();\n if (!_pyfunc_truthy(is_vbo)) {\n funcname = this.ATYPEMAP[type_];\n this._attributes[name] = [\n 0,\n handle,\n funcname,\n value\n ];\n } else {\n stub7_ = this.ATYPEINFO[type_];\n size = stub7_[0];\n gtype = stub7_[1];\n funcname = 'vertexAttribPointer';\n args = [\n size,\n gtype,\n this._gl.FALSE,\n stride,\n offset\n ];\n this._attributes[name] = [\n value.handle,\n handle,\n funcname,\n args\n ];\n }\n return null;\n};\nProgram.prototype._pre_draw = function () {\n var args, attr_handle, funcname, stub10_, stub11_seq, stub8_, stub9_seq, tex_handle, tex_target, unit, vbo_handle, x;\n // Prepare for drawing.\n this.activate();\n stub9_seq = this._samplers;\n for (x in stub9_seq) {\n if (!stub9_seq.hasOwnProperty(x)) {\n continue;\n }\n x = stub9_seq[x];\n stub8_ = x;\n tex_target = stub8_[0];\n tex_handle = stub8_[1];\n unit = stub8_[2];\n this._gl.activeTexture(_pyfunc_add(this._gl.TEXTURE0, unit));\n this._gl.bindTexture(tex_target, tex_handle);\n }\n stub11_seq = this._attributes;\n for (x in stub11_seq) {\n if (!stub11_seq.hasOwnProperty(x)) {\n continue;\n }\n x = stub11_seq[x];\n stub10_ = x;\n vbo_handle = stub10_[0];\n attr_handle = stub10_[1];\n funcname = stub10_[2];\n args = stub10_[3];\n if (_pyfunc_truthy(vbo_handle)) {\n this._gl.bindBuffer(this._gl.ARRAY_BUFFER, vbo_handle);\n this._gl.enableVertexAttribArray(attr_handle);\n this._gl[funcname].apply(this._gl, [].concat([attr_handle], args));\n } else {\n this._gl.bindBuffer(this._gl.ARRAY_BUFFER, null);\n this._gl.disableVertexAttribArray(attr_handle);\n this._gl[funcname].apply(this._gl, [].concat([attr_handle], args));\n }\n }\n if (!_pyfunc_truthy(this._validated)) {\n this._validated = true;\n this._validate();\n }\n return null;\n};\nProgram.prototype._validate = function () {\n var err_3;\n if (this._unset_variables.length) {\n console.log('Program has unset variables: ' + this._unset_variables + '');\n }\n this._gl.validateProgram(this.handle);\n if (!_pyfunc_truthy(this._gl.getProgramParameter(this.handle, this._gl.VALIDATE_STATUS))) {\n console.log(this._gl.getProgramInfoLog(this.handle));\n err_3 = new Error('RuntimeError:' + 'Program validation error');\n err_3.name = 'RuntimeError';\n throw err_3;\n }\n return null;\n};\nProgram.prototype.draw = function (mode, selection) {\n var count, err_3, first, gtype, stub12_;\n // Draw the current visualization defined by the program.\n //\n // Parameters\n // ----------\n // mode : GL enum\n // Can be POINTS, LINES, LINE_LOOP, LINE_STRIP, LINE_FAN, TRIANGLES\n // selection : 2-element tuple or IndexBuffer\n // The selection to draw, specified either as (first, count) or an\n // IndexBuffer object.\n if (!_pyfunc_truthy(this._linked)) {\n err_3 = new Error('RuntimeError:' + 'Cannot draw program if code has not been set');\n err_3.name = 'RuntimeError';\n throw err_3;\n }\n check_error(this._gl, 'before draw');\n if (_pyfunc_truthy(selection instanceof IndexBuffer)) {\n this._pre_draw();\n selection.activate();\n count = selection._buffer_size / 2;\n gtype = this._gl.UNSIGNED_SHORT;\n this._gl.drawElements(mode, count, gtype, 0);\n selection.deactivate();\n } else {\n stub12_ = selection;\n first = stub12_[0];\n count = stub12_[1];\n if (_pyfunc_truthy(count)) {\n this._pre_draw();\n this._gl.drawArrays(mode, first, count);\n }\n }\n check_error(this._gl, 'after draw');\n return null;\n};\nBuffer = function () {\n // Base buffer class for vertex data or index data.\n _pyfunc_instantiate(this, arguments);\n};\nBuffer.prototype = Object.create(GlooObject.prototype);\nBuffer.prototype._base_class = GlooObject.prototype;\nBuffer.prototype._class_name = 'Buffer';\nBuffer.prototype._target = null;\nBuffer.prototype._usage = 35048;\nBuffer.prototype._create = function () {\n this.handle = this._gl.createBuffer();\n this._buffer_size = 0;\n return null;\n};\nBuffer.prototype.delete = function () {\n // Delete the buffer.\n this._gl.deleteBuffer(this.handle);\n return null;\n};\nBuffer.prototype.activate = function () {\n // Activete the buffer.\n this._gl.bindBuffer(this._target, this.handle);\n return null;\n};\nBuffer.prototype.deactivate = function () {\n // Disable the buffer.\n this._gl.bindBuffer(this._target, null);\n return null;\n};\nBuffer.prototype.set_size = function (nbytes) {\n // Set the size of the buffer in bytes.\n //\n // Parameters\n // ----------\n // nbytes : int\n // The number of bytes that the buffer needs to hold.\n if (!_pyfunc_equals(nbytes, this._buffer_size)) {\n this.activate();\n this._gl.bufferData(this._target, nbytes, this._usage);\n this._buffer_size = nbytes;\n }\n return null;\n};\nBuffer.prototype.set_data = function (offset, data) {\n // Set the buffer data.\n //\n // Parameters\n // ----------\n // offset : int\n // The offset in bytes for the new data.\n // data : typed array\n // The data to upload.\n this.activate();\n this._gl.bufferSubData(this._target, offset, data);\n return null;\n};\nVertexBuffer = function () {\n // A buffer for vertex data.\n _pyfunc_instantiate(this, arguments);\n};\nVertexBuffer.prototype = Object.create(Buffer.prototype);\nVertexBuffer.prototype._base_class = Buffer.prototype;\nVertexBuffer.prototype._class_name = 'VertexBuffer';\nVertexBuffer.prototype._target = 34962;\nIndexBuffer = function () {\n // A buffer for index data.\n _pyfunc_instantiate(this, arguments);\n};\nIndexBuffer.prototype = Object.create(Buffer.prototype);\nIndexBuffer.prototype._base_class = Buffer.prototype;\nIndexBuffer.prototype._class_name = 'IndexBuffer';\nIndexBuffer.prototype._target = 34963;\nTexture2D = function () {\n // A 2 dimensional regular grid.\n _pyfunc_instantiate(this, arguments);\n};\nTexture2D.prototype = Object.create(GlooObject.prototype);\nTexture2D.prototype._base_class = GlooObject.prototype;\nTexture2D.prototype._class_name = 'Texture2D';\nTexture2D.prototype._target = 3553;\nTexture2D.prototype._types = {\n 'Int8Array': 5120,\n 'Uint8Array': 5121,\n 'Int16Array': 5122,\n 'Uint16Array': 5123,\n 'Int32Array': 5124,\n 'Uint32Array': 5125,\n 'Float32Array': 5126\n};\nTexture2D.prototype._create = function () {\n this.handle = this._gl.createTexture();\n this._shape_format = null;\n return null;\n};\nTexture2D.prototype.delete = function () {\n // Delete the texture.\n this._gl.deleteTexture(this.handle);\n return null;\n};\nTexture2D.prototype.activate = function () {\n // Activate the texture.\n this._gl.bindTexture(this._target, this.handle);\n return null;\n};\nTexture2D.prototype.deactivate = function () {\n // Disable the texture.\n this._gl.bindTexture(this._target, 0);\n return null;\n};\nTexture2D.prototype._get_alignment = function (width) {\n var alignment, alignments, stub13_seq, stub14_itr;\n // Determines a textures byte alignment. If the width isn't a\n // power of 2 we need to adjust the byte alignment of the image.\n // The image height is unimportant.\n //\n // www.opengl.org/wiki/Common_Mistakes#Texture_upload_and_pixel_reads\n alignments = [\n 4,\n 8,\n 2,\n 1\n ];\n stub13_seq = alignments;\n if (typeof stub13_seq === 'object' && !Array.isArray(stub13_seq)) {\n stub13_seq = Object.keys(stub13_seq);\n }\n for (stub14_itr = 0; stub14_itr < stub13_seq.length; stub14_itr += 1) {\n alignment = stub13_seq[stub14_itr];\n if (_pyfunc_equals(width % alignment, 0)) {\n return alignment;\n }\n }\n return null;\n};\nTexture2D.prototype.set_wrapping = function (wrap_s, wrap_t) {\n // Set the texture wrapping mode.\n //\n // Parameters\n // ----------\n // wrap_s : GL enum\n // The mode to wrap the x dimension. Valid values are REPEAT\n // CLAMP_TO_EDGE MIRRORED_REPEAT\n // wrap_t : GL enum\n // The mode to wrap the y dimension. Same options as for wrap_s.\n this.activate();\n this._gl.texParameterf(this._target, this._gl.TEXTURE_WRAP_S, wrap_s);\n this._gl.texParameterf(this._target, this._gl.TEXTURE_WRAP_T, wrap_t);\n return null;\n};\nTexture2D.prototype.set_interpolation = function (min, mag) {\n // Set the texture interpolation mode\n //\n // Parameters\n // ----------\n // min : GL enum\n // The interpolation mode when minifying (i.e. zoomed out). Valid\n // values are LINEAR and NEAREST.\n // max : GL enum\n // The interpolation mode when magnifying (i.e. zoomed in). Valid\n // values are LINEAR, NEAREST, NEAREST_MIPMAP_NEAREST,\n // LINEAR_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR, LINEAR_MIPMAP_LINEAR.\n this.activate();\n this._gl.texParameterf(this._target, this._gl.TEXTURE_MIN_FILTER, min);\n this._gl.texParameterf(this._target, this._gl.TEXTURE_MAG_FILTER, mag);\n return null;\n};\nTexture2D.prototype.set_size = function (shape, format) {\n var height, stub15_, width;\n // Set the size of the 2D texture.\n //\n // Parameters\n // ----------\n // shape : tuple of ints\n // The shape of the data to upload\n // format : GL enum\n // The format of the texture data. Can be LUMINANCE, LUMINANCE_ALPHA,\n // RGB, and RGBA.\n stub15_ = shape;\n height = stub15_[0];\n width = stub15_[1];\n if (!_pyfunc_equals([\n height,\n width,\n format\n ], this._shape_format)) {\n this._shape_format = [\n height,\n width,\n format\n ];\n this.activate();\n this._gl.texImage2D(this._target, 0, format, width, height, 0, format, this._gl.UNSIGNED_BYTE, null);\n }\n this.u_shape = [\n height,\n width\n ];\n return null;\n};\nTexture2D.prototype.set_data = function (offset, shape, data) {\n var _, alignment, err_3, format, gtype, height, stub16_, stub17_, width, x, y;\n // Set the 2D texture data.\n //\n // Parameters\n // ----------\n // offset : tuple of ints\n // Offset in pixels for each dimension.\n // shape : tuple of ints\n // The shape of the data to upload\n // data : typed array\n // The actual pixel data. Can be of any type, but on the GPU the\n // dat is stored in 8 bit precision.\n if (_pyfunc_equals(shape.length, 2)) {\n shape = [\n shape[0],\n shape[1],\n 1\n ];\n }\n this.activate();\n format = this._shape_format[2];\n stub16_ = shape;\n height = stub16_[0];\n width = stub16_[1];\n _ = stub16_[2];\n stub17_ = offset;\n y = stub17_[0];\n x = stub17_[1];\n gtype = _pymeth_get.call(this._types, data.constructor.name, null);\n if (gtype === null) {\n err_3 = new Error('ValueError:' + ('Type ' + data.constructor.name + ' not allowed for texture'));\n err_3.name = 'ValueError';\n throw err_3;\n }\n alignment = this._get_alignment(_pyfunc_mult(shape[shape.length - 2], shape[shape.length - 1]));\n if (!_pyfunc_equals(alignment, 4)) {\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, alignment);\n }\n this._gl.texSubImage2D(this._target, 0, x, y, width, height, format, gtype, data);\n if (!_pyfunc_equals(alignment, 4)) {\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 4);\n }\n return null;\n};\nTexture3DLike = function () {\n // A 2D texture with support to simulate a 3D texture.\n //\n // To use this class, use set_size() and set_data() as if it was a 3D\n // texture. Add the GLSL_SAMPLE_NEAREST or GLSL_SAMPLE_LINEAR to the\n // shader to add the sample3D() function that can be used instead of\n // texture2D(). This function needs ``shape`` and ``tiles`` arguments\n // which can be set via uniforms, using the ``u_shape`` and ``u_tiles``\n // attributes of this object.\n _pyfunc_instantiate(this, arguments);\n};\nTexture3DLike.prototype = Object.create(Texture2D.prototype);\nTexture3DLike.prototype._base_class = Texture2D.prototype;\nTexture3DLike.prototype._class_name = 'Texture3DLike';\nTexture3DLike.prototype.GLSL_SAMPLE_NEAREST = '\\n vec4 sample3D(sampler2D tex, vec3 texcoord, vec3 shape, vec2 tiles) {\\n shape.xyz = shape.zyx; // silly row-major convention\\n float nrows = tiles.y, ncols = tiles.x;\\n // Don\\'t let adjacent frames be interpolated into this one\\n texcoord.x = min(texcoord.x * shape.x, shape.x - 0.5);\\n texcoord.x = max(0.5, texcoord.x) / shape.x;\\n texcoord.y = min(texcoord.y * shape.y, shape.y - 0.5);\\n texcoord.y = max(0.5, texcoord.y) / shape.y;\\n\\n float zindex = floor(texcoord.z * shape.z);\\n\\n // Do a lookup in the 2D texture\\n float u = (mod(zindex, ncols) + texcoord.x) / ncols;\\n float v = (floor(zindex / ncols) + texcoord.y) / nrows;\\n\\n return texture2D(tex, vec2(u,v));\\n }\\n ';\nTexture3DLike.prototype.GLSL_SAMPLE_LINEAR = '\\n vec4 sample3D(sampler2D tex, vec3 texcoord, vec3 shape, vec2 tiles) {\\n shape.xyz = shape.zyx; // silly row-major convention\\n float nrows = tiles.y, ncols = tiles.x;\\n // Don\\'t let adjacent frames be interpolated into this one\\n texcoord.x = min(texcoord.x * shape.x, shape.x - 0.5);\\n texcoord.x = max(0.5, texcoord.x) / shape.x;\\n texcoord.y = min(texcoord.y * shape.y, shape.y - 0.5);\\n texcoord.y = max(0.5, texcoord.y) / shape.y;\\n\\n float z = texcoord.z * shape.z;\\n float zindex1 = floor(z);\\n float u1 = (mod(zindex1, ncols) + texcoord.x) / ncols;\\n float v1 = (floor(zindex1 / ncols) + texcoord.y) / nrows;\\n\\n float zindex2 = zindex1 + 1.0;\\n float u2 = (mod(zindex2, ncols) + texcoord.x) / ncols;\\n float v2 = (floor(zindex2 / ncols) + texcoord.y) / nrows;\\n\\n vec4 s1 = texture2D(tex, vec2(u1, v1));\\n vec4 s2 = texture2D(tex, vec2(u2, v2));\\n\\n return s1 * (zindex2 - z) + s2 * (z - zindex1);\\n }\\n ';\nTexture3DLike.prototype._get_tile_info = function (shape) {\n var err_3, max_size, ncols, nrows;\n max_size = this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE);\n nrows = Math.floor(max_size / shape[1]);\n nrows = Math.min(nrows, shape[0]);\n ncols = window.Math.ceil(shape[0] / nrows);\n if (_pyfunc_truthy(_pyfunc_mult(ncols, shape[2]) > max_size)) {\n err_3 = new Error('RuntimeError:' + ('Cannot fit 3D data with shape ' + shape + ' onto simulated 2D texture.'));\n err_3.name = 'RuntimeError';\n throw err_3;\n }\n return [\n nrows,\n ncols\n ];\n};\nTexture3DLike.prototype.set_size = function (shape, format) {\n var ncols, nrows, sim_shape, stub18_;\n // Set the size of the 3D texture.\n //\n // Parameters\n // ----------\n // shape : tuple of ints\n // The shape of the data to upload\n // format : GL enum\n // The format of the texture data. Can be LUMINANCE, LUMINANCE_ALPHA,\n // RGB, and RGBA.\n stub18_ = this._get_tile_info(shape);\n nrows = stub18_[0];\n ncols = stub18_[1];\n sim_shape = [\n _pyfunc_mult(shape[1], nrows),\n _pyfunc_mult(shape[2], ncols)\n ];\n Texture3DLike.prototype._base_class.set_size.call(this, sim_shape, format);\n this.u_shape = [\n shape[0],\n shape[1],\n shape[2]\n ];\n this.u_tiles = [\n ncols,\n nrows\n ];\n return null;\n};\nTexture3DLike.prototype.set_data = function (offset, shape, data) {\n var Type, col, elements_per_tile, err_3, ncols, nrows, row, sim_shape, stub19_, stub20_, tile, z, zeros;\n // Set the 3D texture data.\n //\n // Parameters\n // ----------\n // offset : tuple of ints\n // Offset in pixels for each dimension.\n // shape : tuple of ints\n // The shape of the data to upload\n // data : typed array\n // The actual pixel data. Can be of any type, but on the GPU the\n // dat is stored in 8 bit precision.\n if (_pyfunc_equals(shape.length, 3)) {\n shape = [\n shape[0],\n shape[1],\n shape[2],\n 1\n ];\n }\n if (!_pyfunc_all(function list_comprehenson() {\n var res = [];\n var i, iter0, i0;\n iter0 = offset;\n if (typeof iter0 === 'object' && !Array.isArray(iter0)) {\n iter0 = Object.keys(iter0);\n }\n for (i0 = 0; i0 < iter0.length; i0++) {\n i = iter0[i0];\n {\n res.push(_pyfunc_equals(i, 0));\n }\n }\n return res;\n }.apply(this))) {\n err_3 = new Error('ValueError:' + 'Texture3DLike does not support nonzero offset (for now)');\n err_3.name = 'ValueError';\n throw err_3;\n }\n stub19_ = this._get_tile_info(shape);\n nrows = stub19_[0];\n ncols = stub19_[1];\n sim_shape = [\n _pyfunc_mult(shape[1], nrows),\n _pyfunc_mult(shape[2], ncols),\n shape[3]\n ];\n if (_pyfunc_equals(ncols, 1)) {\n Texture3DLike.prototype._base_class.set_data.call(this, [\n 0,\n 0\n ], sim_shape, data);\n } else {\n Type = data.constructor;\n zeros = new Type(_pyfunc_mult(_pyfunc_mult(sim_shape[0], sim_shape[1]), sim_shape[2]));\n Texture3DLike.prototype._base_class.set_data.call(this, [\n 0,\n 0\n ], sim_shape, zeros);\n for (z = 0; z < shape[0]; z += 1) {\n stub20_ = [\n Math.floor(z / ncols),\n z % ncols\n ];\n row = stub20_[0];\n col = stub20_[1];\n elements_per_tile = Math.floor(data.length / shape[0]);\n tile = data.slice(_pyfunc_mult(z, elements_per_tile), _pyfunc_mult(z + 1, elements_per_tile));\n Texture3DLike.prototype._base_class.set_data.call(this, [\n _pyfunc_mult(row, shape[1]),\n _pyfunc_mult(col, shape[2])\n ], shape.slice(1), tile);\n }\n }\n return null;\n};\nmodule.exports = {\n 'Buffer': Buffer,\n 'GlooObject': GlooObject,\n 'IndexBuffer': IndexBuffer,\n 'Program': Program,\n 'Texture2D': Texture2D,\n 'Texture3DLike': Texture3DLike,\n 'VertexBuffer': VertexBuffer,\n 'check_error': check_error,\n 'console': console\n}; \n","'use strict';\n/*\nCopyright notice: many of the awesome techniques and GLSL code contained in\nthis module are based on work by Nicolas Rougier as part of the Glumpy and\nVispy projects. The algorithms are published in\nhttp://jcgt.org/published/0003/04/01/ and http://jcgt.org/published/0002/02/08/\n\nThis module contains all gl-specific code to add gl support for the glyphs.\nBy implementing it separetely, the GL functionality can be spun off in a\nseparate library.\nOther locations where we work with GL, or prepare for GL-rendering:\n- canvas.coffee\n- plot.coffee\n- glyph.coffee\n- glyph_renderer.coffee\n*/\nObject.defineProperty(exports, '__esModule', { value: true });\nvar tslib_1 = require(361 /* tslib */);\ntslib_1.__exportStar(require(423 /* ./line */), exports);\ntslib_1.__exportStar(require(425 /* ./markers */), exports); \n","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar DashAtlas, extend = function (child, parent) {\n for (var key in parent) {\n if (hasProp.call(parent, key))\n child[key] = parent[key];\n }\n function ctor() {\n this.constructor = child;\n }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n child.__super__ = parent.prototype;\n return child;\n }, hasProp = {}.hasOwnProperty;\nvar gloo2_1 = require(421 /* ./gloo2 */);\nvar base_1 = require(420 /* ./base */);\nvar color_1 = require(25 /* core/util/color */);\nDashAtlas = function () {\n function DashAtlas(gl) {\n this._atlas = {};\n this._index = 0;\n this._width = 256;\n this._height = 256;\n this.tex = new gloo2_1.Texture2D(gl);\n this.tex.set_wrapping(gl.REPEAT, gl.REPEAT);\n this.tex.set_interpolation(gl.NEAREST, gl.NEAREST);\n this.tex.set_size([\n this._height,\n this._width\n ], gl.RGBA);\n this.tex.set_data([\n 0,\n 0\n ], [\n this._height,\n this._width\n ], new Uint8Array(this._height * this._width * 4));\n this.get_atlas_data([1]);\n }\n DashAtlas.prototype.get_atlas_data = function (pattern) {\n var data, findex_period, key, period, ref, x;\n key = pattern.join('-');\n findex_period = this._atlas[key];\n if (findex_period === void 0) {\n ref = this.make_pattern(pattern), data = ref[0], period = ref[1];\n this.tex.set_data([\n this._index,\n 0\n ], [\n 1,\n this._width\n ], new Uint8Array(function () {\n var l, len, results;\n results = [];\n for (l = 0, len = data.length; l < len; l++) {\n x = data[l];\n results.push(x + 10);\n }\n return results;\n }()));\n this._atlas[key] = [\n this._index / this._height,\n period\n ];\n this._index += 1;\n }\n return this._atlas[key];\n };\n DashAtlas.prototype.make_pattern = function (pattern) {\n var C, Z, a, b, c, dash_end, dash_start, dash_type, i, index, j, l, len, n, p, period, q, r, ref, ref1, ref2, v, val, val_at_index, x;\n if (pattern.length > 1 && pattern.length % 2) {\n pattern = pattern.concat(pattern);\n }\n period = 0;\n for (l = 0, len = pattern.length; l < len; l++) {\n v = pattern[l];\n period += v;\n }\n C = [];\n c = 0;\n for (i = p = 0, ref = pattern.length + 2; p < ref; i = p += 2) {\n a = Math.max(0.0001, pattern[i % pattern.length]);\n b = Math.max(0.0001, pattern[(i + 1) % pattern.length]);\n C.push.apply(C, [\n c,\n c + a\n ]);\n c += a + b;\n }\n n = this._width;\n Z = new Float32Array(n * 4);\n for (i = q = 0, ref1 = n; 0 <= ref1 ? q < ref1 : q > ref1; i = 0 <= ref1 ? ++q : --q) {\n x = period * i / (n - 1);\n index = 0;\n val_at_index = 10000000000000000;\n for (j = r = 0, ref2 = C.length; 0 <= ref2 ? r < ref2 : r > ref2; j = 0 <= ref2 ? ++r : --r) {\n val = Math.abs(C[j] - x);\n if (val < val_at_index) {\n index = j;\n val_at_index = val;\n }\n }\n if (index % 2 === 0) {\n dash_type = x <= C[index] ? +1 : 0;\n dash_start = C[index];\n dash_end = C[index + 1];\n } else {\n dash_type = x > C[index] ? -1 : 0;\n dash_start = C[index - 1];\n dash_end = C[index];\n }\n Z[i * 4 + 0] = C[index];\n Z[i * 4 + 1] = dash_type;\n Z[i * 4 + 2] = dash_start;\n Z[i * 4 + 3] = dash_end;\n }\n return [\n Z,\n period\n ];\n };\n return DashAtlas;\n}();\nexports.LineGLGlyph = function (superClass) {\n extend(LineGLGlyph, superClass);\n function LineGLGlyph() {\n return LineGLGlyph.__super__.constructor.apply(this, arguments);\n }\n LineGLGlyph.prototype.GLYPH = 'line';\n LineGLGlyph.prototype.JOINS = {\n 'miter': 0,\n 'round': 1,\n 'bevel': 2\n };\n LineGLGlyph.prototype.CAPS = {\n '': 0,\n 'none': 0,\n '.': 0,\n 'round': 1,\n ')': 1,\n '(': 1,\n 'o': 1,\n 'triangle in': 2,\n '<': 2,\n 'triangle out': 3,\n '>': 3,\n 'square': 4,\n '[': 4,\n ']': 4,\n '=': 4,\n 'butt': 5,\n '|': 5\n };\n LineGLGlyph.prototype.VERT = 'precision mediump float;\\n\\nconst float PI = 3.14159265358979323846264;\\nconst float THETA = 15.0 * 3.14159265358979323846264/180.0;\\n\\nuniform float u_pixel_ratio;\\nuniform vec2 u_canvas_size, u_offset;\\nuniform vec2 u_scale_aspect;\\nuniform float u_scale_length;\\n\\nuniform vec4 u_color;\\nuniform float u_antialias;\\nuniform float u_length;\\nuniform float u_linewidth;\\nuniform float u_dash_index;\\nuniform float u_closed;\\n\\nattribute vec2 a_position;\\nattribute vec4 a_tangents;\\nattribute vec2 a_segment;\\nattribute vec2 a_angles;\\nattribute vec2 a_texcoord;\\n\\nvarying vec4 v_color;\\nvarying vec2 v_segment;\\nvarying vec2 v_angles;\\nvarying vec2 v_texcoord;\\nvarying vec2 v_miter;\\nvarying float v_length;\\nvarying float v_linewidth;\\n\\nfloat cross(in vec2 v1, in vec2 v2)\\n{\\n return v1.x*v2.y - v1.y*v2.x;\\n}\\n\\nfloat signed_distance(in vec2 v1, in vec2 v2, in vec2 v3)\\n{\\n return cross(v2-v1,v1-v3) / length(v2-v1);\\n}\\n\\nvoid rotate( in vec2 v, in float alpha, out vec2 result )\\n{\\n float c = cos(alpha);\\n float s = sin(alpha);\\n result = vec2( c*v.x - s*v.y,\\n s*v.x + c*v.y );\\n}\\n\\nvoid main()\\n{\\n bool closed = (u_closed > 0.0);\\n\\n // Attributes and uniforms to varyings\\n v_color = u_color;\\n v_linewidth = u_linewidth;\\n v_segment = a_segment * u_scale_length;\\n v_length = u_length * u_scale_length;\\n\\n // Scale to map to pixel coordinates. The original algorithm from the paper\\n // assumed isotropic scale. We obviously do not have this.\\n vec2 abs_scale_aspect = abs(u_scale_aspect);\\n vec2 abs_scale = u_scale_length * abs_scale_aspect;\\n\\n // Correct angles for aspect ratio\\n vec2 av;\\n av = vec2(1.0, tan(a_angles.x)) / abs_scale_aspect;\\n v_angles.x = atan(av.y, av.x);\\n av = vec2(1.0, tan(a_angles.y)) / abs_scale_aspect;\\n v_angles.y = atan(av.y, av.x);\\n\\n // Thickness below 1 pixel are represented using a 1 pixel thickness\\n // and a modified alpha\\n v_color.a = min(v_linewidth, v_color.a);\\n v_linewidth = max(v_linewidth, 1.0);\\n\\n // If color is fully transparent we just will discard the fragment anyway\\n if( v_color.a <= 0.0 ) {\\n gl_Position = vec4(0.0,0.0,0.0,1.0);\\n return;\\n }\\n\\n // This is the actual half width of the line\\n float w = ceil(u_antialias+v_linewidth)/2.0;\\n\\n vec2 position = (a_position + u_offset) * abs_scale;\\n\\n vec2 t1 = normalize(a_tangents.xy * abs_scale_aspect); // note the scaling for aspect ratio here\\n vec2 t2 = normalize(a_tangents.zw * abs_scale_aspect);\\n float u = a_texcoord.x;\\n float v = a_texcoord.y;\\n vec2 o1 = vec2( +t1.y, -t1.x);\\n vec2 o2 = vec2( +t2.y, -t2.x);\\n\\n // This is a join\\n // ----------------------------------------------------------------\\n if( t1 != t2 ) {\\n float angle = atan (t1.x*t2.y-t1.y*t2.x, t1.x*t2.x+t1.y*t2.y); // Angle needs recalculation for some reason\\n vec2 t = normalize(t1+t2);\\n vec2 o = vec2( + t.y, - t.x);\\n\\n if ( u_dash_index > 0.0 )\\n {\\n // Broken angle\\n // ----------------------------------------------------------------\\n if( (abs(angle) > THETA) ) {\\n position += v * w * o / cos(angle/2.0);\\n float s = sign(angle);\\n if( angle < 0.0 ) {\\n if( u == +1.0 ) {\\n u = v_segment.y + v * w * tan(angle/2.0);\\n if( v == 1.0 ) {\\n position -= 2.0 * w * t1 / sin(angle);\\n u -= 2.0 * w / sin(angle);\\n }\\n } else {\\n u = v_segment.x - v * w * tan(angle/2.0);\\n if( v == 1.0 ) {\\n position += 2.0 * w * t2 / sin(angle);\\n u += 2.0*w / sin(angle);\\n }\\n }\\n } else {\\n if( u == +1.0 ) {\\n u = v_segment.y + v * w * tan(angle/2.0);\\n if( v == -1.0 ) {\\n position += 2.0 * w * t1 / sin(angle);\\n u += 2.0 * w / sin(angle);\\n }\\n } else {\\n u = v_segment.x - v * w * tan(angle/2.0);\\n if( v == -1.0 ) {\\n position -= 2.0 * w * t2 / sin(angle);\\n u -= 2.0*w / sin(angle);\\n }\\n }\\n }\\n // Continuous angle\\n // ------------------------------------------------------------\\n } else {\\n position += v * w * o / cos(angle/2.0);\\n if( u == +1.0 ) u = v_segment.y;\\n else u = v_segment.x;\\n }\\n }\\n\\n // Solid line\\n // --------------------------------------------------------------------\\n else\\n {\\n position.xy += v * w * o / cos(angle/2.0);\\n if( angle < 0.0 ) {\\n if( u == +1.0 ) {\\n u = v_segment.y + v * w * tan(angle/2.0);\\n } else {\\n u = v_segment.x - v * w * tan(angle/2.0);\\n }\\n } else {\\n if( u == +1.0 ) {\\n u = v_segment.y + v * w * tan(angle/2.0);\\n } else {\\n u = v_segment.x - v * w * tan(angle/2.0);\\n }\\n }\\n }\\n\\n // This is a line start or end (t1 == t2)\\n // ------------------------------------------------------------------------\\n } else {\\n position += v * w * o1;\\n if( u == -1.0 ) {\\n u = v_segment.x - w;\\n position -= w * t1;\\n } else {\\n u = v_segment.y + w;\\n position += w * t2;\\n }\\n }\\n\\n // Miter distance\\n // ------------------------------------------------------------------------\\n vec2 t;\\n vec2 curr = a_position * abs_scale;\\n if( a_texcoord.x < 0.0 ) {\\n vec2 next = curr + t2*(v_segment.y-v_segment.x);\\n\\n rotate( t1, +v_angles.x/2.0, t);\\n v_miter.x = signed_distance(curr, curr+t, position);\\n\\n rotate( t2, +v_angles.y/2.0, t);\\n v_miter.y = signed_distance(next, next+t, position);\\n } else {\\n vec2 prev = curr - t1*(v_segment.y-v_segment.x);\\n\\n rotate( t1, -v_angles.x/2.0,t);\\n v_miter.x = signed_distance(prev, prev+t, position);\\n\\n rotate( t2, -v_angles.y/2.0,t);\\n v_miter.y = signed_distance(curr, curr+t, position);\\n }\\n\\n if (!closed && v_segment.x <= 0.0) {\\n v_miter.x = 1e10;\\n }\\n if (!closed && v_segment.y >= v_length)\\n {\\n v_miter.y = 1e10;\\n }\\n\\n v_texcoord = vec2( u, v*w );\\n\\n // Calculate position in device coordinates. Note that we\\n // already scaled with abs scale above.\\n vec2 normpos = position * sign(u_scale_aspect);\\n normpos += 0.5; // make up for Bokeh\\'s offset\\n normpos /= u_canvas_size / u_pixel_ratio; // in 0..1\\n gl_Position = vec4(normpos*2.0-1.0, 0.0, 1.0);\\n gl_Position.y *= -1.0;\\n}\\n';\n LineGLGlyph.prototype.FRAG_ = '// Fragment shader that can be convenient during debugging to show the line skeleton.\\nprecision mediump float;\\nuniform vec4 u_color;\\nvoid main () {\\n gl_FragColor = u_color;\\n}';\n LineGLGlyph.prototype.FRAG = 'precision mediump float;\\n\\nconst float PI = 3.14159265358979323846264;\\nconst float THETA = 15.0 * 3.14159265358979323846264/180.0;\\n\\nuniform sampler2D u_dash_atlas;\\n\\nuniform vec2 u_linecaps;\\nuniform float u_miter_limit;\\nuniform float u_linejoin;\\nuniform float u_antialias;\\nuniform float u_dash_phase;\\nuniform float u_dash_period;\\nuniform float u_dash_index;\\nuniform vec2 u_dash_caps;\\nuniform float u_closed;\\n\\nvarying vec4 v_color;\\nvarying vec2 v_segment;\\nvarying vec2 v_angles;\\nvarying vec2 v_texcoord;\\nvarying vec2 v_miter;\\nvarying float v_length;\\nvarying float v_linewidth;\\n\\n// Compute distance to cap ----------------------------------------------------\\nfloat cap( int type, float dx, float dy, float t, float linewidth )\\n{\\n float d = 0.0;\\n dx = abs(dx);\\n dy = abs(dy);\\n if (type == 0) discard; // None\\n else if (type == 1) d = sqrt(dx*dx+dy*dy); // Round\\n else if (type == 3) d = (dx+abs(dy)); // Triangle in\\n else if (type == 2) d = max(abs(dy),(t+dx-abs(dy))); // Triangle out\\n else if (type == 4) d = max(dx,dy); // Square\\n else if (type == 5) d = max(dx+t,dy); // Butt\\n return d;\\n}\\n\\n// Compute distance to join -------------------------------------------------\\nfloat join( in int type, in float d, in vec2 segment, in vec2 texcoord, in vec2 miter,\\n in float linewidth )\\n{\\n // texcoord.x is distance from start\\n // texcoord.y is distance from centerline\\n // segment.x and y indicate the limits (as for texcoord.x) for this segment\\n\\n float dx = texcoord.x;\\n\\n // Round join\\n if( type == 1 ) {\\n if (dx < segment.x) {\\n d = max(d,length( texcoord - vec2(segment.x,0.0)));\\n //d = length( texcoord - vec2(segment.x,0.0));\\n } else if (dx > segment.y) {\\n d = max(d,length( texcoord - vec2(segment.y,0.0)));\\n //d = length( texcoord - vec2(segment.y,0.0));\\n }\\n }\\n // Bevel join\\n else if ( type == 2 ) {\\n if (dx < segment.x) {\\n vec2 x = texcoord - vec2(segment.x,0.0);\\n d = max(d, max(abs(x.x), abs(x.y)));\\n\\n } else if (dx > segment.y) {\\n vec2 x = texcoord - vec2(segment.y,0.0);\\n d = max(d, max(abs(x.x), abs(x.y)));\\n }\\n /* Original code for bevel which does not work for us\\n if( (dx < segment.x) || (dx > segment.y) )\\n d = max(d, min(abs(x.x),abs(x.y)));\\n */\\n }\\n\\n return d;\\n}\\n\\nvoid main()\\n{\\n // If color is fully transparent we just discard the fragment\\n if( v_color.a <= 0.0 ) {\\n discard;\\n }\\n\\n // Test if dash pattern is the solid one (0)\\n bool solid = (u_dash_index == 0.0);\\n\\n // Test if path is closed\\n bool closed = (u_closed > 0.0);\\n\\n vec4 color = v_color;\\n float dx = v_texcoord.x;\\n float dy = v_texcoord.y;\\n float t = v_linewidth/2.0-u_antialias;\\n float width = 1.0; //v_linewidth; original code had dashes scale with line width, we do not\\n float d = 0.0;\\n\\n vec2 linecaps = u_linecaps;\\n vec2 dash_caps = u_dash_caps;\\n float line_start = 0.0;\\n float line_stop = v_length;\\n\\n // Apply miter limit; fragments too far into the miter are simply discarded\\n if( (dx < v_segment.x) || (dx > v_segment.y) ) {\\n float into_miter = max(v_segment.x - dx, dx - v_segment.y);\\n if (into_miter > u_miter_limit*v_linewidth/2.0)\\n discard;\\n }\\n\\n // Solid line --------------------------------------------------------------\\n if( solid ) {\\n d = abs(dy);\\n if( (!closed) && (dx < line_start) ) {\\n d = cap( int(u_linecaps.x), abs(dx), abs(dy), t, v_linewidth );\\n }\\n else if( (!closed) && (dx > line_stop) ) {\\n d = cap( int(u_linecaps.y), abs(dx)-line_stop, abs(dy), t, v_linewidth );\\n }\\n else {\\n d = join( int(u_linejoin), abs(dy), v_segment, v_texcoord, v_miter, v_linewidth );\\n }\\n\\n // Dash line --------------------------------------------------------------\\n } else {\\n float segment_start = v_segment.x;\\n float segment_stop = v_segment.y;\\n float segment_center= (segment_start+segment_stop)/2.0;\\n float freq = u_dash_period*width;\\n float u = mod( dx + u_dash_phase*width, freq);\\n vec4 tex = texture2D(u_dash_atlas, vec2(u/freq, u_dash_index)) * 255.0 -10.0; // conversion to int-like\\n float dash_center= tex.x * width;\\n float dash_type = tex.y;\\n float _start = tex.z * width;\\n float _stop = tex.a * width;\\n float dash_start = dx - u + _start;\\n float dash_stop = dx - u + _stop;\\n\\n // Compute extents of the first dash (the one relative to v_segment.x)\\n // Note: this could be computed in the vertex shader\\n if( (dash_stop < segment_start) && (dash_caps.x != 5.0) ) {\\n float u = mod(segment_start + u_dash_phase*width, freq);\\n vec4 tex = texture2D(u_dash_atlas, vec2(u/freq, u_dash_index)) * 255.0 -10.0; // conversion to int-like\\n dash_center= tex.x * width;\\n //dash_type = tex.y;\\n float _start = tex.z * width;\\n float _stop = tex.a * width;\\n dash_start = segment_start - u + _start;\\n dash_stop = segment_start - u + _stop;\\n }\\n\\n // Compute extents of the last dash (the one relatives to v_segment.y)\\n // Note: This could be computed in the vertex shader\\n else if( (dash_start > segment_stop) && (dash_caps.y != 5.0) ) {\\n float u = mod(segment_stop + u_dash_phase*width, freq);\\n vec4 tex = texture2D(u_dash_atlas, vec2(u/freq, u_dash_index)) * 255.0 -10.0; // conversion to int-like\\n dash_center= tex.x * width;\\n //dash_type = tex.y;\\n float _start = tex.z * width;\\n float _stop = tex.a * width;\\n dash_start = segment_stop - u + _start;\\n dash_stop = segment_stop - u + _stop;\\n }\\n\\n // This test if the we are dealing with a discontinuous angle\\n bool discontinuous = ((dx < segment_center) && abs(v_angles.x) > THETA) ||\\n ((dx >= segment_center) && abs(v_angles.y) > THETA);\\n //if( dx < line_start) discontinuous = false;\\n //if( dx > line_stop) discontinuous = false;\\n\\n float d_join = join( int(u_linejoin), abs(dy),\\n v_segment, v_texcoord, v_miter, v_linewidth );\\n\\n // When path is closed, we do not have room for linecaps, so we make room\\n // by shortening the total length\\n if (closed) {\\n line_start += v_linewidth/2.0;\\n line_stop -= v_linewidth/2.0;\\n }\\n\\n // We also need to take antialias area into account\\n //line_start += u_antialias;\\n //line_stop -= u_antialias;\\n\\n // Check is dash stop is before line start\\n if( dash_stop <= line_start ) {\\n discard;\\n }\\n // Check is dash start is beyond line stop\\n if( dash_start >= line_stop ) {\\n discard;\\n }\\n\\n // Check if current dash start is beyond segment stop\\n if( discontinuous ) {\\n // Dash start is beyond segment, we discard\\n if( (dash_start > segment_stop) ) {\\n discard;\\n //gl_FragColor = vec4(1.0,0.0,0.0,.25); return;\\n }\\n\\n // Dash stop is before segment, we discard\\n if( (dash_stop < segment_start) ) {\\n discard; //gl_FragColor = vec4(0.0,1.0,0.0,.25); return;\\n }\\n\\n // Special case for round caps (nicer with this)\\n if( dash_caps.x == 1.0 ) {\\n if( (u > _stop) && (dash_stop > segment_stop ) && (abs(v_angles.y) < PI/2.0)) {\\n discard;\\n }\\n }\\n\\n // Special case for round caps (nicer with this)\\n if( dash_caps.y == 1.0 ) {\\n if( (u < _start) && (dash_start < segment_start ) && (abs(v_angles.x) < PI/2.0)) {\\n discard;\\n }\\n }\\n\\n // Special case for triangle caps (in & out) and square\\n // We make sure the cap stop at crossing frontier\\n if( (dash_caps.x != 1.0) && (dash_caps.x != 5.0) ) {\\n if( (dash_start < segment_start ) && (abs(v_angles.x) < PI/2.0) ) {\\n float a = v_angles.x/2.0;\\n float x = (segment_start-dx)*cos(a) - dy*sin(a);\\n float y = (segment_start-dx)*sin(a) + dy*cos(a);\\n if( x > 0.0 ) discard;\\n // We transform the cap into square to avoid holes\\n dash_caps.x = 4.0;\\n }\\n }\\n\\n // Special case for triangle caps (in & out) and square\\n // We make sure the cap stop at crossing frontier\\n if( (dash_caps.y != 1.0) && (dash_caps.y != 5.0) ) {\\n if( (dash_stop > segment_stop ) && (abs(v_angles.y) < PI/2.0) ) {\\n float a = v_angles.y/2.0;\\n float x = (dx-segment_stop)*cos(a) - dy*sin(a);\\n float y = (dx-segment_stop)*sin(a) + dy*cos(a);\\n if( x > 0.0 ) discard;\\n // We transform the caps into square to avoid holes\\n dash_caps.y = 4.0;\\n }\\n }\\n }\\n\\n // Line cap at start\\n if( (dx < line_start) && (dash_start < line_start) && (dash_stop > line_start) ) {\\n d = cap( int(linecaps.x), dx-line_start, dy, t, v_linewidth);\\n }\\n // Line cap at stop\\n else if( (dx > line_stop) && (dash_stop > line_stop) && (dash_start < line_stop) ) {\\n d = cap( int(linecaps.y), dx-line_stop, dy, t, v_linewidth);\\n }\\n // Dash cap left - dash_type = -1, 0 or 1, but there may be roundoff errors\\n else if( dash_type < -0.5 ) {\\n d = cap( int(dash_caps.y), abs(u-dash_center), dy, t, v_linewidth);\\n if( (dx > line_start) && (dx < line_stop) )\\n d = max(d,d_join);\\n }\\n // Dash cap right\\n else if( dash_type > 0.5 ) {\\n d = cap( int(dash_caps.x), abs(dash_center-u), dy, t, v_linewidth);\\n if( (dx > line_start) && (dx < line_stop) )\\n d = max(d,d_join);\\n }\\n // Dash body (plain)\\n else {// if( dash_type > -0.5 && dash_type < 0.5) {\\n d = abs(dy);\\n }\\n\\n // Line join\\n if( (dx > line_start) && (dx < line_stop)) {\\n if( (dx <= segment_start) && (dash_start <= segment_start)\\n && (dash_stop >= segment_start) ) {\\n d = d_join;\\n // Antialias at outer border\\n float angle = PI/2.+v_angles.x;\\n float f = abs( (segment_start - dx)*cos(angle) - dy*sin(angle));\\n d = max(f,d);\\n }\\n else if( (dx > segment_stop) && (dash_start <= segment_stop)\\n && (dash_stop >= segment_stop) ) {\\n d = d_join;\\n // Antialias at outer border\\n float angle = PI/2.+v_angles.y;\\n float f = abs((dx - segment_stop)*cos(angle) - dy*sin(angle));\\n d = max(f,d);\\n }\\n else if( dx < (segment_start - v_linewidth/2.)) {\\n discard;\\n }\\n else if( dx > (segment_stop + v_linewidth/2.)) {\\n discard;\\n }\\n }\\n else if( dx < (segment_start - v_linewidth/2.)) {\\n discard;\\n }\\n else if( dx > (segment_stop + v_linewidth/2.)) {\\n discard;\\n }\\n }\\n\\n // Distance to border ------------------------------------------------------\\n d = d - t;\\n if( d < 0.0 ) {\\n gl_FragColor = color;\\n } else {\\n d /= u_antialias;\\n gl_FragColor = vec4(color.rgb, exp(-d*d)*color.a);\\n }\\n}';\n LineGLGlyph.prototype.init = function () {\n var gl;\n gl = this.gl;\n this._scale_aspect = 0;\n this.prog = new gloo2_1.Program(gl);\n this.prog.set_shaders(this.VERT, this.FRAG);\n this.index_buffer = new gloo2_1.IndexBuffer(gl);\n this.vbo_position = new gloo2_1.VertexBuffer(gl);\n this.vbo_tangents = new gloo2_1.VertexBuffer(gl);\n this.vbo_segment = new gloo2_1.VertexBuffer(gl);\n this.vbo_angles = new gloo2_1.VertexBuffer(gl);\n this.vbo_texcoord = new gloo2_1.VertexBuffer(gl);\n return this.dash_atlas = new DashAtlas(gl);\n };\n LineGLGlyph.prototype.draw = function (indices, mainGlyph, trans) {\n var baked_offset, chunk, chunks, chunksize, i, l, mainGlGlyph, nvertices, offset, p, q, ref, ref1, ref2, results, scale_length, sx, sy, these_indices, uint16_index;\n mainGlGlyph = mainGlyph.glglyph;\n if (mainGlGlyph.data_changed) {\n if (!(isFinite(trans.dx) && isFinite(trans.dy))) {\n return;\n }\n mainGlGlyph._baked_offset = [\n trans.dx,\n trans.dy\n ];\n mainGlGlyph._set_data();\n mainGlGlyph.data_changed = false;\n }\n if (this.visuals_changed) {\n this._set_visuals();\n this.visuals_changed = false;\n }\n sx = trans.sx;\n sy = trans.sy;\n scale_length = Math.sqrt(sx * sx + sy * sy);\n sx /= scale_length;\n sy /= scale_length;\n if (Math.abs(this._scale_aspect - sy / sx) > Math.abs(0.001 * this._scale_aspect)) {\n mainGlGlyph._update_scale(sx, sy);\n this._scale_aspect = sy / sx;\n }\n this.prog.set_attribute('a_position', 'vec2', mainGlGlyph.vbo_position);\n this.prog.set_attribute('a_tangents', 'vec4', mainGlGlyph.vbo_tangents);\n this.prog.set_attribute('a_segment', 'vec2', mainGlGlyph.vbo_segment);\n this.prog.set_attribute('a_angles', 'vec2', mainGlGlyph.vbo_angles);\n this.prog.set_attribute('a_texcoord', 'vec2', mainGlGlyph.vbo_texcoord);\n this.prog.set_uniform('u_length', 'float', [mainGlGlyph.cumsum]);\n this.prog.set_texture('u_dash_atlas', this.dash_atlas.tex);\n baked_offset = mainGlGlyph._baked_offset;\n this.prog.set_uniform('u_pixel_ratio', 'float', [trans.pixel_ratio]);\n this.prog.set_uniform('u_canvas_size', 'vec2', [\n trans.width,\n trans.height\n ]);\n this.prog.set_uniform('u_offset', 'vec2', [\n trans.dx - baked_offset[0],\n trans.dy - baked_offset[1]\n ]);\n this.prog.set_uniform('u_scale_aspect', 'vec2', [\n sx,\n sy\n ]);\n this.prog.set_uniform('u_scale_length', 'float', [scale_length]);\n this.I_triangles = mainGlGlyph.I_triangles;\n if (this.I_triangles.length < 65535) {\n this.index_buffer.set_size(this.I_triangles.length * 2);\n this.index_buffer.set_data(0, new Uint16Array(this.I_triangles));\n return this.prog.draw(this.gl.TRIANGLES, this.index_buffer);\n } else {\n indices = this.I_triangles;\n nvertices = this.I_triangles.length;\n chunksize = 64008;\n chunks = [];\n for (i = l = 0, ref = Math.ceil(nvertices / chunksize); 0 <= ref ? l < ref : l > ref; i = 0 <= ref ? ++l : --l) {\n chunks.push([]);\n }\n for (i = p = 0, ref1 = indices.length; 0 <= ref1 ? p < ref1 : p > ref1; i = 0 <= ref1 ? ++p : --p) {\n uint16_index = indices[i] % chunksize;\n chunk = Math.floor(indices[i] / chunksize);\n chunks[chunk].push(uint16_index);\n }\n results = [];\n for (chunk = q = 0, ref2 = chunks.length; 0 <= ref2 ? q < ref2 : q > ref2; chunk = 0 <= ref2 ? ++q : --q) {\n these_indices = new Uint16Array(chunks[chunk]);\n offset = chunk * chunksize * 4;\n if (these_indices.length === 0) {\n continue;\n }\n this.prog.set_attribute('a_position', 'vec2', mainGlGlyph.vbo_position, 0, offset * 2);\n this.prog.set_attribute('a_tangents', 'vec4', mainGlGlyph.vbo_tangents, 0, offset * 4);\n this.prog.set_attribute('a_segment', 'vec2', mainGlGlyph.vbo_segment, 0, offset * 2);\n this.prog.set_attribute('a_angles', 'vec2', mainGlGlyph.vbo_angles, 0, offset * 2);\n this.prog.set_attribute('a_texcoord', 'vec2', mainGlGlyph.vbo_texcoord, 0, offset * 2);\n this.index_buffer.set_size(these_indices.length * 2);\n this.index_buffer.set_data(0, these_indices);\n results.push(this.prog.draw(this.gl.TRIANGLES, this.index_buffer));\n }\n return results;\n }\n };\n LineGLGlyph.prototype._set_data = function () {\n this._bake();\n this.vbo_position.set_size(this.V_position.length * 4);\n this.vbo_position.set_data(0, this.V_position);\n this.vbo_tangents.set_size(this.V_tangents.length * 4);\n this.vbo_tangents.set_data(0, this.V_tangents);\n this.vbo_angles.set_size(this.V_angles.length * 4);\n this.vbo_angles.set_data(0, this.V_angles);\n this.vbo_texcoord.set_size(this.V_texcoord.length * 4);\n return this.vbo_texcoord.set_data(0, this.V_texcoord);\n };\n LineGLGlyph.prototype._set_visuals = function () {\n var cap, color, dash_index, dash_pattern, dash_period, join, ref;\n color = color_1.color2rgba(this.glyph.visuals.line.line_color.value(), this.glyph.visuals.line.line_alpha.value());\n cap = this.CAPS[this.glyph.visuals.line.line_cap.value()];\n join = this.JOINS[this.glyph.visuals.line.line_join.value()];\n this.prog.set_uniform('u_color', 'vec4', color);\n this.prog.set_uniform('u_linewidth', 'float', [this.glyph.visuals.line.line_width.value()]);\n this.prog.set_uniform('u_antialias', 'float', [0.9]);\n this.prog.set_uniform('u_linecaps', 'vec2', [\n cap,\n cap\n ]);\n this.prog.set_uniform('u_linejoin', 'float', [join]);\n this.prog.set_uniform('u_miter_limit', 'float', [10]);\n dash_pattern = this.glyph.visuals.line.line_dash.value();\n dash_index = 0;\n dash_period = 1;\n if (dash_pattern.length) {\n ref = this.dash_atlas.get_atlas_data(dash_pattern), dash_index = ref[0], dash_period = ref[1];\n }\n this.prog.set_uniform('u_dash_index', 'float', [dash_index]);\n this.prog.set_uniform('u_dash_phase', 'float', [this.glyph.visuals.line.line_dash_offset.value()]);\n this.prog.set_uniform('u_dash_period', 'float', [dash_period]);\n this.prog.set_uniform('u_dash_caps', 'vec2', [\n cap,\n cap\n ]);\n return this.prog.set_uniform('u_closed', 'float', [0]);\n };\n LineGLGlyph.prototype._bake = function () {\n var A, I, T, V_angles, V_angles2, V_position, V_position2, V_tangents, V_tangents2, V_texcoord, V_texcoord2, Vp, Vt, _x, _y, i, i1, j, k, l, m, n, ni, o, p, q, r, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, results, s, t, u, w, y, z;\n n = this.nvertices;\n _x = new Float64Array(this.glyph._x);\n _y = new Float64Array(this.glyph._y);\n V_position = Vp = new Float32Array(n * 2);\n V_angles = new Float32Array(n * 2);\n V_tangents = Vt = new Float32Array(n * 4);\n V_texcoord = new Float32Array(n * 2);\n for (i = l = 0, ref = n; 0 <= ref ? l < ref : l > ref; i = 0 <= ref ? ++l : --l) {\n V_position[i * 2 + 0] = _x[i] + this._baked_offset[0];\n V_position[i * 2 + 1] = _y[i] + this._baked_offset[1];\n }\n this.tangents = T = new Float32Array(n * 2 - 2);\n for (i = p = 0, ref1 = n - 1; 0 <= ref1 ? p < ref1 : p > ref1; i = 0 <= ref1 ? ++p : --p) {\n T[i * 2 + 0] = Vp[(i + 1) * 2 + 0] - Vp[i * 2 + 0];\n T[i * 2 + 1] = Vp[(i + 1) * 2 + 1] - Vp[i * 2 + 1];\n }\n for (i = q = 0, ref2 = n - 1; 0 <= ref2 ? q < ref2 : q > ref2; i = 0 <= ref2 ? ++q : --q) {\n V_tangents[(i + 1) * 4 + 0] = T[i * 2 + 0];\n V_tangents[(i + 1) * 4 + 1] = T[i * 2 + 1];\n V_tangents[i * 4 + 2] = T[i * 2 + 0];\n V_tangents[i * 4 + 3] = T[i * 2 + 1];\n }\n V_tangents[0 * 4 + 0] = T[0];\n V_tangents[0 * 4 + 1] = T[1];\n V_tangents[(n - 1) * 4 + 2] = T[(n - 2) * 2 + 0];\n V_tangents[(n - 1) * 4 + 3] = T[(n - 2) * 2 + 1];\n A = new Float32Array(n);\n for (i = r = 0, ref3 = n; 0 <= ref3 ? r < ref3 : r > ref3; i = 0 <= ref3 ? ++r : --r) {\n A[i] = Math.atan2(Vt[i * 4 + 0] * Vt[i * 4 + 3] - Vt[i * 4 + 1] * Vt[i * 4 + 2], Vt[i * 4 + 0] * Vt[i * 4 + 2] + Vt[i * 4 + 1] * Vt[i * 4 + 3]);\n }\n for (i = s = 0, ref4 = n - 1; 0 <= ref4 ? s < ref4 : s > ref4; i = 0 <= ref4 ? ++s : --s) {\n V_angles[i * 2 + 0] = A[i];\n V_angles[i * 2 + 1] = A[i + 1];\n }\n m = 4 * n - 4;\n this.V_position = V_position2 = new Float32Array(m * 2);\n this.V_angles = V_angles2 = new Float32Array(m * 2);\n this.V_tangents = V_tangents2 = new Float32Array(m * 4);\n this.V_texcoord = V_texcoord2 = new Float32Array(m * 2);\n o = 2;\n for (i = t = 0, ref5 = n; 0 <= ref5 ? t < ref5 : t > ref5; i = 0 <= ref5 ? ++t : --t) {\n for (j = u = 0; u < 4; j = ++u) {\n for (k = w = 0; w < 2; k = ++w) {\n V_position2[(i * 4 + j - o) * 2 + k] = V_position[i * 2 + k];\n V_angles2[(i * 4 + j) * 2 + k] = V_angles[i * 2 + k];\n }\n for (k = y = 0; y < 4; k = ++y) {\n V_tangents2[(i * 4 + j - o) * 4 + k] = V_tangents[i * 4 + k];\n }\n }\n }\n for (i = z = 0, ref6 = n; 0 <= ref6 ? z <= ref6 : z >= ref6; i = 0 <= ref6 ? ++z : --z) {\n V_texcoord2[(i * 4 + 0) * 2 + 0] = -1;\n V_texcoord2[(i * 4 + 1) * 2 + 0] = -1;\n V_texcoord2[(i * 4 + 2) * 2 + 0] = +1;\n V_texcoord2[(i * 4 + 3) * 2 + 0] = +1;\n V_texcoord2[(i * 4 + 0) * 2 + 1] = -1;\n V_texcoord2[(i * 4 + 1) * 2 + 1] = +1;\n V_texcoord2[(i * 4 + 2) * 2 + 1] = -1;\n V_texcoord2[(i * 4 + 3) * 2 + 1] = +1;\n }\n ni = (n - 1) * 6;\n this.I_triangles = I = new Uint32Array(ni);\n results = [];\n for (i = i1 = 0, ref7 = n; 0 <= ref7 ? i1 < ref7 : i1 > ref7; i = 0 <= ref7 ? ++i1 : --i1) {\n I[i * 6 + 0] = 0 + 4 * i;\n I[i * 6 + 1] = 1 + 4 * i;\n I[i * 6 + 2] = 3 + 4 * i;\n I[i * 6 + 3] = 2 + 4 * i;\n I[i * 6 + 4] = 0 + 4 * i;\n results.push(I[i * 6 + 5] = 3 + 4 * i);\n }\n return results;\n };\n LineGLGlyph.prototype._update_scale = function (sx, sy) {\n var N, T, V_segment, V_segment2, cumsum, i, j, k, l, m, n, p, q, r, ref, ref1, ref2, s;\n n = this.nvertices;\n m = 4 * n - 4;\n T = this.tangents;\n N = new Float32Array(n - 1);\n V_segment = new Float32Array(n * 2);\n this.V_segment = V_segment2 = new Float32Array(m * 2);\n for (i = l = 0, ref = n - 1; 0 <= ref ? l < ref : l > ref; i = 0 <= ref ? ++l : --l) {\n N[i] = Math.sqrt(Math.pow(T[i * 2 + 0] * sx, 2) + Math.pow(T[i * 2 + 1] * sy, 2));\n }\n cumsum = 0;\n for (i = p = 0, ref1 = n - 1; 0 <= ref1 ? p < ref1 : p > ref1; i = 0 <= ref1 ? ++p : --p) {\n cumsum += N[i];\n V_segment[(i + 1) * 2 + 0] = cumsum;\n V_segment[i * 2 + 1] = cumsum;\n }\n for (i = q = 0, ref2 = n; 0 <= ref2 ? q < ref2 : q > ref2; i = 0 <= ref2 ? ++q : --q) {\n for (j = r = 0; r < 4; j = ++r) {\n for (k = s = 0; s < 2; k = ++s) {\n V_segment2[(i * 4 + j) * 2 + k] = V_segment[i * 2 + k];\n }\n }\n }\n this.cumsum = cumsum;\n this.vbo_segment.set_size(this.V_segment.length * 4);\n return this.vbo_segment.set_data(0, this.V_segment);\n };\n return LineGLGlyph;\n}(base_1.BaseGLGlyph); \n","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nrequire(422 /* ./index */); \n","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar MarkerGLGlyph, extend = function (child, parent) {\n for (var key in parent) {\n if (hasProp.call(parent, key))\n child[key] = parent[key];\n }\n function ctor() {\n this.constructor = child;\n }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n child.__super__ = parent.prototype;\n return child;\n }, hasProp = {}.hasOwnProperty;\nvar gloo2_1 = require(421 /* ./gloo2 */);\nvar base_1 = require(420 /* ./base */);\nvar logging_1 = require(13 /* core/logging */);\nMarkerGLGlyph = function (superClass) {\n extend(MarkerGLGlyph, superClass);\n function MarkerGLGlyph() {\n return MarkerGLGlyph.__super__.constructor.apply(this, arguments);\n }\n MarkerGLGlyph.prototype.VERT = 'precision mediump float;\\nconst float SQRT_2 = 1.4142135623730951;\\n//\\nuniform float u_pixel_ratio;\\nuniform vec2 u_canvas_size;\\nuniform vec2 u_offset;\\nuniform vec2 u_scale;\\nuniform float u_antialias;\\n//\\nattribute float a_x;\\nattribute float a_y;\\nattribute float a_size;\\nattribute float a_angle; // in radians\\nattribute float a_linewidth;\\nattribute vec4 a_fg_color;\\nattribute vec4 a_bg_color;\\n//\\nvarying float v_linewidth;\\nvarying float v_size;\\nvarying vec4 v_fg_color;\\nvarying vec4 v_bg_color;\\nvarying vec2 v_rotation;\\n\\nvoid main (void)\\n{\\n v_size = a_size * u_pixel_ratio;\\n v_linewidth = a_linewidth * u_pixel_ratio;\\n v_fg_color = a_fg_color;\\n v_bg_color = a_bg_color;\\n v_rotation = vec2(cos(-a_angle), sin(-a_angle));\\n // Calculate position - the -0.5 is to correct for canvas origin\\n vec2 pos = (vec2(a_x, a_y) + u_offset) * u_scale; // in pixels\\n pos += 0.5; // make up for Bokeh\\'s offset\\n pos /= u_canvas_size / u_pixel_ratio; // in 0..1\\n gl_Position = vec4(pos*2.0-1.0, 0.0, 1.0);\\n gl_Position.y *= -1.0;\\n gl_PointSize = SQRT_2 * v_size + 2.0 * (v_linewidth + 1.5*u_antialias);\\n}';\n MarkerGLGlyph.prototype.FRAG = 'precision mediump float;\\nconst float SQRT_2 = 1.4142135623730951;\\nconst float PI = 3.14159265358979323846264;\\n//\\nuniform float u_antialias;\\n//\\nvarying vec4 v_fg_color;\\nvarying vec4 v_bg_color;\\nvarying float v_linewidth;\\nvarying float v_size;\\nvarying vec2 v_rotation;\\n\\nMARKERCODE\\n\\nvec4 outline(float distance, float linewidth, float antialias, vec4 fg_color, vec4 bg_color)\\n{\\n vec4 frag_color;\\n float t = linewidth/2.0 - antialias;\\n float signed_distance = distance;\\n float border_distance = abs(signed_distance) - t;\\n float alpha = border_distance/antialias;\\n alpha = exp(-alpha*alpha);\\n\\n // If fg alpha is zero, it probably means no outline. To avoid a dark outline\\n // shining through due to aa, we set the fg color to the bg color. Avoid if (i.e. branching).\\n float select = float(bool(fg_color.a));\\n fg_color.rgb = select * fg_color.rgb + (1.0 - select) * bg_color.rgb;\\n // Similarly, if we want a transparent bg\\n select = float(bool(bg_color.a));\\n bg_color.rgb = select * bg_color.rgb + (1.0 - select) * fg_color.rgb;\\n\\n if( border_distance < 0.0)\\n frag_color = fg_color;\\n else if( signed_distance < 0.0 ) {\\n frag_color = mix(bg_color, fg_color, sqrt(alpha));\\n } else {\\n if( abs(signed_distance) < (linewidth/2.0 + antialias) ) {\\n frag_color = vec4(fg_color.rgb, fg_color.a * alpha);\\n } else {\\n discard;\\n }\\n }\\n return frag_color;\\n}\\n\\nvoid main()\\n{\\n vec2 P = gl_PointCoord.xy - vec2(0.5, 0.5);\\n P = vec2(v_rotation.x*P.x - v_rotation.y*P.y,\\n v_rotation.y*P.x + v_rotation.x*P.y);\\n float point_size = SQRT_2*v_size + 2.0 * (v_linewidth + 1.5*u_antialias);\\n float distance = marker(P*point_size, v_size);\\n gl_FragColor = outline(distance, v_linewidth, u_antialias, v_fg_color, v_bg_color);\\n //gl_FragColor.rgb *= gl_FragColor.a; // pre-multiply alpha\\n}';\n MarkerGLGlyph.prototype.MARKERCODE = '';\n MarkerGLGlyph.prototype.init = function () {\n var frag, gl;\n gl = this.gl;\n frag = this.FRAG.replace(/MARKERCODE/, this.MARKERCODE);\n this.last_trans = {};\n this.prog = new gloo2_1.Program(gl);\n this.prog.set_shaders(this.VERT, frag);\n this.vbo_x = new gloo2_1.VertexBuffer(gl);\n this.prog.set_attribute('a_x', 'float', this.vbo_x);\n this.vbo_y = new gloo2_1.VertexBuffer(gl);\n this.prog.set_attribute('a_y', 'float', this.vbo_y);\n this.vbo_s = new gloo2_1.VertexBuffer(gl);\n this.prog.set_attribute('a_size', 'float', this.vbo_s);\n this.vbo_a = new gloo2_1.VertexBuffer(gl);\n this.prog.set_attribute('a_angle', 'float', this.vbo_a);\n this.vbo_linewidth = new gloo2_1.VertexBuffer(gl);\n this.vbo_fg_color = new gloo2_1.VertexBuffer(gl);\n this.vbo_bg_color = new gloo2_1.VertexBuffer(gl);\n return this.index_buffer = new gloo2_1.IndexBuffer(gl);\n };\n MarkerGLGlyph.prototype.draw = function (indices, mainGlyph, trans) {\n var baked_offset, chunk, chunks, chunksize, i, j, k, l, mainGlGlyph, nvertices, offset, ref, ref1, ref2, results, s, these_indices, ua, uint16_index;\n mainGlGlyph = mainGlyph.glglyph;\n nvertices = mainGlGlyph.nvertices;\n if (mainGlGlyph.data_changed) {\n if (!(isFinite(trans.dx) && isFinite(trans.dy))) {\n return;\n }\n mainGlGlyph._baked_offset = [\n trans.dx,\n trans.dy\n ];\n mainGlGlyph._set_data(nvertices);\n mainGlGlyph.data_changed = false;\n } else if (this.glyph._radius != null && (trans.sx !== this.last_trans.sx || trans.sy !== this.last_trans.sy)) {\n this.last_trans = trans;\n this.vbo_s.set_data(0, new Float32Array(function () {\n var j, len, ref, results;\n ref = this.glyph.sradius;\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n s = ref[j];\n results.push(s * 2);\n }\n return results;\n }.call(this)));\n }\n if (this.visuals_changed) {\n this._set_visuals(nvertices);\n this.visuals_changed = false;\n }\n baked_offset = mainGlGlyph._baked_offset;\n this.prog.set_uniform('u_pixel_ratio', 'float', [trans.pixel_ratio]);\n this.prog.set_uniform('u_canvas_size', 'vec2', [\n trans.width,\n trans.height\n ]);\n this.prog.set_uniform('u_offset', 'vec2', [\n trans.dx - baked_offset[0],\n trans.dy - baked_offset[1]\n ]);\n this.prog.set_uniform('u_scale', 'vec2', [\n trans.sx,\n trans.sy\n ]);\n this.prog.set_attribute('a_x', 'float', mainGlGlyph.vbo_x);\n this.prog.set_attribute('a_y', 'float', mainGlGlyph.vbo_y);\n this.prog.set_attribute('a_size', 'float', mainGlGlyph.vbo_s);\n this.prog.set_attribute('a_angle', 'float', mainGlGlyph.vbo_a);\n if (indices.length === 0) {\n } else if (indices.length === nvertices) {\n return this.prog.draw(this.gl.POINTS, [\n 0,\n nvertices\n ]);\n } else if (nvertices < 65535) {\n ua = window.navigator.userAgent;\n if (ua.indexOf('MSIE ') + ua.indexOf('Trident/') + ua.indexOf('Edge/') > 0) {\n logging_1.logger.warn('WebGL warning: IE is known to produce 1px sprites whith selections.');\n }\n this.index_buffer.set_size(indices.length * 2);\n this.index_buffer.set_data(0, new Uint16Array(indices));\n return this.prog.draw(this.gl.POINTS, this.index_buffer);\n } else {\n chunksize = 64000;\n chunks = [];\n for (i = j = 0, ref = Math.ceil(nvertices / chunksize); 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {\n chunks.push([]);\n }\n for (i = k = 0, ref1 = indices.length; 0 <= ref1 ? k < ref1 : k > ref1; i = 0 <= ref1 ? ++k : --k) {\n uint16_index = indices[i] % chunksize;\n chunk = Math.floor(indices[i] / chunksize);\n chunks[chunk].push(uint16_index);\n }\n results = [];\n for (chunk = l = 0, ref2 = chunks.length; 0 <= ref2 ? l < ref2 : l > ref2; chunk = 0 <= ref2 ? ++l : --l) {\n these_indices = new Uint16Array(chunks[chunk]);\n offset = chunk * chunksize * 4;\n if (these_indices.length === 0) {\n continue;\n }\n this.prog.set_attribute('a_x', 'float', mainGlGlyph.vbo_x, 0, offset);\n this.prog.set_attribute('a_y', 'float', mainGlGlyph.vbo_y, 0, offset);\n this.prog.set_attribute('a_size', 'float', mainGlGlyph.vbo_s, 0, offset);\n this.prog.set_attribute('a_angle', 'float', mainGlGlyph.vbo_a, 0, offset);\n if (this.vbo_linewidth.used) {\n this.prog.set_attribute('a_linewidth', 'float', this.vbo_linewidth, 0, offset);\n }\n if (this.vbo_fg_color.used) {\n this.prog.set_attribute('a_fg_color', 'vec4', this.vbo_fg_color, 0, offset * 4);\n }\n if (this.vbo_bg_color.used) {\n this.prog.set_attribute('a_bg_color', 'vec4', this.vbo_bg_color, 0, offset * 4);\n }\n this.index_buffer.set_size(these_indices.length * 2);\n this.index_buffer.set_data(0, these_indices);\n results.push(this.prog.draw(this.gl.POINTS, this.index_buffer));\n }\n return results;\n }\n };\n MarkerGLGlyph.prototype._set_data = function (nvertices) {\n var i, j, n, ref, s, xx, yy;\n n = nvertices * 4;\n this.vbo_x.set_size(n);\n this.vbo_y.set_size(n);\n this.vbo_a.set_size(n);\n this.vbo_s.set_size(n);\n xx = new Float64Array(this.glyph._x);\n yy = new Float64Array(this.glyph._y);\n for (i = j = 0, ref = nvertices; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {\n xx[i] += this._baked_offset[0];\n yy[i] += this._baked_offset[1];\n }\n this.vbo_x.set_data(0, new Float32Array(xx));\n this.vbo_y.set_data(0, new Float32Array(yy));\n if (this.glyph._angle != null) {\n this.vbo_a.set_data(0, new Float32Array(this.glyph._angle));\n }\n if (this.glyph._radius != null) {\n return this.vbo_s.set_data(0, new Float32Array(function () {\n var k, len, ref1, results;\n ref1 = this.glyph.sradius;\n results = [];\n for (k = 0, len = ref1.length; k < len; k++) {\n s = ref1[k];\n results.push(s * 2);\n }\n return results;\n }.call(this)));\n } else {\n return this.vbo_s.set_data(0, new Float32Array(this.glyph._size));\n }\n };\n MarkerGLGlyph.prototype._set_visuals = function (nvertices) {\n base_1.attach_float(this.prog, this.vbo_linewidth, 'a_linewidth', nvertices, this.glyph.visuals.line, 'line_width');\n base_1.attach_color(this.prog, this.vbo_fg_color, 'a_fg_color', nvertices, this.glyph.visuals.line, 'line');\n base_1.attach_color(this.prog, this.vbo_bg_color, 'a_bg_color', nvertices, this.glyph.visuals.fill, 'fill');\n return this.prog.set_uniform('u_antialias', 'float', [0.8]);\n };\n return MarkerGLGlyph;\n}(base_1.BaseGLGlyph);\nexports.CircleGLGlyph = function (superClass) {\n extend(CircleGLGlyph, superClass);\n function CircleGLGlyph() {\n return CircleGLGlyph.__super__.constructor.apply(this, arguments);\n }\n CircleGLGlyph.prototype.GLYPH = 'circle';\n CircleGLGlyph.prototype.MARKERCODE = '// --- disc\\nfloat marker(vec2 P, float size)\\n{\\n return length(P) - size/2.0;\\n}';\n return CircleGLGlyph;\n}(MarkerGLGlyph);\nexports.SquareGLGlyph = function (superClass) {\n extend(SquareGLGlyph, superClass);\n function SquareGLGlyph() {\n return SquareGLGlyph.__super__.constructor.apply(this, arguments);\n }\n SquareGLGlyph.prototype.GLYPH = 'square';\n SquareGLGlyph.prototype.MARKERCODE = '// --- square\\nfloat marker(vec2 P, float size)\\n{\\n return max(abs(P.x), abs(P.y)) - size/2.0;\\n}';\n return SquareGLGlyph;\n}(MarkerGLGlyph);\nexports.AnnulusGLGlyph = function (superClass) {\n extend(AnnulusGLGlyph, superClass);\n function AnnulusGLGlyph() {\n return AnnulusGLGlyph.__super__.constructor.apply(this, arguments);\n }\n AnnulusGLGlyph.prototype.GLYPH = 'annulus';\n AnnulusGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n float r1 = length(P) - size/2.0;\\n float r2 = length(P) - size/4.0; // half width\\n return max(r1, -r2);\\n}';\n return AnnulusGLGlyph;\n}(MarkerGLGlyph);\nexports.DiamondGLGlyph = function (superClass) {\n extend(DiamondGLGlyph, superClass);\n function DiamondGLGlyph() {\n return DiamondGLGlyph.__super__.constructor.apply(this, arguments);\n }\n DiamondGLGlyph.prototype.GLYPH = 'diamond';\n DiamondGLGlyph.prototype.MARKERCODE = '// --- diamond\\nfloat marker(vec2 P, float size)\\n{\\n float x = SQRT_2 / 2.0 * (P.x * 1.5 - P.y);\\n float y = SQRT_2 / 2.0 * (P.x * 1.5 + P.y);\\n float r1 = max(abs(x), abs(y)) - size / (2.0 * SQRT_2);\\n return r1 / SQRT_2;\\n}';\n return DiamondGLGlyph;\n}(MarkerGLGlyph);\nexports.TriangleGLGlyph = function (superClass) {\n extend(TriangleGLGlyph, superClass);\n function TriangleGLGlyph() {\n return TriangleGLGlyph.__super__.constructor.apply(this, arguments);\n }\n TriangleGLGlyph.prototype.GLYPH = 'triangle';\n TriangleGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n P.y -= size * 0.3;\\n float x = SQRT_2 / 2.0 * (P.x * 1.7 - P.y);\\n float y = SQRT_2 / 2.0 * (P.x * 1.7 + P.y);\\n float r1 = max(abs(x), abs(y)) - size / 1.6;\\n float r2 = P.y;\\n return max(r1 / SQRT_2, r2); // Instersect diamond with rectangle\\n}';\n return TriangleGLGlyph;\n}(MarkerGLGlyph);\nexports.InvertedTriangleGLGlyph = function (superClass) {\n extend(InvertedTriangleGLGlyph, superClass);\n function InvertedTriangleGLGlyph() {\n return InvertedTriangleGLGlyph.__super__.constructor.apply(this, arguments);\n }\n InvertedTriangleGLGlyph.prototype.GLYPH = 'invertedtriangle';\n InvertedTriangleGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n P.y += size * 0.3;\\n float x = SQRT_2 / 2.0 * (P.x * 1.7 - P.y);\\n float y = SQRT_2 / 2.0 * (P.x * 1.7 + P.y);\\n float r1 = max(abs(x), abs(y)) - size / 1.6;\\n float r2 = - P.y;\\n return max(r1 / SQRT_2, r2); // Instersect diamond with rectangle\\n}';\n return InvertedTriangleGLGlyph;\n}(MarkerGLGlyph);\nexports.CrossGLGlyph = function (superClass) {\n extend(CrossGLGlyph, superClass);\n function CrossGLGlyph() {\n return CrossGLGlyph.__super__.constructor.apply(this, arguments);\n }\n CrossGLGlyph.prototype.GLYPH = 'cross';\n CrossGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n float square = max(abs(P.x), abs(P.y)) - size / 2.5; // 2.5 is a tweak\\n float cross = min(abs(P.x), abs(P.y)) - size / 100.0; // bit of \"width\" for aa\\n return max(square, cross);\\n}';\n return CrossGLGlyph;\n}(MarkerGLGlyph);\nexports.CircleCrossGLGlyph = function (superClass) {\n extend(CircleCrossGLGlyph, superClass);\n function CircleCrossGLGlyph() {\n return CircleCrossGLGlyph.__super__.constructor.apply(this, arguments);\n }\n CircleCrossGLGlyph.prototype.GLYPH = 'circlecross';\n CircleCrossGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n // Define quadrants\\n float qs = size / 2.0; // quadrant size\\n float s1 = max(abs(P.x - qs), abs(P.y - qs)) - qs;\\n float s2 = max(abs(P.x + qs), abs(P.y - qs)) - qs;\\n float s3 = max(abs(P.x - qs), abs(P.y + qs)) - qs;\\n float s4 = max(abs(P.x + qs), abs(P.y + qs)) - qs;\\n // Intersect main shape with quadrants (to form cross)\\n float circle = length(P) - size/2.0;\\n float c1 = max(circle, s1);\\n float c2 = max(circle, s2);\\n float c3 = max(circle, s3);\\n float c4 = max(circle, s4);\\n // Union\\n return min(min(min(c1, c2), c3), c4);\\n}';\n return CircleCrossGLGlyph;\n}(MarkerGLGlyph);\nexports.SquareCrossGLGlyph = function (superClass) {\n extend(SquareCrossGLGlyph, superClass);\n function SquareCrossGLGlyph() {\n return SquareCrossGLGlyph.__super__.constructor.apply(this, arguments);\n }\n SquareCrossGLGlyph.prototype.GLYPH = 'squarecross';\n SquareCrossGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n // Define quadrants\\n float qs = size / 2.0; // quadrant size\\n float s1 = max(abs(P.x - qs), abs(P.y - qs)) - qs;\\n float s2 = max(abs(P.x + qs), abs(P.y - qs)) - qs;\\n float s3 = max(abs(P.x - qs), abs(P.y + qs)) - qs;\\n float s4 = max(abs(P.x + qs), abs(P.y + qs)) - qs;\\n // Intersect main shape with quadrants (to form cross)\\n float square = max(abs(P.x), abs(P.y)) - size/2.0;\\n float c1 = max(square, s1);\\n float c2 = max(square, s2);\\n float c3 = max(square, s3);\\n float c4 = max(square, s4);\\n // Union\\n return min(min(min(c1, c2), c3), c4);\\n}';\n return SquareCrossGLGlyph;\n}(MarkerGLGlyph);\nexports.DiamondCrossGLGlyph = function (superClass) {\n extend(DiamondCrossGLGlyph, superClass);\n function DiamondCrossGLGlyph() {\n return DiamondCrossGLGlyph.__super__.constructor.apply(this, arguments);\n }\n DiamondCrossGLGlyph.prototype.GLYPH = 'diamondcross';\n DiamondCrossGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n // Define quadrants\\n float qs = size / 2.0; // quadrant size\\n float s1 = max(abs(P.x - qs), abs(P.y - qs)) - qs;\\n float s2 = max(abs(P.x + qs), abs(P.y - qs)) - qs;\\n float s3 = max(abs(P.x - qs), abs(P.y + qs)) - qs;\\n float s4 = max(abs(P.x + qs), abs(P.y + qs)) - qs;\\n // Intersect main shape with quadrants (to form cross)\\n float x = SQRT_2 / 2.0 * (P.x * 1.5 - P.y);\\n float y = SQRT_2 / 2.0 * (P.x * 1.5 + P.y);\\n float diamond = max(abs(x), abs(y)) - size / (2.0 * SQRT_2);\\n diamond /= SQRT_2;\\n float c1 = max(diamond, s1);\\n float c2 = max(diamond, s2);\\n float c3 = max(diamond, s3);\\n float c4 = max(diamond, s4);\\n // Union\\n return min(min(min(c1, c2), c3), c4);\\n}';\n return DiamondCrossGLGlyph;\n}(MarkerGLGlyph);\nexports.XGLGlyph = function (superClass) {\n extend(XGLGlyph, superClass);\n function XGLGlyph() {\n return XGLGlyph.__super__.constructor.apply(this, arguments);\n }\n XGLGlyph.prototype.GLYPH = 'x';\n XGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n float circle = length(P) - size / 1.6;\\n float X = min(abs(P.x - P.y), abs(P.x + P.y)) - size / 100.0; // bit of \"width\" for aa\\n return max(circle, X);\\n}';\n return XGLGlyph;\n}(MarkerGLGlyph);\nexports.CircleXGLGlyph = function (superClass) {\n extend(CircleXGLGlyph, superClass);\n function CircleXGLGlyph() {\n return CircleXGLGlyph.__super__.constructor.apply(this, arguments);\n }\n CircleXGLGlyph.prototype.GLYPH = 'circlex';\n CircleXGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n float x = P.x - P.y;\\n float y = P.x + P.y;\\n // Define quadrants\\n float qs = size / 2.0; // quadrant size\\n float s1 = max(abs(x - qs), abs(y - qs)) - qs;\\n float s2 = max(abs(x + qs), abs(y - qs)) - qs;\\n float s3 = max(abs(x - qs), abs(y + qs)) - qs;\\n float s4 = max(abs(x + qs), abs(y + qs)) - qs;\\n // Intersect main shape with quadrants (to form cross)\\n float circle = length(P) - size/2.0;\\n float c1 = max(circle, s1);\\n float c2 = max(circle, s2);\\n float c3 = max(circle, s3);\\n float c4 = max(circle, s4);\\n // Union\\n float almost = min(min(min(c1, c2), c3), c4);\\n // In this case, the X is also outside of the main shape\\n float Xmask = length(P) - size / 1.6; // a circle\\n float X = min(abs(P.x - P.y), abs(P.x + P.y)) - size / 100.0; // bit of \"width\" for aa\\n return min(max(X, Xmask), almost);\\n}';\n return CircleXGLGlyph;\n}(MarkerGLGlyph);\nexports.SquareXGLGlyph = function (superClass) {\n extend(SquareXGLGlyph, superClass);\n function SquareXGLGlyph() {\n return SquareXGLGlyph.__super__.constructor.apply(this, arguments);\n }\n SquareXGLGlyph.prototype.GLYPH = 'squarex';\n SquareXGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n float x = P.x - P.y;\\n float y = P.x + P.y;\\n // Define quadrants\\n float qs = size / 2.0; // quadrant size\\n float s1 = max(abs(x - qs), abs(y - qs)) - qs;\\n float s2 = max(abs(x + qs), abs(y - qs)) - qs;\\n float s3 = max(abs(x - qs), abs(y + qs)) - qs;\\n float s4 = max(abs(x + qs), abs(y + qs)) - qs;\\n // Intersect main shape with quadrants (to form cross)\\n float square = max(abs(P.x), abs(P.y)) - size/2.0;\\n float c1 = max(square, s1);\\n float c2 = max(square, s2);\\n float c3 = max(square, s3);\\n float c4 = max(square, s4);\\n // Union\\n return min(min(min(c1, c2), c3), c4);\\n}';\n return SquareXGLGlyph;\n}(MarkerGLGlyph);\nexports.AsteriskGLGlyph = function (superClass) {\n extend(AsteriskGLGlyph, superClass);\n function AsteriskGLGlyph() {\n return AsteriskGLGlyph.__super__.constructor.apply(this, arguments);\n }\n AsteriskGLGlyph.prototype.GLYPH = 'asterisk';\n AsteriskGLGlyph.prototype.MARKERCODE = 'float marker(vec2 P, float size)\\n{\\n // Masks\\n float diamond = max(abs(SQRT_2 / 2.0 * (P.x - P.y)), abs(SQRT_2 / 2.0 * (P.x + P.y))) - size / (2.0 * SQRT_2);\\n float square = max(abs(P.x), abs(P.y)) - size / (2.0 * SQRT_2);\\n // Shapes\\n float X = min(abs(P.x - P.y), abs(P.x + P.y)) - size / 100.0; // bit of \"width\" for aa\\n float cross = min(abs(P.x), abs(P.y)) - size / 100.0; // bit of \"width\" for aa\\n // Result is union of masked shapes\\n return min(max(X, diamond), max(cross, square));\\n}';\n return AsteriskGLGlyph;\n}(MarkerGLGlyph); \n"]}