gl-draw 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/objects/index.js +11 -11
- package/dist/objects/node/index.d.ts +11 -9
- package/package.json +1 -1
package/dist/objects/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(){var Ot={666:function(P){var M=function(g){"use strict";var L=Object.prototype,S=L.hasOwnProperty,C,w=typeof Symbol=="function"?Symbol:{},k=w.iterator||"@@iterator",V=w.asyncIterator||"@@asyncIterator",E=w.toStringTag||"@@toStringTag";function T(u,s,f){return Object.defineProperty(u,s,{value:f,enumerable:!0,configurable:!0,writable:!0}),u[s]}try{T({},"")}catch(u){T=function(s,f,m){return s[f]=m}}function Z(u,s,f,m){var d=s&&s.prototype instanceof O?s:O,B=Object.create(d.prototype),$=new dt(m||[]);return B._invoke=K(u,f,$),B}g.wrap=Z;function I(u,s,f){try{return{type:"normal",arg:u.call(s,f)}}catch(m){return{type:"throw",arg:m}}}var z="suspendedStart",l="suspendedYield",ot="executing",D="completed",R={};function O(){}function G(){}function W(){}var q={};T(q,k,function(){return this});var tt=Object.getPrototypeOf,et=tt&&tt(tt(ct([])));et&&et!==L&&S.call(et,k)&&(q=et);var Q=W.prototype=O.prototype=Object.create(q);G.prototype=W,T(Q,"constructor",W),T(W,"constructor",G),G.displayName=T(W,E,"GeneratorFunction");function rt(u){["next","throw","return"].forEach(function(s){T(u,s,function(f){return this._invoke(s,f)})})}g.isGeneratorFunction=function(u){var s=typeof u=="function"&&u.constructor;return s?s===G||(s.displayName||s.name)==="GeneratorFunction":!1},g.mark=function(u){return Object.setPrototypeOf?Object.setPrototypeOf(u,W):(u.__proto__=W,T(u,E,"GeneratorFunction")),u.prototype=Object.create(Q),u},g.awrap=function(u){return{__await:u}};function st(u,s){function f(B,$,U,J){var X=I(u[B],u,$);if(X.type==="throw")J(X.arg);else{var mt=X.arg,nt=mt.value;return nt&&typeof nt=="object"&&S.call(nt,"__await")?s.resolve(nt.__await).then(function(it){f("next",it,U,J)},function(it){f("throw",it,U,J)}):s.resolve(nt).then(function(it){mt.value=it,U(mt)},function(it){return f("throw",it,U,J)})}}var m;function d(B,$){function U(){return new s(function(J,X){f(B,$,J,X)})}return m=m?m.then(U,U):U()}this._invoke=d}rt(st.prototype),T(st.prototype,V,function(){return this}),g.AsyncIterator=st,g.async=function(u,s,f,m,d){d===void 0&&(d=Promise);var B=new st(Z(u,s,f,m),d);return g.isGeneratorFunction(s)?B:B.next().then(function($){return $.done?$.value:B.next()})};function K(u,s,f){var m=z;return function(B,$){if(m===ot)throw new Error("Generator is already running");if(m===D){if(B==="throw")throw $;return yt()}for(f.method=B,f.arg=$;;){var U=f.delegate;if(U){var J=ut(U,f);if(J){if(J===R)continue;return J}}if(f.method==="next")f.sent=f._sent=f.arg;else if(f.method==="throw"){if(m===z)throw m=D,f.arg;f.dispatchException(f.arg)}else f.method==="return"&&f.abrupt("return",f.arg);m=ot;var X=I(u,s,f);if(X.type==="normal"){if(m=f.done?D:l,X.arg===R)continue;return{value:X.arg,done:f.done}}else X.type==="throw"&&(m=D,f.method="throw",f.arg=X.arg)}}}function ut(u,s){var f=u.iterator[s.method];if(f===C){if(s.delegate=null,s.method==="throw"){if(u.iterator.return&&(s.method="return",s.arg=C,ut(u,s),s.method==="throw"))return R;s.method="throw",s.arg=new TypeError("The iterator does not provide a 'throw' method")}return R}var m=I(f,u.iterator,s.arg);if(m.type==="throw")return s.method="throw",s.arg=m.arg,s.delegate=null,R;var d=m.arg;if(!d)return s.method="throw",s.arg=new TypeError("iterator result is not an object"),s.delegate=null,R;if(d.done)s[u.resultName]=d.value,s.next=u.nextLoc,s.method!=="return"&&(s.method="next",s.arg=C);else return d;return s.delegate=null,R}rt(Q),T(Q,E,"Generator"),T(Q,k,function(){return this}),T(Q,"toString",function(){return"[object Generator]"});function pt(u){var s={tryLoc:u[0]};1 in u&&(s.catchLoc=u[1]),2 in u&&(s.finallyLoc=u[2],s.afterLoc=u[3]),this.tryEntries.push(s)}function vt(u){var s=u.completion||{};s.type="normal",delete s.arg,u.completion=s}function dt(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(pt,this),this.reset(!0)}g.keys=function(u){var s=[];for(var f in u)s.push(f);return s.reverse(),function m(){for(;s.length;){var d=s.pop();if(d in u)return m.value=d,m.done=!1,m}return m.done=!0,m}};function ct(u){if(u){var s=u[k];if(s)return s.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var f=-1,m=function d(){for(;++f<u.length;)if(S.call(u,f))return d.value=u[f],d.done=!1,d;return d.value=C,d.done=!0,d};return m.next=m}}return{next:yt}}g.values=ct;function yt(){return{value:C,done:!0}}return dt.prototype={constructor:dt,reset:function(u){if(this.prev=0,this.next=0,this.sent=this._sent=C,this.done=!1,this.delegate=null,this.method="next",this.arg=C,this.tryEntries.forEach(vt),!u)for(var s in this)s.charAt(0)==="t"&&S.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=C)},stop:function(){this.done=!0;var u=this.tryEntries[0],s=u.completion;if(s.type==="throw")throw s.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var s=this;function f(J,X){return B.type="throw",B.arg=u,s.next=J,X&&(s.method="next",s.arg=C),!!X}for(var m=this.tryEntries.length-1;m>=0;--m){var d=this.tryEntries[m],B=d.completion;if(d.tryLoc==="root")return f("end");if(d.tryLoc<=this.prev){var $=S.call(d,"catchLoc"),U=S.call(d,"finallyLoc");if($&&U){if(this.prev<d.catchLoc)return f(d.catchLoc,!0);if(this.prev<d.finallyLoc)return f(d.finallyLoc)}else if($){if(this.prev<d.catchLoc)return f(d.catchLoc,!0)}else if(U){if(this.prev<d.finallyLoc)return f(d.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(u,s){for(var f=this.tryEntries.length-1;f>=0;--f){var m=this.tryEntries[f];if(m.tryLoc<=this.prev&&S.call(m,"finallyLoc")&&this.prev<m.finallyLoc){var d=m;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=s&&s<=d.finallyLoc&&(d=null);var B=d?d.completion:{};return B.type=u,B.arg=s,d?(this.method="next",this.next=d.finallyLoc,R):this.complete(B)},complete:function(u,s){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&s&&(this.next=s),R},finish:function(u){for(var s=this.tryEntries.length-1;s>=0;--s){var f=this.tryEntries[s];if(f.finallyLoc===u)return this.complete(f.completion,f.afterLoc),vt(f),R}},catch:function(u){for(var s=this.tryEntries.length-1;s>=0;--s){var f=this.tryEntries[s];if(f.tryLoc===u){var m=f.completion;if(m.type==="throw"){var d=m.arg;vt(f)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(u,s,f){return this.delegate={iterator:ct(u),resultName:s,nextLoc:f},this.method==="next"&&(this.arg=C),R}},g}(P.exports);try{regeneratorRuntime=M}catch(g){typeof globalThis=="object"?globalThis.regeneratorRuntime=M:Function("r","regeneratorRuntime = r")(M)}},695:function(P,M,g){"use strict";g.d(M,{Z:function(){return L}});function L(S){if(S.geometry&&S.geometry.dispose(),S.material){var C=Array.isArray(S.material)?S.material:[S.material];C.forEach(function(w){var k,V,E,T,Z,I,z,l,ot,D,R,O,G;(k=w.map)===null||k===void 0||k.dispose(),(V=w.lightMap)===null||V===void 0||V.dispose(),(E=w.bumpMap)===null||E===void 0||E.dispose(),(T=w.normalMap)===null||T===void 0||T.dispose(),(Z=w.specularMap)===null||Z===void 0||Z.dispose(),(I=w.envMap)===null||I===void 0||I.dispose(),(z=w.alphaMap)===null||z===void 0||z.dispose(),(l=w.aoMap)===null||l===void 0||l.dispose(),(ot=w.displacementMap)===null||ot===void 0||ot.dispose(),(D=w.emissiveMap)===null||D===void 0||D.dispose(),(R=w.gradientMap)===null||R===void 0||R.dispose(),(O=w.metalnessMap)===null||O===void 0||O.dispose(),(G=w.roughnessMap)===null||G===void 0||G.dispose(),w.dispose()})}}},519:function(P,M,g){"use strict";g.d(M,{disposeMesh:function(){return w.Z}});var L=g(666),S=g.n(L),C=null,w=g(695),k=g(644);function V(D){if(D.material){var R=Array.isArray(D.material)?D.material:[D.material];R.forEach(function(O){var G,W;(G=O.color)===null||G===void 0||G.convertSRGBToLinear(),(W=O.emissive)===null||W===void 0||W.convertSRGBToLinear(),O.map&&(O.map.encoding=THREE.sRGBEncoding),O.emissiveMap&&(O.emissiveMap.encoding=THREE.sRGBEncoding)})}}var E=g(568),T=g(924),Z=require("idb-keyval"),I=g(484),z=null,l=null,ot=function(){var D=(0,E.Z)(S().mark(function R(O,G){var W,q,tt,et,Q,rt;return S().wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return W=G.version,K.next=4,(0,Z.get)(O);case 4:if(tt=K.sent,!(tt&&tt[W])){K.next=9;break}q=tt[W],K.next=15;break;case 9:return K.next=11,(0,I.Z)(fetch(O).then(function(ut){if(ut.ok)return ut.blob();throw new Error}));case 11:et=K.sent,Q=et.res,rt=et.err,rt||(q=Q,(0,Z.set)(O,(0,T.Z)({},W,Q)));case 15:return K.abrupt("return",q?{url:URL.createObjectURL(q)}:{url:O});case 16:case"end":return K.stop()}},R)}));return function(O,G){return D.apply(this,arguments)}}()},484:function(P,M,g){"use strict";g.d(M,{Z:function(){return S}});var L=g(42);function S(C){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return C.then(function(k){return(0,L.Z)({err:null,res:k},w)}).catch(function(k){return(0,L.Z)({err:k,res:void 0},w)})}},644:function(P){"use strict";P.exports=require("three")},568:function(P,M,g){"use strict";g.d(M,{Z:function(){return S}});function L(C,w,k,V,E,T,Z){try{var I=C[T](Z),z=I.value}catch(l){k(l);return}I.done?w(z):Promise.resolve(z).then(V,E)}function S(C){return function(){var w=this,k=arguments;return new Promise(function(V,E){var T=C.apply(w,k);function Z(z){L(T,V,E,Z,I,"next",z)}function I(z){L(T,V,E,Z,I,"throw",z)}Z(void 0)})}}},924:function(P,M,g){"use strict";g.d(M,{Z:function(){return L}});function L(S,C,w){return C in S?Object.defineProperty(S,C,{value:w,enumerable:!0,configurable:!0,writable:!0}):S[C]=w,S}},42:function(P,M,g){"use strict";g.d(M,{Z:function(){return S}});var L=g(924);function S(C){for(var w=1;w<arguments.length;w++){var k=arguments[w]!=null?arguments[w]:{},V=Object.keys(k);typeof Object.getOwnPropertySymbols=="function"&&(V=V.concat(Object.getOwnPropertySymbols(k).filter(function(E){return Object.getOwnPropertyDescriptor(k,E).enumerable}))),V.forEach(function(E){(0,L.Z)(C,E,k[E])})}return C}}},St={};function N(P){var M=St[P];if(M!==void 0)return M.exports;var g=St[P]={exports:{}};return Ot[P](g,g.exports,N),g.exports}(function(){N.n=function(P){var M=P&&P.__esModule?function(){return P.default}:function(){return P};return N.d(M,{a:M}),M}})(),function(){N.d=function(P,M){for(var g in M)N.o(M,g)&&!N.o(P,g)&&Object.defineProperty(P,g,{enumerable:!0,get:M[g]})}}(),function(){N.o=function(P,M){return Object.prototype.hasOwnProperty.call(P,M)}}(),function(){N.r=function(P){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(P,"__esModule",{value:!0})}}();var gt={};(function(){"use strict";N.r(gt),N.d(gt,{Image:function(){return B},Line:function(){return Wt},MeshLine:function(){return at},MeshLineMaterial:function(){return wt},MeshLineRaycast:function(){return At},Node:function(){return Ct},Text:function(){return s},Video:function(){return X}});function P(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function M(e,a){return M=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},M(e,a)}function g(e,a){return M(e,a)}function L(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),a&&g(e,a)}var S=N(42);function C(e,a){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function w(e,a){return a=a!=null?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):C(Object(a)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(a,r))}),e}function k(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function V(e){return V=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},V(e)}function E(e){return V(e)}function T(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z(e){return e&&e.constructor===Symbol?"symbol":typeof e}function I(e,a){return a&&(Z(a)==="object"||typeof a=="function")?a:T(e)}function z(e){var a=k();return function(){var n=E(e),i;if(a){var t=E(this).constructor;i=Reflect.construct(n,arguments,t)}else i=n.apply(this,arguments);return I(this,i)}}var l=N(644);function ot(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function D(e,a,r){return ot()?D=Reflect.construct:D=function(i,t,o){var c=[null];c.push.apply(c,t);var h=Function.bind.apply(i,c),p=new h;return o&&g(p,o.prototype),p},D.apply(null,arguments)}function R(e,a,r){return D.apply(null,arguments)}function O(e,a){for(var r=0;r<a.length;r++){var n=a[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function G(e,a,r){return a&&O(e.prototype,a),r&&O(e,r),e}function W(e,a){(a==null||a>e.length)&&(a=e.length);for(var r=0,n=new Array(a);r<a;r++)n[r]=e[r];return n}function q(e){if(Array.isArray(e))return W(e)}function tt(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function et(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Q(e,a){if(!!e){if(typeof e=="string")return W(e,a);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(e,a)}}function rt(e){return q(e)||tt(e)||Q(e)||et()}var st=N(484);function K(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(n,i){r.resolve=n,r.reject=i}),e&&(r.promise=(0,st.Z)(r.promise,a)),r}var ut=require("@tweenjs/tween.js"),pt=N.n(ut),vt=function(){"use strict";function e(){P(this,e),this.guiParams={}}var a=e.prototype;return a.showGuiParams=function(n){var i=this;!n||Object.keys(this.guiParams).forEach(function(t){var o=n.addFolder(t),c=i.guiParams[t];Object.keys(c).forEach(function(h){var p=c[h],b=p.min,y=p.max,x=p.step,A=p.name,_=p.to,j=p.paramMap,v=p.items,H=p.value,F=p.target,xt=h.toLowerCase().indexOf("color")>-1,Y,lt=typeof H=="undefined"&&F,ft=lt?F():c[h],ht=lt?h:"value";v?Y=o.add(ft,ht,v):xt?Y=o.addColor(ft,ht):Y=o.add(ft,ht),Y=Y.name(A||h),typeof b!="undefined"&&(Y=Y.min(b)),typeof y!="undefined"&&(Y=Y.max(y)),typeof x!="undefined"&&(Y=Y.step(x)),Y=Y.onChange(function(){i.setGuiTargetValue(t,h,ft[ht],j)}),(_||lt)&&Y.listen()})})},a.setGuiTargetValue=function(n,i,t,o){var c=this.guiParams[n][i],h=c.onChange,p=c.target,b=c.value,y=i.toLowerCase().indexOf("color")>-1,x=typeof b=="undefined"&&p;if(p&&!x){var A=p();Array.isArray(A)||(A=[A]),A.forEach(function(_){if(!!_)if(y)try{_[o||i].set(t)}catch(j){i!=="color"&&!o&&console.warn("".concat(i," is not a color,set paramMap"))}else _[o||i]=t})}h&&h(t)},a.setGuiTargetValueByParams=function(){var n=this;Object.keys(this.guiParams).forEach(function(i){Object.keys(n.guiParams[i]).forEach(function(t){var o=n.guiParams[i][t];typeof o.value!="undefined"&&n.setGuiTargetValue(i,t,o.value,o.paramMap)})})},a.guiParamTween=function(n,i,t){var o=t.duration,c=o===void 0?0:o,h=this,p=this.guiParams[n][i],b=p.to,y=p.paramMap,x=y===void 0?"":y;return new(pt()).Tween(this.guiParams[n][i]).to({value:b},c).onUpdate(function(A){h.setGuiTargetValue(n,i,A.value,x)})},e}(),dt=require("three/examples/jsm/renderers/CSS2DRenderer"),ct=require("three/examples/jsm/renderers/CSS3DRenderer"),yt=N(519),u=function(e){"use strict";L(r,e);var a=z(r);function r(i){P(this,r);var t;return t=a.call(this),t.objecttype__="BaseObject",t.isAdd=!1,t.userData={},t.pm=K(),t.visible=!1,t}var n=r.prototype;return n.init=function(){},n.create=function(){},n.render=function(){},n.update=function(t,o){},n.resize=function(t,o){},n.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},n.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},n.isVisible=function(){return this.visible},n.createMesh=function(){for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];return this.object3d=R(l.Mesh,rt(o)),this},n.createGroup=function(){return this.object3d=new l.Group,this},n.createPoints=function(){for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];return this.object3d=R(l.Points,rt(o)),this},n.createCSS2DObject=function(t){return this.object3d=new dt.CSS2DObject(t),this},n.createCSS3DObject=function(t){return this.object3d=new ct.CSS3DObject(t),this},n.createCSS3DSprite=function(t){return this.object3d=new ct.CSS3DSprite(t),this},n.createSprite=function(t){return this.object3d=new l.Sprite(t),this},n.add=function(){for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];var h;return(h=this.object3d).add.apply(h,rt(o)),this},n.remove=function(){for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];var h;return(h=this.object3d).remove.apply(h,rt(o)),this},n.getSize=function(){var t=new l.Box3().setFromObject(this.object3d);return{min:t.min,max:t.max,size:t.getSize(new l.Vector3)}},n.traverse=function(t){t(this),this.children.forEach(function(o){o.traverse(t)})},n.dispose=function(){var t;(t=this.object3d)===null||t===void 0||t.traverse(function(o){(0,yt.disposeMesh)(o)})},G(r,[{key:"parent",get:function(){var t=this.object3d.parent;return(t==null?void 0:t.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(t){return t.userData.BaseObject_}).filter(function(t){return!!t})}}]),r}(vt),s=function(e){"use strict";L(r,e);var a=z(r);function r(i){P(this,r);var t;return t=a.call(this),t.width=0,t.options=(0,S.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},i),t}var n=r.prototype;return n.init=function(){var t=document.createElement("canvas");this.canvas=t},n.create=function(){var t=this.options,o=t.position,c=t.lookAt,h=t.sprite,p=t.text,b=t.sizeAttenuation;if(h){var y=new l.Sprite(new l.SpriteMaterial({transparent:!0,sizeAttenuation:b}));this.object3d=y}else{var x=new l.MeshBasicMaterial({side:l.DoubleSide,transparent:!0}),A=new l.PlaneGeometry(1,1,1,1);this.createMesh(A,x)}this.object3d.position.copy(o),c&&this.object3d.lookAt(c),this.setText(p)},n.setText=function(t,o){var c=(0,S.Z)(w((0,S.Z)({},this.options),{text:t}),o||{}),h=c.text,p=c.fontSize,b=c.fontFamily,y=c.fontWeight,x=c.flipX,A=c.scale,_=this.canvas;_.width=p*h.length*2,_.height=p;var j=_.getContext("2d");j.font="".concat(y," ").concat(p,"px/1 ").concat(b);var v=j.measureText(h).width;_.width=v,this.width=v,j=_.getContext("2d"),j.clearRect(0,0,_.width,_.height),x&&j.scale(-1,1),j.font="".concat(y," ").concat(p,"px/1 ").concat(b),j.textBaseline="middle",j.fillStyle="#ffffff",j.fillText(h,x?v*-1:0,_.height/2),j.restore();var H=new l.Texture(_);H.anisotropy=16,H.needsUpdate=!0;var F=this.object3d;F.material.map&&F.material.map.dispose(),F.material.map=H,F.material.needsUpdate=!0,F.scale.set(H.image.width*A,H.image.height*A,1)},r}(u),f=N(568),m=N(666),d=N.n(m),B=function(e){"use strict";L(r,e);var a=z(r);function r(i){P(this,r);var t;return t=a.call(this),t.options=i,t}var n=r.prototype;return n.getMaterial=function(){var t=this;return(0,f.Z)(d().mark(function o(){var c,h,p,b,y,x,A,_,j,v;return d().wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return c=t.options,h=c.transparent,p=c.blending,b=c.src,y=c.depthWrite,x=c.alphaTest,A=c.sprite,_=c.sizeAttenuation,F.next=3,new l.TextureLoader().loadAsync(b);case 3:return j=F.sent,v=A?new l.SpriteMaterial({map:j,transparent:h!=null?h:!1,blending:p!=null?p:l.NormalBlending,depthWrite:y!=null?y:!0,alphaTest:x!=null?x:0,sizeAttenuation:_!=null?_:!0}):new l.MeshBasicMaterial({map:j,transparent:h!=null?h:!1,blending:p!=null?p:l.NormalBlending,depthWrite:y!=null?y:!0,alphaTest:x!=null?x:0}),F.abrupt("return",v);case 6:case"end":return F.stop()}},o)}))()},n.create=function(){var t=this;return(0,f.Z)(d().mark(function o(){var c,h,p,b,y,x,A,_;return d().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(c=t.options,h=c.scale,p=c.position,b=c.src,y=c.cache,x=c.sprite,!(y&&!y.get(b))){v.next=7;break}return y.init(b),v.next=5,t.getMaterial();case 5:A=v.sent,y.set(b,A);case 7:if(!y){v.next=13;break}return v.next=10,y.get(b);case 10:v.t0=v.sent,v.next=16;break;case 13:return v.next=15,t.getMaterial();case 15:v.t0=v.sent;case 16:_=v.t0,t.texture=_.map,x?t.createSprite(_):t.createMesh(new l.PlaneBufferGeometry(1,1),_),h&&t.object3d.scale.set(_.map.image.width*h,_.map.image.height*h,1),p&&t.object3d.position.copy(p);case 21:case"end":return v.stop()}},o)}))()},r}(u);function $(e,a){for(;!Object.prototype.hasOwnProperty.call(e,a)&&(e=E(e),e!==null););return e}function U(e,a,r){return typeof Reflect!="undefined"&&Reflect.get?U=Reflect.get:U=function(i,t,o){var c=$(i,t);if(!!c){var h=Object.getOwnPropertyDescriptor(c,t);return h.get?h.get.call(o||i):h.value}},U(e,a,r)}function J(e,a,r){return U(e,a,r)}var X=function(e){"use strict";L(r,e);var a=z(r);function r(i){P(this,r);var t;return t=a.call(this),t.options=(0,S.Z)({},{autoPlay:!0,loop:!0},i),t}var n=r.prototype;return n.getMaterial=function(){var t=this.options,o=t.src,c=t.transparent,h=t.blending,p=t.depthWrite,b=t.format,y=t.autoPlay,x=t.loop,A=t.alphaTest,_=t.sprite,j=K(),v=document.createElement("video");return v.addEventListener("loadedmetadata",function(){var H=new l.VideoTexture(v);H.format=b!=null?b:l.RGBAFormat,H.needsUpdate=!0;var F=_?new l.SpriteMaterial({map:H,transparent:c!=null?c:!1,blending:h!=null?h:l.NormalBlending,depthWrite:p!=null?p:!0,alphaTest:A!=null?A:0}):new l.MeshBasicMaterial({map:H,transparent:c!=null?c:!1,blending:h!=null?h:l.NormalBlending,depthWrite:p!=null?p:!0,alphaTest:A!=null?A:0});j.resolve(F)},!1),v.src=o,v.muted=!0,v.autoplay=y,v.loop=x,v.preload="auto",j.promise},n.create=function(){var t=this;return(0,f.Z)(d().mark(function o(){var c,h,p,b,y,x,A,_;return d().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(c=t.options,h=c.scale,p=c.position,b=c.src,y=c.cache,x=c.sprite,!(y&&!y.get(b))){v.next=7;break}return y.init(b),v.next=5,t.getMaterial();case 5:A=v.sent,y.set(b,A);case 7:if(!y){v.next=13;break}return v.next=10,y.get(b);case 10:v.t0=v.sent,v.next=16;break;case 13:return v.next=15,t.getMaterial();case 15:v.t0=v.sent;case 16:_=v.t0,t.video=_.map.image,x?t.createSprite(_):t.createMesh(new l.PlaneBufferGeometry(1,1),_),h&&t.object3d.scale.set(t.video.videoWidth*h,t.video.videoWidth*h,1),p&&t.object3d.position.copy(p);case 21:case"end":return v.stop()}},o)}))()},n.render=function(){var t=this.options.autoPlay;t&&this.video.play()},n.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),J(E(r.prototype),"dispose",this).call(this)},r}(u),mt={position:new l.Vector3(0,0,0),onClick:void 0},nt=document.createElement("canvas");nt.width=256,nt.height=256;var it=nt.getContext("2d");it.fillStyle="#ff0000",it.fillRect(0,0,256,256);var bt=new l.CanvasTexture(nt),Mt=function(e){"use strict";L(r,e);var a=z(r);function r(i){P(this,r);var t;return t=a.call(this),t.options=(0,S.Z)({},mt,i),t}var n=r.prototype;return n.create=function(){var t=document.createElement("div");this.options.children&&t.appendChild(this.options.children),this.createCSS2DObject(t),this.object3d.position.copy(this.options.position)},n.createPickObject=function(t){var o=t.show,c=o===void 0?!1:o,h=t.scale,p=h===void 0?new l.Vector3(1,1,1):h,b=t.position,y=b===void 0?new l.Vector3(0,0,0):b,x=new l.Sprite(new l.SpriteMaterial({map:bt,opacity:c?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}));x.scale.set(bt.image.width*p.x,bt.image.height*p.y,1),x.position.copy(y),this.add(x),this.pickObject=x},r}(u),Ct=Mt,jt=`
|
|
2
|
-
`.concat(
|
|
3
|
-
`).concat(
|
|
1
|
+
(function(){var Me={666:function(A){var C=function(b){"use strict";var L=Object.prototype,M=L.hasOwnProperty,T,S=typeof Symbol=="function"?Symbol:{},R=S.iterator||"@@iterator",Z=S.asyncIterator||"@@asyncIterator",W=S.toStringTag||"@@toStringTag";function k(l,s,f){return Object.defineProperty(l,s,{value:f,enumerable:!0,configurable:!0,writable:!0}),l[s]}try{k({},"")}catch(l){k=function(s,f,y){return s[f]=y}}function $(l,s,f,y){var d=s&&s.prototype instanceof O?s:O,V=Object.create(d.prototype),X=new de(y||[]);return V._invoke=K(l,f,X),V}b.wrap=$;function H(l,s,f){try{return{type:"normal",arg:l.call(s,f)}}catch(y){return{type:"throw",arg:y}}}var B="suspendedStart",c="suspendedYield",ie="executing",U="completed",z={};function O(){}function D(){}function G(){}var q={};k(q,R,function(){return this});var ee=Object.getPrototypeOf,te=ee&&ee(ee(le([])));te&&te!==L&&M.call(te,R)&&(q=te);var Q=G.prototype=O.prototype=Object.create(q);D.prototype=G,k(Q,"constructor",G),k(G,"constructor",D),D.displayName=k(G,W,"GeneratorFunction");function re(l){["next","throw","return"].forEach(function(s){k(l,s,function(f){return this._invoke(s,f)})})}b.isGeneratorFunction=function(l){var s=typeof l=="function"&&l.constructor;return s?s===D||(s.displayName||s.name)==="GeneratorFunction":!1},b.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,G):(l.__proto__=G,k(l,W,"GeneratorFunction")),l.prototype=Object.create(Q),l},b.awrap=function(l){return{__await:l}};function oe(l,s){function f(V,X,N,J){var Y=H(l[V],l,X);if(Y.type==="throw")J(Y.arg);else{var me=Y.arg,ue=me.value;return ue&&typeof ue=="object"&&M.call(ue,"__await")?s.resolve(ue.__await).then(function(ae){f("next",ae,N,J)},function(ae){f("throw",ae,N,J)}):s.resolve(ue).then(function(ae){me.value=ae,N(me)},function(ae){return f("throw",ae,N,J)})}}var y;function d(V,X){function N(){return new s(function(J,Y){f(V,X,J,Y)})}return y=y?y.then(N,N):N()}this._invoke=d}re(oe.prototype),k(oe.prototype,Z,function(){return this}),b.AsyncIterator=oe,b.async=function(l,s,f,y,d){d===void 0&&(d=Promise);var V=new oe($(l,s,f,y),d);return b.isGeneratorFunction(s)?V:V.next().then(function(X){return X.done?X.value:V.next()})};function K(l,s,f){var y=B;return function(V,X){if(y===ie)throw new Error("Generator is already running");if(y===U){if(V==="throw")throw X;return ye()}for(f.method=V,f.arg=X;;){var N=f.delegate;if(N){var J=se(N,f);if(J){if(J===z)continue;return J}}if(f.method==="next")f.sent=f._sent=f.arg;else if(f.method==="throw"){if(y===B)throw y=U,f.arg;f.dispatchException(f.arg)}else f.method==="return"&&f.abrupt("return",f.arg);y=ie;var Y=H(l,s,f);if(Y.type==="normal"){if(y=f.done?U:c,Y.arg===z)continue;return{value:Y.arg,done:f.done}}else Y.type==="throw"&&(y=U,f.method="throw",f.arg=Y.arg)}}}function se(l,s){var f=l.iterator[s.method];if(f===T){if(s.delegate=null,s.method==="throw"){if(l.iterator.return&&(s.method="return",s.arg=T,se(l,s),s.method==="throw"))return z;s.method="throw",s.arg=new TypeError("The iterator does not provide a 'throw' method")}return z}var y=H(f,l.iterator,s.arg);if(y.type==="throw")return s.method="throw",s.arg=y.arg,s.delegate=null,z;var d=y.arg;if(!d)return s.method="throw",s.arg=new TypeError("iterator result is not an object"),s.delegate=null,z;if(d.done)s[l.resultName]=d.value,s.next=l.nextLoc,s.method!=="return"&&(s.method="next",s.arg=T);else return d;return s.delegate=null,z}re(Q),k(Q,W,"Generator"),k(Q,R,function(){return this}),k(Q,"toString",function(){return"[object Generator]"});function pe(l){var s={tryLoc:l[0]};1 in l&&(s.catchLoc=l[1]),2 in l&&(s.finallyLoc=l[2],s.afterLoc=l[3]),this.tryEntries.push(s)}function ve(l){var s=l.completion||{};s.type="normal",delete s.arg,l.completion=s}function de(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(pe,this),this.reset(!0)}b.keys=function(l){var s=[];for(var f in l)s.push(f);return s.reverse(),function y(){for(;s.length;){var d=s.pop();if(d in l)return y.value=d,y.done=!1,y}return y.done=!0,y}};function le(l){if(l){var s=l[R];if(s)return s.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var f=-1,y=function d(){for(;++f<l.length;)if(M.call(l,f))return d.value=l[f],d.done=!1,d;return d.value=T,d.done=!0,d};return y.next=y}}return{next:ye}}b.values=le;function ye(){return{value:T,done:!0}}return de.prototype={constructor:de,reset:function(l){if(this.prev=0,this.next=0,this.sent=this._sent=T,this.done=!1,this.delegate=null,this.method="next",this.arg=T,this.tryEntries.forEach(ve),!l)for(var s in this)s.charAt(0)==="t"&&M.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=T)},stop:function(){this.done=!0;var l=this.tryEntries[0],s=l.completion;if(s.type==="throw")throw s.arg;return this.rval},dispatchException:function(l){if(this.done)throw l;var s=this;function f(J,Y){return V.type="throw",V.arg=l,s.next=J,Y&&(s.method="next",s.arg=T),!!Y}for(var y=this.tryEntries.length-1;y>=0;--y){var d=this.tryEntries[y],V=d.completion;if(d.tryLoc==="root")return f("end");if(d.tryLoc<=this.prev){var X=M.call(d,"catchLoc"),N=M.call(d,"finallyLoc");if(X&&N){if(this.prev<d.catchLoc)return f(d.catchLoc,!0);if(this.prev<d.finallyLoc)return f(d.finallyLoc)}else if(X){if(this.prev<d.catchLoc)return f(d.catchLoc,!0)}else if(N){if(this.prev<d.finallyLoc)return f(d.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(l,s){for(var f=this.tryEntries.length-1;f>=0;--f){var y=this.tryEntries[f];if(y.tryLoc<=this.prev&&M.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var d=y;break}}d&&(l==="break"||l==="continue")&&d.tryLoc<=s&&s<=d.finallyLoc&&(d=null);var V=d?d.completion:{};return V.type=l,V.arg=s,d?(this.method="next",this.next=d.finallyLoc,z):this.complete(V)},complete:function(l,s){if(l.type==="throw")throw l.arg;return l.type==="break"||l.type==="continue"?this.next=l.arg:l.type==="return"?(this.rval=this.arg=l.arg,this.method="return",this.next="end"):l.type==="normal"&&s&&(this.next=s),z},finish:function(l){for(var s=this.tryEntries.length-1;s>=0;--s){var f=this.tryEntries[s];if(f.finallyLoc===l)return this.complete(f.completion,f.afterLoc),ve(f),z}},catch:function(l){for(var s=this.tryEntries.length-1;s>=0;--s){var f=this.tryEntries[s];if(f.tryLoc===l){var y=f.completion;if(y.type==="throw"){var d=y.arg;ve(f)}return d}}throw new Error("illegal catch attempt")},delegateYield:function(l,s,f){return this.delegate={iterator:le(l),resultName:s,nextLoc:f},this.method==="next"&&(this.arg=T),z}},b}(A.exports);try{regeneratorRuntime=C}catch(b){typeof globalThis=="object"?globalThis.regeneratorRuntime=C:Function("r","regeneratorRuntime = r")(C)}},695:function(A,C,b){"use strict";b.d(C,{Z:function(){return L}});function L(M){if(M.geometry&&M.geometry.dispose(),M.material){var T=Array.isArray(M.material)?M.material:[M.material];T.forEach(function(S){var R,Z,W,k,$,H,B,c,ie,U,z,O,D;(R=S.map)===null||R===void 0||R.dispose(),(Z=S.lightMap)===null||Z===void 0||Z.dispose(),(W=S.bumpMap)===null||W===void 0||W.dispose(),(k=S.normalMap)===null||k===void 0||k.dispose(),($=S.specularMap)===null||$===void 0||$.dispose(),(H=S.envMap)===null||H===void 0||H.dispose(),(B=S.alphaMap)===null||B===void 0||B.dispose(),(c=S.aoMap)===null||c===void 0||c.dispose(),(ie=S.displacementMap)===null||ie===void 0||ie.dispose(),(U=S.emissiveMap)===null||U===void 0||U.dispose(),(z=S.gradientMap)===null||z===void 0||z.dispose(),(O=S.metalnessMap)===null||O===void 0||O.dispose(),(D=S.roughnessMap)===null||D===void 0||D.dispose(),S.dispose()})}}},519:function(A,C,b){"use strict";b.d(C,{disposeMesh:function(){return S.Z}});var L=b(666),M=b.n(L),T=null,S=b(695),R=b(644);function Z(U){if(U.material){var z=Array.isArray(U.material)?U.material:[U.material];z.forEach(function(O){var D,G;(D=O.color)===null||D===void 0||D.convertSRGBToLinear(),(G=O.emissive)===null||G===void 0||G.convertSRGBToLinear(),O.map&&(O.map.encoding=THREE.sRGBEncoding),O.emissiveMap&&(O.emissiveMap.encoding=THREE.sRGBEncoding)})}}var W=b(568),k=b(924),$=require("idb-keyval"),H=b(484),B=null,c=null,ie=function(){var U=(0,W.Z)(M().mark(function z(O,D){var G,q,ee,te,Q,re;return M().wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return G=D.version,K.next=4,(0,$.get)(O);case 4:if(ee=K.sent,!(ee&&ee[G])){K.next=9;break}q=ee[G],K.next=15;break;case 9:return K.next=11,(0,H.Z)(fetch(O).then(function(se){if(se.ok)return se.blob();throw new Error}));case 11:te=K.sent,Q=te.res,re=te.err,re||(q=Q,(0,$.set)(O,(0,k.Z)({},G,Q)));case 15:return K.abrupt("return",q?{url:URL.createObjectURL(q)}:{url:O});case 16:case"end":return K.stop()}},z)}));return function(O,D){return U.apply(this,arguments)}}()},484:function(A,C,b){"use strict";b.d(C,{Z:function(){return M}});var L=b(42);function M(T){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return T.then(function(R){return(0,L.Z)({err:null,res:R},S)}).catch(function(R){return(0,L.Z)({err:R,res:void 0},S)})}},644:function(A){"use strict";A.exports=require("three")},568:function(A,C,b){"use strict";b.d(C,{Z:function(){return M}});function L(T,S,R,Z,W,k,$){try{var H=T[k]($),B=H.value}catch(c){R(c);return}H.done?S(B):Promise.resolve(B).then(Z,W)}function M(T){return function(){var S=this,R=arguments;return new Promise(function(Z,W){var k=T.apply(S,R);function $(B){L(k,Z,W,$,H,"next",B)}function H(B){L(k,Z,W,$,H,"throw",B)}$(void 0)})}}},924:function(A,C,b){"use strict";b.d(C,{Z:function(){return L}});function L(M,T,S){return T in M?Object.defineProperty(M,T,{value:S,enumerable:!0,configurable:!0,writable:!0}):M[T]=S,M}},42:function(A,C,b){"use strict";b.d(C,{Z:function(){return M}});var L=b(924);function M(T){for(var S=1;S<arguments.length;S++){var R=arguments[S]!=null?arguments[S]:{},Z=Object.keys(R);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(R).filter(function(W){return Object.getOwnPropertyDescriptor(R,W).enumerable}))),Z.forEach(function(W){(0,L.Z)(T,W,R[W])})}return T}}},Se={};function I(A){var C=Se[A];if(C!==void 0)return C.exports;var b=Se[A]={exports:{}};return Me[A](b,b.exports,I),b.exports}(function(){I.n=function(A){var C=A&&A.__esModule?function(){return A.default}:function(){return A};return I.d(C,{a:C}),C}})(),function(){I.d=function(A,C){for(var b in C)I.o(C,b)&&!I.o(A,b)&&Object.defineProperty(A,b,{enumerable:!0,get:C[b]})}}(),function(){I.o=function(A,C){return Object.prototype.hasOwnProperty.call(A,C)}}(),function(){I.r=function(A){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})}}();var be={};(function(){"use strict";I.r(be),I.d(be,{Image:function(){return V},Line:function(){return ke},MeshLine:function(){return ne},MeshLineMaterial:function(){return we},MeshLineRaycast:function(){return Ae},Node:function(){return ue},Text:function(){return s},Video:function(){return Y}});function A(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function C(t,a){return C=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},C(t,a)}function b(t,a){return C(t,a)}function L(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(a&&a.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),a&&b(t,a)}var M=I(42);function T(t,a){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function S(t,a){return a=a!=null?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):T(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))}),t}function R(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function Z(t){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Z(t)}function W(t){return Z(t)}function k(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function $(t){return t&&t.constructor===Symbol?"symbol":typeof t}function H(t,a){return a&&($(a)==="object"||typeof a=="function")?a:k(t)}function B(t){var a=R();return function(){var n=W(t),i;if(a){var e=W(this).constructor;i=Reflect.construct(n,arguments,e)}else i=n.apply(this,arguments);return H(this,i)}}var c=I(644);function ie(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function U(t,a,r){return ie()?U=Reflect.construct:U=function(i,e,o){var u=[null];u.push.apply(u,e);var h=Function.bind.apply(i,u),p=new h;return o&&b(p,o.prototype),p},U.apply(null,arguments)}function z(t,a,r){return U.apply(null,arguments)}function O(t,a){for(var r=0;r<a.length;r++){var n=a[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function D(t,a,r){return a&&O(t.prototype,a),r&&O(t,r),t}function G(t,a){(a==null||a>t.length)&&(a=t.length);for(var r=0,n=new Array(a);r<a;r++)n[r]=t[r];return n}function q(t){if(Array.isArray(t))return G(t)}function ee(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function te(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Q(t,a){if(!!t){if(typeof t=="string")return G(t,a);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return G(t,a)}}function re(t){return q(t)||ee(t)||Q(t)||te()}var oe=I(484);function K(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(n,i){r.resolve=n,r.reject=i}),t&&(r.promise=(0,oe.Z)(r.promise,a)),r}var se=require("@tweenjs/tween.js"),pe=I.n(se),ve=function(){"use strict";function t(){A(this,t),this.guiParams={}}var a=t.prototype;return a.showGuiParams=function(n){var i=this;!n||Object.keys(this.guiParams).forEach(function(e){var o=n.addFolder(e),u=i.guiParams[e];Object.keys(u).forEach(function(h){var p=u[h],_=p.min,m=p.max,g=p.step,P=p.name,w=p.to,x=p.paramMap,v=p.items,F=p.value,E=p.target,ge=h.toLowerCase().indexOf("color")>-1,j,ce=typeof F=="undefined"&&E,fe=ce?E():u[h],he=ce?h:"value";v?j=o.add(fe,he,v):ge?j=o.addColor(fe,he):j=o.add(fe,he),j=j.name(P||h),typeof _!="undefined"&&(j=j.min(_)),typeof m!="undefined"&&(j=j.max(m)),typeof g!="undefined"&&(j=j.step(g)),j=j.onChange(function(){i.setGuiTargetValue(e,h,fe[he],x)}),(w||ce)&&j.listen()})})},a.setGuiTargetValue=function(n,i,e,o){var u=this.guiParams[n][i],h=u.onChange,p=u.target,_=u.value,m=i.toLowerCase().indexOf("color")>-1,g=typeof _=="undefined"&&p;if(p&&!g){var P=p();Array.isArray(P)||(P=[P]),P.forEach(function(w){if(!!w)if(m)try{w[o||i].set(e)}catch(x){i!=="color"&&!o&&console.warn("".concat(i," is not a color,set paramMap"))}else w[o||i]=e})}h&&h(e)},a.setGuiTargetValueByParams=function(){var n=this;Object.keys(this.guiParams).forEach(function(i){Object.keys(n.guiParams[i]).forEach(function(e){var o=n.guiParams[i][e];typeof o.value!="undefined"&&n.setGuiTargetValue(i,e,o.value,o.paramMap)})})},a.guiParamTween=function(n,i,e){var o=e.duration,u=o===void 0?0:o,h=this,p=this.guiParams[n][i],_=p.to,m=p.paramMap,g=m===void 0?"":m;return new(pe()).Tween(this.guiParams[n][i]).to({value:_},u).onUpdate(function(P){h.setGuiTargetValue(n,i,P.value,g)})},t}(),de=require("three/examples/jsm/renderers/CSS2DRenderer"),le=require("three/examples/jsm/renderers/CSS3DRenderer"),ye=I(519),l=function(t){"use strict";L(r,t);var a=B(r);function r(i){A(this,r);var e;return e=a.call(this),e.objecttype__="BaseObject",e.isAdd=!1,e.userData={},e.pm=K(),e.visible=!1,e}var n=r.prototype;return n.init=function(){},n.create=function(){},n.render=function(){},n.update=function(e,o){},n.resize=function(e,o){},n.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},n.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},n.isVisible=function(){return this.visible},n.createMesh=function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];return this.object3d=z(c.Mesh,re(o)),this},n.createGroup=function(){return this.object3d=new c.Group,this},n.createPoints=function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];return this.object3d=z(c.Points,re(o)),this},n.createCSS2DObject=function(e){return this.object3d=new de.CSS2DObject(e),this},n.createCSS3DObject=function(e){return this.object3d=new le.CSS3DObject(e),this},n.createCSS3DSprite=function(e){return this.object3d=new le.CSS3DSprite(e),this},n.createSprite=function(e){return this.object3d=new c.Sprite(e),this},n.add=function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];var h;return(h=this.object3d).add.apply(h,re(o)),this},n.remove=function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];var h;return(h=this.object3d).remove.apply(h,re(o)),this},n.getSize=function(){var e=new c.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new c.Vector3)}},n.traverse=function(e){e(this),this.children.forEach(function(o){o.traverse(e)})},n.dispose=function(){var e;(e=this.object3d)===null||e===void 0||e.traverse(function(o){(0,ye.disposeMesh)(o)})},D(r,[{key:"parent",get:function(){var e=this.object3d.parent;return(e==null?void 0:e.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(e){return e.userData.BaseObject_}).filter(function(e){return!!e})}}]),r}(ve),s=function(t){"use strict";L(r,t);var a=B(r);function r(i){A(this,r);var e;return e=a.call(this),e.width=0,e.options=(0,M.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},i),e}var n=r.prototype;return n.init=function(){var e=document.createElement("canvas");this.canvas=e},n.create=function(){var e=this.options,o=e.position,u=e.lookAt,h=e.sprite,p=e.text,_=e.sizeAttenuation;if(h){var m=new c.Sprite(new c.SpriteMaterial({transparent:!0,sizeAttenuation:_}));this.object3d=m}else{var g=new c.MeshBasicMaterial({side:c.DoubleSide,transparent:!0}),P=new c.PlaneGeometry(1,1,1,1);this.createMesh(P,g)}this.object3d.position.copy(o),u&&this.object3d.lookAt(u),this.setText(p)},n.setText=function(e,o){var u=(0,M.Z)(S((0,M.Z)({},this.options),{text:e}),o||{}),h=u.text,p=u.fontSize,_=u.fontFamily,m=u.fontWeight,g=u.flipX,P=u.scale,w=this.canvas;w.width=p*h.length*2,w.height=p;var x=w.getContext("2d");x.font="".concat(m," ").concat(p,"px/1 ").concat(_);var v=x.measureText(h).width;w.width=v,this.width=v,x=w.getContext("2d"),x.clearRect(0,0,w.width,w.height),g&&x.scale(-1,1),x.font="".concat(m," ").concat(p,"px/1 ").concat(_),x.textBaseline="middle",x.fillStyle="#ffffff",x.fillText(h,g?v*-1:0,w.height/2),x.restore();var F=new c.Texture(w);F.anisotropy=16,F.needsUpdate=!0;var E=this.object3d;E.material.map&&E.material.map.dispose(),E.material.map=F,E.material.needsUpdate=!0,E.scale.set(F.image.width*P,F.image.height*P,1)},r}(l),f=I(568),y=I(666),d=I.n(y),V=function(t){"use strict";L(r,t);var a=B(r);function r(i){A(this,r);var e;return e=a.call(this),e.options=i,e}var n=r.prototype;return n.getMaterial=function(){var e=this;return(0,f.Z)(d().mark(function o(){var u,h,p,_,m,g,P,w,x,v;return d().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return u=e.options,h=u.transparent,p=u.blending,_=u.src,m=u.depthWrite,g=u.alphaTest,P=u.sprite,w=u.sizeAttenuation,E.next=3,new c.TextureLoader().loadAsync(_);case 3:return x=E.sent,v=P?new c.SpriteMaterial({map:x,transparent:h!=null?h:!1,blending:p!=null?p:c.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:g!=null?g:0,sizeAttenuation:w!=null?w:!0}):new c.MeshBasicMaterial({map:x,transparent:h!=null?h:!1,blending:p!=null?p:c.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:g!=null?g:0}),E.abrupt("return",v);case 6:case"end":return E.stop()}},o)}))()},n.create=function(){var e=this;return(0,f.Z)(d().mark(function o(){var u,h,p,_,m,g,P,w;return d().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(u=e.options,h=u.scale,p=u.position,_=u.src,m=u.cache,g=u.sprite,!(m&&!m.get(_))){v.next=7;break}return m.init(_),v.next=5,e.getMaterial();case 5:P=v.sent,m.set(_,P);case 7:if(!m){v.next=13;break}return v.next=10,m.get(_);case 10:v.t0=v.sent,v.next=16;break;case 13:return v.next=15,e.getMaterial();case 15:v.t0=v.sent;case 16:w=v.t0,e.texture=w.map,g?e.createSprite(w):e.createMesh(new c.PlaneBufferGeometry(1,1),w),h&&e.object3d.scale.set(w.map.image.width*h,w.map.image.height*h,1),p&&e.object3d.position.copy(p);case 21:case"end":return v.stop()}},o)}))()},r}(l);function X(t,a){for(;!Object.prototype.hasOwnProperty.call(t,a)&&(t=W(t),t!==null););return t}function N(t,a,r){return typeof Reflect!="undefined"&&Reflect.get?N=Reflect.get:N=function(i,e,o){var u=X(i,e);if(!!u){var h=Object.getOwnPropertyDescriptor(u,e);return h.get?h.get.call(o||i):h.value}},N(t,a,r)}function J(t,a,r){return N(t,a,r)}var Y=function(t){"use strict";L(r,t);var a=B(r);function r(i){A(this,r);var e;return e=a.call(this),e.options=(0,M.Z)({},{autoPlay:!0,loop:!0},i),e}var n=r.prototype;return n.getMaterial=function(){var e=this.options,o=e.src,u=e.transparent,h=e.blending,p=e.depthWrite,_=e.format,m=e.autoPlay,g=e.loop,P=e.alphaTest,w=e.sprite,x=K(),v=document.createElement("video");return v.addEventListener("loadedmetadata",function(){var F=new c.VideoTexture(v);F.format=_!=null?_:c.RGBAFormat,F.needsUpdate=!0;var E=w?new c.SpriteMaterial({map:F,transparent:u!=null?u:!1,blending:h!=null?h:c.NormalBlending,depthWrite:p!=null?p:!0,alphaTest:P!=null?P:0}):new c.MeshBasicMaterial({map:F,transparent:u!=null?u:!1,blending:h!=null?h:c.NormalBlending,depthWrite:p!=null?p:!0,alphaTest:P!=null?P:0});x.resolve(E)},!1),v.src=o,v.muted=!0,v.autoplay=m,v.loop=g,v.preload="auto",x.promise},n.create=function(){var e=this;return(0,f.Z)(d().mark(function o(){var u,h,p,_,m,g,P,w;return d().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(u=e.options,h=u.scale,p=u.position,_=u.src,m=u.cache,g=u.sprite,!(m&&!m.get(_))){v.next=7;break}return m.init(_),v.next=5,e.getMaterial();case 5:P=v.sent,m.set(_,P);case 7:if(!m){v.next=13;break}return v.next=10,m.get(_);case 10:v.t0=v.sent,v.next=16;break;case 13:return v.next=15,e.getMaterial();case 15:v.t0=v.sent;case 16:w=v.t0,e.video=w.map.image,g?e.createSprite(w):e.createMesh(new c.PlaneBufferGeometry(1,1),w),h&&e.object3d.scale.set(e.video.videoWidth*h,e.video.videoHeight*h,1),p&&e.object3d.position.copy(p);case 21:case"end":return v.stop()}},o)}))()},n.render=function(){var e=this.options.autoPlay;e&&this.video.play()},n.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),J(W(r.prototype),"dispose",this).call(this)},r}(l),me=function(t){"use strict";L(r,t);var a=B(r);function r(i){A(this,r);var e;return e=a.call(this),e.options=(0,M.Z)({},i),e}var n=r.prototype;return n.create=function(){var e=this.options,o=e.position,u=e.children,h=document.createElement("div");h.appendChild(u),this.createCSS2DObject(h),o&&this.object3d.position.copy(o)},n.getMaterial=function(e){return(0,f.Z)(d().mark(function o(){var u,h,p,_;return d().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return u=document.createElement("canvas"),u.width=256,u.height=256,h=u.getContext("2d"),h.fillStyle="#ff0000",h.fillRect(0,0,256,256),p=new c.CanvasTexture(u),_=new c.SpriteMaterial({map:p,opacity:e?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),g.abrupt("return",_);case 9:case"end":return g.stop()}},o)}))()},n.createPickObject=function(e){var o=e.show,u=o===void 0?!1:o,h=e.scale,p=h===void 0?new c.Vector3(1,1,1):h,_=e.position,m=_===void 0?new c.Vector3(0,0,0):_,g=e.cache,P=this;return(0,f.Z)(d().mark(function w(){var x,v,F,E;return d().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:if(x="node-create-pick-object",!(g&&!g.get(x))){j.next=7;break}return g.init(x),j.next=5,P.getMaterial(u);case 5:v=j.sent,g.set(x,v);case 7:if(!g){j.next=13;break}return j.next=10,g.get(x);case 10:j.t0=j.sent,j.next=16;break;case 13:return j.next=15,P.getMaterial(u);case 15:j.t0=j.sent;case 16:F=j.t0,E=new c.Sprite(F),E.scale.set(F.map.image.width*p.x,F.map.image.height*p.y,1),E.position.copy(m),P.add(E),P.pickObject=E;case 22:case"end":return j.stop()}},w)}))()},r}(l),ue=me,ae=`
|
|
2
|
+
`.concat(c.ShaderChunk.logdepthbuf_pars_vertex,`
|
|
3
|
+
`).concat(c.ShaderChunk.fog_pars_vertex,`
|
|
4
4
|
attribute vec3 previous;
|
|
5
5
|
attribute vec3 next;
|
|
6
6
|
attribute float side;
|
|
@@ -91,13 +91,13 @@
|
|
|
91
91
|
finalPosition.xy+=offset.xy;
|
|
92
92
|
|
|
93
93
|
gl_Position=finalPosition;
|
|
94
|
-
`).concat(
|
|
94
|
+
`).concat(c.ShaderChunk.logdepthbuf_vertex,`
|
|
95
95
|
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
96
|
-
`).concat(
|
|
96
|
+
`).concat(c.ShaderChunk.fog_vertex,`
|
|
97
97
|
}
|
|
98
|
-
`),
|
|
99
|
-
`.concat(
|
|
100
|
-
`).concat(
|
|
98
|
+
`),xe=`
|
|
99
|
+
`.concat(c.ShaderChunk.fog_pars_fragment,`
|
|
100
|
+
`).concat(c.ShaderChunk.logdepthbuf_pars_fragment,`
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
uniform sampler2D map;
|
|
@@ -117,7 +117,7 @@ varying vec4 vColor;
|
|
|
117
117
|
varying float vCounters;
|
|
118
118
|
|
|
119
119
|
void main() {
|
|
120
|
-
`).concat(
|
|
120
|
+
`).concat(c.ShaderChunk.logdepthbuf_fragment,`
|
|
121
121
|
vec4 c = vColor;
|
|
122
122
|
if( useMap == 1. ) c *= texture2D( map, vUV * repeat );
|
|
123
123
|
if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;
|
|
@@ -127,6 +127,6 @@ void main() {
|
|
|
127
127
|
}
|
|
128
128
|
gl_FragColor = c;
|
|
129
129
|
gl_FragColor.a *= step(vCounters, visibility);
|
|
130
|
-
`).concat(
|
|
130
|
+
`).concat(c.ShaderChunk.fog_fragment,`
|
|
131
131
|
}
|
|
132
|
-
`),at=function(e){"use strict";L(r,e);var a=z(r);function r(){P(this,r);var n;return n=a.call(this),n.isMeshLine=!0,n.type="MeshLine",n.positions=[],n.previous=[],n.next=[],n.side=[],n.width=[],n.indices_array=[],n.uvs=[],n.counters=[],n._points=[],n._geom=null,n.widthCallback=null,n.matrixWorld=new l.Matrix4,Object.defineProperties(T(n),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),n}return r}(l.BufferGeometry);at.prototype.setMatrixWorld=function(e){this.matrixWorld=e},at.prototype.setGeometry=function(e,a){this._geometry=e,this.setPoints(e.getAttribute("position").array,a)},at.prototype.setPoints=function(e,a){if(!(e instanceof Float32Array)&&!(e instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=e,this.widthCallback=a,this.positions=[],this.counters=[],e.length&&e[0]instanceof l.Vector3)for(var r=0;r<e.length;r++){var n=e[r],i=r/e.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var r=0;r<e.length;r+=3){var i=r/e.length;this.positions.push(e[r],e[r+1],e[r+2]),this.positions.push(e[r],e[r+1],e[r+2]),this.counters.push(i),this.counters.push(i)}this.process()};function At(e,a){var r=new l.Matrix4,n=new l.Ray,i=new l.Sphere,t=new l.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),i.copy(o.boundingSphere),i.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(i,t)!==!1){r.copy(this.matrixWorld).invert(),n.copy(e.ray).applyMatrix4(r);var c=new l.Vector3,h=new l.Vector3,p=new l.Vector3,b=this instanceof l.LineSegments?2:1,y=o.index,x=o.attributes;if(y!==null)for(var A=y.array,_=x.position.array,j=x.width.array,v=0,H=A.length-1;v<H;v+=b){var F=A[v],xt=A[v+1];c.fromArray(_,F*3),h.fromArray(_,xt*3);var Y=j[Math.floor(v/3)]!==void 0?j[Math.floor(v/3)]:1,lt=e.params.Line.threshold+this.material.lineWidth*Y/2,ft=lt*lt,ht=n.distanceSqToSegment(c,h,t,p);if(!(ht>ft)){t.applyMatrix4(this.matrixWorld);var Pt=e.ray.origin.distanceTo(t);Pt<e.near||Pt>e.far||(a.push({distance:Pt,point:p.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=H)}}}}at.prototype.raycast=At,at.prototype.compareV3=function(e,a){var r=e*6,n=a*6;return this.positions[r]===this.positions[n]&&this.positions[r+1]===this.positions[n+1]&&this.positions[r+2]===this.positions[n+2]},at.prototype.copyV3=function(e){var a=e*6;return[this.positions[a],this.positions[a+1],this.positions[a+2]]},at.prototype.process=function(){var e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var a,r;this.compareV3(0,e-1)?r=this.copyV3(e-2):r=this.copyV3(0),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);for(var n=0;n<e;n++){if(this.side.push(1),this.side.push(-1),this.widthCallback?a=this.widthCallback(n/(e-1)):a=1,this.width.push(a),this.width.push(a),this.uvs.push(n/(e-1),0),this.uvs.push(n/(e-1),1),n<e-1){r=this.copyV3(n),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var i=n*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}n>0&&(r=this.copyV3(n),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(e-1,0)?r=this.copyV3(1):r=this.copyV3(e-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new l.BufferAttribute(new Float32Array(this.positions),3),previous:new l.BufferAttribute(new Float32Array(this.previous),3),next:new l.BufferAttribute(new Float32Array(this.next),3),side:new l.BufferAttribute(new Float32Array(this.side),1),width:new l.BufferAttribute(new Float32Array(this.width),1),uv:new l.BufferAttribute(new Float32Array(this.uvs),2),index:new l.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new l.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function _t(e,a,r,n,i){var t;if(e=e.subarray||e.slice?e:e.buffer,r=r.subarray||r.slice?r:r.buffer,e=a?e.subarray?e.subarray(a,i&&a+i):e.slice(a,i&&a+i):e,r.set)r.set(e,n);else for(t=0;t<e.length;t++)r[t+n]=e[t];return r}at.prototype.advance=function(e){var a=this._attributes.position.array,r=this._attributes.previous.array,n=this._attributes.next.array,i=a.length;_t(a,0,r,0,i),_t(a,6,a,0,i-6),a[i-6]=e.x,a[i-5]=e.y,a[i-4]=e.z,a[i-3]=e.x,a[i-2]=e.y,a[i-1]=e.z,_t(a,6,n,0,i-6),n[i-6]=e.x,n[i-5]=e.y,n[i-4]=e.z,n[i-3]=e.x,n[i-2]=e.y,n[i-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},l.ShaderChunk.meshline_vert=jt,l.ShaderChunk.meshline_frag=Tt;var wt=function(e){"use strict";L(r,e);var a=z(r);function r(n){P(this,r);var i;return i=a.call(this,{uniforms:Object.assign({},l.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new l.Color(16777215)},opacity:{value:1},resolution:{value:new l.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new l.Vector2(1,1)},offset:{value:new l.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new l.Vector2(0,0)},lightColor:{value:new l.Color(16777215)}}),vertexShader:l.ShaderChunk.meshline_vert,fragmentShader:l.ShaderChunk.meshline_frag}),i.isMeshLineMaterial=!0,i.type="MeshLineMaterial",Object.defineProperties(T(i),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),i.setValues(n),i}return r}(l.ShaderMaterial);wt.prototype.copy=function(e){return l.ShaderMaterial.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray.copy(e.dashArray),this.dashOffset.copy(e.dashOffset),this.dashRatio.copy(e.dashRatio),this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this};function Lt(e,a){if(e==null)return{};var r={},n=Object.keys(e),i,t;for(t=0;t<n.length;t++)i=n[t],!(a.indexOf(i)>=0)&&(r[i]=e[i]);return r}function kt(e,a){if(e==null)return{};var r=Lt(e,a),n,i;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(i=0;i<t.length;i++)n=t[i],!(a.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(r[n]=e[n]))}return r}var Et={nodes:[],color:new l.Color("red"),lineWidth:3,sizeAttenuation:0},Rt=function(e){"use strict";L(r,e);var a=z(r);function r(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};P(this,r);var t;return t=a.call(this),t.geometry=new l.BufferGeometry,t.meshline=new at,t.options=(0,S.Z)({},Et,i),t}var n=r.prototype;return n.create=function(){var t=this.options,o=t.nodes,c=t.duration,h=t.delay,p=t.onComplete,b=t.setPointWidth,y=kt(t,["nodes","duration","delay","onComplete","setPointWidth"]),x=this.pencil.getSize(),A=x.width,_=x.height;delete y.key,this.geometry.setFromPoints(o),this.meshline.setGeometry(this.geometry,b);var j=new wt(w((0,S.Z)({},y),{resolution:new l.Vector2(A,_)}));this.material=j,this.createMesh(this.meshline,j)},n.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},n.animate=function(){var t=this.options,o=t.duration,c=t.delay,h=t.onComplete,p=this.material.uniforms.offset,b=new(pt()).Tween(p.value).to({x:0},o!=null?o:1e3).delay(c!=null?c:0).repeat(1/0);h&&b.onComplete(h),b.start(),this.tween=b},n.dispose=function(){this.tween&&pt().remove(this.tween)},r}(u),Wt=Rt})(),module.exports=gt})();
|
|
132
|
+
`),ne=function(t){"use strict";L(r,t);var a=B(r);function r(){A(this,r);var n;return n=a.call(this),n.isMeshLine=!0,n.type="MeshLine",n.positions=[],n.previous=[],n.next=[],n.side=[],n.width=[],n.indices_array=[],n.uvs=[],n.counters=[],n._points=[],n._geom=null,n.widthCallback=null,n.matrixWorld=new c.Matrix4,Object.defineProperties(k(n),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}}),n}return r}(c.BufferGeometry);ne.prototype.setMatrixWorld=function(t){this.matrixWorld=t},ne.prototype.setGeometry=function(t,a){this._geometry=t,this.setPoints(t.getAttribute("position").array,a)},ne.prototype.setPoints=function(t,a){if(!(t instanceof Float32Array)&&!(t instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=t,this.widthCallback=a,this.positions=[],this.counters=[],t.length&&t[0]instanceof c.Vector3)for(var r=0;r<t.length;r++){var n=t[r],i=r/t.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var r=0;r<t.length;r+=3){var i=r/t.length;this.positions.push(t[r],t[r+1],t[r+2]),this.positions.push(t[r],t[r+1],t[r+2]),this.counters.push(i),this.counters.push(i)}this.process()};function Ae(t,a){var r=new c.Matrix4,n=new c.Ray,i=new c.Sphere,e=new c.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),i.copy(o.boundingSphere),i.applyMatrix4(this.matrixWorld),t.ray.intersectSphere(i,e)!==!1){r.copy(this.matrixWorld).invert(),n.copy(t.ray).applyMatrix4(r);var u=new c.Vector3,h=new c.Vector3,p=new c.Vector3,_=this instanceof c.LineSegments?2:1,m=o.index,g=o.attributes;if(m!==null)for(var P=m.array,w=g.position.array,x=g.width.array,v=0,F=P.length-1;v<F;v+=_){var E=P[v],ge=P[v+1];u.fromArray(w,E*3),h.fromArray(w,ge*3);var j=x[Math.floor(v/3)]!==void 0?x[Math.floor(v/3)]:1,ce=t.params.Line.threshold+this.material.lineWidth*j/2,fe=ce*ce,he=n.distanceSqToSegment(u,h,e,p);if(!(he>fe)){e.applyMatrix4(this.matrixWorld);var Pe=t.ray.origin.distanceTo(e);Pe<t.near||Pe>t.far||(a.push({distance:Pe,point:p.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=F)}}}}ne.prototype.raycast=Ae,ne.prototype.compareV3=function(t,a){var r=t*6,n=a*6;return this.positions[r]===this.positions[n]&&this.positions[r+1]===this.positions[n+1]&&this.positions[r+2]===this.positions[n+2]},ne.prototype.copyV3=function(t){var a=t*6;return[this.positions[a],this.positions[a+1],this.positions[a+2]]},ne.prototype.process=function(){var t=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var a,r;this.compareV3(0,t-1)?r=this.copyV3(t-2):r=this.copyV3(0),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);for(var n=0;n<t;n++){if(this.side.push(1),this.side.push(-1),this.widthCallback?a=this.widthCallback(n/(t-1)):a=1,this.width.push(a),this.width.push(a),this.uvs.push(n/(t-1),0),this.uvs.push(n/(t-1),1),n<t-1){r=this.copyV3(n),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var i=n*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}n>0&&(r=this.copyV3(n),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(t-1,0)?r=this.copyV3(1):r=this.copyV3(t-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function _e(t,a,r,n,i){var e;if(t=t.subarray||t.slice?t:t.buffer,r=r.subarray||r.slice?r:r.buffer,t=a?t.subarray?t.subarray(a,i&&a+i):t.slice(a,i&&a+i):t,r.set)r.set(t,n);else for(e=0;e<t.length;e++)r[e+n]=t[e];return r}ne.prototype.advance=function(t){var a=this._attributes.position.array,r=this._attributes.previous.array,n=this._attributes.next.array,i=a.length;_e(a,0,r,0,i),_e(a,6,a,0,i-6),a[i-6]=t.x,a[i-5]=t.y,a[i-4]=t.z,a[i-3]=t.x,a[i-2]=t.y,a[i-1]=t.z,_e(a,6,n,0,i-6),n[i-6]=t.x,n[i-5]=t.y,n[i-4]=t.z,n[i-3]=t.x,n[i-2]=t.y,n[i-1]=t.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},c.ShaderChunk.meshline_vert=ae,c.ShaderChunk.meshline_frag=xe;var we=function(t){"use strict";L(r,t);var a=B(r);function r(n){A(this,r);var i;return i=a.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),i.isMeshLineMaterial=!0,i.type="MeshLineMaterial",Object.defineProperties(k(i),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),i.setValues(n),i}return r}(c.ShaderMaterial);we.prototype.copy=function(t){return c.ShaderMaterial.prototype.copy.call(this,t),this.lineWidth=t.lineWidth,this.map=t.map,this.useMap=t.useMap,this.alphaMap=t.alphaMap,this.useAlphaMap=t.useAlphaMap,this.color.copy(t.color),this.opacity=t.opacity,this.resolution.copy(t.resolution),this.sizeAttenuation=t.sizeAttenuation,this.dashArray.copy(t.dashArray),this.dashOffset.copy(t.dashOffset),this.dashRatio.copy(t.dashRatio),this.useDash=t.useDash,this.visibility=t.visibility,this.alphaTest=t.alphaTest,this.repeat.copy(t.repeat),this};function Oe(t,a){if(t==null)return{};var r={},n=Object.keys(t),i,e;for(e=0;e<n.length;e++)i=n[e],!(a.indexOf(i)>=0)&&(r[i]=t[i]);return r}function Ce(t,a){if(t==null)return{};var r=Oe(t,a),n,i;if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);for(i=0;i<e.length;i++)n=e[i],!(a.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,n)||(r[n]=t[n]))}return r}var je={nodes:[],color:new c.Color("red"),lineWidth:3,sizeAttenuation:0},Te=function(t){"use strict";L(r,t);var a=B(r);function r(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};A(this,r);var e;return e=a.call(this),e.geometry=new c.BufferGeometry,e.meshline=new ne,e.options=(0,M.Z)({},je,i),e}var n=r.prototype;return n.create=function(){var e=this.options,o=e.nodes,u=e.duration,h=e.delay,p=e.onComplete,_=e.setPointWidth,m=Ce(e,["nodes","duration","delay","onComplete","setPointWidth"]),g=this.pencil.getSize(),P=g.width,w=g.height;delete m.key,this.geometry.setFromPoints(o),this.meshline.setGeometry(this.geometry,_);var x=new we(S((0,M.Z)({},m),{resolution:new c.Vector2(P,w)}));this.material=x,this.createMesh(this.meshline,x)},n.resize=function(e,o){this.material.uniforms.resolution.value.set(e,o)},n.animate=function(){var e=this.options,o=e.duration,u=e.delay,h=e.onComplete,p=this.material.uniforms.offset,_=new(pe()).Tween(p.value).to({x:0},o!=null?o:1e3).delay(u!=null?u:0).repeat(1/0);h&&_.onComplete(h),_.start(),this.tween=_},n.dispose=function(){this.tween&&pe().remove(this.tween)},r}(l),ke=Te})(),module.exports=be})();
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import BaseObject from '../../core/BaseObject';
|
|
3
|
+
import Cache from '../../plugins/Cache';
|
|
3
4
|
interface Options {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
children?: HTMLElement;
|
|
5
|
+
children: HTMLElement;
|
|
6
|
+
position?: THREE.Vector3;
|
|
7
7
|
}
|
|
8
8
|
export declare class Node extends BaseObject {
|
|
9
9
|
options: Options;
|
|
10
10
|
pickObject?: THREE.Sprite;
|
|
11
|
-
constructor(options:
|
|
11
|
+
constructor(options: Options);
|
|
12
12
|
create(): void;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
getMaterial(show: boolean): Promise<THREE.SpriteMaterial>;
|
|
14
|
+
createPickObject({ show, scale, position, cache, }: {
|
|
15
|
+
show?: boolean;
|
|
16
|
+
scale?: THREE.Vector3;
|
|
17
|
+
position?: THREE.Vector3;
|
|
18
|
+
cache?: Cache;
|
|
19
|
+
}): Promise<void>;
|
|
18
20
|
}
|
|
19
21
|
export default Node;
|