gl-draw 0.0.1 → 0.0.2

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.
Files changed (49) hide show
  1. package/dist/constants.d.ts +4 -0
  2. package/dist/core/BaseObject.d.ts +47 -0
  3. package/dist/core/CSSRenderer.d.ts +19 -0
  4. package/dist/core/Camera.d.ts +31 -0
  5. package/dist/core/Composer.d.ts +60 -0
  6. package/dist/core/Control.d.ts +28 -0
  7. package/dist/core/GUIObject.d.ts +38 -0
  8. package/dist/core/Pencil.d.ts +144 -0
  9. package/dist/core/Renderer.d.ts +49 -0
  10. package/dist/core/Scene.d.ts +19 -0
  11. package/dist/core/pass/bloom/UnrealBloomPass.d.ts +46 -0
  12. package/dist/core/pass/bloom/index.d.ts +33 -0
  13. package/dist/core/pass/outline/index.d.ts +37 -0
  14. package/dist/core/pass/ssr/index.d.ts +38 -0
  15. package/dist/index.d.ts +2 -0
  16. package/dist/index.js +2038 -1
  17. package/dist/objects/cache.d.ts +3 -0
  18. package/dist/objects/css2dbind/index.d.ts +16 -0
  19. package/dist/objects/image/index.d.ts +20 -0
  20. package/dist/objects/index.d.ts +7 -0
  21. package/dist/objects/index.js +132 -0
  22. package/dist/objects/line/index.d.ts +1 -0
  23. package/dist/objects/line/line.d.ts +41 -0
  24. package/dist/objects/line/meshLine/index.d.ts +89 -0
  25. package/dist/objects/line/meshLine/shader/fragment.d.ts +2 -0
  26. package/dist/objects/line/meshLine/shader/vertex.d.ts +2 -0
  27. package/dist/objects/spriteImage/index.d.ts +20 -0
  28. package/dist/objects/spriteVideo/index.d.ts +28 -0
  29. package/dist/objects/text/index.d.ts +24 -0
  30. package/dist/objects/video/index.d.ts +28 -0
  31. package/dist/plugins/Cache.d.ts +10 -0
  32. package/dist/plugins/Draw.d.ts +32 -0
  33. package/dist/plugins/index.d.ts +2 -0
  34. package/dist/plugins/index.js +1 -0
  35. package/dist/shims.d.ts +5 -0
  36. package/dist/utils/chain.d.ts +23 -0
  37. package/dist/utils/colorCorrection.d.ts +2 -0
  38. package/dist/utils/disposeMesh.d.ts +2 -0
  39. package/dist/utils/exception.d.ts +26 -0
  40. package/dist/utils/getCache.d.ts +8 -0
  41. package/dist/utils/getElementView.d.ts +2 -0
  42. package/dist/utils/index.d.ts +10 -0
  43. package/dist/utils/index.js +1 -0
  44. package/dist/utils/isPlainObject.d.ts +1 -0
  45. package/dist/utils/makePromiseCreator.d.ts +6 -0
  46. package/dist/utils/polar2Cartesian.d.ts +1 -0
  47. package/dist/utils/timer.d.ts +9 -0
  48. package/dist/utils/to.d.ts +8 -0
  49. package/package.json +26 -11
@@ -0,0 +1,3 @@
1
+ import Cache from '../plugins/Cache';
2
+ declare const _default: Cache;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import * as THREE from 'three';
2
+ import BaseObject from '../../core/BaseObject';
3
+ interface Options {
4
+ position: THREE.Vector3;
5
+ key?: string;
6
+ children?: HTMLElement;
7
+ onClick?: (key?: string) => {};
8
+ }
9
+ export declare class Css2dBind extends BaseObject {
10
+ options: Options;
11
+ constructor(options: Partial<Options>);
12
+ }
13
+ declare const _default: {
14
+ Css2dBind: typeof Css2dBind;
15
+ };
16
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import * as THREE from 'three';
2
+ import BaseObject from '../../core/BaseObject';
3
+ interface Options {
4
+ src: string;
5
+ scale?: number;
6
+ position?: THREE.Vector3;
7
+ transparent?: boolean;
8
+ blending?: THREE.Blending;
9
+ cache?: boolean;
10
+ depthWrite?: boolean;
11
+ alphaTest?: number;
12
+ }
13
+ export default class extends BaseObject {
14
+ options: Options;
15
+ texture: THREE.Texture;
16
+ constructor(options: Options);
17
+ getMaterial(): Promise<THREE.MeshBasicMaterial>;
18
+ create(): Promise<void>;
19
+ }
20
+ export {};
@@ -0,0 +1,7 @@
1
+ export { default as Text } from './text';
2
+ export { default as Image } from './image';
3
+ export { default as SpriteImage } from './spriteImage';
4
+ export { default as Video } from './video';
5
+ export { default as SpriteVideo } from './spriteVideo';
6
+ export { default as Line } from './line';
7
+ export { Css2dBind } from './css2dbind';
@@ -0,0 +1,132 @@
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=`
2
+ `.concat(f.ShaderChunk.logdepthbuf_pars_vertex,`
3
+ `).concat(f.ShaderChunk.fog_pars_vertex,`
4
+ attribute vec3 previous;
5
+ attribute vec3 next;
6
+ attribute float side;
7
+ attribute float width;
8
+ attribute float counters;
9
+
10
+ uniform vec2 resolution;
11
+ uniform float lineWidth;
12
+ uniform vec3 color;
13
+ uniform float opacity;
14
+ uniform float sizeAttenuation;
15
+ uniform vec2 offset;
16
+ uniform float time;
17
+ uniform vec3 lightColor;
18
+ uniform vec2 uCenter;
19
+ uniform float size;
20
+ uniform float speed;
21
+ uniform float lightWidth;
22
+ uniform float lineLightAnimation;
23
+
24
+ varying vec2 vUV;
25
+ varying vec4 vColor;
26
+ varying float vCounters;
27
+
28
+ vec2 fix(vec4 i,float aspect){
29
+
30
+ vec2 res=i.xy/i.w;
31
+ res.x*=aspect;
32
+ vCounters=counters;
33
+ return res;
34
+
35
+ }
36
+
37
+ void main(){
38
+
39
+ float aspect=resolution.x/resolution.y;
40
+ float pixelWidthRatio=1./(resolution.x*projectionMatrix[0][0]);
41
+
42
+ if (lineLightAnimation == 1.0) {
43
+ vec2 vWorld=position.xy;
44
+ float r_time=mod(time/(speed*size),2.);
45
+ float l=distance(vWorld, uCenter)/size;
46
+ float r_opacity=smoothstep(r_time-lightWidth*2.,r_time-lightWidth,l)-smoothstep(r_time-lightWidth,r_time,l);
47
+ vColor=vec4(mix(color,lightColor,r_opacity),opacity);
48
+ } else {
49
+ vColor=vec4(color,opacity);
50
+ }
51
+
52
+
53
+ vUV=uv+offset;
54
+
55
+ mat4 m=projectionMatrix*modelViewMatrix;
56
+ vec4 finalPosition=m*vec4(position,1.);
57
+ vec4 prevPos=m*vec4(previous,1.);
58
+ vec4 nextPos=m*vec4(next,1.);
59
+
60
+ vec2 currentP=fix(finalPosition,aspect);
61
+ vec2 prevP=fix(prevPos,aspect);
62
+ vec2 nextP=fix(nextPos,aspect);
63
+
64
+ float pixelWidth=finalPosition.w*pixelWidthRatio;
65
+ float w=1.8*pixelWidth*lineWidth*width;
66
+
67
+ if(sizeAttenuation==1.){
68
+ w=1.8*lineWidth*width;
69
+ }
70
+
71
+ vec2 dir;
72
+ if(nextP==currentP)dir=normalize(currentP-prevP);
73
+ else if(prevP==currentP)dir=normalize(nextP-currentP);
74
+ else{
75
+ vec2 dir1=normalize(currentP-prevP);
76
+ vec2 dir2=normalize(nextP-currentP);
77
+ dir=normalize(dir1+dir2);
78
+
79
+ vec2 perp=vec2(-dir1.y,dir1.x);
80
+ vec2 miter=vec2(-dir.y,dir.x);
81
+ //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );
82
+
83
+ }
84
+
85
+ //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;
86
+ vec2 normal=vec2(-dir.y,dir.x);
87
+ normal.x/=aspect;
88
+ normal*=.5*w;
89
+
90
+ vec4 offset=vec4(normal*side,0.,1.);
91
+ finalPosition.xy+=offset.xy;
92
+
93
+ gl_Position=finalPosition;
94
+ `).concat(f.ShaderChunk.logdepthbuf_vertex,`
95
+ vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
96
+ `).concat(f.ShaderChunk.fog_vertex,`
97
+ }
98
+ `),Zt=`
99
+ `.concat(f.ShaderChunk.fog_pars_fragment,`
100
+ `).concat(f.ShaderChunk.logdepthbuf_pars_fragment,`
101
+
102
+
103
+ uniform sampler2D map;
104
+ uniform sampler2D alphaMap;
105
+ uniform float useMap;
106
+ uniform float useAlphaMap;
107
+ uniform float useDash;
108
+ uniform float dashArray;
109
+ uniform float dashOffset;
110
+ uniform float dashRatio;
111
+ uniform float visibility;
112
+ uniform float alphaTest;
113
+ uniform vec2 repeat;
114
+
115
+ varying vec2 vUV;
116
+ varying vec4 vColor;
117
+ varying float vCounters;
118
+
119
+ void main() {
120
+ `).concat(f.ShaderChunk.logdepthbuf_fragment,`
121
+ vec4 c = vColor;
122
+ if( useMap == 1. ) c *= texture2D( map, vUV * repeat );
123
+ if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;
124
+ if( c.a < alphaTest ) discard;
125
+ if( useDash == 1. ){
126
+ c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
127
+ }
128
+ gl_FragColor = c;
129
+ gl_FragColor.a *= step(vCounters, visibility);
130
+ `).concat(f.ShaderChunk.fog_fragment,`
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})();
@@ -0,0 +1 @@
1
+ export { default } from './line';
@@ -0,0 +1,41 @@
1
+ import * as THREE from 'three';
2
+ import { Tween } from '@tweenjs/tween.js';
3
+ import BaseObject from '../../core/BaseObject';
4
+ import { MeshLine, MeshLineMaterial } from './meshLine';
5
+ interface Options {
6
+ nodes: THREE.Vector3[];
7
+ duration?: number;
8
+ delay?: number;
9
+ onComplete?: (...args: any[]) => void;
10
+ color?: string | THREE.Color | number;
11
+ lineWidth?: number;
12
+ sizeAttenuation?: number;
13
+ map?: THREE.Texture;
14
+ useMap?: number;
15
+ alphaMap?: THREE.Texture;
16
+ useAlphaMap?: number;
17
+ opacity?: number;
18
+ dashArray?: number;
19
+ dashOffset?: number;
20
+ dashRatio?: number;
21
+ useDash?: number;
22
+ visibility?: number;
23
+ alphaTest?: number;
24
+ repeat?: THREE.Vector2;
25
+ transparent?: boolean;
26
+ depthTest?: boolean;
27
+ setPointWidth?: (p: number) => number;
28
+ }
29
+ export declare class Line extends BaseObject {
30
+ options: Options;
31
+ tween: Tween<any>;
32
+ constructor(options?: Partial<Options>);
33
+ material: MeshLineMaterial;
34
+ geometry: THREE.BufferGeometry;
35
+ meshline: MeshLine;
36
+ create(): void;
37
+ resize(w: number, h: number): void;
38
+ animate(): void;
39
+ dispose(): void;
40
+ }
41
+ export default Line;
@@ -0,0 +1,89 @@
1
+ import * as THREE from 'three';
2
+
3
+ export class MeshLine extends THREE.BufferGeometry {
4
+ constructor();
5
+
6
+ geometry: MeshLine;
7
+
8
+ points: Float32Array | Array<number>;
9
+
10
+ isMeshLine: boolean;
11
+
12
+ setPoints(
13
+ points: Float32Array | Array<number>,
14
+ wcb?: (p: number) => any
15
+ ): void;
16
+
17
+ setMatrixWorld(matrixWorld: THREE.Matrix4): void;
18
+
19
+ setGeometry(g: THREE.BufferGeometry, c?: (p: number) => any): void;
20
+
21
+ raycast: (
22
+ raycaster: THREE.Raycaster,
23
+ intersects: THREE.Intersection[]
24
+ ) => void;
25
+
26
+ compareV3(a: number, b: number): number;
27
+
28
+ copyV3(a: number): [number, number, number];
29
+ }
30
+
31
+ export class MeshLineMaterial extends THREE.ShaderMaterial {
32
+ constructor(parameters?: {
33
+ resolution: THREE.Vector2; // required
34
+ lineWidth?: number;
35
+ map?: THREE.Texture;
36
+ useMap?: number;
37
+ alphaMap?: THREE.Texture;
38
+ useAlphaMap?: number;
39
+ color?: string | THREE.Color | number;
40
+ opacity?: number;
41
+ sizeAttenuation?: number;
42
+ dashArray?: number;
43
+ dashOffset?: number;
44
+ dashRatio?: number;
45
+ useDash?: number;
46
+ visibility?: number;
47
+ alphaTest?: number;
48
+ repeat?: THREE.Vector2;
49
+ transparent?: boolean;
50
+ depthTest?: boolean;
51
+ });
52
+
53
+ lineWidth: number;
54
+
55
+ map: THREE.Texture;
56
+
57
+ useMap: number;
58
+
59
+ alphaMap: THREE.Texture;
60
+
61
+ useAlphaMap: number;
62
+
63
+ color: THREE.Color | string | number;
64
+
65
+ opacity: number;
66
+
67
+ resolution: THREE.Vector2;
68
+
69
+ sizeAttenuation: number;
70
+
71
+ dashArray: number;
72
+
73
+ dashOffset: number;
74
+
75
+ dashRatio: number;
76
+
77
+ useDesh: number;
78
+
79
+ visibility: number;
80
+
81
+ alphaTest: number;
82
+
83
+ repeat: THREE.Vector2;
84
+ }
85
+
86
+ export function MeshLineRaycast(
87
+ raycaster: THREE.Raycaster,
88
+ intersects: THREE.Intersection[]
89
+ ): void;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import * as THREE from 'three';
2
+ import BaseObject from '../../core/BaseObject';
3
+ interface Options {
4
+ src: string;
5
+ scale?: number;
6
+ position?: THREE.Vector3;
7
+ transparent?: boolean;
8
+ blending?: THREE.Blending;
9
+ depthWrite?: boolean;
10
+ alphaTest?: number;
11
+ sizeAttenuation?: boolean;
12
+ }
13
+ export default class extends BaseObject {
14
+ options: Options;
15
+ texture: THREE.Texture;
16
+ constructor(options: Options);
17
+ init(): Promise<void>;
18
+ create(): void;
19
+ }
20
+ export {};
@@ -0,0 +1,28 @@
1
+ import * as THREE from 'three';
2
+ import BaseObject from '../../core/BaseObject';
3
+ interface Options {
4
+ src: string;
5
+ scale?: number;
6
+ position?: THREE.Vector3;
7
+ cache?: boolean;
8
+ transparent?: boolean;
9
+ blending?: THREE.Blending;
10
+ depthWrite?: boolean;
11
+ alphaTest?: number;
12
+ autoPlay?: boolean;
13
+ loop?: boolean;
14
+ format?: THREE.PixelFormat;
15
+ }
16
+ export default class extends BaseObject {
17
+ options: Options & {
18
+ autoPlay: boolean;
19
+ loop: boolean;
20
+ };
21
+ video: HTMLVideoElement;
22
+ constructor(options: Options);
23
+ getMaterial(): Promise<any>;
24
+ create(): Promise<void>;
25
+ render(): void;
26
+ dispose(): void;
27
+ }
28
+ export {};
@@ -0,0 +1,24 @@
1
+ import * as THREE from 'three';
2
+ import BaseObject from '../../core/BaseObject';
3
+ interface Options {
4
+ position: THREE.Vector3;
5
+ text: string;
6
+ fontSize?: number;
7
+ scale?: number;
8
+ fontFamily?: string;
9
+ fontWeight?: string;
10
+ flipX?: boolean;
11
+ lookAt?: THREE.Vector3;
12
+ sprite?: boolean;
13
+ sizeAttenuation?: boolean;
14
+ }
15
+ export default class extends BaseObject {
16
+ options: Omit<Required<Options>, 'lookAt'> & Pick<Options, 'lookAt'>;
17
+ width: number;
18
+ canvas: HTMLCanvasElement;
19
+ constructor(options: Options);
20
+ init(): void;
21
+ create(): void;
22
+ setText(t: string, options?: Pick<Options, 'fontSize' | 'fontFamily' | 'flipX'>): void;
23
+ }
24
+ export {};
@@ -0,0 +1,28 @@
1
+ import * as THREE from 'three';
2
+ import BaseObject from '../../core/BaseObject';
3
+ interface Options {
4
+ src: string;
5
+ scale?: number;
6
+ position?: THREE.Vector3;
7
+ cache?: boolean;
8
+ transparent?: boolean;
9
+ blending?: THREE.Blending;
10
+ depthWrite?: boolean;
11
+ alphaTest?: number;
12
+ autoPlay?: boolean;
13
+ loop?: boolean;
14
+ format?: THREE.PixelFormat;
15
+ }
16
+ export default class extends BaseObject {
17
+ options: Options & {
18
+ autoPlay: boolean;
19
+ loop: boolean;
20
+ };
21
+ video: HTMLVideoElement;
22
+ constructor(options: Options);
23
+ getMaterial(): Promise<any>;
24
+ create(): Promise<void>;
25
+ render(): void;
26
+ dispose(): void;
27
+ }
28
+ export {};
@@ -0,0 +1,10 @@
1
+ import Pencil from '../core/Pencil';
2
+ export default class {
3
+ cache: Map<any, any>;
4
+ pencil: Pencil;
5
+ install(pencil: Pencil): void;
6
+ init(key: string): void;
7
+ get(key: string): any;
8
+ set(key: string, value: any): void;
9
+ dispose(): void;
10
+ }
@@ -0,0 +1,32 @@
1
+ import { IBaseObject } from '../core/BaseObject';
2
+ import Pencil from '../core/Pencil';
3
+ declare type KeyOf<T extends object> = Extract<keyof T, string>;
4
+ export default class Draw<T extends {
5
+ [key: string]: new (...args: any[]) => IBaseObject;
6
+ }> {
7
+ pencil: Pencil;
8
+ private objects_;
9
+ private objectNamesToFactories;
10
+ private objects;
11
+ get objectsPromise(): Promise<any>[];
12
+ constructor(objects: T);
13
+ install(pencil: Pencil): void;
14
+ initObjectFactories(): void;
15
+ getObject<Y extends KeyOf<T>>(nameOrigin: Y, options?: {
16
+ key: string;
17
+ }): InstanceType<T[Y]>;
18
+ getAllObject<Y extends KeyOf<T>>(nameOrigin: Y, options?: {
19
+ key: string;
20
+ }): InstanceType<T[Y]>[];
21
+ draw<Y extends KeyOf<T>, U extends KeyOf<T> | `${KeyOf<T>}#${string}` | IBaseObject>(nameOrigin: Y, options?: ConstructorParameters<T[Y]>[0] & {
22
+ key?: string;
23
+ target?: U;
24
+ }, target?: U): Promise<InstanceType<T[Y]>>;
25
+ private addMesh;
26
+ erase(...args: (KeyOf<T> | `${KeyOf<T>}#${string}` | InstanceType<T[keyof T]>)[]): void;
27
+ private removeMesh;
28
+ update(delta: number, elapsed: number): void;
29
+ setSize(width: number, height: number): void;
30
+ dispose(): void;
31
+ }
32
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as Cache } from './Cache';
2
+ export { default as Draw } from './Draw';
@@ -0,0 +1 @@
1
+ (function(){var J={666:function(p){var v=function(s){"use strict";var A=Object.prototype,g=A.hasOwnProperty,d,b=typeof Symbol=="function"?Symbol:{},y=b.iterator||"@@iterator",T=b.asyncIterator||"@@asyncIterator",j=b.toStringTag||"@@toStringTag";function w(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{w({},"")}catch(e){w=function(t,n,f){return t[n]=f}}function R(e,t,n,f){var c=t&&t.prototype instanceof m?t:m,O=Object.create(c.prototype),C=new N(f||[]);return O._invoke=_(e,n,C),O}s.wrap=R;function I(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(f){return{type:"throw",arg:f}}}var D="suspendedStart",W="suspendedYield",z="executing",k="completed",P={};function m(){}function i(){}function o(){}var a={};w(a,y,function(){return this});var r=Object.getPrototypeOf,u=r&&r(r(U([])));u&&u!==A&&g.call(u,y)&&(a=u);var h=o.prototype=m.prototype=Object.create(a);i.prototype=o,w(h,"constructor",o),w(o,"constructor",i),i.displayName=w(o,j,"GeneratorFunction");function l(e){["next","throw","return"].forEach(function(t){w(e,t,function(n){return this._invoke(t,n)})})}s.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===i||(t.displayName||t.name)==="GeneratorFunction":!1},s.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,o):(e.__proto__=o,w(e,j,"GeneratorFunction")),e.prototype=Object.create(h),e},s.awrap=function(e){return{__await:e}};function E(e,t){function n(O,C,M,B){var G=I(e[O],e,C);if(G.type==="throw")B(G.arg);else{var Y=G.arg,H=Y.value;return H&&typeof H=="object"&&g.call(H,"__await")?t.resolve(H.__await).then(function($){n("next",$,M,B)},function($){n("throw",$,M,B)}):t.resolve(H).then(function($){Y.value=$,M(Y)},function($){return n("throw",$,M,B)})}}var f;function c(O,C){function M(){return new t(function(B,G){n(O,C,B,G)})}return f=f?f.then(M,M):M()}this._invoke=c}l(E.prototype),w(E.prototype,T,function(){return this}),s.AsyncIterator=E,s.async=function(e,t,n,f,c){c===void 0&&(c=Promise);var O=new E(R(e,t,n,f),c);return s.isGeneratorFunction(t)?O:O.next().then(function(C){return C.done?C.value:O.next()})};function _(e,t,n){var f=D;return function(O,C){if(f===z)throw new Error("Generator is already running");if(f===k){if(O==="throw")throw C;return F()}for(n.method=O,n.arg=C;;){var M=n.delegate;if(M){var B=L(M,n);if(B){if(B===P)continue;return B}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(f===D)throw f=k,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);f=z;var G=I(e,t,n);if(G.type==="normal"){if(f=n.done?k:W,G.arg===P)continue;return{value:G.arg,done:n.done}}else G.type==="throw"&&(f=k,n.method="throw",n.arg=G.arg)}}}function L(e,t){var n=e.iterator[t.method];if(n===d){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=d,L(e,t),t.method==="throw"))return P;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return P}var f=I(n,e.iterator,t.arg);if(f.type==="throw")return t.method="throw",t.arg=f.arg,t.delegate=null,P;var c=f.arg;if(!c)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,P;if(c.done)t[e.resultName]=c.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=d);else return c;return t.delegate=null,P}l(h),w(h,j,"Generator"),w(h,y,function(){return this}),w(h,"toString",function(){return"[object Generator]"});function Z(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(Z,this),this.reset(!0)}s.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function f(){for(;t.length;){var c=t.pop();if(c in e)return f.value=c,f.done=!1,f}return f.done=!0,f}};function U(e){if(e){var t=e[y];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var n=-1,f=function c(){for(;++n<e.length;)if(g.call(e,n))return c.value=e[n],c.done=!1,c;return c.value=d,c.done=!0,c};return f.next=f}}return{next:F}}s.values=U;function F(){return{value:d,done:!0}}return N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=d,this.done=!1,this.delegate=null,this.method="next",this.arg=d,this.tryEntries.forEach(x),!e)for(var t in this)t.charAt(0)==="t"&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=d)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(B,G){return O.type="throw",O.arg=e,t.next=B,G&&(t.method="next",t.arg=d),!!G}for(var f=this.tryEntries.length-1;f>=0;--f){var c=this.tryEntries[f],O=c.completion;if(c.tryLoc==="root")return n("end");if(c.tryLoc<=this.prev){var C=g.call(c,"catchLoc"),M=g.call(c,"finallyLoc");if(C&&M){if(this.prev<c.catchLoc)return n(c.catchLoc,!0);if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else if(C){if(this.prev<c.catchLoc)return n(c.catchLoc,!0)}else if(M){if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var f=this.tryEntries[n];if(f.tryLoc<=this.prev&&g.call(f,"finallyLoc")&&this.prev<f.finallyLoc){var c=f;break}}c&&(e==="break"||e==="continue")&&c.tryLoc<=t&&t<=c.finallyLoc&&(c=null);var O=c?c.completion:{};return O.type=e,O.arg=t,c?(this.method="next",this.next=c.finallyLoc,P):this.complete(O)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),P},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),P}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var f=n.completion;if(f.type==="throw"){var c=f.arg;x(n)}return c}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:U(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=d),P}},s}(p.exports);try{regeneratorRuntime=v}catch(s){typeof globalThis=="object"?globalThis.regeneratorRuntime=v:Function("r","regeneratorRuntime = r")(v)}},519:function(p,v,s){"use strict";s.d(v,{makePromiseCreator:function(){return A.Z}});var A=s(282),g=s(666),d=s.n(g),b=null,y=s(644);function T(k){if(k.material){var P=Array.isArray(k.material)?k.material:[k.material];P.forEach(function(m){var i,o;(i=m.color)===null||i===void 0||i.convertSRGBToLinear(),(o=m.emissive)===null||o===void 0||o.convertSRGBToLinear(),m.map&&(m.map.encoding=THREE.sRGBEncoding),m.emissiveMap&&(m.emissiveMap.encoding=THREE.sRGBEncoding)})}}var j=s(568),w=s(924),R=require("idb-keyval"),I=s(484),D=null,W=null,z=function(){var k=(0,j.Z)(d().mark(function P(m,i){var o,a,r,u,h,l;return d().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return o=i.version,_.next=4,(0,R.get)(m);case 4:if(r=_.sent,!(r&&r[o])){_.next=9;break}a=r[o],_.next=15;break;case 9:return _.next=11,(0,I.Z)(fetch(m).then(function(L){if(L.ok)return L.blob();throw new Error}));case 11:u=_.sent,h=u.res,l=u.err,l||(a=h,(0,R.set)(m,(0,w.Z)({},o,h)));case 15:return _.abrupt("return",a?{url:URL.createObjectURL(a)}:{url:m});case 16:case"end":return _.stop()}},P)}));return function(m,i){return k.apply(this,arguments)}}()},282:function(p,v,s){"use strict";s.d(v,{Z:function(){return g}});var A=s(484);function g(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={};return y.promise=new Promise(function(T,j){y.resolve=T,y.reject=j}),d&&(y.promise=(0,A.Z)(y.promise,b)),y}},484:function(p,v,s){"use strict";s.d(v,{Z:function(){return g}});var A=s(42);function g(d){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return d.then(function(y){return(0,A.Z)({err:null,res:y},b)}).catch(function(y){return(0,A.Z)({err:y,res:void 0},b)})}},644:function(p){"use strict";p.exports=require("three")},568:function(p,v,s){"use strict";s.d(v,{Z:function(){return g}});function A(d,b,y,T,j,w,R){try{var I=d[w](R),D=I.value}catch(W){y(W);return}I.done?b(D):Promise.resolve(D).then(T,j)}function g(d){return function(){var b=this,y=arguments;return new Promise(function(T,j){var w=d.apply(b,y);function R(D){A(w,T,j,R,I,"next",D)}function I(D){A(w,T,j,R,I,"throw",D)}R(void 0)})}}},924:function(p,v,s){"use strict";s.d(v,{Z:function(){return A}});function A(g,d,b){return d in g?Object.defineProperty(g,d,{value:b,enumerable:!0,configurable:!0,writable:!0}):g[d]=b,g}},42:function(p,v,s){"use strict";s.d(v,{Z:function(){return g}});var A=s(924);function g(d){for(var b=1;b<arguments.length;b++){var y=arguments[b]!=null?arguments[b]:{},T=Object.keys(y);typeof Object.getOwnPropertySymbols=="function"&&(T=T.concat(Object.getOwnPropertySymbols(y).filter(function(j){return Object.getOwnPropertyDescriptor(y,j).enumerable}))),T.forEach(function(j){(0,A.Z)(d,j,y[j])})}return d}}},X={};function S(p){var v=X[p];if(v!==void 0)return v.exports;var s=X[p]={exports:{}};return J[p](s,s.exports,S),s.exports}(function(){S.n=function(p){var v=p&&p.__esModule?function(){return p.default}:function(){return p};return S.d(v,{a:v}),v}})(),function(){S.d=function(p,v){for(var s in v)S.o(v,s)&&!S.o(p,s)&&Object.defineProperty(p,s,{enumerable:!0,get:v[s]})}}(),function(){S.o=function(p,v){return Object.prototype.hasOwnProperty.call(p,v)}}(),function(){S.r=function(p){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})}}();var K={};(function(){"use strict";S.r(K),S.d(K,{Cache:function(){return s},Draw:function(){return m}});function p(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var v=S(519),s=function(){"use strict";function i(){p(this,i),this.cache=new Map}var o=i.prototype;return o.install=function(r){this.pencil=r},o.init=function(r){var u=(0,v.makePromiseCreator)();this.cache.set(r,u)},o.get=function(r){var u;return(u=this.cache.get(r))===null||u===void 0?void 0:u.promise},o.set=function(r,u){var h=this.cache.get(r);h?h.resolve(u):console.warn("init cache first")},o.dispose=function(){this.cache.forEach(function(r,u){r.reject("stop set cache:".concat(u))}),this.cache.clear()},i}(),A=S(568);function g(i,o){for(var a=0;a<o.length;a++){var r=o[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function d(i,o,a){return o&&g(i.prototype,o),a&&g(i,a),i}function b(i){if(Array.isArray(i))return i}function y(i){if(typeof Symbol!="undefined"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(i,o){(o==null||o>i.length)&&(o=i.length);for(var a=0,r=new Array(o);a<o;a++)r[a]=i[a];return r}function w(i,o){if(!!i){if(typeof i=="string")return j(i,o);var a=Object.prototype.toString.call(i).slice(8,-1);if(a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return j(i,o)}}function R(i,o){return b(i)||y(i,o)||w(i,o)||T()}function I(i){if(Array.isArray(i))return j(i)}function D(){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 W(i){return I(i)||y(i)||w(i)||D()}var z=S(666),k=S.n(z),P=S(644),m=function(){"use strict";function i(a){p(this,i),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=a}var o=i.prototype;return o.install=function(r){this.pencil=r,this.initObjectFactories()},o.initObjectFactories=function(){var r=this,u=this.objects_;Object.keys(u).forEach(function(h){var l=function(){function E(){p(this,E)}var _=E.prototype;return _.create=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new u[h](Z)},E}();r.objectNamesToFactories.set(h,l)})},o.getObject=function(r,u){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var h=(u||{}).key,l="".concat(r).concat(h?"#".concat(h):""),E=this.objects.get(l);return E},o.getAllObject=function(r,u){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var h=(u||{}).key,l="".concat(r).concat(h?"#".concat(h):""),E=[];return this.objects.forEach(function(_,L){(L.startsWith("".concat(l,"#"))||L===l)&&E.push(_)}),E},o.draw=function(r,u,h){var l=this;return(0,A.Z)(k().mark(function E(){var _,L,Z,x,N,U,F;return k().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(_=l.objectNamesToFactories.get(r),!_){t.next=15;break}return L=(u||{}).key,Z="".concat(r).concat(L?"#".concat(L):""),l.objects.has(Z)&&(x=P.MathUtils.generateUUID(),Z+="#".concat(x)),N=(u==null?void 0:u.target)||h,typeof N=="string"?U=l.objects.get(N):(N==null?void 0:N.objecttype__)==="BaseObject"?U=N:U=l.pencil.scene,F=new _().create(u),F.pencil=l.pencil,F.key=Z,l.objects.set(Z,F),t.next=14,l.addMesh(F,U);case 14:return t.abrupt("return",F);case 15:throw new Error("Unrecognized:".concat(r));case 16:case"end":return t.stop()}},E)}))()},o.addMesh=function(r,u){var h=this;return(0,A.Z)(k().mark(function l(){return k().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return _.next=2,r.init();case 2:return _.next=4,r.create();case 4:r.object3d&&(r.object3d.userData.BaseObject_=r,u.add(r.object3d)),r.isAdd||(r.isAdd=!0,r.visible=!0),r.render(),h.pencil.gui&&r.showGuiParams(h.pencil.gui),r.pm.resolve();case 9:case"end":return _.stop()}},l)}))()},o.erase=function(){for(var r=arguments.length,u=new Array(r),h=0;h<r;h++)u[h]=arguments[h];var l=this;W(u).forEach(function(E){var _=[];if(typeof E=="string"){var L,Z=R(E.split("#"),2),x=Z[0],N=Z[1];(L=_).push.apply(L,W(l.getAllObject(x,{key:N})))}else _.push(E);_.forEach(function(U){l.removeMesh(U)})})},o.removeMesh=function(r){var u=this,h=r.parent;r.object3d&&h.remove(r.object3d),r.traverse(function(l){l.isAdd&&(l.isAdd=!1,l.visible=!1),l.dispose(),u.objects.delete(l.key)})},o.update=function(r,u){this.objects.forEach(function(h){h.objecttype__==="BaseObject"&&h.update(r,u)})},o.setSize=function(r,u){this.objects.forEach(function(h){h.objecttype__==="BaseObject"&&h.resize(r,u)})},o.dispose=function(){this.objects.forEach(function(r,u){r.objecttype__==="BaseObject"&&(r.dispose(),r.pm.reject("stop draw:".concat(u)))}),this.objects.clear(),this.objectNamesToFactories.clear()},d(i,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(u){r.push(u.pm.promise)}),r}}]),i}()})(),module.exports=K})();
@@ -0,0 +1,5 @@
1
+ declare module '*.glsl' {
2
+ export default string;
3
+ }
4
+
5
+ declare module '*.scss';
@@ -0,0 +1,23 @@
1
+ interface Options {
2
+ isdev?: boolean;
3
+ }
4
+ export default class Chain {
5
+ options: Required<Options>;
6
+ index: number;
7
+ repeatCount: number;
8
+ repeatNum: number;
9
+ constructor(options?: Options);
10
+ isPlaying: boolean;
11
+ chainedList: (Function | Chain)[][];
12
+ children: Chain[];
13
+ start(): this | Promise<void>;
14
+ private stop1;
15
+ stop(): this;
16
+ dispose(): this;
17
+ private play;
18
+ chain(...args: (Function | Chain)[]): this;
19
+ repeat(number: number): this;
20
+ timeout(ms: number): this;
21
+ traverse(fn: (o: Chain) => void): void;
22
+ }
23
+ export {};
@@ -0,0 +1,2 @@
1
+ import * as THREE from 'three';
2
+ export default function colorCorrection(node: THREE.Mesh): void;