Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dmap

Package Overview
Dependencies
Maintainers
5
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dmap - npm Package Compare versions

Comparing version 0.2.6 to 0.2.7

2

core/utils.js

@@ -1,1 +0,1 @@

'use strict';function p(c){c.originalEvent&&(c=c.originalEvent);var d=c.target,e=d.offsetWidth,f=d.offsetHeight,g=d.offsetLeft,h=d.offsetTop,a,b;if(c.type.indexOf('mouse')!==-1)return a=c.x||c.pageX,b=c.y||c.pageY,[a-g,b-h,'mouse'];var i=window.event.touches[0];return a=i.pageX-g,b=i.pageY-h,a=a<e?a:e,a=a>0?a:1,b=b<f?b:f,b=b>0?b:1,[a,b,'touch']}function s(g,h,b,c,d,f){return c=c||0,d=d||0,f=f||0,b=b||6378137,new a.Vector3(g/180*e*b+c,d,-b*o(n((90+h)*e/360))+f)}function v(o,p,b,h,i,g){var j=1;h=h||0,i=i||0,g=g||0,b=b||1;var k=-o*e/180,d=p*e/180,n=b*c(k)*c(d)*j+h,l=b*f(k)*c(d)*j+g,m=b*f(d)+i;return new a.Vector3(n,m,l)}function B(j,n,k,b,c,a,d){c=c||0,a=a||0,d=d||0,b=b||1;var i=j-c,g=n-a,h=k-d,f=l(g/b),e=m(h,i);return{lat:f,lng:e}}function A(c,a,d){var e=a.x-c.x,f=a.y-c.y,i=a.z-c.z,k=d.x-a.x,j=d.y-a.y,b=d.z-a.z;return.5*h(g(f*b-i*j,2)+g(e*b-i*k,2)+g(e*j-f*b,2))}function i(f,i,j,k,l){var c=f.x-j,d=f.y-k,e=f.z-l,g=h(c*c+d*d+e*e),b=g<i?i/g:1;return new a.Vector3(j+c*b,k+d*b,l+e*b)}function z(f,A){var B=A.x0,s=A.y0,z=A.z0,v=A.radius,e={},H=f.faces,n=[],c=f.vertices;for(var t=H.length-1;t>=0;t--){var j=H[t],k=j.a,g=j.b,h=j.c,o=j.normal,q=j.color,p=j.materialIndex,G=c[k],F=c[g],E=c[h],r,l,m,C=d(k,g)+'_'+b(k,g);if(!e[C]){var y=new a.Vector3().addVectors(G,F).divideScalar(2);y=i(y,v,B,s,z),r=e[C]=c.length,c.push(y)}else r=e[C];var x=d(g,h)+'_'+b(g,h);if(!e[x]){var w=new a.Vector3().addVectors(F,E).divideScalar(2);w=i(w,B,s,z,v);var l=e[x]=c.length;c.push(w)}else l=e[x];var u=d(k,h)+'_'+b(k,h);if(!e[u]){var D=new a.Vector3().addVectors(E,G).divideScalar(2);D=i(D,B,s,z,v);var m=e[u]=c.length;c.push(D)}else m=e[u];var J=new a.Face3(k,r,m,o,q,p),K=new a.Face3(r,g,l,o,q,p),L=new a.Face3(m,l,h,o,q,p),I=new a.Face3(r,l,m,o,q,p);n.push(J),n.push(K),n.push(L),n.push(I)}return f.vertices=c,f.faces=n,f.computeFaceNormals(),f.computeVertexNormals(),console.log(f),f}function y(f,l){var b=[];for(var d in f){var e=l[d],h=e.bound;if(h)b.push(f[d]);else{var i=e.adj,c=new a.Vector3(0,0,0),g=0;for(var k in i){var j=f[k];c.add(j),g++}c.divideScalar(g),b.push(c)}}return b}function r(i){var q=i.faces,l=i.vertices,a={},e={},g;for(var k=0;k<q.length;k++){var o=q[k],c=o.a,f=o.b,h=o.c;a[c]||(a[c]={adj:{}}),g=a[c].adj,g[f]=1,g[h]=1,a[f]||(a[f]={adj:{}}),g=a[c].adj,g[c]=1,g[h]=1,a[h]||(a[h]={adj:{}}),g=a[c].adj,g[c]=1,g[f]=1;var m=d(c,f)+'_'+b(c,f),n=d(f,h)+'_'+b(f,h),j=d(h,c)+'_'+b(h,c);e[m]?delete e[m]:e[m]=1,e[n]?delete e[n]:e[n]=1,e[j]?delete e[j]:e[j]=1}for(var s in e){var r=s.split('_'),t=r[0],u=r[1];a[t].bound=1,a[u].bound=1}for(var p=0;p<15;p++)l=y(l,a);return i.vertices=l,i.computeFaceNormals(),i}function w(o,q,p){var h=new a.Geometry,j=h.vertices;for(var b=p-1;b>=0;b--){var g=o+f(1e3*b)*q,i=e*k(),d=e*2*k(),m=g*f(i)*c(d),l=g*f(d),n=g*c(i)*c(d);j.push(new a.Vector3(m,l,n))}return h}function q(){try{var a=document.createElement('canvas'),b=a.getContext('webgl')||a.getContext('experimental-webgl');if(!b)throw'您的浏览器不支持webgl'}catch(a){alert('您的浏览器不支持webgl')}}function D(a){return typeof a==='function'?a:a==='sphere'?Sphere.project:void 0}function u(a){return a===null||a===undefined}function t(d,a){a=u(a)?.9:a;var e=d.getContext('2d'),f=e.getImageData(0,0,d.width,d.height),b=f.data,h=b.length,g;for(var c=0;c<h/4;c++)g=c*4+3,b[g]=b[g]*a;e.putImageData(f,0,0)}function x(a,c){typeof a==='String'&&(a=parseFloat(a));var b=c?Math.pow(10,c):1;return Math.floor(a*b)/b}function C(g,a,h){var b='',c=a,d=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];g&&(c=Math.round(Math.random()*(h-a))+a);for(var e=0;e<c;e++){var f=Math.round(Math.random()*(d.length-1));b+=d[f]}return b}var a=require('three'),j=require('aliyun-common-utils'),c=Math.cos,f=Math.sin,m=Math.atan2,l=Math.asin,h=Math.sqrt,k=Math.random,g=Math.pow,d=Math.min,n=Math.tan,e=Math.PI,o=Math.log,b=Math.max;q(),module.exports=j.extend(j,{genSphereParticles:w,getAreaTriangle3d:A,subdivideOnSphere:z,laplacian:r,getLatlngSphere:B,mercator:s,sphere:v,getPt:p,getScreenPt:p,detect:q,darken:t,parseNumber:x,randomWord:C})
'use strict';function p(c){c.originalEvent&&(c=c.originalEvent);var d=c.target,e=d.offsetWidth,f=d.offsetHeight,g=d.offsetLeft,h=d.offsetTop,a,b;if(c.type.indexOf('mouse')!==-1)return a=c.x||c.pageX,b=c.y||c.pageY,[a-g,b-h,'mouse'];var i=window.event.touches[0];return a=i.pageX-g,b=i.pageY-h,a=a<e?a:e,a=a>0?a:1,b=b<f?b:f,b=b>0?b:1,[a,b,'touch']}function s(g,h,b,c,d,f){return c=c||0,d=d||0,f=f||0,b=b||6378137,new a.Vector3(g/180*e*b+c,d,-b*o(n((90+h)*e/360))+f)}function v(o,p,b,h,i,g){var j=1;h=h||0,i=i||0,g=g||0,b=b||1;var k=-o*e/180,d=p*e/180,n=b*c(k)*c(d)*j+h,l=b*f(k)*c(d)*j+g,m=b*f(d)+i;return new a.Vector3(n,m,l)}function B(j,n,k,b,c,a,d){c=c||0,a=a||0,d=d||0,b=b||1;var i=j-c,g=n-a,h=k-d,f=l(g/b),e=m(h,i);return{lat:f,lng:e}}function A(c,a,d){var e=a.x-c.x,f=a.y-c.y,i=a.z-c.z,k=d.x-a.x,j=d.y-a.y,b=d.z-a.z;return.5*h(g(f*b-i*j,2)+g(e*b-i*k,2)+g(e*j-f*b,2))}function i(f,i,j,k,l){var c=f.x-j,d=f.y-k,e=f.z-l,g=h(c*c+d*d+e*e),b=g<i?i/g:1;return new a.Vector3(j+c*b,k+d*b,l+e*b)}function z(f,A){var B=A.x0,s=A.y0,z=A.z0,v=A.radius,e={},H=f.faces,n=[],c=f.vertices;for(var t=H.length-1;t>=0;t--){var j=H[t],k=j.a,g=j.b,h=j.c,o=j.normal,q=j.color,p=j.materialIndex,G=c[k],F=c[g],E=c[h],r,l,m,C=d(k,g)+'_'+b(k,g);if(!e[C]){var y=new a.Vector3().addVectors(G,F).divideScalar(2);y=i(y,v,B,s,z),r=e[C]=c.length,c.push(y)}else r=e[C];var x=d(g,h)+'_'+b(g,h);if(!e[x]){var w=new a.Vector3().addVectors(F,E).divideScalar(2);w=i(w,B,s,z,v);var l=e[x]=c.length;c.push(w)}else l=e[x];var u=d(k,h)+'_'+b(k,h);if(!e[u]){var D=new a.Vector3().addVectors(E,G).divideScalar(2);D=i(D,B,s,z,v);var m=e[u]=c.length;c.push(D)}else m=e[u];var J=new a.Face3(k,r,m,o,q,p),K=new a.Face3(r,g,l,o,q,p),L=new a.Face3(m,l,h,o,q,p),I=new a.Face3(r,l,m,o,q,p);n.push(J),n.push(K),n.push(L),n.push(I)}return f.vertices=c,f.faces=n,f.computeFaceNormals(),f.computeVertexNormals(),console.log(f),f}function y(f,l){var b=[];for(var d in f){var e=l[d],h=e.bound;if(h)b.push(f[d]);else{var i=e.adj,c=new a.Vector3(0,0,0),g=0;for(var k in i){var j=f[k];c.add(j),g++}c.divideScalar(g),b.push(c)}}return b}function r(i){var q=i.faces,l=i.vertices,a={},e={},g;for(var k=0;k<q.length;k++){var o=q[k],c=o.a,f=o.b,h=o.c;a[c]||(a[c]={adj:{}}),g=a[c].adj,g[f]=1,g[h]=1,a[f]||(a[f]={adj:{}}),g=a[c].adj,g[c]=1,g[h]=1,a[h]||(a[h]={adj:{}}),g=a[c].adj,g[c]=1,g[f]=1;var m=d(c,f)+'_'+b(c,f),n=d(f,h)+'_'+b(f,h),j=d(h,c)+'_'+b(h,c);e[m]?delete e[m]:e[m]=1,e[n]?delete e[n]:e[n]=1,e[j]?delete e[j]:e[j]=1}for(var s in e){var r=s.split('_'),t=r[0],u=r[1];a[t].bound=1,a[u].bound=1}for(var p=0;p<15;p++)l=y(l,a);return i.vertices=l,i.computeFaceNormals(),i}function w(o,q,p){var h=new a.Geometry,j=h.vertices;for(var b=p-1;b>=0;b--){var g=o+f(1e3*b)*q,i=e*k(),d=e*2*k(),m=g*f(i)*c(d),l=g*f(d),n=g*c(i)*c(d);j.push(new a.Vector3(m,l,n))}return h}function q(){try{var a=document.createElement('canvas'),b=a.getContext('webgl')||a.getContext('experimental-webgl');if(!b)throw'您的浏览器不支持webgl'}catch(a){alert('您的浏览器不支持webgl')}}function D(a){return typeof a==='function'?a:a==='sphere'?Sphere.project:void 0}function u(a){return a===null||a===undefined}function t(d,a){a=u(a)?.9:a;var e=d.getContext('2d'),f=e.getImageData(0,0,d.width,d.height),b=f.data,h=b.length,g;for(var c=0;c<h/4;c++)g=c*4+3,b[g]=b[g]*a;e.putImageData(f,0,0)}function x(a,c){typeof a==='String'&&(a=parseFloat(a));var b=c?Math.pow(10,c):1;return Math.floor(a*b)/b}function C(g,a,h){var b='',c=a,d=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];g&&(c=Math.round(Math.random()*(h-a))+a);for(var e=0;e<c;e++){var f=Math.round(Math.random()*(d.length-1));b+=d[f]}return b}var a=require('../three'),j=require('aliyun-common-utils'),c=Math.cos,f=Math.sin,m=Math.atan2,l=Math.asin,h=Math.sqrt,k=Math.random,g=Math.pow,d=Math.min,n=Math.tan,e=Math.PI,o=Math.log,b=Math.max;q(),module.exports=j.extend(j,{genSphereParticles:w,getAreaTriangle3d:A,subdivideOnSphere:z,laplacian:r,getLatlngSphere:B,mercator:s,sphere:v,getPt:p,getScreenPt:p,detect:q,darken:t,parseNumber:x,randomWord:C})

@@ -1,1 +0,1 @@

var a=require('aliyun-map-utils'),b=require('three');module.exports={init:function(a){a.fileBase&&(Model.fileBase=a.fileBase),a.severBase&&(Model.severBase=a.severBase)},Map:require('./map/map'),Globe:require('./layer/globe'),Sky:require('./layer/sky'),Solar:require('./layer/solar'),Areas:require('./layer/areas'),Scatter:require('./layer/scatter'),FlyingLine:require('./layer/flying_line'),FlyingLines:require('./layer/flying_lines'),FlyingTubes:require('./layer/flyling_tube/flying_tubes'),FlowField:require('./layer/flow_field/flow_field'),FlowCanvas:require('./layer/flow_field_canvas/flows_field'),DataPool:require('./core/data_pool'),Utils:a,THREE:b}
const a=require('aliyun-map-utils');const b=require('./three');module.exports={init:function(a){a.fileBase&&(Model.fileBase=a.fileBase),a.severBase&&(Model.severBase=a.severBase)},Map:require('./map/map'),Globe:require('./layer/globe'),Sky:require('./layer/sky'),Solar:require('./layer/solar'),Areas:require('./layer/areas'),Scatter:require('./layer/scatter'),FlyingLine:require('./layer/flying_line'),FlyingLines:require('./layer/flying_lines'),FlyingTubes:require('./layer/flyling_tube/flying_tubes'),FlowField:require('./layer/flow_field/flow_field'),FlowCanvas:require('./layer/flow_field_canvas/flows_field'),DataPool:require('./core/data_pool'),Utils:a,THREE:b}

@@ -1,1 +0,1 @@

'use strict';function f(a,b,c){return typeof a==='function'?a(b,c):a}function b(a){a=this.options=c.deepMerge(b.options,a)}var a=require('three'),c=require('bcore/utils'),d=require('bcore/event'),e=require('lodash');b.options={isVisible:!0,width:200,height:100,style:{offsetLeft:30,fontSize:25,color:'#fff',background:'rgba(240,0,0,0)',opacity:function(){return 1}},scaleSize:1e6},b=d.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.three3D=a.three3D,this.init()},init:function(){var b=this.options,c=this.canvas=document.createElement('canvas'),h=this.ctx=c.getContext('2d');c.width=b.width,c.height=b.height;var f=this.texture=new a.Texture(c),g=this.material=new a.SpriteMaterial({map:f,opacity:1,transparent:!0,depthTest:!0,fog:!1}),d=b.scaleSize,e=this.object=new a.Sprite(g);e.scale.set(d,d*b.height/b.width),this.three3D.add(e)},updatePos:function(a){this.position=a,this.object.position.set(a.x,a.y,a.z)},clear:function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},updateTexture:function(d){if(this.clear(),!d)return;var d=this.content=d,l=this,b=this.ctx,c=this.options,i=c.type,g=c.style;b.canvas.height=c.height,b.canvas.width=c.width;var n=b.canvas.width,o=b.canvas.height;if(c.updateCtx)return c.updateCtx(b);if(i==='text'){b.fillStyle=g.background,b.font=g.fontSize+'px Arial';var m=b.measureText(d);b.textBaseline='middle';var k=m.width,h=(n-k)/2;c.offsetLeft&&(h-=g.offsetLeft),b.fillRect(0,0,k+2*h,c.height),b.fillStyle=f(g.color),b.fillText(d,h,c.height/2,k),b.fill(),l.texture.needsUpdate=!0}else if(i==='image'){if(typeof d!=='string'){console.log('need urls of images');return}var j=new a.ImageLoader;j.setCrossOrigin('*'),j.crossOrigin='*',j.load(d,function(a){b.drawImage(a,0,0),l.texture.needsUpdate=!0})}else if(i==='dom'){if(!e.isPlainObject(d)){console.log('content must be object');return}this.drawHTML(b,d)}this.updateVisible()},drawHTML:function(c,b){var g=this,w=b.title||'标题',d=b.content||'这是正文',v=b.titleColor||'#FF0000',u=b.contentColor||'#000',n=b.width||400,s=b.height||300,j=b.titleFontSize||100,e=b.contentFontSize||80,l=b.fontFamily||'serif',p=b.bgImgUrl||'',o=b.paddingLeft||0,q=b.paddingRight||0,r=b.paddingTop||0,k=j,t=s-k,m,i,h,x,f=new a.ImageLoader;f.setCrossOrigin('*'),f.crossOrigin='*',f.load(p,function(s){c.drawImage(s,0,k,n,t),c.font=j+'px '+l,c.fillStyle=v,c.fillText(w,0,j),c.font=e+'px '+l,c.fillStyle=u,m=+(n-o-q)||1,d=d,h=d.split(''),x=h.length*e,i=Math.floor(m/e);for(var a=0;a<Math.ceil(x/m);a++){var b=a*i,f=(a+1)*i>=h.length?h.length:(a+1)*i,p=d.slice(b,f);c.fillText(p,o,r+e*(a+1))}g.texture.image=g.canvas,g.texture.needsUpdate=!0})},updateOptions:function(a){this.options=a,this.update()},updateScale:function(){var a=this.options,c=this.object,b=a.scaleSize;c.scale.set(b,b*a.height/a.width)},update:function(){this.updateVisible(),this.updateScale(),this.updateMaterial()},updateVisible:function(){var a=this.options,b=a.isVisible;b?this.show():this.hide()},show:function(){this.object.visible=!0},hide:function(){this.object.visible=!1},updateMaterial:function(){this.texture.needsUpdate=!0,this.material.needsUpdate=!0,this.material.map.needsUpdate=!0},updateOpacity:function(){var a=this._map.three3D.camera,b=a.position,c=b.distanceTo(this.position),d=this._map.projection.radius,e=this.options,f=e.style.opacity(c/d);this.material.opacity=f},remove:function(){this.three3D.remove(this.object),this.object&&this.object.dispose&&this.object.dispose(),this.material&&this.material.dispose(),this.texture&&this.texture.dispose(),this.object=null,this.material=null,this.texture=null}}),module.exports=b
'use strict';function f(a,b,c){return typeof a==='function'?a(b,c):a}function b(a){a=this.options=c.deepMerge(b.options,a)}var a=require('../../three'),c=require('bcore/utils'),d=require('bcore/event'),e=require('lodash');b.options={isVisible:!0,width:200,height:100,style:{offsetLeft:30,fontSize:25,color:'#fff',background:'rgba(240,0,0,0)',opacity:function(){return 1}},scaleSize:1e6},b=d.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.three3D=a.three3D,this.init()},init:function(){var b=this.options,c=this.canvas=document.createElement('canvas'),h=this.ctx=c.getContext('2d');c.width=b.width,c.height=b.height;var f=this.texture=new a.Texture(c),g=this.material=new a.SpriteMaterial({map:f,opacity:1,transparent:!0,depthTest:!0,fog:!1}),d=b.scaleSize,e=this.object=new a.Sprite(g);e.scale.set(d,d*b.height/b.width),this.three3D.add(e)},updatePos:function(a){this.position=a,this.object.position.set(a.x,a.y,a.z)},clear:function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},updateTexture:function(d){if(this.clear(),!d)return;var d=this.content=d,l=this,b=this.ctx,c=this.options,i=c.type,g=c.style;b.canvas.height=c.height,b.canvas.width=c.width;var n=b.canvas.width,o=b.canvas.height;if(c.updateCtx)return c.updateCtx(b);if(i==='text'){b.fillStyle=g.background,b.font=g.fontSize+'px Arial';var m=b.measureText(d);b.textBaseline='middle';var k=m.width,h=(n-k)/2;c.offsetLeft&&(h-=g.offsetLeft),b.fillRect(0,0,k+2*h,c.height),b.fillStyle=f(g.color),b.fillText(d,h,c.height/2,k),b.fill(),l.texture.needsUpdate=!0}else if(i==='image'){if(typeof d!=='string'){console.log('need urls of images');return}var j=new a.ImageLoader;j.setCrossOrigin('*'),j.crossOrigin='*',j.load(d,function(a){b.drawImage(a,0,0),l.texture.needsUpdate=!0})}else if(i==='dom'){if(!e.isPlainObject(d)){console.log('content must be object');return}this.drawHTML(b,d)}this.updateVisible()},drawHTML:function(c,b){var g=this,w=b.title||'标题',d=b.content||'这是正文',v=b.titleColor||'#FF0000',u=b.contentColor||'#000',n=b.width||400,s=b.height||300,j=b.titleFontSize||100,e=b.contentFontSize||80,l=b.fontFamily||'serif',p=b.bgImgUrl||'',o=b.paddingLeft||0,q=b.paddingRight||0,r=b.paddingTop||0,k=j,t=s-k,m,i,h,x,f=new a.ImageLoader;f.setCrossOrigin('*'),f.crossOrigin='*',f.load(p,function(s){c.drawImage(s,0,k,n,t),c.font=j+'px '+l,c.fillStyle=v,c.fillText(w,0,j),c.font=e+'px '+l,c.fillStyle=u,m=+(n-o-q)||1,d=d,h=d.split(''),x=h.length*e,i=Math.floor(m/e);for(var a=0;a<Math.ceil(x/m);a++){var b=a*i,f=(a+1)*i>=h.length?h.length:(a+1)*i,p=d.slice(b,f);c.fillText(p,o,r+e*(a+1))}g.texture.image=g.canvas,g.texture.needsUpdate=!0})},updateOptions:function(a){this.options=a,this.update()},updateScale:function(){var a=this.options,c=this.object,b=a.scaleSize;c.scale.set(b,b*a.height/a.width)},update:function(){this.updateVisible(),this.updateScale(),this.updateMaterial()},updateVisible:function(){var a=this.options,b=a.isVisible;b?this.show():this.hide()},show:function(){this.object.visible=!0},hide:function(){this.object.visible=!1},updateMaterial:function(){this.texture.needsUpdate=!0,this.material.needsUpdate=!0,this.material.map.needsUpdate=!0},updateOpacity:function(){var a=this._map.three3D.camera,b=a.position,c=b.distanceTo(this.position),d=this._map.projection.radius,e=this.options,f=e.style.opacity(c/d);this.material.opacity=f},remove:function(){this.three3D.remove(this.object),this.object&&this.object.dispose&&this.object.dispose(),this.material&&this.material.dispose(),this.texture&&this.texture.dispose(),this.object=null,this.material=null,this.texture=null}}),module.exports=b

@@ -1,1 +0,1 @@

'use strict';function b(c){c=this.options=a.deepMerge(b.options,c),this.markers={}}var a=require('./../../core/utils'),e=a.mercator,f=a.sphere,c=require('./marker'),g=require('lodash'),h=a.isNone,i=require('three'),a=require('bcore/utils'),d=require('bcore/event');b.options={isAble:!0,markerN:100,isDynamic:!0,texture:function(a){return a.text},fog:!0,ratio:1.1,marker:{depthTest:!0,scaleSize:15e5,quality:3,style:{offsetLeft:30,fontSize:55,color:'#0ff',background:'rgba(0,0,0,0)'}},lat:function(a){return a.latlngs.lat},lng:function(a){return a.latlngs.lng},width:function(a){return a.content.width||900},height:function(a){return a.content.height||300},id:function(a,b){return a.id||b}},b=d.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.three3D=a.three3D,this.projection=a.projection},onUpdate:function(a){if(typeof a!=='function')return console.log('必须是函数');this._updateCtx=this._opt.updateCtx=a},remove:function(){var b,a=this.markers;for(var c in a)b=a[c],b.remove();this._data=null,b=null,a=null},clean:function(){var a=this.markers;if(a)for(var b in a){var c=a[b];c.remove(),delete a[b]}},data:function(a){this._data=a},draw:function(){var h=this._data;if(!h)return;var m=this.projection,p=this._map,j=this.markers,f=this.getChildOptions(),a=this.options,g=a.ratio,u=a.texture,v=a.id,l=a.lat,q=a.lng,n=a.width,o=a.height,b,k,r,s,t,d,e;for(var i in h)b=h[i],k=v(b,i),r=u(b),s=l(b),t=q(b),e=m.project({lng:t,lat:s}),e.x=e.x*g,e.y=e.y*g,e.z=e.z*g,f.isVisible=a.isAble,f.type=b.type||'text',f.width=n(b)||900,f.height=o(b)||300,d=j[k],d||(d=new c(f),d.addTo(p),j[k]=d),d.updateOptions(f),d.updateTexture(r),d.updatePos(e,b)},each:function(b){var c,a=this.markers;for(var d in a)c=a[d],b&&b(c)},update:function(){this.each(function(a){a&&a.update()})},getChildOptions:function(){var a=this.options;return a.marker},updateOptions:function(b){b&&(this.options=a.deepMerge(this.options,b)),this.draw();var c=this.getChildOptions();c.isVisible=b.isAble,this.each(function(a){a.updateOptions(c)}.bind(this))},render:function(a){a&&this.data(a),this.clean(),this.draw()}}),module.exports=b
'use strict';function b(c){c=this.options=a.deepMerge(b.options,c),this.markers={}}var a=require('./../../core/utils'),e=a.mercator,f=a.sphere,c=require('./marker'),g=require('lodash'),h=a.isNone,i=require('../../three'),a=require('bcore/utils'),d=require('bcore/event');b.options={isAble:!0,markerN:100,isDynamic:!0,texture:function(a){return a.text},fog:!0,ratio:1.1,marker:{depthTest:!0,scaleSize:15e5,quality:3,style:{offsetLeft:30,fontSize:55,color:'#0ff',background:'rgba(0,0,0,0)'}},lat:function(a){return a.latlngs.lat},lng:function(a){return a.latlngs.lng},width:function(a){return a.content.width||900},height:function(a){return a.content.height||300},id:function(a,b){return a.id||b}},b=d.extend(b,{addTo:function(a){if(!a)return;this._map=a,this.three3D=a.three3D,this.projection=a.projection},onUpdate:function(a){if(typeof a!=='function')return console.log('必须是函数');this._updateCtx=this._opt.updateCtx=a},remove:function(){var b,a=this.markers;for(var c in a)b=a[c],b.remove();this._data=null,b=null,a=null},clean:function(){var a=this.markers;if(a)for(var b in a){var c=a[b];c.remove(),delete a[b]}},data:function(a){this._data=a},draw:function(){var h=this._data;if(!h)return;var m=this.projection,p=this._map,j=this.markers,f=this.getChildOptions(),a=this.options,g=a.ratio,u=a.texture,v=a.id,l=a.lat,q=a.lng,n=a.width,o=a.height,b,k,r,s,t,d,e;for(var i in h)b=h[i],k=v(b,i),r=u(b),s=l(b),t=q(b),e=m.project({lng:t,lat:s}),e.x=e.x*g,e.y=e.y*g,e.z=e.z*g,f.isVisible=a.isAble,f.type=b.type||'text',f.width=n(b)||900,f.height=o(b)||300,d=j[k],d||(d=new c(f),d.addTo(p),j[k]=d),d.updateOptions(f),d.updateTexture(r),d.updatePos(e,b)},each:function(b){var c,a=this.markers;for(var d in a)c=a[d],b&&b(c)},update:function(){this.each(function(a){a&&a.update()})},getChildOptions:function(){var a=this.options;return a.marker},updateOptions:function(b){b&&(this.options=a.deepMerge(this.options,b)),this.draw();var c=this.getChildOptions();c.isVisible=b.isAble,this.each(function(a){a.updateOptions(c)}.bind(this))},render:function(a){a&&this.data(a),this.clean(),this.draw()}}),module.exports=b

@@ -1,1 +0,1 @@

'use strict';function l(a,b){return typeof a==='function'?a(arguments[1],arguments[2],arguments[3],arguments[4]):a}function m(a,b,c){return typeof a==='function'?a(b,c):a}function j(a,b){return typeof a==='function'?a(b):a}function n(d,e){var c=d.faces,b=g.parse(e).arr;setTimeout(function(){var g;for(var e=0;e<c.length;e++){var g=c[e],h=Math.abs(Math.cos(e/10)),f=new a.Color('rgb('+b[0]+', '+Math.floor(b[1]+h*30)+', '+Math.floor(b[2]+50*h)+')');g.vertexColors.push(f,f,f)}d.colorsNeedUpdate=!0},10)}function b(a){this.options=c.deepMerge(b.options,a)}function d(a){return a===undefined?!1:!0}var a=require('three'),c=require('./../core/utils'),e=c.divideby,h=c.traver,d=c.isNone,g=c.format,f=require('./../map/projection/mecator'),k=c.getColorFunc,i=c.switchValue;b.options={geoid:function(b){if(b.id)return b.id;var a=b.properties;return a?a.id||a.adcode:void 0},lat:function(a){return a[1]},lng:function(a){return a[0]},value:function(a){return a&&a.value?a.value||0:a},id:function(a,b){return a.id||a.adcode||b},offset:function(){return{x:0,y:0,z:0}},ratio:1,shape:{fill:{type:'texture',url:''},stroke:null}},b.prototype.addTo=function(a){this._map=a,this.projection=a.projection,this.three3D=a.three3D},b.prototype.render=function(a){a&&this.data(a),this.draw()},b.prototype.data=function(a){if(!a)return;this.processing(a)},b.prototype.processing=function(f){var b,c,a,k,g,i=this.options.value,j=this.options.id,h={};for(var e in f)g=f[e],k=j(g,e),a=i(f[e]),h[k]=g,c=d(c)?a:c,b=d(b)?a:b,a>c&&(c=a),a<b&&(b=a);this.vMax=c,this.vMin=b,this._data=h},b.prototype.draw=function(){var a=this._data,c=this.options.id,d=this.geo,g,e,f;for(var b in a)e=a[b],f=c(e,b),g=d[f];this.updateFill(),this.updateStroke()},b.prototype.geoJson=function(n){var d=this.options,f=this;if(!n)return console.log('没有geojson');var g=this.options.shape,m=this.projection,q=g.fill,e=g.stroke;if(e)var l=this.genStroke(e);var i=this.geo=this.geo||{},c,k,o,b,a,p=this.traverArray.bind(this);h(n,function(t,q,g){if(t!=='geometry')return!0;if(k=d.geoid(g),a=i[k]=i[k]||{},c=g.properties,b=q.coordinate||g.cp||c.cp||c.coordinate,b){a.cp=b;var r=b.lat||b[0],s=b.lng||b[1];a.cp3D=m.project({lng:s,lat:r},1)}var h=c.cName||c.name;h&&(a.cName=h),e&&(l(a),a.strokeMesh=[]),f.fillFunc(a,function(a){a.fillMesh=[],p(o,a,n),f.updateScale()});var n;return d.offset?n=j(d.offset,c):n={x:0,y:0,z:0},o=q.coordinates,!1})},b.prototype.traverArray=function(a,c,d){for(var b in a)if(typeof a[b][0]!=='object'){this.pts2Mesh.bind(this)(a,c,d);break}else this.traverArray.bind(this)(a[b],c,d)},b.prototype.pts2Mesh=function(k,e,i){var l=this.projection,f=this.pts2MeshGeo(k,e);if(f){var h=this.three3D,c=f.fillGeometry,g=f.strokeGeometry;if(c){var d=e.material;if(!d)return;var b;typeof d==='function'?(b=d(c),c.buffersNeedUpdate=!0,c.uvsNeedUpdate=!0,c.computeFaceNormals()):typeof d==='object'&&(b=new a.Mesh(c,d)),b.position.set(i.x,i.y,i.z),h.add(b),e.fillMesh.push(b)}if(g){var j=e.strokeMaterial;g.computeLineDistances();var b;b=new a.Line(g,j),b.position.set(0,0,0),h.add(b),e.strokeMesh.push(b)}}},b.prototype.pts2MeshGeo=function(r,E){var A=this.projection,m=this.options,q=m.shape,C=q.stroke,D=q.fill,l=q.divide,s=new a.Shape,k=[],b,w,i,j,x,B=m.lat,z=m.lng,t=1e-5,u=1e-5,n,o;if(r.length<3)return console.log('less 3pts');for(var h=0;h<r.length;h++)n=B(r[h]),l&&(n=e(n,l)),o=z(r[h]),l&&(o=e(o,l)),b=A.project({lng:o,lat:n},m.ratio),w=f.project({lng:o,lat:n}),i=w.x,j=w.z,x=!d(i)&&!d(j),h===0&&x&&(s.moveTo(-j,-i),k.push(b),t=i,u=j),h!==0&&(t!==i||u!==j)&&x&&(s.lineTo(-j,-i),k.push(b),t=i,u=j);var p,g;if(k.length){var v,y;if(D){y=new a.ShapeGeometry(s),p=y.vertices;for(var c=0;c<p.length;c++)b=k[c],g=p[c],g&&b&&(g.x=b.x,g.z=b.z,g.y=b.y)}if(C){v=new a.Geometry,p=v.vertices;for(var c=0;c<k.length;c++)b=k[c],g=new a.Vector3,g.x=b.x,g.z=b.z,g.y=b.y,p.push(g)}return{strokeGeometry:v,fillGeometry:y}}return!1},b.prototype.hide=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!1;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!1})},b.prototype.show=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!0;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!0})},b.prototype.updateScale=function(){var a,b=this.options.ratio;this.each(function(d){if(a=d.fillMesh,a)for(var c in a)a[c].scale.set(b,b,b);if(a=d.strokeMesh,a)for(var c in a)a[c].scale.set(b,b,b)})},b.prototype.fillFunc=function(e,f){var c=this,d=this.options,g=d.shape.fill.url,h=d.shape.fill.mediumUrl,i=d.shape.fill.smallUrl,b=new a.TextureLoader;b.setCrossOrigin('*'),b.crossOrigin='*',b.load(g,function(d){b.load(i,function(g){b.load(h,function(b){var h=new a.MeshBasicMaterial({map:d,side:a.DoubleSide,overdraw:!0,blending:a.AdditiveBlending});d.minFilter=a.LinearFilter,d.wrapS=d.wrapT=a.RepeatWrapping,h.map.needsUpdate=!0;var i=new a.MeshBasicMaterial({map:b,side:a.DoubleSide,overdraw:!0,blending:a.AdditiveBlending});b.minFilter=a.LinearFilter,b.wrapS=b.wrapT=a.RepeatWrapping,i.map.needsUpdate=!0;var j=new a.MeshBasicMaterial({map:g,side:a.DoubleSide,overdraw:!0,blending:a.AdditiveBlending});g.minFilter=a.LinearFilter,g.wrapS=g.wrapT=a.RepeatWrapping,j.map.needsUpdate=!0,e.material=function(b){if(b.faces.length<70){var d=new a.Mesh(b,j);return c.uvGenerator(b),d}else if(b.faces.length>100){var d=new a.Mesh(b,h);return c.uvGenerator(b),d}else{var d=new a.Mesh(b,i);return c.uvGenerator(b),d}},f&&f(e)})})})},b.prototype.uvGenerator=function(b){b.computeBoundingBox();var i=b.boundingBox.max,g=b.boundingBox.min,o=i.x,q=i.y,p=i.z,e=g.x,r=g.y,d=g.z,j=o-e,f=p-d,l=new a.Vector2(0,0),m=new a.Vector2(0,0),n=new a.Vector2(0,0);b.faceVertexUvs[0]=[];for(var k=0;k<b.faces.length;++k){var h=b.faces[k],c=b.vertices[h.a];l.set((c.z-d)/f,(c.x-e)/j),c=b.vertices[h.b],m.set((c.z-d)/f,(c.x-e)/j),c=b.vertices[h.c],n.set((c.z-d)/f,(c.x-e)/j),b.faceVertexUvs[0].push([l.clone(),m.clone(),n.clone()])}b.uvsNeedUpdate=!0},b.prototype.update=function(){this.updateFill(),this.updateStroke()},b.prototype.updateFill=function(){var a=this.options,b=a.shape,c=a.value,d=b.fill;return void 0},b.prototype.updateStroke=function(){var k=this.options.shape,c=k.stroke;if(!c)return;var r=c.color,f=this.geo,p=this._data;for(var g in f){var j=f[g],m=p[g],h=j.strokeMesh;for(var n in h){var o=h[n],d=o.material,q=l(r,m),e=new a.Color(q);d.color.setRGB(e.r,e.g,e.b);var b=c.opacity;(b===null||b===undefined)&&(b=1),d.opacity=b,d.linewidth=i(c.linewidth)}}},b.prototype.updateOptions=function(a){this.options=c.deepMerge(this.options,a),this.updateStroke(),this.updateFill(),this.updateScale()},b.prototype.each=function(d){var a=this.geo;for(var b in a){var c=a[b];d(c)}},b.prototype.genStroke=function(b){if(typeof b==='function')return b;var d=this.options.shape.stroke,h=b.type||'default',e=b.color||16777215,c=b.opacity,f=b.width||b.linewidth||.01,g=c?!0:!1;return{dash:function(b){b.strokeMaterial=new a.LineDashedMaterial({linewidth:f,color:e,dashSize:d.dashSize,gapSize:d.gapSize,transparent:g,opacity:c,linejoin:'round',linecap:'round'})},default:function(b){b.strokeMaterial=new a.LineBasicMaterial({linewidth:f,color:e,transparent:g,opacity:c,linejoin:'round',linecap:'round'})}}[h]},b.prototype.loop=function(){},b.prototype.geojson=b.prototype.geoJson,module.exports=b
'use strict';function l(a,b){return typeof a==='function'?a(arguments[1],arguments[2],arguments[3],arguments[4]):a}function m(a,b,c){return typeof a==='function'?a(b,c):a}function j(a,b){return typeof a==='function'?a(b):a}function n(d,e){var c=d.faces,b=g.parse(e).arr;setTimeout(function(){var g;for(var e=0;e<c.length;e++){var g=c[e],h=Math.abs(Math.cos(e/10)),f=new a.Color('rgb('+b[0]+', '+Math.floor(b[1]+h*30)+', '+Math.floor(b[2]+50*h)+')');g.vertexColors.push(f,f,f)}d.colorsNeedUpdate=!0},10)}function b(a){this.options=c.deepMerge(b.options,a)}function d(a){return a===undefined?!1:!0}var a=require('../three'),c=require('./../core/utils'),e=c.divideby,h=c.traver,d=c.isNone,g=c.format,f=require('./../map/projection/mecator'),k=c.getColorFunc,i=c.switchValue;b.options={geoid:function(b){if(b.id)return b.id;var a=b.properties;return a?a.id||a.adcode:void 0},lat:function(a){return a[1]},lng:function(a){return a[0]},value:function(a){return a&&a.value?a.value||0:a},id:function(a,b){return a.id||a.adcode||b},offset:function(){return{x:0,y:0,z:0}},ratio:1,shape:{fill:{type:'texture',url:''},stroke:null}},b.prototype.addTo=function(a){this._map=a,this.projection=a.projection,this.three3D=a.three3D},b.prototype.render=function(a){a&&this.data(a),this.draw()},b.prototype.data=function(a){if(!a)return;this.processing(a)},b.prototype.processing=function(f){var b,c,a,k,g,i=this.options.value,j=this.options.id,h={};for(var e in f)g=f[e],k=j(g,e),a=i(f[e]),h[k]=g,c=d(c)?a:c,b=d(b)?a:b,a>c&&(c=a),a<b&&(b=a);this.vMax=c,this.vMin=b,this._data=h},b.prototype.draw=function(){var a=this._data,c=this.options.id,d=this.geo,g,e,f;for(var b in a)e=a[b],f=c(e,b),g=d[f];this.updateFill(),this.updateStroke()},b.prototype.geoJson=function(n){var d=this.options,f=this;if(!n)return console.log('没有geojson');var g=this.options.shape,m=this.projection,q=g.fill,e=g.stroke;if(e)var l=this.genStroke(e);var i=this.geo=this.geo||{},c,k,o,b,a,p=this.traverArray.bind(this);h(n,function(t,q,g){if(t!=='geometry')return!0;if(k=d.geoid(g),a=i[k]=i[k]||{},c=g.properties,b=q.coordinate||g.cp||c.cp||c.coordinate,b){a.cp=b;var r=b.lat||b[0],s=b.lng||b[1];a.cp3D=m.project({lng:s,lat:r},1)}var h=c.cName||c.name;h&&(a.cName=h),e&&(l(a),a.strokeMesh=[]),f.fillFunc(a,function(a){a.fillMesh=[],p(o,a,n),f.updateScale()});var n;return d.offset?n=j(d.offset,c):n={x:0,y:0,z:0},o=q.coordinates,!1})},b.prototype.traverArray=function(a,c,d){for(var b in a)if(typeof a[b][0]!=='object'){this.pts2Mesh.bind(this)(a,c,d);break}else this.traverArray.bind(this)(a[b],c,d)},b.prototype.pts2Mesh=function(k,e,i){var l=this.projection,f=this.pts2MeshGeo(k,e);if(f){var h=this.three3D,c=f.fillGeometry,g=f.strokeGeometry;if(c){var d=e.material;if(!d)return;var b;typeof d==='function'?(b=d(c),c.buffersNeedUpdate=!0,c.uvsNeedUpdate=!0,c.computeFaceNormals()):typeof d==='object'&&(b=new a.Mesh(c,d)),b.position.set(i.x,i.y,i.z),h.add(b),e.fillMesh.push(b)}if(g){var j=e.strokeMaterial;g.computeLineDistances();var b;b=new a.Line(g,j),b.position.set(0,0,0),h.add(b),e.strokeMesh.push(b)}}},b.prototype.pts2MeshGeo=function(r,E){var A=this.projection,m=this.options,q=m.shape,C=q.stroke,D=q.fill,l=q.divide,s=new a.Shape,k=[],b,w,i,j,x,B=m.lat,z=m.lng,t=1e-5,u=1e-5,n,o;if(r.length<3)return console.log('less 3pts');for(var h=0;h<r.length;h++)n=B(r[h]),l&&(n=e(n,l)),o=z(r[h]),l&&(o=e(o,l)),b=A.project({lng:o,lat:n},m.ratio),w=f.project({lng:o,lat:n}),i=w.x,j=w.z,x=!d(i)&&!d(j),h===0&&x&&(s.moveTo(-j,-i),k.push(b),t=i,u=j),h!==0&&(t!==i||u!==j)&&x&&(s.lineTo(-j,-i),k.push(b),t=i,u=j);var p,g;if(k.length){var v,y;if(D){y=new a.ShapeGeometry(s),p=y.vertices;for(var c=0;c<p.length;c++)b=k[c],g=p[c],g&&b&&(g.x=b.x,g.z=b.z,g.y=b.y)}if(C){v=new a.Geometry,p=v.vertices;for(var c=0;c<k.length;c++)b=k[c],g=new a.Vector3,g.x=b.x,g.z=b.z,g.y=b.y,p.push(g)}return{strokeGeometry:v,fillGeometry:y}}return!1},b.prototype.hide=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!1;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!1})},b.prototype.show=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!0;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!0})},b.prototype.updateScale=function(){var a,b=this.options.ratio;this.each(function(d){if(a=d.fillMesh,a)for(var c in a)a[c].scale.set(b,b,b);if(a=d.strokeMesh,a)for(var c in a)a[c].scale.set(b,b,b)})},b.prototype.fillFunc=function(e,f){var c=this,d=this.options,g=d.shape.fill.url,h=d.shape.fill.mediumUrl,i=d.shape.fill.smallUrl,b=new a.TextureLoader;b.setCrossOrigin('*'),b.crossOrigin='*',b.load(g,function(d){b.load(i,function(g){b.load(h,function(b){var h=new a.MeshBasicMaterial({map:d,side:a.DoubleSide,overdraw:!0,blending:a.AdditiveBlending});d.minFilter=a.LinearFilter,d.wrapS=d.wrapT=a.RepeatWrapping,h.map.needsUpdate=!0;var i=new a.MeshBasicMaterial({map:b,side:a.DoubleSide,overdraw:!0,blending:a.AdditiveBlending});b.minFilter=a.LinearFilter,b.wrapS=b.wrapT=a.RepeatWrapping,i.map.needsUpdate=!0;var j=new a.MeshBasicMaterial({map:g,side:a.DoubleSide,overdraw:!0,blending:a.AdditiveBlending});g.minFilter=a.LinearFilter,g.wrapS=g.wrapT=a.RepeatWrapping,j.map.needsUpdate=!0,e.material=function(b){if(b.faces.length<70){var d=new a.Mesh(b,j);return c.uvGenerator(b),d}else if(b.faces.length>100){var d=new a.Mesh(b,h);return c.uvGenerator(b),d}else{var d=new a.Mesh(b,i);return c.uvGenerator(b),d}},f&&f(e)})})})},b.prototype.uvGenerator=function(b){b.computeBoundingBox();var i=b.boundingBox.max,g=b.boundingBox.min,o=i.x,q=i.y,p=i.z,e=g.x,r=g.y,d=g.z,j=o-e,f=p-d,l=new a.Vector2(0,0),m=new a.Vector2(0,0),n=new a.Vector2(0,0);b.faceVertexUvs[0]=[];for(var k=0;k<b.faces.length;++k){var h=b.faces[k],c=b.vertices[h.a];l.set((c.z-d)/f,(c.x-e)/j),c=b.vertices[h.b],m.set((c.z-d)/f,(c.x-e)/j),c=b.vertices[h.c],n.set((c.z-d)/f,(c.x-e)/j),b.faceVertexUvs[0].push([l.clone(),m.clone(),n.clone()])}b.uvsNeedUpdate=!0},b.prototype.update=function(){this.updateFill(),this.updateStroke()},b.prototype.updateFill=function(){var a=this.options,b=a.shape,c=a.value,d=b.fill;return void 0},b.prototype.updateStroke=function(){var k=this.options.shape,c=k.stroke;if(!c)return;var r=c.color,f=this.geo,p=this._data;for(var g in f){var j=f[g],m=p[g],h=j.strokeMesh;for(var n in h){var o=h[n],d=o.material,q=l(r,m),e=new a.Color(q);d.color.setRGB(e.r,e.g,e.b);var b=c.opacity;(b===null||b===undefined)&&(b=1),d.opacity=b,d.linewidth=i(c.linewidth)}}},b.prototype.updateOptions=function(a){this.options=c.deepMerge(this.options,a),this.updateStroke(),this.updateFill(),this.updateScale()},b.prototype.each=function(d){var a=this.geo;for(var b in a){var c=a[b];d(c)}},b.prototype.genStroke=function(b){if(typeof b==='function')return b;var d=this.options.shape.stroke,h=b.type||'default',e=b.color||16777215,c=b.opacity,f=b.width||b.linewidth||.01,g=c?!0:!1;return{dash:function(b){b.strokeMaterial=new a.LineDashedMaterial({linewidth:f,color:e,dashSize:d.dashSize,gapSize:d.gapSize,transparent:g,opacity:c,linejoin:'round',linecap:'round'})},default:function(b){b.strokeMaterial=new a.LineBasicMaterial({linewidth:f,color:e,transparent:g,opacity:c,linejoin:'round',linecap:'round'})}}[h]},b.prototype.loop=function(){},b.prototype.geojson=b.prototype.geoJson,module.exports=b

@@ -1,1 +0,1 @@

'use strict';function e(a,b){return typeof a==='function'?a(arguments[1],arguments[2],arguments[3],arguments[4]):a}function h(a,b,c){return typeof a==='function'?a(b,c):a}function n(a,b){return typeof a==='function'?a(b):a}function m(d,e){var c=d.faces,a=j.parse(e).arr;setTimeout(function(){var g;for(var e=0;e<c.length;e++){var g=c[e],h=Math.abs(Math.cos(e/10)),f=new b.Color('rgb('+a[0]+', '+Math.floor(a[1]+h*30)+', '+Math.floor(a[2]+50*h)+')');g.vertexColors.push(f,f,f)}d.colorsNeedUpdate=!0},10)}function a(b){this.options=c.deepMerge(a.options,b)}function d(a){return a===undefined?!1:!0}var b=require('three'),c=require('./../core/utils'),g=c.divideby,i=c.traver,d=c.isNone,j=c.format,k=require('./../map/projection/mecator'),f=c.getColorFunc,l=c.switchValue;a.options={geoid:function(b){if(b.id)return b.id;var a=b.properties;return a?a.id||a.adcode:void 0},lat:function(a){return a[1]},lng:function(a){return a[0]},value:function(a){return a&&a.value?a.value||0:a},id:function(a,b){return a.id||a.adcode||b},offset:function(){return{x:0,y:0,z:0}},ratio:1,shape:{fill:{transparent:!1,type:'flat',colorBack:2236962,hue:360,colorFront:'#07c',opacity:1},stroke:null}},a.prototype.addTo=function(a){this._map=a,this.projection=a.projection,this.three3D=a.three3D},a.prototype.render=function(a){a&&this.data(a),this.draw()},a.prototype.data=function(a){if(!a)return;this.processing(a)},a.prototype.processing=function(f){var b,c,a,k,g,i=this.options.value,j=this.options.id,h={};for(var e in f)g=f[e],k=j(g,e),a=i(f[e]),h[k]=g,c=d(c)?a:c,b=d(b)?a:b,a>c&&(c=a),a<b&&(b=a);this.vMax=c,this.vMin=b,this._data=h},a.prototype.draw=function(){var a=this._data,c=this.options.id,d=this.geo,g,e,f;for(var b in a)e=a[b],f=c(e,b),g=d[f];this.updateFill(),this.updateStroke()},a.prototype.geoJson=function(p){this.remove();var d=this.options;if(!p)return console.log('没有geojson');var g=this.options.shape,m=this.projection,e=g.fill;if(e)var l=this.genFill(e);var f=g.stroke;if(f)var k=this.genStroke(f);var h=this.geo=this.geo||{},c,j,o,b,a,q=this.traverArray.bind(this);i(p,function(u,r,g){if(u!=='geometry')return!0;if(j=d.geoid(g),a=h[j]=h[j]||{},c=g.properties,b=r.coordinate||g.cp||c.cp||c.coordinate,b){a.cp=b;var s=b.lat||b[0],t=b.lng||b[1];a.cp3D=m.project({lng:t,lat:s},1)}var i=c.cName||c.name;i&&(a.cName=i),e&&(l(a),a.fillMesh=[]),f&&(k(a),a.strokeMesh=[]);var p;return d.offset?p=n(d.offset,c):p={x:0,y:0,z:0},o=r.coordinates,q(o,a,p),!1}),this.updateScale()},a.prototype.traverArray=function(a,c,d){for(var b in a)if(typeof a[b][0]!=='object'){this.pts2Mesh.bind(this)(a,c,d);break}else this.traverArray.bind(this)(a[b],c,d)},a.prototype.pts2Mesh=function(l,d,i){var j=this.projection,e=this.pts2MeshGeo(l,d);if(e){var h=this.three3D,f=e.fillGeometry,g=e.strokeGeometry;if(f){var c=d.material;if(!c)return;j.type==='sphere';var a;typeof c==='function'?a=c(f):typeof c==='object'&&(a=new b.Mesh(f,c)),a.position.set(i.x,i.y,i.z),h.add(a),d.fillMesh.push(a)}if(g){var k=d.strokeMaterial;g.computeLineDistances();var a;a=new b.Line(g,k),a.position.set(0,0,0),h.add(a),d.strokeMesh.push(a)}}},a.prototype.pts2MeshGeo=function(s,E){var D=this.projection,n=this.options,r=n.shape,C=r.stroke,B=r.fill,l=r.divide,q=new b.Shape,f=[],a,y,j,h,x,A=n.lat,z=n.lng,t=1e-5,u=1e-5,p,o;if(s.length<3)return console.log('less 3pts');for(var i=0;i<s.length;i++)p=A(s[i]),l&&(p=g(p,l)),o=z(s[i]),l&&(o=g(o,l)),a=D.project({lng:o,lat:p},n.ratio),y=k.project({lng:o,lat:p}),j=y.x,h=y.z,x=!d(j)&&!d(h),i===0&&x&&(q.moveTo(-h,-j),f.push(a),t=j,u=h),i!==0&&(t!==j||u!==h)&&x&&(q.lineTo(-h,-j),f.push(a),t=j,u=h);var m,c;if(f.length){if(B){var w=new b.ShapeGeometry(q);m=w.vertices;for(var e=0;e<m.length;e++)a=f[e],c=m[e],c&&a&&(c.x=a.x,c.z=a.z,c.y=a.y)}if(C){var v=new b.Geometry;m=v.vertices;for(var e=0;e<f.length;e++)a=f[e],c=new b.Vector3,c.x=a.x,c.z=a.z,c.y=a.y,m.push(c)}return{strokeGeometry:v,fillGeometry:w}}return!1},a.prototype.hide=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!1;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!1})},a.prototype.show=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!0;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!0})},a.prototype.updateScale=function(){var a,b=this.options.ratio;this.each(function(d){if(a=d.fillMesh,a)for(var c in a)a[c].scale.set(b,b,b);if(a=d.strokeMesh,a)for(var c in a)a[c].scale.set(b,b,b)})},a.prototype.genFill=function(a){if(typeof a==='function')return a;var g=this.options,j=this.projection,d=a.opacity,f={transparent:g.shape.fill.transparent},k=e(a.colorBack,0),l=e(a.colorFront,0);d=h(a.opacity,0);var n=c.extend({color:k,side:b.BackSide,vertexColors:b.VertexColors,opacity:d},f),o=c.extend({wireframe:!1,opacity:d,color:l,side:b.FrontSide,vertexColors:b.VertexColors},f),i=(a?a.type:'none')||'none';return{triangle:function(a){a.material=function(a){j.type==='mecator'&&m(a,g.shape.fill.colorFront);var c=new b.MeshPhongMaterial({vertexColors:b.VertexColors}),d=new b.MeshPhongMaterial({vertexColors:b.VertexColors});return b.SceneUtils.createMultiMaterialObject(a,[c,d])}},none:function(a){return a},flat:function(d){var a=new b.MeshBasicMaterial(n),c=new b.MeshBasicMaterial(o);d.material=function(d){return b.SceneUtils.createMultiMaterialObject(d,[a,c])}}}[i]},a.prototype.update=function(){this.updateFill(),this.updateStroke()},a.prototype.updateFill=function(){var q=this.options,C=q.shape,B=q.value,c=C.fill;if(!c)return;var A=f(c.colorFront),z=f(c.colorBack),w=this.vMax,l=this.vMin,t=this._data||{},n=this.geo;for(var o in n){var p=n[o],r=p.fillMesh,d=t[o],a=B(d);a&&(a=(a-l)/(w-l)||0);var y=A(a,d),u=z(a,d);for(var v in r){var k=r[v],x=k.children[0],s=k.children[1],j=x.material,i=s.material,m=h(c.opacity,d,p),g=new b.Color(u);j.color.setRGB(g.r,g.g,g.b),j.opacity=m;var e=new b.Color(y);i.color.setRGB(e.r,e.g,e.b),i.opacity=m}}},a.prototype.updateStroke=function(){var k=this.options.shape,c=k.stroke;if(!c)return;var r=c.color,g=this.geo,p=this._data;for(var h in g){var j=g[h],m=p[h],i=j.strokeMesh;for(var n in i){var o=i[n],d=o.material,q=e(r,m),f=new b.Color(q);d.color.setRGB(f.r,f.g,f.b);var a=c.opacity;(a===null||a===undefined)&&(a=1),d.opacity=a,d.linewidth=l(c.linewidth)}}},a.prototype.updateOptions=function(a){this.options=c.deepMerge(this.options,a),this.updateStroke(),this.updateFill(),this.updateScale()},a.prototype.each=function(d){var a=this.geo;for(var b in a){var c=a[b];d(c)}},a.prototype.genStroke=function(a){if(typeof a==='function')return a;var d=this.options.shape.stroke,h=a.type||'default',e=a.color||16777215,c=a.opacity,f=a.width||a.linewidth||.01,g=c?!0:!1;return{dash:function(a){a.strokeMaterial=new b.LineDashedMaterial({linewidth:f,color:e,dashSize:d.dashSize,gapSize:d.gapSize,transparent:g,opacity:c,linejoin:'round',linecap:'round'})},default:function(a){a.strokeMaterial=new b.LineBasicMaterial({linewidth:f,color:e,transparent:g,opacity:c,linejoin:'round',linecap:'round'})}}[h]},a.prototype.loop=function(){},a.prototype.remove=function(){var a,b,c,d=this.three3D;this.each(function(f){if(a=f.fillMesh,a)for(var e in a)c=a[e],d.remove(c),c&&c.children&&c.children.forEach(function(a){d.remove(a),a.dispose&&a.dispose(),a.material&&a.material.dispose(),a.geometry&&a.geometry.dispose()});if(a=f.strokeMesh,a)for(var e in a)b=a[e],d.remove(b),b.dispose&&b.dispose(),b.material&&b.material.dispose(),b.geometry&&b.geometry.dispose()}),a=null,b=null},a.prototype.geojson=a.prototype.geoJson,module.exports=a
'use strict';function e(a,b){return typeof a==='function'?a(arguments[1],arguments[2],arguments[3],arguments[4]):a}function h(a,b,c){return typeof a==='function'?a(b,c):a}function n(a,b){return typeof a==='function'?a(b):a}function m(d,e){var c=d.faces,a=j.parse(e).arr;setTimeout(function(){var g;for(var e=0;e<c.length;e++){var g=c[e],h=Math.abs(Math.cos(e/10)),f=new b.Color('rgb('+a[0]+', '+Math.floor(a[1]+h*30)+', '+Math.floor(a[2]+50*h)+')');g.vertexColors.push(f,f,f)}d.colorsNeedUpdate=!0},10)}function a(b){this.options=c.deepMerge(a.options,b)}function d(a){return a===undefined?!1:!0}var b=require('../three'),c=require('./../core/utils'),g=c.divideby,i=c.traver,d=c.isNone,j=c.format,k=require('./../map/projection/mecator'),f=c.getColorFunc,l=c.switchValue;a.options={geoid:function(b){if(b.id)return b.id;var a=b.properties;return a?a.id||a.adcode:void 0},lat:function(a){return a[1]},lng:function(a){return a[0]},value:function(a){return a&&a.value?a.value||0:a},id:function(a,b){return a.id||a.adcode||b},offset:function(){return{x:0,y:0,z:0}},ratio:1,shape:{fill:{transparent:!1,type:'flat',colorBack:2236962,hue:360,colorFront:'#07c',opacity:1},stroke:null}},a.prototype.addTo=function(a){this._map=a,this.projection=a.projection,this.three3D=a.three3D},a.prototype.render=function(a){a&&this.data(a),this.draw()},a.prototype.data=function(a){if(!a)return;this.processing(a)},a.prototype.processing=function(f){var b,c,a,k,g,i=this.options.value,j=this.options.id,h={};for(var e in f)g=f[e],k=j(g,e),a=i(f[e]),h[k]=g,c=d(c)?a:c,b=d(b)?a:b,a>c&&(c=a),a<b&&(b=a);this.vMax=c,this.vMin=b,this._data=h},a.prototype.draw=function(){var a=this._data,c=this.options.id,d=this.geo,g,e,f;for(var b in a)e=a[b],f=c(e,b),g=d[f];this.updateFill(),this.updateStroke()},a.prototype.geoJson=function(p){this.remove();var d=this.options;if(!p)return console.log('没有geojson');var g=this.options.shape,m=this.projection,e=g.fill;if(e)var l=this.genFill(e);var f=g.stroke;if(f)var k=this.genStroke(f);var h=this.geo=this.geo||{},c,j,o,b,a,q=this.traverArray.bind(this);i(p,function(u,r,g){if(u!=='geometry')return!0;if(j=d.geoid(g),a=h[j]=h[j]||{},c=g.properties,b=r.coordinate||g.cp||c.cp||c.coordinate,b){a.cp=b;var s=b.lat||b[0],t=b.lng||b[1];a.cp3D=m.project({lng:t,lat:s},1)}var i=c.cName||c.name;i&&(a.cName=i),e&&(l(a),a.fillMesh=[]),f&&(k(a),a.strokeMesh=[]);var p;return d.offset?p=n(d.offset,c):p={x:0,y:0,z:0},o=r.coordinates,q(o,a,p),!1}),this.updateScale()},a.prototype.traverArray=function(a,c,d){for(var b in a)if(typeof a[b][0]!=='object'){this.pts2Mesh.bind(this)(a,c,d);break}else this.traverArray.bind(this)(a[b],c,d)},a.prototype.pts2Mesh=function(l,d,i){var j=this.projection,e=this.pts2MeshGeo(l,d);if(e){var h=this.three3D,f=e.fillGeometry,g=e.strokeGeometry;if(f){var c=d.material;if(!c)return;j.type==='sphere';var a;typeof c==='function'?a=c(f):typeof c==='object'&&(a=new b.Mesh(f,c)),a.position.set(i.x,i.y,i.z),h.add(a),d.fillMesh.push(a)}if(g){var k=d.strokeMaterial;g.computeLineDistances();var a;a=new b.Line(g,k),a.position.set(0,0,0),h.add(a),d.strokeMesh.push(a)}}},a.prototype.pts2MeshGeo=function(s,E){var D=this.projection,n=this.options,r=n.shape,C=r.stroke,B=r.fill,l=r.divide,q=new b.Shape,f=[],a,y,j,h,x,A=n.lat,z=n.lng,t=1e-5,u=1e-5,p,o;if(s.length<3)return console.log('less 3pts');for(var i=0;i<s.length;i++)p=A(s[i]),l&&(p=g(p,l)),o=z(s[i]),l&&(o=g(o,l)),a=D.project({lng:o,lat:p},n.ratio),y=k.project({lng:o,lat:p}),j=y.x,h=y.z,x=!d(j)&&!d(h),i===0&&x&&(q.moveTo(-h,-j),f.push(a),t=j,u=h),i!==0&&(t!==j||u!==h)&&x&&(q.lineTo(-h,-j),f.push(a),t=j,u=h);var m,c;if(f.length){if(B){var w=new b.ShapeGeometry(q);m=w.vertices;for(var e=0;e<m.length;e++)a=f[e],c=m[e],c&&a&&(c.x=a.x,c.z=a.z,c.y=a.y)}if(C){var v=new b.Geometry;m=v.vertices;for(var e=0;e<f.length;e++)a=f[e],c=new b.Vector3,c.x=a.x,c.z=a.z,c.y=a.y,m.push(c)}return{strokeGeometry:v,fillGeometry:w}}return!1},a.prototype.hide=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!1;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!1})},a.prototype.show=function(){var a;this.each(function(c){if(a=c.fillMesh,a)for(var b in a)a[b].visible=!0;if(a=c.strokeMesh,a)for(var b in a)a[b].visible=!0})},a.prototype.updateScale=function(){var a,b=this.options.ratio;this.each(function(d){if(a=d.fillMesh,a)for(var c in a)a[c].scale.set(b,b,b);if(a=d.strokeMesh,a)for(var c in a)a[c].scale.set(b,b,b)})},a.prototype.genFill=function(a){if(typeof a==='function')return a;var g=this.options,j=this.projection,d=a.opacity,f={transparent:g.shape.fill.transparent},k=e(a.colorBack,0),l=e(a.colorFront,0);d=h(a.opacity,0);var n=c.extend({color:k,side:b.BackSide,vertexColors:b.VertexColors,opacity:d},f),o=c.extend({wireframe:!1,opacity:d,color:l,side:b.FrontSide,vertexColors:b.VertexColors},f),i=(a?a.type:'none')||'none';return{triangle:function(a){a.material=function(a){j.type==='mecator'&&m(a,g.shape.fill.colorFront);var c=new b.MeshPhongMaterial({vertexColors:b.VertexColors}),d=new b.MeshPhongMaterial({vertexColors:b.VertexColors});return b.SceneUtils.createMultiMaterialObject(a,[c,d])}},none:function(a){return a},flat:function(d){var a=new b.MeshBasicMaterial(n),c=new b.MeshBasicMaterial(o);d.material=function(d){return b.SceneUtils.createMultiMaterialObject(d,[a,c])}}}[i]},a.prototype.update=function(){this.updateFill(),this.updateStroke()},a.prototype.updateFill=function(){var q=this.options,C=q.shape,B=q.value,c=C.fill;if(!c)return;var A=f(c.colorFront),z=f(c.colorBack),w=this.vMax,l=this.vMin,t=this._data||{},n=this.geo;for(var o in n){var p=n[o],r=p.fillMesh,d=t[o],a=B(d);a&&(a=(a-l)/(w-l)||0);var y=A(a,d),u=z(a,d);for(var v in r){var k=r[v],x=k.children[0],s=k.children[1],j=x.material,i=s.material,m=h(c.opacity,d,p),g=new b.Color(u);j.color.setRGB(g.r,g.g,g.b),j.opacity=m;var e=new b.Color(y);i.color.setRGB(e.r,e.g,e.b),i.opacity=m}}},a.prototype.updateStroke=function(){var k=this.options.shape,c=k.stroke;if(!c)return;var r=c.color,g=this.geo,p=this._data;for(var h in g){var j=g[h],m=p[h],i=j.strokeMesh;for(var n in i){var o=i[n],d=o.material,q=e(r,m),f=new b.Color(q);d.color.setRGB(f.r,f.g,f.b);var a=c.opacity;(a===null||a===undefined)&&(a=1),d.opacity=a,d.linewidth=l(c.linewidth)}}},a.prototype.updateOptions=function(a){this.options=c.deepMerge(this.options,a),this.updateStroke(),this.updateFill(),this.updateScale()},a.prototype.each=function(d){var a=this.geo;for(var b in a){var c=a[b];d(c)}},a.prototype.genStroke=function(a){if(typeof a==='function')return a;var d=this.options.shape.stroke,h=a.type||'default',e=a.color||16777215,c=a.opacity,f=a.width||a.linewidth||.01,g=c?!0:!1;return{dash:function(a){a.strokeMaterial=new b.LineDashedMaterial({linewidth:f,color:e,dashSize:d.dashSize,gapSize:d.gapSize,transparent:g,opacity:c,linejoin:'round',linecap:'round'})},default:function(a){a.strokeMaterial=new b.LineBasicMaterial({linewidth:f,color:e,transparent:g,opacity:c,linejoin:'round',linecap:'round'})}}[h]},a.prototype.loop=function(){},a.prototype.remove=function(){var a,b,c,d=this.three3D;this.each(function(f){if(a=f.fillMesh,a)for(var e in a)c=a[e],d.remove(c),c&&c.children&&c.children.forEach(function(a){d.remove(a),a.dispose&&a.dispose(),a.material&&a.material.dispose(),a.geometry&&a.geometry.dispose()});if(a=f.strokeMesh,a)for(var e in a)b=a[e],d.remove(b),b.dispose&&b.dispose(),b.material&&b.material.dispose(),b.geometry&&b.geometry.dispose()}),a=null,b=null},a.prototype.geojson=a.prototype.geoJson,module.exports=a

@@ -1,1 +0,1 @@

function b(a){a=this.options=c.deepMerge(b.options,a),this.initialize(a)}var e=require('leaflet'),a=require('three'),d=require('bcore/event'),c=require('bcore/utils');b.options={simplify:{limit:7e-5},polygon:function(a){return a.latlngs},id:function(a,b){return a.id||b},height:function(a){return a.floor*4},isRenderShape:function(a){return a.floor===1},faceColor:function(c){var b=Math.min(-c.height/100,1);return b>.8?new a.Color('rgb(200,0,0)'):new a.Color('rgb(0,150,250)')},material:{color:'#999',emissive:'#222',specular:'#111',opacity:1}},b=d.extend(b,{initialize:function(a){},addTo:function(a){this._map=a,this.project=a.projection.project.bind(a.projection),this.three3D=a.three3D,this.initEvents()},data:function(a){this._data=a},drawBuilding:function(c){var e=this._map,f=this.options;if(!e)return;var g=this.geometry=new a.Geometry;c&&this.data(c),this.faceIndex=0,this.objects={};var d=0;for(var h in c)this.renderOne(c[h],d),d++;var b=f.material,i=this.material=new a.MeshPhongMaterial({color:b.color,vertexColors:a.FaceColors,side:a.DoubleSide,emissive:b.emissive,specular:b.specular,opacity:b.opacity,transparent:!0}),j=this.mesh=new a.Mesh(g,i);this.three3D.add(j)},renderOne:function(g,y){var i=this.options,s=i.simplify,o=s.limit,x=i.polygon,p=i.height,t=this.project,w=-p(g);g.height=w;var k=x(g),f,c,h=[],e,d,q,r,l,m,u,v,n,j;for(var b=0;b<k.length;b++){if(f=k[b],!f)continue;if(n=f.lat,j=f.lng,b===0&&(u=n,v=j),Math.abs(n-u)+Math.abs(j-v)<o&&b!==0)continue;if(c=t(f),e=c.x,d=c.z,b===0&&(l=e,m=d),e===q&&d===r)continue;c=new a.Vector2(e-l,d-m),h.push(c),q=e,r=d}h.length>=3&&this.createExtrudeGeometry(g,h,l,m,y)},createExtrudeGeometry:function(b,t,s,r,q){var c=this.options,i=c.id,j=c.isRenderShape(b),d,e=this.geometry,f=new a.Shape(t);j?d=new a.ShapeGeometry(f):d=new a.ExtrudeGeometry(f,{amount:b.height,steps:1,material:0,extrudeMaterial:1,bevelEnabled:!1});var n=d.faces,o=c.faceColor(b);n.forEach(function(a){a.color=o});var p=i(b,q),g=new a.Matrix4().makeRotationX(Math.PI/2),m=new a.Matrix4().makeTranslation(s,0,r),l=new a.Matrix4().multiply(m).multiply(g);e.merge(d,l);var k=this.fadeIndex,h=this.fadeIndex=e.faces.length;this.objects[p]={range:[k,h],data:b}},setBuildingColor:function(e,f){var c=this.geometry,b=this.objects[e].range,d=c.faces;for(var a=b[0];a<b[1];a++)d[a].color=f},updateFaceColor:function(){console.log(this.geometry);var e=this.objects,c,j,d,b,g,h,i=this.options.faceColor,f=this.geometry,k=f.faces;for(var l in e){c=e[l],j=c.data,d=c.range,g=d[0],h=d[1];for(var a=g;a<h;a++)b=i(j),k[a].color.setRGB(b.r,b.g,b.b)}f.colorsNeedUpdate=!0},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.updateMaterial(a.material),this.updateFaceColor()},updateMaterial:function(c){var b=this.material;b.color=new a.Color(c.color),b.emissive=new a.Color(c.emissive),b.specular=new a.Color(c.specular),b.opacity=c.opacity},initEvents:function(){}}),module.exports=b
function b(a){a=this.options=c.deepMerge(b.options,a),this.initialize(a)}var e=require('leaflet'),a=require('../three'),d=require('bcore/event'),c=require('bcore/utils');b.options={simplify:{limit:7e-5},polygon:function(a){return a.latlngs},id:function(a,b){return a.id||b},height:function(a){return a.floor*4},isRenderShape:function(a){return a.floor===1},faceColor:function(c){var b=Math.min(-c.height/100,1);return b>.8?new a.Color('rgb(200,0,0)'):new a.Color('rgb(0,150,250)')},material:{color:'#999',emissive:'#222',specular:'#111',opacity:1}},b=d.extend(b,{initialize:function(a){},addTo:function(a){this._map=a,this.project=a.projection.project.bind(a.projection),this.three3D=a.three3D,this.initEvents()},data:function(a){this._data=a},drawBuilding:function(c){var e=this._map,f=this.options;if(!e)return;var g=this.geometry=new a.Geometry;c&&this.data(c),this.faceIndex=0,this.objects={};var d=0;for(var h in c)this.renderOne(c[h],d),d++;var b=f.material,i=this.material=new a.MeshPhongMaterial({color:b.color,vertexColors:a.FaceColors,side:a.DoubleSide,emissive:b.emissive,specular:b.specular,opacity:b.opacity,transparent:!0}),j=this.mesh=new a.Mesh(g,i);this.three3D.add(j)},renderOne:function(g,y){var i=this.options,s=i.simplify,o=s.limit,x=i.polygon,p=i.height,t=this.project,w=-p(g);g.height=w;var k=x(g),f,c,h=[],e,d,q,r,l,m,u,v,n,j;for(var b=0;b<k.length;b++){if(f=k[b],!f)continue;if(n=f.lat,j=f.lng,b===0&&(u=n,v=j),Math.abs(n-u)+Math.abs(j-v)<o&&b!==0)continue;if(c=t(f),e=c.x,d=c.z,b===0&&(l=e,m=d),e===q&&d===r)continue;c=new a.Vector2(e-l,d-m),h.push(c),q=e,r=d}h.length>=3&&this.createExtrudeGeometry(g,h,l,m,y)},createExtrudeGeometry:function(b,t,s,r,q){var c=this.options,i=c.id,j=c.isRenderShape(b),d,e=this.geometry,f=new a.Shape(t);j?d=new a.ShapeGeometry(f):d=new a.ExtrudeGeometry(f,{amount:b.height,steps:1,material:0,extrudeMaterial:1,bevelEnabled:!1});var n=d.faces,o=c.faceColor(b);n.forEach(function(a){a.color=o});var p=i(b,q),g=new a.Matrix4().makeRotationX(Math.PI/2),m=new a.Matrix4().makeTranslation(s,0,r),l=new a.Matrix4().multiply(m).multiply(g);e.merge(d,l);var k=this.fadeIndex,h=this.fadeIndex=e.faces.length;this.objects[p]={range:[k,h],data:b}},setBuildingColor:function(e,f){var c=this.geometry,b=this.objects[e].range,d=c.faces;for(var a=b[0];a<b[1];a++)d[a].color=f},updateFaceColor:function(){console.log(this.geometry);var e=this.objects,c,j,d,b,g,h,i=this.options.faceColor,f=this.geometry,k=f.faces;for(var l in e){c=e[l],j=c.data,d=c.range,g=d[0],h=d[1];for(var a=g;a<h;a++)b=i(j),k[a].color.setRGB(b.r,b.g,b.b)}f.colorsNeedUpdate=!0},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.updateMaterial(a.material),this.updateFaceColor()},updateMaterial:function(c){var b=this.material;b.color=new a.Color(c.color),b.emissive=new a.Color(c.emissive),b.specular=new a.Color(c.specular),b.opacity=c.opacity},initEvents:function(){}}),module.exports=b

@@ -1,1 +0,1 @@

'use strict';const a=require('three');const b=require('./../../core/utils');const c=require('./flow_field_vert');const d=require('./flow_field_frag');const e={xN:360,yN:181,speed:1,width:3600,height:1800,grids:function(a){return a.data},fadeSpeed:.4,particleN:1e4};class f{constructor(a){this.options=b.deepMerge(e,a)}addTo(a){if(!a)return;this.three3D=a.three3D,this.renderer=this.three3D.renderer,this.init()}init(){let i=this.options;let b=i.particleN;let f=this.width=Math.floor(Math.sqrt(b))+1;let j=this.height=Math.floor(Math.sqrt(b))+1;let d=this.geometry=new a.BufferGeometry;let c=this.colorF32=new Float32Array(b*4);let e=this.positionsF32=new Float32Array(b*3);let h=this.uvF32=new Float32Array(b*2);for(let a=0;a<b;a++)h[a*2+0]=a%f/f,h[a*2+1]=Math.floor(a/f)/j,e[a*3+0]=0,e[a*3+1]=0,e[a*3+2]=0,c[a*4+0]=1,c[a*4+1]=0,c[a*4+2]=0,c[a*4+3]=1;d.addAttribute('aColor',new a.BufferAttribute(c,4,1).setDynamic(!0)),d.addAttribute('position',new a.BufferAttribute(e,3,1).setDynamic(!0)),d.computeBoundingSphere();let k=this.material=this.getMaterial();let g=this.mesh=new a.Points(d,k);g.frustumCulled=!1,this.three3D.add(g)}setData(a){this.processing(a)}processing(d){this._data=d;let b=this.options;let e=b.xN;let f=b.yN;let g=b.grids;let c=g(d);let a=this.fieldDataF32=new Float32Array(e*f*4);for(let h=0;h<c.length;h++){let b=c[h];a[h*4+0]=b[0],a[h*4+1]=b[1],a[h*4+2]=0,a[h*4+3]=1}this.creatFieldTexture(),this.creatParticleTexture()}creatFieldTexture(){let b=this.options;let c=b.xN;let d=b.yN;this.fieldTexture=new a.DataTexture(this.fieldDataF32,c,d,a.RGBAFormat,a.FloatType),this.fieldTexture.needsUpdate=!0}creatParticleTexture(){let d=this.options;let f=this.width;let g=this.height;var c=new Float32Array(f*g*4);for(var b=0;b<n2;b++)c[4*b+0]=Math.random(),c[4*b+1]=Math.random(),c[4*b+2]=Math.random(),c[4*b+3]=Math.random();var e=this.textureRand=new a.DataTexture(c,f,g,a.RGBAFormat,a.FloatType);e.needsUpdate=!0,this.texturePt=this.createRenderTarget(),this.texturePt.needsUpdate=!0,this.copy(e,this.texturePt),this.texturePtCopy=this.createRenderTarget(),this.texturePtCopy.needsUpdate=!0,this.copy(e,this.texturePtCopy),this.textureWind=this.createRenderTarget(a.RGBAFormat,d.width,d.height),this.textureWind.needsUpdate=!0,this.textureWindCopy=this.createRenderTarget(a.RGBAFormat,d.width,d.height),this.textureWindCopy.needsUpdate=!0}copy(b,c){var a=this.mesh.material=this.copyShader;a.uniforms.texture.value=b,a.uniforms.texture.needsUpdate=!0,this.renderer.render(this.scene,this.camera,c,!0)}createRenderTarget(c,d,e,b){return c=c||a.RGBAFormat,d=d||this.width,e=e||this.height,b=b||a.NearestFilter,new a.WebGLRenderTarget(d,e,{wrapS:a.RepeatWrapping,wrapT:a.RepeatWrapping,minFilter:b,magFilter:b,format:c,type:a.FloatType,stencilBuffer:!1})}render(){let a=this._data;let c=this.options;let d=c.particleN;let b=this.geometry.getAttribute('position').array;for(let e=0;e<d;e++)b[e*3+0]=a.x+(Math.random()-.5)*1e6,b[e*3+1]=a.y+(Math.random()-.5)*1e6,b[e*3+2]=a.z+(Math.random()-.5)*1e6;this.geometry.getAttribute('position').needsUpdate=!0,this.geometry.getAttribute('aColor').needsUpdate=!0}initCopyShader(){var b=this.copyShader=new a.ShaderMaterial({uniforms:{resolution:{type:'v2',value:new a.Vector2(this.width,this.height)},texture:{type:'t',value:null}},vertexShader:vert,fragmentShader:fragCopy});b.needsUpdate=!0}getMaterial(){let b={};return new a.ShaderMaterial({vertexShader:c,fragmentShader:d,vertexColors:a.VertexColors,blending:a.NormalBlending,shading:a.SmoothShading,side:a.FrontSide,depthTest:!0,depthWrite:!0,transparent:!0})}updateOptions(a){this.options=b.deepMerge(this.options,a)}}module.exports=f
'use strict';const a=require('../../three');const b=require('./../../core/utils');const c=require('./flow_field_vert');const d=require('./flow_field_frag');const e={xN:360,yN:181,speed:1,width:3600,height:1800,grids:function(a){return a.data},fadeSpeed:.4,particleN:1e4};class f{constructor(a){this.options=b.deepMerge(e,a)}addTo(a){if(!a)return;this.three3D=a.three3D,this.renderer=this.three3D.renderer,this.init()}init(){let i=this.options;let b=i.particleN;let f=this.width=Math.floor(Math.sqrt(b))+1;let j=this.height=Math.floor(Math.sqrt(b))+1;let d=this.geometry=new a.BufferGeometry;let c=this.colorF32=new Float32Array(b*4);let e=this.positionsF32=new Float32Array(b*3);let h=this.uvF32=new Float32Array(b*2);for(let a=0;a<b;a++)h[a*2+0]=a%f/f,h[a*2+1]=Math.floor(a/f)/j,e[a*3+0]=0,e[a*3+1]=0,e[a*3+2]=0,c[a*4+0]=1,c[a*4+1]=0,c[a*4+2]=0,c[a*4+3]=1;d.addAttribute('aColor',new a.BufferAttribute(c,4,1).setDynamic(!0)),d.addAttribute('position',new a.BufferAttribute(e,3,1).setDynamic(!0)),d.computeBoundingSphere();let k=this.material=this.getMaterial();let g=this.mesh=new a.Points(d,k);g.frustumCulled=!1,this.three3D.add(g)}setData(a){this.processing(a)}processing(d){this._data=d;let b=this.options;let e=b.xN;let f=b.yN;let g=b.grids;let c=g(d);let a=this.fieldDataF32=new Float32Array(e*f*4);for(let h=0;h<c.length;h++){let b=c[h];a[h*4+0]=b[0],a[h*4+1]=b[1],a[h*4+2]=0,a[h*4+3]=1}this.creatFieldTexture(),this.creatParticleTexture()}creatFieldTexture(){let b=this.options;let c=b.xN;let d=b.yN;this.fieldTexture=new a.DataTexture(this.fieldDataF32,c,d,a.RGBAFormat,a.FloatType),this.fieldTexture.needsUpdate=!0}creatParticleTexture(){let d=this.options;let f=this.width;let g=this.height;var c=new Float32Array(f*g*4);for(var b=0;b<n2;b++)c[4*b+0]=Math.random(),c[4*b+1]=Math.random(),c[4*b+2]=Math.random(),c[4*b+3]=Math.random();var e=this.textureRand=new a.DataTexture(c,f,g,a.RGBAFormat,a.FloatType);e.needsUpdate=!0,this.texturePt=this.createRenderTarget(),this.texturePt.needsUpdate=!0,this.copy(e,this.texturePt),this.texturePtCopy=this.createRenderTarget(),this.texturePtCopy.needsUpdate=!0,this.copy(e,this.texturePtCopy),this.textureWind=this.createRenderTarget(a.RGBAFormat,d.width,d.height),this.textureWind.needsUpdate=!0,this.textureWindCopy=this.createRenderTarget(a.RGBAFormat,d.width,d.height),this.textureWindCopy.needsUpdate=!0}copy(b,c){var a=this.mesh.material=this.copyShader;a.uniforms.texture.value=b,a.uniforms.texture.needsUpdate=!0,this.renderer.render(this.scene,this.camera,c,!0)}createRenderTarget(c,d,e,b){return c=c||a.RGBAFormat,d=d||this.width,e=e||this.height,b=b||a.NearestFilter,new a.WebGLRenderTarget(d,e,{wrapS:a.RepeatWrapping,wrapT:a.RepeatWrapping,minFilter:b,magFilter:b,format:c,type:a.FloatType,stencilBuffer:!1})}render(){let a=this._data;let c=this.options;let d=c.particleN;let b=this.geometry.getAttribute('position').array;for(let e=0;e<d;e++)b[e*3+0]=a.x+(Math.random()-.5)*1e6,b[e*3+1]=a.y+(Math.random()-.5)*1e6,b[e*3+2]=a.z+(Math.random()-.5)*1e6;this.geometry.getAttribute('position').needsUpdate=!0,this.geometry.getAttribute('aColor').needsUpdate=!0}initCopyShader(){var b=this.copyShader=new a.ShaderMaterial({uniforms:{resolution:{type:'v2',value:new a.Vector2(this.width,this.height)},texture:{type:'t',value:null}},vertexShader:vert,fragmentShader:fragCopy});b.needsUpdate=!0}getMaterial(){let b={};return new a.ShaderMaterial({vertexShader:c,fragmentShader:d,vertexColors:a.VertexColors,blending:a.NormalBlending,shading:a.SmoothShading,side:a.FrontSide,depthTest:!0,depthWrite:!0,transparent:!0})}updateOptions(a){this.options=b.deepMerge(this.options,a)}}module.exports=f

@@ -1,1 +0,1 @@

'use strict';const e=require('three');const a=require('bcore/event');const b=require('./../../core/utils');const c=require('./flow_field_buffer');const d={};class f extends a{constructor(a){super(),this.options=b.deepMerge(d,a)}addTo(a){if(!a)return console.warn('map is necessary...');this.map=a,this.three3D=a.three3D,this.projection=a.projection}setData(a){if(!a)return;this._data=a}_parsePtString(a){if(typeof a==='string'&&a.indexOf(',')!==-1){a=a.split(',');let b=+a[1]||0;let c=+a[0]||0;return{lat:b,lng:c}}return a}render(){let a=this.ffBuffer=new c({});a.addTo(this.map),console.log(this.three3D)}loop(){window.requestAnimationFrame(this.loop.bind(this))}updateOptions(){}remove(){}}module.exports=f
'use strict';const e=require('../../three');const a=require('bcore/event');const b=require('./../../core/utils');const c=require('./flow_field_buffer');const d={};class f extends a{constructor(a){super(),this.options=b.deepMerge(d,a)}addTo(a){if(!a)return console.warn('map is necessary...');this.map=a,this.three3D=a.three3D,this.projection=a.projection}setData(a){if(!a)return;this._data=a}_parsePtString(a){if(typeof a==='string'&&a.indexOf(',')!==-1){a=a.split(',');let b=+a[1]||0;let c=+a[0]||0;return{lat:b,lng:c}}return a}render(){let a=this.ffBuffer=new c({});a.addTo(this.map),console.log(this.three3D)}loop(){window.requestAnimationFrame(this.loop.bind(this))}updateOptions(){}remove(){}}module.exports=f

@@ -1,1 +0,1 @@

'use strict';const a=require('three');const b=require('./../../core/utils');const c={xN:360,yN:181,fadeOpacity:.996,speedFactor:.25,dropRate:.003,dropRateBump:.01,particleN:1e4,grids:function(a){return a.data}};class d{constructor(a){this.options=b.deepMerge(c,a)}addTo(a){if(!a)return;this.three3D=a.three3D,this.renderer=this.three3D.renderer,this.init()}init(){let e=this.options;let f=e.particleN;let b=this.particleResolution=Math.ceil(Math.sqrt(f));let d=this._particleN=b*b;let c=new Uint8Array(d*4);for(let a=0;a<c.length;a++)c[a]=Math.floor(Math.random()*256);this.particleStateTexture0=new a.DataTexture(c,b,b,a.RGBAFormat,a.FloatType),this.particleStateTexture1=new a.DataTexture(c,b,b,a.RGBAFormat,a.FloatType);let g=new Float32Array(d);for(let a=0;a<d;a++)g[a]=a}setData(g){if(!g)return;let c=this.options;let d=c.xN;let e=c.yN;let h=c.grids;let f=h(g);let b=this.fieldDataF32=new Float32Array(d*e*4);for(let a=0;a<f.length;a++){let c=f[a];b[a*4+0]=c[0],b[a*4+1]=c[1],b[a*4+2]=0,b[a*4+3]=1}this.windTexture=new a.DataTexture(b,d,e,a.RGBAFormat,a.FloatType)}render(){}drawScreen(){}drawParticles(){}updateParticles(){}updateOptions(){}}module.exports=d
'use strict';const a=require('../../three');const b=require('./../../core/utils');const c={xN:360,yN:181,fadeOpacity:.996,speedFactor:.25,dropRate:.003,dropRateBump:.01,particleN:1e4,grids:function(a){return a.data}};class d{constructor(a){this.options=b.deepMerge(c,a)}addTo(a){if(!a)return;this.three3D=a.three3D,this.renderer=this.three3D.renderer,this.init()}init(){let e=this.options;let f=e.particleN;let b=this.particleResolution=Math.ceil(Math.sqrt(f));let d=this._particleN=b*b;let c=new Uint8Array(d*4);for(let a=0;a<c.length;a++)c[a]=Math.floor(Math.random()*256);this.particleStateTexture0=new a.DataTexture(c,b,b,a.RGBAFormat,a.FloatType),this.particleStateTexture1=new a.DataTexture(c,b,b,a.RGBAFormat,a.FloatType);let g=new Float32Array(d);for(let a=0;a<d;a++)g[a]=a}setData(g){if(!g)return;let c=this.options;let d=c.xN;let e=c.yN;let h=c.grids;let f=h(g);let b=this.fieldDataF32=new Float32Array(d*e*4);for(let a=0;a<f.length;a++){let c=f[a];b[a*4+0]=c[0],b[a*4+1]=c[1],b[a*4+2]=0,b[a*4+3]=1}this.windTexture=new a.DataTexture(b,d,e,a.RGBAFormat,a.FloatType)}render(){}drawScreen(){}drawParticles(){}updateParticles(){}updateOptions(){}}module.exports=d

@@ -1,1 +0,1 @@

'use strict';function o(a){return a===undefined||a===null}function g(a){if(typeof a==='string'&&a.indexOf(',')!==-1){a=a.split(',');var b=+a[1]||0,c=+a[0]||0;return{lat:b,lng:c}}return a}function m(a,b,c,d){return a+(b-a)*c}function e(d,e,a,b){b=b||1;var c=a*a;return a=3*c-2*c*a,a=Math.pow(a,b),d+(e-d)*a}function a(a){this.updateOptions(a);var b=this.id='flyingline_'+Math.floor(Math.random()*1e9);this.reset()}var c=require('./../core/utils'),f=require('bcore/event'),b=require('three'),i=c.mercator,j=c.sphere,k=c.requestAnimationFrame,l=c.cancelAnimationFrame,h=require('./cube_utils'),d={cube:h(),smooth:function(d){var g=this.options,a=this.ptFrom,c=this.ptTo,f=g.flying.indensty,h=e(a.x,c.x,d,f),i=m(a.y,c.y,d),j=e(a.z,c.z,d,f);return new b.Vector3(h,i,j)},flying:function(a){var b=this.options,c=b.flying,d=c.kHeight+(this.kHeightJitter||0),e=this.ptFrom,f=this.ptTo,g=this._getNormal(),h=(1-a)*a*d*this.distance,i=e.clone().lerp(f,a).add(g.multiplyScalar(h));return i}};a.options={ptN:10,range:.8,isUpdateWhenEndStart:!0,flying:{kHeight:2,kHeightJitter:.2,weight:2,style:{hue:.5,opacity:.2,color:function(a){var c=.5;return new b.Color().setHSL(c,1-a*.3,.3+Math.pow(a,8)*.6)}}},type:'flying',lifeSpeed:.002,delay:0,delayEnd:1,lifeMin:0,lifeMax:1,endType:'explodePts'},a=f.extend(a,{updateOptions:function(b){b=this.options=c.deepMerge(this.options||a.options,b),typeof b.lifeSpeed==='function'&&(b.lifeSpeed=b.lifeSpeed()),typeof b.delay==='function'&&(b.delay=b.delay());var e=b.type;this._getPt=(d[e]||d.flying).bind(this)},setLine:function(a,b){this.lineMerge=a,this.lineIndex=b},addTo:function(a){this._map=a;var c=this.three3D=a.three3D,b=this.projection=a.projection;this.setNormal(b)},checkStatus:function(){if(this.status==='end')return;var b=this.life,a=this.options,c=a.flying.range,d=a.delayEnd;return b<a.lifeMin?this.status='pre-living':b<=a.lifeMax?this.status='living':(b<=a.lifeMax+c?this.status='lifeend-start':this.status='lifeend-done',b>a.lifeMax+d?this.end():this.status)},setNormal:function(a){var c=a.type;if(c==='mecator'||c==='plane'||c==='origin'){var d=this._center=new b.Vector3(a.x0,a.y0,a.z0);this._getNormal=function(){return new b.Vector3(0,1,0)}}else if(c==='sphere'){var d=this._center=new b.Vector3(a.x0,a.y0,a.z0);this._getNormal=function(c){var a=c||this.ptFrom,b=this.ptTo;return a&&b?a.clone().lerp(b,.5).sub(d).normalize():void 0}}},data:function(b){if(!b)return;this._data=b;var c=g(b.to),a=g(b.from),d=b.cubeCenter,e=!a||!c||(!a.lat||!c.lat)&&(a.x===null||a.x===undefined),i=!d;if(i&&e)return this.end();if(!e){var f=this.ptFrom=this.projection.project(a),h=this.ptTo=this.projection.project(c);if(this.distance=f.distanceTo(h),!(f&&h))return this.end()}d&&(this.cubeCenter=d),this.reset(),this.emit('start')}}),a.prototype._getPt=function(a){},a.prototype.update=function(){if(!(this.lineMerge&&this._map))return;var b=this.options;this.life+=b.lifeSpeed;var c=b.endType,a=this.checkStatus();a==='pre-living'||a==='living'?this.updateLine():a==='lifeend-start'&&(b.isUpdateWhenEndStart&&this.updateLine(),this.pStatus==='living'&&this.emit('flying-end',{data:this._data,lineIndex:this.lineIndex})),this.pStatus=a},a.prototype.equalTo=function(a){return this.lineIndex===a.lineIndex},a.prototype.end=function(){this.status='end',this.emit('end');var b=this.options,c=b.ptN,d=this.lineMerge,e=this.lineIndex;for(var a=0;a<c;a++)d.setPt(e,a,0,0,0)};var n=0;a.prototype.resetLine=function(){var c=this.lineMerge,f=this.lineIndex,j=this._data;if(!c)return;var b=this.options.flying.style,h=b.color.bind(b),a=this.options.ptN;for(var d=0;d<a;d++)c.setPt(f,d,0,0,0);a=(a-1)*2;var g=[];for(var e=0;e<a;e++){var i=h(j,e/(a-1));g.push(i)}c.setColorArray(f,g,b.opacity)},a.prototype.updateLine=function(){var h=this.options,k=h.flying,b=k.range,g=h.ptN,i=this.lineMerge,j=this.lineIndex,a=this.life,e,f;for(var c=0;c<g;c++){var d=c/g;if(b>a)e=(1-d)*a;else if(a<1)e=a-d*b;else if(a>1&&a<1+b)e=1-(b-a+1)*d;else return;f=this._getPt(e),i.setPt(j,c,f.x,f.y,f.z)}},a.prototype.reset=function(){var a=this.options;this.status='ready',this.life=a.lifeMin-a.delay,this.targetList=null,this.kHeightJitter=a.flying.kHeight*a.flying.kHeightJitter*Math.random(),this.resetLine()},module.exports=a
'use strict';function o(a){return a===undefined||a===null}function g(a){if(typeof a==='string'&&a.indexOf(',')!==-1){a=a.split(',');var b=+a[1]||0,c=+a[0]||0;return{lat:b,lng:c}}return a}function m(a,b,c,d){return a+(b-a)*c}function e(d,e,a,b){b=b||1;var c=a*a;return a=3*c-2*c*a,a=Math.pow(a,b),d+(e-d)*a}function a(a){this.updateOptions(a);var b=this.id='flyingline_'+Math.floor(Math.random()*1e9);this.reset()}var c=require('./../core/utils'),f=require('bcore/event'),b=require('../three'),i=c.mercator,j=c.sphere,k=c.requestAnimationFrame,l=c.cancelAnimationFrame,h=require('./cube_utils'),d={cube:h(),smooth:function(d){var g=this.options,a=this.ptFrom,c=this.ptTo,f=g.flying.indensty,h=e(a.x,c.x,d,f),i=m(a.y,c.y,d),j=e(a.z,c.z,d,f);return new b.Vector3(h,i,j)},flying:function(a){var b=this.options,c=b.flying,d=c.kHeight+(this.kHeightJitter||0),e=this.ptFrom,f=this.ptTo,g=this._getNormal(),h=(1-a)*a*d*this.distance,i=e.clone().lerp(f,a).add(g.multiplyScalar(h));return i}};a.options={ptN:10,range:.8,isUpdateWhenEndStart:!0,flying:{kHeight:2,kHeightJitter:.2,weight:2,style:{hue:.5,opacity:.2,color:function(a){var c=.5;return new b.Color().setHSL(c,1-a*.3,.3+Math.pow(a,8)*.6)}}},type:'flying',lifeSpeed:.002,delay:0,delayEnd:1,lifeMin:0,lifeMax:1,endType:'explodePts'},a=f.extend(a,{updateOptions:function(b){b=this.options=c.deepMerge(this.options||a.options,b),typeof b.lifeSpeed==='function'&&(b.lifeSpeed=b.lifeSpeed()),typeof b.delay==='function'&&(b.delay=b.delay());var e=b.type;this._getPt=(d[e]||d.flying).bind(this)},setLine:function(a,b){this.lineMerge=a,this.lineIndex=b},addTo:function(a){this._map=a;var c=this.three3D=a.three3D,b=this.projection=a.projection;this.setNormal(b)},checkStatus:function(){if(this.status==='end')return;var b=this.life,a=this.options,c=a.flying.range,d=a.delayEnd;return b<a.lifeMin?this.status='pre-living':b<=a.lifeMax?this.status='living':(b<=a.lifeMax+c?this.status='lifeend-start':this.status='lifeend-done',b>a.lifeMax+d?this.end():this.status)},setNormal:function(a){var c=a.type;if(c==='mecator'||c==='plane'||c==='origin'){var d=this._center=new b.Vector3(a.x0,a.y0,a.z0);this._getNormal=function(){return new b.Vector3(0,1,0)}}else if(c==='sphere'){var d=this._center=new b.Vector3(a.x0,a.y0,a.z0);this._getNormal=function(c){var a=c||this.ptFrom,b=this.ptTo;return a&&b?a.clone().lerp(b,.5).sub(d).normalize():void 0}}},data:function(b){if(!b)return;this._data=b;var c=g(b.to),a=g(b.from),d=b.cubeCenter,e=!a||!c||(!a.lat||!c.lat)&&(a.x===null||a.x===undefined),i=!d;if(i&&e)return this.end();if(!e){var f=this.ptFrom=this.projection.project(a),h=this.ptTo=this.projection.project(c);if(this.distance=f.distanceTo(h),!(f&&h))return this.end()}d&&(this.cubeCenter=d),this.reset(),this.emit('start')}}),a.prototype._getPt=function(a){},a.prototype.update=function(){if(!(this.lineMerge&&this._map))return;var b=this.options;this.life+=b.lifeSpeed;var c=b.endType,a=this.checkStatus();a==='pre-living'||a==='living'?this.updateLine():a==='lifeend-start'&&(b.isUpdateWhenEndStart&&this.updateLine(),this.pStatus==='living'&&this.emit('flying-end',{data:this._data,lineIndex:this.lineIndex})),this.pStatus=a},a.prototype.equalTo=function(a){return this.lineIndex===a.lineIndex},a.prototype.end=function(){this.status='end',this.emit('end');var b=this.options,c=b.ptN,d=this.lineMerge,e=this.lineIndex;for(var a=0;a<c;a++)d.setPt(e,a,0,0,0)};var n=0;a.prototype.resetLine=function(){var c=this.lineMerge,f=this.lineIndex,j=this._data;if(!c)return;var b=this.options.flying.style,h=b.color.bind(b),a=this.options.ptN;for(var d=0;d<a;d++)c.setPt(f,d,0,0,0);a=(a-1)*2;var g=[];for(var e=0;e<a;e++){var i=h(j,e/(a-1));g.push(i)}c.setColorArray(f,g,b.opacity)},a.prototype.updateLine=function(){var h=this.options,k=h.flying,b=k.range,g=h.ptN,i=this.lineMerge,j=this.lineIndex,a=this.life,e,f;for(var c=0;c<g;c++){var d=c/g;if(b>a)e=(1-d)*a;else if(a<1)e=a-d*b;else if(a>1&&a<1+b)e=1-(b-a+1)*d;else return;f=this._getPt(e),i.setPt(j,c,f.x,f.y,f.z)}},a.prototype.reset=function(){var a=this.options;this.status='ready',this.life=a.lifeMin-a.delay,this.targetList=null,this.kHeightJitter=a.flying.kHeight*a.flying.kHeightJitter*Math.random(),this.resetLine()},module.exports=a

@@ -1,1 +0,1 @@

'use strict';function a(c){this.options=b.deepMerge(a.options,c)}var b=require('./../core/utils'),c=require('three'),g=b.requestAnimationFrame,h=b.cancelAnimationFrame,d=require('./../render/line_merge'),e=require('./../layer/flying_line'),i=b.getColorFunc,f=require('bcore/event');a.options={lineN:1e3,ptN:30,maxOpacity:1,weight:2,blending:c.AdditiveBlending,flying:{range:.2,kHeight:2,kHeightJitter:.2,style:{hue:.5,color:function(a){var b=this.hue;return a=1-a,new c.Color().setHSL(b,1-a*.3,.3+Math.pow(a,8)*.6)}}}},a=f.extend(a,{addTo:function(a){this._map=a;var b=this.three3D=a.three3D;this.initLines(),this.loop()}}),a.prototype.initLines=function(){var h=this._map,a=this.options,f=a.lineN,i=a.ptN,g=this.lineMerge=new d({lineN:f,ptN:i,weight:a.weight,maxOpacity:a.maxOpacity,material:{blending:a.blending}});g.addTo(h);var m=this.using=[],j=this.unusing=[],k=this.all=[],b,l=a;for(var c=0;c<f;c++)b=new e(l,!0),b.addTo(h),b.setLine(g,c),this.initEventLine(b),j.push(b),k.push(b)},a.prototype.data=function(d){var b,c,a=this.unusing,e=this.using;if(!(a&&a.length))return;for(var f in d)b=d[f],a.length&&b&&(c=a.pop(),c.data(b),e.push(c))},a.prototype.checkIfEnd=function(){var c=this.using,d=this.unusing,a;for(var b=c.length-1;b>=0;b--)a=c[b],a.life>=a.options.lifeMax+a.options.range&&(c.splice(b,1),d.push(a))},a.prototype.render=function(a){a&&this.data(a)},a.prototype.clean=function(){var b=this.using,a=this.unusing,e;for(var f in b)e=b[f],e.reset();this.using=[],a=[];var c=this.all;for(var d in c)a[d]=c[d];this.unusing=a},a.prototype.updateOptions=function(a){a&&(a=this.options=b.deepMerge(this.options,a)),a=this.options;var c,d=this.using;for(var f in d)c=d[f],c.updateOptions(a);var e=this.unusing;for(var g in e)c=e[g],c.updateOptions(a);var h=this.lineMerge;h.updateOptions({weight:a.weight,maxOpacity:a.maxOpacity})},a.prototype.loop=function(){this.checkIfEnd(),this.update();var a=this.loopId=window.requestAnimationFrame(this.loop.bind(this))},a.prototype.update=function(){var a=this.using;if(!(a&&a.length))return;var b;for(var c in a)b=a[c],b.update();this.lineMerge.update()},a.prototype.updateSprite=function(){},a.prototype.initEventLine=function(b){var c=this.unusing,d=this.using,a=this;b.on('flying-end',function(b){a.emit('flying-end',b)})},a.prototype.remove=function(){this.clean(),window.cancelAnimationFrame(this.loopId),this.lineMerge&&this.lineMerge.remove()},module.exports=a
'use strict';function a(c){this.options=b.deepMerge(a.options,c)}var b=require('./../core/utils'),c=require('../three'),g=b.requestAnimationFrame,h=b.cancelAnimationFrame,d=require('./../render/line_merge'),e=require('./../layer/flying_line'),i=b.getColorFunc,f=require('bcore/event');a.options={lineN:1e3,ptN:30,maxOpacity:1,weight:2,blending:c.AdditiveBlending,flying:{range:.2,kHeight:2,kHeightJitter:.2,style:{hue:.5,color:function(a){var b=this.hue;return a=1-a,new c.Color().setHSL(b,1-a*.3,.3+Math.pow(a,8)*.6)}}}},a=f.extend(a,{addTo:function(a){this._map=a;var b=this.three3D=a.three3D;this.initLines(),this.loop()}}),a.prototype.initLines=function(){var h=this._map,a=this.options,f=a.lineN,i=a.ptN,g=this.lineMerge=new d({lineN:f,ptN:i,weight:a.weight,maxOpacity:a.maxOpacity,material:{blending:a.blending}});g.addTo(h);var m=this.using=[],j=this.unusing=[],k=this.all=[],b,l=a;for(var c=0;c<f;c++)b=new e(l,!0),b.addTo(h),b.setLine(g,c),this.initEventLine(b),j.push(b),k.push(b)},a.prototype.data=function(d){var b,c,a=this.unusing,e=this.using;if(!(a&&a.length))return;for(var f in d)b=d[f],a.length&&b&&(c=a.pop(),c.data(b),e.push(c))},a.prototype.checkIfEnd=function(){var c=this.using,d=this.unusing,a;for(var b=c.length-1;b>=0;b--)a=c[b],a.life>=a.options.lifeMax+a.options.range&&(c.splice(b,1),d.push(a))},a.prototype.render=function(a){a&&this.data(a)},a.prototype.clean=function(){var b=this.using,a=this.unusing,e;for(var f in b)e=b[f],e.reset();this.using=[],a=[];var c=this.all;for(var d in c)a[d]=c[d];this.unusing=a},a.prototype.updateOptions=function(a){a&&(a=this.options=b.deepMerge(this.options,a)),a=this.options;var c,d=this.using;for(var f in d)c=d[f],c.updateOptions(a);var e=this.unusing;for(var g in e)c=e[g],c.updateOptions(a);var h=this.lineMerge;h.updateOptions({weight:a.weight,maxOpacity:a.maxOpacity})},a.prototype.loop=function(){this.checkIfEnd(),this.update();var a=this.loopId=window.requestAnimationFrame(this.loop.bind(this))},a.prototype.update=function(){var a=this.using;if(!(a&&a.length))return;var b;for(var c in a)b=a[c],b.update();this.lineMerge.update()},a.prototype.updateSprite=function(){},a.prototype.initEventLine=function(b){var c=this.unusing,d=this.using,a=this;b.on('flying-end',function(b){a.emit('flying-end',b)})},a.prototype.remove=function(){this.clean(),window.cancelAnimationFrame(this.loopId),this.lineMerge&&this.lineMerge.remove()},module.exports=a

@@ -1,1 +0,1 @@

'use strict';const a=require('three');const c=require('bcore/event');const d=require('./tube_buffer');const b=require('./../../core/utils');const e={tubularSegments:100,radius:1e3,radiusSegments:60,color:'',lineLength:.2,speed:1,height:1,ptPerTube:10};class f extends c{constructor(a){super(),this.options=b.deepMerge(e,a)}addTo(a){if(!a)return console.warn('map is necessary...');this.map=a,this.three3D=a.three3D,this.projection=a.projection,this.paths=[],this.flyingTubeCollectioin=[],this.loop()}_getNormal(e,f){let b=this.projection;let c=b.type;let d=new a.Vector3(b.x0,b.y0,b.z0);return c==='mecator'||c==='plane'||c==='origin'?new a.Vector3(0,1,0):c==='sphere'?e.clone().lerp(f,.5).sub(d).normalize():void 0}_getPt(a,b,c,i){let d=this.options;let e=d.height;let f=this._getNormal(b,c);let g=(1-a)*a*e*i;let h=b.clone().lerp(c,a).add(f.multiplyScalar(g));return h}_parsePtString(a){if(typeof a==='string'&&a.indexOf(',')!==-1){a=a.split(',');let b=+a[1]||0;let c=+a[0]||0;return{lat:b,lng:c}}return a}setData(a){if(!a)return;this._data=a}processing(){this.remove();let a=this;let c=this._data;let d=this.paths;let e=this.options;let b=e.ptPerTube;for(let f of c){let c=[];let e=a.projection.project(a._parsePtString(f.to));let g=a.projection.project(a._parsePtString(f.from));let h=g.distanceTo(e);for(let f=0;f<=b;f++){let d=f/b;let i=a._getPt(d,g,e,h);c.push(i)}d.push(c)}}render(){this.processing(),this.updateTexture();let h=this.map;let a=this.options;let e=a.color;let f=a.speed;let g=a.radius;let c=a.height;let i=a.lineLength;let j=a.radiusSegments;let k=a.tubularSegments;let b=this.paths;let l=this.flyingTubeCollectioin;for(let m=0;m<b.length;m++){let n=b[m];let a=new d({data:n,color:e,speed:f,height:c,radius:g,lineLength:i,radiusSegments:j,tubularSegments:k});a.addTo(h),l.push(a)}}updateTexture(){let c=this.flyingTubeCollectioin;let b=new a.TextureLoader;b.setCrossOrigin('*'),b.crossOrigin='*',b.load('https://img.alicdn.com/tfs/TB1kEaaSpXXXXaRaXXXXXXXXXXX-427-115.png',function(b){if(b.magFilter=a.LinearMipMapLinearFilter,b.minFilter=a.LinearMipMapLinearFilter,c)for(let a of c)a.updateTexture(b)})}animation(){let a=this.flyingTubeCollectioin;if(a)for(let b of a)b.render()}updateOptions(a){let c=this.options;(a.radius!==c.radius||a.height!==c.height)&&(this.options=b.deepMerge(this.options,a),this.render()),this.options=b.deepMerge(this.options,a),this.updateTubesOptions()}updateTubesOptions(){let a=this.options;let c=a.color;let d=a.speed;let e=a.lineLength;let b=this.flyingTubeCollectioin;if(b)for(let f of b)f.updateOptions({color:c,speed:d,lineLength:e})}clean(){this.paths=[],this.flyingTubeCollectioin=[]}remove(){let a=this.flyingTubeCollectioin;if(a)for(let b of a)b.remove();this.clean()}loop(){this.animation(),this.loopId=window.requestAnimationFrame(this.loop.bind(this))}}module.exports=f
'use strict';const a=require('../../three');const c=require('bcore/event');const d=require('./tube_buffer');const b=require('./../../core/utils');const e={tubularSegments:100,radius:1e3,radiusSegments:60,color:'',lineLength:.2,speed:1,height:1,ptPerTube:10};class f extends c{constructor(a){super(),this.options=b.deepMerge(e,a)}addTo(a){if(!a)return console.warn('map is necessary...');this.map=a,this.three3D=a.three3D,this.projection=a.projection,this.paths=[],this.flyingTubeCollectioin=[],this.loop()}_getNormal(e,f){let b=this.projection;let c=b.type;let d=new a.Vector3(b.x0,b.y0,b.z0);return c==='mecator'||c==='plane'||c==='origin'?new a.Vector3(0,1,0):c==='sphere'?e.clone().lerp(f,.5).sub(d).normalize():void 0}_getPt(a,b,c,i){let d=this.options;let e=d.height;let f=this._getNormal(b,c);let g=(1-a)*a*e*i;let h=b.clone().lerp(c,a).add(f.multiplyScalar(g));return h}_parsePtString(a){if(typeof a==='string'&&a.indexOf(',')!==-1){a=a.split(',');let b=+a[1]||0;let c=+a[0]||0;return{lat:b,lng:c}}return a}setData(a){if(!a)return;this._data=a}processing(){this.remove();let a=this;let c=this._data;let d=this.paths;let e=this.options;let b=e.ptPerTube;for(let f of c){let c=[];let e=a.projection.project(a._parsePtString(f.to));let g=a.projection.project(a._parsePtString(f.from));let h=g.distanceTo(e);for(let f=0;f<=b;f++){let d=f/b;let i=a._getPt(d,g,e,h);c.push(i)}d.push(c)}}render(){this.processing(),this.updateTexture();let h=this.map;let a=this.options;let e=a.color;let f=a.speed;let g=a.radius;let c=a.height;let i=a.lineLength;let j=a.radiusSegments;let k=a.tubularSegments;let b=this.paths;let l=this.flyingTubeCollectioin;for(let m=0;m<b.length;m++){let n=b[m];let a=new d({data:n,color:e,speed:f,height:c,radius:g,lineLength:i,radiusSegments:j,tubularSegments:k});a.addTo(h),l.push(a)}}updateTexture(){let c=this.flyingTubeCollectioin;let b=new a.TextureLoader;b.setCrossOrigin('*'),b.crossOrigin='*',b.load('https://img.alicdn.com/tfs/TB1kEaaSpXXXXaRaXXXXXXXXXXX-427-115.png',function(b){if(b.magFilter=a.LinearMipMapLinearFilter,b.minFilter=a.LinearMipMapLinearFilter,c)for(let a of c)a.updateTexture(b)})}animation(){let a=this.flyingTubeCollectioin;if(a)for(let b of a)b.render()}updateOptions(a){let c=this.options;(a.radius!==c.radius||a.height!==c.height)&&(this.options=b.deepMerge(this.options,a),this.render()),this.options=b.deepMerge(this.options,a),this.updateTubesOptions()}updateTubesOptions(){let a=this.options;let c=a.color;let d=a.speed;let e=a.lineLength;let b=this.flyingTubeCollectioin;if(b)for(let f of b)f.updateOptions({color:c,speed:d,lineLength:e})}clean(){this.paths=[],this.flyingTubeCollectioin=[]}remove(){let a=this.flyingTubeCollectioin;if(a)for(let b of a)b.remove();this.clean()}loop(){this.animation(),this.loopId=window.requestAnimationFrame(this.loop.bind(this))}}module.exports=f

@@ -1,1 +0,1 @@

'use strict';const a=require('three');const d=require('bcore/event');const b=require('chroma-js');const c=require('./../../core/utils');const e=require('./tube_buffer_vert');const f=require('./tube_buffer_frag');const g={tubularSegments:100,radius:1,radiusSegments:6,lineLength:.2,closed:!1,color:null,data:null,speed:1};class h extends d{constructor(a){super(),this.options=c.deepMerge(g,a)}addTo(a){if(!a)return console.warn('map is necessary...');this.map=a,this.three3D=a.three3D,this.init()}init(){let b=this.options;let d=b.data;let i=b.closed;let f=b.radius;let g=b.radiusSegments;let h=b.tubularSegments;let e=[];for(let m=0;m<d.length;m++){let b=d[m];e.push(new a.Vector3(b.x,b.y,b.z))}let j=new a.CatmullRomCurve3(e);let k=this.geometry=new a.TubeBufferGeometry(j,h,f,g,i);let l=this.material=this.getMaterial();let c=this.mesh=new a.Mesh(k,l);c.frustumCulled=!1,this.three3D.add(c)}getMaterial(){let d=this.options;let g=d.color;let c=b(g).gl();let h=d.lineLength;let i={uColor:{value:new a.Vector3(c[0],c[1],c[2])},uLength:{value:h},uTimeCounter:{value:Math.random()},uTexture:{type:'t',value:null}};return new a.ShaderMaterial({uniforms:i,vertexShader:e,fragmentShader:f,vertexColors:a.VertexColors,blending:a.NormalBlending,shading:a.SmoothShading,side:a.FrontSide,depthTest:!0,depthWrite:!1,transparent:!0})}render(){let a=this.material;let b=this.options;let c=b.speed;let d=b.lineLength;a.uniforms.uTimeCounter.value+=c,a.uniforms.uTimeCounter.value>1+d&&(a.uniforms.uTimeCounter.value=0)}update(){let e=this.options;let f=e.color;let c=b(f).gl();let g=e.lineLength;let d=this.material;d.uniforms.uLength.value=g,d.uniforms.uColor.value=new a.Vector3(c[0],c[1],c[2]),d.needsUpdate=!0}updateTexture(b){let a=this.material;a.uniforms.uTexture.value=b,a.needsUpdate=!0}updateOptions(a){this.options=c.deepMerge(this.options,a),this.update()}remove(){this.three3D.remove(this.mesh),this.mesh&&this.mesh.dispose&&this.mesh.dispose(),this.geometry&&this.geometry.dispose(),this.material&&this.material.dispose(),this.mesh=null,this.geometry=null,this.material=null}}module.exports=h
'use strict';const a=require('../../three');const d=require('bcore/event');const b=require('chroma-js');const c=require('./../../core/utils');const e=require('./tube_buffer_vert');const f=require('./tube_buffer_frag');const g={tubularSegments:100,radius:1,radiusSegments:6,lineLength:.2,closed:!1,color:null,data:null,speed:1};class h extends d{constructor(a){super(),this.options=c.deepMerge(g,a)}addTo(a){if(!a)return console.warn('map is necessary...');this.map=a,this.three3D=a.three3D,this.init()}init(){let b=this.options;let d=b.data;let i=b.closed;let f=b.radius;let g=b.radiusSegments;let h=b.tubularSegments;let e=[];for(let m=0;m<d.length;m++){let b=d[m];e.push(new a.Vector3(b.x,b.y,b.z))}let j=new a.CatmullRomCurve3(e);let k=this.geometry=new a.TubeBufferGeometry(j,h,f,g,i);let l=this.material=this.getMaterial();let c=this.mesh=new a.Mesh(k,l);c.frustumCulled=!1,this.three3D.add(c)}getMaterial(){let d=this.options;let g=d.color;let c=b(g).gl();let h=d.lineLength;let i={uColor:{value:new a.Vector3(c[0],c[1],c[2])},uLength:{value:h},uTimeCounter:{value:Math.random()},uTexture:{type:'t',value:null}};return new a.ShaderMaterial({uniforms:i,vertexShader:e,fragmentShader:f,vertexColors:a.VertexColors,blending:a.NormalBlending,shading:a.SmoothShading,side:a.FrontSide,depthTest:!0,depthWrite:!1,transparent:!0})}render(){let a=this.material;let b=this.options;let c=b.speed;let d=b.lineLength;a.uniforms.uTimeCounter.value+=c,a.uniforms.uTimeCounter.value>1+d&&(a.uniforms.uTimeCounter.value=0)}update(){let e=this.options;let f=e.color;let c=b(f).gl();let g=e.lineLength;let d=this.material;d.uniforms.uLength.value=g,d.uniforms.uColor.value=new a.Vector3(c[0],c[1],c[2]),d.needsUpdate=!0}updateTexture(b){let a=this.material;a.uniforms.uTexture.value=b,a.needsUpdate=!0}updateOptions(a){this.options=c.deepMerge(this.options,a),this.update()}remove(){this.three3D.remove(this.mesh),this.mesh&&this.mesh.dispose&&this.mesh.dispose(),this.geometry&&this.geometry.dispose(),this.material&&this.material.dispose(),this.mesh=null,this.geometry=null,this.material=null}}module.exports=h

@@ -1,1 +0,1 @@

'use strict';function a(c){c=this.options=b.deepMerge(a.options,c),this.initialize(c)}var d=require('three'),b=require('./../core/utils'),e=require('bcore/event'),f=b.format,c=require('./../map/projection/mecator');a.options={transform:'normal',scale:1,offset:{x:0,y:0,z:0},u:{step:6,range:[0,360]},v:{step:6,range:[0,180]}},a=e.extend(a,{initialize:function(a){},addTo:function(a){if(!a)return;this.three3D=a.three3D,this.projection=a.projection,this.initGeometry()},initGeometry:function(){var a=this.options,q=this.projection,e=a.u.step||a.step,f=a.u.range,g=f[0],h=f[1],i=a.v.step||a.step,b=a.v.range,k=b[0],l=b[1],n=this.geometry=new d.BufferGeometry,m=Math.floor((l-k)/ i)*Math.floor((h-g)/e),o=new Float32Array(m*3),p=new Float32Array(m*2);for(var c=k;c<=l;c+=i)for(var j=g;j<h;j+=e);},updateTransform:function(){var a=this.options,b=a.transform;if(b==='mecator'){var d=c.project({lat:-85.05112877980659,lng:0}),e=c.project({lat:85.05112877980659,lng:180});this.transform=function(a,b){},this.unTransform=function(a,b){};return}this.transform=this.unTransform=function(a,b){return{lat:a,lng:b}}}}),module.exports=a
'use strict';function a(c){c=this.options=b.deepMerge(a.options,c),this.initialize(c)}var d=require('../three'),b=require('./../core/utils'),e=require('bcore/event'),f=b.format,c=require('./../map/projection/mecator');a.options={transform:'normal',scale:1,offset:{x:0,y:0,z:0},u:{step:6,range:[0,360]},v:{step:6,range:[0,180]}},a=e.extend(a,{initialize:function(a){},addTo:function(a){if(!a)return;this.three3D=a.three3D,this.projection=a.projection,this.initGeometry()},initGeometry:function(){var a=this.options,q=this.projection,e=a.u.step||a.step,f=a.u.range,g=f[0],h=f[1],i=a.v.step||a.step,b=a.v.range,k=b[0],l=b[1],n=this.geometry=new d.BufferGeometry,m=Math.floor((l-k)/ i)*Math.floor((h-g)/e),o=new Float32Array(m*3),p=new Float32Array(m*2);for(var c=k;c<=l;c+=i)for(var j=g;j<h;j+=e);},updateTransform:function(){var a=this.options,b=a.transform;if(b==='mecator'){var d=c.project({lat:-85.05112877980659,lng:0}),e=c.project({lat:85.05112877980659,lng:180});this.transform=function(a,b){},this.unTransform=function(a,b){};return}this.transform=this.unTransform=function(a,b){return{lat:a,lng:b}}}}),module.exports=a

@@ -1,1 +0,1 @@

'use strict';const a=require('three');const c=require('bcore/event');const b=require('./../core/utils');const d={maxOpacity:.8,ratio:.98,color:16777215,xN:30,yN:30,width:2048,height:1024,material:{}};class e extends c{constructor(a){super(),this.options=b.deepMerge(d,a||{})}addTo(b){if(!b)return;this.three3D=b.three3D;let a=this.projection=b.projection;if(a.type==='plane'||a.type==='mecator'||a.type==='origin')return;this.initGlobe()}initGlobe(){let b=this.options;let d=this.projection;let e=(d.radius||1)*b.ratio;let f=this.globeGeometry=new a.SphereBufferGeometry(e,b.xN,b.yN);let g=this.material=this.createMaterial();let c=this.globeMesh=new a.Mesh(f,g);c.scale.set(b.ratio,b.ratio,b.ratio),this.three3D.add(c)}createMaterial(){let b=this.options;let c=new a.Color(b.color);let d=b.maxOpacity;let e=this.createTexture();return new a.MeshBasicMaterial({map:e,color:c,opacity:d,transparent:!0})}createTexture(){let c=this.createCanvas();let b=this.texture=new a.Texture(c);return b.needsUpdate=!0,b}createCanvas(){let b=this.options;let a=this.canvas=document.createElement('canvas');return a.width=b.width,a.height=b.height,a}getCanvas(){return this.canvas}update(){this.texture.needsUpdate=!0,this.material.needsUpdate=!0,this.material.map.needsUpdate=!0}updateOptions(a){this.options=b.deepMerge(this.options,a),this.updateGlobe()}updateGlobe(){let b=this.options;let c=b.ratio;let e=b.maxOpacity;let d=new a.Color(b.color);this.material&&this.material.color.setRGB(d.r,d.g,d.b),this.material&&(this.material.opacity=e),this.globeMesh&&this.globeMesh.scale.set(c,c,c)}remove(){this.three3D.remove(this.globeMesh),this.globeMesh&&this.globeMesh.dispose&&this.globeMesh.dispose(),this.globeMesh.material&&this.globeMesh.material.dispose(),this.globeMesh.geometry&&this.globeMesh.geometry.dispose(),this.material=null,this.globeMesh=null,this.globeGeometry=null,this.canvas=null,this.loopId&&window.cancelAnimationFrame(this.loopId)}loop(){this.update(),this.loopId=window.requestAnimationFrame(this.loop.bind(this))}}module.exports=e
'use strict';const a=require('../three');const c=require('bcore/event');const b=require('./../core/utils');const d={maxOpacity:.8,ratio:.98,color:16777215,xN:30,yN:30,width:2048,height:1024,material:{}};class e extends c{constructor(a){super(),this.options=b.deepMerge(d,a||{})}addTo(b){if(!b)return;this.three3D=b.three3D;let a=this.projection=b.projection;if(a.type==='plane'||a.type==='mecator'||a.type==='origin')return;this.initGlobe()}initGlobe(){let b=this.options;let d=this.projection;let e=(d.radius||1)*b.ratio;let f=this.globeGeometry=new a.SphereBufferGeometry(e,b.xN,b.yN);let g=this.material=this.createMaterial();let c=this.globeMesh=new a.Mesh(f,g);c.scale.set(b.ratio,b.ratio,b.ratio),this.three3D.add(c)}createMaterial(){let b=this.options;let c=new a.Color(b.color);let d=b.maxOpacity;let e=this.createTexture();return new a.MeshBasicMaterial({map:e,color:c,opacity:d,transparent:!0})}createTexture(){let c=this.createCanvas();let b=this.texture=new a.Texture(c);return b.needsUpdate=!0,b}createCanvas(){let b=this.options;let a=this.canvas=document.createElement('canvas');return a.width=b.width,a.height=b.height,a}getCanvas(){return this.canvas}update(){this.texture.needsUpdate=!0,this.material.needsUpdate=!0,this.material.map.needsUpdate=!0}updateOptions(a){this.options=b.deepMerge(this.options,a),this.updateGlobe()}updateGlobe(){let b=this.options;let c=b.ratio;let e=b.maxOpacity;let d=new a.Color(b.color);this.material&&this.material.color.setRGB(d.r,d.g,d.b),this.material&&(this.material.opacity=e),this.globeMesh&&this.globeMesh.scale.set(c,c,c)}remove(){this.three3D.remove(this.globeMesh),this.globeMesh&&this.globeMesh.dispose&&this.globeMesh.dispose(),this.globeMesh.material&&this.globeMesh.material.dispose(),this.globeMesh.geometry&&this.globeMesh.geometry.dispose(),this.material=null,this.globeMesh=null,this.globeGeometry=null,this.canvas=null,this.loopId&&window.cancelAnimationFrame(this.loopId)}loop(){this.update(),this.loopId=window.requestAnimationFrame(this.loop.bind(this))}}module.exports=e

@@ -1,1 +0,1 @@

'use strict';function b(a){a=this.options=c.deepMerge(b.options,a),this.initTexture(a.image),this.initialize(a)}var a=require('three'),c=require('bcore/utils'),d=require('bcore/event');b.options={intensity:2,maxOpacity:.8,ratio:.98,xN:200,yN:200,type:'mesh',image:null,material:function(){return new a.MeshBasicMaterial({color:'#f00'})},atmosphere:!1},b=d.extend(b,{initialize:function(a){},initTexture:function(b){this.texture=new a.Texture(b)},addTo:function(b){if(!b)return;this.three3D=b.three3D;var a=this.projection=b.projection;if(a.type==='plane'||a.type==='mecator'||a.type==='origin')return;this.initGeo()},genUvs:function(){var c=[],d=this.options,e=d.xN,f=d.yN;for(var a=0;a<=e;a++)for(var b=0;b<=f;b++)c.push(b/f,1-a/e);return new Float32Array(c)},genNormals:function(){var h=[],f=this.options,g=f.xN,i=f.yN,a=Math.cos,e=Math.sin;for(var b=0;b<=g;b++){var k=1-b/g,c=(k-.5)*1*Math.PI;for(var d=0;d<=i;d++){var l=d/ i,j=-(l-.5)*2*Math.PI,n=a(j)*a(c),o=e(j)*a(c),m=e(c);h.push(n,m,o)}}return new Float32Array(h)},initGeo:function(){var b=this.options,n=this.three3D,m=b.type,l=this.projection,k=(l.radius||1)*b.ratio,e=new a.SphereBufferGeometry(k,b.xN,b.yN),h=b.xN*b.yN,f=new Float32Array(h*1),d=new Float32Array(h*4);for(var c=0;c<h;c++)d[c*4+0]=1,d[c*4+1]=1,d[c*4+2]=1,d[c*4+3]=1,f[c*1]=c;d=new a.BufferAttribute(d,4).setDynamic(!0),f=new a.BufferAttribute(f,1).setDynamic(!0);var i=this.genUvs();i=new a.BufferAttribute(i,2).setDynamic(!0);var j=this.genNormals();j=new a.BufferAttribute(j,3).setDynamic(!0),e.addAttribute('colors',d),e.addAttribute('indexes',f),e.addAttribute('uvs',i),e.addAttribute('normals1',j);var o=this.materialGlobe=b.material(),p={mesh:a.Mesh,pointCloud:a.Points,particle:a.Points,points:a.Points}[m],g=this.globeMesh=new p(e,o);g.scale.set(b.ratio,b.ratio,b.ratio),g.castShadow=!0,g.receiveShadow=!0,n.add(g)},updateOptions:function(){var b=this.options,a=b.globe.ratio;this.globeMesh.scale.set(a,a,a),this.updateShader()}}),module.exports=b
'use strict';function b(a){a=this.options=c.deepMerge(b.options,a),this.initTexture(a.image),this.initialize(a)}var a=require('../three'),c=require('bcore/utils'),d=require('bcore/event');b.options={intensity:2,maxOpacity:.8,ratio:.98,xN:200,yN:200,type:'mesh',image:null,material:function(){return new a.MeshBasicMaterial({color:'#f00'})},atmosphere:!1},b=d.extend(b,{initialize:function(a){},initTexture:function(b){this.texture=new a.Texture(b)},addTo:function(b){if(!b)return;this.three3D=b.three3D;var a=this.projection=b.projection;if(a.type==='plane'||a.type==='mecator'||a.type==='origin')return;this.initGeo()},genUvs:function(){var c=[],d=this.options,e=d.xN,f=d.yN;for(var a=0;a<=e;a++)for(var b=0;b<=f;b++)c.push(b/f,1-a/e);return new Float32Array(c)},genNormals:function(){var h=[],f=this.options,g=f.xN,i=f.yN,a=Math.cos,e=Math.sin;for(var b=0;b<=g;b++){var k=1-b/g,c=(k-.5)*1*Math.PI;for(var d=0;d<=i;d++){var l=d/ i,j=-(l-.5)*2*Math.PI,n=a(j)*a(c),o=e(j)*a(c),m=e(c);h.push(n,m,o)}}return new Float32Array(h)},initGeo:function(){var b=this.options,n=this.three3D,m=b.type,l=this.projection,k=(l.radius||1)*b.ratio,e=new a.SphereBufferGeometry(k,b.xN,b.yN),h=b.xN*b.yN,f=new Float32Array(h*1),d=new Float32Array(h*4);for(var c=0;c<h;c++)d[c*4+0]=1,d[c*4+1]=1,d[c*4+2]=1,d[c*4+3]=1,f[c*1]=c;d=new a.BufferAttribute(d,4).setDynamic(!0),f=new a.BufferAttribute(f,1).setDynamic(!0);var i=this.genUvs();i=new a.BufferAttribute(i,2).setDynamic(!0);var j=this.genNormals();j=new a.BufferAttribute(j,3).setDynamic(!0),e.addAttribute('colors',d),e.addAttribute('indexes',f),e.addAttribute('uvs',i),e.addAttribute('normals1',j);var o=this.materialGlobe=b.material(),p={mesh:a.Mesh,pointCloud:a.Points,particle:a.Points,points:a.Points}[m],g=this.globeMesh=new p(e,o);g.scale.set(b.ratio,b.ratio,b.ratio),g.castShadow=!0,g.receiveShadow=!0,n.add(g)},updateOptions:function(){var b=this.options,a=b.globe.ratio;this.globeMesh.scale.set(a,a,a),this.updateShader()}}),module.exports=b

@@ -1,1 +0,1 @@

'use strict';function b(a){a=this.options=d.deepMerge(b.options,a),this.initialize(a)}var a=require('three'),e=require('bcore/event'),d=require('./../core/utils'),c={卫星:{transparent:!1,cache:{}},地形:{transparent:!1,cache:{}},行政区:{transparent:!0,cache:{}},粒子:{transparent:!0,cache:{}},自定义:{transparent:!0,cache:{}},specularMap:{cache:{}},normalMap:{cache:{}},bumpMap:{cache:{}}};b.options={globe:{textureType:'地形',intensity:2,maxOpacity:.8,ratio:.98,xN:40,yN:40,mapUrl:'',specularMapUrl:'',normalMapUrl:'',bumpMapUrl:'',material:{map:null,specularMap:null,normalMap:null,bumpMap:null,specular:'#0a121b',color:'#1a234d',emissive:'#203864',opacity:1,normalScale:{x:1.5,y:1.5},bumpScale:1,shininess:1.5,combine:a.AddOperation,wireframeLinecap:'round',depthTest:!0,shading:a.SmoothShading}},atmosphere:{color:'#0ff',ratio:1.05,maxOpacity:1,intensity:2,isAtmosphere:!1}},b=e.extend(b,{initialize:function(a){},addTo:function(b){if(!b)return;this.three3D=b.three3D;var a=this.projection=b.projection;if(a.type==='plane'||a.type==='mecator'||a.type==='origin')return;this.initGeo()},initGeo:function(m){var b=this.options.globe,d=this.three3D,l=this._map,i=this.projection,e=(i.radius||1)*b.ratio,h=this.globe=new a.SphereBufferGeometry(e,b.xN,b.yN);this.genMaterialGlobe(function(f){var i=this.materialGlobe=f;f.side=a.BackSide;var e=this.globeMesh=new a.Mesh(h,i);e.scale.set(b.ratio,b.ratio,b.ratio),e.castShadow=!0,e.receiveShadow=!0,d.add(e);var g=this.backMaterial=f.clone(),j=this.bcakGlobe=h.clone(),c=this.backGlobeMesh=new a.Mesh(j,g);c.scale.set(b.ratio,b.ratio,b.ratio),c.castShadow=!0,c.receiveShadow=!0,c.material.side=a.FrontSide,d.add(c),f.needsUpdate=!0,g.needsUpdate=!0}.bind(this));var g=this.options.atmosphere;if(!g)return;var j=this.atmosphere=new a.SphereBufferGeometry(e,b.xN,b.yN),k=this.materialAtmosphere=this.genMaterialAtmosphere(),f=this.meshAtomesphere=new a.Mesh(j,k),c=g.ratio;f.scale.set(c,c,c),d.add(f),this.checkAtomesphere()}}),b.prototype.genMaterialGlobe=function(o){var i=this.options,k=i.globe.textureType||'地形',f=c[k],b=i.globe.material;b.transparent=f.transparent;var g=i.globe,j=g.mapUrl,r=g.bumpMapUrl,p=g.normalMapUrl,q=g.specularMapUrl;if(typeof b==='function'){var h=b();return o(h)}b=JSON.parse(JSON.stringify(b));var d=new a.TextureLoader;if(d.setCrossOrigin('*'),d.crossOrigin='*',k==='自定义'){var e=d.load(j,function(){e.needsUpdate=!0});f.cache.map=e}else if(!f.cache.map){var e=d.load(j,function(){e.needsUpdate=!0});f.cache.map=e}if(!c.specularMap.cache.specularMap){var m=d.load(q,function(){m.needsUpdate=!0});c.specularMap.cache.specularMap=m}if(!c.normalMap.cache.normalMap){var n=d.load(p,function(){n.needsUpdate=!0});c.normalMap.cache.normalMap=n}if(!c.bumpMap.cache.bumpMap){var l=d.load(r,function(){l.needsUpdate=!0});c.bumpMap.cache.bumpMap=l}b.map=f.cache.map||null,b.bumpMap=c.bumpMap.cache.bumpMap||null,b.normalMap=c.normalMap.cache.normalMap||null,b.specularMap=c.specularMap.cache.specularMap||null;var h=new a.MeshPhongMaterial(b);o(h)},b.prototype.getTexture=function(d,e){var b=new a.Texture,c=new Image;return c.src=d,c.crossOrigin='*',b.image=c,c.onload=function(){var c=d.search(/\.(jpg|jpeg)$/)>0||d.search(/^data\:image\/jpeg/)===0;b.format=c?a.RGBFormat:a.RGBAFormat,console.log(b.format,d),b.needsUpdate=!0,e(b)},b},b.prototype.checkAtomesphere=function(){var a=this.options.atmosphere,b=a.isAtmosphere;b?this.atomesphereShow():this.atomesphereHide()},b.prototype.atomesphereShow=function(){this.meshAtomesphere&&(this.meshAtomesphere.visible=!0)},b.prototype.atomesphereHide=function(){this.meshAtomesphere&&(this.meshAtomesphere.visible=!1)},b.prototype.show=function(){this.meshAtomesphere&&(this.meshAtomesphere.visible=!0),this.globeMesh&&(this.globeMesh.visible=!0)},b.prototype.hide=function(){this.meshAtomesphere&&(this.meshAtomesphere.visible=!1),this.globeMesh&&(this.globeMesh.visible=!1)},b.prototype.genMaterialAtmosphere=function(){var b=this.options.atmosphere,c=b.maxOpacity,d=b.intensity,e='varying vec3 vNormal;void main() {vNormal = normalize( normalMatrix * normal );gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );}',f=this.genFragAtmosphere();return new a.ShaderMaterial({uniforms:{intensity:{type:'f',value:d},maxOpacity:{type:'f',value:c}},vertexShader:e,fragmentShader:f,side:a.BackSide,transparent:!1})},b.prototype.genFragAtmosphere=function(){var b=this.options.atmosphere.color;b=new a.Color(b);var c=this.options.atmosphere.intensity;return'varying vec3 vNormal;uniform float intensity;uniform float maxOpacity;void main() {float k = pow( 0.51 - dot( vNormal, vec3(0, 0, 1.0 )), '+c.toFixed(1)+' );'+'gl_FragColor = vec4( '+b.r+', '+b.g+', '+b.b+', maxOpacity ) * k;'+'}'},b.prototype.updateShader=function(){var e=this.options,b=e.globe.material,c=this.materialGlobe,d=this.backMaterial;if(!c)return;c.normalScale=b.normalScale,c.color=new a.Color(b.color),c.specular=new a.Color(b.specular),c.emissive=new a.Color(b.emissive),c.transparent=b.transparent,c.needsUpdate=!0,d.normalScale=b.normalScale,d.color=new a.Color(b.color),d.specular=new a.Color(b.specular),d.emissive=new a.Color(b.emissive),d.transparent=b.transparent,d.needsUpdate=!0},b.prototype.updateOptions=function(b){b&&(b=this.options=d.deepMerge(this.options,b));var a=b.globe.ratio;this.globeMesh&&this.globeMesh.scale.set(a,a,a),this.backGlobeMesh&&this.backGlobeMesh.scale.set(a,a,a),this.updateShader(),this.checkAtomesphere(),this.updateAtmosphere(),this.updateGlobeMaterial()},b.prototype.updateGlobeMaterial=function(){var b=this.options;this.genMaterialGlobe(function(b){var e=this.materialGlobe=b,c=this.globeMesh;b.side=a.BackSide,c.material=b,c.material.needsUpdate=!0;var d=this.backMaterial=b.clone();d.side=a.FrontSide,this.backGlobeMesh.material=d,this.backGlobeMesh.material.needsUpdate=!0}.bind(this))},b.prototype.updateAtmosphere=function(){var b=this.options.atmosphere;if(!b)return;var c=this.meshAtomesphere,a=b.ratio;c.scale.set(a,a,a),this.materialAtmosphere.fragmentShader=this.genFragAtmosphere(),this.materialAtmosphere.needsUpdate=!0},b.prototype.remove=function(){this.three3D.remove(this.globeMesh),this.three3D.remove(this.backGlobeMesh),this.three3D.remove(this.meshAtomesphere),this.globeMesh&&this.globeMesh.dispose&&this.globeMesh.dispose(),this.materialGlobe&&this.materialGlobe.dispose(),this.globe&&this.globe.dispose(),this.backGlobeMesh&&this.backGlobeMesh.dispose&&this.backGlobeMesh.dispose(),this.backMaterial&&this.backMaterial.dispose(),this.bcakGlobe&&this.bcakGlobe.dispose(),this.meshAtomesphere&&this.meshAtomesphere.dispose&&this.meshAtomesphere.dispose(),this.atmosphere&&this.atmosphere.dispose(),this.materialAtmosphere&&this.materialAtmosphere.dispose(),this.globeMesh=null,this.materialGlobe=null,this.globe=null,this.backGlobeMesh=null,this.backMaterial=null,this.bcakGlobe=null,this.meshAtomesphere=null,this.atmosphere=null,this.materialAtmosphere=null,c.cache=null},module.exports=b
'use strict';function b(a){a=this.options=d.deepMerge(b.options,a),this.initialize(a)}var a=require('../three'),e=require('bcore/event'),d=require('./../core/utils'),c={卫星:{transparent:!1,cache:{}},地形:{transparent:!1,cache:{}},行政区:{transparent:!0,cache:{}},粒子:{transparent:!0,cache:{}},自定义:{transparent:!0,cache:{}},specularMap:{cache:{}},normalMap:{cache:{}},bumpMap:{cache:{}}};b.options={globe:{textureType:'地形',intensity:2,maxOpacity:.8,ratio:.98,xN:40,yN:40,mapUrl:'',specularMapUrl:'',normalMapUrl:'',bumpMapUrl:'',material:{map:null,specularMap:null,normalMap:null,bumpMap:null,specular:'#0a121b',color:'#1a234d',emissive:'#203864',opacity:1,normalScale:{x:1.5,y:1.5},bumpScale:1,shininess:1.5,combine:a.AddOperation,wireframeLinecap:'round',depthTest:!0,shading:a.SmoothShading}},atmosphere:{color:'#0ff',ratio:1.05,maxOpacity:1,intensity:2,isAtmosphere:!1}},b=e.extend(b,{initialize:function(a){},addTo:function(b){if(!b)return;this.three3D=b.three3D;var a=this.projection=b.projection;if(a.type==='plane'||a.type==='mecator'||a.type==='origin')return;this.initGeo()},initGeo:function(m){var b=this.options.globe,d=this.three3D,l=this._map,i=this.projection,e=(i.radius||1)*b.ratio,h=this.globe=new a.SphereBufferGeometry(e,b.xN,b.yN);this.genMaterialGlobe(function(f){var i=this.materialGlobe=f;f.side=a.BackSide;var e=this.globeMesh=new a.Mesh(h,i);e.scale.set(b.ratio,b.ratio,b.ratio),e.castShadow=!0,e.receiveShadow=!0,d.add(e);var g=this.backMaterial=f.clone(),j=this.bcakGlobe=h.clone(),c=this.backGlobeMesh=new a.Mesh(j,g);c.scale.set(b.ratio,b.ratio,b.ratio),c.castShadow=!0,c.receiveShadow=!0,c.material.side=a.FrontSide,d.add(c),f.needsUpdate=!0,g.needsUpdate=!0}.bind(this));var g=this.options.atmosphere;if(!g)return;var j=this.atmosphere=new a.SphereBufferGeometry(e,b.xN,b.yN),k=this.materialAtmosphere=this.genMaterialAtmosphere(),f=this.meshAtomesphere=new a.Mesh(j,k),c=g.ratio;f.scale.set(c,c,c),d.add(f),this.checkAtomesphere()}}),b.prototype.genMaterialGlobe=function(o){var i=this.options,k=i.globe.textureType||'地形',f=c[k],b=i.globe.material;b.transparent=f.transparent;var g=i.globe,j=g.mapUrl,r=g.bumpMapUrl,p=g.normalMapUrl,q=g.specularMapUrl;if(typeof b==='function'){var h=b();return o(h)}b=JSON.parse(JSON.stringify(b));var d=new a.TextureLoader;if(d.setCrossOrigin('*'),d.crossOrigin='*',k==='自定义'){var e=d.load(j,function(){e.needsUpdate=!0});f.cache.map=e}else if(!f.cache.map){var e=d.load(j,function(){e.needsUpdate=!0});f.cache.map=e}if(!c.specularMap.cache.specularMap){var m=d.load(q,function(){m.needsUpdate=!0});c.specularMap.cache.specularMap=m}if(!c.normalMap.cache.normalMap){var n=d.load(p,function(){n.needsUpdate=!0});c.normalMap.cache.normalMap=n}if(!c.bumpMap.cache.bumpMap){var l=d.load(r,function(){l.needsUpdate=!0});c.bumpMap.cache.bumpMap=l}b.map=f.cache.map||null,b.bumpMap=c.bumpMap.cache.bumpMap||null,b.normalMap=c.normalMap.cache.normalMap||null,b.specularMap=c.specularMap.cache.specularMap||null;var h=new a.MeshPhongMaterial(b);o(h)},b.prototype.getTexture=function(d,e){var b=new a.Texture,c=new Image;return c.src=d,c.crossOrigin='*',b.image=c,c.onload=function(){var c=d.search(/\.(jpg|jpeg)$/)>0||d.search(/^data\:image\/jpeg/)===0;b.format=c?a.RGBFormat:a.RGBAFormat,console.log(b.format,d),b.needsUpdate=!0,e(b)},b},b.prototype.checkAtomesphere=function(){var a=this.options.atmosphere,b=a.isAtmosphere;b?this.atomesphereShow():this.atomesphereHide()},b.prototype.atomesphereShow=function(){this.meshAtomesphere&&(this.meshAtomesphere.visible=!0)},b.prototype.atomesphereHide=function(){this.meshAtomesphere&&(this.meshAtomesphere.visible=!1)},b.prototype.show=function(){this.meshAtomesphere&&(this.meshAtomesphere.visible=!0),this.globeMesh&&(this.globeMesh.visible=!0)},b.prototype.hide=function(){this.meshAtomesphere&&(this.meshAtomesphere.visible=!1),this.globeMesh&&(this.globeMesh.visible=!1)},b.prototype.genMaterialAtmosphere=function(){var b=this.options.atmosphere,c=b.maxOpacity,d=b.intensity,e='varying vec3 vNormal;void main() {vNormal = normalize( normalMatrix * normal );gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );}',f=this.genFragAtmosphere();return new a.ShaderMaterial({uniforms:{intensity:{type:'f',value:d},maxOpacity:{type:'f',value:c}},vertexShader:e,fragmentShader:f,side:a.BackSide,transparent:!1})},b.prototype.genFragAtmosphere=function(){var b=this.options.atmosphere.color;b=new a.Color(b);var c=this.options.atmosphere.intensity;return'varying vec3 vNormal;uniform float intensity;uniform float maxOpacity;void main() {float k = pow( 0.51 - dot( vNormal, vec3(0, 0, 1.0 )), '+c.toFixed(1)+' );'+'gl_FragColor = vec4( '+b.r+', '+b.g+', '+b.b+', maxOpacity ) * k;'+'}'},b.prototype.updateShader=function(){var e=this.options,b=e.globe.material,c=this.materialGlobe,d=this.backMaterial;if(!c)return;c.normalScale=b.normalScale,c.color=new a.Color(b.color),c.specular=new a.Color(b.specular),c.emissive=new a.Color(b.emissive),c.transparent=b.transparent,c.needsUpdate=!0,d.normalScale=b.normalScale,d.color=new a.Color(b.color),d.specular=new a.Color(b.specular),d.emissive=new a.Color(b.emissive),d.transparent=b.transparent,d.needsUpdate=!0},b.prototype.updateOptions=function(b){b&&(b=this.options=d.deepMerge(this.options,b));var a=b.globe.ratio;this.globeMesh&&this.globeMesh.scale.set(a,a,a),this.backGlobeMesh&&this.backGlobeMesh.scale.set(a,a,a),this.updateShader(),this.checkAtomesphere(),this.updateAtmosphere(),this.updateGlobeMaterial()},b.prototype.updateGlobeMaterial=function(){var b=this.options;this.genMaterialGlobe(function(b){var e=this.materialGlobe=b,c=this.globeMesh;b.side=a.BackSide,c.material=b,c.material.needsUpdate=!0;var d=this.backMaterial=b.clone();d.side=a.FrontSide,this.backGlobeMesh.material=d,this.backGlobeMesh.material.needsUpdate=!0}.bind(this))},b.prototype.updateAtmosphere=function(){var b=this.options.atmosphere;if(!b)return;var c=this.meshAtomesphere,a=b.ratio;c.scale.set(a,a,a),this.materialAtmosphere.fragmentShader=this.genFragAtmosphere(),this.materialAtmosphere.needsUpdate=!0},b.prototype.remove=function(){this.three3D.remove(this.globeMesh),this.three3D.remove(this.backGlobeMesh),this.three3D.remove(this.meshAtomesphere),this.globeMesh&&this.globeMesh.dispose&&this.globeMesh.dispose(),this.materialGlobe&&this.materialGlobe.dispose(),this.globe&&this.globe.dispose(),this.backGlobeMesh&&this.backGlobeMesh.dispose&&this.backGlobeMesh.dispose(),this.backMaterial&&this.backMaterial.dispose(),this.bcakGlobe&&this.bcakGlobe.dispose(),this.meshAtomesphere&&this.meshAtomesphere.dispose&&this.meshAtomesphere.dispose(),this.atmosphere&&this.atmosphere.dispose(),this.materialAtmosphere&&this.materialAtmosphere.dispose(),this.globeMesh=null,this.materialGlobe=null,this.globe=null,this.backGlobeMesh=null,this.backMaterial=null,this.bcakGlobe=null,this.meshAtomesphere=null,this.atmosphere=null,this.materialAtmosphere=null,c.cache=null},module.exports=b

@@ -1,1 +0,1 @@

function b(b,a){a=this.options=c.deepMerge(this.options,a),obj=obj||{},this.setLight(),this.ambientColor=obj.ambientColor||2236962,this.init(obj),this.loop()}var a=require('three'),c=require('./../core/utils'),d;b.prototype.prototype={init:function(a){},initShader:function(){},genMaterial:function(f,g){var b='attribute vec4 colors;attribute float indexes;varying vec4 c;varying float index;void main(){c = colors;index = indexes;vec3 pos = position;vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;gl_PointSize = 10.0;}',c='varying vec4 c;uniform float maxOpacity;varying float index;void main() {gl_FragColor = c * vec4(1, 1, 1, maxOpacity);}',d={maxOpacity:{type:'f',value:this._maxOpacity}},e={colors:{type:'v4',value:f},indexes:{type:'f',value:g}};return new a.ShaderMaterial({uniforms:d,attributes:e,vertexShader:b,fragmentShader:c,vertexColors:a.VertexColors,blending:a.AdditiveBlending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:a.SmoothShading,side:a.DoubleSide,linewidth:this._weight,linejoin:'round',linecap:'round',fog:!0})},loop:function(){this.update(),requestAnimationFrame(this.update.bind(this))}},b.options={},module.exports=b
function b(b,a){a=this.options=c.deepMerge(this.options,a),obj=obj||{},this.setLight(),this.ambientColor=obj.ambientColor||2236962,this.init(obj),this.loop()}var a=require('../three'),c=require('./../core/utils'),d;b.prototype.prototype={init:function(a){},initShader:function(){},genMaterial:function(f,g){var b='attribute vec4 colors;attribute float indexes;varying vec4 c;varying float index;void main(){c = colors;index = indexes;vec3 pos = position;vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;gl_PointSize = 10.0;}',c='varying vec4 c;uniform float maxOpacity;varying float index;void main() {gl_FragColor = c * vec4(1, 1, 1, maxOpacity);}',d={maxOpacity:{type:'f',value:this._maxOpacity}},e={colors:{type:'v4',value:f},indexes:{type:'f',value:g}};return new a.ShaderMaterial({uniforms:d,attributes:e,vertexShader:b,fragmentShader:c,vertexColors:a.VertexColors,blending:a.AdditiveBlending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:a.SmoothShading,side:a.DoubleSide,linewidth:this._weight,linejoin:'round',linecap:'round',fog:!0})},loop:function(){this.update(),requestAnimationFrame(this.update.bind(this))}},b.options={},module.exports=b

@@ -1,1 +0,1 @@

function b(a){this.options=c.deepMerge(b.options,a)}function e(a){var b=a.type;return b==='rect'?f(a):b==='box'?g(a):void 0}function f(b){var c=b.width||b.radius*2,d=b.height||b.width||b.radius*2;return new a.PlaneGeometry(c,d,1,1)}function g(b){var c=b.dx||b.radius*2,d=b.dy||b.dx||b.radius*2,e=b.dz||b.dx||b.radius*2;return new a.BoxGeometry(c,d,e,1,1,1)}var a=require('three'),c=require('./../core/utils'),d=require('bcore/event');b.options={N:100,transition:{x:0,y:0,z:0},shape:{type:'box',dx:1e6,dy:1e6,dz:1e5},material:function(){return new a.MeshBasicMaterial({color:'#f00'})}},b=d.extend(b,{addTo:function(a){this._map=a,window.three3D=this.three3D=a.three3D,this.projection=a.projection,this.init()},init:function(){var b=this.options,f=b.N,g=b.shape,h,c=new a.Geometry;for(var d=0;d<f;d++)h=e(g),c.merge(h);var i=b.material(),j=new a.Mesh(c,i);this.three3D.add(j)}}),module.exports=b
function b(a){this.options=c.deepMerge(b.options,a)}function e(a){var b=a.type;return b==='rect'?f(a):b==='box'?g(a):void 0}function f(b){var c=b.width||b.radius*2,d=b.height||b.width||b.radius*2;return new a.PlaneGeometry(c,d,1,1)}function g(b){var c=b.dx||b.radius*2,d=b.dy||b.dx||b.radius*2,e=b.dz||b.dx||b.radius*2;return new a.BoxGeometry(c,d,e,1,1,1)}var a=require('../three'),c=require('./../core/utils'),d=require('bcore/event');b.options={N:100,transition:{x:0,y:0,z:0},shape:{type:'box',dx:1e6,dy:1e6,dz:1e5},material:function(){return new a.MeshBasicMaterial({color:'#f00'})}},b=d.extend(b,{addTo:function(a){this._map=a,window.three3D=this.three3D=a.three3D,this.projection=a.projection,this.init()},init:function(){var b=this.options,f=b.N,g=b.shape,h,c=new a.Geometry;for(var d=0;d<f;d++)h=e(g),c.merge(h);var i=b.material(),j=new a.Mesh(c,i);this.three3D.add(j)}}),module.exports=b

@@ -1,1 +0,1 @@

function a(b){this.options=c.deepMerge(a.options,b)}function e(a){var b=a.type;return b==='rect'?f(a):b==='box'?g(a):void 0}function f(a){var c=a.width||a.radius*2,d=a.height||a.width||a.radius*2;return new b.PlaneGeometry(c,d,1,1)}function g(a){var c=a.dx||a.radius*2,d=a.dy||a.dx||a.radius*2,e=a.dz||a.dx||a.radius*2;return new b.BoxGeometry(c,d,e,1,1,1)}var b=require('three'),c=require('./../core/utils'),d=require('bcore/event');a.options={N:100,transition:{x:0,y:0,z:0},shape:{type:'box',dx:1e6,dy:1e6,dz:1e5},material:function(){return new b.MeshBasicMaterial({color:'#f00'})}},a=d.extend(a,{addTo:function(a){this._map=a,window.three3D=this.three3D=a.three3D,this.projection=a.projection,this.init()},init:function(){var g=this.three3D,a=this.options,h=this.shapes=[],i=a.N,j=a.shape,c,d,k=a.material();for(var f=0;f<i;f++)c=e(j),d=new b.Mesh(c,k),g.add(d),h.push({geometry:c,mesh:d})},updatePos:function(f){var b=this.shapes;for(var c in b){var d=b[c],e=d.mesh,a=f[c];e.position.set(a.x,a.y,a.z)}}}),module.exports=a
function a(b){this.options=c.deepMerge(a.options,b)}function e(a){var b=a.type;return b==='rect'?f(a):b==='box'?g(a):void 0}function f(a){var c=a.width||a.radius*2,d=a.height||a.width||a.radius*2;return new b.PlaneGeometry(c,d,1,1)}function g(a){var c=a.dx||a.radius*2,d=a.dy||a.dx||a.radius*2,e=a.dz||a.dx||a.radius*2;return new b.BoxGeometry(c,d,e,1,1,1)}var b=require('../three'),c=require('./../core/utils'),d=require('bcore/event');a.options={N:100,transition:{x:0,y:0,z:0},shape:{type:'box',dx:1e6,dy:1e6,dz:1e5},material:function(){return new b.MeshBasicMaterial({color:'#f00'})}},a=d.extend(a,{addTo:function(a){this._map=a,window.three3D=this.three3D=a.three3D,this.projection=a.projection,this.init()},init:function(){var g=this.three3D,a=this.options,h=this.shapes=[],i=a.N,j=a.shape,c,d,k=a.material();for(var f=0;f<i;f++)c=e(j),d=new b.Mesh(c,k),g.add(d),h.push({geometry:c,mesh:d})},updatePos:function(f){var b=this.shapes;for(var c in b){var d=b[c],e=d.mesh,a=f[c];e.position.set(a.x,a.y,a.z)}}}),module.exports=a

@@ -1,1 +0,1 @@

function d(b){this.options=a.deepMerge(ShapeSystem.options,b)}var c=require('three'),a=require('./../core/utils'),b=require('bcore/event');ShapeSystem.options={type:'rect'},ShapeSystem=b.extend(ShapeSystem,{addTo:function(a){this._map=a,window.three3D=this.three3D=a.three3D,this.projection=a.projection,this.init(this.options)},init:function(b){var a=this._map}}),module.exports=ShapeSystem
function d(b){this.options=a.deepMerge(ShapeSystem.options,b)}var c=require('./../three'),a=require('./../core/utils'),b=require('bcore/event');ShapeSystem.options={type:'rect'},ShapeSystem=b.extend(ShapeSystem,{addTo:function(a){this._map=a,window.three3D=this.three3D=a.three3D,this.projection=a.projection,this.init(this.options)},init:function(b){var a=this._map}}),module.exports=ShapeSystem

@@ -1,1 +0,1 @@

function a(b){this.options=c.deepMerge(a.options,b)}var b=require('three'),c=require('./../core/utils');a.options={ratio:10,matType:null,color:'#222',imgUrl:null},a.prototype.addTo=function(a){this._map=a,this.radius=a.projection.radius*this.options.ratio,this.three3D=a.three3D,this.init()},a.prototype.init=function(){var d=this.options,a=this.three3D,c=this.geo=new b.SphereGeometry(this.radius,60,60);this.genMaterial(function(d){this.material=d;var e=this.mesh=new b.Mesh(c,d);a.add(e)}.bind(this))},a.prototype.show=function(){this.mesh&&(this.mesh.visible=!0)},a.prototype.hide=function(){this.mesh&&(this.mesh.visible=!1)},a.prototype.genMaterial=function(f){var a=this.options,g=a.matType,h=a.color,c=a.imgUrl;g==='nasa1'&&(c='./../mapping/sky/sky.jpg');var d={color:h,side:b.BackSide};if(c){var e=new b.TextureLoader;e.setCrossOrigin('*'),e.crossOrigin='*',e.load(c,function(a){d.map=a,f(new b.MeshBasicMaterial(d))})}else f(new b.MeshBasicMaterial(d))},a.prototype.updateOptions=function(){options=this.options;var a=new b.Color(options.matType);this.material.color.setRGB(a.r,a.g,a.b)},module.exports=a
function a(b){this.options=c.deepMerge(a.options,b)}var b=require('../three'),c=require('./../core/utils');a.options={ratio:10,matType:null,color:'#222',imgUrl:null},a.prototype.addTo=function(a){this._map=a,this.radius=a.projection.radius*this.options.ratio,this.three3D=a.three3D,this.init()},a.prototype.init=function(){var d=this.options,a=this.three3D,c=this.geo=new b.SphereGeometry(this.radius,60,60);this.genMaterial(function(d){this.material=d;var e=this.mesh=new b.Mesh(c,d);a.add(e)}.bind(this))},a.prototype.show=function(){this.mesh&&(this.mesh.visible=!0)},a.prototype.hide=function(){this.mesh&&(this.mesh.visible=!1)},a.prototype.genMaterial=function(f){var a=this.options,g=a.matType,h=a.color,c=a.imgUrl;g==='nasa1'&&(c='./../mapping/sky/sky.jpg');var d={color:h,side:b.BackSide};if(c){var e=new b.TextureLoader;e.setCrossOrigin('*'),e.crossOrigin='*',e.load(c,function(a){d.map=a,f(new b.MeshBasicMaterial(d))})}else f(new b.MeshBasicMaterial(d))},a.prototype.updateOptions=function(){options=this.options;var a=new b.Color(options.matType);this.material.color.setRGB(a.r,a.g,a.b)},module.exports=a

@@ -1,1 +0,1 @@

function a(b){this.options=c.deepMerge(a.options,b)}var b=require('three'),c=require('./../core/utils'),d=c.requestAnimationFrame;a.options={ambient:{color:'#fff',intensity:.5},spot:{color:'#333',intensity:10},isSolar:!1,radius:4e8,phi:10},a.prototype.addTo=function(a){this._map=a;var b=this.three3D=a.three3D;this.projection=a.projection,this.init(this.options),this.loop()},a.prototype.init=function(d){var f=this._map;this.lightMax=2;var g=this.three3D,a=this.spot=new b.SpotLight(d.spot.color,d.spot.intensity);a.lookAt(f.options.center||f.center),a.castShadow=!0,a.shadow.mapSize.width=1024,a.shadow.mapSize.height=1024,g.add(a);var c=new b.Color(d.ambient.color),e=d.ambient.intensity||1,h=this.ambient=new b.AmbientLight(c);h.color.setRGB(c.r*e,c.g*e,c.b*e),g.add(h)},a.prototype.updateOptions=function(a){a&&(this.options=c.deepMerge(this.options,a)),this.updateSolar()},a.prototype.updateSolar=function(){var a=this.options,c=new b.Color(a.ambient.color),d=a.ambient.intensity||1;this.ambient.color.setRGB(c.r*d,c.g*d,c.b*d);var e=new b.Color(a.spot.color);this.spot.color.setRGB(e.r,e.g,e.b),this.spot.intensity=a.spot.intensity},a.prototype.genMaterial=function(c){var a={side:b.BackSide,color:16711680};return new b.MeshBasicMaterial(a)},a.prototype.updateSolarPos=function(){var a=this.options.radius||this.projection.radius*8,b=this.options.phi,c=a*Math.cos(b),d=a*Math.sin(-.044444444444444446*Math.PI),e=a*Math.sin(b);this.spot.position.set(c,d,e)},a.prototype.update=function(){var b=this.three3D.camera,a=b.position,c=a.x,d=a.y,e=a.z;this.spot.position.set(c,d,e)},a.prototype.loop=function(){this.update(),this.loopId=d(this.loop.bind(this))},a.prototype.remove=function(){this.three3D.remove(this.spot),this.three3D.remove(this.ambient),this.spot&&this.spot.dispose&&this.spot.dispose(),this.ambient&&this.ambient.dispose&&this.ambient.dispose(),this.spot=null,this.ambient=null,window.cancelAnimationFrame(this.loopId)},module.exports=a
function a(b){this.options=c.deepMerge(a.options,b)}var b=require('../three'),c=require('./../core/utils'),d=c.requestAnimationFrame;a.options={ambient:{color:'#fff',intensity:.5},spot:{color:'#333',intensity:10},isSolar:!1,radius:4e8,phi:10},a.prototype.addTo=function(a){this._map=a;var b=this.three3D=a.three3D;this.projection=a.projection,this.init(this.options),this.loop()},a.prototype.init=function(d){var f=this._map;this.lightMax=2;var g=this.three3D,a=this.spot=new b.SpotLight(d.spot.color,d.spot.intensity);a.lookAt(f.options.center||f.center),a.castShadow=!0,a.shadow.mapSize.width=1024,a.shadow.mapSize.height=1024,g.add(a);var c=new b.Color(d.ambient.color),e=d.ambient.intensity||1,h=this.ambient=new b.AmbientLight(c);h.color.setRGB(c.r*e,c.g*e,c.b*e),g.add(h)},a.prototype.updateOptions=function(a){a&&(this.options=c.deepMerge(this.options,a)),this.updateSolar()},a.prototype.updateSolar=function(){var a=this.options,c=new b.Color(a.ambient.color),d=a.ambient.intensity||1;this.ambient.color.setRGB(c.r*d,c.g*d,c.b*d);var e=new b.Color(a.spot.color);this.spot.color.setRGB(e.r,e.g,e.b),this.spot.intensity=a.spot.intensity},a.prototype.genMaterial=function(c){var a={side:b.BackSide,color:16711680};return new b.MeshBasicMaterial(a)},a.prototype.updateSolarPos=function(){var a=this.options.radius||this.projection.radius*8,b=this.options.phi,c=a*Math.cos(b),d=a*Math.sin(-.044444444444444446*Math.PI),e=a*Math.sin(b);this.spot.position.set(c,d,e)},a.prototype.update=function(){var b=this.three3D.camera,a=b.position,c=a.x,d=a.y,e=a.z;this.spot.position.set(c,d,e)},a.prototype.loop=function(){this.update(),this.loopId=d(this.loop.bind(this))},a.prototype.remove=function(){this.three3D.remove(this.spot),this.three3D.remove(this.ambient),this.spot&&this.spot.dispose&&this.spot.dispose(),this.ambient&&this.ambient.dispose&&this.ambient.dispose(),this.spot=null,this.ambient=null,window.cancelAnimationFrame(this.loopId)},module.exports=a

@@ -1,1 +0,1 @@

function b(){}var c=require('three'),a=require('./../core/utils'),d=require('bcore/event'),e=a.getColorFunc;b.options={}
function b(){}var c=require('../three'),a=require('./../core/utils'),d=require('bcore/event'),e=a.getColorFunc;b.options={}

@@ -1,1 +0,1 @@

function b(a){this.options=c.deepMerge(b.options,a)}var a=require('three'),c=require('./../core/utils'),f=require('bcore/event'),d=c.getColorFunc,e=' void main() {gl_Position = vec4( position, 1.0 );}',g=' uniform vec2 resolution; uniform sampler2D texture; void main() { vec2 uv = gl_FragCoord.xy / resolution.xy; vec3 color = texture2D(texture, uv).xyz; gl_FragColor = vec4(color, 1.0);}',h=' varying vec2 vUv; void main(){vUv = uv;gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );}';b.options={xN:360,yN:181,grids:function(a){return a.data},ptN:16e3,speedScale:1e-5,width:3600,height:1800,heatValue:function(b,c){var a=Math.sqrt(b*b+c*c);return a/=20,Math.max(Math.min(a,1),0)},heatFill:{to:'#ff00ef',from:'#09f0f0',space:'rgb',easing:'linear.Out.1'}},b=f.extend(b,{addTo:function(a){this._map=a;var b=this.three3D=a.three3D;this.renderer=b.renderer,this.projection=a.projection,this.initScene()},data:function(a){this.processing(a)},processing:function(o){var b=this.options,e=b.heatFill;e&&(e=d(e));var j=b.grids.bind(b),g=this._data=j(o),f=b.xN,i=b.yN,l,k,h,m,n,c=this.dataF32V=new Float32Array(f*i*4);for(var a in g)l=Math.floor(a/f),k=a%f,h=g[a],m=c[a*4+0]=h[0],n=c[a*4+1]=h[1],c[a*4+2]=0,c[a*4+3]=1},init:function(b){var a=this.options.ptN;this.n=Math.floor(Math.sqrt(a))+1,this.initCopyShader(),this.initWindMap(),this.initParticleTexture(),this.initShaderVP(),this.initParticles(),this.initBlurShader(),this.isInited=!0},updateHeatTexture:function(){var g=this.options,m=g.xN,k=g.yN,j=this._data,h=this.heatF32=new Float32Array(m*k*4),e=g.heatFill,n=g.heatValue,l,f,o,i;if(e){e=d(e);for(var b in j)l=j[b],o=n(l[0],l[1]),i=e(o),i=c.parse(i),f=i.arr,h[b*4+0]=f[0]/255,h[b*4+1]=f[1]/255,h[b*4+2]=f[2]/255,h[b*4+3]=f[3]}this.heatTexture=new a.DataTexture(this.heatF32,m,k,a.RGBAFormat,a.FloatType),this.heatTexture.needsUpdate=!0},updateData:function(){if(!this.isInited){this.init(),this.updateHeatTexture();return}this.updateHeatTexture()},render:function(a){a&&this.data(a),this.updateData()},initWindMap:function(){this.textureV=new a.DataTexture(this.dataF32V,this.options.xN,this.options.yN,a.RGBAFormat,a.FloatType),this.textureV.needsUpdate=!0},initRandomMap:function(){},initParticleTexture:function(){var d=this.options,e=this.n,g=e*e,c=new Float32Array(g*4);for(var b=0;b<g;b++)c[4*b+0]=Math.random(),c[4*b+1]=Math.random(),c[4*b+2]=Math.random(),c[4*b+3]=Math.random();var f=this.textureRand=new a.DataTexture(c,e,e,a.RGBAFormat,a.FloatType);f.needsUpdate=!0,this.texturePt=this.createRenderTarget(),this.texturePt.needsUpdate=!0,this.copy(f,this.texturePt),this.texturePtCopy=this.createRenderTarget(),this.texturePtCopy.needsUpdate=!0,this.copy(f,this.texturePtCopy),this.textureWind=this.createRenderTarget(a.RGBAFormat,d.width,d.height),this.textureWind.needsUpdate=!0,this.textureWindCopy=this.createRenderTarget(a.RGBAFormat,d.width,d.height),this.textureWindCopy.needsUpdate=!0},createRenderTarget:function(c,d,e,b){return c=c||a.RGBAFormat,d=d||this.n,e=e||this.n,b=b||a.NearestFilter,new a.WebGLRenderTarget(d,e,{wrapS:a.RepeatWrapping,wrapT:a.RepeatWrapping,minFilter:b,magFilter:b,format:c,type:a.FloatType,stencilBuffer:!1})},initShaderVP:function(){this.shaderVP=new a.ShaderMaterial({uniforms:{random:{type:'f',value:1},textureV:{type:'t',value:this.textureV},textureRand:{type:'t',value:this.textureRand},texturePt:{type:'t',value:this.texturePt},speedScale:{type:'f',value:this.options.speedScale}},vertexShader:e,fragmentShader:this.initFragVP()})},initFragVP:function(){return},initCopyShader:function(){var b=this.copyShader=new a.ShaderMaterial({uniforms:{resolution:{type:'v2',value:new a.Vector2(this.n,this.n)},texture:{type:'t',value:null}},vertexShader:e,fragmentShader:g});b.needsUpdate=!0},initScene:function(){var b=this.camera=new a.Camera;b.position.z=1,this.scene=new a.Scene;var c=new a.PlaneBufferGeometry(2,2),d=new a.MeshBasicMaterial,e=this.mesh=new a.Mesh(c,d);this.scene.add(e),this.scenePoints=new a.Scene;var f=new a.BufferGeometry},initParticleShader:function(){this.shaderPt=new a.ShaderMaterial({vertexShader:this.initVetexPt(),fragmentShader:this.initFragPt(),uniforms:{texturePt:{type:'t',value:this.texturePt}},transparent:!0})},initVetexPt:function(){return},initFragPt:function(){return},initParticles:function(){this.initParticleShader();var d=this.options.ptN,e=this.n,h=this.n,f=new a.BufferGeometry,c=new Float32Array(d*3),g=new Float32Array(d*2);for(var b=0;b<d;b++)g[b*2]=b%e/e,g[b*2+1]=Math.floor(b/e)/h,c[b*3+0]=0,c[b*3+1]=0,c[b*3+2]=0;f.addAttribute('position',new a.BufferAttribute(c,3)),f.addAttribute('uvs',new a.BufferAttribute(g,2));var i=new a.Points(f,this.shaderPt);this.scenePoints.add(i)},updateAnim:function(){this.updatePt(),this.updateVP()},animate:function(){this.updateAnim(),requestAnimationFrame(this.animate.bind(this))},updatePt:function(){var a=this.shaderPt;if(!a)return;a.uniforms.texturePt.value=this.texturePt,a.uniforms.texturePt.needsUpdate=!0,this.renderer.setClearColor(0,0),this.isOrder?this.renderer.render(this.scenePoints,this.camera,this.textureWindCopy,!0):this.renderer.render(this.scenePoints,this.camera,this.textureWind,!0),this.updateBlur()},updateVP:function(){if(!this.shaderVP)return;this.mesh.material=this.shaderVP,this.shaderVP.uniforms.random.value=Math.random(),this.shaderVP.uniforms.random.needsUpdate=!0,this.shaderVP.uniforms.textureRand.value=this.textureRand,this.shaderVP.uniforms.textureRand.needsUpdate=!0,this.isOrder?(this.shaderVP.uniforms.texturePt.value=this.texturePtCopy,this.shaderVP.uniforms.texturePt.needsUpdate=!0,this.renderer.render(this.scene,this.camera,this.texturePt,!0)):(this.shaderVP.uniforms.texturePt.value=this.texturePt,this.shaderVP.uniforms.texturePt.needsUpdate=!0,this.renderer.render(this.scene,this.camera,this.texturePtCopy,!1)),this.isOrder=!this.isOrder},updateBlur:function(){var a=this.blurShader;if(!a)return;this.isOrer?(a.uniforms.texturePrev.value=this.textureWind,a.uniforms.texturePrev.needsUpdate=!0,a.uniforms.texture.value=this.textureWindCopy,a.uniforms.texture.needsUpdate=!0):(a.uniforms.texturePrev.value=this.textureWindCopy,a.uniforms.texturePrev.needsUpdate=!0,a.uniforms.texture.value=this.textureWind,a.uniforms.texture.needsUpdate=!0),a.needsUpdate=!0},initBlurShader:function(){this.blurShader=new a.ShaderMaterial({vertexShader:h,fragmentShader:this.initFragBlur(),uniforms:{texturePrev:{type:'t',value:null},texture:{type:'t',value:null}},transparent:!0})},initFragBlur:function(){return},copy:function(b,c){var a=this.mesh.material=this.copyShader;a.uniforms.texture.value=b,a.uniforms.texture.needsUpdate=!0,this.renderer.render(this.scene,this.camera,c,!0)}}),module.exports=b
function b(a){this.options=c.deepMerge(b.options,a)}var a=require('../three'),c=require('./../core/utils'),f=require('bcore/event'),d=c.getColorFunc,e=' void main() {gl_Position = vec4( position, 1.0 );}',g=' uniform vec2 resolution; uniform sampler2D texture; void main() { vec2 uv = gl_FragCoord.xy / resolution.xy; vec3 color = texture2D(texture, uv).xyz; gl_FragColor = vec4(color, 1.0);}',h=' varying vec2 vUv; void main(){vUv = uv;gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );}';b.options={xN:360,yN:181,grids:function(a){return a.data},ptN:16e3,speedScale:1e-5,width:3600,height:1800,heatValue:function(b,c){var a=Math.sqrt(b*b+c*c);return a/=20,Math.max(Math.min(a,1),0)},heatFill:{to:'#ff00ef',from:'#09f0f0',space:'rgb',easing:'linear.Out.1'}},b=f.extend(b,{addTo:function(a){this._map=a;var b=this.three3D=a.three3D;this.renderer=b.renderer,this.projection=a.projection,this.initScene()},data:function(a){this.processing(a)},processing:function(o){var b=this.options,e=b.heatFill;e&&(e=d(e));var j=b.grids.bind(b),g=this._data=j(o),f=b.xN,i=b.yN,l,k,h,m,n,c=this.dataF32V=new Float32Array(f*i*4);for(var a in g)l=Math.floor(a/f),k=a%f,h=g[a],m=c[a*4+0]=h[0],n=c[a*4+1]=h[1],c[a*4+2]=0,c[a*4+3]=1},init:function(b){var a=this.options.ptN;this.n=Math.floor(Math.sqrt(a))+1,this.initCopyShader(),this.initWindMap(),this.initParticleTexture(),this.initShaderVP(),this.initParticles(),this.initBlurShader(),this.isInited=!0},updateHeatTexture:function(){var g=this.options,m=g.xN,k=g.yN,j=this._data,h=this.heatF32=new Float32Array(m*k*4),e=g.heatFill,n=g.heatValue,l,f,o,i;if(e){e=d(e);for(var b in j)l=j[b],o=n(l[0],l[1]),i=e(o),i=c.parse(i),f=i.arr,h[b*4+0]=f[0]/255,h[b*4+1]=f[1]/255,h[b*4+2]=f[2]/255,h[b*4+3]=f[3]}this.heatTexture=new a.DataTexture(this.heatF32,m,k,a.RGBAFormat,a.FloatType),this.heatTexture.needsUpdate=!0},updateData:function(){if(!this.isInited){this.init(),this.updateHeatTexture();return}this.updateHeatTexture()},render:function(a){a&&this.data(a),this.updateData()},initWindMap:function(){this.textureV=new a.DataTexture(this.dataF32V,this.options.xN,this.options.yN,a.RGBAFormat,a.FloatType),this.textureV.needsUpdate=!0},initRandomMap:function(){},initParticleTexture:function(){var d=this.options,e=this.n,g=e*e,c=new Float32Array(g*4);for(var b=0;b<g;b++)c[4*b+0]=Math.random(),c[4*b+1]=Math.random(),c[4*b+2]=Math.random(),c[4*b+3]=Math.random();var f=this.textureRand=new a.DataTexture(c,e,e,a.RGBAFormat,a.FloatType);f.needsUpdate=!0,this.texturePt=this.createRenderTarget(),this.texturePt.needsUpdate=!0,this.copy(f,this.texturePt),this.texturePtCopy=this.createRenderTarget(),this.texturePtCopy.needsUpdate=!0,this.copy(f,this.texturePtCopy),this.textureWind=this.createRenderTarget(a.RGBAFormat,d.width,d.height),this.textureWind.needsUpdate=!0,this.textureWindCopy=this.createRenderTarget(a.RGBAFormat,d.width,d.height),this.textureWindCopy.needsUpdate=!0},createRenderTarget:function(c,d,e,b){return c=c||a.RGBAFormat,d=d||this.n,e=e||this.n,b=b||a.NearestFilter,new a.WebGLRenderTarget(d,e,{wrapS:a.RepeatWrapping,wrapT:a.RepeatWrapping,minFilter:b,magFilter:b,format:c,type:a.FloatType,stencilBuffer:!1})},initShaderVP:function(){this.shaderVP=new a.ShaderMaterial({uniforms:{random:{type:'f',value:1},textureV:{type:'t',value:this.textureV},textureRand:{type:'t',value:this.textureRand},texturePt:{type:'t',value:this.texturePt},speedScale:{type:'f',value:this.options.speedScale}},vertexShader:e,fragmentShader:this.initFragVP()})},initFragVP:function(){return},initCopyShader:function(){var b=this.copyShader=new a.ShaderMaterial({uniforms:{resolution:{type:'v2',value:new a.Vector2(this.n,this.n)},texture:{type:'t',value:null}},vertexShader:e,fragmentShader:g});b.needsUpdate=!0},initScene:function(){var b=this.camera=new a.Camera;b.position.z=1,this.scene=new a.Scene;var c=new a.PlaneBufferGeometry(2,2),d=new a.MeshBasicMaterial,e=this.mesh=new a.Mesh(c,d);this.scene.add(e),this.scenePoints=new a.Scene;var f=new a.BufferGeometry},initParticleShader:function(){this.shaderPt=new a.ShaderMaterial({vertexShader:this.initVetexPt(),fragmentShader:this.initFragPt(),uniforms:{texturePt:{type:'t',value:this.texturePt}},transparent:!0})},initVetexPt:function(){return},initFragPt:function(){return},initParticles:function(){this.initParticleShader();var d=this.options.ptN,e=this.n,h=this.n,f=new a.BufferGeometry,c=new Float32Array(d*3),g=new Float32Array(d*2);for(var b=0;b<d;b++)g[b*2]=b%e/e,g[b*2+1]=Math.floor(b/e)/h,c[b*3+0]=0,c[b*3+1]=0,c[b*3+2]=0;f.addAttribute('position',new a.BufferAttribute(c,3)),f.addAttribute('uvs',new a.BufferAttribute(g,2));var i=new a.Points(f,this.shaderPt);this.scenePoints.add(i)},updateAnim:function(){this.updatePt(),this.updateVP()},animate:function(){this.updateAnim(),requestAnimationFrame(this.animate.bind(this))},updatePt:function(){var a=this.shaderPt;if(!a)return;a.uniforms.texturePt.value=this.texturePt,a.uniforms.texturePt.needsUpdate=!0,this.renderer.setClearColor(0,0),this.isOrder?this.renderer.render(this.scenePoints,this.camera,this.textureWindCopy,!0):this.renderer.render(this.scenePoints,this.camera,this.textureWind,!0),this.updateBlur()},updateVP:function(){if(!this.shaderVP)return;this.mesh.material=this.shaderVP,this.shaderVP.uniforms.random.value=Math.random(),this.shaderVP.uniforms.random.needsUpdate=!0,this.shaderVP.uniforms.textureRand.value=this.textureRand,this.shaderVP.uniforms.textureRand.needsUpdate=!0,this.isOrder?(this.shaderVP.uniforms.texturePt.value=this.texturePtCopy,this.shaderVP.uniforms.texturePt.needsUpdate=!0,this.renderer.render(this.scene,this.camera,this.texturePt,!0)):(this.shaderVP.uniforms.texturePt.value=this.texturePt,this.shaderVP.uniforms.texturePt.needsUpdate=!0,this.renderer.render(this.scene,this.camera,this.texturePtCopy,!1)),this.isOrder=!this.isOrder},updateBlur:function(){var a=this.blurShader;if(!a)return;this.isOrer?(a.uniforms.texturePrev.value=this.textureWind,a.uniforms.texturePrev.needsUpdate=!0,a.uniforms.texture.value=this.textureWindCopy,a.uniforms.texture.needsUpdate=!0):(a.uniforms.texturePrev.value=this.textureWindCopy,a.uniforms.texturePrev.needsUpdate=!0,a.uniforms.texture.value=this.textureWind,a.uniforms.texture.needsUpdate=!0),a.needsUpdate=!0},initBlurShader:function(){this.blurShader=new a.ShaderMaterial({vertexShader:h,fragmentShader:this.initFragBlur(),uniforms:{texturePrev:{type:'t',value:null},texture:{type:'t',value:null}},transparent:!0})},initFragBlur:function(){return},copy:function(b,c){var a=this.mesh.material=this.copyShader;a.uniforms.texture.value=b,a.uniforms.texture.needsUpdate=!0,this.renderer.render(this.scene,this.camera,c,!0)}}),module.exports=b

@@ -1,1 +0,1 @@

function b(a){return JSON.parse(JSON.stringify(a))}function g(b,c,d){for(var a in b)b[a]=(c[a]-b[a])*d+b[a]}function a(c,d){this.options=b(e.deepMerge(a.options,d)),this.containner=e.getContainer(c),this.detect()}var d=require('three'),c=Math.PI,e=require('./../core/utils'),i=require('bcore/event'),h=e.getScreenPt,j=e.requestAnimationFrame,k=e.cancelAnimationFrame,f=require('tween.js');a.options={isDetect:!1,interactive:{mouseX:{type:'rotatex',phi:.005},mouseY:{type:'rotatey',phi:.005},scroll:{type:'distance',phi:.005,speed:.01}},distance:{value:100,target:1e3,speed:.003,max:2e8,min:1,limit:.01},center:{limit:.01,speed:2,value:{x:0,y:0,z:0},target:{x:0,y:0,z:0}},rotation:{limit:1e-4,speed:.1,value:{x:0,y:0},target:{x:9.801592653589791,y:.31579632679489666},autoRotateSpeed:0},lookAt:{limit:.01,speed:.6,speedMouseUp:.1,speedMouseDown:.6,value:{x:-500,y:400,z:0},target:{x:0,y:0,z:0}}},a=i.extend(a,{linkTo:function(a){this.camera=a,this.initialize(this.options)},initPlane:function(){this.plane=new d.Plane(new d.Vector3(0,1,0),0)},updateOptions:function(a){a&&(this.options=b(e.deepMerge(this.options,a)))},initialize:function(a){this.initPlane(),this.initVariables(),this.initEvents(),this.loop()},initVariables:function(){var a=this.options;this.mouse={x:0,y:0},this.mouseOnDown=b(this.mouse),this.rotationTargetOnDown=b(a.rotation.target),this.lookAtTargetOnDown=b(a.lookAt.target),this.overRenderer=!1},initEvents:function(){var b=this,a=this.containner;a.addEventListener('mousewheel',this.mouseWheel.bind(this)),a.addEventListener('mousedown',this.mouseDown.bind(this)),a.addEventListener('touchstart',this.mouseDown.bind(this)),a.addEventListener('mousemove',this.mouseMove.bind(this)),a.addEventListener('touchmove',this.mouseMove.bind(this)),a.addEventListener('touchleave',this.mouseUp.bind(this)),a.addEventListener('touchup',this.mouseUp.bind(this)),a.addEventListener('mouseup',this.mouseUp.bind(this)),a.addEventListener('mouseover',function(){b.overRenderer=!0}),a.addEventListener('mouseout',function(){b.overRenderer=!1}),a.addEventListener('touchup',function(){b.overRenderer=!1})},loop:function(){this.update(),f.update(),j(this.loop.bind(this))},update:function(){var j=this.options,e=j.rotation,b=e.value,i=e.target;e.autoRotateSpeed&&!this.isMouseDown&&(i.x+=e.autoRotateSpeed),Math.abs(i.x-b.x)+Math.abs(i.y-b.y)>e.limit&&g(b,i,e.speed);var a=j.distance;Math.abs(a.target-a.value)>a.limit&&(a.value+=(a.target-a.value)*a.speed);var m=j.center,l=m.value,f=m.target;Math.abs(f.x-l.x)+Math.abs(f.y-l.y)>m.limit&&g(l,f,f.speed);var k=j.lookAt,c=k.value,h=k.target;Math.abs(h.x-c.x)+Math.abs(h.y-c.y)+Math.abs(h.z-c.z)>k.limit&&g(c,h,k.speed);var n=a.value*Math.sin(b.x)*Math.cos(b.y)+c.x,o=a.value*Math.sin(b.y)+c.y,p=a.value*Math.cos(b.x)*Math.cos(b.y)+c.z,d=this.camera;d.near/a.value>1e-4&&(d.far=Math.max(a.value*1e4,1),d.near=a.value/1e3,d.updateProjectionMatrix()),d.position.set(n,o,p),d.lookAt(c)},mouseDown:function(c){this.isMouseDown=!0,this.options.lookAt.target=b(this.options.lookAt.value),this.options.lookAt.speed=this.options.lookAt.speedMouseDown;var a=h(c);this.mouseOnDown.x=a[0],this.mouseOnDown.y=a[1],this.rotationTargetOnDown=b(this.options.rotation.target),this.lookAtTargetOnDown=b(this.options.lookAt.target),this.cameraClone=this.camera.clone(),this.downPoint=this.unproject(this.mouseOnDown.x,this.mouseOnDown.y),c.preventDefault()}}),a.prototype.mouseMove=function(p){if(!this.isMouseDown)return;p.preventDefault();var d=this.options,k=h(p),b=this.mouse,u=this.mouseOnDown;b.x=k[0],b.y=k[1];var t=d.distance.value/1e3,a=d.rotation.target,n=this.rotationTargetOnDown,j=d.interactive,e=j.mouseX,g=j.mouseY,l=d.lookAt.target,m=this.lookAtTargetOnDown,q=this.mouse.x-this.mouseOnDown.x,r=this.mouse.y-this.mouseOnDown.y;e.type==='rotatex'&&(a.x=n.x-q*e.phi),g.type==='rotatey'&&(a.y=n.y+r*g.phi,a.y=a.y>c/2?c/2:a.y,a.y=a.y<-c/2?-c/2:a.y);var i=this.downPoint,f=this.unproject(b.x,b.y);if(!(f&&i))return;var o=f.z-i.z,s=f.x-i.x;e.type==='panx'&&(l.x=m.x-s),g.type==='pany'&&(l.z=m.z-o)},a.prototype.mouseUp=function(b){b.preventDefault();var a=this.options;if(this.isMouseDown=!1,this.options.lookAt.speed=this.options.lookAt.speedMouseUp,!this.options.isDetect)return;console.log('\n'+JSON.stringify({center:a.lookAt.target,distance:a.distance.target,rotation:a.rotation.target}).replace(/\"/g,'\''))},a.prototype.detect=function(){var a=this.options.interactive;window.addEventListener('keydown',function(c){var b=navigator.appname=='Netscape'?event.which:window.event.keyCode;b===32?a.mouseX.type==='panx'?(a.mouseX.type='rotatex',a.mouseY.type='rotatey'):(a.mouseX.type='panx',a.mouseY.type='pany'):b===90?this.mouseWheel({wheelDeltaY:1}):b===67?this.mouseWheel({wheelDeltaY:-1}):b===38||b===40}.bind(this))},a.prototype.unproject=function(h,i){var e=this.containner.offsetWidth,f=this.containner.offsetHeight,g=this.cameraClone,c=new d.Vector3;c.set(h/e*2-1,-(i/f)*2+1,.5);var a=new d.Raycaster;a.setFromCamera(c.clone(),g);var j=a.ray.direction,k=a.ray.origin,b=a.ray.intersectPlane(this.plane);return b?new d.Vector3(b.x,0,b.z):void 0},a.prototype.mouseWheel=function(a){a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();var b=0;if(a.wheelDelta!==undefined?b=a.wheelDelta:a.detail!==undefined&&(b=-a.detail),this.overRenderer){var c=1+(b>0?5:-5)*this.options.interactive.scroll.speed;c=Math.max(Math.min(c,1.5),0),this.zoom(c)}return!1},a.prototype.flyingTo=function(v,w,u,k){w=w||.75,u=u||0,k=k||0;var b,e;for(var r in v){var t=v[r],m=t.geometry;m.computeBoundingBox();var a=m.boundingBox;r===0&&(b=a.max.clone(),e=a.min.clone()),b.x<a.max.x&&(b.x=a.max.x),b.y<a.max.y&&(b.y=a.max.y),b.z<a.max.z&&(b.z=a.max.z),e.x>a.min.x&&(e.x=a.min.x),e.y>a.min.y&&(e.y=a.min.y),e.z>a.min.z&&(e.z=a.min.z)}var s=this.containner,A=s.width(),F=s.height(),f=b.x,g=b.y,p=b.z,j=e.x,i=e.y,l=e.z,q=Math.abs(f-j),h=Math.abs(g-i),o=(f+j)/2,n=(g+i)/2,x=(p+l)/2,B=f-j,C=g-i,D=p-l,E=new d.Vector3(n,x,o);h&&q/h>self.w/self.h&&(q=h*self.w/self.h);var y=this.getCamera(),z=y.fov/360*c;this.lookAtTarget.x=-n+k,this.lookAtTarget.z=-o+k,this.lookAtTarget.y=0,this.rotation.x=c,this.rotation.y=c/2},a.prototype.genTween=function(a,d){var i=this.camera,e=this,b=e.options,c=a.easingType||'Sinusoidal.InOut',g=f.Easing[c.split('.')[0]][c.split('.')[1]],h=new f.Tween(b.rotation.target).to(a,a.duration*1e3||500).delay(a.delay*1e3||0).easing(g).onUpdate(function(){b.rotation.target.x=this.x,b.rotation.target.y=this.y}).onStart(function(){}).onStop(function(){}).onComplete(function(){a.onComplete&&a.onComplete(),d&&d()});return h},a.prototype.flyTo=function(a,b){this.currentTween=this.genTween(a,b),this.currentTween.start()},a.prototype.flying=function(b){var a=this.options;a.distance.target=b.distance||a.distance.target,a.lookAt.target=b.lookAt||a.lookAt.target,a.rotation.target=b.rotation||a.rotation.target,b.autoRotateSpeed&&(a.rotation.autoRotateSpeed=b.autoRotateSpeed)},a.prototype.flyingDirect=function(b){var a=this.options;a.distance.target=b.distance,a.lookAt.target=b.lookAt,a.rotation.target=b.rotation,a.distance.value=b.distance,a.lookAt.value=b.lookAt,a.rotation.value=b.rotation},a.prototype.zoom=function(b){var a=this.options.distance;a.target=Math.max(Math.min(a.target*b,a.max),a.min)},module.exports=a
function b(a){return JSON.parse(JSON.stringify(a))}function g(b,c,d){for(var a in b)b[a]=(c[a]-b[a])*d+b[a]}function a(c,d){this.options=b(e.deepMerge(a.options,d)),this.containner=e.getContainer(c),this.detect()}var d=require('../three'),c=Math.PI,e=require('./../core/utils'),i=require('bcore/event'),h=e.getScreenPt,j=e.requestAnimationFrame,k=e.cancelAnimationFrame,f=require('tween.js');a.options={isDetect:!1,interactive:{mouseX:{type:'rotatex',phi:.005},mouseY:{type:'rotatey',phi:.005},scroll:{type:'distance',phi:.005,speed:.01}},distance:{value:100,target:1e3,speed:.003,max:2e8,min:1,limit:.01},center:{limit:.01,speed:2,value:{x:0,y:0,z:0},target:{x:0,y:0,z:0}},rotation:{limit:1e-4,speed:.1,value:{x:0,y:0},target:{x:9.801592653589791,y:.31579632679489666},autoRotateSpeed:0},lookAt:{limit:.01,speed:.6,speedMouseUp:.1,speedMouseDown:.6,value:{x:-500,y:400,z:0},target:{x:0,y:0,z:0}}},a=i.extend(a,{linkTo:function(a){this.camera=a,this.initialize(this.options)},initPlane:function(){this.plane=new d.Plane(new d.Vector3(0,1,0),0)},updateOptions:function(a){a&&(this.options=b(e.deepMerge(this.options,a)))},initialize:function(a){this.initPlane(),this.initVariables(),this.initEvents(),this.loop()},initVariables:function(){var a=this.options;this.mouse={x:0,y:0},this.mouseOnDown=b(this.mouse),this.rotationTargetOnDown=b(a.rotation.target),this.lookAtTargetOnDown=b(a.lookAt.target),this.overRenderer=!1},initEvents:function(){var b=this,a=this.containner;a.addEventListener('mousewheel',this.mouseWheel.bind(this)),a.addEventListener('mousedown',this.mouseDown.bind(this)),a.addEventListener('touchstart',this.mouseDown.bind(this)),a.addEventListener('mousemove',this.mouseMove.bind(this)),a.addEventListener('touchmove',this.mouseMove.bind(this)),a.addEventListener('touchleave',this.mouseUp.bind(this)),a.addEventListener('touchup',this.mouseUp.bind(this)),a.addEventListener('mouseup',this.mouseUp.bind(this)),a.addEventListener('mouseover',function(){b.overRenderer=!0}),a.addEventListener('mouseout',function(){b.overRenderer=!1}),a.addEventListener('touchup',function(){b.overRenderer=!1})},loop:function(){this.update(),f.update(),j(this.loop.bind(this))},update:function(){var j=this.options,e=j.rotation,b=e.value,i=e.target;e.autoRotateSpeed&&!this.isMouseDown&&(i.x+=e.autoRotateSpeed),Math.abs(i.x-b.x)+Math.abs(i.y-b.y)>e.limit&&g(b,i,e.speed);var a=j.distance;Math.abs(a.target-a.value)>a.limit&&(a.value+=(a.target-a.value)*a.speed);var m=j.center,l=m.value,f=m.target;Math.abs(f.x-l.x)+Math.abs(f.y-l.y)>m.limit&&g(l,f,f.speed);var k=j.lookAt,c=k.value,h=k.target;Math.abs(h.x-c.x)+Math.abs(h.y-c.y)+Math.abs(h.z-c.z)>k.limit&&g(c,h,k.speed);var n=a.value*Math.sin(b.x)*Math.cos(b.y)+c.x,o=a.value*Math.sin(b.y)+c.y,p=a.value*Math.cos(b.x)*Math.cos(b.y)+c.z,d=this.camera;d.near/a.value>1e-4&&(d.far=Math.max(a.value*1e4,1),d.near=a.value/1e3,d.updateProjectionMatrix()),d.position.set(n,o,p),d.lookAt(c)},mouseDown:function(c){this.isMouseDown=!0,this.options.lookAt.target=b(this.options.lookAt.value),this.options.lookAt.speed=this.options.lookAt.speedMouseDown;var a=h(c);this.mouseOnDown.x=a[0],this.mouseOnDown.y=a[1],this.rotationTargetOnDown=b(this.options.rotation.target),this.lookAtTargetOnDown=b(this.options.lookAt.target),this.cameraClone=this.camera.clone(),this.downPoint=this.unproject(this.mouseOnDown.x,this.mouseOnDown.y),c.preventDefault()}}),a.prototype.mouseMove=function(p){if(!this.isMouseDown)return;p.preventDefault();var d=this.options,k=h(p),b=this.mouse,u=this.mouseOnDown;b.x=k[0],b.y=k[1];var t=d.distance.value/1e3,a=d.rotation.target,n=this.rotationTargetOnDown,j=d.interactive,e=j.mouseX,g=j.mouseY,l=d.lookAt.target,m=this.lookAtTargetOnDown,q=this.mouse.x-this.mouseOnDown.x,r=this.mouse.y-this.mouseOnDown.y;e.type==='rotatex'&&(a.x=n.x-q*e.phi),g.type==='rotatey'&&(a.y=n.y+r*g.phi,a.y=a.y>c/2?c/2:a.y,a.y=a.y<-c/2?-c/2:a.y);var i=this.downPoint,f=this.unproject(b.x,b.y);if(!(f&&i))return;var o=f.z-i.z,s=f.x-i.x;e.type==='panx'&&(l.x=m.x-s),g.type==='pany'&&(l.z=m.z-o)},a.prototype.mouseUp=function(b){b.preventDefault();var a=this.options;if(this.isMouseDown=!1,this.options.lookAt.speed=this.options.lookAt.speedMouseUp,!this.options.isDetect)return;console.log('\n'+JSON.stringify({center:a.lookAt.target,distance:a.distance.target,rotation:a.rotation.target}).replace(/\"/g,'\''))},a.prototype.detect=function(){var a=this.options.interactive;window.addEventListener('keydown',function(c){var b=navigator.appname=='Netscape'?event.which:window.event.keyCode;b===32?a.mouseX.type==='panx'?(a.mouseX.type='rotatex',a.mouseY.type='rotatey'):(a.mouseX.type='panx',a.mouseY.type='pany'):b===90?this.mouseWheel({wheelDeltaY:1}):b===67?this.mouseWheel({wheelDeltaY:-1}):b===38||b===40}.bind(this))},a.prototype.unproject=function(h,i){var e=this.containner.offsetWidth,f=this.containner.offsetHeight,g=this.cameraClone,c=new d.Vector3;c.set(h/e*2-1,-(i/f)*2+1,.5);var a=new d.Raycaster;a.setFromCamera(c.clone(),g);var j=a.ray.direction,k=a.ray.origin,b=a.ray.intersectPlane(this.plane);return b?new d.Vector3(b.x,0,b.z):void 0},a.prototype.mouseWheel=function(a){a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();var b=0;if(a.wheelDelta!==undefined?b=a.wheelDelta:a.detail!==undefined&&(b=-a.detail),this.overRenderer){var c=1+(b>0?5:-5)*this.options.interactive.scroll.speed;c=Math.max(Math.min(c,1.5),0),this.zoom(c)}return!1},a.prototype.flyingTo=function(v,w,u,k){w=w||.75,u=u||0,k=k||0;var b,e;for(var r in v){var t=v[r],m=t.geometry;m.computeBoundingBox();var a=m.boundingBox;r===0&&(b=a.max.clone(),e=a.min.clone()),b.x<a.max.x&&(b.x=a.max.x),b.y<a.max.y&&(b.y=a.max.y),b.z<a.max.z&&(b.z=a.max.z),e.x>a.min.x&&(e.x=a.min.x),e.y>a.min.y&&(e.y=a.min.y),e.z>a.min.z&&(e.z=a.min.z)}var s=this.containner,A=s.width(),F=s.height(),f=b.x,g=b.y,p=b.z,j=e.x,i=e.y,l=e.z,q=Math.abs(f-j),h=Math.abs(g-i),o=(f+j)/2,n=(g+i)/2,x=(p+l)/2,B=f-j,C=g-i,D=p-l,E=new d.Vector3(n,x,o);h&&q/h>self.w/self.h&&(q=h*self.w/self.h);var y=this.getCamera(),z=y.fov/360*c;this.lookAtTarget.x=-n+k,this.lookAtTarget.z=-o+k,this.lookAtTarget.y=0,this.rotation.x=c,this.rotation.y=c/2},a.prototype.genTween=function(a,d){var i=this.camera,e=this,b=e.options,c=a.easingType||'Sinusoidal.InOut',g=f.Easing[c.split('.')[0]][c.split('.')[1]],h=new f.Tween(b.rotation.target).to(a,a.duration*1e3||500).delay(a.delay*1e3||0).easing(g).onUpdate(function(){b.rotation.target.x=this.x,b.rotation.target.y=this.y}).onStart(function(){}).onStop(function(){}).onComplete(function(){a.onComplete&&a.onComplete(),d&&d()});return h},a.prototype.flyTo=function(a,b){this.currentTween=this.genTween(a,b),this.currentTween.start()},a.prototype.flying=function(b){var a=this.options;a.distance.target=b.distance||a.distance.target,a.lookAt.target=b.lookAt||a.lookAt.target,a.rotation.target=b.rotation||a.rotation.target,b.autoRotateSpeed&&(a.rotation.autoRotateSpeed=b.autoRotateSpeed)},a.prototype.flyingDirect=function(b){var a=this.options;a.distance.target=b.distance,a.lookAt.target=b.lookAt,a.rotation.target=b.rotation,a.distance.value=b.distance,a.lookAt.value=b.lookAt,a.rotation.value=b.rotation},a.prototype.zoom=function(b){var a=this.options.distance;a.target=Math.max(Math.min(a.target*b,a.max),a.min)},module.exports=a

@@ -1,1 +0,1 @@

function d(b){var a;Array.isArray(b)?a=[]:a={};for(var c in b)a[c]=b[c];return a}function b(a,d){a=this.container=c.getContainer(a),d=this.options=c.deepMerge(b.options,d),this.setProjection(),this.initialize(a,d)}var g=require('three'),e=require('bcore/event'),c=require('bcore/utils'),f=require('./../render/three3d'),l=require('./interactions'),h=require('./projection/sphere'),i=require('./projection/mecator'),j=require('./projection/normal'),k=require('./projection/origin'),a=Math.PI/180;b.options={projection:'plane',rotation:{x:-1.53407346410207,y:Math.PI/4},rotateSpeed:.1,autoRotateSpeed:0,distance:19378137,distanceSpeed:.3,center:null,moveSpeed:.2,globalAlpha:1,clearAlpha:1,angle:50,far:1e7,near:10,clearColor:0,background:'transparent',pointerEvents:'auto'},b=e.extend(b,{init3d:function(a){var d=this.options,b=this.three3D=new f(a,this.getThree3dOptions()),c=this.interaction=new l(a,this.getInteractionOptions());c.linkTo(b.camera)},getInteractionOptions:function(){var a=this.options,b=a.center;return a?b&&(b=this.processingCenter(a.center)):a=this.options,{rotation:{target:a.rotation,speed:a.rotateSpeed,autoRotateSpeed:a.autoRotateSpeed},distance:{target:a.distance,speed:a.distanceSpeed},center:{target:b},lookAt:{target:b,speed:a.moveSpeed}}},getThree3dOptions:function(){var a=this.options;return{alpha:a.globalAlpha,clearAlpha:a.clearAlpha,clearColor:a.clearColor,background:a.background,camera:{angle:a.angle,far:a.far,near:a.near},pointerEvents:a.pointerEvents}},initialize:function(b,c){var a=this.options.center||{lat:40,lng:100};if(!a)return console.log('必须有中心点');this.setCenter(a),this.init3d(b)},setProjection:function(){var b=this.options,a=b.projection;if(typeof a==='object')return;if(typeof a!=='string')return console.log('可能projection格式有误');this.projection={normal:j,sphere:h,plane:i,origin:k}[a]},setCenter:function(a){this.center=a,this.updatePosition(a)},setView:function(){},setRadius:function(){},getCenter:function(){},openDetect:function(){this.interaction.openDetect()},closeDetect:function(){this.interaction.closeDetect()},processingCenter:function(a){return a?a.x!==undefined&&a.y!==null?new g.Vector3(a.x,a.y,a.z):this.projection.project(a):null},updatePosition:function(a){var b=this.options,a=this.processingCenter(a);this.interaction&&this.interaction.flying({rotation:b.rotation,center:a,lookAt:a,distance:b.distance})},sphereFlying:function(b){var c=this.options;if(c.projection!=='sphere')return console.log('目前只支持球形墨卡托');var d=(90+b.lng)*a,e=b.lat*a,f={x:d,y:e};this.interaction&&this.interaction.flying({rotation:f})},tweenFly:function(b,f){var c=this.options;if(c.projection!=='sphere')return console.log('目前只支持球形墨卡托');var d=(90+b.lng)*a,e=b.lat*a;b.x=d,b.y=e,this.interaction&&this.interaction.flyTo(b,f)},updateCamera:function(){var a=this.options;this.three3D.updateCamera({angle:a.angle,far:a.far,near:a.near})},updateOptions:function(a){a&&(this.options=c.deepMerge(this.options,a)),this.interaction&&this.interaction.updateOptions(this.getInteractionOptions()),this.three3D.updateOptions(this.getThree3dOptions())},initEvents:function(){var a=this.interaction,b=this.options;a.on('zoom',function(){b.distance=a.options.distance.target}).on('rotate',function(){b.rotation=d(a.options.rotation.target)}).on('move',function(){b.center=d(a.options.lookAt.target),b.lookAt=d(a.options.lookAt.target)})}}),module.exports=b
function d(b){var a;Array.isArray(b)?a=[]:a={};for(var c in b)a[c]=b[c];return a}function b(a,d){a=this.container=c.getContainer(a),d=this.options=c.deepMerge(b.options,d),this.setProjection(),this.initialize(a,d)}var g=require('../three'),e=require('bcore/event'),c=require('bcore/utils'),f=require('./../render/three3d'),l=require('./interactions'),h=require('./projection/sphere'),i=require('./projection/mecator'),j=require('./projection/normal'),k=require('./projection/origin'),a=Math.PI/180;b.options={projection:'plane',rotation:{x:-1.53407346410207,y:Math.PI/4},rotateSpeed:.1,autoRotateSpeed:0,distance:19378137,distanceSpeed:.3,center:null,moveSpeed:.2,globalAlpha:1,clearAlpha:1,angle:50,far:1e7,near:10,clearColor:0,background:'transparent',pointerEvents:'auto'},b=e.extend(b,{init3d:function(a){var d=this.options,b=this.three3D=new f(a,this.getThree3dOptions()),c=this.interaction=new l(a,this.getInteractionOptions());c.linkTo(b.camera)},getInteractionOptions:function(){var a=this.options,b=a.center;return a?b&&(b=this.processingCenter(a.center)):a=this.options,{rotation:{target:a.rotation,speed:a.rotateSpeed,autoRotateSpeed:a.autoRotateSpeed},distance:{target:a.distance,speed:a.distanceSpeed},center:{target:b},lookAt:{target:b,speed:a.moveSpeed}}},getThree3dOptions:function(){var a=this.options;return{alpha:a.globalAlpha,clearAlpha:a.clearAlpha,clearColor:a.clearColor,background:a.background,camera:{angle:a.angle,far:a.far,near:a.near},pointerEvents:a.pointerEvents}},initialize:function(b,c){var a=this.options.center||{lat:40,lng:100};if(!a)return console.log('必须有中心点');this.setCenter(a),this.init3d(b)},setProjection:function(){var b=this.options,a=b.projection;if(typeof a==='object')return;if(typeof a!=='string')return console.log('可能projection格式有误');this.projection={normal:j,sphere:h,plane:i,origin:k}[a]},setCenter:function(a){this.center=a,this.updatePosition(a)},setView:function(){},setRadius:function(){},getCenter:function(){},openDetect:function(){this.interaction.openDetect()},closeDetect:function(){this.interaction.closeDetect()},processingCenter:function(a){return a?a.x!==undefined&&a.y!==null?new g.Vector3(a.x,a.y,a.z):this.projection.project(a):null},updatePosition:function(a){var b=this.options,a=this.processingCenter(a);this.interaction&&this.interaction.flying({rotation:b.rotation,center:a,lookAt:a,distance:b.distance})},sphereFlying:function(b){var c=this.options;if(c.projection!=='sphere')return console.log('目前只支持球形墨卡托');var d=(90+b.lng)*a,e=b.lat*a,f={x:d,y:e};this.interaction&&this.interaction.flying({rotation:f})},tweenFly:function(b,f){var c=this.options;if(c.projection!=='sphere')return console.log('目前只支持球形墨卡托');var d=(90+b.lng)*a,e=b.lat*a;b.x=d,b.y=e,this.interaction&&this.interaction.flyTo(b,f)},updateCamera:function(){var a=this.options;this.three3D.updateCamera({angle:a.angle,far:a.far,near:a.near})},updateOptions:function(a){a&&(this.options=c.deepMerge(this.options,a)),this.interaction&&this.interaction.updateOptions(this.getInteractionOptions()),this.three3D.updateOptions(this.getThree3dOptions())},initEvents:function(){var a=this.interaction,b=this.options;a.on('zoom',function(){b.distance=a.options.distance.target}).on('rotate',function(){b.rotation=d(a.options.rotation.target)}).on('move',function(){b.center=d(a.options.lookAt.target),b.lookAt=d(a.options.lookAt.target)})}}),module.exports=b

@@ -1,1 +0,1 @@

var c=require('three'),d=Math.log,e=Math.tan,f=Math.atan,g=Math.exp,b=Math.PI,h,i,a=b/180;module.exports={project:function(f,i,j,k){if(f.lat===null||f.lat===undefined)return;if(f.lng===null||f.lng===undefined)return;var h=this.radius,l=this.latMax,m=Math.max(Math.min(l,f.lat),-l),n=f.lng*a,g=m*a;g=d(e(b/4+g/2)),i=this.x+i||0,j=this.y+j||0,k=this.z+k||0;var o=new c.Vector3(h*g+i,j,h*n+k);return o},unProject:function(d,k,m,l){var c=1/this.radius,e=(d.z-(l||0))*c,j=(d.x-(k||0))*c;return i=e/a,h=(2*f(g(j))-b/2)/a,{lat:h,lng:i}},getNormal:function(){return new c.Vector3(0,1,0)},x:0,y:0,z:0,radius:6378137,type:'mecator',latMax:85.05112877980659}
var c=require('../../three'),d=Math.log,e=Math.tan,f=Math.atan,g=Math.exp,b=Math.PI,h,i,a=b/180;module.exports={project:function(f,i,j,k){if(f.lat===null||f.lat===undefined)return;if(f.lng===null||f.lng===undefined)return;var h=this.radius,l=this.latMax,m=Math.max(Math.min(l,f.lat),-l),n=f.lng*a,g=m*a;g=d(e(b/4+g/2)),i=this.x+i||0,j=this.y+j||0,k=this.z+k||0;var o=new c.Vector3(h*g+i,j,h*n+k);return o},unProject:function(d,k,m,l){var c=1/this.radius,e=(d.z-(l||0))*c,j=(d.x-(k||0))*c;return i=e/a,h=(2*f(g(j))-b/2)/a,{lat:h,lng:i}},getNormal:function(){return new c.Vector3(0,1,0)},x:0,y:0,z:0,radius:6378137,type:'mecator',latMax:85.05112877980659}

@@ -1,1 +0,1 @@

var a=require('three');module.exports={project:function(b){return new a.Vector3(b.x,b.y,b.z)},unProject:function(a,b,c){},radius:1,type:'normal'}
var a=require('../../three');module.exports={project:function(b){return new a.Vector3(b.x,b.y,b.z)},unProject:function(a,b,c){},radius:1,type:'normal'}

@@ -1,1 +0,1 @@

var b=require('three'),a=6378137;module.exports={project:function(e,c,d){return c=c||1,d=d||1,new b.Vector3(e.lng*a/180*c,0,-e.lat*a/180*d)},unProject:function(a,b,c){},radius:a,type:'origin_2d'}
var b=require('../../three'),a=6378137;module.exports={project:function(e,c,d){return c=c||1,d=d||1,new b.Vector3(e.lng*a/180*c,0,-e.lat*a/180*d)},unProject:function(a,b,c){},radius:a,type:'origin_2d'}

@@ -1,1 +0,1 @@

var b=require('three'),a=6378137;module.exports={project:function(c,d,e,f){return new b.Vector3(c.lng*a/180+(d||0),e||0,-c.lat*a/180*1.5+(f||0))},unProject:function(a,b,c){},radius:a,type:'origin'}
var b=require('../../three'),a=6378137;module.exports={project:function(c,d,e,f){return new b.Vector3(c.lng*a/180+(d||0),e||0,-c.lat*a/180*1.5+(f||0))},unProject:function(a,b,c){},radius:a,type:'origin'}

@@ -1,1 +0,1 @@

var l=require('three'),m=Math.PI,c=Math.cos,g=Math.sin,o=Math.asin,k=Math.atan,n=Math.exp,f,d,h,i,j,e,a,b=m/180;module.exports={project:function(k,n){if(n=n||1,k.lat===null||k.lat===undefined)return;if(k.lng===null||k.lng===undefined)return;if(!k)return;f=k.lat,d=k.lng,e=-d*b,a=f*b;var m=this.radius*n;h=m*c(e)*c(a)+this.x0,j=m*g(e)*c(a)+this.z0,i=m*g(a)+this.y0;var o=new l.Vector3(h,i,j);return o},unProject:function(e){var a=e.x-this.x0,g=e.y-this.y0,c=e.z-this.z0,h=Math.sqrt(a*a+c*c),i=k(g/h),j=c/a,l=k(j);return f=i/b,d=-l/b,a<0&&(d-=180),{lat:f,lng:d}},getNormal:function(k,m){if(m=m||1,k.lat===null||k.lat===undefined)return;if(k.lng===null||k.lng===undefined)return;if(!k)return;f=k.lat,d=k.lng,e=-d*b,a=f*b,h=c(e)*c(a)+this.x0,j=g(e)*c(a)+this.z0,i=g(a)+this.y0;var n=new l.Vector3(h,i,j).normalize();return n},radius:6378137,x0:0,y0:0,z0:0,type:'sphere'}
var l=require('../../three'),m=Math.PI,c=Math.cos,g=Math.sin,o=Math.asin,k=Math.atan,n=Math.exp,f,d,h,i,j,e,a,b=m/180;module.exports={project:function(k,n){if(n=n||1,k.lat===null||k.lat===undefined)return;if(k.lng===null||k.lng===undefined)return;if(!k)return;f=k.lat,d=k.lng,e=-d*b,a=f*b;var m=this.radius*n;h=m*c(e)*c(a)+this.x0,j=m*g(e)*c(a)+this.z0,i=m*g(a)+this.y0;var o=new l.Vector3(h,i,j);return o},unProject:function(e){var a=e.x-this.x0,g=e.y-this.y0,c=e.z-this.z0,h=Math.sqrt(a*a+c*c),i=k(g/h),j=c/a,l=k(j);return f=i/b,d=-l/b,a<0&&(d-=180),{lat:f,lng:d}},getNormal:function(k,m){if(m=m||1,k.lat===null||k.lat===undefined)return;if(k.lng===null||k.lng===undefined)return;if(!k)return;f=k.lat,d=k.lng,e=-d*b,a=f*b,h=c(e)*c(a)+this.x0,j=g(e)*c(a)+this.z0,i=g(a)+this.y0;var n=new l.Vector3(h,i,j).normalize();return n},radius:6378137,x0:0,y0:0,z0:0,type:'sphere'}

@@ -5,3 +5,3 @@ {

"description": "3d map visualization lib",
"version": "0.2.6",
"version": "0.2.7",
"scripts": {

@@ -8,0 +8,0 @@ "test": "mocha -r jscoverage test"

@@ -1,1 +0,1 @@

function b(a,d){this.three3D=a,this.options=c.deepMerge(b.options,d),this.initPhysic(),this.initPreview()}var a=require('three'),c=require('bcore/utils'),e=require('./physic'),f=require('./../core/utils').getSprite;b.options={ptN:6400,weight:function(a){return a.weight||a.mass||a.m||1},sprite:{drawN:31,color:{from:'hsla(0,100%,50%,0.8)',to:'hsla(0,100%,50%,0)',easing:'Linear.None.11.7',space:'rgb'}},material:{blending:a.AdditiveBlending,transparent:!0}},b.prototype={init:function(){var e=this.options,i=e.ptN,w=this._data,u=w.nodes,c=new a.Geometry,m=100,j=Math.ceil(Math.sqrt(i)),k=new Float32Array(i*3),l=new Float32Array(i*4),o=new Float32Array(i*2),q=new Float32Array(i*1),b=0,t=e.weight.bind(e);for(var p=0;p<j;p++)for(var n=0;n<j;n++)d=u[b]||{},q[b*1]=t(d)||1e-4,k[b*3+0]=Math.random()*m,k[b*3+1]=Math.random()*m,k[b*3+2]=Math.random()*m,l[b*3+0]=0,l[b*3+1]=.5,l[b*3+2]=1,o[b*2+0]=p/j,o[b*2+1]=n/j,b++;var c=new a.BufferGeometry;c.addAttribute('position',new a.BufferAttribute(k,3)),c.addAttribute('uvs',new a.BufferAttribute(o,2)),c.addAttribute('pcolor',new a.BufferAttribute(l,3)),c.addAttribute('mass',new a.BufferAttribute(q,1));var v=f(e.sprite),r=new a.Texture(v);r.needsUpdate=!0;var x=this.material=new a.ShaderMaterial({depthWrite:!1,transparent:e.material.transparent,uniforms:{texture:{type:'t',value:this.physicRender.textureP},sprite:{type:'t',value:r}},blending:e.material.blending,vertexShader:g,fragmentShader:h}),s=this.points=new a.Points(c,x);s.frustumCulled=!1,this.three3D.add(s)},initPhysic:function(){this.physicRender=new e(this.three3D,{ptN:this.options.ptN})},render:function(a){this._data=a,this.physicRender.render(a),this.init()},updateAnim:function(){this.physicRender.updateAnim(),this.updatePreview()},initPreview:function(){var c=new a.PlaneGeometry(105,105,32),b=new a.MeshBasicMaterial({color:'#fff',side:a.DoubleSide});b.needsUpdate=!0;var d=this.meshPrev=new a.Mesh(c,b);this.three3D.add(d)},updatePreview:function(){this.meshPrev.material.map=this.physicRender.textureLinkForce}};var g='uniform sampler2D texture;attribute vec3 pcolor;attribute vec2 uvs;attribute float mass;varying vec3 color;void main() { color = pcolor; gl_PointSize = mass * 3.0; vec3 pos = texture2D(texture, uvs).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 );}',h=' uniform sampler2D sprite; varying vec3 color; void main() { vec2 uv = vec2(gl_PointCoord.x,gl_PointCoord.y); vec4 texture2d = texture2D(sprite, uv); gl_FragColor = texture2d;}';module.exports=b
function b(a,d){this.three3D=a,this.options=c.deepMerge(b.options,d),this.initPhysic(),this.initPreview()}var a=require('../three'),c=require('bcore/utils'),e=require('./physic'),f=require('./../core/utils').getSprite;b.options={ptN:6400,weight:function(a){return a.weight||a.mass||a.m||1},sprite:{drawN:31,color:{from:'hsla(0,100%,50%,0.8)',to:'hsla(0,100%,50%,0)',easing:'Linear.None.11.7',space:'rgb'}},material:{blending:a.AdditiveBlending,transparent:!0}},b.prototype={init:function(){var e=this.options,i=e.ptN,w=this._data,u=w.nodes,c=new a.Geometry,m=100,j=Math.ceil(Math.sqrt(i)),k=new Float32Array(i*3),l=new Float32Array(i*4),o=new Float32Array(i*2),q=new Float32Array(i*1),b=0,t=e.weight.bind(e);for(var p=0;p<j;p++)for(var n=0;n<j;n++)d=u[b]||{},q[b*1]=t(d)||1e-4,k[b*3+0]=Math.random()*m,k[b*3+1]=Math.random()*m,k[b*3+2]=Math.random()*m,l[b*3+0]=0,l[b*3+1]=.5,l[b*3+2]=1,o[b*2+0]=p/j,o[b*2+1]=n/j,b++;var c=new a.BufferGeometry;c.addAttribute('position',new a.BufferAttribute(k,3)),c.addAttribute('uvs',new a.BufferAttribute(o,2)),c.addAttribute('pcolor',new a.BufferAttribute(l,3)),c.addAttribute('mass',new a.BufferAttribute(q,1));var v=f(e.sprite),r=new a.Texture(v);r.needsUpdate=!0;var x=this.material=new a.ShaderMaterial({depthWrite:!1,transparent:e.material.transparent,uniforms:{texture:{type:'t',value:this.physicRender.textureP},sprite:{type:'t',value:r}},blending:e.material.blending,vertexShader:g,fragmentShader:h}),s=this.points=new a.Points(c,x);s.frustumCulled=!1,this.three3D.add(s)},initPhysic:function(){this.physicRender=new e(this.three3D,{ptN:this.options.ptN})},render:function(a){this._data=a,this.physicRender.render(a),this.init()},updateAnim:function(){this.physicRender.updateAnim(),this.updatePreview()},initPreview:function(){var c=new a.PlaneGeometry(105,105,32),b=new a.MeshBasicMaterial({color:'#fff',side:a.DoubleSide});b.needsUpdate=!0;var d=this.meshPrev=new a.Mesh(c,b);this.three3D.add(d)},updatePreview:function(){this.meshPrev.material.map=this.physicRender.textureLinkForce}};var g='uniform sampler2D texture;attribute vec3 pcolor;attribute vec2 uvs;attribute float mass;varying vec3 color;void main() { color = pcolor; gl_PointSize = mass * 3.0; vec3 pos = texture2D(texture, uvs).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 );}',h=' uniform sampler2D sprite; varying vec3 color; void main() { vec2 uv = vec2(gl_PointCoord.x,gl_PointCoord.y); vec4 texture2d = texture2D(sprite, uv); gl_FragColor = texture2d;}';module.exports=b

@@ -1,1 +0,1 @@

function b(d,a){this.three3D=d,this.isOrder=!0,this.isable=!1,this.check(),a=this.options=c.deepMerge(b.options,a)}var a=require('three'),c=require('bcore/utils'),e=require('./force');b.options={ptNMax:14400,force:{newton:{minLength:10,G:.4,k:1e-5},resistance:{k:1e-4,min:.2}},mass:function(a){return a.weight||a.m||a.mass||1},v:function(a){return a.v||{x:0,y:0,z:0}},p:function(a){return a.p||a.position||{x:Math.random(),y:Math.random(),z:Math.random()}}},b.prototype={draw:function(){if(!this.isable)return;this._force=new e(this.options.force),this.initScene();var b=this.textureP=this.createRenderTarget(a.RGBAFormat),c=this.textureV=this.createRenderTarget(a.RGBAFormat),g=this.textureTmp=this.createRenderTarget(a.RGBAFormat),d=this.texturePCopy=b.clone(),f=this.textureVCopy=c.clone();this._links&&this.drawLinks(),this.resetTexture(),b.needsUpdate=c.needsUpdate=f.needsUpdate=d.needsUpdate=!0,this.shaderPV=this.createShader({frag:this.createFragV()}),this.shaderVP=this.createShader({frag:this.createFragS()})},render:function(a){a&&this.data(a),this.draw()},data:function(a){this.nodes(a.nodes),this.links(a.links)},nodes:function(j){if(!j)return;this._nodes=j;var b=this.options,c=j.length;if(c>b.ptNMax)return console.log('数据量太大 超过最大限制'+b.ptNMax+'个');var d=this.precision=Math.ceil(Math.sqrt(c)),n=b.mass.bind(b),o=b.v.bind(b),p=b.p.bind(b),g=new Float32Array(c*4),f=new Float32Array(c*4),e=new Float32Array(c*4),q=new Float32Array(c*4),m,a,i,k,l,r={x:1e14,y:1e14,z:1e14},s={x:0,y:0,z:0};for(var h=0;h<d*d;h++)l=j[h]||{},a=4*h,m=n(l)||0,e[a+0]=m,e[a+1]=0,e[a+2]=0,e[a+3]=0,i=o(l)||s,g[a+0]=i.x,g[a+1]=i.y,g[a+2]=i.z,g[a+3]=1,k=p(l)||r,f[a+0]=k.x,f[a+1]=k.y,f[a+2]=k.z,f[a+3]=1;this.vDataTexture=this.getDataTexture(g,d),this.pDataTexture=this.getDataTexture(f,d),this.mDataTexture=this.getDataTexture(e,d),this.cleanDataTexture=this.getDataTexture(q,d)},getDataTexture:function(f,d,b,e){e=e||a.RGBAFormat,b=b||d;var c=new a.DataTexture(f,d,b,a.RGBAFormat,a.FloatType);return c.needsUpdate=!0,c},check:function(){var b=this.renderer=this.three3D.renderer,a=b.getContext();if(!a.getExtension('OES_texture_float'))return console.log('No OES_texture_float support for float textures!');if(a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS)==0)return console.log('No support for vertex shader textures!');this.isable=!0},updateAnim:function(){var a=this.textureP,b=this.textureV,c=this.textureVCopy,d=this.texturePCopy;this.updateLinkForce(),this.isOrder?(this.updatePV(a,b,c),this.updateVP(a,c,d)):(this.updatePV(d,c,b),this.updateVP(d,b,a)),this.renderer.render(this.scene,this.camera,this.textureTmp),this.isOrder=!this.isOrder},updatePV:function(b,c,d){this.mesh.material=this.shaderPV;var a=this.shaderPV.uniforms;a.textureP.value=b,a.textureP.needsUpdate=!0,a.textureLinkForce.value=this.textureLinkForce,a.textureLinkForce.needsUpdate=!0,a.textureV.value=c,a.textureV.needsUpdate=!0,this.renderer.render(this.scene,this.camera,d)},updateVP:function(b,c,d){this.mesh.material=this.shaderVP;var a=this.shaderPV.uniforms;a.textureP.value=b,a.textureP.needsUpdate=!0,a.textureV.value=c,a.textureV.needsUpdate=!0,this.renderer.render(this.scene,this.camera,d)},initScene:function(){var e=this.camera=new a.Camera,b=this.precision;e.position.z=1,this.scene=new a.Scene;var c=this.copyShader=new a.ShaderMaterial({uniforms:{resolution:{type:'v2',value:new a.Vector2(b,b)},texture:{type:'t',value:null}},vertexShader:d,fragmentShader:f});c.needsUpdate=!0;var g=this.mesh=new a.Mesh(new a.PlaneBufferGeometry(2,2),c);this.scene.add(g)},copy:function(b,c){var a=this.mesh.material=this.copyShader;a.uniforms.texture.value=b,a.uniforms.texture.needsUpdate=!0,this.renderer.render(this.scene,this.camera,c,!0)},createShader:function(e){var b=this.precision,c={dt:{type:'f',value:1},resolution:{type:'v2',value:new a.Vector2(b,b)},textureP:{type:'t',value:null},textureLinkForce:{type:'t',value:null},textureV:{type:'t',value:null},textureM:{type:'t',value:this.mDataTexture}};return new a.ShaderMaterial({uniforms:c,vertexShader:d,fragmentShader:e.frag})},createRenderTarget:function(c){var b=this.precision;return new a.WebGLRenderTarget(b,b,{wrapS:a.RepeatWrapping,wrapT:a.RepeatWrapping,minFilter:a.NearestFilter,magFilter:a.NearestFilter,format:c,type:a.FloatType,stencilBuffer:!1})},createFragV:function(){var a=this._force,b=a.genNewton(),c=a.genResistance();return},createFragS:function(){return},updateForce:function(){this._force.updateOptions(this.options.force),this.shaderPV.fragmentShader=this.createFragV(),this.shaderPV.needsUpdate=!0},updateOptions:function(a){this.options=c.deepMerge(b.options,a)},resetTexture:function(){this.copy(this.pDataTexture,this.texturePCopy),this.copy(this.pDataTexture,this.textureP),this.copy(this.vDataTexture,this.textureV),this.copy(this.vDataTexture,this.textureVCopy),this.copy(this.vDataTexture,this.textureLinkForce),this.copy(this.vDataTexture,this.textureTmp)}},b.prototype=c.extend(b.prototype,require('./physic.links'));var d=' void main() {gl_Position = vec4( position, 1.0 );}',f=' uniform vec2 resolution; uniform sampler2D texture; void main() { vec2 uv = gl_FragCoord.xy / resolution.xy; vec3 color = texture2D(texture, uv).xyz; gl_FragColor = vec4(color, 1.0);}';module.exports=b
function b(d,a){this.three3D=d,this.isOrder=!0,this.isable=!1,this.check(),a=this.options=c.deepMerge(b.options,a)}var a=require('../three'),c=require('bcore/utils'),e=require('./force');b.options={ptNMax:14400,force:{newton:{minLength:10,G:.4,k:1e-5},resistance:{k:1e-4,min:.2}},mass:function(a){return a.weight||a.m||a.mass||1},v:function(a){return a.v||{x:0,y:0,z:0}},p:function(a){return a.p||a.position||{x:Math.random(),y:Math.random(),z:Math.random()}}},b.prototype={draw:function(){if(!this.isable)return;this._force=new e(this.options.force),this.initScene();var b=this.textureP=this.createRenderTarget(a.RGBAFormat),c=this.textureV=this.createRenderTarget(a.RGBAFormat),g=this.textureTmp=this.createRenderTarget(a.RGBAFormat),d=this.texturePCopy=b.clone(),f=this.textureVCopy=c.clone();this._links&&this.drawLinks(),this.resetTexture(),b.needsUpdate=c.needsUpdate=f.needsUpdate=d.needsUpdate=!0,this.shaderPV=this.createShader({frag:this.createFragV()}),this.shaderVP=this.createShader({frag:this.createFragS()})},render:function(a){a&&this.data(a),this.draw()},data:function(a){this.nodes(a.nodes),this.links(a.links)},nodes:function(j){if(!j)return;this._nodes=j;var b=this.options,c=j.length;if(c>b.ptNMax)return console.log('数据量太大 超过最大限制'+b.ptNMax+'个');var d=this.precision=Math.ceil(Math.sqrt(c)),n=b.mass.bind(b),o=b.v.bind(b),p=b.p.bind(b),g=new Float32Array(c*4),f=new Float32Array(c*4),e=new Float32Array(c*4),q=new Float32Array(c*4),m,a,i,k,l,r={x:1e14,y:1e14,z:1e14},s={x:0,y:0,z:0};for(var h=0;h<d*d;h++)l=j[h]||{},a=4*h,m=n(l)||0,e[a+0]=m,e[a+1]=0,e[a+2]=0,e[a+3]=0,i=o(l)||s,g[a+0]=i.x,g[a+1]=i.y,g[a+2]=i.z,g[a+3]=1,k=p(l)||r,f[a+0]=k.x,f[a+1]=k.y,f[a+2]=k.z,f[a+3]=1;this.vDataTexture=this.getDataTexture(g,d),this.pDataTexture=this.getDataTexture(f,d),this.mDataTexture=this.getDataTexture(e,d),this.cleanDataTexture=this.getDataTexture(q,d)},getDataTexture:function(f,d,b,e){e=e||a.RGBAFormat,b=b||d;var c=new a.DataTexture(f,d,b,a.RGBAFormat,a.FloatType);return c.needsUpdate=!0,c},check:function(){var b=this.renderer=this.three3D.renderer,a=b.getContext();if(!a.getExtension('OES_texture_float'))return console.log('No OES_texture_float support for float textures!');if(a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS)==0)return console.log('No support for vertex shader textures!');this.isable=!0},updateAnim:function(){var a=this.textureP,b=this.textureV,c=this.textureVCopy,d=this.texturePCopy;this.updateLinkForce(),this.isOrder?(this.updatePV(a,b,c),this.updateVP(a,c,d)):(this.updatePV(d,c,b),this.updateVP(d,b,a)),this.renderer.render(this.scene,this.camera,this.textureTmp),this.isOrder=!this.isOrder},updatePV:function(b,c,d){this.mesh.material=this.shaderPV;var a=this.shaderPV.uniforms;a.textureP.value=b,a.textureP.needsUpdate=!0,a.textureLinkForce.value=this.textureLinkForce,a.textureLinkForce.needsUpdate=!0,a.textureV.value=c,a.textureV.needsUpdate=!0,this.renderer.render(this.scene,this.camera,d)},updateVP:function(b,c,d){this.mesh.material=this.shaderVP;var a=this.shaderPV.uniforms;a.textureP.value=b,a.textureP.needsUpdate=!0,a.textureV.value=c,a.textureV.needsUpdate=!0,this.renderer.render(this.scene,this.camera,d)},initScene:function(){var e=this.camera=new a.Camera,b=this.precision;e.position.z=1,this.scene=new a.Scene;var c=this.copyShader=new a.ShaderMaterial({uniforms:{resolution:{type:'v2',value:new a.Vector2(b,b)},texture:{type:'t',value:null}},vertexShader:d,fragmentShader:f});c.needsUpdate=!0;var g=this.mesh=new a.Mesh(new a.PlaneBufferGeometry(2,2),c);this.scene.add(g)},copy:function(b,c){var a=this.mesh.material=this.copyShader;a.uniforms.texture.value=b,a.uniforms.texture.needsUpdate=!0,this.renderer.render(this.scene,this.camera,c,!0)},createShader:function(e){var b=this.precision,c={dt:{type:'f',value:1},resolution:{type:'v2',value:new a.Vector2(b,b)},textureP:{type:'t',value:null},textureLinkForce:{type:'t',value:null},textureV:{type:'t',value:null},textureM:{type:'t',value:this.mDataTexture}};return new a.ShaderMaterial({uniforms:c,vertexShader:d,fragmentShader:e.frag})},createRenderTarget:function(c){var b=this.precision;return new a.WebGLRenderTarget(b,b,{wrapS:a.RepeatWrapping,wrapT:a.RepeatWrapping,minFilter:a.NearestFilter,magFilter:a.NearestFilter,format:c,type:a.FloatType,stencilBuffer:!1})},createFragV:function(){var a=this._force,b=a.genNewton(),c=a.genResistance();return},createFragS:function(){return},updateForce:function(){this._force.updateOptions(this.options.force),this.shaderPV.fragmentShader=this.createFragV(),this.shaderPV.needsUpdate=!0},updateOptions:function(a){this.options=c.deepMerge(b.options,a)},resetTexture:function(){this.copy(this.pDataTexture,this.texturePCopy),this.copy(this.pDataTexture,this.textureP),this.copy(this.vDataTexture,this.textureV),this.copy(this.vDataTexture,this.textureVCopy),this.copy(this.vDataTexture,this.textureLinkForce),this.copy(this.vDataTexture,this.textureTmp)}},b.prototype=c.extend(b.prototype,require('./physic.links'));var d=' void main() {gl_Position = vec4( position, 1.0 );}',f=' uniform vec2 resolution; uniform sampler2D texture; void main() { vec2 uv = gl_FragCoord.xy / resolution.xy; vec3 color = texture2D(texture, uv).xyz; gl_FragColor = vec4(color, 1.0);}';module.exports=b

@@ -1,1 +0,1 @@

var a=require('three'),b=require('bcore/utils'),c=require('./force');module.exports={drawLinks:function(){if(!this.isable)return;if(!this._links)return;this.linkScene=new a.Scene;var b=this.textureLinkForce=this.createRenderTarget(a.RGBAFormat);this.copy(this.cleanDataTexture,b),this.createLinkComputing()},links:function(a){this._links=a},createLinkComputing:function(){var c=this.linkScene;this._linkPoints&&c.remove(this._linkPoints);var b=new a.BufferGeometry,d=this.createLinkAttributes();b.addAttribute('linkV4',new a.BufferAttribute(d,4));var e=this.createPositionLink();b.addAttribute('position',new a.BufferAttribute(e,3));var f=this.shaderLinkForce=this.createShaderLinks(),g=new a.Points(b,f);c.add(g)},createPositionLink:function(){return new Float32Array(this._links.length*3)},createLinkAttributes:function(){var d,c=this._links,a=new Float32Array(c.length*4),e,f;for(var b in c)d=c[b],e=this.getUvInTexture(d[0]),f=this.getUvInTexture(d[1]),a[b*4+0]=e.u,a[b*4+1]=e.v,a[b*4+2]=f.u,a[b*4+3]=f.v;return a},getUvInTexture:function(b){var a=this.precision,c=this.precision;return{u:(b%a+.5)/a,v:(Math.floor(b/a)+.5)/c}},createShaderLinks:function(){var b={textureP:{type:'t',value:null},isReverse:{type:'f',value:1}};return new a.ShaderMaterial({transparent:!0,blending:a.AdditiveBlending,depthWrite:!1,depthTest:!1,uniforms:b,vertexShader:this.createVertLinks(),fragmentShader:this.createFragLinks()})},createVertLinks:function(){return'uniform sampler2D textureP;uniform float isReverse;attribute vec4 linkV4;varying vec3 forceLink;'+this._force.genSpring()+'const float w ='+this.precision+'.0;'+'const float h = '+this.precision+'.0;'+'void main() {'+'vec3 pFrom = texture2D(textureP, linkV4.xy).xyz;'+'vec3 pTo = texture2D(textureP, linkV4.zw).xyz;'+'vec3 dir;'+'if (isReverse > 0.5) { dir = pTo - pFrom; gl_Position = vec4(linkV4.x * 2. - 1.0, linkV4.y * 2. - 1.0, 0., 1.); }else{ dir = pFrom - pTo; gl_Position = vec4(linkV4.z * 2. - 1., linkV4.w * 2. - 1., 0., 1.); }'+'forceLink = getSpringForce(dir);'+'}'},createFragLinks:function(){return},updateLinkForce:function(){if(!this._links)return;var a=this.shaderLinkForce.uniforms;a.textureP.value=this.isOrder?this.textureP:this.texturePCopy,a.textureP.needsUpdate=!0;var b=this.renderer;b.clear(0),a.isReverse.value=0,a.isReverse.needsUpdate=!0,b.render(this.linkScene,this.camera),b.autoClear=!1,a.isReverse.value=1,a.isReverse.needsUpdate=!0,b.render(this.linkScene,this.camera,this.textureLinkForce,!0),b.autoClear=!0}}
var a=require('../three'),b=require('bcore/utils'),c=require('./force');module.exports={drawLinks:function(){if(!this.isable)return;if(!this._links)return;this.linkScene=new a.Scene;var b=this.textureLinkForce=this.createRenderTarget(a.RGBAFormat);this.copy(this.cleanDataTexture,b),this.createLinkComputing()},links:function(a){this._links=a},createLinkComputing:function(){var c=this.linkScene;this._linkPoints&&c.remove(this._linkPoints);var b=new a.BufferGeometry,d=this.createLinkAttributes();b.addAttribute('linkV4',new a.BufferAttribute(d,4));var e=this.createPositionLink();b.addAttribute('position',new a.BufferAttribute(e,3));var f=this.shaderLinkForce=this.createShaderLinks(),g=new a.Points(b,f);c.add(g)},createPositionLink:function(){return new Float32Array(this._links.length*3)},createLinkAttributes:function(){var d,c=this._links,a=new Float32Array(c.length*4),e,f;for(var b in c)d=c[b],e=this.getUvInTexture(d[0]),f=this.getUvInTexture(d[1]),a[b*4+0]=e.u,a[b*4+1]=e.v,a[b*4+2]=f.u,a[b*4+3]=f.v;return a},getUvInTexture:function(b){var a=this.precision,c=this.precision;return{u:(b%a+.5)/a,v:(Math.floor(b/a)+.5)/c}},createShaderLinks:function(){var b={textureP:{type:'t',value:null},isReverse:{type:'f',value:1}};return new a.ShaderMaterial({transparent:!0,blending:a.AdditiveBlending,depthWrite:!1,depthTest:!1,uniforms:b,vertexShader:this.createVertLinks(),fragmentShader:this.createFragLinks()})},createVertLinks:function(){return'uniform sampler2D textureP;uniform float isReverse;attribute vec4 linkV4;varying vec3 forceLink;'+this._force.genSpring()+'const float w ='+this.precision+'.0;'+'const float h = '+this.precision+'.0;'+'void main() {'+'vec3 pFrom = texture2D(textureP, linkV4.xy).xyz;'+'vec3 pTo = texture2D(textureP, linkV4.zw).xyz;'+'vec3 dir;'+'if (isReverse > 0.5) { dir = pTo - pFrom; gl_Position = vec4(linkV4.x * 2. - 1.0, linkV4.y * 2. - 1.0, 0., 1.); }else{ dir = pFrom - pTo; gl_Position = vec4(linkV4.z * 2. - 1., linkV4.w * 2. - 1., 0., 1.); }'+'forceLink = getSpringForce(dir);'+'}'},createFragLinks:function(){return},updateLinkForce:function(){if(!this._links)return;var a=this.shaderLinkForce.uniforms;a.textureP.value=this.isOrder?this.textureP:this.texturePCopy,a.textureP.needsUpdate=!0;var b=this.renderer;b.clear(0),a.isReverse.value=0,a.isReverse.needsUpdate=!0,b.render(this.linkScene,this.camera),b.autoClear=!1,a.isReverse.value=1,a.isReverse.needsUpdate=!0,b.render(this.linkScene,this.camera,this.textureLinkForce,!0),b.autoClear=!0}}

@@ -1,1 +0,1 @@

function b(a,d){var e=a.three3D;this._map=a,this.three3D=e,d=this.options=c.deepMerge(b.options,d),this.init(),this.update(),this.loop()}var c=require('bcore/utils'),a=require('three');require('./lib/RenderPass'),require('./lib/BloomPass'),require('./lib/ShaderPass'),require('./lib/EffectComposer'),require('./lib/shader/HorizontalTiltShiftShader'),require('./lib/shader/VerticalTiltShiftShader'),require('./lib/shader/BleachBypassShader'),b.options={focusX:.5,focusY:.5,blur:2,effectBleachOpacity:.6},b.prototype={init:function(){var c=this.three3D,g=c.scene,e=c.camera,k=this.options,f=new a.BloomPass(.6),h=this.effectBleach=new a.ShaderPass(a.BleachBypassShader);h.uniforms.opacity.value=.9;var i=this.renderPass=new a.RenderPass(g,e),j=this.hblur=new a.ShaderPass(a.HorizontalTiltShiftShader),d=this.vblur=new a.ShaderPass(a.VerticalTiltShiftShader),b=this.composer=new a.EffectComposer(c.renderer);b.addPass(i),b.addPass(f),b.addPass(j),b.addPass(d),d.renderToScreen=!0,b.render()},update:function(){var a=this.options,b=a.blur/this.three3D.width;this.hblur.uniforms.h.value=b,this.hblur.uniforms.r.value=a.focusX,this.vblur.uniforms.v.value=b,this.vblur.uniforms.r.value=a.focusY,this.effectBleach.uniforms.opacity.value=a.effectBleachOpacity},render:function(){this.composer.render()},loop:function(){this.render(),window.requestAnimationFrame(this.loop.bind(this))}},module.exports=b
function b(a,d){var e=a.three3D;this._map=a,this.three3D=e,d=this.options=c.deepMerge(b.options,d),this.init(),this.update(),this.loop()}var c=require('bcore/utils'),a=require('../../three');require('./lib/RenderPass'),require('./lib/BloomPass'),require('./lib/ShaderPass'),require('./lib/EffectComposer'),require('./lib/shader/HorizontalTiltShiftShader'),require('./lib/shader/VerticalTiltShiftShader'),require('./lib/shader/BleachBypassShader'),b.options={focusX:.5,focusY:.5,blur:2,effectBleachOpacity:.6},b.prototype={init:function(){var c=this.three3D,g=c.scene,e=c.camera,k=this.options,f=new a.BloomPass(.6),h=this.effectBleach=new a.ShaderPass(a.BleachBypassShader);h.uniforms.opacity.value=.9;var i=this.renderPass=new a.RenderPass(g,e),j=this.hblur=new a.ShaderPass(a.HorizontalTiltShiftShader),d=this.vblur=new a.ShaderPass(a.VerticalTiltShiftShader),b=this.composer=new a.EffectComposer(c.renderer);b.addPass(i),b.addPass(f),b.addPass(j),b.addPass(d),d.renderToScreen=!0,b.render()},update:function(){var a=this.options,b=a.blur/this.three3D.width;this.hblur.uniforms.h.value=b,this.hblur.uniforms.r.value=a.focusX,this.vblur.uniforms.v.value=b,this.vblur.uniforms.r.value=a.focusY,this.effectBleach.uniforms.opacity.value=a.effectBleachOpacity},render:function(){this.composer.render()},loop:function(){this.render(),window.requestAnimationFrame(this.loop.bind(this))}},module.exports=b

@@ -1,1 +0,1 @@

function a(b,d){var e=b.three3D;this._map=b,this.three3D=e,d=this.options=c.deepMerge(a.options,d),this.init(),this.update(),this.loop()}var c=require('bcore/utils'),b=require('three');require('./lib/RenderPass'),require('./lib/BloomPass'),require('./lib/ShaderPass'),require('./lib/EffectComposer'),require('./lib/BokehPass'),a.options={focus:1,maxblur:2,aperture:.025},a.prototype={init:function(){var a=this.three3D,e=a.scene,f=a.camera,c=this.options,h=this.renderPass=new b.RenderPass(e,f),g=this.bokeh=new b.BokehPass(e,f,{focus:c.focus,aperture:c.aperture,maxblur:c.maxblur,width:a.width,height:a.height}),d=this.composer=new b.EffectComposer(a.renderer);d.addPass(h),d.addPass(g),g.renderToScreen=!0,d.render()},update:function(){var a=this.options,b=this.bokeh.uniforms;b.focus.value=a.focus,b.aperture.value=a.aperture,b.maxblur.value=a.maxblur},render:function(){this.composer.render()},loop:function(){this.render(),window.requestAnimationFrame(this.loop.bind(this))}},module.exports=a
function a(b,d){var e=b.three3D;this._map=b,this.three3D=e,d=this.options=c.deepMerge(a.options,d),this.init(),this.update(),this.loop()}var c=require('bcore/utils'),b=require('../../three');require('./lib/RenderPass'),require('./lib/BloomPass'),require('./lib/ShaderPass'),require('./lib/EffectComposer'),require('./lib/BokehPass'),a.options={focus:1,maxblur:2,aperture:.025},a.prototype={init:function(){var a=this.three3D,e=a.scene,f=a.camera,c=this.options,h=this.renderPass=new b.RenderPass(e,f),g=this.bokeh=new b.BokehPass(e,f,{focus:c.focus,aperture:c.aperture,maxblur:c.maxblur,width:a.width,height:a.height}),d=this.composer=new b.EffectComposer(a.renderer);d.addPass(h),d.addPass(g),g.renderToScreen=!0,d.render()},update:function(){var a=this.options,b=this.bokeh.uniforms;b.focus.value=a.focus,b.aperture.value=a.aperture,b.maxblur.value=a.maxblur},render:function(){this.composer.render()},loop:function(){this.render(),window.requestAnimationFrame(this.loop.bind(this))}},module.exports=a

@@ -1,1 +0,1 @@

var a=require('three');require('./shader/ConvolutionShader'),a.BloomPass=function(d,c,e,b){d=d!==undefined?d:1,c=c!==undefined?c:25,e=e!==undefined?e:4,b=b!==undefined?b:256;var h={minFilter:a.LinearFilter,magFilter:a.LinearFilter,format:a.RGBFormat};this.renderTargetX=new a.WebGLRenderTarget(b,b,h),this.renderTargetY=new a.WebGLRenderTarget(b,b,h),a.CopyShader===undefined&&console.error('THREE.BloomPass relies on THREE.CopyShader');var f=a.CopyShader;this.copyUniforms=a.UniformsUtils.clone(f.uniforms),this.copyUniforms.opacity.value=d,this.materialCopy=new a.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:f.vertexShader,fragmentShader:f.fragmentShader,blending:a.AdditiveBlending,transparent:!0}),a.ConvolutionShader===undefined&&console.error('THREE.BloomPass relies on THREE.ConvolutionShader');var g=a.ConvolutionShader;this.convolutionUniforms=a.UniformsUtils.clone(g.uniforms),this.convolutionUniforms.uImageIncrement.value=a.BloomPass.blurX,this.convolutionUniforms.cKernel.value=a.ConvolutionShader.buildKernel(e),this.materialConvolution=new a.ShaderMaterial({uniforms:this.convolutionUniforms,vertexShader:g.vertexShader,fragmentShader:g.fragmentShader,defines:{KERNEL_SIZE_FLOAT:c.toFixed(1),KERNEL_SIZE_INT:c.toFixed(0)}}),this.enabled=!0,this.needsSwap=!1,this.clear=!1,this.camera=new a.OrthographicCamera(-1,1,1,-1,0,1),this.scene=new a.Scene,this.quad=new a.Mesh(new a.PlaneBufferGeometry(2,2),null),this.scene.add(this.quad)},a.BloomPass.prototype={render:function(b,e,c,f,d){d&&b.context.disable(b.context.STENCIL_TEST),this.quad.material=this.materialConvolution,this.convolutionUniforms.tDiffuse.value=c,this.convolutionUniforms.uImageIncrement.value=a.BloomPass.blurX,b.render(this.scene,this.camera,this.renderTargetX,!0),this.convolutionUniforms.tDiffuse.value=this.renderTargetX,this.convolutionUniforms.uImageIncrement.value=a.BloomPass.blurY,b.render(this.scene,this.camera,this.renderTargetY,!0),this.quad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetY,d&&b.context.enable(b.context.STENCIL_TEST),b.render(this.scene,this.camera,c,this.clear)}},a.BloomPass.blurX=new a.Vector2(.001953125,0),a.BloomPass.blurY=new a.Vector2(0,.001953125)
var a=require('../../../three');require('./shader/ConvolutionShader'),a.BloomPass=function(d,c,e,b){d=d!==undefined?d:1,c=c!==undefined?c:25,e=e!==undefined?e:4,b=b!==undefined?b:256;var h={minFilter:a.LinearFilter,magFilter:a.LinearFilter,format:a.RGBFormat};this.renderTargetX=new a.WebGLRenderTarget(b,b,h),this.renderTargetY=new a.WebGLRenderTarget(b,b,h),a.CopyShader===undefined&&console.error('THREE.BloomPass relies on THREE.CopyShader');var f=a.CopyShader;this.copyUniforms=a.UniformsUtils.clone(f.uniforms),this.copyUniforms.opacity.value=d,this.materialCopy=new a.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:f.vertexShader,fragmentShader:f.fragmentShader,blending:a.AdditiveBlending,transparent:!0}),a.ConvolutionShader===undefined&&console.error('THREE.BloomPass relies on THREE.ConvolutionShader');var g=a.ConvolutionShader;this.convolutionUniforms=a.UniformsUtils.clone(g.uniforms),this.convolutionUniforms.uImageIncrement.value=a.BloomPass.blurX,this.convolutionUniforms.cKernel.value=a.ConvolutionShader.buildKernel(e),this.materialConvolution=new a.ShaderMaterial({uniforms:this.convolutionUniforms,vertexShader:g.vertexShader,fragmentShader:g.fragmentShader,defines:{KERNEL_SIZE_FLOAT:c.toFixed(1),KERNEL_SIZE_INT:c.toFixed(0)}}),this.enabled=!0,this.needsSwap=!1,this.clear=!1,this.camera=new a.OrthographicCamera(-1,1,1,-1,0,1),this.scene=new a.Scene,this.quad=new a.Mesh(new a.PlaneBufferGeometry(2,2),null),this.scene.add(this.quad)},a.BloomPass.prototype={render:function(b,e,c,f,d){d&&b.context.disable(b.context.STENCIL_TEST),this.quad.material=this.materialConvolution,this.convolutionUniforms.tDiffuse.value=c,this.convolutionUniforms.uImageIncrement.value=a.BloomPass.blurX,b.render(this.scene,this.camera,this.renderTargetX,!0),this.convolutionUniforms.tDiffuse.value=this.renderTargetX,this.convolutionUniforms.uImageIncrement.value=a.BloomPass.blurY,b.render(this.scene,this.camera,this.renderTargetY,!0),this.quad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetY,d&&b.context.enable(b.context.STENCIL_TEST),b.render(this.scene,this.camera,c,this.clear)}},a.BloomPass.blurX=new a.Vector2(.001953125,0),a.BloomPass.blurY=new a.Vector2(0,.001953125)

@@ -1,1 +0,1 @@

var a=require('three');require('./../../shader/BokehShader'),a.BokehPass=function(l,h,b){this.scene=l,this.camera=h;var f=b.focus!==undefined?b.focus:1,g=b.aspect!==undefined?b.aspect:h.aspect,e=b.aperture!==undefined?b.aperture:.025,i=b.maxblur!==undefined?b.maxblur:1,j=b.width||window.innerWidth||1,k=b.height||window.innerHeight||1;this.renderTargetColor=new a.WebGLRenderTarget(j,k,{minFilter:a.LinearFilter,magFilter:a.LinearFilter,format:a.RGBFormat}),this.renderTargetDepth=this.renderTargetColor.clone(),this.materialDepth=new a.MeshDepthMaterial,a.BokehShader===undefined&&console.error('THREE.BokehPass relies on THREE.BokehShader');var d=a.BokehShader,c=a.UniformsUtils.clone(d.uniforms);c.tDepth.value=this.renderTargetDepth,c.focus.value=f,c.aspect.value=g,c.aperture.value=e,c.maxblur.value=i,this.materialBokeh=new a.ShaderMaterial({uniforms:c,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader}),this.uniforms=c,this.enabled=!0,this.needsSwap=!1,this.renderToScreen=!1,this.clear=!1,this.camera2=new a.OrthographicCamera(-1,1,1,-1,0,1),this.scene2=new a.Scene,this.quad2=new a.Mesh(new a.PlaneBufferGeometry(2,2),null),this.scene2.add(this.quad2)},a.BokehPass.prototype={render:function(a,b,c,d,e){this.quad2.material=this.materialBokeh,this.scene.overrideMaterial=this.materialDepth,a.render(this.scene,this.camera,this.renderTargetDepth,!0),this.uniforms.tColor.value=c,this.renderToScreen?a.render(this.scene2,this.camera2):a.render(this.scene2,this.camera2,b,this.clear),this.scene.overrideMaterial=null}}
var a=require('../../../three');require('./../../shader/BokehShader'),a.BokehPass=function(l,h,b){this.scene=l,this.camera=h;var f=b.focus!==undefined?b.focus:1,g=b.aspect!==undefined?b.aspect:h.aspect,e=b.aperture!==undefined?b.aperture:.025,i=b.maxblur!==undefined?b.maxblur:1,j=b.width||window.innerWidth||1,k=b.height||window.innerHeight||1;this.renderTargetColor=new a.WebGLRenderTarget(j,k,{minFilter:a.LinearFilter,magFilter:a.LinearFilter,format:a.RGBFormat}),this.renderTargetDepth=this.renderTargetColor.clone(),this.materialDepth=new a.MeshDepthMaterial,a.BokehShader===undefined&&console.error('THREE.BokehPass relies on THREE.BokehShader');var d=a.BokehShader,c=a.UniformsUtils.clone(d.uniforms);c.tDepth.value=this.renderTargetDepth,c.focus.value=f,c.aspect.value=g,c.aperture.value=e,c.maxblur.value=i,this.materialBokeh=new a.ShaderMaterial({uniforms:c,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader}),this.uniforms=c,this.enabled=!0,this.needsSwap=!1,this.renderToScreen=!1,this.clear=!1,this.camera2=new a.OrthographicCamera(-1,1,1,-1,0,1),this.scene2=new a.Scene,this.quad2=new a.Mesh(new a.PlaneBufferGeometry(2,2),null),this.scene2.add(this.quad2)},a.BokehPass.prototype={render:function(a,b,c,d,e){this.quad2.material=this.materialBokeh,this.scene.overrideMaterial=this.materialDepth,a.render(this.scene,this.camera,this.renderTargetDepth,!0),this.uniforms.tColor.value=c,this.renderToScreen?a.render(this.scene2,this.camera2):a.render(this.scene2,this.camera2,b,this.clear),this.scene.overrideMaterial=null}}

@@ -1,1 +0,1 @@

var a=require('three');require('./shader/CopyShader'),require('./MaskPass'),a.EffectComposer=function(b,c){if(this.renderer=b,c===undefined){var d=b.getPixelRatio(),e=Math.floor(b.context.canvas.width/d)||1,f=Math.floor(b.context.canvas.height/d)||1,g={minFilter:a.LinearFilter,magFilter:a.LinearFilter,format:a.RGBFormat,stencilBuffer:!1};c=new a.WebGLRenderTarget(e,f,g)}this.renderTarget1=c,this.renderTarget2=c.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.passes=[],a.CopyShader===undefined&&console.error('THREE.EffectComposer relies on THREE.CopyShader'),this.copyPass=new a.ShaderPass(a.CopyShader)},a.EffectComposer.prototype={swapBuffers:function(){var a=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=a},addPass:function(a){this.passes.push(a)},insertPass:function(a,b){this.passes.splice(b,0,a)},render:function(f){this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2;var c=!1,b,e,g=this.passes.length;for(e=0;e<g;e++){if(b=this.passes[e],!b.enabled)continue;if(b.render(this.renderer,this.writeBuffer,this.readBuffer,f,c),b.needsSwap){if(c){var d=this.renderer.context;d.stencilFunc(d.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,f),d.stencilFunc(d.EQUAL,1,4294967295)}this.swapBuffers()}b instanceof a.MaskPass?c=!0:b instanceof a.ClearMaskPass&&(c=!1)}},reset:function(a){if(a===undefined){a=this.renderTarget1.clone();var b=this.renderer.getPixelRatio();a.width=Math.floor(this.renderer.context.canvas.width/b),a.height=Math.floor(this.renderer.context.canvas.height/b)}this.renderTarget1.dispose(),this.renderTarget1=a,this.renderTarget2.dispose(),this.renderTarget2=a.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2},setSize:function(a,b){this.renderTarget1.setSize(a,b),this.renderTarget2.setSize(a,b)}}
var a=require('../../../three');require('./shader/CopyShader'),require('./MaskPass'),a.EffectComposer=function(b,c){if(this.renderer=b,c===undefined){var d=b.getPixelRatio(),e=Math.floor(b.context.canvas.width/d)||1,f=Math.floor(b.context.canvas.height/d)||1,g={minFilter:a.LinearFilter,magFilter:a.LinearFilter,format:a.RGBFormat,stencilBuffer:!1};c=new a.WebGLRenderTarget(e,f,g)}this.renderTarget1=c,this.renderTarget2=c.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.passes=[],a.CopyShader===undefined&&console.error('THREE.EffectComposer relies on THREE.CopyShader'),this.copyPass=new a.ShaderPass(a.CopyShader)},a.EffectComposer.prototype={swapBuffers:function(){var a=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=a},addPass:function(a){this.passes.push(a)},insertPass:function(a,b){this.passes.splice(b,0,a)},render:function(f){this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2;var c=!1,b,e,g=this.passes.length;for(e=0;e<g;e++){if(b=this.passes[e],!b.enabled)continue;if(b.render(this.renderer,this.writeBuffer,this.readBuffer,f,c),b.needsSwap){if(c){var d=this.renderer.context;d.stencilFunc(d.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,f),d.stencilFunc(d.EQUAL,1,4294967295)}this.swapBuffers()}b instanceof a.MaskPass?c=!0:b instanceof a.ClearMaskPass&&(c=!1)}},reset:function(a){if(a===undefined){a=this.renderTarget1.clone();var b=this.renderer.getPixelRatio();a.width=Math.floor(this.renderer.context.canvas.width/b),a.height=Math.floor(this.renderer.context.canvas.height/b)}this.renderTarget1.dispose(),this.renderTarget1=a,this.renderTarget2.dispose(),this.renderTarget2=a.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2},setSize:function(a,b){this.renderTarget1.setSize(a,b),this.renderTarget2.setSize(a,b)}}

@@ -1,1 +0,1 @@

var a=require('three');a.MaskPass=function(a,b){this.scene=a,this.camera=b,this.enabled=!0,this.clear=!0,this.needsSwap=!1,this.inverse=!1},a.MaskPass.prototype={render:function(b,e,f,g){var a=b.context;a.colorMask(!1,!1,!1,!1),a.depthMask(!1);var c,d;this.inverse?(c=0,d=1):(c=1,d=0),a.enable(a.STENCIL_TEST),a.stencilOp(a.REPLACE,a.REPLACE,a.REPLACE),a.stencilFunc(a.ALWAYS,c,4294967295),a.clearStencil(d),b.render(this.scene,this.camera,f,this.clear),b.render(this.scene,this.camera,e,this.clear),a.colorMask(!0,!0,!0,!0),a.depthMask(!0),a.stencilFunc(a.EQUAL,1,4294967295),a.stencilOp(a.KEEP,a.KEEP,a.KEEP)}},a.ClearMaskPass=function(){this.enabled=!0},a.ClearMaskPass.prototype={render:function(b,c,d,e){var a=b.context;a.disable(a.STENCIL_TEST)}}
var a=require('../../../three');a.MaskPass=function(a,b){this.scene=a,this.camera=b,this.enabled=!0,this.clear=!0,this.needsSwap=!1,this.inverse=!1},a.MaskPass.prototype={render:function(b,e,f,g){var a=b.context;a.colorMask(!1,!1,!1,!1),a.depthMask(!1);var c,d;this.inverse?(c=0,d=1):(c=1,d=0),a.enable(a.STENCIL_TEST),a.stencilOp(a.REPLACE,a.REPLACE,a.REPLACE),a.stencilFunc(a.ALWAYS,c,4294967295),a.clearStencil(d),b.render(this.scene,this.camera,f,this.clear),b.render(this.scene,this.camera,e,this.clear),a.colorMask(!0,!0,!0,!0),a.depthMask(!0),a.stencilFunc(a.EQUAL,1,4294967295),a.stencilOp(a.KEEP,a.KEEP,a.KEEP)}},a.ClearMaskPass=function(){this.enabled=!0},a.ClearMaskPass.prototype={render:function(b,c,d,e){var a=b.context;a.disable(a.STENCIL_TEST)}}

@@ -1,1 +0,1 @@

var a=require('three');a.RenderPass=function(c,d,e,f,b){this.scene=c,this.camera=d,this.overrideMaterial=e,this.clearColor=f,this.clearAlpha=b!==undefined?b:1,this.oldClearColor=new a.Color,this.oldClearAlpha=1,this.enabled=!0,this.clear=!0,this.needsSwap=!1},a.RenderPass.prototype={render:function(a,c,b,d){this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(this.oldClearColor.copy(a.getClearColor()),this.oldClearAlpha=a.getClearAlpha(),a.setClearColor(this.clearColor,this.clearAlpha)),a.render(this.scene,this.camera,b,this.clear),this.clearColor&&a.setClearColor(this.oldClearColor,this.oldClearAlpha),this.scene.overrideMaterial=null}}
var a=require('../../../three');a.RenderPass=function(c,d,e,f,b){this.scene=c,this.camera=d,this.overrideMaterial=e,this.clearColor=f,this.clearAlpha=b!==undefined?b:1,this.oldClearColor=new a.Color,this.oldClearAlpha=1,this.enabled=!0,this.clear=!0,this.needsSwap=!1},a.RenderPass.prototype={render:function(a,c,b,d){this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(this.oldClearColor.copy(a.getClearColor()),this.oldClearAlpha=a.getClearAlpha(),a.setClearColor(this.clearColor,this.clearAlpha)),a.render(this.scene,this.camera,b,this.clear),this.clearColor&&a.setClearColor(this.oldClearColor,this.oldClearAlpha),this.scene.overrideMaterial=null}}

@@ -1,1 +0,1 @@

var a=require('three');a.BleachBypassShader={uniforms:{tDiffuse:{type:'t',value:null},opacity:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float opacity;','uniform sampler2D tDiffuse;','varying vec2 vUv;','void main() {','vec4 base = texture2D( tDiffuse, vUv );','vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );','float lum = dot( lumCoeff, base.rgb );','vec3 blend = vec3( lum );','float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );','vec3 result1 = 2.0 * base.rgb * blend;','vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );','vec3 newColor = mix( result1, result2, L );','float A2 = opacity * base.a;','vec3 mixRGB = A2 * newColor.rgb;','mixRGB += ( ( 1.0 - A2 ) * base.rgb );','gl_FragColor = vec4( mixRGB, base.a );','}'].join('\n')}
var a=require('../../../../three');a.BleachBypassShader={uniforms:{tDiffuse:{type:'t',value:null},opacity:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float opacity;','uniform sampler2D tDiffuse;','varying vec2 vUv;','void main() {','vec4 base = texture2D( tDiffuse, vUv );','vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );','float lum = dot( lumCoeff, base.rgb );','vec3 blend = vec3( lum );','float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );','vec3 result1 = 2.0 * base.rgb * blend;','vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );','vec3 newColor = mix( result1, result2, L );','float A2 = opacity * base.a;','vec3 mixRGB = A2 * newColor.rgb;','mixRGB += ( ( 1.0 - A2 ) * base.rgb );','gl_FragColor = vec4( mixRGB, base.a );','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.BokehShader={uniforms:{tColor:{type:'t',value:null},tDepth:{type:'t',value:null},focus:{type:'f',value:1},aspect:{type:'f',value:1},aperture:{type:'f',value:.025},maxblur:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['varying vec2 vUv;','uniform sampler2D tColor;','uniform sampler2D tDepth;','uniform float maxblur;','uniform float aperture;','uniform float focus;','uniform float aspect;','void main() {','vec2 aspectcorrect = vec2( 1.0, aspect );','vec4 depth1 = texture2D( tDepth, vUv );','float factor = depth1.x - focus;','vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );','vec2 dofblur9 = dofblur * 0.9;','vec2 dofblur7 = dofblur * 0.7;','vec2 dofblur4 = dofblur * 0.4;','vec4 col = vec4( 0.0 );','col += texture2D( tColor, vUv.xy );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );','gl_FragColor = col / 41.0;','gl_FragColor.a = 1.0;','}'].join('\n')}
var a=require('../../../../three');a.BokehShader={uniforms:{tColor:{type:'t',value:null},tDepth:{type:'t',value:null},focus:{type:'f',value:1},aspect:{type:'f',value:1},aperture:{type:'f',value:.025},maxblur:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['varying vec2 vUv;','uniform sampler2D tColor;','uniform sampler2D tDepth;','uniform float maxblur;','uniform float aperture;','uniform float focus;','uniform float aspect;','void main() {','vec2 aspectcorrect = vec2( 1.0, aspect );','vec4 depth1 = texture2D( tDepth, vUv );','float factor = depth1.x - focus;','vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );','vec2 dofblur9 = dofblur * 0.9;','vec2 dofblur7 = dofblur * 0.7;','vec2 dofblur4 = dofblur * 0.4;','vec4 col = vec4( 0.0 );','col += texture2D( tColor, vUv.xy );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );','gl_FragColor = col / 41.0;','gl_FragColor.a = 1.0;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.BokehShader={uniforms:{textureWidth:{type:'f',value:1},textureHeight:{type:'f',value:1},focalDepth:{type:'f',value:1},focalLength:{type:'f',value:24},fstop:{type:'f',value:.9},tColor:{type:'t',value:null},tDepth:{type:'t',value:null},maxblur:{type:'f',value:1},showFocus:{type:'i',value:0},manualdof:{type:'i',value:0},vignetting:{type:'i',value:0},depthblur:{type:'i',value:0},threshold:{type:'f',value:.5},gain:{type:'f',value:2},bias:{type:'f',value:.5},fringe:{type:'f',value:.7},znear:{type:'f',value:.1},zfar:{type:'f',value:100},noise:{type:'i',value:1},dithering:{type:'f',value:1e-4},pentagon:{type:'i',value:0},shaderFocus:{type:'i',value:1},focusCoords:{type:'v2',value:new a.Vector2}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['varying vec2 vUv;','uniform sampler2D tColor;','uniform sampler2D tDepth;','uniform float textureWidth;','uniform float textureHeight;','const float PI = 3.14159265;','uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below','uniform float focalLength; //focal length in mm','uniform float fstop; //f-stop value','uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)','/*','make sure that these two values are the same for your camera, otherwise distances will be wrong.','*/','uniform float znear; // camera clipping start','uniform float zfar; // camera clipping end','//------------------------------------------','//user variables','const int samples = SAMPLES; //samples on the first ring','const int rings = RINGS; //ring count','const int maxringsamples = rings * samples;','uniform bool manualdof; // manual dof calculation','float ndofstart = 1.0; // near dof blur start','float ndofdist = 2.0; // near dof blur falloff distance','float fdofstart = 1.0; // far dof blur start','float fdofdist = 3.0; // far dof blur falloff distance','float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)','uniform bool vignetting; // use optical lens vignetting','float vignout = 1.3; // vignetting outer border','float vignin = 0.0; // vignetting inner border','float vignfade = 22.0; // f-stops till vignete fades','uniform bool shaderFocus;','// disable if you use external focalDepth value','uniform vec2 focusCoords;','// autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)','// if center of screen use vec2(0.5, 0.5);','uniform float maxblur;','//clamp value of max blur (0.0 = no blur, 1.0 default)','uniform float threshold; // highlight threshold;','uniform float gain; // highlight gain;','uniform float bias; // bokeh edge bias','uniform float fringe; // bokeh chromatic aberration / fringing','uniform bool noise; //use noise instead of pattern for sample dithering','uniform float dithering;','uniform bool depthblur; // blur the depth buffer','float dbsize = 1.25; // depth blur size','/*','next part is experimental','not looking good with small sample and ring count','looks okay starting from samples = 4, rings = 4','*/','uniform bool pentagon; //use pentagon as bokeh shape?','float feather = 0.4; //pentagon shape feather','//------------------------------------------','float penta(vec2 coords) {','//pentagonal shape','float scale = float(rings) - 1.3;','vec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);','vec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);','vec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);','vec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);','vec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);','vec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);','vec4 one = vec4( 1.0 );','vec4 P = vec4((coords),vec2(scale, scale));','vec4 dist = vec4(0.0);','float inorout = -4.0;','dist.x = dot( P, HS0 );','dist.y = dot( P, HS1 );','dist.z = dot( P, HS2 );','dist.w = dot( P, HS3 );','dist = smoothstep( -feather, feather, dist );','inorout += dot( dist, one );','dist.x = dot( P, HS4 );','dist.y = HS5.w - abs( P.z );','dist = smoothstep( -feather, feather, dist );','inorout += dist.x;','return clamp( inorout, 0.0, 1.0 );','}','float bdepth(vec2 coords) {','// Depth buffer blur','float d = 0.0;','float kernel[9];','vec2 offset[9];','vec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;','offset[0] = vec2(-wh.x,-wh.y);','offset[1] = vec2( 0.0, -wh.y);','offset[2] = vec2( wh.x -wh.y);','offset[3] = vec2(-wh.x, 0.0);','offset[4] = vec2( 0.0, 0.0);','offset[5] = vec2( wh.x, 0.0);','offset[6] = vec2(-wh.x, wh.y);','offset[7] = vec2( 0.0, wh.y);','offset[8] = vec2( wh.x, wh.y);','kernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;','kernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;','kernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;','for( int i=0; i<9; i++ ) {','float tmp = texture2D(tDepth, coords + offset[i]).r;','d += tmp * kernel[i];','}','return d;','}','vec3 color(vec2 coords,float blur) {','//processing the sample','vec3 col = vec3(0.0);','vec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);','col.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;','col.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;','col.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;','vec3 lumcoeff = vec3(0.299,0.587,0.114);','float lum = dot(col.rgb, lumcoeff);','float thresh = max((lum-threshold)*gain, 0.0);','return col+mix(vec3(0.0),col,thresh*blur);','}','vec2 rand(vec2 coord) {','// generating noise / pattern texture for dithering','float noiseX = ((fract(1.0-coord.s*(textureWidth/2.0))*0.25)+(fract(coord.t*(textureHeight/2.0))*0.75))*2.0-1.0;','float noiseY = ((fract(1.0-coord.s*(textureWidth/2.0))*0.75)+(fract(coord.t*(textureHeight/2.0))*0.25))*2.0-1.0;','if (noise) {','noiseX = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233))) * 43758.5453),0.0,1.0)*2.0-1.0;','noiseY = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233)*2.0)) * 43758.5453),0.0,1.0)*2.0-1.0;','}','return vec2(noiseX,noiseY);','}','vec3 debugFocus(vec3 col, float blur, float depth) {','float edge = 0.002*depth; //distance based edge smoothing','float m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);','float e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);','col = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);','col = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);','return col;','}','float linearize(float depth) {','return -zfar * znear / (depth * (zfar - znear) - zfar);','}','float vignette() {','float dist = distance(vUv.xy, vec2(0.5,0.5));','dist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);','return clamp(dist,0.0,1.0);','}','float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {','float rings2 = float(rings);','float step = PI*2.0 / float(ringsamples);','float pw = cos(j*step)*i;','float ph = sin(j*step)*i;','float p = 1.0;','if (pentagon) {','p = penta(vec2(pw,ph));','}','col += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;','return 1.0 * mix(1.0, i /rings2, bias) * p;','}','void main() {','//scene depth calculation','float depth = linearize(texture2D(tDepth,vUv.xy).x);','// Blur depth?','if (depthblur) {','depth = linearize(bdepth(vUv.xy));','}','//focal plane calculation','float fDepth = focalDepth;','if (shaderFocus) {','fDepth = linearize(texture2D(tDepth,focusCoords).x);','}','// dof blur factor calculation','float blur = 0.0;','if (manualdof) {','float a = depth-fDepth; // Focal plane','float b = (a-fdofstart)/fdofdist; // Far DoF','float c = (-a-ndofstart)/ndofdist; // Near Dof','blur = (a>0.0) ? b : c;','} else {','float f = focalLength; // focal length in mm','float d = fDepth*1000.0; // focal plane in mm','float o = depth*1000.0; // depth in mm','float a = (o*f)/(o-f);','float b = (d*f)/(d-f);','float c = (d-f)/(d*fstop*CoC);','blur = abs(a-b)*c;','}','blur = clamp(blur,0.0,1.0);','// calculation of pattern for dithering','vec2 noise = rand(vUv.xy)*dithering*blur;','// getting blur x and y step factor','float w = (1.0/textureWidth)*blur*maxblur+noise.x;','float h = (1.0/textureHeight)*blur*maxblur+noise.y;','// calculation of final color','vec3 col = vec3(0.0);','if(blur < 0.05) {','//some optimization thingy','col = texture2D(tColor, vUv.xy).rgb;','} else {','col = texture2D(tColor, vUv.xy).rgb;','float s = 1.0;','int ringsamples;','for (int i = 1; i <= rings; i++) {','/*unboxstart*/','ringsamples = i * samples;','for (int j = 0 ; j < maxringsamples ; j++) {','if (j >= ringsamples) break;','s += gather(float(i), float(j), ringsamples, col, w, h, blur);','}','/*unboxend*/','}','col /= s; //divide by sample count','}','if (showFocus) {','col = debugFocus(col, blur, depth);','}','if (vignetting) {','col *= vignette();','}','gl_FragColor.rgb = col;','gl_FragColor.a = 1.0;','} '].join('\n')}
var a=require('../../../../three');a.BokehShader={uniforms:{textureWidth:{type:'f',value:1},textureHeight:{type:'f',value:1},focalDepth:{type:'f',value:1},focalLength:{type:'f',value:24},fstop:{type:'f',value:.9},tColor:{type:'t',value:null},tDepth:{type:'t',value:null},maxblur:{type:'f',value:1},showFocus:{type:'i',value:0},manualdof:{type:'i',value:0},vignetting:{type:'i',value:0},depthblur:{type:'i',value:0},threshold:{type:'f',value:.5},gain:{type:'f',value:2},bias:{type:'f',value:.5},fringe:{type:'f',value:.7},znear:{type:'f',value:.1},zfar:{type:'f',value:100},noise:{type:'i',value:1},dithering:{type:'f',value:1e-4},pentagon:{type:'i',value:0},shaderFocus:{type:'i',value:1},focusCoords:{type:'v2',value:new a.Vector2}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['varying vec2 vUv;','uniform sampler2D tColor;','uniform sampler2D tDepth;','uniform float textureWidth;','uniform float textureHeight;','const float PI = 3.14159265;','uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below','uniform float focalLength; //focal length in mm','uniform float fstop; //f-stop value','uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)','/*','make sure that these two values are the same for your camera, otherwise distances will be wrong.','*/','uniform float znear; // camera clipping start','uniform float zfar; // camera clipping end','//------------------------------------------','//user variables','const int samples = SAMPLES; //samples on the first ring','const int rings = RINGS; //ring count','const int maxringsamples = rings * samples;','uniform bool manualdof; // manual dof calculation','float ndofstart = 1.0; // near dof blur start','float ndofdist = 2.0; // near dof blur falloff distance','float fdofstart = 1.0; // far dof blur start','float fdofdist = 3.0; // far dof blur falloff distance','float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)','uniform bool vignetting; // use optical lens vignetting','float vignout = 1.3; // vignetting outer border','float vignin = 0.0; // vignetting inner border','float vignfade = 22.0; // f-stops till vignete fades','uniform bool shaderFocus;','// disable if you use external focalDepth value','uniform vec2 focusCoords;','// autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)','// if center of screen use vec2(0.5, 0.5);','uniform float maxblur;','//clamp value of max blur (0.0 = no blur, 1.0 default)','uniform float threshold; // highlight threshold;','uniform float gain; // highlight gain;','uniform float bias; // bokeh edge bias','uniform float fringe; // bokeh chromatic aberration / fringing','uniform bool noise; //use noise instead of pattern for sample dithering','uniform float dithering;','uniform bool depthblur; // blur the depth buffer','float dbsize = 1.25; // depth blur size','/*','next part is experimental','not looking good with small sample and ring count','looks okay starting from samples = 4, rings = 4','*/','uniform bool pentagon; //use pentagon as bokeh shape?','float feather = 0.4; //pentagon shape feather','//------------------------------------------','float penta(vec2 coords) {','//pentagonal shape','float scale = float(rings) - 1.3;','vec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);','vec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);','vec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);','vec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);','vec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);','vec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);','vec4 one = vec4( 1.0 );','vec4 P = vec4((coords),vec2(scale, scale));','vec4 dist = vec4(0.0);','float inorout = -4.0;','dist.x = dot( P, HS0 );','dist.y = dot( P, HS1 );','dist.z = dot( P, HS2 );','dist.w = dot( P, HS3 );','dist = smoothstep( -feather, feather, dist );','inorout += dot( dist, one );','dist.x = dot( P, HS4 );','dist.y = HS5.w - abs( P.z );','dist = smoothstep( -feather, feather, dist );','inorout += dist.x;','return clamp( inorout, 0.0, 1.0 );','}','float bdepth(vec2 coords) {','// Depth buffer blur','float d = 0.0;','float kernel[9];','vec2 offset[9];','vec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;','offset[0] = vec2(-wh.x,-wh.y);','offset[1] = vec2( 0.0, -wh.y);','offset[2] = vec2( wh.x -wh.y);','offset[3] = vec2(-wh.x, 0.0);','offset[4] = vec2( 0.0, 0.0);','offset[5] = vec2( wh.x, 0.0);','offset[6] = vec2(-wh.x, wh.y);','offset[7] = vec2( 0.0, wh.y);','offset[8] = vec2( wh.x, wh.y);','kernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;','kernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;','kernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;','for( int i=0; i<9; i++ ) {','float tmp = texture2D(tDepth, coords + offset[i]).r;','d += tmp * kernel[i];','}','return d;','}','vec3 color(vec2 coords,float blur) {','//processing the sample','vec3 col = vec3(0.0);','vec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);','col.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;','col.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;','col.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;','vec3 lumcoeff = vec3(0.299,0.587,0.114);','float lum = dot(col.rgb, lumcoeff);','float thresh = max((lum-threshold)*gain, 0.0);','return col+mix(vec3(0.0),col,thresh*blur);','}','vec2 rand(vec2 coord) {','// generating noise / pattern texture for dithering','float noiseX = ((fract(1.0-coord.s*(textureWidth/2.0))*0.25)+(fract(coord.t*(textureHeight/2.0))*0.75))*2.0-1.0;','float noiseY = ((fract(1.0-coord.s*(textureWidth/2.0))*0.75)+(fract(coord.t*(textureHeight/2.0))*0.25))*2.0-1.0;','if (noise) {','noiseX = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233))) * 43758.5453),0.0,1.0)*2.0-1.0;','noiseY = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233)*2.0)) * 43758.5453),0.0,1.0)*2.0-1.0;','}','return vec2(noiseX,noiseY);','}','vec3 debugFocus(vec3 col, float blur, float depth) {','float edge = 0.002*depth; //distance based edge smoothing','float m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);','float e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);','col = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);','col = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);','return col;','}','float linearize(float depth) {','return -zfar * znear / (depth * (zfar - znear) - zfar);','}','float vignette() {','float dist = distance(vUv.xy, vec2(0.5,0.5));','dist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);','return clamp(dist,0.0,1.0);','}','float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {','float rings2 = float(rings);','float step = PI*2.0 / float(ringsamples);','float pw = cos(j*step)*i;','float ph = sin(j*step)*i;','float p = 1.0;','if (pentagon) {','p = penta(vec2(pw,ph));','}','col += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;','return 1.0 * mix(1.0, i /rings2, bias) * p;','}','void main() {','//scene depth calculation','float depth = linearize(texture2D(tDepth,vUv.xy).x);','// Blur depth?','if (depthblur) {','depth = linearize(bdepth(vUv.xy));','}','//focal plane calculation','float fDepth = focalDepth;','if (shaderFocus) {','fDepth = linearize(texture2D(tDepth,focusCoords).x);','}','// dof blur factor calculation','float blur = 0.0;','if (manualdof) {','float a = depth-fDepth; // Focal plane','float b = (a-fdofstart)/fdofdist; // Far DoF','float c = (-a-ndofstart)/ndofdist; // Near Dof','blur = (a>0.0) ? b : c;','} else {','float f = focalLength; // focal length in mm','float d = fDepth*1000.0; // focal plane in mm','float o = depth*1000.0; // depth in mm','float a = (o*f)/(o-f);','float b = (d*f)/(d-f);','float c = (d-f)/(d*fstop*CoC);','blur = abs(a-b)*c;','}','blur = clamp(blur,0.0,1.0);','// calculation of pattern for dithering','vec2 noise = rand(vUv.xy)*dithering*blur;','// getting blur x and y step factor','float w = (1.0/textureWidth)*blur*maxblur+noise.x;','float h = (1.0/textureHeight)*blur*maxblur+noise.y;','// calculation of final color','vec3 col = vec3(0.0);','if(blur < 0.05) {','//some optimization thingy','col = texture2D(tColor, vUv.xy).rgb;','} else {','col = texture2D(tColor, vUv.xy).rgb;','float s = 1.0;','int ringsamples;','for (int i = 1; i <= rings; i++) {','/*unboxstart*/','ringsamples = i * samples;','for (int j = 0 ; j < maxringsamples ; j++) {','if (j >= ringsamples) break;','s += gather(float(i), float(j), ringsamples, col, w, h, blur);','}','/*unboxend*/','}','col /= s; //divide by sample count','}','if (showFocus) {','col = debugFocus(col, blur, depth);','}','if (vignetting) {','col *= vignette();','}','gl_FragColor.rgb = col;','gl_FragColor.a = 1.0;','} '].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.ConvolutionShader={defines:{KERNEL_SIZE_FLOAT:'25.0',KERNEL_SIZE_INT:'25'},uniforms:{tDiffuse:{type:'t',value:null},uImageIncrement:{type:'v2',value:new a.Vector2(.001953125,0)},cKernel:{type:'fv1',value:[]}},vertexShader:['uniform vec2 uImageIncrement;','varying vec2 vUv;','void main() {','vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float cKernel[ KERNEL_SIZE_INT ];','uniform sampler2D tDiffuse;','uniform vec2 uImageIncrement;','varying vec2 vUv;','void main() {','vec2 imageCoord = vUv;','vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );','for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {','sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];','imageCoord += uImageIncrement;','}','gl_FragColor = sum;','}'].join('\n'),buildKernel:function(f){function h(a,b){return Math.exp(-(a*a)/(2*b*b))}var a,c,d,g,e=25,b=2*Math.ceil(f*3)+1;for(b>e&&(b=e),g=(b-1)*.5,c=new Array(b),d=0,a=0;a<b;++a)c[a]=h(a-g,f),d+=c[a];for(a=0;a<b;++a)c[a]/=d;return c}}
var a=require('../../../../three');a.ConvolutionShader={defines:{KERNEL_SIZE_FLOAT:'25.0',KERNEL_SIZE_INT:'25'},uniforms:{tDiffuse:{type:'t',value:null},uImageIncrement:{type:'v2',value:new a.Vector2(.001953125,0)},cKernel:{type:'fv1',value:[]}},vertexShader:['uniform vec2 uImageIncrement;','varying vec2 vUv;','void main() {','vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float cKernel[ KERNEL_SIZE_INT ];','uniform sampler2D tDiffuse;','uniform vec2 uImageIncrement;','varying vec2 vUv;','void main() {','vec2 imageCoord = vUv;','vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );','for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {','sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];','imageCoord += uImageIncrement;','}','gl_FragColor = sum;','}'].join('\n'),buildKernel:function(f){function h(a,b){return Math.exp(-(a*a)/(2*b*b))}var a,c,d,g,e=25,b=2*Math.ceil(f*3)+1;for(b>e&&(b=e),g=(b-1)*.5,c=new Array(b),d=0,a=0;a<b;++a)c[a]=h(a-g,f),d+=c[a];for(a=0;a<b;++a)c[a]/=d;return c}}

@@ -1,1 +0,1 @@

var a=require('three');a.CopyShader={uniforms:{tDiffuse:{type:'t',value:null},opacity:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float opacity;','uniform sampler2D tDiffuse;','varying vec2 vUv;','void main() {','vec4 texel = texture2D( tDiffuse, vUv );','gl_FragColor = opacity * texel;','}'].join('\n')}
var a=require('../../../../three');a.CopyShader={uniforms:{tDiffuse:{type:'t',value:null},opacity:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float opacity;','uniform sampler2D tDiffuse;','varying vec2 vUv;','void main() {','vec4 texel = texture2D( tDiffuse, vUv );','gl_FragColor = opacity * texel;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.HorizontalBlurShader={uniforms:{tDiffuse:{type:'t',value:null},h:{type:'f',value:.001953125}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float h;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}
var a=require('../../../../three');a.HorizontalBlurShader={uniforms:{tDiffuse:{type:'t',value:null},h:{type:'f',value:.001953125}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float h;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.HorizontalTiltShiftShader={uniforms:{tDiffuse:{type:'t',value:null},h:{type:'f',value:.001953125},r:{type:'f',value:.35}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float h;','uniform float r;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','float hh = h * abs( r - vUv.y );','sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}
var a=require('../../../../three');a.HorizontalTiltShiftShader={uniforms:{tDiffuse:{type:'t',value:null},h:{type:'f',value:.001953125},r:{type:'f',value:.35}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float h;','uniform float r;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','float hh = h * abs( r - vUv.y );','sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.VerticalBlurShader={uniforms:{tDiffuse:{type:'t',value:null},v:{type:'f',value:.001953125}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float v;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}
var a=require('../../../../three');a.VerticalBlurShader={uniforms:{tDiffuse:{type:'t',value:null},v:{type:'f',value:.001953125}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float v;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.VerticalTiltShiftShader={uniforms:{tDiffuse:{type:'t',value:null},v:{type:'f',value:.001953125},r:{type:'f',value:.35}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float v;','uniform float r;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','float vv = v * abs( r - vUv.y );','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}
var a=require('../../../../three');a.VerticalTiltShiftShader={uniforms:{tDiffuse:{type:'t',value:null},v:{type:'f',value:.001953125},r:{type:'f',value:.35}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float v;','uniform float r;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','float vv = v * abs( r - vUv.y );','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.ShaderPass=function(b,c){this.textureID=c!==undefined?c:'tDiffuse',this.uniforms=a.UniformsUtils.clone(b.uniforms),this.material=new a.ShaderMaterial({defines:b.defines||{},uniforms:this.uniforms,vertexShader:b.vertexShader,fragmentShader:b.fragmentShader}),this.renderToScreen=!1,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.camera=new a.OrthographicCamera(-1,1,1,-1,0,1),this.scene=new a.Scene,this.quad=new a.Mesh(new a.PlaneBufferGeometry(2,2),null),this.scene.add(this.quad)},a.ShaderPass.prototype={render:function(a,b,c,d){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=c),this.quad.material=this.material,this.renderToScreen?a.render(this.scene,this.camera):a.render(this.scene,this.camera,b,this.clear)}}
var a=require('../../../three');a.ShaderPass=function(b,c){this.textureID=c!==undefined?c:'tDiffuse',this.uniforms=a.UniformsUtils.clone(b.uniforms),this.material=new a.ShaderMaterial({defines:b.defines||{},uniforms:this.uniforms,vertexShader:b.vertexShader,fragmentShader:b.fragmentShader}),this.renderToScreen=!1,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.camera=new a.OrthographicCamera(-1,1,1,-1,0,1),this.scene=new a.Scene,this.quad=new a.Mesh(new a.PlaneBufferGeometry(2,2),null),this.scene.add(this.quad)},a.ShaderPass.prototype={render:function(a,b,c,d){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=c),this.quad.material=this.material,this.renderToScreen?a.render(this.scene,this.camera):a.render(this.scene,this.camera,b,this.clear)}}

@@ -1,1 +0,1 @@

var a=require('three');a.BleachBypassShader={uniforms:{tDiffuse:{type:'t',value:null},opacity:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float opacity;','uniform sampler2D tDiffuse;','varying vec2 vUv;','void main() {','vec4 base = texture2D( tDiffuse, vUv );','vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );','float lum = dot( lumCoeff, base.rgb );','vec3 blend = vec3( lum );','float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );','vec3 result1 = 2.0 * base.rgb * blend;','vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );','vec3 newColor = mix( result1, result2, L );','float A2 = opacity * base.a;','vec3 mixRGB = A2 * newColor.rgb;','mixRGB += ( ( 1.0 - A2 ) * base.rgb );','gl_FragColor = vec4( mixRGB, base.a );','}'].join('\n')}
var a=require('../../three');a.BleachBypassShader={uniforms:{tDiffuse:{type:'t',value:null},opacity:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float opacity;','uniform sampler2D tDiffuse;','varying vec2 vUv;','void main() {','vec4 base = texture2D( tDiffuse, vUv );','vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );','float lum = dot( lumCoeff, base.rgb );','vec3 blend = vec3( lum );','float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );','vec3 result1 = 2.0 * base.rgb * blend;','vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );','vec3 newColor = mix( result1, result2, L );','float A2 = opacity * base.a;','vec3 mixRGB = A2 * newColor.rgb;','mixRGB += ( ( 1.0 - A2 ) * base.rgb );','gl_FragColor = vec4( mixRGB, base.a );','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.BokehShader={uniforms:{tColor:{type:'t',value:null},tDepth:{type:'t',value:null},focus:{type:'f',value:1},aspect:{type:'f',value:1},aperture:{type:'f',value:.025},maxblur:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['varying vec2 vUv;','uniform sampler2D tColor;','uniform sampler2D tDepth;','uniform float maxblur;','uniform float aperture;','uniform float focus;','uniform float aspect;','void main() {','vec2 aspectcorrect = vec2( 1.0, aspect );','vec4 depth1 = texture2D( tDepth, vUv );','float factor = depth1.x - focus;','vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );','vec2 dofblur9 = dofblur * 0.9;','vec2 dofblur7 = dofblur * 0.7;','vec2 dofblur4 = dofblur * 0.4;','vec4 col = vec4( 0.0 );','col += texture2D( tColor, vUv.xy );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );','gl_FragColor = col / 41.0;','gl_FragColor.a = 1.0;','}'].join('\n')}
var a=require('../../three');a.BokehShader={uniforms:{tColor:{type:'t',value:null},tDepth:{type:'t',value:null},focus:{type:'f',value:1},aspect:{type:'f',value:1},aperture:{type:'f',value:.025},maxblur:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['varying vec2 vUv;','uniform sampler2D tColor;','uniform sampler2D tDepth;','uniform float maxblur;','uniform float aperture;','uniform float focus;','uniform float aspect;','void main() {','vec2 aspectcorrect = vec2( 1.0, aspect );','vec4 depth1 = texture2D( tDepth, vUv );','float factor = depth1.x - focus;','vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );','vec2 dofblur9 = dofblur * 0.9;','vec2 dofblur7 = dofblur * 0.7;','vec2 dofblur4 = dofblur * 0.4;','vec4 col = vec4( 0.0 );','col += texture2D( tColor, vUv.xy );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );','col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );','gl_FragColor = col / 41.0;','gl_FragColor.a = 1.0;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.BokehShader={uniforms:{textureWidth:{type:'f',value:1},textureHeight:{type:'f',value:1},focalDepth:{type:'f',value:1},focalLength:{type:'f',value:24},fstop:{type:'f',value:.9},tColor:{type:'t',value:null},tDepth:{type:'t',value:null},maxblur:{type:'f',value:1},showFocus:{type:'i',value:0},manualdof:{type:'i',value:0},vignetting:{type:'i',value:0},depthblur:{type:'i',value:0},threshold:{type:'f',value:.5},gain:{type:'f',value:2},bias:{type:'f',value:.5},fringe:{type:'f',value:.7},znear:{type:'f',value:.1},zfar:{type:'f',value:100},noise:{type:'i',value:1},dithering:{type:'f',value:1e-4},pentagon:{type:'i',value:0},shaderFocus:{type:'i',value:1},focusCoords:{type:'v2',value:new a.Vector2}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['varying vec2 vUv;','uniform sampler2D tColor;','uniform sampler2D tDepth;','uniform float textureWidth;','uniform float textureHeight;','const float PI = 3.14159265;','uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below','uniform float focalLength; //focal length in mm','uniform float fstop; //f-stop value','uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)','/*','make sure that these two values are the same for your camera, otherwise distances will be wrong.','*/','uniform float znear; // camera clipping start','uniform float zfar; // camera clipping end','//------------------------------------------','//user variables','const int samples = SAMPLES; //samples on the first ring','const int rings = RINGS; //ring count','const int maxringsamples = rings * samples;','uniform bool manualdof; // manual dof calculation','float ndofstart = 1.0; // near dof blur start','float ndofdist = 2.0; // near dof blur falloff distance','float fdofstart = 1.0; // far dof blur start','float fdofdist = 3.0; // far dof blur falloff distance','float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)','uniform bool vignetting; // use optical lens vignetting','float vignout = 1.3; // vignetting outer border','float vignin = 0.0; // vignetting inner border','float vignfade = 22.0; // f-stops till vignete fades','uniform bool shaderFocus;','// disable if you use external focalDepth value','uniform vec2 focusCoords;','// autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)','// if center of screen use vec2(0.5, 0.5);','uniform float maxblur;','//clamp value of max blur (0.0 = no blur, 1.0 default)','uniform float threshold; // highlight threshold;','uniform float gain; // highlight gain;','uniform float bias; // bokeh edge bias','uniform float fringe; // bokeh chromatic aberration / fringing','uniform bool noise; //use noise instead of pattern for sample dithering','uniform float dithering;','uniform bool depthblur; // blur the depth buffer','float dbsize = 1.25; // depth blur size','/*','next part is experimental','not looking good with small sample and ring count','looks okay starting from samples = 4, rings = 4','*/','uniform bool pentagon; //use pentagon as bokeh shape?','float feather = 0.4; //pentagon shape feather','//------------------------------------------','float penta(vec2 coords) {','//pentagonal shape','float scale = float(rings) - 1.3;','vec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);','vec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);','vec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);','vec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);','vec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);','vec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);','vec4 one = vec4( 1.0 );','vec4 P = vec4((coords),vec2(scale, scale));','vec4 dist = vec4(0.0);','float inorout = -4.0;','dist.x = dot( P, HS0 );','dist.y = dot( P, HS1 );','dist.z = dot( P, HS2 );','dist.w = dot( P, HS3 );','dist = smoothstep( -feather, feather, dist );','inorout += dot( dist, one );','dist.x = dot( P, HS4 );','dist.y = HS5.w - abs( P.z );','dist = smoothstep( -feather, feather, dist );','inorout += dist.x;','return clamp( inorout, 0.0, 1.0 );','}','float bdepth(vec2 coords) {','// Depth buffer blur','float d = 0.0;','float kernel[9];','vec2 offset[9];','vec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;','offset[0] = vec2(-wh.x,-wh.y);','offset[1] = vec2( 0.0, -wh.y);','offset[2] = vec2( wh.x -wh.y);','offset[3] = vec2(-wh.x, 0.0);','offset[4] = vec2( 0.0, 0.0);','offset[5] = vec2( wh.x, 0.0);','offset[6] = vec2(-wh.x, wh.y);','offset[7] = vec2( 0.0, wh.y);','offset[8] = vec2( wh.x, wh.y);','kernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;','kernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;','kernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;','for( int i=0; i<9; i++ ) {','float tmp = texture2D(tDepth, coords + offset[i]).r;','d += tmp * kernel[i];','}','return d;','}','vec3 color(vec2 coords,float blur) {','//processing the sample','vec3 col = vec3(0.0);','vec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);','col.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;','col.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;','col.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;','vec3 lumcoeff = vec3(0.299,0.587,0.114);','float lum = dot(col.rgb, lumcoeff);','float thresh = max((lum-threshold)*gain, 0.0);','return col+mix(vec3(0.0),col,thresh*blur);','}','vec2 rand(vec2 coord) {','// generating noise / pattern texture for dithering','float noiseX = ((fract(1.0-coord.s*(textureWidth/2.0))*0.25)+(fract(coord.t*(textureHeight/2.0))*0.75))*2.0-1.0;','float noiseY = ((fract(1.0-coord.s*(textureWidth/2.0))*0.75)+(fract(coord.t*(textureHeight/2.0))*0.25))*2.0-1.0;','if (noise) {','noiseX = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233))) * 43758.5453),0.0,1.0)*2.0-1.0;','noiseY = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233)*2.0)) * 43758.5453),0.0,1.0)*2.0-1.0;','}','return vec2(noiseX,noiseY);','}','vec3 debugFocus(vec3 col, float blur, float depth) {','float edge = 0.002*depth; //distance based edge smoothing','float m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);','float e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);','col = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);','col = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);','return col;','}','float linearize(float depth) {','return -zfar * znear / (depth * (zfar - znear) - zfar);','}','float vignette() {','float dist = distance(vUv.xy, vec2(0.5,0.5));','dist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);','return clamp(dist,0.0,1.0);','}','float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {','float rings2 = float(rings);','float step = PI*2.0 / float(ringsamples);','float pw = cos(j*step)*i;','float ph = sin(j*step)*i;','float p = 1.0;','if (pentagon) {','p = penta(vec2(pw,ph));','}','col += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;','return 1.0 * mix(1.0, i /rings2, bias) * p;','}','void main() {','//scene depth calculation','float depth = linearize(texture2D(tDepth,vUv.xy).x);','// Blur depth?','if (depthblur) {','depth = linearize(bdepth(vUv.xy));','}','//focal plane calculation','float fDepth = focalDepth;','if (shaderFocus) {','fDepth = linearize(texture2D(tDepth,focusCoords).x);','}','// dof blur factor calculation','float blur = 0.0;','if (manualdof) {','float a = depth-fDepth; // Focal plane','float b = (a-fdofstart)/fdofdist; // Far DoF','float c = (-a-ndofstart)/ndofdist; // Near Dof','blur = (a>0.0) ? b : c;','} else {','float f = focalLength; // focal length in mm','float d = fDepth*1000.0; // focal plane in mm','float o = depth*1000.0; // depth in mm','float a = (o*f)/(o-f);','float b = (d*f)/(d-f);','float c = (d-f)/(d*fstop*CoC);','blur = abs(a-b)*c;','}','blur = clamp(blur,0.0,1.0);','// calculation of pattern for dithering','vec2 noise = rand(vUv.xy)*dithering*blur;','// getting blur x and y step factor','float w = (1.0/textureWidth)*blur*maxblur+noise.x;','float h = (1.0/textureHeight)*blur*maxblur+noise.y;','// calculation of final color','vec3 col = vec3(0.0);','if(blur < 0.05) {','//some optimization thingy','col = texture2D(tColor, vUv.xy).rgb;','} else {','col = texture2D(tColor, vUv.xy).rgb;','float s = 1.0;','int ringsamples;','for (int i = 1; i <= rings; i++) {','/*unboxstart*/','ringsamples = i * samples;','for (int j = 0 ; j < maxringsamples ; j++) {','if (j >= ringsamples) break;','s += gather(float(i), float(j), ringsamples, col, w, h, blur);','}','/*unboxend*/','}','col /= s; //divide by sample count','}','if (showFocus) {','col = debugFocus(col, blur, depth);','}','if (vignetting) {','col *= vignette();','}','gl_FragColor.rgb = col;','gl_FragColor.a = 1.0;','} '].join('\n')}
var a=require('../../three');a.BokehShader={uniforms:{textureWidth:{type:'f',value:1},textureHeight:{type:'f',value:1},focalDepth:{type:'f',value:1},focalLength:{type:'f',value:24},fstop:{type:'f',value:.9},tColor:{type:'t',value:null},tDepth:{type:'t',value:null},maxblur:{type:'f',value:1},showFocus:{type:'i',value:0},manualdof:{type:'i',value:0},vignetting:{type:'i',value:0},depthblur:{type:'i',value:0},threshold:{type:'f',value:.5},gain:{type:'f',value:2},bias:{type:'f',value:.5},fringe:{type:'f',value:.7},znear:{type:'f',value:.1},zfar:{type:'f',value:100},noise:{type:'i',value:1},dithering:{type:'f',value:1e-4},pentagon:{type:'i',value:0},shaderFocus:{type:'i',value:1},focusCoords:{type:'v2',value:new a.Vector2}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['varying vec2 vUv;','uniform sampler2D tColor;','uniform sampler2D tDepth;','uniform float textureWidth;','uniform float textureHeight;','const float PI = 3.14159265;','uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below','uniform float focalLength; //focal length in mm','uniform float fstop; //f-stop value','uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)','/*','make sure that these two values are the same for your camera, otherwise distances will be wrong.','*/','uniform float znear; // camera clipping start','uniform float zfar; // camera clipping end','//------------------------------------------','//user variables','const int samples = SAMPLES; //samples on the first ring','const int rings = RINGS; //ring count','const int maxringsamples = rings * samples;','uniform bool manualdof; // manual dof calculation','float ndofstart = 1.0; // near dof blur start','float ndofdist = 2.0; // near dof blur falloff distance','float fdofstart = 1.0; // far dof blur start','float fdofdist = 3.0; // far dof blur falloff distance','float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)','uniform bool vignetting; // use optical lens vignetting','float vignout = 1.3; // vignetting outer border','float vignin = 0.0; // vignetting inner border','float vignfade = 22.0; // f-stops till vignete fades','uniform bool shaderFocus;','// disable if you use external focalDepth value','uniform vec2 focusCoords;','// autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)','// if center of screen use vec2(0.5, 0.5);','uniform float maxblur;','//clamp value of max blur (0.0 = no blur, 1.0 default)','uniform float threshold; // highlight threshold;','uniform float gain; // highlight gain;','uniform float bias; // bokeh edge bias','uniform float fringe; // bokeh chromatic aberration / fringing','uniform bool noise; //use noise instead of pattern for sample dithering','uniform float dithering;','uniform bool depthblur; // blur the depth buffer','float dbsize = 1.25; // depth blur size','/*','next part is experimental','not looking good with small sample and ring count','looks okay starting from samples = 4, rings = 4','*/','uniform bool pentagon; //use pentagon as bokeh shape?','float feather = 0.4; //pentagon shape feather','//------------------------------------------','float penta(vec2 coords) {','//pentagonal shape','float scale = float(rings) - 1.3;','vec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);','vec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);','vec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);','vec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);','vec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);','vec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);','vec4 one = vec4( 1.0 );','vec4 P = vec4((coords),vec2(scale, scale));','vec4 dist = vec4(0.0);','float inorout = -4.0;','dist.x = dot( P, HS0 );','dist.y = dot( P, HS1 );','dist.z = dot( P, HS2 );','dist.w = dot( P, HS3 );','dist = smoothstep( -feather, feather, dist );','inorout += dot( dist, one );','dist.x = dot( P, HS4 );','dist.y = HS5.w - abs( P.z );','dist = smoothstep( -feather, feather, dist );','inorout += dist.x;','return clamp( inorout, 0.0, 1.0 );','}','float bdepth(vec2 coords) {','// Depth buffer blur','float d = 0.0;','float kernel[9];','vec2 offset[9];','vec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;','offset[0] = vec2(-wh.x,-wh.y);','offset[1] = vec2( 0.0, -wh.y);','offset[2] = vec2( wh.x -wh.y);','offset[3] = vec2(-wh.x, 0.0);','offset[4] = vec2( 0.0, 0.0);','offset[5] = vec2( wh.x, 0.0);','offset[6] = vec2(-wh.x, wh.y);','offset[7] = vec2( 0.0, wh.y);','offset[8] = vec2( wh.x, wh.y);','kernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;','kernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;','kernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;','for( int i=0; i<9; i++ ) {','float tmp = texture2D(tDepth, coords + offset[i]).r;','d += tmp * kernel[i];','}','return d;','}','vec3 color(vec2 coords,float blur) {','//processing the sample','vec3 col = vec3(0.0);','vec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);','col.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;','col.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;','col.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;','vec3 lumcoeff = vec3(0.299,0.587,0.114);','float lum = dot(col.rgb, lumcoeff);','float thresh = max((lum-threshold)*gain, 0.0);','return col+mix(vec3(0.0),col,thresh*blur);','}','vec2 rand(vec2 coord) {','// generating noise / pattern texture for dithering','float noiseX = ((fract(1.0-coord.s*(textureWidth/2.0))*0.25)+(fract(coord.t*(textureHeight/2.0))*0.75))*2.0-1.0;','float noiseY = ((fract(1.0-coord.s*(textureWidth/2.0))*0.75)+(fract(coord.t*(textureHeight/2.0))*0.25))*2.0-1.0;','if (noise) {','noiseX = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233))) * 43758.5453),0.0,1.0)*2.0-1.0;','noiseY = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233)*2.0)) * 43758.5453),0.0,1.0)*2.0-1.0;','}','return vec2(noiseX,noiseY);','}','vec3 debugFocus(vec3 col, float blur, float depth) {','float edge = 0.002*depth; //distance based edge smoothing','float m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);','float e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);','col = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);','col = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);','return col;','}','float linearize(float depth) {','return -zfar * znear / (depth * (zfar - znear) - zfar);','}','float vignette() {','float dist = distance(vUv.xy, vec2(0.5,0.5));','dist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);','return clamp(dist,0.0,1.0);','}','float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {','float rings2 = float(rings);','float step = PI*2.0 / float(ringsamples);','float pw = cos(j*step)*i;','float ph = sin(j*step)*i;','float p = 1.0;','if (pentagon) {','p = penta(vec2(pw,ph));','}','col += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;','return 1.0 * mix(1.0, i /rings2, bias) * p;','}','void main() {','//scene depth calculation','float depth = linearize(texture2D(tDepth,vUv.xy).x);','// Blur depth?','if (depthblur) {','depth = linearize(bdepth(vUv.xy));','}','//focal plane calculation','float fDepth = focalDepth;','if (shaderFocus) {','fDepth = linearize(texture2D(tDepth,focusCoords).x);','}','// dof blur factor calculation','float blur = 0.0;','if (manualdof) {','float a = depth-fDepth; // Focal plane','float b = (a-fdofstart)/fdofdist; // Far DoF','float c = (-a-ndofstart)/ndofdist; // Near Dof','blur = (a>0.0) ? b : c;','} else {','float f = focalLength; // focal length in mm','float d = fDepth*1000.0; // focal plane in mm','float o = depth*1000.0; // depth in mm','float a = (o*f)/(o-f);','float b = (d*f)/(d-f);','float c = (d-f)/(d*fstop*CoC);','blur = abs(a-b)*c;','}','blur = clamp(blur,0.0,1.0);','// calculation of pattern for dithering','vec2 noise = rand(vUv.xy)*dithering*blur;','// getting blur x and y step factor','float w = (1.0/textureWidth)*blur*maxblur+noise.x;','float h = (1.0/textureHeight)*blur*maxblur+noise.y;','// calculation of final color','vec3 col = vec3(0.0);','if(blur < 0.05) {','//some optimization thingy','col = texture2D(tColor, vUv.xy).rgb;','} else {','col = texture2D(tColor, vUv.xy).rgb;','float s = 1.0;','int ringsamples;','for (int i = 1; i <= rings; i++) {','/*unboxstart*/','ringsamples = i * samples;','for (int j = 0 ; j < maxringsamples ; j++) {','if (j >= ringsamples) break;','s += gather(float(i), float(j), ringsamples, col, w, h, blur);','}','/*unboxend*/','}','col /= s; //divide by sample count','}','if (showFocus) {','col = debugFocus(col, blur, depth);','}','if (vignetting) {','col *= vignette();','}','gl_FragColor.rgb = col;','gl_FragColor.a = 1.0;','} '].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.ConvolutionShader={defines:{KERNEL_SIZE_FLOAT:'25.0',KERNEL_SIZE_INT:'25'},uniforms:{tDiffuse:{type:'t',value:null},uImageIncrement:{type:'v2',value:new a.Vector2(.001953125,0)},cKernel:{type:'fv1',value:[]}},vertexShader:['uniform vec2 uImageIncrement;','varying vec2 vUv;','void main() {','vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float cKernel[ KERNEL_SIZE_INT ];','uniform sampler2D tDiffuse;','uniform vec2 uImageIncrement;','varying vec2 vUv;','void main() {','vec2 imageCoord = vUv;','vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );','for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {','sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];','imageCoord += uImageIncrement;','}','gl_FragColor = sum;','}'].join('\n'),buildKernel:function(f){function h(a,b){return Math.exp(-(a*a)/(2*b*b))}var a,c,d,g,e=25,b=2*Math.ceil(f*3)+1;for(b>e&&(b=e),g=(b-1)*.5,c=new Array(b),d=0,a=0;a<b;++a)c[a]=h(a-g,f),d+=c[a];for(a=0;a<b;++a)c[a]/=d;return c}}
var a=require('../../three');a.ConvolutionShader={defines:{KERNEL_SIZE_FLOAT:'25.0',KERNEL_SIZE_INT:'25'},uniforms:{tDiffuse:{type:'t',value:null},uImageIncrement:{type:'v2',value:new a.Vector2(.001953125,0)},cKernel:{type:'fv1',value:[]}},vertexShader:['uniform vec2 uImageIncrement;','varying vec2 vUv;','void main() {','vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float cKernel[ KERNEL_SIZE_INT ];','uniform sampler2D tDiffuse;','uniform vec2 uImageIncrement;','varying vec2 vUv;','void main() {','vec2 imageCoord = vUv;','vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );','for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {','sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];','imageCoord += uImageIncrement;','}','gl_FragColor = sum;','}'].join('\n'),buildKernel:function(f){function h(a,b){return Math.exp(-(a*a)/(2*b*b))}var a,c,d,g,e=25,b=2*Math.ceil(f*3)+1;for(b>e&&(b=e),g=(b-1)*.5,c=new Array(b),d=0,a=0;a<b;++a)c[a]=h(a-g,f),d+=c[a];for(a=0;a<b;++a)c[a]/=d;return c}}

@@ -1,1 +0,1 @@

var a=require('three');a.CopyShader={uniforms:{tDiffuse:{type:'t',value:null},opacity:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float opacity;','uniform sampler2D tDiffuse;','varying vec2 vUv;','void main() {','vec4 texel = texture2D( tDiffuse, vUv );','gl_FragColor = opacity * texel;','}'].join('\n')}
var a=require('../../three');a.CopyShader={uniforms:{tDiffuse:{type:'t',value:null},opacity:{type:'f',value:1}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform float opacity;','uniform sampler2D tDiffuse;','varying vec2 vUv;','void main() {','vec4 texel = texture2D( tDiffuse, vUv );','gl_FragColor = opacity * texel;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.HorizontalBlurShader={uniforms:{tDiffuse:{type:'t',value:null},h:{type:'f',value:.001953125}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float h;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}
var a=require('../../three');a.HorizontalBlurShader={uniforms:{tDiffuse:{type:'t',value:null},h:{type:'f',value:.001953125}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float h;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.HorizontalTiltShiftShader={uniforms:{tDiffuse:{type:'t',value:null},h:{type:'f',value:.001953125},r:{type:'f',value:.35}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float h;','uniform float r;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','float hh = h * abs( r - vUv.y );','sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}
var a=require('../../three');a.HorizontalTiltShiftShader={uniforms:{tDiffuse:{type:'t',value:null},h:{type:'f',value:.001953125},r:{type:'f',value:.35}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float h;','uniform float r;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','float hh = h * abs( r - vUv.y );','sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.VerticalBlurShader={uniforms:{tDiffuse:{type:'t',value:null},v:{type:'f',value:.001953125}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float v;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}
var a=require('../../three');a.VerticalBlurShader={uniforms:{tDiffuse:{type:'t',value:null},v:{type:'f',value:.001953125}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float v;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}

@@ -1,1 +0,1 @@

var a=require('three');a.VerticalTiltShiftShader={uniforms:{tDiffuse:{type:'t',value:null},v:{type:'f',value:.001953125},r:{type:'f',value:.35}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float v;','uniform float r;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','float vv = v * abs( r - vUv.y );','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}
var a=require('../../three');a.VerticalTiltShiftShader={uniforms:{tDiffuse:{type:'t',value:null},v:{type:'f',value:.001953125},r:{type:'f',value:.35}},vertexShader:['varying vec2 vUv;','void main() {','vUv = uv;','gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );','}'].join('\n'),fragmentShader:['uniform sampler2D tDiffuse;','uniform float v;','uniform float r;','varying vec2 vUv;','void main() {','vec4 sum = vec4( 0.0 );','float vv = v * abs( r - vUv.y );','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;','sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;','gl_FragColor = sum;','}'].join('\n')}

@@ -1,1 +0,1 @@

function b(a,d){d=this.options=c.deepMerge(b.options,d),a&&this.addTo(a),this.loop()}var c=require('./../core/utils'),a=require('three');b.options={width:2e7,height:2e7},b.prototype={init:function(){var b=this.options,d=new a.PlaneGeometry(b.width,b.height,10),c=this.material=new a.MeshBasicMaterial({side:a.DoubleSide,color:'#fff'});c.needsUpdate=!0;var e=this.mesh=new a.Mesh(d,c);this.three3D.add(e)},addTo:function(a){this._map=a,this.three3D=a.three3D,this.init()},preview:function(a){if(!a)return;this.texture=this.mesh.material.map=a,this.update()},update:function(){var a=this.texture;a&&(this.material.needsUpdate=!0)},loop:function(){this.update(),requestAnimationFrame(this.loop.bind(this))}},module.exports=b
function b(a,d){d=this.options=c.deepMerge(b.options,d),a&&this.addTo(a),this.loop()}var c=require('./../core/utils'),a=require('../three');b.options={width:2e7,height:2e7},b.prototype={init:function(){var b=this.options,d=new a.PlaneGeometry(b.width,b.height,10),c=this.material=new a.MeshBasicMaterial({side:a.DoubleSide,color:'#fff'});c.needsUpdate=!0;var e=this.mesh=new a.Mesh(d,c);this.three3D.add(e)},addTo:function(a){this._map=a,this.three3D=a.three3D,this.init()},preview:function(a){if(!a)return;this.texture=this.mesh.material.map=a,this.update()},update:function(){var a=this.texture;a&&(this.material.needsUpdate=!0)},loop:function(){this.update(),requestAnimationFrame(this.loop.bind(this))}},module.exports=b

@@ -1,1 +0,1 @@

function a(c){this.options=b.deepMerge(a.options,c),this.init()}var d=require('three'),b=require('./../core/utils'),c=require('bcore/event'),e=b.requestAnimationFrame,f=b.cancelAnimationFrame;a.options={width:1e3,height:1e3,clearWithImage:!1,mode:'source-over'},a=c.extend(a,{init:function(a){this.initCanvas()},loadImage:function(c,b){return typeof a==='object'?this.image=a:this.loadImage(a,this.initCanvas.bind(this));var a=this.image=new Image;a.src=c,a.onload=function(){b&&b(a)}.bind(this)},initCanvas:function(){var a=this.options,c=a.width,d=a.height,b=this.canvas=document.createElement('canvas');b.width=c,b.height=d;var e=this.ctx=b.getContext('2d');e.globalCompositeOperation=a.mode,this.clear()},clear:function(){return this.image&&this.options.clearWithImage?this.ctx.drawImage(this.image,0,0,this.canvas.width,this.canvas.height):this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},getCanvas:function(){return this.canvas},dot:function(c,d,e,b,a){a=a||b,this.ctx.drawImage(c,d-b,e-a,2*b,2*a)}}),module.exports=a
function a(c){this.options=b.deepMerge(a.options,c),this.init()}var d=require('../three'),b=require('./../core/utils'),c=require('bcore/event'),e=b.requestAnimationFrame,f=b.cancelAnimationFrame;a.options={width:1e3,height:1e3,clearWithImage:!1,mode:'source-over'},a=c.extend(a,{init:function(a){this.initCanvas()},loadImage:function(c,b){return typeof a==='object'?this.image=a:this.loadImage(a,this.initCanvas.bind(this));var a=this.image=new Image;a.src=c,a.onload=function(){b&&b(a)}.bind(this)},initCanvas:function(){var a=this.options,c=a.width,d=a.height,b=this.canvas=document.createElement('canvas');b.width=c,b.height=d;var e=this.ctx=b.getContext('2d');e.globalCompositeOperation=a.mode,this.clear()},clear:function(){return this.image&&this.options.clearWithImage?this.ctx.drawImage(this.image,0,0,this.canvas.width,this.canvas.height):this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},getCanvas:function(){return this.canvas},dot:function(c,d,e,b,a){a=a||b,this.ctx.drawImage(c,d-b,e-a,2*b,2*a)}}),module.exports=a

@@ -1,1 +0,1 @@

'use strict';function b(a){a=this.options=c.deepMerge(b.options,a),this.initShader()}var a=require('three'),c=require('./../core/utils');b.options={shapeType:'circle',r:8e4,offset:1e5,color:'#0ff',indensity:.1,background:'#000',maxOpacity:1,blending:a.AdditiveBlending},b.prototype={initShader:function(){var b=this.options,e='varying vec2 vUv;void main(){vUv = uv;vec3 pos = position;vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;}',f=b.background,g=b.color,c=new a.Color(g),h=new a.Vector4(c.r,c.g,c.b,1),d=new a.Color(f),i=new a.Vector4(d.r,d.g,d.b,1),j={color:{type:'v4',value:h},background:{type:'v4',value:i},rx:{type:'f',value:b.rx||b.r},ry:{type:'f',value:b.ry||b.r},dx:{type:'f',value:b.offset+(b.rx||b.r)*2},dy:{type:'f',value:b.offset+(b.ry||b.r)*2},indensity:{type:'f',value:b.indensity}};this.material=new a.ShaderMaterial({uniforms:j,vertexShader:e,fragmentShader:this.getFragmentShader(),blending:b.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:a.SmoothShading})},getFragmentShader:function(){var a=this.options.shapeType,b;a==='circle'?b='ratio = (disX * disX + disY * disY) / (rx * rx + ry * ry);':a==='rect'?b='ratio = max(disX / rx , disY / ry);':a==='diamond'&&(b='ratio = (disX + disY ) / (rx + ry );');var c='uniform vec4 color;uniform vec4 background;uniform float dx;uniform float dy;uniform float rx;uniform float ry;uniform float indensity;varying vec2 vUv;void main() {float relativeX = mod(vUv.x, dx);float relativeY = mod(vUv.y, dy);float disX = abs(relativeX - dx * 0.5);float disY = abs(relativeY - dy * 0.5);float ratio;'+b+'ratio = pow(ratio, indensity);'+'gl_FragColor = ratio * background + (1.0 - ratio) * color;'+'}';return c},updateUniforms:function(){var f=this.material,c=f.uniforms,b=this.options,g=b.background,h=b.color,d=new a.Color(h),i=new a.Vector4(d.r,d.g,d.b,1),e=new a.Color(g),j=new a.Vector4(e.r,e.g,e.b,1);c.color.value=i,c.background.value=j,c.rx.value=b.rx||b.r,c.ry.value=b.ry||b.r,c.indensity.value=b.indensity,c.dx.value=b.offset+(b.rx||b.r)*2,c.dy.value=b.offset+(b.ry||b.r)*2},updateShader:function(){this.material.fragmentShader=this.getFragmentShader(),this.material.needsUpdate=!0},update:function(){this.updateShader(),this.updateUniforms()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.updateUniforms()},getMaterial:function(){return this.material}},module.exports=b
'use strict';function b(a){a=this.options=c.deepMerge(b.options,a),this.initShader()}var a=require('../three'),c=require('./../core/utils');b.options={shapeType:'circle',r:8e4,offset:1e5,color:'#0ff',indensity:.1,background:'#000',maxOpacity:1,blending:a.AdditiveBlending},b.prototype={initShader:function(){var b=this.options,e='varying vec2 vUv;void main(){vUv = uv;vec3 pos = position;vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;}',f=b.background,g=b.color,c=new a.Color(g),h=new a.Vector4(c.r,c.g,c.b,1),d=new a.Color(f),i=new a.Vector4(d.r,d.g,d.b,1),j={color:{type:'v4',value:h},background:{type:'v4',value:i},rx:{type:'f',value:b.rx||b.r},ry:{type:'f',value:b.ry||b.r},dx:{type:'f',value:b.offset+(b.rx||b.r)*2},dy:{type:'f',value:b.offset+(b.ry||b.r)*2},indensity:{type:'f',value:b.indensity}};this.material=new a.ShaderMaterial({uniforms:j,vertexShader:e,fragmentShader:this.getFragmentShader(),blending:b.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:a.SmoothShading})},getFragmentShader:function(){var a=this.options.shapeType,b;a==='circle'?b='ratio = (disX * disX + disY * disY) / (rx * rx + ry * ry);':a==='rect'?b='ratio = max(disX / rx , disY / ry);':a==='diamond'&&(b='ratio = (disX + disY ) / (rx + ry );');var c='uniform vec4 color;uniform vec4 background;uniform float dx;uniform float dy;uniform float rx;uniform float ry;uniform float indensity;varying vec2 vUv;void main() {float relativeX = mod(vUv.x, dx);float relativeY = mod(vUv.y, dy);float disX = abs(relativeX - dx * 0.5);float disY = abs(relativeY - dy * 0.5);float ratio;'+b+'ratio = pow(ratio, indensity);'+'gl_FragColor = ratio * background + (1.0 - ratio) * color;'+'}';return c},updateUniforms:function(){var f=this.material,c=f.uniforms,b=this.options,g=b.background,h=b.color,d=new a.Color(h),i=new a.Vector4(d.r,d.g,d.b,1),e=new a.Color(g),j=new a.Vector4(e.r,e.g,e.b,1);c.color.value=i,c.background.value=j,c.rx.value=b.rx||b.r,c.ry.value=b.ry||b.r,c.indensity.value=b.indensity,c.dx.value=b.offset+(b.rx||b.r)*2,c.dy.value=b.offset+(b.ry||b.r)*2},updateShader:function(){this.material.fragmentShader=this.getFragmentShader(),this.material.needsUpdate=!0},update:function(){this.updateShader(),this.updateUniforms()},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.updateUniforms()},getMaterial:function(){return this.material}},module.exports=b

@@ -1,1 +0,1 @@

'use strict';function b(d,a){var e=this.texture=d.texture;a=this.options=c.deepMerge(b.options,a),this.initShader()}var a=require('three'),c=require('./../core/utils'),d=c.getSprite,e=require('jquery');b.options={maxOpacity:1,blending:a.AdditiveBlending,heightMax:5e6,wireframe:!1,indensity:1,dotSize:5,sprite:{type:'radian',isContinue:!1,drawN:1.15,color:{from:'rgba(255,255,255, 1)',to:'rgba(255,255,255, 1)',easing:'Linear.None.1.7',space:'rgb'}}},b.prototype={initShader:function(){var b=this.options,e='attribute vec2 uvs;attribute vec3 normals1;varying vec2 uvv;uniform sampler2D texture;uniform float heightMax;uniform float dotSize;void main(){uvv = uvs;vec3 pos = position;vec3 vNormal = normalize(normalMatrix * normals1);vec4 c = texture2D(texture, uvs);float luma = 0.299 * c.x + 0.587 * c.y + 0.114 * c.z;float indensity = pow(luma, 0.1);vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 ) + heightMax * vec4(vNormal * indensity, 0.0);gl_Position = projectionMatrix * mvPosition;gl_PointSize = dotSize;}',f=b.background,g=b.color,c=new a.Color(g),h=new a.Vector4(c.r,c.g,c.b,1),d=new a.Color(f),i=new a.Vector4(d.r,d.g,d.b,1),j={color:{type:'v4',value:h},background:{type:'v4',value:i},indensity:{type:'f',value:b.indensity},texture:{type:'t',value:this.texture},heightMax:{type:'f',value:b.heightMax},dotSize:{type:'f',value:b.dotSize}};this.material=new a.ShaderMaterial({uniforms:j,vertexShader:e,fragmentShader:this.getFragmentShader(),blending:b.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:a.SmoothShading,wireframe:b.wireframe})},getFragmentShader:function(){var a='varying vec2 uvv;uniform vec4 color;uniform float indensity;uniform sampler2D texture;void main() {gl_FragColor = texture2D(texture, uvv);}';return a},updateUniforms:function(){var f=this.material,b=f.uniforms,c=this.options,g=c.background,h=c.color,d=new a.Color(h),i=new a.Vector4(d.r,d.g,d.b,1),e=new a.Color(g),j=new a.Vector4(e.r,e.g,e.b,1);b.color.value=i,b.background.value=j,b.indensity.value=c.indensity,b.heightMax.value=c.heightMax,b.dotSize.value=c.dotSize},updateShader:function(){this.material.fragmentShader=this.getFragmentShader(),this.material.needsUpdate=!0},updateImage:function(b){var a=this.material.uniforms.texture.value;b&&(a.image=b),a&&a.image&&(a.needsUpdate=!0)},update:function(a){this.material.wireframe=this.options.wireframe,this.material.blending=this.options.blending,this.updateImage(a),this.updateShader(),this.updateUniforms(),this.material.needsUpdate=!0},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.update()},getMaterial:function(){return this.update(),this.material}},module.exports=b
'use strict';function b(d,a){var e=this.texture=d.texture;a=this.options=c.deepMerge(b.options,a),this.initShader()}var a=require('../three'),c=require('./../core/utils'),d=c.getSprite,e=require('jquery');b.options={maxOpacity:1,blending:a.AdditiveBlending,heightMax:5e6,wireframe:!1,indensity:1,dotSize:5,sprite:{type:'radian',isContinue:!1,drawN:1.15,color:{from:'rgba(255,255,255, 1)',to:'rgba(255,255,255, 1)',easing:'Linear.None.1.7',space:'rgb'}}},b.prototype={initShader:function(){var b=this.options,e='attribute vec2 uvs;attribute vec3 normals1;varying vec2 uvv;uniform sampler2D texture;uniform float heightMax;uniform float dotSize;void main(){uvv = uvs;vec3 pos = position;vec3 vNormal = normalize(normalMatrix * normals1);vec4 c = texture2D(texture, uvs);float luma = 0.299 * c.x + 0.587 * c.y + 0.114 * c.z;float indensity = pow(luma, 0.1);vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 ) + heightMax * vec4(vNormal * indensity, 0.0);gl_Position = projectionMatrix * mvPosition;gl_PointSize = dotSize;}',f=b.background,g=b.color,c=new a.Color(g),h=new a.Vector4(c.r,c.g,c.b,1),d=new a.Color(f),i=new a.Vector4(d.r,d.g,d.b,1),j={color:{type:'v4',value:h},background:{type:'v4',value:i},indensity:{type:'f',value:b.indensity},texture:{type:'t',value:this.texture},heightMax:{type:'f',value:b.heightMax},dotSize:{type:'f',value:b.dotSize}};this.material=new a.ShaderMaterial({uniforms:j,vertexShader:e,fragmentShader:this.getFragmentShader(),blending:b.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:a.SmoothShading,wireframe:b.wireframe})},getFragmentShader:function(){var a='varying vec2 uvv;uniform vec4 color;uniform float indensity;uniform sampler2D texture;void main() {gl_FragColor = texture2D(texture, uvv);}';return a},updateUniforms:function(){var f=this.material,b=f.uniforms,c=this.options,g=c.background,h=c.color,d=new a.Color(h),i=new a.Vector4(d.r,d.g,d.b,1),e=new a.Color(g),j=new a.Vector4(e.r,e.g,e.b,1);b.color.value=i,b.background.value=j,b.indensity.value=c.indensity,b.heightMax.value=c.heightMax,b.dotSize.value=c.dotSize},updateShader:function(){this.material.fragmentShader=this.getFragmentShader(),this.material.needsUpdate=!0},updateImage:function(b){var a=this.material.uniforms.texture.value;b&&(a.image=b),a&&a.image&&(a.needsUpdate=!0)},update:function(a){this.material.wireframe=this.options.wireframe,this.material.blending=this.options.blending,this.updateImage(a),this.updateShader(),this.updateUniforms(),this.material.needsUpdate=!0},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.update()},getMaterial:function(){return this.update(),this.material}},module.exports=b

@@ -1,1 +0,1 @@

'use strict';var a=require('three'),c=require('./../core/utils'),d=require('bcore/event'),b=function(a){this.options=c.deepMerge(b.options,a)};b.options={maxHeight:5e6,minHeight:5e5,histogramN:100,ratio:1.01,size:1e5,color:65280,opacity:.1,value:function(a){return a.value},lat:c.getLat,lng:c.getLng,id:function(a,b){return a.id||b},blending:a.AdditiveBlending,faceColor:function(b){return new a.Color('rgb(0,150,250)')}},b=d.extend(b,{addTo:function(a){this.three3D=a.three3D,this.init()},init:function(){var c=this.options,d=c.histogramN,b=this.geometry=new a.BufferGeometry,e=this.positionsF32=new Float32Array(d*8*3);b.addAttribute('position',new a.BufferAttribute(e,3,1).setDynamic(!0)),b.computeBoundingSphere();var f=this.material=this.genMaterial(),g=this.mesh=new a.Mesh(b,f);this.three3D.add(g)},genMaterial:function(){var b=this.options;return new a.ShaderMaterial({uniforms:uniforms,vertexShader:vertexShader,fragmentShader:fragmentShader,vertexColors:a.vertexColors,shading:a.SmoothShading,side:a.DoubleSide})}})
'use strict';var a=require('../three'),c=require('./../core/utils'),d=require('bcore/event'),b=function(a){this.options=c.deepMerge(b.options,a)};b.options={maxHeight:5e6,minHeight:5e5,histogramN:100,ratio:1.01,size:1e5,color:65280,opacity:.1,value:function(a){return a.value},lat:c.getLat,lng:c.getLng,id:function(a,b){return a.id||b},blending:a.AdditiveBlending,faceColor:function(b){return new a.Color('rgb(0,150,250)')}},b=d.extend(b,{addTo:function(a){this.three3D=a.three3D,this.init()},init:function(){var c=this.options,d=c.histogramN,b=this.geometry=new a.BufferGeometry,e=this.positionsF32=new Float32Array(d*8*3);b.addAttribute('position',new a.BufferAttribute(e,3,1).setDynamic(!0)),b.computeBoundingSphere();var f=this.material=this.genMaterial(),g=this.mesh=new a.Mesh(b,f);this.three3D.add(g)},genMaterial:function(){var b=this.options;return new a.ShaderMaterial({uniforms:uniforms,vertexShader:vertexShader,fragmentShader:fragmentShader,vertexColors:a.vertexColors,shading:a.SmoothShading,side:a.DoubleSide})}})

@@ -1,1 +0,1 @@

'use strict';function a(d,b){this.texture=d.texture,b=this.options=c.deepMerge(a.options,b),this.initShader()}var b=require('three'),c=require('./../core/utils');a.options={blending:b.AdditiveBlending},a.prototype={initShader:function(){var a=this.options,c='void main(){vec3 pos = position;vec3 vNormal = normalize(normalMatrix * normal);vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;gl_PointSize = 120.0;}',d={heightMax:{type:'f',value:a.heightMax}};this.material=new b.ShaderMaterial({uniforms:d,vertexShader:c,fragmentShader:this.getFragmentShader(),blending:a.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:b.SmoothShading})},getFragmentShader:function(){var b=this.options,a='void main() {gl_FragColor = vec4(1.,1.,1.,1.);}';return a},updateUniforms:function(){var c=this.material,a=c.uniforms,b=this.options;a.indensity.value=b.indensity,a.heightMax.value=b.heightMax},getMaterial:function(){return this.material}},module.exports=a
'use strict';function a(d,b){this.texture=d.texture,b=this.options=c.deepMerge(a.options,b),this.initShader()}var b=require('../three'),c=require('./../core/utils');a.options={blending:b.AdditiveBlending},a.prototype={initShader:function(){var a=this.options,c='void main(){vec3 pos = position;vec3 vNormal = normalize(normalMatrix * normal);vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;gl_PointSize = 120.0;}',d={heightMax:{type:'f',value:a.heightMax}};this.material=new b.ShaderMaterial({uniforms:d,vertexShader:c,fragmentShader:this.getFragmentShader(),blending:a.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:b.SmoothShading})},getFragmentShader:function(){var b=this.options,a='void main() {gl_FragColor = vec4(1.,1.,1.,1.);}';return a},updateUniforms:function(){var c=this.material,a=c.uniforms,b=this.options;a.indensity.value=b.indensity,a.heightMax.value=b.heightMax},getMaterial:function(){return this.material}},module.exports=a

@@ -1,1 +0,1 @@

'use strict';var a=require('three'),c=require('./../core/utils'),b=function(a){this.options=c.deepMerge(b.options,a)},d=0,e=0;b.options={lineN:1e3,ptN:100,maxOpacity:.2,weight:3,material:{blending:a.AdditiveBlending},style:{opacity:function(a){return a*a},hue:.5,color:function(b,c){return b=1-b,new a.Color().setHSL(c,1-b*.3,.3+Math.pow(b,8)*.6)}}};var f=0;b.prototype={addTo:function(a){this.three3D=a.three3D,this.init()},init:function(){var e=this.options,i=e.lineN,x=e.ptN,w=e.style.color.bind(e.style),v=e.style.hue,k=this.lines=[],n=this.colorGroup=[],f=this.geometry=new a.BufferGeometry,d=this.ptRealN=(x-1)*2,u=[],l,p,z,g=this.colorsF32=new Float32Array(d*i*4),m=this.indexesF32=new Float32Array(d*i*1),q=this.positionsF32=new Float32Array(d*i*3),r=[],s=[],t,b=0;for(var c=0;c<i;c++)for(var h=0;h<d;h++){s.push(1-h/d),k[c]=p=k[c]||[],n[c]=t=n[c]||[],l=new a.Vector3,u.push(l),p.push(l),z=w(v,h/d);var j=new a.Vector4(1,1,1,1);g[b*4+0]=1,g[b*4+1]=1,g[b*4+2]=1,g[b*4+3]=1,m[b]=b,b++,r.push(j),t.push(j)}f.addAttribute('cs',new a.BufferAttribute(g,4,1).setDynamic(!0)),f.addAttribute('indexes',new a.BufferAttribute(m,1)),f.addAttribute('position',new a.BufferAttribute(q,3,1).setDynamic(!0)),f.computeBoundingSphere();var y=this.material=this.genMaterial(),o=this.line=new a.LineSegments(f,y);o.frustumCulled=!1,this.three3D.add(o)},getSegment:function(a){console.log('getSegment')},setPt:function(i,c,d,e,f){var g=this.options.ptN,a=i*this.ptRealN,h=this.geometry.getAttribute('position'),b=h.array;if(c===0){b[a*3+0]=d,b[a*3+1]=e,b[a*3+2]=f;return}b[(a+2*c-1)*3+0]=d,b[(a+2*c-1)*3+1]=e,b[(a+2*c-1)*3+2]=f,c<g-1&&(b[(a+2*c)*3+0]=d,b[(a+2*c)*3+1]=e,b[(a+2*c)*3+2]=f)},getPt:function(a,b,c){},update:function(){var a=this.geometry;a.getAttribute('cs').needsUpdate=!0,a.getAttribute('position').needsUpdate=!0},updateOptions:function(a){a=this.options=c.deepMerge(this.options||b.options,a);var d=this.material;d.linewidth=a.weight},getUniforms:function(){return this.uniforms},setColor:function(a,b,c){},setColorArray:function(k,l,b){var i=this.geometry.getAttribute('cs'),c=i.array,g=this.ptRealN,h=k*this.ptRealN,d,f,e,j;for(var a=0;a<g;a++)if(j=a/g,d=h+a,f=l[a],c[d*4+0]=f.r,c[d*4+1]=f.g,c[d*4+2]=f.b,b!==undefined&&b!==null){var e;typeof b==='function'?e=b(j):e=b,c[d*4+3]=e}return},genMaterial:function(){var b=this.options,c='attribute vec4 cs;attribute float indexes;varying vec4 c;void main(){c = cs;vec3 pos = position;vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;}',d='varying vec4 c;uniform float maxOpacity;void main() {gl_FragColor = c * vec4(1., 1., 1., 1.);}',e=this.uniforms={maxOpacity:{type:'f',value:b.maxOpacity}};return new a.ShaderMaterial({uniforms:e,vertexShader:c,fragmentShader:d,vertexColors:a.VertexColors,blending:b.material.blending,depthTest:!0,alphaTest:1,transparent:!0,shading:a.SmoothShading,side:a.DoubleSide,linewidth:b.weight})},remove:function(){this.three3D.remove(this.line),this.line&&this.line.dispose&&this.line.dispose(),this.geometry&&this.geometry.dispose(),this.material&&this.material.dispose(),this.line=null,this.geometry=null,this.material=null}},module.exports=b
'use strict';var a=require('../three'),c=require('./../core/utils'),b=function(a){this.options=c.deepMerge(b.options,a)},d=0,e=0;b.options={lineN:1e3,ptN:100,maxOpacity:.2,weight:3,material:{blending:a.AdditiveBlending},style:{opacity:function(a){return a*a},hue:.5,color:function(b,c){return b=1-b,new a.Color().setHSL(c,1-b*.3,.3+Math.pow(b,8)*.6)}}};var f=0;b.prototype={addTo:function(a){this.three3D=a.three3D,this.init()},init:function(){var e=this.options,i=e.lineN,x=e.ptN,w=e.style.color.bind(e.style),v=e.style.hue,k=this.lines=[],n=this.colorGroup=[],f=this.geometry=new a.BufferGeometry,d=this.ptRealN=(x-1)*2,u=[],l,p,z,g=this.colorsF32=new Float32Array(d*i*4),m=this.indexesF32=new Float32Array(d*i*1),q=this.positionsF32=new Float32Array(d*i*3),r=[],s=[],t,b=0;for(var c=0;c<i;c++)for(var h=0;h<d;h++){s.push(1-h/d),k[c]=p=k[c]||[],n[c]=t=n[c]||[],l=new a.Vector3,u.push(l),p.push(l),z=w(v,h/d);var j=new a.Vector4(1,1,1,1);g[b*4+0]=1,g[b*4+1]=1,g[b*4+2]=1,g[b*4+3]=1,m[b]=b,b++,r.push(j),t.push(j)}f.addAttribute('cs',new a.BufferAttribute(g,4,1).setDynamic(!0)),f.addAttribute('indexes',new a.BufferAttribute(m,1)),f.addAttribute('position',new a.BufferAttribute(q,3,1).setDynamic(!0)),f.computeBoundingSphere();var y=this.material=this.genMaterial(),o=this.line=new a.LineSegments(f,y);o.frustumCulled=!1,this.three3D.add(o)},getSegment:function(a){console.log('getSegment')},setPt:function(i,c,d,e,f){var g=this.options.ptN,a=i*this.ptRealN,h=this.geometry.getAttribute('position'),b=h.array;if(c===0){b[a*3+0]=d,b[a*3+1]=e,b[a*3+2]=f;return}b[(a+2*c-1)*3+0]=d,b[(a+2*c-1)*3+1]=e,b[(a+2*c-1)*3+2]=f,c<g-1&&(b[(a+2*c)*3+0]=d,b[(a+2*c)*3+1]=e,b[(a+2*c)*3+2]=f)},getPt:function(a,b,c){},update:function(){var a=this.geometry;a.getAttribute('cs').needsUpdate=!0,a.getAttribute('position').needsUpdate=!0},updateOptions:function(a){a=this.options=c.deepMerge(this.options||b.options,a);var d=this.material;d.linewidth=a.weight},getUniforms:function(){return this.uniforms},setColor:function(a,b,c){},setColorArray:function(k,l,b){var i=this.geometry.getAttribute('cs'),c=i.array,g=this.ptRealN,h=k*this.ptRealN,d,f,e,j;for(var a=0;a<g;a++)if(j=a/g,d=h+a,f=l[a],c[d*4+0]=f.r,c[d*4+1]=f.g,c[d*4+2]=f.b,b!==undefined&&b!==null){var e;typeof b==='function'?e=b(j):e=b,c[d*4+3]=e}return},genMaterial:function(){var b=this.options,c='attribute vec4 cs;attribute float indexes;varying vec4 c;void main(){c = cs;vec3 pos = position;vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;}',d='varying vec4 c;uniform float maxOpacity;void main() {gl_FragColor = c * vec4(1., 1., 1., 1.);}',e=this.uniforms={maxOpacity:{type:'f',value:b.maxOpacity}};return new a.ShaderMaterial({uniforms:e,vertexShader:c,fragmentShader:d,vertexColors:a.VertexColors,blending:b.material.blending,depthTest:!0,alphaTest:1,transparent:!0,shading:a.SmoothShading,side:a.DoubleSide,linewidth:b.weight})},remove:function(){this.three3D.remove(this.line),this.line&&this.line.dispose&&this.line.dispose(),this.geometry&&this.geometry.dispose(),this.material&&this.material.dispose(),this.line=null,this.geometry=null,this.material=null}},module.exports=b

@@ -1,1 +0,1 @@

'use strict';function a(b,d){this.texture=b.texture,this.attributes=b.attributes,d=this.options=c.deepMerge(a.options,d)}var b=require('three'),c=require('./../core/utils');a.options={blending:b.AdditiveBlending},a.prototype={createShader:function(){var a=this.options,d='uniform sampler2D texture;attribute float i;void main(){vec3 pos = position;vec3 vNormal = normalize(normalMatrix * normal);vec3 transition = vec3(1000000. * i, 1000000. * i, 0.);vec4 mvPosition = modelViewMatrix * vec4( pos + transition, 1.0 );gl_Position = projectionMatrix * mvPosition;}',e={heightMax:{type:'f',value:a.heightMax}},c={uniforms:e,vertexShader:d,fragmentShader:this.getFragmentShader(),blending:a.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:b.SmoothShading};this.attributes&&(c.attributes=this.attributes),console.log(this.attributes),this.material=new b.ShaderMaterial(c)},getFragmentShader:function(){var b=this.options,a='void main() {gl_FragColor = vec4(0.,0.4,0.9,0.5);}';return a},updateUniforms:function(){var c=this.material,a=c.uniforms,b=this.options;a.indensity.value=b.indensity,a.heightMax.value=b.heightMax},getMaterial:function(){return this.material},createAttributes:function(c){if(!c)return console.log('必须传入attrs');var f=this.options,i=f.N,h=f.type,g={box:8,rect:4}[h]||1,b={};for(var a in c)b[a]={type:c.type,value:[]};for(var a in c){var j=c[a].value,k=b[a].value;for(var e=0;e<i;e++)for(var d=0;d<g;d++)k.push(j(e,d))}return this.attributes=b,b}},module.exports=a
'use strict';function a(b,d){this.texture=b.texture,this.attributes=b.attributes,d=this.options=c.deepMerge(a.options,d)}var b=require('../three'),c=require('./../core/utils');a.options={blending:b.AdditiveBlending},a.prototype={createShader:function(){var a=this.options,d='uniform sampler2D texture;attribute float i;void main(){vec3 pos = position;vec3 vNormal = normalize(normalMatrix * normal);vec3 transition = vec3(1000000. * i, 1000000. * i, 0.);vec4 mvPosition = modelViewMatrix * vec4( pos + transition, 1.0 );gl_Position = projectionMatrix * mvPosition;}',e={heightMax:{type:'f',value:a.heightMax}},c={uniforms:e,vertexShader:d,fragmentShader:this.getFragmentShader(),blending:a.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:b.SmoothShading};this.attributes&&(c.attributes=this.attributes),console.log(this.attributes),this.material=new b.ShaderMaterial(c)},getFragmentShader:function(){var b=this.options,a='void main() {gl_FragColor = vec4(0.,0.4,0.9,0.5);}';return a},updateUniforms:function(){var c=this.material,a=c.uniforms,b=this.options;a.indensity.value=b.indensity,a.heightMax.value=b.heightMax},getMaterial:function(){return this.material},createAttributes:function(c){if(!c)return console.log('必须传入attrs');var f=this.options,i=f.N,h=f.type,g={box:8,rect:4}[h]||1,b={};for(var a in c)b[a]={type:c.type,value:[]};for(var a in c){var j=c[a].value,k=b[a].value;for(var e=0;e<i;e++)for(var d=0;d<g;d++)k.push(j(e,d))}return this.attributes=b,b}},module.exports=a

@@ -1,1 +0,1 @@

'use strict';function b(d){d=this.options=c.deepMerge(b.options,d);var e='attribute float sizes;attribute vec4 colors;attribute float scales;varying vec4 cs;void main(){cs = colors;vec3 pos = position;vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;gl_PointSize = abs(sizes * scales);}',f='varying vec4 cs;uniform float time;uniform sampler2D texture;void main() {vec2 uv = vec2(gl_PointCoord.x,gl_PointCoord.y);vec4 texture2d = texture2D(texture, uv);gl_FragColor = cs * texture2d * 1.0;}',g=this.uniforms={texture:{type:'t',value:this.genTexture()}};this.material=new a.ShaderMaterial({uniforms:g,vertexShader:e,fragmentShader:f,blending:d.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:a.SmoothShading})}var a=require('three'),c=require('./../core/utils');b.options={scatterN:1e3,maxOpacity:1,sprite:null,blending:a.AdditiveBlending},b.prototype={getMaterial:function(){return this.material},genTexture:function(c){var b=new a.Texture(this.options.sprite);return b.needsUpdate=!0,b},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.uniforms.texture.value.image=a.sprite,this.uniforms.texture.value.needsUpdate=!0,this.uniforms.texture.needsUpdate=!0}},module.exports=b
'use strict';function b(d){d=this.options=c.deepMerge(b.options,d);var e='attribute float sizes;attribute vec4 colors;attribute float scales;varying vec4 cs;void main(){cs = colors;vec3 pos = position;vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );gl_Position = projectionMatrix * mvPosition;gl_PointSize = abs(sizes * scales);}',f='varying vec4 cs;uniform float time;uniform sampler2D texture;void main() {vec2 uv = vec2(gl_PointCoord.x,gl_PointCoord.y);vec4 texture2d = texture2D(texture, uv);gl_FragColor = cs * texture2d * 1.0;}',g=this.uniforms={texture:{type:'t',value:this.genTexture()}};this.material=new a.ShaderMaterial({uniforms:g,vertexShader:e,fragmentShader:f,blending:d.blending,depthTest:!0,depthWrite:!1,alphaTest:1,transparent:!0,shading:a.SmoothShading})}var a=require('../three'),c=require('./../core/utils');b.options={scatterN:1e3,maxOpacity:1,sprite:null,blending:a.AdditiveBlending},b.prototype={getMaterial:function(){return this.material},genTexture:function(c){var b=new a.Texture(this.options.sprite);return b.needsUpdate=!0,b},updateOptions:function(a){a=this.options=c.deepMerge(this.options,a),this.uniforms.texture.value.image=a.sprite,this.uniforms.texture.value.needsUpdate=!0,this.uniforms.texture.needsUpdate=!0}},module.exports=b

@@ -1,1 +0,1 @@

'use strict';var b=require('three'),c=require('./../core/utils'),d=require('bcore/event'),e=c.requestAnimationFrame,f=c.cancelAnimationFrame;b.ImageUtils.crossOrigin='',b.Loader.crossOrigin='';var a=function(b,d){this.options=c.deepMerge(a.options,d),this.container=c.getContainer(b),this.width=b.offsetWidth,this.height=b.offsetHeight,this.initScene(),this.initCamera(),this.initRender(),this.initEvents(),this.loop()};a.options={clearAlpha:0,alpha:1,clearColor:0,background:'transparent',pointerEvents:'auto',camera:{angle:60,far:119378137,near:1}},a=d.extend(a,{}),a.prototype.initScene=function(){this.scene=new b.Scene},a.prototype.initCamera=function(){var d=this.width,e=this.height,c=this.options.camera,a=this.camera=new b.PerspectiveCamera(c.angle,d/e,c.far,c.near);a.up.x=0,a.up.y=1,a.up.z=0,a.lookAt(new b.Vector3(0,0,0)),this.scene.add(a)},a.prototype.initCanvas=function(){let a=this.options;this.canvas=document.createElement('canvas'),this.canvas.style.position='absolute',this.canvas.style.top=0,this.canvas.style.left=0,this.canvas.style.height='100%',this.canvas.style.width='100%',this.canvas.style.opacity=a.alpha,this.canvas.style.background=a.background,this.canvas.style.pointerEvents=a.pointerEvents,this.container.style.pointerEvents=a.pointerEvents,this.container.appendChild(this.canvas)},a.prototype.initRender=function(){this.initCanvas();var c=this.options,a=this.renderer=new b.WebGLRenderer({preserveDrawingBuffer:!0,antialias:!0,alpha:!0,canvas:this.canvas});a.setClearColor(c.clearColor,c.clearAlpha),a.setSize(this.width,this.height),a.autoClear=!1},a.prototype.initTarget=function(){var a=this.target=new b.WebGLRenderTarget(this.width,this.height);a.minFilter=b.LinearFilter,a.generateMipmaps=!1,this.renderer.setRenderTarget(a)},a.prototype.update=function(){var a=this.renderer;a.clear(),a.render(this.scene,this.camera)},a.prototype.loop=function(){this.update(),e(this.loop.bind(this))},a.prototype.add=function(a){this.scene.add(a)},a.prototype.remove=function(a){this.scene.remove(a)},a.prototype.children=function(){return this.scene.children},a.prototype.setClearColor=function(a){this.renderer.setClearColor(a)},a.prototype.setCameraPosition=function(a){this.camera.position.x=a.x,this.camera.position.y=a.y,this.camera.position.z=a.z},a.prototype.setCameraView=function(a){this.camera.lookAt(a)},a.prototype.getCamera=function(){return this.camera},a.prototype.setSize=function(a,b){this.renderer.setSize(a,b)},a.prototype.getContainer=function(){return this.container},a.prototype.initEvents=function(){window.addEventListener('resize',this.onWindowResize.bind(this))},a.prototype.updateOptions=function(a){a&&(this.options=c.deepMerge(this.options,a)),this.updateCSS()},a.prototype.updateCSS=function(){this.canvas.style.pointerEvents=this.container.style.pointerEvents=this.pointerEvents=this.options.pointerEvents},a.prototype.updateCamera=function(d){d&&typeof d==='object'&&(this.options=c.deepMerge(this.options,{camera:d}));var a=this.camera,b=this.options.camera;a.far=b.far,a.near=b.near,a.angle=b.angle,a.updateProjectionMatrix(),a.updateMatrixWorld()},a.prototype.onWindowResize=function(){var a=this.camera,b=this.container,c=b.offsetWidth,d=b.offsetHeight;a.aspect=c/d,a.updateProjectionMatrix(),this.renderer.setSize(c,d)},module.exports=a
'use strict';var b=require('../three'),c=require('./../core/utils'),d=require('bcore/event'),e=c.requestAnimationFrame,f=c.cancelAnimationFrame;b.ImageUtils.crossOrigin='',b.Loader.crossOrigin='';var a=function(b,d){this.options=c.deepMerge(a.options,d),this.container=c.getContainer(b),this.width=b.offsetWidth,this.height=b.offsetHeight,this.initScene(),this.initCamera(),this.initRender(),this.initEvents(),this.loop()};a.options={clearAlpha:0,alpha:1,clearColor:0,background:'transparent',pointerEvents:'auto',camera:{angle:60,far:119378137,near:1}},a=d.extend(a,{}),a.prototype.initScene=function(){this.scene=new b.Scene},a.prototype.initCamera=function(){var d=this.width,e=this.height,c=this.options.camera,a=this.camera=new b.PerspectiveCamera(c.angle,d/e,c.far,c.near);a.up.x=0,a.up.y=1,a.up.z=0,a.lookAt(new b.Vector3(0,0,0)),this.scene.add(a)},a.prototype.initCanvas=function(){let a=this.options;this.canvas=document.createElement('canvas'),this.canvas.style.position='absolute',this.canvas.style.top=0,this.canvas.style.left=0,this.canvas.style.height='100%',this.canvas.style.width='100%',this.canvas.style.opacity=a.alpha,this.canvas.style.background=a.background,this.canvas.style.pointerEvents=a.pointerEvents,this.container.style.pointerEvents=a.pointerEvents,this.container.appendChild(this.canvas)},a.prototype.initRender=function(){this.initCanvas();var c=this.options,a=this.renderer=new b.WebGLRenderer({preserveDrawingBuffer:!0,antialias:!0,alpha:!0,canvas:this.canvas});a.setClearColor(c.clearColor,c.clearAlpha),a.setSize(this.width,this.height),a.autoClear=!1},a.prototype.initTarget=function(){var a=this.target=new b.WebGLRenderTarget(this.width,this.height);a.minFilter=b.LinearFilter,a.generateMipmaps=!1,this.renderer.setRenderTarget(a)},a.prototype.update=function(){var a=this.renderer;a.clear(),a.render(this.scene,this.camera)},a.prototype.loop=function(){this.update(),e(this.loop.bind(this))},a.prototype.add=function(a){this.scene.add(a)},a.prototype.remove=function(a){this.scene.remove(a)},a.prototype.children=function(){return this.scene.children},a.prototype.setClearColor=function(a){this.renderer.setClearColor(a)},a.prototype.setCameraPosition=function(a){this.camera.position.x=a.x,this.camera.position.y=a.y,this.camera.position.z=a.z},a.prototype.setCameraView=function(a){this.camera.lookAt(a)},a.prototype.getCamera=function(){return this.camera},a.prototype.setSize=function(a,b){this.renderer.setSize(a,b)},a.prototype.getContainer=function(){return this.container},a.prototype.initEvents=function(){window.addEventListener('resize',this.onWindowResize.bind(this))},a.prototype.updateOptions=function(a){a&&(this.options=c.deepMerge(this.options,a)),this.updateCSS()},a.prototype.updateCSS=function(){this.canvas.style.pointerEvents=this.container.style.pointerEvents=this.pointerEvents=this.options.pointerEvents},a.prototype.updateCamera=function(d){d&&typeof d==='object'&&(this.options=c.deepMerge(this.options,{camera:d}));var a=this.camera,b=this.options.camera;a.far=b.far,a.near=b.near,a.angle=b.angle,a.updateProjectionMatrix(),a.updateMatrixWorld()},a.prototype.onWindowResize=function(){var a=this.camera,b=this.container,c=b.offsetWidth,d=b.offsetHeight;a.aspect=c/d,a.updateProjectionMatrix(),this.renderer.setSize(c,d)},module.exports=a

@@ -1,1 +0,1 @@

module.exports=require('three')
module.exports=require('three/build/three.js')
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc