gl-draw 0.11.0 → 0.11.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.
@@ -1 +1 @@
1
- "use strict";const b=require("three"),p=require("esus-lite"),j=require("three/examples/jsm/renderers/CSS2DRenderer"),d=require("three/examples/jsm/renderers/CSS3DRenderer"),c=require("./disposeMesh.js");require("idb-keyval");require("d3-geo");require("d3-geo-projection");function f(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const i=f(b),u=(a,e,t)=>{e&&(c.disposeMesh(e,t),e.children.forEach(r=>{a.has(r)||u(a,r,t)}))};class m{constructor(){this.objectType="BaseObject",this.userData={},this.prefab=!1,this.isInstantiate=!1,this.pm=p.makePromiseCreator(),this.materialList={},this.useMaterialType="origin",this.onPointerIndex=[]}get parent(){const e=this.object3d.parent;return e?this.drawController.objMap.get(e)||this.pencil.scene:null}get children(){return this.object3d.children.map(e=>this.drawController.objMap.get(e)).filter(e=>!!e)}get position(){var e;return(e=this.object3d)==null?void 0:e.position}get rotation(){var e;return(e=this.object3d)==null?void 0:e.rotation}get scale(){var e;return(e=this.object3d)==null?void 0:e.scale}get add(){var e;return(e=this.object3d)==null?void 0:e.add.bind(this.object3d)}get remove(){var e;return(e=this.object3d)==null?void 0:e.remove.bind(this.object3d)}get visible(){return this.object3d?this.object3d.visible:!1}create(){}render(){}update(e,t){}resize(e,t){}show(){return this.object3d&&(this.object3d.visible=!0),this}hide(){return this.object3d&&(this.object3d.visible=!1),this}createMesh(...e){return this.object3d=new i.Mesh(...e),this}createGroup(){return this.object3d=new i.Group,this}createPoints(...e){return this.object3d=new i.Points(...e),this}createCSS2DObject(e){return this.object3d=new j.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new d.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new d.CSS3DSprite(e),this}createSprite(e){return this.object3d=new i.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d),this.drawController!==t.drawController&&(t.drawController.objects.delete(t.key),this.drawController.objects.set(t.key,t))}),this}getSize(){const e=new i.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new i.Vector3)}}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}clone(){return this.instantiate()}instantiate(e){return this.drawController.instantiate(this,{create:t=>{var r;if(this.object3d){if(this.object3d instanceof i.Sprite&&typeof e=="number"){const{size:s}=this.getSize(),n=new i.MeshBasicMaterial,o=["color","map","alphaMap","transparent","opacity","alphaTest","blending","side","depthTest","depthWrite"];for(const h of o){const l=this.object3d.material[h];l!==null&&(n[h]=l)}t.object3d=new i.Mesh(new i.PlaneGeometry(s.x,s.y,2,2),n)}else t.object3d=this.object3d.clone(!0);typeof e=="number"&&(t.object3d=new i.InstancedMesh(t.object3d.geometry,t.object3d.material,e),t.object3d.instanceMatrix.setUsage(i.DynamicDrawUsage)),t.position.set(0,0,0),t.rotation.set(0,0,0),t.setMaterialList("instantiate","clone"),t.useMaterial("instantiate"),t.object3d.userData.bloom&&((r=this.pencil.composerController)==null||r.toggleBloomSelection(t.object3d,!0)),t.object3d.userData.prefab&&(t.object3d.userData.prefab=!1)}}})}setInstancedMatrix(e){this.object3d instanceof i.InstancedMesh&&(Object.keys(e).forEach(t=>{this.object3d.setMatrixAt(Number(t),e[t])}),this.object3d.instanceMatrix.needsUpdate=!0,this.object3d.computeBoundingSphere())}erase(){this.drawController.erase(this)}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(r=>{const s=r.userData;r.userData={};const n=r.clone();return r.userData=s,n});{const r=t.userData;t.userData={};const s=t.clone();return t.userData=r,s}}setMaterialList(e,t,r=!0){const s=this.object3d;if(!s||!s.material)return;if(this.materialList.origin||(this.materialList.origin=s.material),this.materialList[e])if(r){const o=this.materialList[e];c.disposeMesh({material:o})}else return this.materialList[e];const n=t==="clone"?this.cloneMaterial():t;return this.materialList[e]=n,n}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}onPointerEvent(e,t){const r=this.drawController.handlePick([this],e,t);this.onPointerIndex.push(r)}dispose(e=!0){this.onPointerIndex.forEach(t=>{this.drawController.removePick(t)}),u(this.drawController.objMap,this.object3d,e),e&&Object.keys(this.materialList).forEach(t=>{if(t!==this.useMaterialType){if(this.isInstantiate&&t==="origin")return;c.disposeMesh({material:this.materialList[t]})}})}}exports.BaseObject=m;
1
+ "use strict";const b=require("three"),p=require("esus-lite"),j=require("three/examples/jsm/renderers/CSS2DRenderer"),u=require("three/examples/jsm/renderers/CSS3DRenderer"),c=require("./disposeMesh.js");require("idb-keyval");require("d3-geo");require("d3-geo-projection");function f(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const i=f(b),h=(a,e,t=!0)=>{e&&(c.disposeMesh(e,t),e.children.forEach(r=>{a.has(r)||h(a,r,t)}))};class m{constructor(){this.objectType="BaseObject",this.userData={},this.prefab=!1,this.isInstantiate=!1,this.pm=p.makePromiseCreator(),this.materialList={},this.useMaterialType="origin",this.onPointerIndex=[]}get parent(){const e=this.object3d.parent;return e?this.drawController.objMap.get(e)||this.pencil.scene:null}get children(){return this.object3d.children.map(e=>this.drawController.objMap.get(e)).filter(e=>!!e)}get position(){var e;return(e=this.object3d)==null?void 0:e.position}get rotation(){var e;return(e=this.object3d)==null?void 0:e.rotation}get scale(){var e;return(e=this.object3d)==null?void 0:e.scale}get add(){var e;return(e=this.object3d)==null?void 0:e.add.bind(this.object3d)}get remove(){var e;return(e=this.object3d)==null?void 0:e.remove.bind(this.object3d)}get visible(){return this.object3d?this.object3d.visible:!1}create(){}render(){}update(e,t){}resize(e,t){}show(){return this.object3d&&(this.object3d.visible=!0),this}hide(){return this.object3d&&(this.object3d.visible=!1),this}createMesh(...e){return this.object3d=new i.Mesh(...e),this}createGroup(){return this.object3d=new i.Group,this}createPoints(...e){return this.object3d=new i.Points(...e),this}createCSS2DObject(e){return this.object3d=new j.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new u.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new u.CSS3DSprite(e),this}createSprite(e){return this.object3d=new i.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d),this.drawController!==t.drawController&&(t.drawController.objects.delete(t.key),this.drawController.objects.set(t.key,t))}),this}getSize(){const e=new i.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new i.Vector3)}}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}clone(){return this.instantiate()}instantiate(e){return this.drawController.instantiate(this,{create:t=>{var r;if(this.object3d){if(this.object3d instanceof i.Sprite&&typeof e=="number"){const{size:s}=this.getSize(),n=new i.MeshBasicMaterial,o=["color","map","alphaMap","transparent","opacity","alphaTest","blending","side","depthTest","depthWrite"];for(const l of o){const d=this.object3d.material[l];d!==null&&(n[l]=d)}t.object3d=new i.Mesh(new i.PlaneGeometry(s.x,s.y,2,2),n)}else t.object3d=this.object3d.clone(!0);typeof e=="number"&&(t.object3d=new i.InstancedMesh(t.object3d.geometry,t.object3d.material,e),t.object3d.instanceMatrix.setUsage(i.DynamicDrawUsage)),t.position.set(0,0,0),t.rotation.set(0,0,0),t.setMaterialList("instantiate","clone"),t.useMaterial("instantiate"),t.object3d.userData.bloom&&((r=this.pencil.composerController)==null||r.toggleBloomSelection(t.object3d,!0)),t.object3d.userData.prefab&&(t.object3d.userData.prefab=!1)}}})}setInstancedMatrix(e){this.object3d instanceof i.InstancedMesh&&(Object.keys(e).forEach(t=>{this.object3d.setMatrixAt(Number(t),e[t])}),this.object3d.instanceMatrix.needsUpdate=!0,this.object3d.computeBoundingSphere())}erase(){this.drawController.erase(this)}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(r=>{const s=r.userData;r.userData={};const n=r.clone();return r.userData=s,n});{const r=t.userData;t.userData={};const s=t.clone();return t.userData=r,s}}setMaterialList(e,t,r=!0){const s=this.object3d;if(!s||!s.material)return;if(this.materialList.origin||(this.materialList.origin=s.material),this.materialList[e])if(r){const o=this.materialList[e];c.disposeMesh({material:o})}else return this.materialList[e];const n=t==="clone"?this.cloneMaterial():t;return this.materialList[e]=n,n}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}onPointerEvent(e,t){const r=this.drawController.handlePick([this],e,t);this.onPointerIndex.push(r)}dispose(){this.onPointerIndex.forEach(e=>{this.drawController.removePick(e)}),h(this.drawController.objMap,this.object3d),Object.keys(this.materialList).forEach(e=>{if(e!==this.useMaterialType){if(this.isInstantiate&&e==="origin")return;c.disposeMesh({material:this.materialList[e]})}})}disposeWithOutMaterial(){this.onPointerIndex.forEach(e=>{this.drawController.removePick(e)}),h(this.drawController.objMap,this.object3d,!1)}}exports.BaseObject=m;
@@ -1,17 +1,17 @@
1
1
  import * as r from "three";
2
2
  import { makePromiseCreator as b } from "esus-lite";
3
3
  import { CSS2DObject as u } from "three/examples/jsm/renderers/CSS2DRenderer";
4
- import { CSS3DObject as p, CSS3DSprite as m } from "three/examples/jsm/renderers/CSS3DRenderer";
4
+ import { CSS3DObject as p, CSS3DSprite as j } from "three/examples/jsm/renderers/CSS3DRenderer";
5
5
  import { d as c } from "./disposeMesh.module.js";
6
6
  import "idb-keyval";
7
7
  import "d3-geo";
8
8
  import "d3-geo-projection";
9
- const d = (o, t, e) => {
9
+ const h = (o, t, e = !0) => {
10
10
  t && (c(t, e), t.children.forEach((i) => {
11
- o.has(i) || d(o, i, e);
11
+ o.has(i) || h(o, i, e);
12
12
  }));
13
13
  };
14
- class C {
14
+ class D {
15
15
  constructor() {
16
16
  this.objectType = "BaseObject", this.userData = {}, this.prefab = !1, this.isInstantiate = !1, this.pm = b(), this.materialList = {}, this.useMaterialType = "origin", this.onPointerIndex = [];
17
17
  }
@@ -75,7 +75,7 @@ class C {
75
75
  return this.object3d = new p(t), this;
76
76
  }
77
77
  createCSS3DSprite(t) {
78
- return this.object3d = new m(t), this;
78
+ return this.object3d = new j(t), this;
79
79
  }
80
80
  createSprite(t) {
81
81
  return this.object3d = new r.Sprite(t), this;
@@ -119,9 +119,9 @@ class C {
119
119
  "depthTest",
120
120
  "depthWrite"
121
121
  ];
122
- for (const h of n) {
123
- const l = this.object3d.material[h];
124
- l !== null && (a[h] = l);
122
+ for (const l of n) {
123
+ const d = this.object3d.material[l];
124
+ d !== null && (a[l] = d);
125
125
  }
126
126
  e.object3d = new r.Mesh(
127
127
  new r.PlaneGeometry(s.x, s.y, 2, 2),
@@ -197,24 +197,25 @@ class C {
197
197
  const i = this.drawController.handlePick([this], t, e);
198
198
  this.onPointerIndex.push(i);
199
199
  }
200
- dispose(t = !0) {
201
- this.onPointerIndex.forEach((e) => {
202
- this.drawController.removePick(e);
203
- }), d(
204
- this.drawController.objMap,
205
- this.object3d,
206
- t
207
- ), t && Object.keys(this.materialList).forEach((e) => {
208
- if (e !== this.useMaterialType) {
209
- if (this.isInstantiate && e === "origin")
200
+ dispose() {
201
+ this.onPointerIndex.forEach((t) => {
202
+ this.drawController.removePick(t);
203
+ }), h(this.drawController.objMap, this.object3d), Object.keys(this.materialList).forEach((t) => {
204
+ if (t !== this.useMaterialType) {
205
+ if (this.isInstantiate && t === "origin")
210
206
  return;
211
207
  c({
212
- material: this.materialList[e]
208
+ material: this.materialList[t]
213
209
  });
214
210
  }
215
211
  });
216
212
  }
213
+ disposeWithOutMaterial() {
214
+ this.onPointerIndex.forEach((t) => {
215
+ this.drawController.removePick(t);
216
+ }), h(this.drawController.objMap, this.object3d, !1);
217
+ }
217
218
  }
218
219
  export {
219
- C as B
220
+ D as B
220
221
  };
@@ -59,7 +59,8 @@ export default class BaseObject {
59
59
  setTop(onTop: number): void;
60
60
  private onPointerIndex;
61
61
  onPointerEvent(type: PickFunctionsItem['type'], cb: PickFunctionsItem['cb']): void;
62
- dispose(disposeWithMaterial?: boolean): void;
62
+ dispose(): void;
63
+ disposeWithOutMaterial(): void;
63
64
  }
64
65
  export interface IBaseObject extends BaseObject {
65
66
  }
@@ -3,7 +3,7 @@ import CameraControls from './CameraControls';
3
3
  export interface ControlsParams {
4
4
  domElement: HTMLElement;
5
5
  }
6
- export declare const defaultControlParams: {};
6
+ export declare const defaultControlsParams: {};
7
7
  interface Options {
8
8
  camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
9
9
  controlsParams: ControlsParams;
@@ -78,7 +78,7 @@ export default class Pencil {
78
78
  stats: boolean;
79
79
  gui: boolean;
80
80
  helper: boolean;
81
- control: boolean;
81
+ controls: boolean;
82
82
  transformControls: boolean;
83
83
  resizeObserver: boolean;
84
84
  renderer: {
@@ -1,4 +1,4 @@
1
- "use strict";var O=Object.defineProperty;var P=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var W=Math.pow,z=(a,i,e)=>i in a?O(a,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[i]=e,c=(a,i)=>{for(var e in i||(i={}))_.call(i,e)&&z(a,e,i[e]);if(P)for(var e of P(i))T.call(i,e)&&z(a,e,i[e]);return a};var b=(a,i,e)=>new Promise((t,o)=>{var f=d=>{try{l(e.next(d))}catch(m){o(m)}},r=d=>{try{l(e.throw(d))}catch(m){o(m)}},l=d=>d.done?t(d.value):Promise.resolve(d.value).then(f,r);l((e=e.apply(a,i)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("three"),V=require("@tweenjs/tween.js"),D=require("esus-lite");function j(a){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(i,e,t.get?t:{enumerable:!0,get:()=>a[e]})}}return i.default=a,Object.freeze(i)}const u=j(A),C=j(V);class E{constructor(i,e={}){this.object=i,this.options=c({color:16777215,opacity:1,lineNum:10,lineWidth:1,lineHieght:10,fade:!1,fadeType:2,radius:0,range:new u.Vector2(0,1),vertical:!1,step:0,pos:"bottom",duration:5e3,yoyo:!1,repeat:0},e)}initMaterial(){const{color:i,lineNum:e,lineWidth:t,lineHieght:o,fade:f,fadeType:r,radius:l,range:d,vertical:m,step:g,opacity:w,exclude:p}=this.options,v={field:{value:new u.Vector4(0,0,0,0)},color:{value:new u.Color(i)},opacity:{value:w},lineNum:{value:e},lineWidth:{value:t},lineHieght:{value:o},sizeNum:{value:new u.Vector3(l,l,l)},objPos:{value:new u.Vector3(0,0,0)},fade:{value:f},fadeType:{value:r},range:{value:d},angle:{value:0},stepNum:{value:g}};if(!l){const{size:h}=this.object.getSize();v.sizeNum.value.copy(h)}this.uniforms=v,this.object.object3d.traverse(h=>{const n=h;!n.material||p&&p.includes(n)||(n.userData.materialO?n.material=n.userData.materialO.clone():n.userData.materialO=Array.isArray(n.material)?n.material.map(s=>s.clone()):n.material.clone(),Array.isArray(n.material)?n.material.forEach(s=>{m?this.setVerticalMaterial(s):this.setMaterial(s)}):m?this.setVerticalMaterial(n.material):this.setMaterial(n.material))})}setMaterial(i){const{uniforms:e}=this;i.onBeforeCompile=t=>{t.uniforms.field=e.field,t.uniforms.fieldColor=e.color,t.uniforms.fieldOpacity=e.opacity,t.uniforms.lineNum=e.lineNum,t.uniforms.lineWidth=e.lineWidth,t.uniforms.sizeNum=e.sizeNum,t.uniforms.fade=e.fade,t.uniforms.fadeType=e.fadeType,t.uniforms.range=e.range,t.uniforms.stepNum=e.stepNum,t.vertexShader=`
1
+ "use strict";var O=Object.defineProperty;var P=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var W=Math.pow,z=(a,i,e)=>i in a?O(a,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[i]=e,c=(a,i)=>{for(var e in i||(i={}))_.call(i,e)&&z(a,e,i[e]);if(P)for(var e of P(i))T.call(i,e)&&z(a,e,i[e]);return a};var b=(a,i,e)=>new Promise((t,o)=>{var f=d=>{try{r(e.next(d))}catch(m){o(m)}},l=d=>{try{r(e.throw(d))}catch(m){o(m)}},r=d=>d.done?t(d.value):Promise.resolve(d.value).then(f,l);r((e=e.apply(a,i)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("three"),V=require("@tweenjs/tween.js"),D=require("esus-lite");function j(a){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(i,e,t.get?t:{enumerable:!0,get:()=>a[e]})}}return i.default=a,Object.freeze(i)}const u=j(A),S=j(V);class E{constructor(i,e={}){this.object=i,this.options=c({color:16777215,opacity:1,lineNum:10,lineWidth:1,lineHieght:10,fade:!1,fadeType:2,radius:0,range:new u.Vector2(0,1),vertical:!1,step:0,pos:"bottom",duration:5e3,yoyo:!1,repeat:0},e)}initMaterial(){const{color:i,lineNum:e,lineWidth:t,lineHieght:o,fade:f,fadeType:l,radius:r,range:d,vertical:m,step:g,opacity:w,exclude:p}=this.options,v={field:{value:new u.Vector4(0,0,0,0)},color:{value:new u.Color(i)},opacity:{value:w},lineNum:{value:e},lineWidth:{value:t},lineHieght:{value:o},sizeNum:{value:new u.Vector3(r,r,r)},objPos:{value:new u.Vector3(0,0,0)},fade:{value:f},fadeType:{value:l},range:{value:d},angle:{value:0},stepNum:{value:g}};if(!r){const{size:h}=this.object.getSize();v.sizeNum.value.copy(h)}this.uniforms=v,this.object.object3d.traverse(h=>{const n=h;!n.material||p&&p.includes(n)||(n.userData.materialO?n.material=n.userData.materialO.clone():n.userData.materialO=Array.isArray(n.material)?n.material.map(s=>s.clone()):n.material.clone(),Array.isArray(n.material)?n.material.forEach(s=>{m?this.setVerticalMaterial(s):this.setMaterial(s)}):m?this.setVerticalMaterial(n.material):this.setMaterial(n.material))})}setMaterial(i){const{uniforms:e}=this;i.onBeforeCompile=t=>{t.uniforms.field=e.field,t.uniforms.fieldColor=e.color,t.uniforms.fieldOpacity=e.opacity,t.uniforms.lineNum=e.lineNum,t.uniforms.lineWidth=e.lineWidth,t.uniforms.sizeNum=e.sizeNum,t.uniforms.fade=e.fade,t.uniforms.fadeType=e.fadeType,t.uniforms.range=e.range,t.uniforms.stepNum=e.stepNum,t.vertexShader=`
2
2
  varying vec4 vWorldPos;
3
3
  ${t.vertexShader}
4
4
  `.replace("#include <worldpos_vertex>",`#include <worldpos_vertex>
@@ -125,7 +125,7 @@
125
125
  }
126
126
  }
127
127
 
128
- `)},i.needsUpdate=!0}resetMaterial(){this.object.object3d.traverse(i=>{const e=i;e.material&&e.userData.materialO&&(e.material=e.userData.materialO.clone(),e.userData.materialO=void 0)})}play(i={}){this.stop();const e=D.makePromiseCreator(!0),{object:t,uniforms:o}=this,{lineNum:f,step:r,lineWidth:l,pos:d,duration:m}=c(c({},this.options),i),{min:g,max:w,size:p}=t.getSize();let v=f,h=l;r>0&&(v=1,h=p.y/r);const n=o.sizeNum.value.y*(v>1?2:1);return this.tween=new C.Tween({latest:0}).to({latest:1},m).onStart(()=>{const s=new u.Vector3;d==="bottom"?s.set(g.x-.001,g.y-.001,g.z-.001):d==="top"&&s.set(w.x+.001,w.y+.001,w.z+.001);const x=t.pencil.cameraControls.azimuthAngle||0,y=this.object.object3d.position.clone();if(x){const N=Math.sqrt(W(p.x,2)+W(p.z,2))/2;s.x=y.x+N,s.z=y.z+N;const M=new u.Vector3().subVectors(s,y),S=new u.Vector3(0,1,0);M.applyAxisAngle(S,x),s.addVectors(y,M)}o.objPos.value.copy(y),o.field.value.set(s.x,s.y,s.z,0),o.angle.value=x,o.lineNum.value=v,o.lineWidth.value=h}).onUpdate(({latest:s})=>{r>0?o.field.value.w=Math.floor(s*r)/r*n:o.field.value.w=s*n}).onStop(()=>{o.field.value.w=0,e.reject("stop")}).onComplete(()=>{e.resolve()}).start(),e.promise}checkRepeat(){return b(this,arguments,function*(i={}){const{yoyo:e,repeat:t,pos:o}=c(c({},this.options),i);t===this.options.repeat&&this.initMaterial();const{err:f}=yield this.play(i);if(f){this.resetMaterial();return}if(t){let r=o;e&&(r=r==="bottom"?"top":"bottom"),yield this.checkRepeat({pos:r,repeat:t===1/0?-1:t-1})}else this.resetMaterial()})}start(){return this.checkRepeat()}stop(){this.tween&&this.tween.stop()}}class k{constructor(i,e={}){this.object=i,this.options=c({color:16777215,lineWidth:2,opacity:.5,fade:!1,position:new u.Vector3(0,0,0),duration:5e3,repeat:0},e)}initMaterial(){const{exclude:i}=this.options,e={field:{value:new u.Vector4(0,0,0,1e-4)},color:{value:new u.Color(this.options.color)},opacity:{value:this.options.opacity},lineWidth:{value:this.options.lineWidth}};this.uniforms=e,this.object.object3d.traverse(t=>{const o=t;!o.material||i&&i.includes(o)||(o.userData.materialO?o.material=o.userData.materialO:o.userData.materialO=Array.isArray(o.material)?o.material.map(f=>f.clone()):o.material.clone(),Array.isArray(o.material)?o.material.forEach(f=>{this.setMaterial(f)}):this.setMaterial(o.material))})}setMaterial(i){const{uniforms:e}=this;i.onBeforeCompile=t=>{t.uniforms.field=e.field,t.uniforms.fieldColor=e.color,t.uniforms.fieldOpacity=e.opacity,t.uniforms.lineWidth=e.lineWidth,t.vertexShader=`
128
+ `)},i.needsUpdate=!0}resetMaterial(){this.object.object3d.traverse(i=>{const e=i;e.material&&e.userData.materialO&&(e.material=e.userData.materialO.clone(),e.userData.materialO=void 0)})}play(i={}){this.stop();const e=D.makePromiseCreator(!0),{object:t,uniforms:o}=this,{lineNum:f,step:l,lineWidth:r,pos:d,duration:m}=c(c({},this.options),i),{min:g,max:w,size:p}=t.getSize();let v=f,h=r;l>0&&(v=1,h=p.y/l);const n=o.sizeNum.value.y*(v>1?2:1);return this.tween=new S.Tween({latest:0}).to({latest:1},m).onStart(()=>{const s=new u.Vector3;d==="bottom"?s.set(g.x-.001,g.y-.001,g.z-.001):d==="top"&&s.set(w.x+.001,w.y+.001,w.z+.001);const x=t.pencil.controls.azimuthAngle||0,y=this.object.object3d.position.clone();if(x){const N=Math.sqrt(W(p.x,2)+W(p.z,2))/2;s.x=y.x+N,s.z=y.z+N;const M=new u.Vector3().subVectors(s,y),C=new u.Vector3(0,1,0);M.applyAxisAngle(C,x),s.addVectors(y,M)}o.objPos.value.copy(y),o.field.value.set(s.x,s.y,s.z,0),o.angle.value=x,o.lineNum.value=v,o.lineWidth.value=h}).onUpdate(({latest:s})=>{l>0?o.field.value.w=Math.floor(s*l)/l*n:o.field.value.w=s*n}).onStop(()=>{o.field.value.w=0,e.reject("stop")}).onComplete(()=>{e.resolve()}).start(),e.promise}checkRepeat(){return b(this,arguments,function*(i={}){const{yoyo:e,repeat:t,pos:o}=c(c({},this.options),i);t===this.options.repeat&&this.initMaterial();const{err:f}=yield this.play(i);if(f){this.resetMaterial();return}if(t){let l=o;e&&(l=l==="bottom"?"top":"bottom"),yield this.checkRepeat({pos:l,repeat:t===1/0?-1:t-1})}else this.resetMaterial()})}start(){return this.checkRepeat()}stop(){this.tween&&this.tween.stop()}}class k{constructor(i,e={}){this.object=i,this.options=c({color:16777215,lineWidth:2,opacity:.5,fade:!1,position:new u.Vector3(0,0,0),duration:5e3,repeat:0},e)}initMaterial(){const{exclude:i}=this.options,e={field:{value:new u.Vector4(0,0,0,1e-4)},color:{value:new u.Color(this.options.color)},opacity:{value:this.options.opacity},lineWidth:{value:this.options.lineWidth}};this.uniforms=e,this.object.object3d.traverse(t=>{const o=t;!o.material||i&&i.includes(o)||(o.userData.materialO?o.material=o.userData.materialO:o.userData.materialO=Array.isArray(o.material)?o.material.map(f=>f.clone()):o.material.clone(),Array.isArray(o.material)?o.material.forEach(f=>{this.setMaterial(f)}):this.setMaterial(o.material))})}setMaterial(i){const{uniforms:e}=this;i.onBeforeCompile=t=>{t.uniforms.field=e.field,t.uniforms.fieldColor=e.color,t.uniforms.fieldOpacity=e.opacity,t.uniforms.lineWidth=e.lineWidth,t.vertexShader=`
129
129
  varying vec4 vWorldPos;
130
130
  ${t.vertexShader}
131
131
  `.replace("#include <worldpos_vertex>",`#include <worldpos_vertex>
@@ -157,4 +157,4 @@
157
157
  }
158
158
  gl_FragColor.rgb = mix(gl_FragColor.rgb, fieldColor, fadeout);
159
159
 
160
- `)},i.needsUpdate=!0}resetMaterial(){this.object.object3d.traverse(i=>{const e=i;e.material&&e.userData.materialO&&(e.material=e.userData.materialO.clone(),e.userData.materialO=void 0)})}play(){this.stop();const i=D.makePromiseCreator(!0),{object:e,uniforms:t}=this,{position:o,duration:f}=this.options;let{radius:r}=this.options;if(!r){const{size:l}=e.getSize();r=Math.max(l.x,l.y,l.z)}return this.tween=new C.Tween({a:1e-4}).to({a:1},f).onStart(()=>{t.field.value.set(o.x,o.y,o.z,1e-4),this.options.fade&&(t.opacity.value=this.options.opacity)}).onUpdate(({a:l})=>{t.field.value.w=l*r,this.options.fade&&(t.opacity.value=(1-l)*this.options.opacity)}).onStop(()=>{t.field.value.w=0,i.reject("stop")}).onComplete(()=>{i.resolve()}).start(),i.promise}checkRepeat(){return b(this,arguments,function*(i={}){const{repeat:e}=c(c({},this.options),i);e===this.options.repeat&&this.initMaterial();const{err:t}=yield this.play();if(t){this.resetMaterial();return}e?yield this.checkRepeat({repeat:e===1/0?-1:e-1}):this.resetMaterial()})}start(){return this.checkRepeat()}stop(){this.tween&&this.tween.stop()}}exports.Scan=E;exports.Scan2=k;
160
+ `)},i.needsUpdate=!0}resetMaterial(){this.object.object3d.traverse(i=>{const e=i;e.material&&e.userData.materialO&&(e.material=e.userData.materialO.clone(),e.userData.materialO=void 0)})}play(){this.stop();const i=D.makePromiseCreator(!0),{object:e,uniforms:t}=this,{position:o,duration:f}=this.options;let{radius:l}=this.options;if(!l){const{size:r}=e.getSize();l=Math.max(r.x,r.y,r.z)}return this.tween=new S.Tween({a:1e-4}).to({a:1},f).onStart(()=>{t.field.value.set(o.x,o.y,o.z,1e-4),this.options.fade&&(t.opacity.value=this.options.opacity)}).onUpdate(({a:r})=>{t.field.value.w=r*l,this.options.fade&&(t.opacity.value=(1-r)*this.options.opacity)}).onStop(()=>{t.field.value.w=0,i.reject("stop")}).onComplete(()=>{i.resolve()}).start(),i.promise}checkRepeat(){return b(this,arguments,function*(i={}){const{repeat:e}=c(c({},this.options),i);e===this.options.repeat&&this.initMaterial();const{err:t}=yield this.play();if(t){this.resetMaterial();return}e?yield this.checkRepeat({repeat:e===1/0?-1:e-1}):this.resetMaterial()})}start(){return this.checkRepeat()}stop(){this.tween&&this.tween.stop()}}exports.Scan=E;exports.Scan2=k;
@@ -27,7 +27,7 @@ var N = (d, i, e) => new Promise((t, o) => {
27
27
  });
28
28
  import * as u from "three";
29
29
  import * as D from "@tweenjs/tween.js";
30
- import { makePromiseCreator as C } from "esus-lite";
30
+ import { makePromiseCreator as j } from "esus-lite";
31
31
  class V {
32
32
  constructor(i, e = {}) {
33
33
  this.object = i, this.options = c({
@@ -261,7 +261,7 @@ class V {
261
261
  }
262
262
  play(i = {}) {
263
263
  this.stop();
264
- const e = C(!0), { object: t, uniforms: o } = this, { lineNum: n, step: a, lineWidth: l, pos: f, duration: m } = c(c({}, this.options), i), { min: g, max: w, size: p } = t.getSize();
264
+ const e = j(!0), { object: t, uniforms: o } = this, { lineNum: n, step: a, lineWidth: l, pos: f, duration: m } = c(c({}, this.options), i), { min: g, max: w, size: p } = t.getSize();
265
265
  let v = n, h = l;
266
266
  a > 0 && (v = 1, h = p.y / a);
267
267
  const s = o.sizeNum.value.y * (v > 1 ? 2 : 1);
@@ -275,12 +275,12 @@ class V {
275
275
  ).onStart(() => {
276
276
  const r = new u.Vector3();
277
277
  f === "bottom" ? r.set(g.x - 1e-3, g.y - 1e-3, g.z - 1e-3) : f === "top" && r.set(w.x + 1e-3, w.y + 1e-3, w.z + 1e-3);
278
- const x = t.pencil.cameraControls.azimuthAngle || 0, y = this.object.object3d.position.clone();
278
+ const x = t.pencil.controls.azimuthAngle || 0, y = this.object.object3d.position.clone();
279
279
  if (x) {
280
280
  const b = Math.sqrt(W(p.x, 2) + W(p.z, 2)) / 2;
281
281
  r.x = y.x + b, r.z = y.z + b;
282
- const M = new u.Vector3().subVectors(r, y), j = new u.Vector3(0, 1, 0);
283
- M.applyAxisAngle(j, x), r.addVectors(y, M);
282
+ const M = new u.Vector3().subVectors(r, y), C = new u.Vector3(0, 1, 0);
283
+ M.applyAxisAngle(C, x), r.addVectors(y, M);
284
284
  }
285
285
  o.objPos.value.copy(y), o.field.value.set(r.x, r.y, r.z, 0), o.angle.value = x, o.lineNum.value = v, o.lineWidth.value = h;
286
286
  }).onUpdate(({ latest: r }) => {
@@ -395,7 +395,7 @@ class k {
395
395
  }
396
396
  play() {
397
397
  this.stop();
398
- const i = C(!0), { object: e, uniforms: t } = this, { position: o, duration: n } = this.options;
398
+ const i = j(!0), { object: e, uniforms: t } = this, { position: o, duration: n } = this.options;
399
399
  let { radius: a } = this.options;
400
400
  if (!a) {
401
401
  const { size: l } = e.getSize();
package/dist/index.js CHANGED
@@ -91,4 +91,4 @@
91
91
  gl_FragColor = ( base_color + vec4( 1.0 ) * bloom_color );
92
92
  }
93
93
  }
94
- `,defines:{}}),"baseTexture");return t.needsSwap=!0,t},Nt=1,ut=!1,cs=new P.MeshBasicMaterial({color:"black"}),ds=new P.SpriteMaterial({color:"black",sizeAttenuation:!0}),ms=new P.SpriteMaterial({color:"black",sizeAttenuation:!1}),ps={threshold:0,strength:.4,radius:.1,bloomAlphaType:0},_s={multisampling:4,premultiplieAlpha:!1};class us{constructor(t){this.bloomComposerActive=!1,this.active=!0,this.bloomSelection=new Set,this.bloomLayer=new P.Layers,this.bloomMaterials={},this.bloomVisible={},this.options=t;const{renderer:e,scene:s,camera:i,composerParams:r}=t,{multisampling:o}=r,{maxSamples:a}=e.capabilities,l=e.getDrawingBufferSize(new P.Vector2),m=new P.WebGLRenderTarget(l.width,l.height,{samples:Math.min(o,a),type:P.HalfFloatType}),E=new Ae.RenderPass(s,i),_=new qt.EffectComposer(e,m);_.addPass(E),this.renderer=e,this.scene=s,this.camera=i,this.finalComposer=_,this.renderPass=E;const C=e.getSize(new P.Vector2);this.setSize(C.width,C.height)}setRenderPassCamera(t){this.renderPass.camera=t}resetRenderPassCamera(){this.renderPass.camera=this.camera}addOutputPass(){const{premultiplieAlpha:t}=this.options.composerParams,e=new hs;this.outputPass=e,this.setPremultiplieAlpha(t),this.finalComposer.addPass(e)}setPremultiplieAlpha(t){this.outputPass&&(this.outputPass.uniforms.premultiplieAlpha.value=t?1:0)}addBloomPass(t){const{renderer:e}=this,{threshold:s,strength:i,radius:r,bloomAlphaType:o}=t,a=new ze.UnrealBloomPass(new P.Vector2(window.innerWidth,window.innerHeight),i,r,s);this.bloomPass=a;const l=new qt.EffectComposer(e);l.renderToScreen=!1,l.addPass(this.renderPass),l.addPass(a),this.bloomComposer=l;const m=ls(l);m.uniforms.bloomAlphaType.value=o,this.bloomComposer=l,this.finalComposer.addPass(m),this.mixPass=m,this.bloomLayer.set(Nt)}addBloomGui(t){if(!this.bloomComposer)return;new Gt({bloom:{threshold:{min:0,max:1,step:.01,target:()=>this.bloomPass},radius:{min:0,max:1,step:.001,target:()=>this.bloomPass},strength:{min:0,max:10,step:.001,target:()=>this.bloomPass}}}).showGui(t)}toggleBloomSelection(t,e){if(!this.bloomComposer){console.warn("err:pencil.options.bloom");return}const{object3d:s}=t;if(!s)return;let i=e;e===void 0&&(i=!this.bloomSelection.has(s)),i?(this.bloomSelection.add(s),s.layers.enable(Nt)):(this.bloomSelection.delete(s),s.layers.disable(Nt)),this.bloomSelection.size===0?this.bloomComposerActive=!1:this.bloomComposerActive=!0}enable(){this.active||(this.active=!0)}disable(){this.active&&(this.active=!1)}setSize(t,e){var s;(s=this.bloomComposer)==null||s.setSize(t,e),this.finalComposer.setSize(t,e)}setPixelRatio(t){var e;(e=this.bloomComposer)==null||e.setPixelRatio(t),this.finalComposer.setPixelRatio(t)}darkenNonBloomed(){const t=[],e=[];this.scene.children.forEach(s=>{s.isTransformControls||s.isTransformControlsRoot||s.type==="RectAreaLightHelper"?t.push(s):e.push(s)}),t.forEach(s=>{this.bloomVisible[s.uuid]=s.visible,s.visible=!1}),e.forEach(s=>{s.traverse(i=>{const r=i,o=i;r.material&&this.bloomLayer.test(r.layers)===!1&&(this.bloomMaterials[r.uuid]=r.material,o.isSprite?o.material.sizeAttenuation?o.material=ds:o.material=ms:r.material=cs)})})}restoreNonBloomed(){this.scene.traverse(t=>{const e=t;this.bloomMaterials[e.uuid]?(e.material=this.bloomMaterials[e.uuid],delete this.bloomMaterials[e.uuid]):this.bloomVisible[e.uuid]!==void 0&&(e.visible=this.bloomVisible[e.uuid],delete this.bloomVisible[e.uuid])})}render(){this.active&&(this.bloomComposerActive&&this.bloomComposer?(this.mixPass.enabled=!0,this.darkenNonBloomed(),this.bloomComposer.render(),this.restoreNonBloomed()):this.mixPass&&(this.mixPass.enabled=!1),this.finalComposer.render())}render2(){this.active}dispose(){var t;this.bloomMaterials={},this.bloomVisible={},this.bloomSelection.clear(),this.finalComposer.dispose(),(t=this.bloomComposer)==null||t.dispose()}}const At=class At{constructor(t,e){this.raycaster=new P.Raycaster,this.installPlugins=new Map,this._cameraPositon=new P.Vector3,this._cameraTarget=new P.Vector3,this.event=new pe.eventsExports.EventEmitter,this.clock=new P.Clock,this.userData={},this.pipViewportState=!1,this.options=Oe(At.options,t,{isMergeableObject:Ie.isPlainObject}),this.event.setMaxListeners(1/0);const{container:s,stats:i,gui:r,resizeObserver:o}=this.options;if(r){const a=new xe;a.open(!1),this.gui=a}if(this.init(),i){const a=new ve({horizontal:!1});a.init(this.renderer),a.dom.style.position="absolute",s.appendChild(a.dom),this.stats=a}this.options.WebGPUTHREE||this.initComposer(),this.initCSSRenderer(),this.initControls(),o&&this.initResizeObserver(),this.clock.getDelta(),this.clock.getElapsedTime(),e&&(Array.isArray(e)||(e=[e]),e.forEach(a=>{Array.isArray(a)||(a=[a]),this.use(a[0],a[1])}))}getPlugin(t){return this.installPlugins.get(t)}get renderer(){return this.rendererController.renderer}get maxAnisotropy(){return this.options.WebGPUTHREE?0:this.renderer.capabilities.getMaxAnisotropy()}get controls(){return this.controlsController.cameraControls}get cameraPositon(){return this.controls.getPosition(this._cameraPositon,!1)}get cameraTarget(){return this.controls.getTarget(this._cameraTarget,!1)}get camera(){return this.cameraController.camera}get scene(){return this.sceneController.scene}use(t,...e){this.installPlugins.has(t.pluginName)?console.log("plugin already installed"):typeof t.install=="function"&&(t.install(this,...e),this.installPlugins.set(t.pluginName,t))}init(){const{container:t,isdev:e,WebGPUTHREE:s,helper:i,renderer:r,scene:o,camera:a,controls:l}=this.options,{width:m,height:E}=this.getSize(),_=new Ge({isdev:e,width:m,height:E,cameraParams:a,cameraControls:l===!0});this.gui&&_.setGui(this.gui);const C=_.camera,y=new Qe({camera:C,sceneParams:o}),b=y.scene,u=s?new Be({width:m,height:E,scene:b,camera:C,isdev:e,renderer:s.WebGPURenderer,rendererParams:Ze}):new ke({width:m,height:E,scene:b,camera:C,isdev:e,rendererParams:zt(it({},r),{antialias:!1})});if(i){const O=new je({scene:b});O.add(b),this.helperController=O}this.sceneController=y,this.rendererController=u,this.cameraController=_,t.appendChild(u.renderer.domElement)}initComposer(){const{bloom:t,bloomParams:e,composer:s}=this.options,i=new us({renderer:this.renderer,scene:this.scene,camera:this.camera,composerParams:s});this.composerController=i,t&&(i.addBloomPass(it({},e)),this.gui&&i.addBloomGui(this.gui)),i.addOutputPass()}initCSSRenderer(){const{container:t,css2DRenderer:e,css3DRenderer:s,css2DRendererParams:i,css3DRendererParams:r}=this.options;if(e||s){const o=new ns(t);e&&o.addRenderer("css2d",i),s&&o.addRenderer("css3d",r),this.cssRendererController=o}}initControls(){const{controls:t,controlsParams:e,transformControls:s}=this.options;if(t){const i=new qe({camera:this.camera,controlsParams:{domElement:(e==null?void 0:e.domElement)||this.renderer.domElement},customControls:typeof t=="boolean"?void 0:t});this.controlsController=i}if(s){const i=new rs({camera:this.camera,renderer:this.renderer,scene:this.scene});i.event.on("mouseDown",()=>{var r;(r=this.controlsController)==null||r.disable()}),i.event.on("mouseUp",()=>{var r;(r=this.controlsController)==null||r.enable()}),this.transformController=i}}getSize(){const{container:t}=this.options;return{width:t.offsetWidth,height:t.offsetHeight}}initResizeObserver(){const{container:t}=this.options;if(this.resizeObserver)return;const e=this.getSize(),s=new ResizeObserver(i=>{for(const r of i){const o=r.contentRect;(o.width!==e.width||o.height!==e.height)&&(e.width=o.width,e.height=o.height,this.handeleResize(o.width,o.height),this.render())}});s.observe(t),this.resizeObserver=s}handeleResize(t,e,s=!0){const{rendererController:i,cameraController:r,composerController:o,cssRendererController:a}=this;r==null||r.setSize(t,e),i==null||i.setSize(t,e),o==null||o.setSize(t,e),a==null||a.setSize(t,e),this.installPlugins.forEach(l=>{var m;(m=l.setSize)==null||m.call(l,t,e)}),s&&this.event.emit("resize",{width:t,height:e})}setDevicePixelRatio(t){var e;this.rendererController.setPixelRatio(t),(e=this.composerController)==null||e.setPixelRatio(t)}pick(t,e,s=!0){const{raycaster:i,options:r}=this,{container:o}=r,a=new P.Vector2,l=o.getBoundingClientRect();if(a.x=(t.clientX-l.left)/(l.right-l.left)*2-1,a.y=-((t.clientY-l.top)/(l.bottom-l.top))*2+1,this.camera&&this.scene){i.setFromCamera(a,this.camera);const m=i.intersectObjects(e||this.scene.children,s);if(m.length)return{object:m[0].object,intersects:m}}}render(){var o,a,l,m,E,_;const{scene:t,camera:e,clock:s}=this,i=s.getDelta(),r=s.getElapsedTime();Wt.update(),(o=this.controlsController)==null||o.update(i),this.installPlugins.forEach(C=>{var y;(y=C.update)==null||y.call(C,i,r)}),(a=this.helperController)==null||a.update(),(l=this.composerController)!=null&&l.active?this.cameraController.camera2?(this.composerController.resetRenderPassCamera(),this.setViewportFull(),this.composerController.render(),this.pipViewportState&&(this.setViewportPip(),this.composerController.setRenderPassCamera(this.cameraController.camera2),this.composerController.render())):this.composerController.render():(m=this.rendererController)==null||m.render(),(E=this.cssRendererController)==null||E.render(t,e),(_=this.stats)==null||_.update(),this.event.emit("render",{delta:i,elapsed:r})}start(){this.renderer.setAnimationLoop(this.render.bind(this)),this.event.emit("start")}stop(){this.renderer.setAnimationLoop(null),this.event.emit("stop")}autoRotate(t){this.controlsController.autoRotateSpeed=t}showPipViewport(t){if(t===!0){const e=this.getSize(),s=240,i=s/e.width,r=s/e.height,o=1-i,a=1-r;t={left:o,top:a,width:i,height:r}}if(this.pipViewportState=t,t){if(this.controlsController.cameraControls2)this.controlsController.cameraControls2.enabled=!0,this.cameraController.camera2.position.copy(this.cameraController.camera.position);else{const e=this.cameraController.addCamera2();this.controlsController.addCameraControls2(e)}this.controlsController.cameraControls2.interactiveArea=new DOMRect(t.left,t.top,t.width,t.height)}else this.controlsController.cameraControls2&&(this.controlsController.cameraControls2.enabled=!1)}setViewportFull(){const t=this.getSize(),e=0,s=0,i=t.width,r=t.height,o=i/r;this.camera.aspect!==o&&(this.camera.aspect=o,this.camera.updateProjectionMatrix()),this.renderer.setViewport(e,s,i,r),this.renderer.setScissor(e,s,i,r),this.renderer.setScissorTest(!0)}setViewportPip(){if(!this.pipViewportState)return;const t=this.pipViewportState,e=this.getSize(),s=e.width*t.left,i=(1-(t.top+t.height))*e.height,r=e.width*t.width,o=e.height*t.height,a=r/o,l=this.cameraController.camera2;l&&l.aspect!==a&&(l.aspect=a,l.updateProjectionMatrix()),this.renderer.setViewport(s,i,r,o),this.renderer.setScissor(s,i,r,o),this.renderer.setScissorTest(!0)}dispose(){var t,e,s,i,r,o,a,l,m,E,_;this.stop(),Wt.removeAll(),this.event.removeAllListeners(),(t=this.resizeObserver)==null||t.unobserve(this.options.container),this.installPlugins.forEach(C=>{var y;(y=C.dispose)==null||y.call(C)}),(e=this.controlsController)==null||e.dispose(),(s=this.transformController)==null||s.dispose(),(i=this.cssRendererController)==null||i.dispose(),(r=this.sceneController)==null||r.dispose(),(o=this.helperController)==null||o.dispose(),(a=this.composerController)==null||a.dispose(),(l=this.rendererController)==null||l.dispose(),this.cssRendererController=void 0,(m=this.gui)==null||m.destroy(),this.installPlugins.clear(),(E=this.stats)==null||E.dom.remove(),(_=this.renderer)==null||_.domElement.remove()}};At.options={isdev:ut,stats:ut,gui:ut,helper:ut,control:!0,transformControls:ut,resizeObserver:!0,renderer:Ve,composer:_s,scene:Xe,camera:Ne,bloom:!1,bloomParams:ps,css2DRenderer:!1,css2DRendererParams:it({},me),css3DRenderer:!1,css3DRendererParams:it({},me)};let Dt=At;const fs=J.ACTION;exports.BaseObject=Fe.BaseObject;exports.GUIObject=Gt;exports.Pencil=Dt;exports.cameraControlsAction=fs;exports.default=Dt;
94
+ `,defines:{}}),"baseTexture");return t.needsSwap=!0,t},Nt=1,ut=!1,cs=new P.MeshBasicMaterial({color:"black"}),ds=new P.SpriteMaterial({color:"black",sizeAttenuation:!0}),ms=new P.SpriteMaterial({color:"black",sizeAttenuation:!1}),ps={threshold:0,strength:.4,radius:.1,bloomAlphaType:0},_s={multisampling:4,premultiplieAlpha:!1};class us{constructor(t){this.bloomComposerActive=!1,this.active=!0,this.bloomSelection=new Set,this.bloomLayer=new P.Layers,this.bloomMaterials={},this.bloomVisible={},this.options=t;const{renderer:e,scene:s,camera:i,composerParams:r}=t,{multisampling:o}=r,{maxSamples:a}=e.capabilities,l=e.getDrawingBufferSize(new P.Vector2),m=new P.WebGLRenderTarget(l.width,l.height,{samples:Math.min(o,a),type:P.HalfFloatType}),E=new Ae.RenderPass(s,i),_=new qt.EffectComposer(e,m);_.addPass(E),this.renderer=e,this.scene=s,this.camera=i,this.finalComposer=_,this.renderPass=E;const C=e.getSize(new P.Vector2);this.setSize(C.width,C.height)}setRenderPassCamera(t){this.renderPass.camera=t}resetRenderPassCamera(){this.renderPass.camera=this.camera}addOutputPass(){const{premultiplieAlpha:t}=this.options.composerParams,e=new hs;this.outputPass=e,this.setPremultiplieAlpha(t),this.finalComposer.addPass(e)}setPremultiplieAlpha(t){this.outputPass&&(this.outputPass.uniforms.premultiplieAlpha.value=t?1:0)}addBloomPass(t){const{renderer:e}=this,{threshold:s,strength:i,radius:r,bloomAlphaType:o}=t,a=new ze.UnrealBloomPass(new P.Vector2(window.innerWidth,window.innerHeight),i,r,s);this.bloomPass=a;const l=new qt.EffectComposer(e);l.renderToScreen=!1,l.addPass(this.renderPass),l.addPass(a),this.bloomComposer=l;const m=ls(l);m.uniforms.bloomAlphaType.value=o,this.bloomComposer=l,this.finalComposer.addPass(m),this.mixPass=m,this.bloomLayer.set(Nt)}addBloomGui(t){if(!this.bloomComposer)return;new Gt({bloom:{threshold:{min:0,max:1,step:.01,target:()=>this.bloomPass},radius:{min:0,max:1,step:.001,target:()=>this.bloomPass},strength:{min:0,max:10,step:.001,target:()=>this.bloomPass}}}).showGui(t)}toggleBloomSelection(t,e){if(!this.bloomComposer){console.warn("err:pencil.options.bloom");return}const{object3d:s}=t;if(!s)return;let i=e;e===void 0&&(i=!this.bloomSelection.has(s)),i?(this.bloomSelection.add(s),s.layers.enable(Nt)):(this.bloomSelection.delete(s),s.layers.disable(Nt)),this.bloomSelection.size===0?this.bloomComposerActive=!1:this.bloomComposerActive=!0}enable(){this.active||(this.active=!0)}disable(){this.active&&(this.active=!1)}setSize(t,e){var s;(s=this.bloomComposer)==null||s.setSize(t,e),this.finalComposer.setSize(t,e)}setPixelRatio(t){var e;(e=this.bloomComposer)==null||e.setPixelRatio(t),this.finalComposer.setPixelRatio(t)}darkenNonBloomed(){const t=[],e=[];this.scene.children.forEach(s=>{s.isTransformControls||s.isTransformControlsRoot||s.type==="RectAreaLightHelper"?t.push(s):e.push(s)}),t.forEach(s=>{this.bloomVisible[s.uuid]=s.visible,s.visible=!1}),e.forEach(s=>{s.traverse(i=>{const r=i,o=i;r.material&&this.bloomLayer.test(r.layers)===!1&&(this.bloomMaterials[r.uuid]=r.material,o.isSprite?o.material.sizeAttenuation?o.material=ds:o.material=ms:r.material=cs)})})}restoreNonBloomed(){this.scene.traverse(t=>{const e=t;this.bloomMaterials[e.uuid]?(e.material=this.bloomMaterials[e.uuid],delete this.bloomMaterials[e.uuid]):this.bloomVisible[e.uuid]!==void 0&&(e.visible=this.bloomVisible[e.uuid],delete this.bloomVisible[e.uuid])})}render(){this.active&&(this.bloomComposerActive&&this.bloomComposer?(this.mixPass.enabled=!0,this.darkenNonBloomed(),this.bloomComposer.render(),this.restoreNonBloomed()):this.mixPass&&(this.mixPass.enabled=!1),this.finalComposer.render())}render2(){this.active}dispose(){var t;this.bloomMaterials={},this.bloomVisible={},this.bloomSelection.clear(),this.finalComposer.dispose(),(t=this.bloomComposer)==null||t.dispose()}}const At=class At{constructor(t,e){this.raycaster=new P.Raycaster,this.installPlugins=new Map,this._cameraPositon=new P.Vector3,this._cameraTarget=new P.Vector3,this.event=new pe.eventsExports.EventEmitter,this.clock=new P.Clock,this.userData={},this.pipViewportState=!1,this.options=Oe(At.options,t,{isMergeableObject:Ie.isPlainObject}),this.event.setMaxListeners(1/0);const{container:s,stats:i,gui:r,resizeObserver:o}=this.options;if(r){const a=new xe;a.open(!1),this.gui=a}if(this.init(),i){const a=new ve({horizontal:!1});a.init(this.renderer),a.dom.style.position="absolute",s.appendChild(a.dom),this.stats=a}this.options.WebGPUTHREE||this.initComposer(),this.initCSSRenderer(),this.initControls(),o&&this.initResizeObserver(),this.clock.getDelta(),this.clock.getElapsedTime(),e&&(Array.isArray(e)||(e=[e]),e.forEach(a=>{Array.isArray(a)||(a=[a]),this.use(a[0],a[1])}))}getPlugin(t){return this.installPlugins.get(t)}get renderer(){return this.rendererController.renderer}get maxAnisotropy(){return this.options.WebGPUTHREE?0:this.renderer.capabilities.getMaxAnisotropy()}get controls(){return this.controlsController.cameraControls}get cameraPositon(){return this.controls.getPosition(this._cameraPositon,!1)}get cameraTarget(){return this.controls.getTarget(this._cameraTarget,!1)}get camera(){return this.cameraController.camera}get scene(){return this.sceneController.scene}use(t,...e){this.installPlugins.has(t.pluginName)?console.log("plugin already installed"):typeof t.install=="function"&&(t.install(this,...e),this.installPlugins.set(t.pluginName,t))}init(){const{container:t,isdev:e,WebGPUTHREE:s,helper:i,renderer:r,scene:o,camera:a,controls:l}=this.options,{width:m,height:E}=this.getSize(),_=new Ge({isdev:e,width:m,height:E,cameraParams:a,cameraControls:l===!0});this.gui&&_.setGui(this.gui);const C=_.camera,y=new Qe({camera:C,sceneParams:o}),b=y.scene,u=s?new Be({width:m,height:E,scene:b,camera:C,isdev:e,renderer:s.WebGPURenderer,rendererParams:Ze}):new ke({width:m,height:E,scene:b,camera:C,isdev:e,rendererParams:zt(it({},r),{antialias:!1})});if(i){const O=new je({scene:b});O.add(b),this.helperController=O}this.sceneController=y,this.rendererController=u,this.cameraController=_,t.appendChild(u.renderer.domElement)}initComposer(){const{bloom:t,bloomParams:e,composer:s}=this.options,i=new us({renderer:this.renderer,scene:this.scene,camera:this.camera,composerParams:s});this.composerController=i,t&&(i.addBloomPass(it({},e)),this.gui&&i.addBloomGui(this.gui)),i.addOutputPass()}initCSSRenderer(){const{container:t,css2DRenderer:e,css3DRenderer:s,css2DRendererParams:i,css3DRendererParams:r}=this.options;if(e||s){const o=new ns(t);e&&o.addRenderer("css2d",i),s&&o.addRenderer("css3d",r),this.cssRendererController=o}}initControls(){const{controls:t,controlsParams:e,transformControls:s}=this.options;if(t){const i=new qe({camera:this.camera,controlsParams:{domElement:(e==null?void 0:e.domElement)||this.renderer.domElement},customControls:typeof t=="boolean"?void 0:t});this.controlsController=i}if(s){const i=new rs({camera:this.camera,renderer:this.renderer,scene:this.scene});i.event.on("mouseDown",()=>{var r;(r=this.controlsController)==null||r.disable()}),i.event.on("mouseUp",()=>{var r;(r=this.controlsController)==null||r.enable()}),this.transformController=i}}getSize(){const{container:t}=this.options;return{width:t.offsetWidth,height:t.offsetHeight}}initResizeObserver(){const{container:t}=this.options;if(this.resizeObserver)return;const e=this.getSize(),s=new ResizeObserver(i=>{for(const r of i){const o=r.contentRect;(o.width!==e.width||o.height!==e.height)&&(e.width=o.width,e.height=o.height,this.handeleResize(o.width,o.height),this.render())}});s.observe(t),this.resizeObserver=s}handeleResize(t,e,s=!0){const{rendererController:i,cameraController:r,composerController:o,cssRendererController:a}=this;r==null||r.setSize(t,e),i==null||i.setSize(t,e),o==null||o.setSize(t,e),a==null||a.setSize(t,e),this.installPlugins.forEach(l=>{var m;(m=l.setSize)==null||m.call(l,t,e)}),s&&this.event.emit("resize",{width:t,height:e})}setDevicePixelRatio(t){var e;this.rendererController.setPixelRatio(t),(e=this.composerController)==null||e.setPixelRatio(t)}pick(t,e,s=!0){const{raycaster:i,options:r}=this,{container:o}=r,a=new P.Vector2,l=o.getBoundingClientRect();if(a.x=(t.clientX-l.left)/(l.right-l.left)*2-1,a.y=-((t.clientY-l.top)/(l.bottom-l.top))*2+1,this.camera&&this.scene){i.setFromCamera(a,this.camera);const m=i.intersectObjects(e||this.scene.children,s);if(m.length)return{object:m[0].object,intersects:m}}}render(){var o,a,l,m,E,_;const{scene:t,camera:e,clock:s}=this,i=s.getDelta(),r=s.getElapsedTime();Wt.update(),(o=this.controlsController)==null||o.update(i),this.installPlugins.forEach(C=>{var y;(y=C.update)==null||y.call(C,i,r)}),(a=this.helperController)==null||a.update(),(l=this.composerController)!=null&&l.active?this.cameraController.camera2?(this.composerController.resetRenderPassCamera(),this.setViewportFull(),this.composerController.render(),this.pipViewportState&&(this.setViewportPip(),this.composerController.setRenderPassCamera(this.cameraController.camera2),this.composerController.render())):this.composerController.render():(m=this.rendererController)==null||m.render(),(E=this.cssRendererController)==null||E.render(t,e),(_=this.stats)==null||_.update(),this.event.emit("render",{delta:i,elapsed:r})}start(){this.renderer.setAnimationLoop(this.render.bind(this)),this.event.emit("start")}stop(){this.renderer.setAnimationLoop(null),this.event.emit("stop")}autoRotate(t){this.controlsController.autoRotateSpeed=t}showPipViewport(t){if(t===!0){const e=this.getSize(),s=240,i=s/e.width,r=s/e.height,o=1-i,a=1-r;t={left:o,top:a,width:i,height:r}}if(this.pipViewportState=t,t){if(this.controlsController.cameraControls2)this.controlsController.cameraControls2.enabled=!0,this.cameraController.camera2.position.copy(this.cameraController.camera.position);else{const e=this.cameraController.addCamera2();this.controlsController.addCameraControls2(e)}this.controlsController.cameraControls2.interactiveArea=new DOMRect(t.left,t.top,t.width,t.height)}else this.controlsController.cameraControls2&&(this.controlsController.cameraControls2.enabled=!1)}setViewportFull(){const t=this.getSize(),e=0,s=0,i=t.width,r=t.height,o=i/r;this.camera.aspect!==o&&(this.camera.aspect=o,this.camera.updateProjectionMatrix()),this.renderer.setViewport(e,s,i,r),this.renderer.setScissor(e,s,i,r),this.renderer.setScissorTest(!0)}setViewportPip(){if(!this.pipViewportState)return;const t=this.pipViewportState,e=this.getSize(),s=e.width*t.left,i=(1-(t.top+t.height))*e.height,r=e.width*t.width,o=e.height*t.height,a=r/o,l=this.cameraController.camera2;l&&l.aspect!==a&&(l.aspect=a,l.updateProjectionMatrix()),this.renderer.setViewport(s,i,r,o),this.renderer.setScissor(s,i,r,o),this.renderer.setScissorTest(!0)}dispose(){var t,e,s,i,r,o,a,l,m,E,_;this.stop(),Wt.removeAll(),this.event.removeAllListeners(),(t=this.resizeObserver)==null||t.unobserve(this.options.container),this.installPlugins.forEach(C=>{var y;(y=C.dispose)==null||y.call(C)}),(e=this.controlsController)==null||e.dispose(),(s=this.transformController)==null||s.dispose(),(i=this.cssRendererController)==null||i.dispose(),(r=this.sceneController)==null||r.dispose(),(o=this.helperController)==null||o.dispose(),(a=this.composerController)==null||a.dispose(),(l=this.rendererController)==null||l.dispose(),this.cssRendererController=void 0,(m=this.gui)==null||m.destroy(),this.installPlugins.clear(),(E=this.stats)==null||E.dom.remove(),(_=this.renderer)==null||_.domElement.remove()}};At.options={isdev:ut,stats:ut,gui:ut,helper:ut,controls:!0,transformControls:ut,resizeObserver:!0,renderer:Ve,composer:_s,scene:Xe,camera:Ne,bloom:!1,bloomParams:ps,css2DRenderer:!1,css2DRendererParams:it({},me),css3DRenderer:!1,css3DRendererParams:it({},me)};let Dt=At;const fs=J.ACTION;exports.BaseObject=Fe.BaseObject;exports.GUIObject=Gt;exports.Pencil=Dt;exports.cameraControlsAction=fs;exports.default=Dt;
@@ -3522,7 +3522,7 @@ Ft.options = {
3522
3522
  stats: wt,
3523
3523
  gui: wt,
3524
3524
  helper: wt,
3525
- control: !0,
3525
+ controls: !0,
3526
3526
  transformControls: wt,
3527
3527
  resizeObserver: !0,
3528
3528
  renderer: os,
@@ -143,4 +143,4 @@
143
143
  #include <tonemapping_fragment>
144
144
  #include <${+y.REVISION<154?st[0]:st[1]}>
145
145
  }
146
- `;class pt extends y.ShaderMaterial{constructor(e){super({uniforms:Me(I({},y.UniformsLib.fog),{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new y.Color(16777215)},opacity:{value:1},resolution:{value:new y.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useDepth:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new y.Vector2(1,1)},offset:{value:new y.Vector2(0,0)},offsetLoop:{value:1},lineLightAnimation:{value:0},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new y.Vector2(0,0)},lightColor:{value:new y.Color(16777215)}}),vertexShader:Ft,fragmentShader:qt}),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(t){this.uniforms.useDash.value=t}},useDepth:{enumerable:!0,get(){return this.uniforms.useDepth.value},set(t){this.uniforms.useDepth.value=t}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(t){this.uniforms.repeat.value.copy(t)}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(t){this.uniforms.lineLightAnimation.value=t}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(t){this.uniforms.size.value=t}},speed:{enumerable:!0,get:function(){return this.uniforms.speed.value},set:function(t){this.uniforms.speed.value=t}},lightWidth:{enumerable:!0,get:function(){return this.uniforms.lightWidth.value},set:function(t){this.uniforms.lightWidth.value=t}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(t){this.uniforms.uCenter.value=t}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(t){t&&(this.uniforms.lightColor.value=t)}}}),this.setValues(e)}copy(e){return super.copy(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=e.dashArray,this.dashOffset=e.dashOffset,this.dashRatio=e.dashRatio,this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}}function Ht(o,e){const t=new y.Matrix4,i=new y.Ray,s=new y.Sphere,n=new y.Vector3,r=this.geometry;if(s.copy(r.boundingSphere),s.applyMatrix4(this.matrixWorld),!o.ray.intersectSphere(s,n))return;t.copy(this.matrixWorld).invert(),i.copy(o.ray).applyMatrix4(t);const a=new y.Vector3,c=new y.Vector3,u=new y.Vector3,l=this instanceof y.LineSegments?2:1,h=r.index,p=r.attributes;if(h!==null){const f=h.array,d=p.position.array,m=p.width.array;for(let M=0,B=f.length-1;M<B;M+=l){const P=f[M],V=f[M+1];a.fromArray(d,P*3),c.fromArray(d,V*3);const T=m[Math.floor(M/3)]!=null?m[Math.floor(M/3)]:1,E=o.params.Line.threshold+this.material.lineWidth*T/2,j=E*E;if(i.distanceSqToSegment(a,c,n,u)>j)continue;n.applyMatrix4(this.matrixWorld);const W=o.ray.origin.distanceTo(n);W<o.near||W>o.far||(e.push({distance:W,point:u.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:void 0,object:this}),M=B)}}}const Te=o=>{const{setPointWidth:e,nodes:t}=o,i=new ft;return i.setPoints(t,e),i};class $t extends ie.BaseObject{constructor(e={}){super(),this.options=I({},e)}get material(){var e;return(e=this.object3d)==null?void 0:e.material}create(){return ee(this,null,function*(){const{nodes:e,nodesArr:t,geometry:i,geometryArr:s,material:n,useGroups:r,setPointWidth:a,lineWidthArr:c,materialParameters:u}=this.options;let l=n,h=i;!l&&u&&(l=this.getMaterial(u)),!h&&e?h=Te({nodes:e,setPointWidth:a}):!h&&t?h=te(t.map((p,f)=>{let d=a;return!d&&c&&(d=()=>{var m;return(m=c[f])!=null?m:c[0]}),Te({nodes:p,setPointWidth:d})}),r!=null?r:0):!h&&s&&s.length>1?h=te(s,r!=null?r:0):!h&&s&&s.length===1&&([h]=s),this.createMesh(h,l)})}setGeometry(e,t){const i=Te({nodes:e,setPointWidth:t}),s=this.object3d,n=s.geometry;s.geometry=i,n.dispose()}getMaterial(e){const{width:t,height:i}=this.pencil.getSize();return new pt(I({color:new y.Color("#ffffff"),resolution:new y.Vector2(t,i)},e))}addGeometries(e){const t=this.object3d,i=te([t.geometry,...e]);t.geometry=i}resize(e,t){var i,s;(s=(i=this.material)==null?void 0:i.uniforms)==null||s.resolution.value.set(e,t)}useMaterial(e){super.useMaterial(e);const{width:t,height:i}=this.pencil.getSize();this.resize(t,i)}animate({duration:e=1e3,delay:t=0,repeat:i=0,lineLoop:s,onRepeat:n,onUpdate:r,onComplete:a}={}){const{offset:c,offsetLoop:u}=this.material.uniforms;if(this.material.userData.tween)return;const l=s!=null?s:!0;c.value.x=1,u.value=0;let h=0;const p=new ae.Tween(c.value).to({x:-1},e).delay(t).repeat(i).onUpdate(({x:f})=>{l&&f<=0&&u.value===0&&(u.value=1),r&&r(f)}).onRepeat(()=>{h+=1,n&&n(h)}).onComplete(()=>{a&&a()}).start();this.material.userData.tween=p}render(){const{width:e,height:t}=this.pencil.getSize();this.resize(e,t)}dispose(e=!0){e&&this.material.userData.tween&&(this.material.userData.tween.stop(),ae.remove(this.material.userData.tween)),super.dispose(e)}}function Zt(o,e){return o.map(t=>{const i=[];let s;return t.forEach(n=>{if(s){const r=he.geoDistance(n,s)*180/Math.PI;if(r>e){const a=he.geoInterpolate(s,n),c=1/Math.ceil(r/e);let u=c;for(;u<1;)i.push(a(u)),u+=c}}i.push(s=n)}),i})}function Jt(o,{minLng:e,maxLng:t,minLat:i,maxLat:s}={}){const n=Math.round(Je(360/o,2)/Math.PI),r=(1+Math.sqrt(5))/2,a=f=>f/r*360%360-180,c=f=>Math.acos(2*f/n-1)/Math.PI*180-90,u=f=>n*(Math.cos((f+90)*Math.PI/180)+1)/2,l=[s!==void 0?Math.ceil(u(s)):0,i!==void 0?Math.floor(u(i)):n-1],h=e===void 0&&t===void 0?()=>!0:e===void 0?f=>f<=t:t===void 0?f=>f>=e:t>=e?f=>f>=e&&f<=t:f=>f>=e||f<=t,p=[];for(let f=l[0];f<=l[1];f++){const d=a(f);h(d)&&p.push([d,c(f)])}return p}function Ce(o,e,t=!1){return t?he.geoContains(e,o):Lt(o,e)}function Xt(o,e){const t={type:"Polygon",coordinates:o},[[i,s],[n,r]]=he.geoBounds(t);if(Math.min(Math.abs(n-i),Math.abs(r-s))<e)return[];const a=i>n||r>=89||s<=-89;return Jt(e,{minLng:i,maxLng:n,minLat:s,maxLat:r}).filter(c=>Ce(c,t,a))}function Yt(o,{resolution:e=1/0,bbox:t}={}){const i=Zt(o,e),s=oe.merge(i),n=Xt(o,e),r=[...s,...n],a={type:"Polygon",coordinates:o},[[c,u],[l,h]]=he.geoBounds(a),p=c>l||h>=89||u<=-89;let f=[];if(p){const P=Ct.geoVoronoi(r).triangles(),V=new Map(r.map(([T,E],j)=>[`${T}-${E}`,j]));P.features.forEach(T=>{const E=T.geometry.coordinates[0].slice(0,3).reverse(),j=[];if(E.forEach(([L,W])=>{const k=`${L}-${W}`;V.has(k)&&j.push(V.get(k))}),j.length===3){if(j.some(L=>L<s.length)){const L=T.properties.circumcenter;if(!Ce(L,a,p))return}f.push(...j)}})}else if(n.length){const P=Bt.from(r);for(let V=0,T=P.triangles.length;V<T;V+=3){const E=[2,1,0].map(L=>P.triangles[V+L]),j=E.map(L=>r[L]);if(E.some(L=>L<s.length)){const L=[0,1].map(W=>oe.mean(j,k=>k[W]));if(!Ce(L,a,p))continue}f.push(...E)}}else{const{vertices:P,holes:V=[]}=Be.flatten(i);f=Be(P,V,2)}const d=Xe.scaleLinear(t?[t[0],t[2]]:oe.extent(r,P=>P[0]),[0,1]),m=Xe.scaleLinear(t?[t[1],t[3]]:oe.extent(r,P=>P[1]),[0,1]),M=r.map(([P,V])=>[d(P),m(V)]);return{contour:i,triangles:{points:r,indices:f,uvs:M}}}const nt=new y.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function be(o,e,t,i){const s=o.map(n=>n.map(([r,a])=>{if(i){const[c,u]=i([r,a]);return[c,-u,e]}return t?Le.polar2Cartesian(r,a,e):[r,a,e]}));return Be.flatten(s)}function Kt(o,e,t,i,s){const{vertices:n,holes:r}=be(o,e,i,s),{vertices:a}=be(o,t,i,s),c=oe.merge([a,n]),u=Math.round(a.length/3),l=new Set(r);let h=0;const p=[];for(let d=0;d<u;d++){let m=d+1;if(m===u)m=h;else if(l.has(m)){const M=m;m=h,h=M}p.push(d,d+u,m+u),p.push(m+u,m,d)}const f=[];for(let d=1;d>=0;d--)for(let m=0;m<u;m+=1)f.push(m/(u-1),d);return{indices:p,vertices:c,uvs:f,topVerts:a}}function rt(o,e,t,i,s,n){return{indices:i?o.indices:o.indices.slice().reverse(),vertices:be([o.points],e,s,n).vertices,uvs:t}}const dt=({polygonGeoJson:o,startHeight:e,endHeight:t,curvatureResolution:i=1,cartesian:s=!0,hasSide:n=!0,hasBottom:r=!1,hasTop:a=!1,projection:c,bbox:u})=>{o.forEach(B=>{Tt(B)||B.reverse()});const{contour:l,triangles:h}=Yt(o,{resolution:i,bbox:u});let p={},f;n&&(p=Kt(l,e!=null?e:t,t!=null?t:e,s,c),f=p.topVerts);let d=[];(r||a)&&(d=oe.merge(h.uvs));let m={};r&&(m=rt(h,e,d,!1,s,c));let M={};return a&&(M=rt(h,t,d,!0,s,c)),{contour:l,triangles:h,sideTorso:p,bottomCap:m,topCap:M,topVerts:f}};class mt extends y.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=I({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},t);const{endHeight:i,hasTop:s,topFirst:n,hasBottom:r,hasSide:a,cartesian:c,userDataRsoOffset:u,projection:l}=this.parameters,{contour:h,sideTorso:p,topVerts:f,bottomCap:d,topCap:m}=dt(I({},this.parameters));let M=[],B=[],P=[],V=0;const T=E=>{const j=Math.round(M.length/3),L=P.length;M=M.concat(E.vertices),B=B.concat(E.uvs),P=P.concat(j?E.indices.map(W=>W+j):E.indices),this.addGroup(L,P.length-L,V++)};s&&n&&T(m),a&&(T(p),this.userData.topVerts=u?be(h,i+u,c,l).vertices:f),r&&T(d),s&&!n&&T(m),this.setIndex(P),this[nt]("position",new y.Float32BufferAttribute(M,3)),this[nt]("uv",new y.Float32BufferAttribute(B,2)),this.computeVertexNormals()}}const ot=o=>{const a=o,{coordinate:e,startHeight:t,height:i}=a,s=Ae(a,["coordinate","startHeight","height"]);let n=t||0;return typeof t!="undefined"&&typeof i!="undefined"&&(n=t+i),new mt([e],Me(I({},s),{startHeight:t,endHeight:n}))};class Qt extends ie.BaseObject{constructor(e){super(),this.options=I({},e)}create(){const c=this.options,{geometry:e,coordinateArr:t,coordinate:i,material:s,useGroups:n}=c,r=Ae(c,["geometry","coordinateArr","coordinate","material","useGroups"]);let a=e;if(!a&&i)a=ot(I({coordinate:i},r));else if(!a&&t){const u=t.map(l=>ot(I({coordinate:l},r)));a=te(u,n!=null?n:0)}this.createMesh(a,s)}}class Ie extends w.BufferGeometry{constructor(e=new w.Shape([new w.Vector2(.5,.5),new w.Vector2(-.5,.5),new w.Vector2(-.5,-.5),new w.Vector2(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,s=[],n=[];for(let a=0,c=e.length;a<c;a++){const u=e[a];r(u)}this.setAttribute("position",new w.Float32BufferAttribute(s,3)),this.setAttribute("uv",new w.Float32BufferAttribute(n,2)),this.computeVertexNormals();function r(a){var Ue,We,De;const c=[],u=t.curveSegments!==void 0?t.curveSegments:12,l=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,d=t.bevelSize!==void 0?t.bevelSize:f-.1,m=t.bevelOffset!==void 0?t.bevelOffset:0,M=t.bevelSegments!==void 0?t.bevelSegments:3;const B=t.extrudePath,P=t.UVGenerator!==void 0?t.UVGenerator:ei,V=(Ue=t.hasTop)!=null?Ue:!0,T=(We=t.hasBottom)!=null?We:!0,E=(De=t.hasSide)!=null?De:!0;let j,L=!1,W,k,le,Z;B&&(j=B.getSpacedPoints(l),L=!0,p=!1,W=B.computeFrenetFrames(l,!1),k=new w.Vector3,le=new w.Vector3,Z=new w.Vector3),p||(M=0,f=0,d=0,m=0);const Ee=a.extractPoints(u);let N=Ee.shape;const R=Ee.holes;if(!w.ShapeUtils.isClockWise(N)){N=N.reverse();for(let g=0,v=R.length;g<v;g++){const b=R[g];w.ShapeUtils.isClockWise(b)&&(R[g]=b.reverse())}}const ce=w.ShapeUtils.triangulateShape(N,R),F=N;for(let g=0,v=R.length;g<v;g++){const b=R[g];N=N.concat(b)}function re(g,v,b){return v||console.error("THREE.ExtrudeGeometry: vec does not exist"),g.clone().addScaledVector(v,b)}const J=N.length,fe=ce.length;function Ge(g,v,b){let A,x,S;const _=g.x-v.x,C=g.y-v.y,D=b.x-g.x,G=b.y-g.y,ue=_*_+C*C,we=_*G-C*D;if(Math.abs(we)>Number.EPSILON){const Q=Math.sqrt(ue),Re=Math.sqrt(D*D+G*G),Ne=v.x-C/Q,ke=v.y+_/Q,bt=b.x-G/Re,xt=b.y+D/Re,Fe=((bt-Ne)*G-(xt-ke)*D)/(_*G-C*D);A=Ne+_*Fe-g.x,x=ke+C*Fe-g.y;const qe=A*A+x*x;if(qe<=2)return new w.Vector2(A,x);S=Math.sqrt(qe/2)}else{let Q=!1;_>Number.EPSILON?D>Number.EPSILON&&(Q=!0):_<-Number.EPSILON?D<-Number.EPSILON&&(Q=!0):Math.sign(C)===Math.sign(G)&&(Q=!0),Q?(A=-C,x=_,S=Math.sqrt(ue)):(A=_,x=C,S=Math.sqrt(ue/2))}return new w.Vector2(A/S,x/S)}const pe=[];for(let g=0,v=F.length,b=v-1,A=g+1;g<v;g++,b++,A++)b===v&&(b=0),A===v&&(A=0),pe[g]=Ge(F[g],F[b],F[A]);const xe=[];let se,de=pe.concat();for(let g=0,v=R.length;g<v;g++){const b=R[g];se=[];for(let A=0,x=b.length,S=x-1,_=A+1;A<x;A++,S++,_++)S===x&&(S=0),_===x&&(_=0),se[A]=Ge(b[A],b[S],b[_]);xe.push(se),de=de.concat(se)}for(let g=0;g<M;g++){const v=g/M,b=f*Math.cos(v*Math.PI/2),A=d*Math.sin(v*Math.PI/2)+m;for(let x=0,S=F.length;x<S;x++){const _=re(F[x],pe[x],A);X(_.x,_.y,-b)}for(let x=0,S=R.length;x<S;x++){const _=R[x];se=xe[x];for(let C=0,D=_.length;C<D;C++){const G=re(_[C],se[C],A);X(G.x,G.y,-b)}}}const ze=d+m;for(let g=0;g<J;g++){const v=p?re(N[g],de[g],ze):N[g];L?(le.copy(W.normals[0]).multiplyScalar(v.x),k.copy(W.binormals[0]).multiplyScalar(v.y),Z.copy(j[0]).add(le).add(k),X(Z.x,Z.y,Z.z)):X(v.x,v.y,0)}for(let g=1;g<=l;g++)for(let v=0;v<J;v++){const b=p?re(N[v],de[v],ze):N[v];L?(le.copy(W.normals[g]).multiplyScalar(b.x),k.copy(W.binormals[g]).multiplyScalar(b.y),Z.copy(j[g]).add(le).add(k),X(Z.x,Z.y,Z.z)):X(b.x,b.y,h/l*g)}for(let g=M-1;g>=0;g--){const v=g/M,b=f*Math.cos(v*Math.PI/2),A=d*Math.sin(v*Math.PI/2)+m;for(let x=0,S=F.length;x<S;x++){const _=re(F[x],pe[x],A);X(_.x,_.y,h+b)}for(let x=0,S=R.length;x<S;x++){const _=R[x];se=xe[x];for(let C=0,D=_.length;C<D;C++){const G=re(_[C],se[C],A);L?X(G.x,G.y+j[l-1].y,j[l-1].x+b):X(G.x,G.y,h+b)}}}gt(),E&&yt();function gt(){const g=s.length/3;if(p){let v=0,b=J*v;if(T)for(let A=0;A<fe;A++){const x=ce[A];me(x[2]+b,x[1]+b,x[0]+b)}if(v=l+M*2,b=J*v,V)for(let A=0;A<fe;A++){const x=ce[A];me(x[0]+b,x[1]+b,x[2]+b)}}else{if(T)for(let v=0;v<fe;v++){const b=ce[v];me(b[2],b[1],b[0])}if(V)for(let v=0;v<fe;v++){const b=ce[v];me(b[0]+J*l,b[1]+J*l,b[2]+J*l)}}i.addGroup(g,s.length/3-g,0)}function yt(){const g=s.length/3;let v=0;Oe(F,v),v+=F.length;for(let b=0,A=R.length;b<A;b++){const x=R[b];Oe(x,v),v+=x.length}i.addGroup(g,s.length/3-g,1)}function Oe(g,v){let b=g.length;for(;--b>=0;){const A=b;let x=b-1;x<0&&(x=g.length-1);for(let S=0,_=l+M*2;S<_;S++){const C=J*S,D=J*(S+1),G=v+A+C,ue=v+x+C,we=v+x+D,Q=v+A+D;vt(G,ue,we,Q)}}}function X(g,v,b){c.push(g),c.push(v),c.push(b)}function me(g,v,b){Y(g),Y(v),Y(b);const A=s.length/3,x=P.generateTopUV(i,s,A-3,A-2,A-1);K(x[0]),K(x[1]),K(x[2])}function vt(g,v,b,A){Y(g),Y(v),Y(A),Y(v),Y(b),Y(A);const x=s.length/3,S=P.generateSideWallUV(i,s,x-6,x-3,x-2,x-1);K(S[0]),K(S[1]),K(S[3]),K(S[1]),K(S[2]),K(S[3])}function Y(g){s.push(c[g*3+0]),s.push(c[g*3+1]),s.push(c[g*3+2])}function K(g){n.push(g.x),n.push(g.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return ti(t,i,e)}static fromJSON(e,t){const i=[];for(let n=0,r=e.shapes.length;n<r;n++){const a=t[e.shapes[n]];i.push(a)}const s=e.options.extrudePath;return console.log(s.type),s!==void 0&&(e.options.extrudePath=new y[`${s.type}Curve`]().fromJSON(s)),new Ie(i,e.options)}}const ei={generateTopUV:function(o,e,t,i,s){const n=e[t*3],r=e[t*3+1],a=e[i*3],c=e[i*3+1],u=e[s*3],l=e[s*3+1];return[new w.Vector2(n,r),new w.Vector2(a,c),new w.Vector2(u,l)]},generateSideWallUV:function(o,e,t,i,s,n){const r=e[t*3],a=e[t*3+1],c=e[t*3+2],u=e[i*3],l=e[i*3+1],h=e[i*3+2],p=e[s*3],f=e[s*3+1],d=e[s*3+2],m=e[n*3],M=e[n*3+1],B=e[n*3+2];return Math.abs(a-l)<Math.abs(r-u)?[new w.Vector2(r,1-c),new w.Vector2(u,1-h),new w.Vector2(p,1-d),new w.Vector2(m,1-B)]:[new w.Vector2(a,1-c),new w.Vector2(l,1-h),new w.Vector2(f,1-d),new w.Vector2(M,1-B)]}};function ti(o,e,t){if(t.shapes=[],Array.isArray(o))for(let i=0,s=o.length;i<s;i++){const n=o[i];t.shapes.push(n.uuid)}else t.shapes.push(o.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}const at=o=>{const{split:e,depth:t,points:i,box3:s,hasTop:n,hasBottom:r,hasSide:a,sideRepeat:c}=o,u=new Ie(new y.Shape(i),{depth:t,bevelEnabled:!1,UVGenerator:Le.getUVGenerator({split:e,box3:s,sideRepeat:c}),hasTop:n,hasBottom:r,hasSide:a});return Le.claerUVGenerator(),u};class ii extends ie.BaseObject{constructor(e){super(),this.options=I({depth:1},e)}create(){return ee(this,null,function*(){const{points:e,pointsArr:t,useGroups:i,depth:s,geometry:n,geometryArr:r,material:a,box3:c,split:u,hasTop:l,hasBottom:h,hasSide:p}=this.options,f=Array.isArray(s)?s:[s],d=Array.isArray(c)?c:[c],m=a;let M=n;m||console.log("material is null"),!M&&e?M=at({points:e,depth:f[0],box3:d[0],split:u,hasTop:l,hasBottom:h,hasSide:p}):!M&&t?M=te(t.map((B,P)=>{var V,T;return at({points:B,depth:(V=f[P])!=null?V:f[0],box3:(T=d[P])!=null?T:d[0],split:u,hasTop:l,hasBottom:h,hasSide:p})}),i!=null?i:0):!M&&r&&r.length>1?M=te(r,i!=null?i:0):!M&&r&&r.length===1&&([M]=r),this.createMesh(M,m)})}addGeometries(e){const t=this.object3d,i=te([t.geometry,...e]);t.geometry=i}setTextureAnisotropic(e,t){e.anisotropy=t||this.pencil.renderer.capabilities.getMaxAnisotropy()}}const si=o=>{const{topColor:e,sideColor:t,sideMap:i,createCanvasObjectURL:s,split:n,maxAnisotropy:r}=o;return new Promise(a=>{const c=i?document.createElement("img"):{src:"",onload:()=>{},width:128,height:128};c.onload=()=>{const u=n,l=document.createElement("canvas"),h=l.getContext("2d");l.height=c.height/(1-u),l.width=c.width,u&&e&&(h.fillStyle=e,h.fillRect(0,0,c.width,l.height*u)),i&&c instanceof HTMLImageElement?h.drawImage(c,0,l.height*u,c.width,c.height):t&&(h.fillStyle=t,h.fillRect(0,l.height*u,c.width,c.height)),s&&l.toBlob(f=>{console.log(URL.createObjectURL(f))});const p=new y.CanvasTexture(l);a(p)},i?c.src=i:c instanceof HTMLImageElement||c.onload()})};exports.Group=_t.Group;Object.defineProperty(exports,"LineSegmentsGeometry",{enumerable:!0,get:()=>je.LineSegmentsGeometry});Object.defineProperty(exports,"Line2Material",{enumerable:!0,get:()=>lt.LineMaterial});exports.ConicPolygon=Qt;exports.ExtrudePolygon=ii;exports.Image=ht;exports.Light=Ot;exports.Line=$t;exports.Line2=Nt;exports.MeshLineGeometry=ft;exports.MeshLineMaterial=pt;exports.MeshLineRaycast=Ht;exports.Node=Gt;exports.Pie=zt;exports.Text=It;exports.Video=Et;exports.getConicPolygonGeometry=mt;exports.getConicPolygonGeometryMetas=dt;exports.getSplitTexture=si;
146
+ `;class pt extends y.ShaderMaterial{constructor(e){super({uniforms:Me(I({},y.UniformsLib.fog),{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new y.Color(16777215)},opacity:{value:1},resolution:{value:new y.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useDepth:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new y.Vector2(1,1)},offset:{value:new y.Vector2(0,0)},offsetLoop:{value:1},lineLightAnimation:{value:0},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new y.Vector2(0,0)},lightColor:{value:new y.Color(16777215)}}),vertexShader:Ft,fragmentShader:qt}),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(t){this.uniforms.useDash.value=t}},useDepth:{enumerable:!0,get(){return this.uniforms.useDepth.value},set(t){this.uniforms.useDepth.value=t}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(t){this.uniforms.repeat.value.copy(t)}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(t){this.uniforms.lineLightAnimation.value=t}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(t){this.uniforms.size.value=t}},speed:{enumerable:!0,get:function(){return this.uniforms.speed.value},set:function(t){this.uniforms.speed.value=t}},lightWidth:{enumerable:!0,get:function(){return this.uniforms.lightWidth.value},set:function(t){this.uniforms.lightWidth.value=t}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(t){this.uniforms.uCenter.value=t}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(t){t&&(this.uniforms.lightColor.value=t)}}}),this.setValues(e)}copy(e){return super.copy(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=e.dashArray,this.dashOffset=e.dashOffset,this.dashRatio=e.dashRatio,this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}}function Ht(o,e){const t=new y.Matrix4,i=new y.Ray,s=new y.Sphere,n=new y.Vector3,r=this.geometry;if(s.copy(r.boundingSphere),s.applyMatrix4(this.matrixWorld),!o.ray.intersectSphere(s,n))return;t.copy(this.matrixWorld).invert(),i.copy(o.ray).applyMatrix4(t);const a=new y.Vector3,c=new y.Vector3,u=new y.Vector3,l=this instanceof y.LineSegments?2:1,h=r.index,p=r.attributes;if(h!==null){const f=h.array,d=p.position.array,m=p.width.array;for(let M=0,B=f.length-1;M<B;M+=l){const P=f[M],V=f[M+1];a.fromArray(d,P*3),c.fromArray(d,V*3);const T=m[Math.floor(M/3)]!=null?m[Math.floor(M/3)]:1,E=o.params.Line.threshold+this.material.lineWidth*T/2,j=E*E;if(i.distanceSqToSegment(a,c,n,u)>j)continue;n.applyMatrix4(this.matrixWorld);const W=o.ray.origin.distanceTo(n);W<o.near||W>o.far||(e.push({distance:W,point:u.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:void 0,object:this}),M=B)}}}const Te=o=>{const{setPointWidth:e,nodes:t}=o,i=new ft;return i.setPoints(t,e),i};class $t extends ie.BaseObject{constructor(e={}){super(),this.options=I({},e)}get material(){var e;return(e=this.object3d)==null?void 0:e.material}create(){return ee(this,null,function*(){const{nodes:e,nodesArr:t,geometry:i,geometryArr:s,material:n,useGroups:r,setPointWidth:a,lineWidthArr:c,materialParameters:u}=this.options;let l=n,h=i;!l&&u&&(l=this.getMaterial(u)),!h&&e?h=Te({nodes:e,setPointWidth:a}):!h&&t?h=te(t.map((p,f)=>{let d=a;return!d&&c&&(d=()=>{var m;return(m=c[f])!=null?m:c[0]}),Te({nodes:p,setPointWidth:d})}),r!=null?r:0):!h&&s&&s.length>1?h=te(s,r!=null?r:0):!h&&s&&s.length===1&&([h]=s),this.createMesh(h,l)})}setGeometry(e,t){const i=Te({nodes:e,setPointWidth:t}),s=this.object3d,n=s.geometry;s.geometry=i,n.dispose()}getMaterial(e){const{width:t,height:i}=this.pencil.getSize();return new pt(I({color:new y.Color("#ffffff"),resolution:new y.Vector2(t,i)},e))}addGeometries(e){const t=this.object3d,i=te([t.geometry,...e]);t.geometry=i}resize(e,t){var i,s;(s=(i=this.material)==null?void 0:i.uniforms)==null||s.resolution.value.set(e,t)}useMaterial(e){super.useMaterial(e);const{width:t,height:i}=this.pencil.getSize();this.resize(t,i)}animate({duration:e=1e3,delay:t=0,repeat:i=0,lineLoop:s,onRepeat:n,onUpdate:r,onComplete:a}={}){const{offset:c,offsetLoop:u}=this.material.uniforms;if(this.material.userData.tween)return;const l=s!=null?s:!0;c.value.x=1,u.value=0;let h=0;const p=new ae.Tween(c.value).to({x:-1},e).delay(t).repeat(i).onUpdate(({x:f})=>{l&&f<=0&&u.value===0&&(u.value=1),r&&r(f)}).onRepeat(()=>{h+=1,n&&n(h)}).onComplete(()=>{a&&a()}).start();this.material.userData.tween=p}render(){const{width:e,height:t}=this.pencil.getSize();this.resize(e,t)}dispose(){this.material.userData.tween&&(this.material.userData.tween.stop(),ae.remove(this.material.userData.tween)),super.dispose()}}function Zt(o,e){return o.map(t=>{const i=[];let s;return t.forEach(n=>{if(s){const r=he.geoDistance(n,s)*180/Math.PI;if(r>e){const a=he.geoInterpolate(s,n),c=1/Math.ceil(r/e);let u=c;for(;u<1;)i.push(a(u)),u+=c}}i.push(s=n)}),i})}function Jt(o,{minLng:e,maxLng:t,minLat:i,maxLat:s}={}){const n=Math.round(Je(360/o,2)/Math.PI),r=(1+Math.sqrt(5))/2,a=f=>f/r*360%360-180,c=f=>Math.acos(2*f/n-1)/Math.PI*180-90,u=f=>n*(Math.cos((f+90)*Math.PI/180)+1)/2,l=[s!==void 0?Math.ceil(u(s)):0,i!==void 0?Math.floor(u(i)):n-1],h=e===void 0&&t===void 0?()=>!0:e===void 0?f=>f<=t:t===void 0?f=>f>=e:t>=e?f=>f>=e&&f<=t:f=>f>=e||f<=t,p=[];for(let f=l[0];f<=l[1];f++){const d=a(f);h(d)&&p.push([d,c(f)])}return p}function Ce(o,e,t=!1){return t?he.geoContains(e,o):Lt(o,e)}function Xt(o,e){const t={type:"Polygon",coordinates:o},[[i,s],[n,r]]=he.geoBounds(t);if(Math.min(Math.abs(n-i),Math.abs(r-s))<e)return[];const a=i>n||r>=89||s<=-89;return Jt(e,{minLng:i,maxLng:n,minLat:s,maxLat:r}).filter(c=>Ce(c,t,a))}function Yt(o,{resolution:e=1/0,bbox:t}={}){const i=Zt(o,e),s=oe.merge(i),n=Xt(o,e),r=[...s,...n],a={type:"Polygon",coordinates:o},[[c,u],[l,h]]=he.geoBounds(a),p=c>l||h>=89||u<=-89;let f=[];if(p){const P=Ct.geoVoronoi(r).triangles(),V=new Map(r.map(([T,E],j)=>[`${T}-${E}`,j]));P.features.forEach(T=>{const E=T.geometry.coordinates[0].slice(0,3).reverse(),j=[];if(E.forEach(([L,W])=>{const k=`${L}-${W}`;V.has(k)&&j.push(V.get(k))}),j.length===3){if(j.some(L=>L<s.length)){const L=T.properties.circumcenter;if(!Ce(L,a,p))return}f.push(...j)}})}else if(n.length){const P=Bt.from(r);for(let V=0,T=P.triangles.length;V<T;V+=3){const E=[2,1,0].map(L=>P.triangles[V+L]),j=E.map(L=>r[L]);if(E.some(L=>L<s.length)){const L=[0,1].map(W=>oe.mean(j,k=>k[W]));if(!Ce(L,a,p))continue}f.push(...E)}}else{const{vertices:P,holes:V=[]}=Be.flatten(i);f=Be(P,V,2)}const d=Xe.scaleLinear(t?[t[0],t[2]]:oe.extent(r,P=>P[0]),[0,1]),m=Xe.scaleLinear(t?[t[1],t[3]]:oe.extent(r,P=>P[1]),[0,1]),M=r.map(([P,V])=>[d(P),m(V)]);return{contour:i,triangles:{points:r,indices:f,uvs:M}}}const nt=new y.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function be(o,e,t,i){const s=o.map(n=>n.map(([r,a])=>{if(i){const[c,u]=i([r,a]);return[c,-u,e]}return t?Le.polar2Cartesian(r,a,e):[r,a,e]}));return Be.flatten(s)}function Kt(o,e,t,i,s){const{vertices:n,holes:r}=be(o,e,i,s),{vertices:a}=be(o,t,i,s),c=oe.merge([a,n]),u=Math.round(a.length/3),l=new Set(r);let h=0;const p=[];for(let d=0;d<u;d++){let m=d+1;if(m===u)m=h;else if(l.has(m)){const M=m;m=h,h=M}p.push(d,d+u,m+u),p.push(m+u,m,d)}const f=[];for(let d=1;d>=0;d--)for(let m=0;m<u;m+=1)f.push(m/(u-1),d);return{indices:p,vertices:c,uvs:f,topVerts:a}}function rt(o,e,t,i,s,n){return{indices:i?o.indices:o.indices.slice().reverse(),vertices:be([o.points],e,s,n).vertices,uvs:t}}const dt=({polygonGeoJson:o,startHeight:e,endHeight:t,curvatureResolution:i=1,cartesian:s=!0,hasSide:n=!0,hasBottom:r=!1,hasTop:a=!1,projection:c,bbox:u})=>{o.forEach(B=>{Tt(B)||B.reverse()});const{contour:l,triangles:h}=Yt(o,{resolution:i,bbox:u});let p={},f;n&&(p=Kt(l,e!=null?e:t,t!=null?t:e,s,c),f=p.topVerts);let d=[];(r||a)&&(d=oe.merge(h.uvs));let m={};r&&(m=rt(h,e,d,!1,s,c));let M={};return a&&(M=rt(h,t,d,!0,s,c)),{contour:l,triangles:h,sideTorso:p,bottomCap:m,topCap:M,topVerts:f}};class mt extends y.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=I({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},t);const{endHeight:i,hasTop:s,topFirst:n,hasBottom:r,hasSide:a,cartesian:c,userDataRsoOffset:u,projection:l}=this.parameters,{contour:h,sideTorso:p,topVerts:f,bottomCap:d,topCap:m}=dt(I({},this.parameters));let M=[],B=[],P=[],V=0;const T=E=>{const j=Math.round(M.length/3),L=P.length;M=M.concat(E.vertices),B=B.concat(E.uvs),P=P.concat(j?E.indices.map(W=>W+j):E.indices),this.addGroup(L,P.length-L,V++)};s&&n&&T(m),a&&(T(p),this.userData.topVerts=u?be(h,i+u,c,l).vertices:f),r&&T(d),s&&!n&&T(m),this.setIndex(P),this[nt]("position",new y.Float32BufferAttribute(M,3)),this[nt]("uv",new y.Float32BufferAttribute(B,2)),this.computeVertexNormals()}}const ot=o=>{const a=o,{coordinate:e,startHeight:t,height:i}=a,s=Ae(a,["coordinate","startHeight","height"]);let n=t||0;return typeof t!="undefined"&&typeof i!="undefined"&&(n=t+i),new mt([e],Me(I({},s),{startHeight:t,endHeight:n}))};class Qt extends ie.BaseObject{constructor(e){super(),this.options=I({},e)}create(){const c=this.options,{geometry:e,coordinateArr:t,coordinate:i,material:s,useGroups:n}=c,r=Ae(c,["geometry","coordinateArr","coordinate","material","useGroups"]);let a=e;if(!a&&i)a=ot(I({coordinate:i},r));else if(!a&&t){const u=t.map(l=>ot(I({coordinate:l},r)));a=te(u,n!=null?n:0)}this.createMesh(a,s)}}class Ie extends w.BufferGeometry{constructor(e=new w.Shape([new w.Vector2(.5,.5),new w.Vector2(-.5,.5),new w.Vector2(-.5,-.5),new w.Vector2(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,s=[],n=[];for(let a=0,c=e.length;a<c;a++){const u=e[a];r(u)}this.setAttribute("position",new w.Float32BufferAttribute(s,3)),this.setAttribute("uv",new w.Float32BufferAttribute(n,2)),this.computeVertexNormals();function r(a){var Ue,We,De;const c=[],u=t.curveSegments!==void 0?t.curveSegments:12,l=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,d=t.bevelSize!==void 0?t.bevelSize:f-.1,m=t.bevelOffset!==void 0?t.bevelOffset:0,M=t.bevelSegments!==void 0?t.bevelSegments:3;const B=t.extrudePath,P=t.UVGenerator!==void 0?t.UVGenerator:ei,V=(Ue=t.hasTop)!=null?Ue:!0,T=(We=t.hasBottom)!=null?We:!0,E=(De=t.hasSide)!=null?De:!0;let j,L=!1,W,k,le,Z;B&&(j=B.getSpacedPoints(l),L=!0,p=!1,W=B.computeFrenetFrames(l,!1),k=new w.Vector3,le=new w.Vector3,Z=new w.Vector3),p||(M=0,f=0,d=0,m=0);const Ee=a.extractPoints(u);let N=Ee.shape;const R=Ee.holes;if(!w.ShapeUtils.isClockWise(N)){N=N.reverse();for(let g=0,v=R.length;g<v;g++){const b=R[g];w.ShapeUtils.isClockWise(b)&&(R[g]=b.reverse())}}const ce=w.ShapeUtils.triangulateShape(N,R),F=N;for(let g=0,v=R.length;g<v;g++){const b=R[g];N=N.concat(b)}function re(g,v,b){return v||console.error("THREE.ExtrudeGeometry: vec does not exist"),g.clone().addScaledVector(v,b)}const J=N.length,fe=ce.length;function Ge(g,v,b){let A,x,S;const _=g.x-v.x,C=g.y-v.y,D=b.x-g.x,G=b.y-g.y,ue=_*_+C*C,we=_*G-C*D;if(Math.abs(we)>Number.EPSILON){const Q=Math.sqrt(ue),Re=Math.sqrt(D*D+G*G),Ne=v.x-C/Q,ke=v.y+_/Q,bt=b.x-G/Re,xt=b.y+D/Re,Fe=((bt-Ne)*G-(xt-ke)*D)/(_*G-C*D);A=Ne+_*Fe-g.x,x=ke+C*Fe-g.y;const qe=A*A+x*x;if(qe<=2)return new w.Vector2(A,x);S=Math.sqrt(qe/2)}else{let Q=!1;_>Number.EPSILON?D>Number.EPSILON&&(Q=!0):_<-Number.EPSILON?D<-Number.EPSILON&&(Q=!0):Math.sign(C)===Math.sign(G)&&(Q=!0),Q?(A=-C,x=_,S=Math.sqrt(ue)):(A=_,x=C,S=Math.sqrt(ue/2))}return new w.Vector2(A/S,x/S)}const pe=[];for(let g=0,v=F.length,b=v-1,A=g+1;g<v;g++,b++,A++)b===v&&(b=0),A===v&&(A=0),pe[g]=Ge(F[g],F[b],F[A]);const xe=[];let se,de=pe.concat();for(let g=0,v=R.length;g<v;g++){const b=R[g];se=[];for(let A=0,x=b.length,S=x-1,_=A+1;A<x;A++,S++,_++)S===x&&(S=0),_===x&&(_=0),se[A]=Ge(b[A],b[S],b[_]);xe.push(se),de=de.concat(se)}for(let g=0;g<M;g++){const v=g/M,b=f*Math.cos(v*Math.PI/2),A=d*Math.sin(v*Math.PI/2)+m;for(let x=0,S=F.length;x<S;x++){const _=re(F[x],pe[x],A);X(_.x,_.y,-b)}for(let x=0,S=R.length;x<S;x++){const _=R[x];se=xe[x];for(let C=0,D=_.length;C<D;C++){const G=re(_[C],se[C],A);X(G.x,G.y,-b)}}}const ze=d+m;for(let g=0;g<J;g++){const v=p?re(N[g],de[g],ze):N[g];L?(le.copy(W.normals[0]).multiplyScalar(v.x),k.copy(W.binormals[0]).multiplyScalar(v.y),Z.copy(j[0]).add(le).add(k),X(Z.x,Z.y,Z.z)):X(v.x,v.y,0)}for(let g=1;g<=l;g++)for(let v=0;v<J;v++){const b=p?re(N[v],de[v],ze):N[v];L?(le.copy(W.normals[g]).multiplyScalar(b.x),k.copy(W.binormals[g]).multiplyScalar(b.y),Z.copy(j[g]).add(le).add(k),X(Z.x,Z.y,Z.z)):X(b.x,b.y,h/l*g)}for(let g=M-1;g>=0;g--){const v=g/M,b=f*Math.cos(v*Math.PI/2),A=d*Math.sin(v*Math.PI/2)+m;for(let x=0,S=F.length;x<S;x++){const _=re(F[x],pe[x],A);X(_.x,_.y,h+b)}for(let x=0,S=R.length;x<S;x++){const _=R[x];se=xe[x];for(let C=0,D=_.length;C<D;C++){const G=re(_[C],se[C],A);L?X(G.x,G.y+j[l-1].y,j[l-1].x+b):X(G.x,G.y,h+b)}}}gt(),E&&yt();function gt(){const g=s.length/3;if(p){let v=0,b=J*v;if(T)for(let A=0;A<fe;A++){const x=ce[A];me(x[2]+b,x[1]+b,x[0]+b)}if(v=l+M*2,b=J*v,V)for(let A=0;A<fe;A++){const x=ce[A];me(x[0]+b,x[1]+b,x[2]+b)}}else{if(T)for(let v=0;v<fe;v++){const b=ce[v];me(b[2],b[1],b[0])}if(V)for(let v=0;v<fe;v++){const b=ce[v];me(b[0]+J*l,b[1]+J*l,b[2]+J*l)}}i.addGroup(g,s.length/3-g,0)}function yt(){const g=s.length/3;let v=0;Oe(F,v),v+=F.length;for(let b=0,A=R.length;b<A;b++){const x=R[b];Oe(x,v),v+=x.length}i.addGroup(g,s.length/3-g,1)}function Oe(g,v){let b=g.length;for(;--b>=0;){const A=b;let x=b-1;x<0&&(x=g.length-1);for(let S=0,_=l+M*2;S<_;S++){const C=J*S,D=J*(S+1),G=v+A+C,ue=v+x+C,we=v+x+D,Q=v+A+D;vt(G,ue,we,Q)}}}function X(g,v,b){c.push(g),c.push(v),c.push(b)}function me(g,v,b){Y(g),Y(v),Y(b);const A=s.length/3,x=P.generateTopUV(i,s,A-3,A-2,A-1);K(x[0]),K(x[1]),K(x[2])}function vt(g,v,b,A){Y(g),Y(v),Y(A),Y(v),Y(b),Y(A);const x=s.length/3,S=P.generateSideWallUV(i,s,x-6,x-3,x-2,x-1);K(S[0]),K(S[1]),K(S[3]),K(S[1]),K(S[2]),K(S[3])}function Y(g){s.push(c[g*3+0]),s.push(c[g*3+1]),s.push(c[g*3+2])}function K(g){n.push(g.x),n.push(g.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return ti(t,i,e)}static fromJSON(e,t){const i=[];for(let n=0,r=e.shapes.length;n<r;n++){const a=t[e.shapes[n]];i.push(a)}const s=e.options.extrudePath;return console.log(s.type),s!==void 0&&(e.options.extrudePath=new y[`${s.type}Curve`]().fromJSON(s)),new Ie(i,e.options)}}const ei={generateTopUV:function(o,e,t,i,s){const n=e[t*3],r=e[t*3+1],a=e[i*3],c=e[i*3+1],u=e[s*3],l=e[s*3+1];return[new w.Vector2(n,r),new w.Vector2(a,c),new w.Vector2(u,l)]},generateSideWallUV:function(o,e,t,i,s,n){const r=e[t*3],a=e[t*3+1],c=e[t*3+2],u=e[i*3],l=e[i*3+1],h=e[i*3+2],p=e[s*3],f=e[s*3+1],d=e[s*3+2],m=e[n*3],M=e[n*3+1],B=e[n*3+2];return Math.abs(a-l)<Math.abs(r-u)?[new w.Vector2(r,1-c),new w.Vector2(u,1-h),new w.Vector2(p,1-d),new w.Vector2(m,1-B)]:[new w.Vector2(a,1-c),new w.Vector2(l,1-h),new w.Vector2(f,1-d),new w.Vector2(M,1-B)]}};function ti(o,e,t){if(t.shapes=[],Array.isArray(o))for(let i=0,s=o.length;i<s;i++){const n=o[i];t.shapes.push(n.uuid)}else t.shapes.push(o.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}const at=o=>{const{split:e,depth:t,points:i,box3:s,hasTop:n,hasBottom:r,hasSide:a,sideRepeat:c}=o,u=new Ie(new y.Shape(i),{depth:t,bevelEnabled:!1,UVGenerator:Le.getUVGenerator({split:e,box3:s,sideRepeat:c}),hasTop:n,hasBottom:r,hasSide:a});return Le.claerUVGenerator(),u};class ii extends ie.BaseObject{constructor(e){super(),this.options=I({depth:1},e)}create(){return ee(this,null,function*(){const{points:e,pointsArr:t,useGroups:i,depth:s,geometry:n,geometryArr:r,material:a,box3:c,split:u,hasTop:l,hasBottom:h,hasSide:p}=this.options,f=Array.isArray(s)?s:[s],d=Array.isArray(c)?c:[c],m=a;let M=n;m||console.log("material is null"),!M&&e?M=at({points:e,depth:f[0],box3:d[0],split:u,hasTop:l,hasBottom:h,hasSide:p}):!M&&t?M=te(t.map((B,P)=>{var V,T;return at({points:B,depth:(V=f[P])!=null?V:f[0],box3:(T=d[P])!=null?T:d[0],split:u,hasTop:l,hasBottom:h,hasSide:p})}),i!=null?i:0):!M&&r&&r.length>1?M=te(r,i!=null?i:0):!M&&r&&r.length===1&&([M]=r),this.createMesh(M,m)})}addGeometries(e){const t=this.object3d,i=te([t.geometry,...e]);t.geometry=i}setTextureAnisotropic(e,t){e.anisotropy=t||this.pencil.renderer.capabilities.getMaxAnisotropy()}}const si=o=>{const{topColor:e,sideColor:t,sideMap:i,createCanvasObjectURL:s,split:n,maxAnisotropy:r}=o;return new Promise(a=>{const c=i?document.createElement("img"):{src:"",onload:()=>{},width:128,height:128};c.onload=()=>{const u=n,l=document.createElement("canvas"),h=l.getContext("2d");l.height=c.height/(1-u),l.width=c.width,u&&e&&(h.fillStyle=e,h.fillRect(0,0,c.width,l.height*u)),i&&c instanceof HTMLImageElement?h.drawImage(c,0,l.height*u,c.width,c.height):t&&(h.fillStyle=t,h.fillRect(0,l.height*u,c.width,c.height)),s&&l.toBlob(f=>{console.log(URL.createObjectURL(f))});const p=new y.CanvasTexture(l);a(p)},i?c.src=i:c instanceof HTMLImageElement||c.onload()})};exports.Group=_t.Group;Object.defineProperty(exports,"LineSegmentsGeometry",{enumerable:!0,get:()=>je.LineSegmentsGeometry});Object.defineProperty(exports,"Line2Material",{enumerable:!0,get:()=>lt.LineMaterial});exports.ConicPolygon=Qt;exports.ExtrudePolygon=ii;exports.Image=ht;exports.Light=Ot;exports.Line=$t;exports.Line2=Nt;exports.MeshLineGeometry=ft;exports.MeshLineMaterial=pt;exports.MeshLineRaycast=Ht;exports.Node=Gt;exports.Pie=zt;exports.Text=It;exports.Video=Et;exports.getConicPolygonGeometry=mt;exports.getConicPolygonGeometryMetas=dt;exports.getSplitTexture=si;
@@ -1378,8 +1378,8 @@ class Ui extends st {
1378
1378
  const { width: t, height: e } = this.pencil.getSize();
1379
1379
  this.resize(t, e);
1380
1380
  }
1381
- dispose(t = !0) {
1382
- t && this.material.userData.tween && (this.material.userData.tween.stop(), at.remove(this.material.userData.tween)), super.dispose(t);
1381
+ dispose() {
1382
+ this.material.userData.tween && (this.material.userData.tween.stop(), at.remove(this.material.userData.tween)), super.dispose();
1383
1383
  }
1384
1384
  }
1385
1385
  function si(a, t) {
@@ -35,6 +35,6 @@ export default class Line extends BaseObject {
35
35
  onRepeat?: (...args: any[]) => void;
36
36
  }): void;
37
37
  render(): void;
38
- dispose(disposeWithMaterial?: boolean): void;
38
+ dispose(): void;
39
39
  }
40
40
  export {};
@@ -3,6 +3,7 @@ import { EventEmitter } from 'events';
3
3
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
4
4
  import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
5
5
  import { EXRLoader } from 'three/examples/jsm/loaders/EXRLoader';
6
+ import { LottieLoader } from 'three/examples/jsm/loaders/LottieLoader';
6
7
  import TextureLoader from './TextureLoader';
7
8
  import Pencil from "../../core/Pencil";
8
9
  type ValuesOf<T extends readonly any[]> = T[number];
@@ -12,12 +13,14 @@ export declare const KNOWN_ASSET_TYPES: {
12
13
  readonly gltf: readonly ["gltf", "glb"];
13
14
  readonly json: readonly ["json", "geojson"];
14
15
  readonly exr: readonly ["exr"];
16
+ readonly lottie: readonly ["lottie.json"];
15
17
  };
16
18
  type TypeImage = ValuesOf<(typeof KNOWN_ASSET_TYPES)['images']>;
17
19
  type TypeMedia = ValuesOf<(typeof KNOWN_ASSET_TYPES)['media']>;
18
20
  type TypeGLTF = ValuesOf<(typeof KNOWN_ASSET_TYPES)['gltf']>;
19
21
  type TypeJSON = ValuesOf<(typeof KNOWN_ASSET_TYPES)['json']>;
20
22
  type TypeEXR = ValuesOf<(typeof KNOWN_ASSET_TYPES)['exr']>;
23
+ type TypeLottie = ValuesOf<(typeof KNOWN_ASSET_TYPES)['lottie']>;
21
24
  interface AssetOptions {
22
25
  cacheVersion?: string;
23
26
  dracoPath?: string;
@@ -42,6 +45,7 @@ export default class Loader {
42
45
  jsonLoader?: THREE.FileLoader;
43
46
  dracoLoader?: DRACOLoader;
44
47
  exrLoader?: EXRLoader;
48
+ lottieLoader?: LottieLoader;
45
49
  loadObj: Asset[];
46
50
  delLoadArr: string[];
47
51
  assets: Map<string, THREE.Texture | THREE.Object3D | any>;
@@ -56,14 +60,15 @@ export default class Loader {
56
60
  getAsset(src: `${string}.${TypeGLTF}`): {
57
61
  scene: THREE.Object3D;
58
62
  };
63
+ getAsset(src: `${string}.${TypeLottie}`): THREE.Texture;
59
64
  getAsset(src: `${string}.${TypeJSON}`): any;
60
65
  getAsset(src: `${string}.${TypeEXR}`): THREE.DataTexture;
61
66
  getAsset(src: string): THREE.Texture;
62
- getAssetType(src: string): "json" | "gltf" | "exr" | "images" | "media" | undefined;
67
+ getAssetType(src: string): "json" | "gltf" | "exr" | "images" | "media" | "lottie" | undefined;
63
68
  install(pencil: Pencil): void;
64
69
  getLoader(type: string, options?: {
65
70
  dracoPath?: string;
66
- }): TextureLoader | THREE.FileLoader | GLTFLoader | EXRLoader | undefined;
71
+ }): TextureLoader | THREE.FileLoader | GLTFLoader | EXRLoader | LottieLoader | undefined;
67
72
  add(src: string | string[], options?: AssetOptions): void;
68
73
  getSrcByAsset(asset: THREE.Texture | THREE.Object3D | any, assets?: Map<string, any>): string | undefined;
69
74
  get textureAssets(): Map<string, THREE.Texture>;
@@ -73,6 +78,7 @@ export default class Loader {
73
78
  load(src: `${string}.${TypeGLTF}`, options?: AssetOptions): Promise<{
74
79
  scene: THREE.Object3D;
75
80
  }>;
81
+ load(src: `${string}.${TypeLottie}`, options?: AssetOptions): Promise<THREE.Texture>;
76
82
  load(src: `${string}.${TypeJSON}`, options?: AssetOptions): Promise<any>;
77
83
  load(src: `${string}.${TypeEXR}`, options?: AssetOptions): Promise<THREE.DataTexture>;
78
84
  load(src: string, options?: AssetOptions): Promise<THREE.Texture>;