three-globe
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -203,2 +203,4 @@ 'use strict'; | ||
globeObj.__globeObjType = 'globe'; // Add object type | ||
state.scene.add(globeObj); | ||
@@ -220,2 +222,4 @@ state.globeImageUrl && this._loadGlobeImage(state.globeImageUrl); // add atmosphere | ||
mesh.scale.set(1.1, 1.1, 1.1); | ||
mesh.__globeObjType = 'atmosphere'; // Add object type | ||
state.scene.add(mesh); | ||
@@ -222,0 +226,0 @@ } // add points group |
@@ -1,2 +0,2 @@ | ||
// Version 0.4.1 three-globe - https://github.com/vasturiano/three-globe | ||
// Version 0.4.2 three-globe - https://github.com/vasturiano/three-globe | ||
(function (global, factory) { | ||
@@ -226,2 +226,4 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('three')) : | ||
globeObj.__globeObjType = 'globe'; // Add object type | ||
state.scene.add(globeObj); | ||
@@ -243,2 +245,4 @@ state.globeImageUrl && this._loadGlobeImage(state.globeImageUrl); // add atmosphere | ||
mesh.scale.set(1.1, 1.1, 1.1); | ||
mesh.__globeObjType = 'atmosphere'; // Add object type | ||
state.scene.add(mesh); | ||
@@ -245,0 +249,0 @@ } // add points group |
@@ -1,2 +0,2 @@ | ||
// Version 0.4.1 three-globe - https://github.com/vasturiano/three-globe | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("three")):"function"==typeof define&&define.amd?define(["three"],t):(e=e||self).ThreeGlobe=t(e.THREE)}(this,function(e){"use strict";"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,t){return e(t={exports:{}},t.exports),t.exports}var o=n(function(e,t){"undefined"!=typeof self&&self,e.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){var o,r,a,i;i=function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.stateInit,n=void 0===t?function(){return{}}:t,o=e.props,s=void 0===o?{}:o,l=e.methods,u=void 0===l?{}:l,c=e.aliases,d=void 0===c?{}:c,p=e.init,f=void 0===p?function(){}:p,h=e.update,m=void 0===h?function(){}:h,v=Object.keys(s).map(function(e){return new i(e,s[e])});return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},n instanceof Function?n(e):n,{initialised:!1});function o(t){return i(t,e),s(),o}var i=function(e,n){f.call(o,e,t,n),t.initialised=!0},s=(0,r.default)(function(){t.initialised&&m.call(o,t)},1);return v.forEach(function(e){o[e.name]=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e,t){};return function(a){var i=t[e];return arguments.length?(t[e]=a,r.call(o,a,t,i),n&&s(),o):i}}(e.name,e.triggerUpdate,e.onChange)}),Object.keys(u).forEach(function(e){o[e]=function(){for(var n,r=arguments.length,a=Array(r),i=0;i<r;i++)a[i]=arguments[i];return(n=u[e]).call.apply(n,[o,t].concat(a))}}),Object.entries(d).forEach(function(e){var t=a(e,2),n=t[0],r=t[1];return o[n]=o[r]}),o.resetProps=function(){return v.forEach(function(e){o[e.name](e.defaultVal)}),o},o.resetProps(),t._rerender=s,o}};var o,r=(o=n)&&o.__esModule?o:{default:o},a=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],o=!0,r=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(o=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);o=!0);}catch(e){r=!0,a=e}finally{try{!o&&s.return&&s.return()}finally{if(r)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=function e(t,n){var o=n.default,r=void 0===o?null:o,a=n.triggerUpdate,i=void 0===a||a,s=n.onChange,l=void 0===s?function(e,t){}:s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=t,this.defaultVal=r,this.triggerUpdate=i,this.onChange=l};e.exports=t.default},r=[e,t,n(1)],void 0===(a="function"==typeof(o=i)?o.apply(t,r):o)||(e.exports=a)},function(e,t){e.exports=function(e,t,n){var o,r,a,i,s;function l(){var u=Date.now()-i;u<t&&u>=0?o=setTimeout(l,t-u):(o=null,n||(s=e.apply(a,r),a=r=null))}null==t&&(t=100);var u=function(){a=this,r=arguments,i=Date.now();var u=n&&!o;return o||(o=setTimeout(l,t)),u&&(s=e.apply(a,r),a=r=null),s};return u.clear=function(){o&&(clearTimeout(o),o=null)},u.flush=function(){o&&(s=e.apply(a,r),a=r=null,clearTimeout(o),o=null)},u}}])}),r=t(o),a=(o.Kapsule,n(function(e,t){e.exports=function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){var o,r,a;r=[e,t],void 0!==(a="function"==typeof(o=function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e instanceof Function?e:"string"==typeof e?function(t){return t[e]}:function(t){return e}},e.exports=t.default})?o.apply(t,r):o)&&(e.exports=a)}])})),i=t(a);a.accessorFn;const s=window.THREE?window.THREE:{AdditiveBlending:e.AdditiveBlending,BackSide:e.BackSide,Color:e.Color,CylinderGeometry:e.CylinderGeometry,FaceColors:e.FaceColors,Geometry:e.Geometry,Group:e.Group,Matrix4:e.Matrix4,Mesh:e.Mesh,MeshBasicMaterial:e.MeshBasicMaterial,ShaderMaterial:e.ShaderMaterial,SphereGeometry:e.SphereGeometry,TextureLoader:e.TextureLoader,UniformsUtils:e.UniformsUtils},l=e=>{const t=e=>{e instanceof Array?e.forEach(t):(e.map&&e.map.dispose(),e.dispose())},n=e=>{e.geometry&&e.geometry.dispose(),e.material&&t(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(n)};for(;e.children.length;){const e=state.pointsG.children[0];state.pointsG.remove(e),n(e)}},u={earth:{uniforms:{texture:{type:"t",value:null}},vertexShader:["varying vec3 vNormal;","varying vec2 vUv;","void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","vNormal = normalize( normalMatrix * normal );","vUv = uv;","}"].join("\n"),fragmentShader:["uniform sampler2D texture;","varying vec3 vNormal;","varying vec2 vUv;","void main() {","vec3 diffuse = texture2D( texture, vUv ).xyz;","float intensity = 1.05 - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) );","vec3 atmosphere = vec3( 1.0, 1.0, 1.0 ) * pow( intensity, 3.0 );","gl_FragColor = vec4( diffuse + atmosphere, 1.0 );","}"].join("\n")},atmosphere:{uniforms:{},vertexShader:["varying vec3 vNormal;","void main() {","vNormal = normalize( normalMatrix * normal );","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec3 vNormal;","void main() {","float intensity = pow( 0.8 - dot( vNormal, vec3( 0, 0, 1.0 ) ), 12.0 );","gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 ) * intensity;","}"].join("\n")}};return function(e,t=Object,n=!1){class o extends t{constructor(...t){super(...t),this.__kapsuleInstance=e()(...n?[this]:[],...t)}}return Object.keys(e()).forEach(e=>o.prototype[e]=function(...t){const n=this.__kapsuleInstance[e](...t);return n===this.__kapsuleInstance?this:n}),o}(r({props:{globeImageUrl:{onChange(e){this._loadGlobeImage(e)},triggerUpdate:!1},pointsData:{default:[],onChange(e,t){t.pointsNeedsRepopulating=!0}},pointLat:{default:"lat",onChange(e,t){t.pointsNeedsRepopulating=!0}},pointLng:{default:"lng",onChange(e,t){t.pointsNeedsRepopulating=!0}},pointColor:{default:()=>"#ffffaa",onChange(e,t){t.pointsNeedsRepopulating=!0}},pointHeight:{default:.1,onChange(e,t){t.pointsNeedsRepopulating=!0}},pointRadius:{default:.25,onChange(e,t){t.pointsNeedsRepopulating=!0}},customLayerData:{default:[],onChange(e,t){t.customLayerNeedsRepopulating=!0}},customThreeObject:{default:[],onChange(e,t){t.customLayerNeedsRepopulating=!0}}},methods:{getCoords(e,t,n,o=1){const r=(90-t)*Math.PI/180,a=(180-n)*Math.PI/180,i=100*o;return{x:i*Math.sin(r)*Math.cos(a),y:i*Math.cos(r),z:i*Math.sin(r)*Math.sin(a)}},_loadGlobeImage:function(e,t){if(e.globeObj&&t){const n=u.earth,o=s.UniformsUtils.clone(n.uniforms);o.texture.value=(new s.TextureLoader).load(t),e.globeObj.material=new s.ShaderMaterial({uniforms:o,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader})}return this}},stateInit:()=>({pointsNeedsRepopulating:!0}),init(e,t){t.scene=e,l(t.scene);const n=new s.SphereGeometry(100,40,30),o=t.globeObj=new s.Mesh(n,new s.MeshBasicMaterial({color:0}));o.rotation.y=Math.PI/4,t.scene.add(o),t.globeImageUrl&&this._loadGlobeImage(t.globeImageUrl);{const e=u.atmosphere,o=s.UniformsUtils.clone(e.uniforms),r=new s.ShaderMaterial({uniforms:o,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,side:s.BackSide,blending:s.AdditiveBlending,transparent:!0}),a=new s.Mesh(n,r);a.scale.set(1.1,1.1,1.1),t.scene.add(a)}t.scene.add(t.pointsG=new s.Group),t.scene.add(t.customLayerG=new s.Group)},update(e){const t=2*Math.PI*100/360;if(e.pointsNeedsRepopulating){e.pointsNeedRepopulating=!1,l(e.pointsG);const n=i(e.pointLat),o=i(e.pointLng),r=i(e.pointHeight),a=i(e.pointRadius),u=i(e.pointColor),c=new s.CylinderGeometry(1,1,1,12);c.applyMatrix((new s.Matrix4).makeRotationX(Math.PI/2)),c.applyMatrix((new s.Matrix4).makeTranslation(0,0,-.5));const d={};e.pointsData.forEach(i=>{const l=u(i);d.hasOwnProperty(l)||(d[l]=new s.MeshBasicMaterial({color:new s.Color(l)}));const p=new s.Mesh(c,d[l]);Object.assign(p.position,this.getCoords(n(i),o(i))),p.lookAt(e.globeObj.position),p.scale.x=p.scale.y=Math.min(30,a(i))*t,p.scale.z=Math.max(100*r(i),.1),p.__globeObjType="point",p.__data=i,e.pointsG.add(i.__threeObj=p)})}if(e.customLayerNeedsRepopulating){e.pointsNeedRepopulating=!1,l(e.customLayerG);const t=i(e.customThreeObject);e.customLayerData.forEach(n=>{let o=t(n,100);o&&e.customThreeObject===o&&(o=o.clone()),o.__globeObjType="custom",o.__data=n,e.customLayerG.add(n.__threeObj=o)})}}}),e.Group,!0)}); | ||
// Version 0.4.2 three-globe - https://github.com/vasturiano/three-globe | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("three")):"function"==typeof define&&define.amd?define(["three"],t):(e=e||self).ThreeGlobe=t(e.THREE)}(this,function(e){"use strict";"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,t){return e(t={exports:{}},t.exports),t.exports}var o=n(function(e,t){"undefined"!=typeof self&&self,e.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){var o,r,a,i;i=function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.stateInit,n=void 0===t?function(){return{}}:t,o=e.props,s=void 0===o?{}:o,l=e.methods,u=void 0===l?{}:l,c=e.aliases,p=void 0===c?{}:c,d=e.init,f=void 0===d?function(){}:d,h=e.update,m=void 0===h?function(){}:h,g=Object.keys(s).map(function(e){return new i(e,s[e])});return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},n instanceof Function?n(e):n,{initialised:!1});function o(t){return i(t,e),s(),o}var i=function(e,n){f.call(o,e,t,n),t.initialised=!0},s=(0,r.default)(function(){t.initialised&&m.call(o,t)},1);return g.forEach(function(e){o[e.name]=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e,t){};return function(a){var i=t[e];return arguments.length?(t[e]=a,r.call(o,a,t,i),n&&s(),o):i}}(e.name,e.triggerUpdate,e.onChange)}),Object.keys(u).forEach(function(e){o[e]=function(){for(var n,r=arguments.length,a=Array(r),i=0;i<r;i++)a[i]=arguments[i];return(n=u[e]).call.apply(n,[o,t].concat(a))}}),Object.entries(p).forEach(function(e){var t=a(e,2),n=t[0],r=t[1];return o[n]=o[r]}),o.resetProps=function(){return g.forEach(function(e){o[e.name](e.defaultVal)}),o},o.resetProps(),t._rerender=s,o}};var o,r=(o=n)&&o.__esModule?o:{default:o},a=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],o=!0,r=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(o=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);o=!0);}catch(e){r=!0,a=e}finally{try{!o&&s.return&&s.return()}finally{if(r)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=function e(t,n){var o=n.default,r=void 0===o?null:o,a=n.triggerUpdate,i=void 0===a||a,s=n.onChange,l=void 0===s?function(e,t){}:s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=t,this.defaultVal=r,this.triggerUpdate=i,this.onChange=l};e.exports=t.default},r=[e,t,n(1)],void 0===(a="function"==typeof(o=i)?o.apply(t,r):o)||(e.exports=a)},function(e,t){e.exports=function(e,t,n){var o,r,a,i,s;function l(){var u=Date.now()-i;u<t&&u>=0?o=setTimeout(l,t-u):(o=null,n||(s=e.apply(a,r),a=r=null))}null==t&&(t=100);var u=function(){a=this,r=arguments,i=Date.now();var u=n&&!o;return o||(o=setTimeout(l,t)),u&&(s=e.apply(a,r),a=r=null),s};return u.clear=function(){o&&(clearTimeout(o),o=null)},u.flush=function(){o&&(s=e.apply(a,r),a=r=null,clearTimeout(o),o=null)},u}}])}),r=t(o),a=(o.Kapsule,n(function(e,t){e.exports=function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){var o,r,a;r=[e,t],void 0!==(a="function"==typeof(o=function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e instanceof Function?e:"string"==typeof e?function(t){return t[e]}:function(t){return e}},e.exports=t.default})?o.apply(t,r):o)&&(e.exports=a)}])})),i=t(a);a.accessorFn;const s=window.THREE?window.THREE:{AdditiveBlending:e.AdditiveBlending,BackSide:e.BackSide,Color:e.Color,CylinderGeometry:e.CylinderGeometry,FaceColors:e.FaceColors,Geometry:e.Geometry,Group:e.Group,Matrix4:e.Matrix4,Mesh:e.Mesh,MeshBasicMaterial:e.MeshBasicMaterial,ShaderMaterial:e.ShaderMaterial,SphereGeometry:e.SphereGeometry,TextureLoader:e.TextureLoader,UniformsUtils:e.UniformsUtils},l=e=>{const t=e=>{e instanceof Array?e.forEach(t):(e.map&&e.map.dispose(),e.dispose())},n=e=>{e.geometry&&e.geometry.dispose(),e.material&&t(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(n)};for(;e.children.length;){const e=state.pointsG.children[0];state.pointsG.remove(e),n(e)}},u={earth:{uniforms:{texture:{type:"t",value:null}},vertexShader:["varying vec3 vNormal;","varying vec2 vUv;","void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","vNormal = normalize( normalMatrix * normal );","vUv = uv;","}"].join("\n"),fragmentShader:["uniform sampler2D texture;","varying vec3 vNormal;","varying vec2 vUv;","void main() {","vec3 diffuse = texture2D( texture, vUv ).xyz;","float intensity = 1.05 - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) );","vec3 atmosphere = vec3( 1.0, 1.0, 1.0 ) * pow( intensity, 3.0 );","gl_FragColor = vec4( diffuse + atmosphere, 1.0 );","}"].join("\n")},atmosphere:{uniforms:{},vertexShader:["varying vec3 vNormal;","void main() {","vNormal = normalize( normalMatrix * normal );","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec3 vNormal;","void main() {","float intensity = pow( 0.8 - dot( vNormal, vec3( 0, 0, 1.0 ) ), 12.0 );","gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 ) * intensity;","}"].join("\n")}};return function(e,t=Object,n=!1){class o extends t{constructor(...t){super(...t),this.__kapsuleInstance=e()(...n?[this]:[],...t)}}return Object.keys(e()).forEach(e=>o.prototype[e]=function(...t){const n=this.__kapsuleInstance[e](...t);return n===this.__kapsuleInstance?this:n}),o}(r({props:{globeImageUrl:{onChange(e){this._loadGlobeImage(e)},triggerUpdate:!1},pointsData:{default:[],onChange(e,t){t.pointsNeedsRepopulating=!0}},pointLat:{default:"lat",onChange(e,t){t.pointsNeedsRepopulating=!0}},pointLng:{default:"lng",onChange(e,t){t.pointsNeedsRepopulating=!0}},pointColor:{default:()=>"#ffffaa",onChange(e,t){t.pointsNeedsRepopulating=!0}},pointHeight:{default:.1,onChange(e,t){t.pointsNeedsRepopulating=!0}},pointRadius:{default:.25,onChange(e,t){t.pointsNeedsRepopulating=!0}},customLayerData:{default:[],onChange(e,t){t.customLayerNeedsRepopulating=!0}},customThreeObject:{default:[],onChange(e,t){t.customLayerNeedsRepopulating=!0}}},methods:{getCoords(e,t,n,o=1){const r=(90-t)*Math.PI/180,a=(180-n)*Math.PI/180,i=100*o;return{x:i*Math.sin(r)*Math.cos(a),y:i*Math.cos(r),z:i*Math.sin(r)*Math.sin(a)}},_loadGlobeImage:function(e,t){if(e.globeObj&&t){const n=u.earth,o=s.UniformsUtils.clone(n.uniforms);o.texture.value=(new s.TextureLoader).load(t),e.globeObj.material=new s.ShaderMaterial({uniforms:o,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader})}return this}},stateInit:()=>({pointsNeedsRepopulating:!0}),init(e,t){t.scene=e,l(t.scene);const n=new s.SphereGeometry(100,40,30),o=t.globeObj=new s.Mesh(n,new s.MeshBasicMaterial({color:0}));o.rotation.y=Math.PI/4,o.__globeObjType="globe",t.scene.add(o),t.globeImageUrl&&this._loadGlobeImage(t.globeImageUrl);{const e=u.atmosphere,o=s.UniformsUtils.clone(e.uniforms),r=new s.ShaderMaterial({uniforms:o,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,side:s.BackSide,blending:s.AdditiveBlending,transparent:!0}),a=new s.Mesh(n,r);a.scale.set(1.1,1.1,1.1),a.__globeObjType="atmosphere",t.scene.add(a)}t.scene.add(t.pointsG=new s.Group),t.scene.add(t.customLayerG=new s.Group)},update(e){const t=2*Math.PI*100/360;if(e.pointsNeedsRepopulating){e.pointsNeedRepopulating=!1,l(e.pointsG);const n=i(e.pointLat),o=i(e.pointLng),r=i(e.pointHeight),a=i(e.pointRadius),u=i(e.pointColor),c=new s.CylinderGeometry(1,1,1,12);c.applyMatrix((new s.Matrix4).makeRotationX(Math.PI/2)),c.applyMatrix((new s.Matrix4).makeTranslation(0,0,-.5));const p={};e.pointsData.forEach(i=>{const l=u(i);p.hasOwnProperty(l)||(p[l]=new s.MeshBasicMaterial({color:new s.Color(l)}));const d=new s.Mesh(c,p[l]);Object.assign(d.position,this.getCoords(n(i),o(i))),d.lookAt(e.globeObj.position),d.scale.x=d.scale.y=Math.min(30,a(i))*t,d.scale.z=Math.max(100*r(i),.1),d.__globeObjType="point",d.__data=i,e.pointsG.add(i.__threeObj=d)})}if(e.customLayerNeedsRepopulating){e.pointsNeedRepopulating=!1,l(e.customLayerG);const t=i(e.customThreeObject);e.customLayerData.forEach(n=>{let o=t(n,100);o&&e.customThreeObject===o&&(o=o.clone()),o.__globeObjType="custom",o.__data=n,e.customLayerG.add(n.__threeObj=o)})}}}),e.Group,!0)}); |
@@ -199,2 +199,4 @@ import { AdditiveBlending, BackSide, Color, CylinderGeometry, FaceColors, Geometry, Group, Matrix4, Mesh, MeshBasicMaterial, ShaderMaterial, SphereGeometry, TextureLoader, UniformsUtils } from 'three'; | ||
globeObj.__globeObjType = 'globe'; // Add object type | ||
state.scene.add(globeObj); | ||
@@ -216,2 +218,4 @@ state.globeImageUrl && this._loadGlobeImage(state.globeImageUrl); // add atmosphere | ||
mesh.scale.set(1.1, 1.1, 1.1); | ||
mesh.__globeObjType = 'atmosphere'; // Add object type | ||
state.scene.add(mesh); | ||
@@ -218,0 +222,0 @@ } // add points group |
{ | ||
"name": "three-globe", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Globe data visualization as a ThreeJS reusable 3D object", | ||
@@ -5,0 +5,0 @@ "unpkg": "dist/three-globe.min.js", |
@@ -168,2 +168,3 @@ import { | ||
globeObj.rotation.y = Math.PI / 4; // face Greenwich Meridian | ||
globeObj.__globeObjType = 'globe'; // Add object type | ||
state.scene.add(globeObj); | ||
@@ -187,2 +188,3 @@ state.globeImageUrl && this._loadGlobeImage(state.globeImageUrl); | ||
mesh.scale.set(1.1, 1.1, 1.1); | ||
mesh.__globeObjType = 'atmosphere'; // Add object type | ||
state.scene.add(mesh); | ||
@@ -189,0 +191,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198808
1057