gl-draw 0.0.3 → 0.0.4
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.
|
@@ -1,12 +1,13 @@
|
|
|
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
|
src: string;
|
|
5
6
|
scale?: number;
|
|
6
7
|
position?: THREE.Vector3;
|
|
7
8
|
transparent?: boolean;
|
|
8
9
|
blending?: THREE.Blending;
|
|
9
|
-
cache?:
|
|
10
|
+
cache?: Cache;
|
|
10
11
|
depthWrite?: boolean;
|
|
11
12
|
alphaTest?: number;
|
|
12
13
|
}
|
package/dist/objects/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export { default as Image } from './image';
|
|
|
3
3
|
export { default as SpriteImage } from './spriteImage';
|
|
4
4
|
export { default as Video } from './video';
|
|
5
5
|
export { default as SpriteVideo } from './spriteVideo';
|
|
6
|
+
export { MeshLine, MeshLineMaterial, MeshLineRaycast } from './line/meshLine';
|
|
6
7
|
export { default as Line } from './line';
|
|
7
8
|
export { Css2dBind } from './css2dbind';
|
package/dist/objects/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){var Et={666:function(M){var C=function(_){"use strict";var T=Object.prototype,A=T.hasOwnProperty,j,P=typeof Symbol=="function"?Symbol:{},E=P.iterator||"@@iterator",Z=P.asyncIterator||"@@asyncIterator",L=P.toStringTag||"@@toStringTag";function W(d,c,g){return Object.defineProperty(d,c,{value:g,enumerable:!0,configurable:!0,writable:!0}),d[c]}try{W({},"")}catch(d){W=function(c,g,x){return c[g]=x}}function K(d,c,g,x){var b=c&&c.prototype instanceof Y?c:Y,V=Object.create(b.prototype),H=new at(x||[]);return V._invoke=_t(d,g,H),V}_.wrap=K;function I(d,c,g){try{return{type:"normal",arg:d.call(c,g)}}catch(x){return{type:"throw",arg:x}}}var D="suspendedStart",f="suspendedYield",lt="executing",tt="completed",R={};function Y(){}function O(){}function B(){}var N={};W(N,E,function(){return this});var nt=Object.getPrototypeOf,rt=nt&&nt(nt(vt([])));rt&&rt!==T&&A.call(rt,E)&&(N=rt);var et=B.prototype=Y.prototype=Object.create(N);O.prototype=B,W(et,"constructor",B),W(B,"constructor",O),O.displayName=W(B,L,"GeneratorFunction");function it(d){["next","throw","return"].forEach(function(c){W(d,c,function(g){return this._invoke(c,g)})})}_.isGeneratorFunction=function(d){var c=typeof d=="function"&&d.constructor;return c?c===O||(c.displayName||c.name)==="GeneratorFunction":!1},_.mark=function(d){return Object.setPrototypeOf?Object.setPrototypeOf(d,B):(d.__proto__=B,W(d,L,"GeneratorFunction")),d.prototype=Object.create(et),d},_.awrap=function(d){return{__await:d}};function st(d,c){function g(V,H,X,G){var q=I(d[V],d,H);if(q.type==="throw")G(q.arg);else{var wt=q.arg,ht=wt.value;return ht&&typeof ht=="object"&&A.call(ht,"__await")?c.resolve(ht.__await).then(function(Q){g("next",Q,X,G)},function(Q){g("throw",Q,X,G)}):c.resolve(ht).then(function(Q){wt.value=Q,X(wt)},function(Q){return g("throw",Q,X,G)})}}var x;function b(V,H){function X(){return new c(function(G,q){g(V,H,G,q)})}return x=x?x.then(X,X):X()}this._invoke=b}it(st.prototype),W(st.prototype,Z,function(){return this}),_.AsyncIterator=st,_.async=function(d,c,g,x,b){b===void 0&&(b=Promise);var V=new st(K(d,c,g,x),b);return _.isGeneratorFunction(c)?V:V.next().then(function(H){return H.done?H.value:V.next()})};function _t(d,c,g){var x=D;return function(V,H){if(x===lt)throw new Error("Generator is already running");if(x===tt){if(V==="throw")throw H;return gt()}for(g.method=V,g.arg=H;;){var X=g.delegate;if(X){var G=$(X,g);if(G){if(G===R)continue;return G}}if(g.method==="next")g.sent=g._sent=g.arg;else if(g.method==="throw"){if(x===D)throw x=tt,g.arg;g.dispatchException(g.arg)}else g.method==="return"&&g.abrupt("return",g.arg);x=lt;var q=I(d,c,g);if(q.type==="normal"){if(x=g.done?tt:f,q.arg===R)continue;return{value:q.arg,done:g.done}}else q.type==="throw"&&(x=tt,g.method="throw",g.arg=q.arg)}}}function $(d,c){var g=d.iterator[c.method];if(g===j){if(c.delegate=null,c.method==="throw"){if(d.iterator.return&&(c.method="return",c.arg=j,$(d,c),c.method==="throw"))return R;c.method="throw",c.arg=new TypeError("The iterator does not provide a 'throw' method")}return R}var x=I(g,d.iterator,c.arg);if(x.type==="throw")return c.method="throw",c.arg=x.arg,c.delegate=null,R;var b=x.arg;if(!b)return c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,R;if(b.done)c[d.resultName]=b.value,c.next=d.nextLoc,c.method!=="return"&&(c.method="next",c.arg=j);else return b;return c.delegate=null,R}it(et),W(et,L,"Generator"),W(et,E,function(){return this}),W(et,"toString",function(){return"[object Generator]"});function dt(d){var c={tryLoc:d[0]};1 in d&&(c.catchLoc=d[1]),2 in d&&(c.finallyLoc=d[2],c.afterLoc=d[3]),this.tryEntries.push(c)}function pt(d){var c=d.completion||{};c.type="normal",delete c.arg,d.completion=c}function at(d){this.tryEntries=[{tryLoc:"root"}],d.forEach(dt,this),this.reset(!0)}_.keys=function(d){var c=[];for(var g in d)c.push(g);return c.reverse(),function x(){for(;c.length;){var b=c.pop();if(b in d)return x.value=b,x.done=!1,x}return x.done=!0,x}};function vt(d){if(d){var c=d[E];if(c)return c.call(d);if(typeof d.next=="function")return d;if(!isNaN(d.length)){var g=-1,x=function b(){for(;++g<d.length;)if(A.call(d,g))return b.value=d[g],b.done=!1,b;return b.value=j,b.done=!0,b};return x.next=x}}return{next:gt}}_.values=vt;function gt(){return{value:j,done:!0}}return at.prototype={constructor:at,reset:function(d){if(this.prev=0,this.next=0,this.sent=this._sent=j,this.done=!1,this.delegate=null,this.method="next",this.arg=j,this.tryEntries.forEach(pt),!d)for(var c in this)c.charAt(0)==="t"&&A.call(this,c)&&!isNaN(+c.slice(1))&&(this[c]=j)},stop:function(){this.done=!0;var d=this.tryEntries[0],c=d.completion;if(c.type==="throw")throw c.arg;return this.rval},dispatchException:function(d){if(this.done)throw d;var c=this;function g(G,q){return V.type="throw",V.arg=d,c.next=G,q&&(c.method="next",c.arg=j),!!q}for(var x=this.tryEntries.length-1;x>=0;--x){var b=this.tryEntries[x],V=b.completion;if(b.tryLoc==="root")return g("end");if(b.tryLoc<=this.prev){var H=A.call(b,"catchLoc"),X=A.call(b,"finallyLoc");if(H&&X){if(this.prev<b.catchLoc)return g(b.catchLoc,!0);if(this.prev<b.finallyLoc)return g(b.finallyLoc)}else if(H){if(this.prev<b.catchLoc)return g(b.catchLoc,!0)}else if(X){if(this.prev<b.finallyLoc)return g(b.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(d,c){for(var g=this.tryEntries.length-1;g>=0;--g){var x=this.tryEntries[g];if(x.tryLoc<=this.prev&&A.call(x,"finallyLoc")&&this.prev<x.finallyLoc){var b=x;break}}b&&(d==="break"||d==="continue")&&b.tryLoc<=c&&c<=b.finallyLoc&&(b=null);var V=b?b.completion:{};return V.type=d,V.arg=c,b?(this.method="next",this.next=b.finallyLoc,R):this.complete(V)},complete:function(d,c){if(d.type==="throw")throw d.arg;return d.type==="break"||d.type==="continue"?this.next=d.arg:d.type==="return"?(this.rval=this.arg=d.arg,this.method="return",this.next="end"):d.type==="normal"&&c&&(this.next=c),R},finish:function(d){for(var c=this.tryEntries.length-1;c>=0;--c){var g=this.tryEntries[c];if(g.finallyLoc===d)return this.complete(g.completion,g.afterLoc),pt(g),R}},catch:function(d){for(var c=this.tryEntries.length-1;c>=0;--c){var g=this.tryEntries[c];if(g.tryLoc===d){var x=g.completion;if(x.type==="throw"){var b=x.arg;pt(g)}return b}}throw new Error("illegal catch attempt")},delegateYield:function(d,c,g){return this.delegate={iterator:vt(d),resultName:c,nextLoc:g},this.method==="next"&&(this.arg=j),R}},_}(M.exports);try{regeneratorRuntime=C}catch(_){typeof globalThis=="object"?globalThis.regeneratorRuntime=C:Function("r","regeneratorRuntime = r")(C)}},695:function(M,C,_){"use strict";_.d(C,{Z:function(){return T}});function T(A){if(A.geometry&&A.geometry.dispose(),A.material){var j=Array.isArray(A.material)?A.material:[A.material];j.forEach(function(P){var E,Z,L,W,K,I,D,f,lt,tt,R,Y,O;(E=P.map)===null||E===void 0||E.dispose(),(Z=P.lightMap)===null||Z===void 0||Z.dispose(),(L=P.bumpMap)===null||L===void 0||L.dispose(),(W=P.normalMap)===null||W===void 0||W.dispose(),(K=P.specularMap)===null||K===void 0||K.dispose(),(I=P.envMap)===null||I===void 0||I.dispose(),(D=P.alphaMap)===null||D===void 0||D.dispose(),(f=P.aoMap)===null||f===void 0||f.dispose(),(lt=P.displacementMap)===null||lt===void 0||lt.dispose(),(tt=P.emissiveMap)===null||tt===void 0||tt.dispose(),(R=P.gradientMap)===null||R===void 0||R.dispose(),(Y=P.metalnessMap)===null||Y===void 0||Y.dispose(),(O=P.roughnessMap)===null||O===void 0||O.dispose(),P.dispose()})}}},519:function(M,C,_){"use strict";_.d(C,{disposeMesh:function(){return E.Z},makePromiseCreator:function(){return T.Z}});var T=_(282),A=_(666),j=_.n(A),P=null,E=_(695),Z=_(644);function L(R){if(R.material){var Y=Array.isArray(R.material)?R.material:[R.material];Y.forEach(function(O){var B,N;(B=O.color)===null||B===void 0||B.convertSRGBToLinear(),(N=O.emissive)===null||N===void 0||N.convertSRGBToLinear(),O.map&&(O.map.encoding=THREE.sRGBEncoding),O.emissiveMap&&(O.emissiveMap.encoding=THREE.sRGBEncoding)})}}var W=_(568),K=_(924),I=require("idb-keyval"),D=_(484),f=null,lt=null,tt=function(){var R=(0,W.Z)(j().mark(function Y(O,B){var N,nt,rt,et,it,st;return j().wrap(function($){for(;;)switch($.prev=$.next){case 0:return N=B.version,$.next=4,(0,I.get)(O);case 4:if(rt=$.sent,!(rt&&rt[N])){$.next=9;break}nt=rt[N],$.next=15;break;case 9:return $.next=11,(0,D.Z)(fetch(O).then(function(dt){if(dt.ok)return dt.blob();throw new Error}));case 11:et=$.sent,it=et.res,st=et.err,st||(nt=it,(0,I.set)(O,(0,K.Z)({},N,it)));case 15:return $.abrupt("return",nt?{url:URL.createObjectURL(nt)}:{url:O});case 16:case"end":return $.stop()}},Y)}));return function(O,B){return R.apply(this,arguments)}}()},282:function(M,C,_){"use strict";_.d(C,{Z:function(){return A}});var T=_(484);function A(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={};return E.promise=new Promise(function(Z,L){E.resolve=Z,E.reject=L}),j&&(E.promise=(0,T.Z)(E.promise,P)),E}},484:function(M,C,_){"use strict";_.d(C,{Z:function(){return A}});var T=_(42);function A(j){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return j.then(function(E){return(0,T.Z)({err:null,res:E},P)}).catch(function(E){return(0,T.Z)({err:E,res:void 0},P)})}},644:function(M){"use strict";M.exports=require("three")},568:function(M,C,_){"use strict";_.d(C,{Z:function(){return A}});function T(j,P,E,Z,L,W,K){try{var I=j[W](K),D=I.value}catch(f){E(f);return}I.done?P(D):Promise.resolve(D).then(Z,L)}function A(j){return function(){var P=this,E=arguments;return new Promise(function(Z,L){var W=j.apply(P,E);function K(D){T(W,Z,L,K,I,"next",D)}function I(D){T(W,Z,L,K,I,"throw",D)}K(void 0)})}}},924:function(M,C,_){"use strict";_.d(C,{Z:function(){return T}});function T(A,j,P){return j in A?Object.defineProperty(A,j,{value:P,enumerable:!0,configurable:!0,writable:!0}):A[j]=P,A}},42:function(M,C,_){"use strict";_.d(C,{Z:function(){return A}});var T=_(924);function A(j){for(var P=1;P<arguments.length;P++){var E=arguments[P]!=null?arguments[P]:{},Z=Object.keys(E);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(E).filter(function(L){return Object.getOwnPropertyDescriptor(E,L).enumerable}))),Z.forEach(function(L){(0,T.Z)(j,L,E[L])})}return j}}},At={};function F(M){var C=At[M];if(C!==void 0)return C.exports;var _=At[M]={exports:{}};return Et[M](_,_.exports,F),_.exports}(function(){F.n=function(M){var C=M&&M.__esModule?function(){return M.default}:function(){return M};return F.d(C,{a:C}),C}})(),function(){F.d=function(M,C){for(var _ in C)F.o(C,_)&&!F.o(M,_)&&Object.defineProperty(M,_,{enumerable:!0,get:C[_]})}}(),function(){F.o=function(M,C){return Object.prototype.hasOwnProperty.call(M,C)}}(),function(){F.r=function(M){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(M,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(M,"__esModule",{value:!0})}}();var St={};(function(){"use strict";F.r(St),F.d(St,{Css2dBind:function(){return jt},Image:function(){return Lt},Line:function(){return Ht},SpriteImage:function(){return Dt},SpriteVideo:function(){return Bt},Text:function(){return Tt},Video:function(){return zt}});function M(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function C(e,a){return C=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},C(e,a)}function _(e,a){return C(e,a)}function T(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&&_(e,a)}var A=F(42);function j(e,a){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);a&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function P(e,a){return a=a!=null?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):j(Object(a)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(a,r))}),e}function E(){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 Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Z(e)}function L(e){return Z(e)}function W(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e){return e&&e.constructor===Symbol?"symbol":typeof e}function I(e,a){return a&&(K(a)==="object"||typeof a=="function")?a:W(e)}function D(e){var a=E();return function(){var i=L(e),n;if(a){var t=L(this).constructor;n=Reflect.construct(i,arguments,t)}else n=i.apply(this,arguments);return I(this,n)}}var f=F(644);function lt(){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 tt(e,a,r){return lt()?tt=Reflect.construct:tt=function(n,t,o){var s=[null];s.push.apply(s,t);var v=Function.bind.apply(n,s),y=new v;return o&&_(y,o.prototype),y},tt.apply(null,arguments)}function R(e,a,r){return tt.apply(null,arguments)}function Y(e,a){for(var r=0;r<a.length;r++){var i=a[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function O(e,a,r){return a&&Y(e.prototype,a),r&&Y(e,r),e}function B(e,a){(a==null||a>e.length)&&(a=e.length);for(var r=0,i=new Array(a);r<a;r++)i[r]=e[r];return i}function N(e){if(Array.isArray(e))return B(e)}function nt(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function rt(){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 et(e,a){if(!!e){if(typeof e=="string")return B(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 B(e,a)}}function it(e){return N(e)||nt(e)||et(e)||rt()}var st=F(282),_t=require("@tweenjs/tween.js"),$=F.n(_t),dt=function(){"use strict";function e(){M(this,e),this.guiParams={}}var a=e.prototype;return a.showGuiParams=function(i){var n=this;!i||Object.keys(this.guiParams).forEach(function(t){var o=i.addFolder(t),s=n.guiParams[t];Object.keys(s).forEach(function(v){var y=s[v],p=y.min,w=y.max,S=y.step,m=y.name,h=y.to,l=y.paramMap,u=y.items,k=y.value,z=y.target,J=v.toLowerCase().indexOf("color")>-1,U,ft=typeof k=="undefined"&&z,mt=ft?z():s[v],yt=ft?v:"value";u?U=o.add(mt,yt,u):J?U=o.addColor(mt,yt):U=o.add(mt,yt),U=U.name(m||v),typeof p!="undefined"&&(U=U.min(p)),typeof w!="undefined"&&(U=U.max(w)),typeof S!="undefined"&&(U=U.step(S)),U=U.onChange(function(){n.setGuiTargetValue(t,v,mt[yt],l)}),(h||ft)&&U.listen()})})},a.setGuiTargetValue=function(i,n,t,o){var s=this.guiParams[i][n],v=s.onChange,y=s.target,p=s.value,w=n.toLowerCase().indexOf("color")>-1,S=typeof p=="undefined"&&y;if(y&&!S){var m=y();Array.isArray(m)||(m=[m]),m.forEach(function(h){if(!!h)if(w)try{h[o||n].set(t)}catch(l){n!=="color"&&!o&&console.warn("".concat(n," is not a color,set paramMap"))}else h[o||n]=t})}v&&v(t)},a.setGuiTargetValueByParams=function(){var i=this;Object.keys(this.guiParams).forEach(function(n){Object.keys(i.guiParams[n]).forEach(function(t){var o=i.guiParams[n][t];typeof o.value!="undefined"&&i.setGuiTargetValue(n,t,o.value,o.paramMap)})})},a.guiParamTween=function(i,n,t){var o=t.duration,s=o===void 0?0:o,v=this,y=this.guiParams[i][n],p=y.to,w=y.paramMap,S=w===void 0?"":w;return new($()).Tween(this.guiParams[i][n]).to({value:p},s).onUpdate(function(m){v.setGuiTargetValue(i,n,m.value,S)})},e}();class pt extends f.Object3D{constructor(a=document.createElement("div")){super(),this.element=a,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(r){r.element instanceof Element&&r.element.parentNode!==null&&r.element.parentNode.removeChild(r.element)})})}copy(a,r){return super.copy(a,r),this.element=a.element.cloneNode(!0),this}}pt.prototype.isCSS2DObject=!0;const at=new f.Vector3,vt=new f.Matrix4,gt=new f.Matrix4,d=new f.Vector3,c=new f.Vector3;class g{constructor(a={}){const r=this;let i,n,t,o;const s={objects:new WeakMap},v=a.element!==void 0?a.element:document.createElement("div");v.style.overflow="hidden",this.domElement=v,this.getSize=function(){return{width:i,height:n}},this.render=function(m,h){m.autoUpdate===!0&&m.updateMatrixWorld(),h.parent===null&&h.updateMatrixWorld(),vt.copy(h.matrixWorldInverse),gt.multiplyMatrices(h.projectionMatrix,vt),y(m,m,h),S(m)},this.setSize=function(m,h){i=m,n=h,t=i/2,o=n/2,v.style.width=m+"px",v.style.height=h+"px"};function y(m,h,l){if(m.isCSS2DObject){m.onBeforeRender(r,h,l),at.setFromMatrixPosition(m.matrixWorld),at.applyMatrix4(gt);const u=m.element;/apple/i.test(navigator.vendor)?u.style.transform="translate(-50%,-50%) translate("+Math.round(at.x*t+t)+"px,"+Math.round(-at.y*o+o)+"px)":u.style.transform="translate(-50%,-50%) translate("+(at.x*t+t)+"px,"+(-at.y*o+o)+"px)",u.style.display=m.visible&&at.z>=-1&&at.z<=1?"":"none";const k={distanceToCameraSquared:p(l,m)};s.objects.set(m,k),u.parentNode!==v&&v.appendChild(u),m.onAfterRender(r,h,l)}for(let u=0,k=m.children.length;u<k;u++)y(m.children[u],h,l)}function p(m,h){return d.setFromMatrixPosition(m.matrixWorld),c.setFromMatrixPosition(h.matrixWorld),d.distanceToSquared(c)}function w(m){const h=[];return m.traverse(function(l){l.isCSS2DObject&&h.push(l)}),h}function S(m){const h=w(m).sort(function(u,k){const z=s.objects.get(u).distanceToCameraSquared,J=s.objects.get(k).distanceToCameraSquared;return z-J}),l=h.length;for(let u=0,k=h.length;u<k;u++)h[u].element.style.zIndex=l-u}}}const x=new f.Vector3,b=new f.Quaternion,V=new f.Vector3;class H extends f.Object3D{constructor(a=document.createElement("div")){super(),this.element=a,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(r){r.element instanceof Element&&r.element.parentNode!==null&&r.element.parentNode.removeChild(r.element)})})}copy(a,r){return super.copy(a,r),this.element=a.element.cloneNode(!0),this}}H.prototype.isCSS3DObject=!0;class X extends H{constructor(a){super(a),this.rotation2D=0}copy(a,r){return super.copy(a,r),this.rotation2D=a.rotation2D,this}}X.prototype.isCSS3DSprite=!0;const G=new f.Matrix4,q=new f.Matrix4;class wt{constructor(a={}){const r=this;let i,n,t,o;const s={camera:{fov:0,style:""},objects:new WeakMap},v=a.element!==void 0?a.element:document.createElement("div");v.style.overflow="hidden",this.domElement=v;const y=document.createElement("div");y.style.transformStyle="preserve-3d",y.style.pointerEvents="none",v.appendChild(y),this.getSize=function(){return{width:i,height:n}},this.render=function(h,l){const u=l.projectionMatrix.elements[5]*o;s.camera.fov!==u&&(v.style.perspective=l.isPerspectiveCamera?u+"px":"",s.camera.fov=u),h.autoUpdate===!0&&h.updateMatrixWorld(),l.parent===null&&l.updateMatrixWorld();let k,z;l.isOrthographicCamera&&(k=-(l.right+l.left)/2,z=(l.top+l.bottom)/2);const J=l.isOrthographicCamera?"scale("+u+")translate("+p(k)+"px,"+p(z)+"px)"+w(l.matrixWorldInverse):"translateZ("+u+"px)"+w(l.matrixWorldInverse),U=J+"translate("+t+"px,"+o+"px)";s.camera.style!==U&&(y.style.transform=U,s.camera.style=U),m(h,h,l,J)},this.setSize=function(h,l){i=h,n=l,t=i/2,o=n/2,v.style.width=h+"px",v.style.height=l+"px",y.style.width=h+"px",y.style.height=l+"px"};function p(h){return Math.abs(h)<1e-10?0:h}function w(h){const l=h.elements;return"matrix3d("+p(l[0])+","+p(-l[1])+","+p(l[2])+","+p(l[3])+","+p(l[4])+","+p(-l[5])+","+p(l[6])+","+p(l[7])+","+p(l[8])+","+p(-l[9])+","+p(l[10])+","+p(l[11])+","+p(l[12])+","+p(-l[13])+","+p(l[14])+","+p(l[15])+")"}function S(h){const l=h.elements,u="matrix3d("+p(l[0])+","+p(l[1])+","+p(l[2])+","+p(l[3])+","+p(-l[4])+","+p(-l[5])+","+p(-l[6])+","+p(-l[7])+","+p(l[8])+","+p(l[9])+","+p(l[10])+","+p(l[11])+","+p(l[12])+","+p(l[13])+","+p(l[14])+","+p(l[15])+")";return"translate(-50%,-50%)"+u}function m(h,l,u,k){if(h.isCSS3DObject){h.onBeforeRender(r,l,u);let z;h.isCSS3DSprite?(G.copy(u.matrixWorldInverse),G.transpose(),h.rotation2D!==0&&G.multiply(q.makeRotationZ(h.rotation2D)),h.matrixWorld.decompose(x,b,V),G.setPosition(x),G.scale(V),G.elements[3]=0,G.elements[7]=0,G.elements[11]=0,G.elements[15]=1,z=S(G)):z=S(h.matrixWorld);const J=h.element,U=s.objects.get(h);if(U===void 0||U.style!==z){J.style.transform=z;const ft={style:z};s.objects.set(h,ft)}J.style.display=h.visible?"":"none",J.parentNode!==y&&y.appendChild(J),h.onAfterRender(r,l,u)}for(let z=0,J=h.children.length;z<J;z++)m(h.children[z],l,u,k)}}}var ht=F(519),Q=function(e){"use strict";T(r,e);var a=D(r);function r(n){M(this,r);var t;return t=a.call(this),t.objecttype__="BaseObject",t.isAdd=!1,t.userData={},t.pm=(0,st.Z)(),t.visible=!1,t}var i=r.prototype;return i.init=function(){},i.create=function(){},i.render=function(){},i.update=function(t,o){},i.resize=function(t,o){},i.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},i.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},i.isVisible=function(){return this.visible},i.createMesh=function(){for(var t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];return this.object3d=R(f.Mesh,it(o)),this},i.createGroup=function(){return this.object3d=new f.Group,this},i.createPoints=function(){for(var t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];return this.object3d=R(f.Points,it(o)),this},i.createCSS2DObject=function(t){return this.object3d=new pt(t),this},i.createCSS3DObject=function(t){return this.object3d=new H(t),this},i.createCSS3DSprite=function(t){return this.object3d=new X(t),this},i.add=function(){for(var t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];var v;return(v=this.object3d).add.apply(v,it(o)),this},i.remove=function(){for(var t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];var v;return(v=this.object3d).remove.apply(v,it(o)),this},i.getSize=function(){var t=new f.Box3().setFromObject(this.object3d);return{min:t.min,max:t.max,size:t.getSize(new f.Vector3)}},i.traverse=function(t){t(this),this.children.forEach(function(o){o.traverse(t)})},i.dispose=function(){var t;(t=this.object3d)===null||t===void 0||t.traverse(function(o){(0,ht.disposeMesh)(o)})},O(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}(dt),Tt=function(e){"use strict";T(r,e);var a=D(r);function r(n){M(this,r);var t;return t=a.call(this),t.width=0,t.options=(0,A.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},n),t}var i=r.prototype;return i.init=function(){var t=document.createElement("canvas");this.canvas=t},i.create=function(){var t=this.options,o=t.position,s=t.lookAt,v=t.sprite,y=t.text,p=t.sizeAttenuation;if(v){var w=new f.Sprite(new f.SpriteMaterial({transparent:!0,sizeAttenuation:p}));this.object3d=w}else{var S=new f.MeshBasicMaterial({side:f.DoubleSide,transparent:!0}),m=new f.PlaneGeometry(1,1,1,1);this.createMesh(m,S)}this.object3d.position.copy(o),s&&this.object3d.lookAt(s),this.setText(y)},i.setText=function(t,o){var s=(0,A.Z)(P((0,A.Z)({},this.options),{text:t}),o||{}),v=s.text,y=s.fontSize,p=s.fontFamily,w=s.fontWeight,S=s.flipX,m=s.scale,h=this.canvas;h.width=y*v.length*2,h.height=y;var l=h.getContext("2d");l.font="".concat(w," ").concat(y,"px/1 ").concat(p);var u=l.measureText(v).width;h.width=u,this.width=u,l=h.getContext("2d"),l.clearRect(0,0,h.width,h.height),S&&l.scale(-1,1),l.font="".concat(w," ").concat(y,"px/1 ").concat(p),l.textBaseline="middle",l.fillStyle="#ffffff",l.fillText(v,S?u*-1:0,h.height/2),l.restore();var k=new f.Texture(h);k.anisotropy=16,k.needsUpdate=!0;var z=this.object3d;z.material.map&&z.material.map.dispose(),z.material.map=k,z.material.needsUpdate=!0,z.scale.set(k.image.width*m,k.image.height*m,1)},r}(Q),bt=F(568),Wt=F(666),ut=F.n(Wt),kt=function(){"use strict";function e(){M(this,e),this.cache=new Map}var a=e.prototype;return a.install=function(i){this.pencil=i},a.init=function(i){var n=(0,ht.makePromiseCreator)();this.cache.set(i,n)},a.get=function(i){var n;return(n=this.cache.get(i))===null||n===void 0?void 0:n.promise},a.set=function(i,n){var t=this.cache.get(i);t?t.resolve(n):console.warn("init cache first")},a.dispose=function(){this.cache.forEach(function(i,n){i.reject("stop set cache:".concat(n))}),this.cache.clear()},e}(),ot=new kt,Lt=function(e){"use strict";T(r,e);var a=D(r);function r(n){M(this,r);var t;return t=a.call(this),t.options=n,t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,bt.Z)(ut().mark(function o(){var s,v,y,p,w,S,m,h;return ut().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return s=t.options,v=s.transparent,y=s.blending,p=s.src,w=s.depthWrite,S=s.alphaTest,u.next=3,new f.TextureLoader().loadAsync(p);case 3:return m=u.sent,h=new f.MeshBasicMaterial({map:m,transparent:v!=null?v:!1,blending:y!=null?y:f.NormalBlending,depthWrite:w!=null?w:!0,alphaTest:S!=null?S:0}),u.abrupt("return",h);case 6:case"end":return u.stop()}},o)}))()},i.create=function(){var t=this;return(0,bt.Z)(ut().mark(function o(){var s,v,y,p,w,S,m,h;return ut().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,v=s.scale,y=s.position,p=s.src,w=s.cache,!(w&&!ot.get(p))){u.next=7;break}return ot.init(p),u.next=5,t.getMaterial();case 5:S=u.sent,ot.set(p,S);case 7:if(!w){u.next=13;break}return u.next=10,ot.get(p);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:m=u.t0,t.texture=m.map,h=new f.PlaneBufferGeometry(m.map.image.width,m.map.image.height),t.createMesh(h,m),v&&t.object3d.scale.set(v,v,1),y&&t.object3d.position.copy(y);case 22:case"end":return u.stop()}},o)}))()},r}(Q),Dt=function(e){"use strict";T(r,e);var a=D(r);function r(n){M(this,r);var t;return t=a.call(this),t.options=n,t}var i=r.prototype;return i.init=function(){var t=this;return(0,bt.Z)(ut().mark(function o(){var s,v;return ut().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return s=t.options.src,p.next=3,new f.TextureLoader().loadAsync(s);case 3:v=p.sent,t.texture=v;case 5:case"end":return p.stop()}},o)}))()},i.create=function(){var t=this.texture,o=this.options,s=o.scale,v=o.position,y=o.blending,p=o.transparent,w=o.depthWrite,S=o.alphaTest,m=o.sizeAttenuation,h=new f.Sprite(new f.SpriteMaterial({map:t,transparent:p!=null?p:!0,blending:y!=null?y:f.NormalBlending,depthWrite:w!=null?w:!0,alphaTest:S!=null?S:0,sizeAttenuation:m!=null?m:!0}));s&&h.scale.set(t.image.width*s,t.image.height*s,1),v&&h.position.copy(v),this.object3d=h},r}(Q);function Rt(e,a){for(;!Object.prototype.hasOwnProperty.call(e,a)&&(e=L(e),e!==null););return e}function xt(e,a,r){return typeof Reflect!="undefined"&&Reflect.get?xt=Reflect.get:xt=function(n,t,o){var s=Rt(n,t);if(!!s){var v=Object.getOwnPropertyDescriptor(s,t);return v.get?v.get.call(o||n):v.value}},xt(e,a,r)}function Ct(e,a,r){return xt(e,a,r)}var zt=function(e){"use strict";T(r,e);var a=D(r);function r(n){M(this,r);var t;return t=a.call(this),t.options=(0,A.Z)({},{autoPlay:!0,loop:!0},n),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,s=t.transparent,v=t.blending,y=t.depthWrite,p=t.format,w=t.autoPlay,S=t.loop,m=t.alphaTest,h=(0,st.Z)(),l=document.createElement("video");return l.addEventListener("loadedmetadata",function(){var u=new f.VideoTexture(l);u.format=p!=null?p:f.RGBAFormat,u.needsUpdate=!0;var k=new f.MeshBasicMaterial({map:u,transparent:s!=null?s:!0,blending:v!=null?v:f.AdditiveBlending,depthWrite:y!=null?y:!0,alphaTest:m!=null?m:0});h.resolve(k)},!1),l.src=o,l.muted=!0,l.autoplay=w,l.loop=S,l.preload="auto",h.promise},i.create=function(){var t=this;return(0,bt.Z)(ut().mark(function o(){var s,v,y,p,w,S,m,h;return ut().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,v=s.scale,y=s.position,p=s.src,w=s.cache,!(w&&!ot.get(p))){u.next=7;break}return ot.init(p),u.next=5,t.getMaterial();case 5:S=u.sent,ot.set(p,S);case 7:if(!w){u.next=13;break}return u.next=10,ot.get(p);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:m=u.t0,t.video=m.map.image,h=new f.PlaneBufferGeometry(t.video.videoWidth,t.video.videoHeight),t.createMesh(h,m),v&&t.object3d.scale.set(v,v,1),y&&t.object3d.position.copy(y);case 22:case"end":return u.stop()}},o)}))()},i.render=function(){var t=this.options.autoPlay;t&&this.video.play()},i.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Ct(L(r.prototype),"dispose",this).call(this)},r}(Q),Bt=function(e){"use strict";T(r,e);var a=D(r);function r(n){M(this,r);var t;return t=a.call(this),t.options=(0,A.Z)({},{autoPlay:!0,loop:!0},n),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,s=t.transparent,v=t.blending,y=t.depthWrite,p=t.autoPlay,w=t.loop,S=t.alphaTest,m=t.format,h=(0,st.Z)(),l=document.createElement("video");return l.addEventListener("loadedmetadata",function(){var u=new f.VideoTexture(l);u.format=m!=null?m:f.RGBAFormat,u.needsUpdate=!0;var k=new f.SpriteMaterial({map:u,transparent:s!=null?s:!0,blending:v!=null?v:f.AdditiveBlending,depthWrite:y!=null?y:!0,alphaTest:S!=null?S:0});h.resolve(k)},!1),l.src=o,l.muted=!0,l.autoplay=p,l.loop=w,l.preload="auto",h.promise},i.create=function(){var t=this;return(0,bt.Z)(ut().mark(function o(){var s,v,y,p,w,S,m,h;return ut().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,v=s.scale,y=s.position,p=s.src,w=s.cache,!(w&&!ot.get(p))){u.next=7;break}return ot.init(p),u.next=5,t.getMaterial();case 5:S=u.sent,ot.set(p,S);case 7:if(!w){u.next=13;break}return u.next=10,ot.get(p);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:m=u.t0,t.video=m.map.image,h=new f.Sprite(m),v&&h.scale.set(t.video.videoWidth*v,t.video.videoHeight*v,1),y&&h.position.copy(y),t.object3d=h;case 22:case"end":return u.stop()}},o)}))()},i.render=function(){var t=this.options.autoPlay;t&&this.video.play()},i.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Ct(L(r.prototype),"dispose",this).call(this)},r}(Q);function Vt(e,a){if(e==null)return{};var r={},i=Object.keys(e),n,t;for(t=0;t<i.length;t++)n=i[t],!(a.indexOf(n)>=0)&&(r[n]=e[n]);return r}function Gt(e,a){if(e==null)return{};var r=Vt(e,a),i,n;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(n=0;n<t.length;n++)i=t[n],!(a.indexOf(i)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,i)||(r[i]=e[i]))}return r}var Ut=`
|
|
1
|
+
(function(){var Et={666:function(M){var O=function(S){"use strict";var T=Object.prototype,A=T.hasOwnProperty,j,P=typeof Symbol=="function"?Symbol:{},z=P.iterator||"@@iterator",Z=P.asyncIterator||"@@asyncIterator",W=P.toStringTag||"@@toStringTag";function E(d,c,g){return Object.defineProperty(d,c,{value:g,enumerable:!0,configurable:!0,writable:!0}),d[c]}try{E({},"")}catch(d){E=function(c,g,x){return c[g]=x}}function $(d,c,g,x){var _=c&&c.prototype instanceof C?c:C,F=Object.create(_.prototype),q=new ft(x||[]);return F._invoke=Y(d,g,q),F}S.wrap=$;function X(d,c,g){try{return{type:"normal",arg:d.call(c,g)}}catch(x){return{type:"throw",arg:x}}}var k="suspendedStart",f="suspendedYield",st="executing",I="completed",B={};function C(){}function G(){}function V(){}var tt={};E(tt,z,function(){return this});var et=Object.getPrototypeOf,rt=et&&et(et(nt([])));rt&&rt!==T&&A.call(rt,z)&&(tt=rt);var J=V.prototype=C.prototype=Object.create(tt);G.prototype=V,E(J,"constructor",V),E(V,"constructor",G),G.displayName=E(V,W,"GeneratorFunction");function it(d){["next","throw","return"].forEach(function(c){E(d,c,function(g){return this._invoke(c,g)})})}S.isGeneratorFunction=function(d){var c=typeof d=="function"&&d.constructor;return c?c===G||(c.displayName||c.name)==="GeneratorFunction":!1},S.mark=function(d){return Object.setPrototypeOf?Object.setPrototypeOf(d,V):(d.__proto__=V,E(d,W,"GeneratorFunction")),d.prototype=Object.create(J),d},S.awrap=function(d){return{__await:d}};function ct(d,c){function g(F,q,H,K){var R=X(d[F],d,q);if(R.type==="throw")K(R.arg);else{var _t=R.arg,dt=_t.value;return dt&&typeof dt=="object"&&A.call(dt,"__await")?c.resolve(dt.__await).then(function(ut){g("next",ut,H,K)},function(ut){g("throw",ut,H,K)}):c.resolve(dt).then(function(ut){_t.value=ut,H(_t)},function(ut){return g("throw",ut,H,K)})}}var x;function _(F,q){function H(){return new c(function(K,R){g(F,q,K,R)})}return x=x?x.then(H,H):H()}this._invoke=_}it(ct.prototype),E(ct.prototype,Z,function(){return this}),S.AsyncIterator=ct,S.async=function(d,c,g,x,_){_===void 0&&(_=Promise);var F=new ct($(d,c,g,x),_);return S.isGeneratorFunction(c)?F:F.next().then(function(q){return q.done?q.value:F.next()})};function Y(d,c,g){var x=k;return function(F,q){if(x===st)throw new Error("Generator is already running");if(x===I){if(F==="throw")throw q;return bt()}for(g.method=F,g.arg=q;;){var H=g.delegate;if(H){var K=ht(H,g);if(K){if(K===B)continue;return K}}if(g.method==="next")g.sent=g._sent=g.arg;else if(g.method==="throw"){if(x===k)throw x=I,g.arg;g.dispatchException(g.arg)}else g.method==="return"&&g.abrupt("return",g.arg);x=st;var R=X(d,c,g);if(R.type==="normal"){if(x=g.done?I:f,R.arg===B)continue;return{value:R.arg,done:g.done}}else R.type==="throw"&&(x=I,g.method="throw",g.arg=R.arg)}}}function ht(d,c){var g=d.iterator[c.method];if(g===j){if(c.delegate=null,c.method==="throw"){if(d.iterator.return&&(c.method="return",c.arg=j,ht(d,c),c.method==="throw"))return B;c.method="throw",c.arg=new TypeError("The iterator does not provide a 'throw' method")}return B}var x=X(g,d.iterator,c.arg);if(x.type==="throw")return c.method="throw",c.arg=x.arg,c.delegate=null,B;var _=x.arg;if(!_)return c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,B;if(_.done)c[d.resultName]=_.value,c.next=d.nextLoc,c.method!=="return"&&(c.method="next",c.arg=j);else return _;return c.delegate=null,B}it(J),E(J,W,"Generator"),E(J,z,function(){return this}),E(J,"toString",function(){return"[object Generator]"});function yt(d){var c={tryLoc:d[0]};1 in d&&(c.catchLoc=d[1]),2 in d&&(c.finallyLoc=d[2],c.afterLoc=d[3]),this.tryEntries.push(c)}function gt(d){var c=d.completion||{};c.type="normal",delete c.arg,d.completion=c}function ft(d){this.tryEntries=[{tryLoc:"root"}],d.forEach(yt,this),this.reset(!0)}S.keys=function(d){var c=[];for(var g in d)c.push(g);return c.reverse(),function x(){for(;c.length;){var _=c.pop();if(_ in d)return x.value=_,x.done=!1,x}return x.done=!0,x}};function nt(d){if(d){var c=d[z];if(c)return c.call(d);if(typeof d.next=="function")return d;if(!isNaN(d.length)){var g=-1,x=function _(){for(;++g<d.length;)if(A.call(d,g))return _.value=d[g],_.done=!1,_;return _.value=j,_.done=!0,_};return x.next=x}}return{next:bt}}S.values=nt;function bt(){return{value:j,done:!0}}return ft.prototype={constructor:ft,reset:function(d){if(this.prev=0,this.next=0,this.sent=this._sent=j,this.done=!1,this.delegate=null,this.method="next",this.arg=j,this.tryEntries.forEach(gt),!d)for(var c in this)c.charAt(0)==="t"&&A.call(this,c)&&!isNaN(+c.slice(1))&&(this[c]=j)},stop:function(){this.done=!0;var d=this.tryEntries[0],c=d.completion;if(c.type==="throw")throw c.arg;return this.rval},dispatchException:function(d){if(this.done)throw d;var c=this;function g(K,R){return F.type="throw",F.arg=d,c.next=K,R&&(c.method="next",c.arg=j),!!R}for(var x=this.tryEntries.length-1;x>=0;--x){var _=this.tryEntries[x],F=_.completion;if(_.tryLoc==="root")return g("end");if(_.tryLoc<=this.prev){var q=A.call(_,"catchLoc"),H=A.call(_,"finallyLoc");if(q&&H){if(this.prev<_.catchLoc)return g(_.catchLoc,!0);if(this.prev<_.finallyLoc)return g(_.finallyLoc)}else if(q){if(this.prev<_.catchLoc)return g(_.catchLoc,!0)}else if(H){if(this.prev<_.finallyLoc)return g(_.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(d,c){for(var g=this.tryEntries.length-1;g>=0;--g){var x=this.tryEntries[g];if(x.tryLoc<=this.prev&&A.call(x,"finallyLoc")&&this.prev<x.finallyLoc){var _=x;break}}_&&(d==="break"||d==="continue")&&_.tryLoc<=c&&c<=_.finallyLoc&&(_=null);var F=_?_.completion:{};return F.type=d,F.arg=c,_?(this.method="next",this.next=_.finallyLoc,B):this.complete(F)},complete:function(d,c){if(d.type==="throw")throw d.arg;return d.type==="break"||d.type==="continue"?this.next=d.arg:d.type==="return"?(this.rval=this.arg=d.arg,this.method="return",this.next="end"):d.type==="normal"&&c&&(this.next=c),B},finish:function(d){for(var c=this.tryEntries.length-1;c>=0;--c){var g=this.tryEntries[c];if(g.finallyLoc===d)return this.complete(g.completion,g.afterLoc),gt(g),B}},catch:function(d){for(var c=this.tryEntries.length-1;c>=0;--c){var g=this.tryEntries[c];if(g.tryLoc===d){var x=g.completion;if(x.type==="throw"){var _=x.arg;gt(g)}return _}}throw new Error("illegal catch attempt")},delegateYield:function(d,c,g){return this.delegate={iterator:nt(d),resultName:c,nextLoc:g},this.method==="next"&&(this.arg=j),B}},S}(M.exports);try{regeneratorRuntime=O}catch(S){typeof globalThis=="object"?globalThis.regeneratorRuntime=O:Function("r","regeneratorRuntime = r")(O)}},695:function(M,O,S){"use strict";S.d(O,{Z:function(){return T}});function T(A){if(A.geometry&&A.geometry.dispose(),A.material){var j=Array.isArray(A.material)?A.material:[A.material];j.forEach(function(P){var z,Z,W,E,$,X,k,f,st,I,B,C,G;(z=P.map)===null||z===void 0||z.dispose(),(Z=P.lightMap)===null||Z===void 0||Z.dispose(),(W=P.bumpMap)===null||W===void 0||W.dispose(),(E=P.normalMap)===null||E===void 0||E.dispose(),($=P.specularMap)===null||$===void 0||$.dispose(),(X=P.envMap)===null||X===void 0||X.dispose(),(k=P.alphaMap)===null||k===void 0||k.dispose(),(f=P.aoMap)===null||f===void 0||f.dispose(),(st=P.displacementMap)===null||st===void 0||st.dispose(),(I=P.emissiveMap)===null||I===void 0||I.dispose(),(B=P.gradientMap)===null||B===void 0||B.dispose(),(C=P.metalnessMap)===null||C===void 0||C.dispose(),(G=P.roughnessMap)===null||G===void 0||G.dispose(),P.dispose()})}}},519:function(M,O,S){"use strict";S.d(O,{disposeMesh:function(){return P.Z}});var T=S(666),A=S.n(T),j=null,P=S(695),z=S(644);function Z(I){if(I.material){var B=Array.isArray(I.material)?I.material:[I.material];B.forEach(function(C){var G,V;(G=C.color)===null||G===void 0||G.convertSRGBToLinear(),(V=C.emissive)===null||V===void 0||V.convertSRGBToLinear(),C.map&&(C.map.encoding=THREE.sRGBEncoding),C.emissiveMap&&(C.emissiveMap.encoding=THREE.sRGBEncoding)})}}var W=S(568),E=S(924),$=require("idb-keyval"),X=S(484),k=null,f=null,st=function(){var I=(0,W.Z)(A().mark(function B(C,G){var V,tt,et,rt,J,it;return A().wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:return V=G.version,Y.next=4,(0,$.get)(C);case 4:if(et=Y.sent,!(et&&et[V])){Y.next=9;break}tt=et[V],Y.next=15;break;case 9:return Y.next=11,(0,X.Z)(fetch(C).then(function(ht){if(ht.ok)return ht.blob();throw new Error}));case 11:rt=Y.sent,J=rt.res,it=rt.err,it||(tt=J,(0,$.set)(C,(0,E.Z)({},V,J)));case 15:return Y.abrupt("return",tt?{url:URL.createObjectURL(tt)}:{url:C});case 16:case"end":return Y.stop()}},B)}));return function(C,G){return I.apply(this,arguments)}}()},484:function(M,O,S){"use strict";S.d(O,{Z:function(){return A}});var T=S(42);function A(j){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return j.then(function(z){return(0,T.Z)({err:null,res:z},P)}).catch(function(z){return(0,T.Z)({err:z,res:void 0},P)})}},644:function(M){"use strict";M.exports=require("three")},568:function(M,O,S){"use strict";S.d(O,{Z:function(){return A}});function T(j,P,z,Z,W,E,$){try{var X=j[E]($),k=X.value}catch(f){z(f);return}X.done?P(k):Promise.resolve(k).then(Z,W)}function A(j){return function(){var P=this,z=arguments;return new Promise(function(Z,W){var E=j.apply(P,z);function $(k){T(E,Z,W,$,X,"next",k)}function X(k){T(E,Z,W,$,X,"throw",k)}$(void 0)})}}},924:function(M,O,S){"use strict";S.d(O,{Z:function(){return T}});function T(A,j,P){return j in A?Object.defineProperty(A,j,{value:P,enumerable:!0,configurable:!0,writable:!0}):A[j]=P,A}},42:function(M,O,S){"use strict";S.d(O,{Z:function(){return A}});var T=S(924);function A(j){for(var P=1;P<arguments.length;P++){var z=arguments[P]!=null?arguments[P]:{},Z=Object.keys(z);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(z).filter(function(W){return Object.getOwnPropertyDescriptor(z,W).enumerable}))),Z.forEach(function(W){(0,T.Z)(j,W,z[W])})}return j}}},Ct={};function N(M){var O=Ct[M];if(O!==void 0)return O.exports;var S=Ct[M]={exports:{}};return Et[M](S,S.exports,N),S.exports}(function(){N.n=function(M){var O=M&&M.__esModule?function(){return M.default}:function(){return M};return N.d(O,{a:O}),O}})(),function(){N.d=function(M,O){for(var S in O)N.o(O,S)&&!N.o(M,S)&&Object.defineProperty(M,S,{enumerable:!0,get:O[S]})}}(),function(){N.o=function(M,O){return Object.prototype.hasOwnProperty.call(M,O)}}(),function(){N.r=function(M){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(M,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(M,"__esModule",{value:!0})}}();var St={};(function(){"use strict";N.r(St),N.d(St,{Css2dBind:function(){return Tt},Image:function(){return kt},Line:function(){return Nt},MeshLine:function(){return ot},MeshLineMaterial:function(){return Pt},MeshLineRaycast:function(){return jt},SpriteImage:function(){return Rt},SpriteVideo:function(){return Bt},Text:function(){return Lt},Video:function(){return zt}});function M(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function O(e,a){return O=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},O(e,a)}function S(e,a){return O(e,a)}function T(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&&S(e,a)}var A=N(42);function j(e,a){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);a&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function P(e,a){return a=a!=null?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):j(Object(a)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(a,r))}),e}function z(){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 Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Z(e)}function W(e){return Z(e)}function E(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return e&&e.constructor===Symbol?"symbol":typeof e}function X(e,a){return a&&($(a)==="object"||typeof a=="function")?a:E(e)}function k(e){var a=z();return function(){var i=W(e),n;if(a){var t=W(this).constructor;n=Reflect.construct(i,arguments,t)}else n=i.apply(this,arguments);return X(this,n)}}var f=N(644);function st(){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 I(e,a,r){return st()?I=Reflect.construct:I=function(n,t,o){var s=[null];s.push.apply(s,t);var v=Function.bind.apply(n,s),y=new v;return o&&S(y,o.prototype),y},I.apply(null,arguments)}function B(e,a,r){return I.apply(null,arguments)}function C(e,a){for(var r=0;r<a.length;r++){var i=a[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function G(e,a,r){return a&&C(e.prototype,a),r&&C(e,r),e}function V(e,a){(a==null||a>e.length)&&(a=e.length);for(var r=0,i=new Array(a);r<a;r++)i[r]=e[r];return i}function tt(e){if(Array.isArray(e))return V(e)}function et(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function rt(){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 J(e,a){if(!!e){if(typeof e=="string")return V(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 V(e,a)}}function it(e){return tt(e)||et(e)||J(e)||rt()}var ct=N(484);function Y(){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(i,n){r.resolve=i,r.reject=n}),e&&(r.promise=(0,ct.Z)(r.promise,a)),r}var ht=require("@tweenjs/tween.js"),yt=N.n(ht),gt=function(){"use strict";function e(){M(this,e),this.guiParams={}}var a=e.prototype;return a.showGuiParams=function(i){var n=this;!i||Object.keys(this.guiParams).forEach(function(t){var o=i.addFolder(t),s=n.guiParams[t];Object.keys(s).forEach(function(v){var y=s[v],p=y.min,b=y.max,w=y.step,m=y.name,h=y.to,l=y.paramMap,u=y.items,L=y.value,D=y.target,Q=v.toLowerCase().indexOf("color")>-1,U,lt=typeof L=="undefined"&&D,vt=lt?D():s[v],mt=lt?v:"value";u?U=o.add(vt,mt,u):Q?U=o.addColor(vt,mt):U=o.add(vt,mt),U=U.name(m||v),typeof p!="undefined"&&(U=U.min(p)),typeof b!="undefined"&&(U=U.max(b)),typeof w!="undefined"&&(U=U.step(w)),U=U.onChange(function(){n.setGuiTargetValue(t,v,vt[mt],l)}),(h||lt)&&U.listen()})})},a.setGuiTargetValue=function(i,n,t,o){var s=this.guiParams[i][n],v=s.onChange,y=s.target,p=s.value,b=n.toLowerCase().indexOf("color")>-1,w=typeof p=="undefined"&&y;if(y&&!w){var m=y();Array.isArray(m)||(m=[m]),m.forEach(function(h){if(!!h)if(b)try{h[o||n].set(t)}catch(l){n!=="color"&&!o&&console.warn("".concat(n," is not a color,set paramMap"))}else h[o||n]=t})}v&&v(t)},a.setGuiTargetValueByParams=function(){var i=this;Object.keys(this.guiParams).forEach(function(n){Object.keys(i.guiParams[n]).forEach(function(t){var o=i.guiParams[n][t];typeof o.value!="undefined"&&i.setGuiTargetValue(n,t,o.value,o.paramMap)})})},a.guiParamTween=function(i,n,t){var o=t.duration,s=o===void 0?0:o,v=this,y=this.guiParams[i][n],p=y.to,b=y.paramMap,w=b===void 0?"":b;return new(yt()).Tween(this.guiParams[i][n]).to({value:p},s).onUpdate(function(m){v.setGuiTargetValue(i,n,m.value,w)})},e}();class ft extends f.Object3D{constructor(a=document.createElement("div")){super(),this.element=a,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(r){r.element instanceof Element&&r.element.parentNode!==null&&r.element.parentNode.removeChild(r.element)})})}copy(a,r){return super.copy(a,r),this.element=a.element.cloneNode(!0),this}}ft.prototype.isCSS2DObject=!0;const nt=new f.Vector3,bt=new f.Matrix4,d=new f.Matrix4,c=new f.Vector3,g=new f.Vector3;class x{constructor(a={}){const r=this;let i,n,t,o;const s={objects:new WeakMap},v=a.element!==void 0?a.element:document.createElement("div");v.style.overflow="hidden",this.domElement=v,this.getSize=function(){return{width:i,height:n}},this.render=function(m,h){m.autoUpdate===!0&&m.updateMatrixWorld(),h.parent===null&&h.updateMatrixWorld(),bt.copy(h.matrixWorldInverse),d.multiplyMatrices(h.projectionMatrix,bt),y(m,m,h),w(m)},this.setSize=function(m,h){i=m,n=h,t=i/2,o=n/2,v.style.width=m+"px",v.style.height=h+"px"};function y(m,h,l){if(m.isCSS2DObject){m.onBeforeRender(r,h,l),nt.setFromMatrixPosition(m.matrixWorld),nt.applyMatrix4(d);const u=m.element;/apple/i.test(navigator.vendor)?u.style.transform="translate(-50%,-50%) translate("+Math.round(nt.x*t+t)+"px,"+Math.round(-nt.y*o+o)+"px)":u.style.transform="translate(-50%,-50%) translate("+(nt.x*t+t)+"px,"+(-nt.y*o+o)+"px)",u.style.display=m.visible&&nt.z>=-1&&nt.z<=1?"":"none";const L={distanceToCameraSquared:p(l,m)};s.objects.set(m,L),u.parentNode!==v&&v.appendChild(u),m.onAfterRender(r,h,l)}for(let u=0,L=m.children.length;u<L;u++)y(m.children[u],h,l)}function p(m,h){return c.setFromMatrixPosition(m.matrixWorld),g.setFromMatrixPosition(h.matrixWorld),c.distanceToSquared(g)}function b(m){const h=[];return m.traverse(function(l){l.isCSS2DObject&&h.push(l)}),h}function w(m){const h=b(m).sort(function(u,L){const D=s.objects.get(u).distanceToCameraSquared,Q=s.objects.get(L).distanceToCameraSquared;return D-Q}),l=h.length;for(let u=0,L=h.length;u<L;u++)h[u].element.style.zIndex=l-u}}}const _=new f.Vector3,F=new f.Quaternion,q=new f.Vector3;class H extends f.Object3D{constructor(a=document.createElement("div")){super(),this.element=a,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(r){r.element instanceof Element&&r.element.parentNode!==null&&r.element.parentNode.removeChild(r.element)})})}copy(a,r){return super.copy(a,r),this.element=a.element.cloneNode(!0),this}}H.prototype.isCSS3DObject=!0;class K extends H{constructor(a){super(a),this.rotation2D=0}copy(a,r){return super.copy(a,r),this.rotation2D=a.rotation2D,this}}K.prototype.isCSS3DSprite=!0;const R=new f.Matrix4,_t=new f.Matrix4;class dt{constructor(a={}){const r=this;let i,n,t,o;const s={camera:{fov:0,style:""},objects:new WeakMap},v=a.element!==void 0?a.element:document.createElement("div");v.style.overflow="hidden",this.domElement=v;const y=document.createElement("div");y.style.transformStyle="preserve-3d",y.style.pointerEvents="none",v.appendChild(y),this.getSize=function(){return{width:i,height:n}},this.render=function(h,l){const u=l.projectionMatrix.elements[5]*o;s.camera.fov!==u&&(v.style.perspective=l.isPerspectiveCamera?u+"px":"",s.camera.fov=u),h.autoUpdate===!0&&h.updateMatrixWorld(),l.parent===null&&l.updateMatrixWorld();let L,D;l.isOrthographicCamera&&(L=-(l.right+l.left)/2,D=(l.top+l.bottom)/2);const Q=l.isOrthographicCamera?"scale("+u+")translate("+p(L)+"px,"+p(D)+"px)"+b(l.matrixWorldInverse):"translateZ("+u+"px)"+b(l.matrixWorldInverse),U=Q+"translate("+t+"px,"+o+"px)";s.camera.style!==U&&(y.style.transform=U,s.camera.style=U),m(h,h,l,Q)},this.setSize=function(h,l){i=h,n=l,t=i/2,o=n/2,v.style.width=h+"px",v.style.height=l+"px",y.style.width=h+"px",y.style.height=l+"px"};function p(h){return Math.abs(h)<1e-10?0:h}function b(h){const l=h.elements;return"matrix3d("+p(l[0])+","+p(-l[1])+","+p(l[2])+","+p(l[3])+","+p(l[4])+","+p(-l[5])+","+p(l[6])+","+p(l[7])+","+p(l[8])+","+p(-l[9])+","+p(l[10])+","+p(l[11])+","+p(l[12])+","+p(-l[13])+","+p(l[14])+","+p(l[15])+")"}function w(h){const l=h.elements,u="matrix3d("+p(l[0])+","+p(l[1])+","+p(l[2])+","+p(l[3])+","+p(-l[4])+","+p(-l[5])+","+p(-l[6])+","+p(-l[7])+","+p(l[8])+","+p(l[9])+","+p(l[10])+","+p(l[11])+","+p(l[12])+","+p(l[13])+","+p(l[14])+","+p(l[15])+")";return"translate(-50%,-50%)"+u}function m(h,l,u,L){if(h.isCSS3DObject){h.onBeforeRender(r,l,u);let D;h.isCSS3DSprite?(R.copy(u.matrixWorldInverse),R.transpose(),h.rotation2D!==0&&R.multiply(_t.makeRotationZ(h.rotation2D)),h.matrixWorld.decompose(_,F,q),R.setPosition(_),R.scale(q),R.elements[3]=0,R.elements[7]=0,R.elements[11]=0,R.elements[15]=1,D=w(R)):D=w(h.matrixWorld);const Q=h.element,U=s.objects.get(h);if(U===void 0||U.style!==D){Q.style.transform=D;const lt={style:D};s.objects.set(h,lt)}Q.style.display=h.visible?"":"none",Q.parentNode!==y&&y.appendChild(Q),h.onAfterRender(r,l,u)}for(let D=0,Q=h.children.length;D<Q;D++)m(h.children[D],l,u,L)}}}var ut=N(519),pt=function(e){"use strict";T(r,e);var a=k(r);function r(n){M(this,r);var t;return t=a.call(this),t.objecttype__="BaseObject",t.isAdd=!1,t.userData={},t.pm=Y(),t.visible=!1,t}var i=r.prototype;return i.init=function(){},i.create=function(){},i.render=function(){},i.update=function(t,o){},i.resize=function(t,o){},i.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},i.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},i.isVisible=function(){return this.visible},i.createMesh=function(){for(var t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];return this.object3d=B(f.Mesh,it(o)),this},i.createGroup=function(){return this.object3d=new f.Group,this},i.createPoints=function(){for(var t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];return this.object3d=B(f.Points,it(o)),this},i.createCSS2DObject=function(t){return this.object3d=new ft(t),this},i.createCSS3DObject=function(t){return this.object3d=new H(t),this},i.createCSS3DSprite=function(t){return this.object3d=new K(t),this},i.add=function(){for(var t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];var v;return(v=this.object3d).add.apply(v,it(o)),this},i.remove=function(){for(var t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];var v;return(v=this.object3d).remove.apply(v,it(o)),this},i.getSize=function(){var t=new f.Box3().setFromObject(this.object3d);return{min:t.min,max:t.max,size:t.getSize(new f.Vector3)}},i.traverse=function(t){t(this),this.children.forEach(function(o){o.traverse(t)})},i.dispose=function(){var t;(t=this.object3d)===null||t===void 0||t.traverse(function(o){(0,ut.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}(gt),Lt=function(e){"use strict";T(r,e);var a=k(r);function r(n){M(this,r);var t;return t=a.call(this),t.width=0,t.options=(0,A.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},n),t}var i=r.prototype;return i.init=function(){var t=document.createElement("canvas");this.canvas=t},i.create=function(){var t=this.options,o=t.position,s=t.lookAt,v=t.sprite,y=t.text,p=t.sizeAttenuation;if(v){var b=new f.Sprite(new f.SpriteMaterial({transparent:!0,sizeAttenuation:p}));this.object3d=b}else{var w=new f.MeshBasicMaterial({side:f.DoubleSide,transparent:!0}),m=new f.PlaneGeometry(1,1,1,1);this.createMesh(m,w)}this.object3d.position.copy(o),s&&this.object3d.lookAt(s),this.setText(y)},i.setText=function(t,o){var s=(0,A.Z)(P((0,A.Z)({},this.options),{text:t}),o||{}),v=s.text,y=s.fontSize,p=s.fontFamily,b=s.fontWeight,w=s.flipX,m=s.scale,h=this.canvas;h.width=y*v.length*2,h.height=y;var l=h.getContext("2d");l.font="".concat(b," ").concat(y,"px/1 ").concat(p);var u=l.measureText(v).width;h.width=u,this.width=u,l=h.getContext("2d"),l.clearRect(0,0,h.width,h.height),w&&l.scale(-1,1),l.font="".concat(b," ").concat(y,"px/1 ").concat(p),l.textBaseline="middle",l.fillStyle="#ffffff",l.fillText(v,w?u*-1:0,h.height/2),l.restore();var L=new f.Texture(h);L.anisotropy=16,L.needsUpdate=!0;var D=this.object3d;D.material.map&&D.material.map.dispose(),D.material.map=L,D.material.needsUpdate=!0,D.scale.set(L.image.width*m,L.image.height*m,1)},r}(pt),wt=N(568),Wt=N(666),at=N.n(Wt),kt=function(e){"use strict";T(r,e);var a=k(r);function r(n){M(this,r);var t;return t=a.call(this),t.options=n,t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,wt.Z)(at().mark(function o(){var s,v,y,p,b,w,m,h;return at().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return s=t.options,v=s.transparent,y=s.blending,p=s.src,b=s.depthWrite,w=s.alphaTest,u.next=3,new f.TextureLoader().loadAsync(p);case 3:return m=u.sent,h=new f.MeshBasicMaterial({map:m,transparent:v!=null?v:!1,blending:y!=null?y:f.NormalBlending,depthWrite:b!=null?b:!0,alphaTest:w!=null?w:0}),u.abrupt("return",h);case 6:case"end":return u.stop()}},o)}))()},i.create=function(){var t=this;return(0,wt.Z)(at().mark(function o(){var s,v,y,p,b,w,m,h;return at().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,v=s.scale,y=s.position,p=s.src,b=s.cache,!(b&&!b.get(p))){u.next=7;break}return b.init(p),u.next=5,t.getMaterial();case 5:w=u.sent,b.set(p,w);case 7:if(!b){u.next=13;break}return u.next=10,b.get(p);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:m=u.t0,t.texture=m.map,h=new f.PlaneBufferGeometry(m.map.image.width,m.map.image.height),t.createMesh(h,m),v&&t.object3d.scale.set(v,v,1),y&&t.object3d.position.copy(y);case 22:case"end":return u.stop()}},o)}))()},r}(pt),Rt=function(e){"use strict";T(r,e);var a=k(r);function r(n){M(this,r);var t;return t=a.call(this),t.options=n,t}var i=r.prototype;return i.init=function(){var t=this;return(0,wt.Z)(at().mark(function o(){var s,v;return at().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return s=t.options.src,p.next=3,new f.TextureLoader().loadAsync(s);case 3:v=p.sent,t.texture=v;case 5:case"end":return p.stop()}},o)}))()},i.create=function(){var t=this.texture,o=this.options,s=o.scale,v=o.position,y=o.blending,p=o.transparent,b=o.depthWrite,w=o.alphaTest,m=o.sizeAttenuation,h=new f.Sprite(new f.SpriteMaterial({map:t,transparent:p!=null?p:!0,blending:y!=null?y:f.NormalBlending,depthWrite:b!=null?b:!0,alphaTest:w!=null?w:0,sizeAttenuation:m!=null?m:!0}));s&&h.scale.set(t.image.width*s,t.image.height*s,1),v&&h.position.copy(v),this.object3d=h},r}(pt);function Dt(e,a){for(;!Object.prototype.hasOwnProperty.call(e,a)&&(e=W(e),e!==null););return e}function xt(e,a,r){return typeof Reflect!="undefined"&&Reflect.get?xt=Reflect.get:xt=function(n,t,o){var s=Dt(n,t);if(!!s){var v=Object.getOwnPropertyDescriptor(s,t);return v.get?v.get.call(o||n):v.value}},xt(e,a,r)}function Ot(e,a,r){return xt(e,a,r)}var zt=function(e){"use strict";T(r,e);var a=k(r);function r(n){M(this,r);var t;return t=a.call(this),t.options=(0,A.Z)({},{autoPlay:!0,loop:!0},n),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,s=t.transparent,v=t.blending,y=t.depthWrite,p=t.format,b=t.autoPlay,w=t.loop,m=t.alphaTest,h=Y(),l=document.createElement("video");return l.addEventListener("loadedmetadata",function(){var u=new f.VideoTexture(l);u.format=p!=null?p:f.RGBAFormat,u.needsUpdate=!0;var L=new f.MeshBasicMaterial({map:u,transparent:s!=null?s:!0,blending:v!=null?v:f.AdditiveBlending,depthWrite:y!=null?y:!0,alphaTest:m!=null?m:0});h.resolve(L)},!1),l.src=o,l.muted=!0,l.autoplay=b,l.loop=w,l.preload="auto",h.promise},i.create=function(){var t=this;return(0,wt.Z)(at().mark(function o(){var s,v,y,p,b,w,m,h;return at().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,v=s.scale,y=s.position,p=s.src,b=s.cache,!(b&&!b.get(p))){u.next=7;break}return b.init(p),u.next=5,t.getMaterial();case 5:w=u.sent,b.set(p,w);case 7:if(!b){u.next=13;break}return u.next=10,b.get(p);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:m=u.t0,t.video=m.map.image,h=new f.PlaneBufferGeometry(t.video.videoWidth,t.video.videoHeight),t.createMesh(h,m),v&&t.object3d.scale.set(v,v,1),y&&t.object3d.position.copy(y);case 22:case"end":return u.stop()}},o)}))()},i.render=function(){var t=this.options.autoPlay;t&&this.video.play()},i.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Ot(W(r.prototype),"dispose",this).call(this)},r}(pt),Bt=function(e){"use strict";T(r,e);var a=k(r);function r(n){M(this,r);var t;return t=a.call(this),t.options=(0,A.Z)({},{autoPlay:!0,loop:!0},n),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,s=t.transparent,v=t.blending,y=t.depthWrite,p=t.autoPlay,b=t.loop,w=t.alphaTest,m=t.format,h=Y(),l=document.createElement("video");return l.addEventListener("loadedmetadata",function(){var u=new f.VideoTexture(l);u.format=m!=null?m:f.RGBAFormat,u.needsUpdate=!0;var L=new f.SpriteMaterial({map:u,transparent:s!=null?s:!0,blending:v!=null?v:f.AdditiveBlending,depthWrite:y!=null?y:!0,alphaTest:w!=null?w:0});h.resolve(L)},!1),l.src=o,l.muted=!0,l.autoplay=p,l.loop=b,l.preload="auto",h.promise},i.create=function(){var t=this;return(0,wt.Z)(at().mark(function o(){var s,v,y,p,b,w,m,h;return at().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,v=s.scale,y=s.position,p=s.src,b=s.cache,!(b&&!b.get(p))){u.next=7;break}return b.init(p),u.next=5,t.getMaterial();case 5:w=u.sent,b.set(p,w);case 7:if(!b){u.next=13;break}return u.next=10,b.get(p);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:m=u.t0,t.video=m.map.image,h=new f.Sprite(m),v&&h.scale.set(t.video.videoWidth*v,t.video.videoHeight*v,1),y&&h.position.copy(y),t.object3d=h;case 22:case"end":return u.stop()}},o)}))()},i.render=function(){var t=this.options.autoPlay;t&&this.video.play()},i.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Ot(W(r.prototype),"dispose",this).call(this)},r}(pt),Vt=`
|
|
2
2
|
`.concat(f.ShaderChunk.logdepthbuf_pars_vertex,`
|
|
3
3
|
`).concat(f.ShaderChunk.fog_pars_vertex,`
|
|
4
4
|
attribute vec3 previous;
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
96
96
|
`).concat(f.ShaderChunk.fog_vertex,`
|
|
97
97
|
}
|
|
98
|
-
`),
|
|
98
|
+
`),Gt=`
|
|
99
99
|
`.concat(f.ShaderChunk.fog_pars_fragment,`
|
|
100
100
|
`).concat(f.ShaderChunk.logdepthbuf_pars_fragment,`
|
|
101
101
|
|
|
@@ -129,4 +129,4 @@ void main() {
|
|
|
129
129
|
gl_FragColor.a *= step(vCounters, visibility);
|
|
130
130
|
`).concat(f.ShaderChunk.fog_fragment,`
|
|
131
131
|
}
|
|
132
|
-
`),ct=function(e){"use strict";T(r,e);var a=D(r);function r(){M(this,r);var i;return i=a.call(this),i.isMeshLine=!0,i.type="MeshLine",i.positions=[],i.previous=[],i.next=[],i.side=[],i.width=[],i.indices_array=[],i.uvs=[],i.counters=[],i._points=[],i._geom=null,i.widthCallback=null,i.matrixWorld=new f.Matrix4,Object.defineProperties(W(i),{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)}}}),i}return r}(f.BufferGeometry);ct.prototype.setMatrixWorld=function(e){this.matrixWorld=e},ct.prototype.setGeometry=function(e,a){this._geometry=e,this.setPoints(e.getAttribute("position").array,a)},ct.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 f.Vector3)for(var r=0;r<e.length;r++){var i=e[r],n=r/e.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(n),this.counters.push(n)}else for(var r=0;r<e.length;r+=3){var n=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(n),this.counters.push(n)}this.process()};function Ft(e,a){var r=new f.Matrix4,i=new f.Ray,n=new f.Sphere,t=new f.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),n.copy(o.boundingSphere),n.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(n,t)!==!1){r.copy(this.matrixWorld).invert(),i.copy(e.ray).applyMatrix4(r);var s=new f.Vector3,v=new f.Vector3,y=new f.Vector3,p=this instanceof f.LineSegments?2:1,w=o.index,S=o.attributes;if(w!==null)for(var m=w.array,h=S.position.array,l=S.width.array,u=0,k=m.length-1;u<k;u+=p){var z=m[u],J=m[u+1];s.fromArray(h,z*3),v.fromArray(h,J*3);var U=l[Math.floor(u/3)]!==void 0?l[Math.floor(u/3)]:1,ft=e.params.Line.threshold+this.material.lineWidth*U/2,mt=ft*ft,yt=i.distanceSqToSegment(s,v,t,y);if(!(yt>mt)){t.applyMatrix4(this.matrixWorld);var Pt=e.ray.origin.distanceTo(t);Pt<e.near||Pt>e.far||(a.push({distance:Pt,point:y.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=k)}}}}ct.prototype.raycast=Ft,ct.prototype.compareV3=function(e,a){var r=e*6,i=a*6;return this.positions[r]===this.positions[i]&&this.positions[r+1]===this.positions[i+1]&&this.positions[r+2]===this.positions[i+2]},ct.prototype.copyV3=function(e){var a=e*6;return[this.positions[a],this.positions[a+1],this.positions[a+2]]},ct.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 i=0;i<e;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?a=this.widthCallback(i/(e-1)):a=1,this.width.push(a),this.width.push(a),this.uvs.push(i/(e-1),0),this.uvs.push(i/(e-1),1),i<e-1){r=this.copyV3(i),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var n=i*2;this.indices_array.push(n,n+1,n+2),this.indices_array.push(n+2,n+1,n+3)}i>0&&(r=this.copyV3(i),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 f.BufferAttribute(new Float32Array(this.positions),3),previous:new f.BufferAttribute(new Float32Array(this.previous),3),next:new f.BufferAttribute(new Float32Array(this.next),3),side:new f.BufferAttribute(new Float32Array(this.side),1),width:new f.BufferAttribute(new Float32Array(this.width),1),uv:new f.BufferAttribute(new Float32Array(this.uvs),2),index:new f.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new f.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 Mt(e,a,r,i,n){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,n&&a+n):e.slice(a,n&&a+n):e,r.set)r.set(e,i);else for(t=0;t<e.length;t++)r[t+i]=e[t];return r}ct.prototype.advance=function(e){var a=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,n=a.length;Mt(a,0,r,0,n),Mt(a,6,a,0,n-6),a[n-6]=e.x,a[n-5]=e.y,a[n-4]=e.z,a[n-3]=e.x,a[n-2]=e.y,a[n-1]=e.z,Mt(a,6,i,0,n-6),i[n-6]=e.x,i[n-5]=e.y,i[n-4]=e.z,i[n-3]=e.x,i[n-2]=e.y,i[n-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},f.ShaderChunk.meshline_vert=Ut,f.ShaderChunk.meshline_frag=Zt;var Ot=function(e){"use strict";T(r,e);var a=D(r);function r(i){M(this,r);var n;return n=a.call(this,{uniforms:Object.assign({},f.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new f.Color(16777215)},opacity:{value:1},resolution:{value:new f.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 f.Vector2(1,1)},offset:{value:new f.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new f.Vector2(0,0)},lightColor:{value:new f.Color(16777215)}}),vertexShader:f.ShaderChunk.meshline_vert,fragmentShader:f.ShaderChunk.meshline_frag}),n.isMeshLineMaterial=!0,n.type="MeshLineMaterial",Object.defineProperties(W(n),{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)}}}),n.setValues(i),n}return r}(f.ShaderMaterial);Ot.prototype.copy=function(e){return f.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};var It={nodes:[],color:new f.Color("red"),lineWidth:3,sizeAttenuation:0},Nt=function(e){"use strict";T(r,e);var a=D(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};M(this,r);var t;return t=a.call(this),t.geometry=new f.BufferGeometry,t.meshline=new ct,t.options=(0,A.Z)({},It,n),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.nodes,s=t.duration,v=t.delay,y=t.onComplete,p=t.setPointWidth,w=Gt(t,["nodes","duration","delay","onComplete","setPointWidth"]),S=this.pencil.getSize(),m=S.width,h=S.height;delete w.key,this.geometry.setFromPoints(o),this.meshline.setGeometry(this.geometry,p);var l=new Ot(P((0,A.Z)({},w),{resolution:new f.Vector2(m,h)}));this.material=l,this.createMesh(this.meshline,l)},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,s=t.delay,v=t.onComplete,y=this.material.uniforms.offset,p=new($()).Tween(y.value).to({x:0},o!=null?o:1e3).delay(s!=null?s:0).repeat(1/0);v&&p.onComplete(v),p.start(),this.tween=p},i.dispose=function(){this.tween&&$().remove(this.tween)},r}(Q),Ht=Nt,$t={position:new f.Vector3(0,0,0),onClick:void 0},jt=function(e){"use strict";T(r,e);var a=D(r);function r(i){M(this,r);var n;n=a.call(this),n.options=(0,A.Z)({},$t,i);var t=document.createElement("div");t.addEventListener("click",function(){var s,v;(v=(s=n.options).onClick)===null||v===void 0||v.call(s,n.options.key)}),n.options.children&&t.appendChild(n.options.children);var o=new pt(t);return o.position.copy(n.options.position),n.object3d=o,n}return r}(Q),Xt={Css2dBind:jt}})(),module.exports=St})();
|
|
132
|
+
`),ot=function(e){"use strict";T(r,e);var a=k(r);function r(){M(this,r);var i;return i=a.call(this),i.isMeshLine=!0,i.type="MeshLine",i.positions=[],i.previous=[],i.next=[],i.side=[],i.width=[],i.indices_array=[],i.uvs=[],i.counters=[],i._points=[],i._geom=null,i.widthCallback=null,i.matrixWorld=new f.Matrix4,Object.defineProperties(E(i),{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)}}}),i}return r}(f.BufferGeometry);ot.prototype.setMatrixWorld=function(e){this.matrixWorld=e},ot.prototype.setGeometry=function(e,a){this._geometry=e,this.setPoints(e.getAttribute("position").array,a)},ot.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 f.Vector3)for(var r=0;r<e.length;r++){var i=e[r],n=r/e.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(n),this.counters.push(n)}else for(var r=0;r<e.length;r+=3){var n=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(n),this.counters.push(n)}this.process()};function jt(e,a){var r=new f.Matrix4,i=new f.Ray,n=new f.Sphere,t=new f.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),n.copy(o.boundingSphere),n.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(n,t)!==!1){r.copy(this.matrixWorld).invert(),i.copy(e.ray).applyMatrix4(r);var s=new f.Vector3,v=new f.Vector3,y=new f.Vector3,p=this instanceof f.LineSegments?2:1,b=o.index,w=o.attributes;if(b!==null)for(var m=b.array,h=w.position.array,l=w.width.array,u=0,L=m.length-1;u<L;u+=p){var D=m[u],Q=m[u+1];s.fromArray(h,D*3),v.fromArray(h,Q*3);var U=l[Math.floor(u/3)]!==void 0?l[Math.floor(u/3)]:1,lt=e.params.Line.threshold+this.material.lineWidth*U/2,vt=lt*lt,mt=i.distanceSqToSegment(s,v,t,y);if(!(mt>vt)){t.applyMatrix4(this.matrixWorld);var At=e.ray.origin.distanceTo(t);At<e.near||At>e.far||(a.push({distance:At,point:y.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=L)}}}}ot.prototype.raycast=jt,ot.prototype.compareV3=function(e,a){var r=e*6,i=a*6;return this.positions[r]===this.positions[i]&&this.positions[r+1]===this.positions[i+1]&&this.positions[r+2]===this.positions[i+2]},ot.prototype.copyV3=function(e){var a=e*6;return[this.positions[a],this.positions[a+1],this.positions[a+2]]},ot.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 i=0;i<e;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?a=this.widthCallback(i/(e-1)):a=1,this.width.push(a),this.width.push(a),this.uvs.push(i/(e-1),0),this.uvs.push(i/(e-1),1),i<e-1){r=this.copyV3(i),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var n=i*2;this.indices_array.push(n,n+1,n+2),this.indices_array.push(n+2,n+1,n+3)}i>0&&(r=this.copyV3(i),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 f.BufferAttribute(new Float32Array(this.positions),3),previous:new f.BufferAttribute(new Float32Array(this.previous),3),next:new f.BufferAttribute(new Float32Array(this.next),3),side:new f.BufferAttribute(new Float32Array(this.side),1),width:new f.BufferAttribute(new Float32Array(this.width),1),uv:new f.BufferAttribute(new Float32Array(this.uvs),2),index:new f.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new f.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 Mt(e,a,r,i,n){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,n&&a+n):e.slice(a,n&&a+n):e,r.set)r.set(e,i);else for(t=0;t<e.length;t++)r[t+i]=e[t];return r}ot.prototype.advance=function(e){var a=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,n=a.length;Mt(a,0,r,0,n),Mt(a,6,a,0,n-6),a[n-6]=e.x,a[n-5]=e.y,a[n-4]=e.z,a[n-3]=e.x,a[n-2]=e.y,a[n-1]=e.z,Mt(a,6,i,0,n-6),i[n-6]=e.x,i[n-5]=e.y,i[n-4]=e.z,i[n-3]=e.x,i[n-2]=e.y,i[n-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},f.ShaderChunk.meshline_vert=Vt,f.ShaderChunk.meshline_frag=Gt;var Pt=function(e){"use strict";T(r,e);var a=k(r);function r(i){M(this,r);var n;return n=a.call(this,{uniforms:Object.assign({},f.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new f.Color(16777215)},opacity:{value:1},resolution:{value:new f.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 f.Vector2(1,1)},offset:{value:new f.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new f.Vector2(0,0)},lightColor:{value:new f.Color(16777215)}}),vertexShader:f.ShaderChunk.meshline_vert,fragmentShader:f.ShaderChunk.meshline_frag}),n.isMeshLineMaterial=!0,n.type="MeshLineMaterial",Object.defineProperties(E(n),{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)}}}),n.setValues(i),n}return r}(f.ShaderMaterial);Pt.prototype.copy=function(e){return f.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 Ut(e,a){if(e==null)return{};var r={},i=Object.keys(e),n,t;for(t=0;t<i.length;t++)n=i[t],!(a.indexOf(n)>=0)&&(r[n]=e[n]);return r}function Ft(e,a){if(e==null)return{};var r=Ut(e,a),i,n;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(n=0;n<t.length;n++)i=t[n],!(a.indexOf(i)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,i)||(r[i]=e[i]))}return r}var It={nodes:[],color:new f.Color("red"),lineWidth:3,sizeAttenuation:0},Zt=function(e){"use strict";T(r,e);var a=k(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};M(this,r);var t;return t=a.call(this),t.geometry=new f.BufferGeometry,t.meshline=new ot,t.options=(0,A.Z)({},It,n),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.nodes,s=t.duration,v=t.delay,y=t.onComplete,p=t.setPointWidth,b=Ft(t,["nodes","duration","delay","onComplete","setPointWidth"]),w=this.pencil.getSize(),m=w.width,h=w.height;delete b.key,this.geometry.setFromPoints(o),this.meshline.setGeometry(this.geometry,p);var l=new Pt(P((0,A.Z)({},b),{resolution:new f.Vector2(m,h)}));this.material=l,this.createMesh(this.meshline,l)},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,s=t.delay,v=t.onComplete,y=this.material.uniforms.offset,p=new(yt()).Tween(y.value).to({x:0},o!=null?o:1e3).delay(s!=null?s:0).repeat(1/0);v&&p.onComplete(v),p.start(),this.tween=p},i.dispose=function(){this.tween&&yt().remove(this.tween)},r}(pt),Nt=Zt,Ht={position:new f.Vector3(0,0,0),onClick:void 0},Tt=function(e){"use strict";T(r,e);var a=k(r);function r(i){M(this,r);var n;n=a.call(this),n.options=(0,A.Z)({},Ht,i);var t=document.createElement("div");t.addEventListener("click",function(){var s,v;(v=(s=n.options).onClick)===null||v===void 0||v.call(s,n.options.key)}),n.options.children&&t.appendChild(n.options.children);var o=new ft(t);return o.position.copy(n.options.position),n.object3d=o,n}return r}(pt),$t={Css2dBind:Tt}})(),module.exports=St})();
|
|
@@ -1,10 +1,11 @@
|
|
|
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
|
src: string;
|
|
5
6
|
scale?: number;
|
|
6
7
|
position?: THREE.Vector3;
|
|
7
|
-
cache?:
|
|
8
|
+
cache?: Cache;
|
|
8
9
|
transparent?: boolean;
|
|
9
10
|
blending?: THREE.Blending;
|
|
10
11
|
depthWrite?: boolean;
|
|
@@ -1,10 +1,11 @@
|
|
|
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
|
src: string;
|
|
5
6
|
scale?: number;
|
|
6
7
|
position?: THREE.Vector3;
|
|
7
|
-
cache?:
|
|
8
|
+
cache?: Cache;
|
|
8
9
|
transparent?: boolean;
|
|
9
10
|
blending?: THREE.Blending;
|
|
10
11
|
depthWrite?: boolean;
|
package/package.json
CHANGED
package/dist/objects/cache.d.ts
DELETED