gl-draw 0.17.0-beta.40 → 0.17.0-beta.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{objects/node → core/CSSRenderer}/CollisionManager.d.ts +5 -1
- package/dist/core/CSSRenderer/index.d.ts +18 -6
- package/dist/core/Pencil.d.ts +16 -2
- package/dist/index.js +2 -2
- package/dist/index.module.js +469 -297
- package/dist/index.module2.js +28 -25
- package/dist/index2.js +3 -3
- package/dist/objects/index.d.ts +0 -1
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +583 -724
- package/dist/objects/node/index.d.ts +0 -1
- package/package.json +1 -1
package/dist/index.module2.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Re = Object.defineProperty, _e = Object.defineProperties;
|
|
2
|
+
var Ne = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var R = Object.getOwnPropertySymbols;
|
|
4
4
|
var oe = Object.prototype.hasOwnProperty, ae = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var ce = Math.pow, re = (r, e, t) => e in r ?
|
|
5
|
+
var ce = Math.pow, re = (r, e, t) => e in r ? Re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, k = (r, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
7
|
oe.call(e, t) && re(r, t, e[t]);
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
8
|
+
if (R)
|
|
9
|
+
for (var t of R(e))
|
|
10
10
|
ae.call(e, t) && re(r, t, e[t]);
|
|
11
11
|
return r;
|
|
12
|
-
}, X = (r, e) =>
|
|
12
|
+
}, X = (r, e) => _e(r, Ne(e));
|
|
13
13
|
var le = (r, e) => {
|
|
14
14
|
var t = {};
|
|
15
15
|
for (var i in r)
|
|
16
16
|
oe.call(r, i) && e.indexOf(i) < 0 && (t[i] = r[i]);
|
|
17
|
-
if (r != null &&
|
|
18
|
-
for (var i of
|
|
17
|
+
if (r != null && R)
|
|
18
|
+
for (var i of R(r))
|
|
19
19
|
e.indexOf(i) < 0 && ae.call(r, i) && (t[i] = r[i]);
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
@@ -49,7 +49,7 @@ import { LineSegmentsGeometry as rt } from "three/examples/jsm/lines/LineSegment
|
|
|
49
49
|
import { CSS2DObject as ot } from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
50
50
|
import { CSS3DObject as at, CSS3DSprite as ct } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
51
51
|
import "d3-geo-projection";
|
|
52
|
-
const Me = 0, xe = 1,
|
|
52
|
+
const Me = 0, xe = 1, _t = !1;
|
|
53
53
|
class lt {
|
|
54
54
|
constructor() {
|
|
55
55
|
this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
|
|
@@ -91,7 +91,7 @@ class lt {
|
|
|
91
91
|
}), e.length = 0, this.resources.clear();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
const we = /* @__PURE__ */ new De(), We = /* @__PURE__ */ new $e(), Y = /* @__PURE__ */ new ze(),
|
|
94
|
+
const we = /* @__PURE__ */ new De(), We = /* @__PURE__ */ new $e(), Y = /* @__PURE__ */ new ze(), _ = /* @__PURE__ */ new S();
|
|
95
95
|
function ut(r, e) {
|
|
96
96
|
const t = this.geometry, i = this.matrixWorld, s = r.params.Points.threshold, o = t.drawRange;
|
|
97
97
|
t.boundingSphere === null && t.computeBoundingSphere(), Y.copy(t.boundingSphere), Y.applyMatrix4(i), Y.radius += s, we.copy(i).invert(), We.copy(r.ray).applyMatrix4(we);
|
|
@@ -100,8 +100,8 @@ function ut(r, e) {
|
|
|
100
100
|
const d = Math.max(0, o.start), u = Math.min(n.count, o.start + o.count);
|
|
101
101
|
for (let f = d, l = u; f < l; f++) {
|
|
102
102
|
const p = n.getX(f);
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
_.fromBufferAttribute(h, p), Se(
|
|
104
|
+
_,
|
|
105
105
|
p,
|
|
106
106
|
c,
|
|
107
107
|
i,
|
|
@@ -116,8 +116,8 @@ function ut(r, e) {
|
|
|
116
116
|
o.start + o.count
|
|
117
117
|
);
|
|
118
118
|
for (let f = d, l = u; f < l; f++)
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
_.fromBufferAttribute(h, f), Se(
|
|
120
|
+
_,
|
|
121
121
|
f,
|
|
122
122
|
c,
|
|
123
123
|
i,
|
|
@@ -713,7 +713,7 @@ const Mt = ({
|
|
|
713
713
|
n
|
|
714
714
|
)), { contour: d, triangles: u, sideTorso: f, bottomCap: m, topCap: b, topVerts: l };
|
|
715
715
|
};
|
|
716
|
-
class
|
|
716
|
+
class Nt extends se {
|
|
717
717
|
constructor(e, t = {}) {
|
|
718
718
|
super(), this.type = "PolygonBufferGeometry", this.parameters = k({
|
|
719
719
|
polygonGeoJson: e,
|
|
@@ -995,7 +995,7 @@ class Ut extends Ke {
|
|
|
995
995
|
this.uniforms.sizeAttenuation.value = e ? 1 : 0;
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
|
-
const Z = new V(), Pe = new S(), Ae = new S(), g = new V(), M = new V(), B = new V(), J = new S(), H = new De(), x = new Qe(), Ie = new S(),
|
|
998
|
+
const Z = new V(), Pe = new S(), Ae = new S(), g = new V(), M = new V(), B = new V(), J = new S(), H = new De(), x = new Qe(), Ie = new S(), N = new ke(), U = new ze(), O = new V();
|
|
999
999
|
let D, L;
|
|
1000
1000
|
function Te(r, e, t) {
|
|
1001
1001
|
return O.set(0, 0, -e, 1).applyMatrix4(r.projectionMatrix), O.multiplyScalar(1 / O.w), O.x = L / t.width, O.y = L / t.height, O.applyMatrix4(r.projectionMatrixInverse), O.multiplyScalar(1 / O.w), Math.abs(Math.max(O.x, O.y));
|
|
@@ -1097,14 +1097,14 @@ class Gt extends Le {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
if (U.radius += h, D.intersectsSphere(U) === !1)
|
|
1099
1099
|
return;
|
|
1100
|
-
n.boundingBox === null && n.computeBoundingBox(),
|
|
1100
|
+
n.boundingBox === null && n.computeBoundingBox(), N.copy(n.boundingBox).applyMatrix4(c);
|
|
1101
1101
|
let d;
|
|
1102
1102
|
if (i)
|
|
1103
1103
|
d = L * 0.5;
|
|
1104
1104
|
else {
|
|
1105
1105
|
const u = Math.max(
|
|
1106
1106
|
s.near,
|
|
1107
|
-
|
|
1107
|
+
N.distanceToPoint(D.origin)
|
|
1108
1108
|
);
|
|
1109
1109
|
d = Te(
|
|
1110
1110
|
s,
|
|
@@ -1112,7 +1112,7 @@ class Gt extends Le {
|
|
|
1112
1112
|
a.resolution
|
|
1113
1113
|
);
|
|
1114
1114
|
}
|
|
1115
|
-
|
|
1115
|
+
N.expandByScalar(d), D.intersectsBox(N) !== !1 && (i ? St(this, t) : jt(this, s, t));
|
|
1116
1116
|
}
|
|
1117
1117
|
onBeforeRender(e) {
|
|
1118
1118
|
const t = this.material.uniforms;
|
|
@@ -1126,8 +1126,9 @@ const v = class v extends ee {
|
|
|
1126
1126
|
}, e);
|
|
1127
1127
|
}
|
|
1128
1128
|
create() {
|
|
1129
|
+
var s;
|
|
1129
1130
|
const { position: e, children: t } = this.options, i = document.createElement("div");
|
|
1130
|
-
this.element = i, t && i.appendChild(t), this.options.type === "3d" ? this.createCSS3DObject(i) : this.options.type === "3dSprite" ? this.createCSS3DSprite(i) : this.createCSS2DObject(i), e && this.object3d.position.copy(e);
|
|
1131
|
+
this.element = i, t && i.appendChild(t), this.options.type === "3d" ? this.createCSS3DObject(i) : this.options.type === "3dSprite" ? this.createCSS3DSprite(i) : this.createCSS2DObject(i), e && this.object3d.position.copy(e), (s = this.pencil.cssRendererController) == null || s.collisionManager.add(this);
|
|
1131
1132
|
}
|
|
1132
1133
|
setChildren(e) {
|
|
1133
1134
|
this.options.children = e, this.element.innerHTML = "", this.element.appendChild(e);
|
|
@@ -1159,9 +1160,11 @@ const v = class v extends ee {
|
|
|
1159
1160
|
this.onNodePointerIndex.push(i);
|
|
1160
1161
|
}
|
|
1161
1162
|
dispose() {
|
|
1163
|
+
var t;
|
|
1164
|
+
(t = this.pencil.cssRendererController) == null || t.collisionManager.remove(this);
|
|
1162
1165
|
const e = this.options.children;
|
|
1163
|
-
e && v.sharedObserver && (v.observerMap.delete(e), v.sharedObserver.unobserve(e), v.observerMap.size === 0 && (v.sharedObserver.disconnect(), v.sharedObserver = void 0)), this.onNodePointerIndex.forEach((
|
|
1164
|
-
this.lead.removePickNode(
|
|
1166
|
+
e && v.sharedObserver && (v.observerMap.delete(e), v.sharedObserver.unobserve(e), v.observerMap.size === 0 && (v.sharedObserver.disconnect(), v.sharedObserver = void 0)), this.onNodePointerIndex.forEach((i) => {
|
|
1167
|
+
this.lead.removePickNode(i);
|
|
1165
1168
|
}), super.dispose();
|
|
1166
1169
|
}
|
|
1167
1170
|
};
|
|
@@ -1169,11 +1172,11 @@ v.observerMap = /* @__PURE__ */ new Map();
|
|
|
1169
1172
|
let Be = v;
|
|
1170
1173
|
export {
|
|
1171
1174
|
xe as B,
|
|
1172
|
-
|
|
1175
|
+
_t as I,
|
|
1173
1176
|
Gt as L,
|
|
1174
1177
|
Ut as M,
|
|
1175
1178
|
Be as N,
|
|
1176
|
-
|
|
1179
|
+
Nt as P,
|
|
1177
1180
|
lt as R,
|
|
1178
1181
|
ee as a,
|
|
1179
1182
|
Mt as g
|
package/dist/index2.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var Se=Object.defineProperty,je=Object.defineProperties;var Ce=Object.getOwnPropertyDescriptors;var
|
|
1
|
+
"use strict";var Se=Object.defineProperty,je=Object.defineProperties;var Ce=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var oe=Math.pow,se=(n,e,t)=>e in n?Se(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,k=(n,e)=>{for(var t in e||(e={}))re.call(e,t)&&se(n,t,e[t]);if(N)for(var t of N(e))ne.call(e,t)&&se(n,t,e[t]);return n},K=(n,e)=>je(n,Ce(e));var ae=(n,e)=>{var t={};for(var i in n)re.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&N)for(var i of N(n))e.indexOf(i)<0&&ne.call(n,i)&&(t[i]=n[i]);return t};var ce=(n,e,t)=>new Promise((i,s)=>{var o=a=>{try{r(t.next(a))}catch(d){s(d)}},l=a=>{try{r(t.throw(a))}catch(d){s(d)}},r=a=>a.done?i(a.value):Promise.resolve(a.value).then(o,l);r((t=t.apply(n,e)).next())});const R=require("d3-array"),H=require("earcut"),c=require("three"),Ae=require("@turf/boolean-clockwise"),L=require("./cartographicToCartesian.js"),Pe=require("delaunator"),Be=require("@turf/boolean-point-in-polygon"),W=require("d3-geo"),Ie=require("d3-geo-voronoi"),le=require("d3-scale"),Te=require("three/examples/jsm/lines/LineSegmentsGeometry"),Oe=require("three/examples/jsm/renderers/CSS2DRenderer"),ue=require("three/examples/jsm/renderers/CSS3DRenderer");require("d3-geo-projection");const he=0,ee=1,De=!1;class Me{constructor(){this.resources=new Set,this.disposeMaterial=!0,this.disposeVideo=!0}track(e){if(!e)return e;if(Array.isArray(e))return e.forEach(t=>this.track(t)),e;if(!this.disposeMaterial&&e instanceof c.Material)return e;if(e instanceof F?(e.disposeTrack&&e.object3d?this.track(e.object3d):this.resources.add(e),Object.values(e.materialList).map(t=>this.track(t))):(e instanceof c.Object3D||Reflect.has(e,"dispose"))&&this.resources.add(e),e instanceof F)e.children.forEach(t=>{t.disposeTrack=!1}),this.track(e.children);else if(e instanceof c.Object3D){const t=e;this.track(t.geometry),this.track(t.material),this.track(t.children)}else if(e instanceof c.Material){for(const i of Object.values(e))i instanceof c.Texture&&this.track(i);const t=e;if(t.uniforms){for(const i of Object.values(t.uniforms))if(i){const s=i.value;(s instanceof c.Texture||Array.isArray(s))&&this.track(s)}}}else this.disposeVideo&&e.isVideoTexture&&e.source.data&&this.resources.add(e.source.data);return e}dispose(){const e=[];for(const t of this.resources)t instanceof c.Object3D?e.push(t):t instanceof HTMLVideoElement&&t.pause(),Reflect.has(t,"dispose")&&t.dispose();e.forEach(t=>{t.removeFromParent()}),e.length=0,this.resources.clear()}}const de=new c.Matrix4,xe=new c.Ray,Q=new c.Sphere,U=new c.Vector3;function Ve(n,e){const t=this.geometry,i=this.matrixWorld,s=n.params.Points.threshold,o=t.drawRange;t.boundingSphere===null&&t.computeBoundingSphere(),Q.copy(t.boundingSphere),Q.applyMatrix4(i),Q.radius+=s,de.copy(i).invert(),xe.copy(n.ray).applyMatrix4(de);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),r=t.index,d=t.attributes.position;if(r!==null){const f=Math.max(0,o.start),h=Math.min(r.count,o.start+o.count);for(let p=f,u=h;p<u;p++){const m=r.getX(p);U.fromBufferAttribute(d,m),fe(U,m,l,i,n,e,this)}}else{const f=Math.max(0,o.start),h=Math.min(d.count,o.start+o.count);for(let p=f,u=h;p<u;p++)U.fromBufferAttribute(d,p),fe(U,p,l,i,n,e,this)}}function fe(n,e,t,i,s,o,l){const r=new c.Vector3;xe.closestPointToPoint(n,r),r.applyMatrix4(i);const a=s.ray.origin.distanceTo(n),d=r.distanceTo(n),f=Math.asin(d/a);if(f<t){if(a<s.near||a>s.far)return;o.push({distance:a,distanceToRay:d,angleToRay:f,point:r,index:e,face:null,object:l})}}const Ee=(n,e=1)=>{const t=new c.BufferGeometry;t.setAttribute("position",new c.Float32BufferAttribute(new Array(e*3).fill(0),3)),t.setAttribute("scaleAtt",new c.Float32BufferAttribute(new Array(e).fill(1),1));const i=n.material,s=new c.PointsMaterial({size:10,map:i.map,alphaMap:i.alphaMap,color:i.color,blending:i.blending,depthTest:i.depthTest,depthWrite:!1,opacity:i.opacity,transparent:!0,alphaTest:i.alphaTest,sizeAttenuation:!1});s.onBeforeCompile=l=>{l.vertexShader=`
|
|
2
2
|
attribute float scaleAtt;
|
|
3
3
|
${l.vertexShader.replace("gl_PointSize = size;","gl_PointSize = size * scaleAtt;")}
|
|
4
|
-
`};const o=new c.Points(t,s);return o.raycast=Ve,o},Le=(n,e)=>{const t=new c.Object3D;e.forEach((i,s)=>{const o=L.parseVector3(i.position),l=L.parseVector3(i.scale||[1,1,1]);t.position.copy(o),t.scale.copy(l),t.updateMatrix();const r=t.matrix.clone();if(n instanceof c.InstancedMesh||n.isInstantiate)n.setMatrixAt(s,r);else if(n instanceof c.Points||n.type==="Points"){const d=n.geometry,f=d.attributes.position.array,h=d.attributes.scaleAtt.array,p=new c.Vector3,u=new c.Vector3,m=new c.Quaternion,v=s*3,y=s*1;r.decompose(p,m,u),f[v]=p.x,f[v+1]=p.y,f[v+2]=p.z,h[y]=Math.max(u.x,u.y,u.z),d.attributes.position.needsUpdate=!0,d.attributes.scaleAtt.needsUpdate=!0}})};class ze{constructor(){this.onPointerIndex=[]}onPointerEvent(e,t){const i=this.lead.handlePick([this],e,t);this.onPointerIndex.push(i)}onClick(e){this.onPointerEvent("click",e)}onPointerEnter(e){this.onPointerEvent("enter",e)}onPointerEnterOnStop(e){this.onPointerEvent("enterOnStop",e)}onPointerLeave(e){this.onPointerEvent("leave",e)}onPointerMove(e){this.onPointerEvent("move",e)}onPointerDown(e){this.onPointerEvent("down",e)}dispose(){this.onPointerIndex.forEach(e=>{this.lead.removePick(e)})}}class ke extends ze{constructor(){super(...arguments),this.userData={},this.materialList={},this.useMaterialType="origin",this.disposeMaterialIfNotUsed=!0}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(i=>{const s=i.userData;i.userData={};const o=i.clone();return i.userData=s,o});{const i=t.userData;t.userData={};const s=t.clone();return t.userData=i,s}}setMaterialList(e,t){const i=this.object3d;if(!i||!i.material)return;this.materialList.origin||(this.materialList.origin=i.material);const s=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=s,s}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const i=this.mList.get(e);if(!i)return;const s=this.object3d;Array.isArray(s.material)&&t!==void 0?s.material[t]=i:s.material=i}useMListByName(e,t){if(!this.mList)return;const i=this.mList.getKeyByName(e);i&&this.useMListById(i,t)}dispose(){super.dispose(),this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed)}}class F extends ke{constructor(){super(...arguments),this.key="",this.objectType="BaseObject",this.userData={},this.isPrefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.isBaseObject=!0,this.disposeTrack=!0,this.isDispose=!1}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}lookAt(e){const t=e instanceof c.Vector3?e:new c.Vector3(...e);this.object3d.lookAt(t)}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{var i;this.lead.objMap.get(t)?(i=this.lead.objMap.get(t))==null||i.erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}isActuallyVisible(){if(!this.object3d.visible)return!1;const e=this.parent;return e?e.isActuallyVisible():!0}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this.isActuallyVisible()&&this._enableLayersRecursive(),this}hide(){return this.object3d.visible=!1,this._disableLayersRecursive(),this}_disableLayersRecursive(){var e;(e=this.object3d)==null||e.layers.disable(he),this.children.forEach(t=>{t._disableLayersRecursive()})}_enableLayersRecursive(){var e;this.object3d.visible&&((e=this.object3d)==null||e.layers.enable(he),this.children.forEach(t=>{t._enableLayersRecursive()}))}createGroup(){return this.object3d=new c.Group,this}createMesh(...e){return this.object3d=new c.Mesh(...e),this}createPoints(...e){return this.object3d=new c.Points(...e),this}createCSS2DObject(e){return this.object3d=new Oe.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new ue.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new ue.CSS3DSprite(e),this}createSprite(e){return this.object3d=new c.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new c.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new c.Vector3),center:e.getCenter(new c.Vector3)}}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}instantiate(e){return ce(this,null,function*(){var d,f;const t=(d=e==null?void 0:e.recursive)!=null?d:!0,i=(f=e==null?void 0:e.cloneMaterial)!=null?f:!1,{objectType:s,objectOptions:o}=this;let l=e==null?void 0:e.create,r,a=(e==null?void 0:e.target)||this.parent;return a===this.lead.prefabGroup&&(a=this.lead.group),this.objectType==="BaseObject"?r=this.lead.createBaseObject(this.object3d.clone(!1),{target:a}):(l===void 0&&(l=h=>{var p;if(this.object3d){if((p=e==null?void 0:e.instancedAttr)!=null&&p.length){const u=e.instancedAttr.length;if(this.object3d instanceof c.Sprite)h.object3d=Ee(this.object3d,u);else{const m=this.object3d,v=i?this.cloneMaterial():m.material;h.object3d=new c.InstancedMesh(m.geometry,v,u)}Le(h.object3d,e==null?void 0:e.instancedAttr)}else h.object3d=this.object3d.clone(!1),i&&h.object3d.material&&(h.object3d.material=this.cloneMaterial());h.object3d.userData.prefab&&delete h.object3d.userData.prefab}}),r=yield this.lead.draw(s,K(k({},o||{}),{create:l,prefab:!1,keyType:this.keyType,key:(e==null?void 0:e.key)||this.keyName,uId:(e==null?void 0:e.uId)||this.keyUId,target:a}))),this.isBloom&&r.enableBloom(),t&&(yield Promise.all(this.children.map(h=>h.instantiate({key:h.keyUId&&h.keyName?`${h.keyName}-${h.keyUId}`:h.keyName,uId:e==null?void 0:e.uId,cloneMaterial:i,target:r})))),r.isInstantiate=!0,r})}erase(){this.lead.erase(this)}handleMaterialChange(e){}enableBloom(e=!0){var t,i,s;if(!((t=this.pencil.composerController)!=null&&t.bloomComposer)){console.warn("err:pencil.options.bloom");return}if(e){this.traverse(o=>{o.enableBloom(!1)});return}this.object3d&&((i=this.pencil.composerController)==null||i.bloomSelection.add(this),this.object3d.layers.enable(ee)),(s=this.pencil.composerController)==null||s.checkBloomComposerActive(),this.isBloom=!0}disableBloom(e=!0){var t,i,s;if(!((t=this.pencil.composerController)!=null&&t.bloomComposer)){console.warn("err:pencil.options.bloom");return}if(e){this.traverse(o=>{o.disableBloom(!1)});return}this.object3d&&((i=this.pencil.composerController)==null||i.bloomSelection.delete(this),this.object3d.layers.disable(ee)),(s=this.pencil.composerController)==null||s.checkBloomComposerActive(),this.isBloom=!1}dispose(){var e,t;if(!this.isDispose&&(this.isDispose=!0,super.dispose(),this.isBloom&&(this.disableBloom(!1),(e=this.pencil.composerController)==null||e.checkBloomComposerActive()),(t=this.lead)==null||t.disableCursor(this),this.lead&&(this.lead.objects.delete(this.key),this.lead.objectWrapChindIdMap.delete(this),this.object3d&&this.lead.objMap.delete(this.object3d)),this.disposeTrack)){const i=new Me;i.disposeMaterial=!1,i.track(this),i.dispose()}}}function We(n,e){return n.map(t=>{const i=[];let s;return t.forEach(o=>{if(s){const l=_.geoDistance(o,s)*180/Math.PI;if(l>e){const r=_.geoInterpolate(s,o),a=1/Math.ceil(l/e);let d=a;for(;d<1;)i.push(r(d)),d+=a}}i.push(s=o)}),i})}function _e(n,{minLng:e,maxLng:t,minLat:i,maxLat:s}={}){const o=Math.round(oe(360/n,2)/Math.PI),l=(1+Math.sqrt(5))/2,r=u=>u/l*360%360-180,a=u=>Math.acos(2*u/o-1)/Math.PI*180-90,d=u=>o*(Math.cos((u+90)*Math.PI/180)+1)/2,f=[s!==void 0?Math.ceil(d(s)):0,i!==void 0?Math.floor(d(i)):o-1],h=e===void 0&&t===void 0?()=>!0:e===void 0?u=>u<=t:t===void 0?u=>u>=e:t>=e?u=>u>=e&&u<=t:u=>u>=e||u<=t,p=[];for(let u=f[0];u<=f[1];u++){const m=r(u);h(m)&&p.push([m,a(u)])}return p}function te(n,e,t=!1){return t?_.geoContains(e,n):Be(n,e)}function Ne(n,e){const t={type:"Polygon",coordinates:n},[[i,s],[o,l]]=_.geoBounds(t);if(Math.min(Math.abs(o-i),Math.abs(l-s))<e)return[];const r=i>o||l>=89||s<=-89;return _e(e,{minLng:i,maxLng:o,minLat:s,maxLat:l}).filter(a=>te(a,t,r))}function Re(n,{resolution:e=1/0,bbox:t,projection:i}={}){const s=We(n,e),o=W.merge(s),l=Ne(n,e),r=[...o,...l],a={type:"Polygon",coordinates:n},[[d,f],[h,p]]=_.geoBounds(a),u=d>h||p>=89||f<=-89;let m=[];if(u){const g=Ie.geoVoronoi(r).triangles(),S=new Map(r.map(([B,I],E)=>[`${B}-${I}`,E]));g.features.forEach(B=>{const I=B.geometry.coordinates[0].slice(0,3).reverse(),E=[];if(I.forEach(([P,X])=>{const N=`${P}-${X}`;S.has(N)&&E.push(S.get(N))}),E.length===3){if(E.some(P=>P<o.length)){const P=B.properties.circumcenter;if(!te(P,a,u))return}m.push(...E)}})}else if(l.length){const g=Pe.from(r);for(let S=0,B=g.triangles.length;S<B;S+=3){const I=[2,1,0].map(P=>g.triangles[S+P]),E=I.map(P=>r[P]);if(I.some(P=>P<o.length)){const P=[0,1].map(X=>W.mean(E,N=>N[X]));if(!te(P,a,u))continue}m.push(...I)}}else{const{vertices:g,holes:S=[]}=H.flatten(s);m=H(g,S,2)}let v=t?[t[0],t[2]]:W.extent(r,g=>g[0]),y=t?[t[1],t[3]]:W.extent(r,g=>g[1]);if(i){const[g,S]=i([v[0],y[0]]),[B,I]=i([v[1],y[1]]);v=[g,B],y=[-S,-I]}const j=le.scaleLinear(v,[0,1]),V=le.scaleLinear(y,[0,1]),C=r.map(([g,S])=>{if(i){const[B,I]=i([g,S]);return[j(B),V(-I)]}else return[j(g),V(S)]});return{contour:s,triangles:{points:r,indices:m,uvs:C}}}const pe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function $(n,e,t){const i=n.map(s=>s.map(([o,l])=>{if(t==="cesium"){const r=1/L.WGS84.a,a=e/r,d=Math.max(0,a-L.WGS84.a),f=L.cartographicToCartesian(o,l,d,r,!1);return[f.x,f.y,f.z]}if(t==="sphere"){const r=L.cartographicToCartesian(o,l,e-L.WGS84.a,1,!0);return[r.x,r.y,r.z]}if(typeof t=="function"){const[r,a]=t([o,l]);return[r,-a,e]}return[o,l,e]}));return H.flatten(i)}function Ue(n,e,t,i){const{vertices:s,holes:o}=$(n,e,i),{vertices:l}=$(n,t,i),r=W.merge([l,s]),a=Math.round(l.length/3),d=new Set(o);let f=0;const h=[];for(let u=0;u<a;u++){let m=u+1;if(m===a)m=f;else if(d.has(m)){const v=m;m=f,f=v}h.push(u,u+a,m+a),h.push(m+a,m,u)}const p=[];for(let u=1;u>=0;u--)for(let m=0;m<a;m+=1)p.push(m/(a-1),u);return{indices:h,vertices:r,uvs:p,topVerts:l}}function me(n,e,t,i,s){return{indices:i?n.indices:n.indices.slice().reverse(),vertices:$([n.points],e,s).vertices,uvs:t}}const we=({polygonGeoJson:n,startHeight:e,endHeight:t,curvatureResolution:i=1,hasSide:s=!0,hasBottom:o=!1,hasTop:l=!1,projection:r="sphere",bbox:a})=>{n.forEach(j=>{Ae(j)||j.reverse()});const d=typeof r=="function"?r:void 0,{contour:f,triangles:h}=Re(n,{resolution:i,bbox:a,projection:d});let p={},u;s&&(p=Ue(f,e!=null?e:t,t!=null?t:e,r),u=p.topVerts);let m=[];(o||l)&&(m=W.merge(h.uvs));let v={};o&&(v=me(h,e,m,!1,r));let y={};return l&&(y=me(h,t,m,!0,r)),{contour:f,triangles:h,sideTorso:p,bottomCap:v,topCap:y,topVerts:u}};class Ge extends c.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=k({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,projection:"sphere",userDataRsoOffset:0},t);const{endHeight:i,hasTop:s,topFirst:o,hasBottom:l,hasSide:r,userDataRsoOffset:a,projection:d}=this.parameters,{contour:f,sideTorso:h,topVerts:p,bottomCap:u,topCap:m}=we(k({},this.parameters));let v=[],y=[],j=[],V=0;const C=A=>{const g=Math.round(v.length/3),S=j.length;v=v.concat(A.vertices),y=y.concat(A.uvs),j=j.concat(g?A.indices.map(B=>B+g):A.indices),this.addGroup(S,j.length-S,V++)};s&&o&&C(m),r&&(C(h),this.userData.topVerts=a?$(f,i+a,d).vertices:p),l&&C(u),s&&!o&&C(m),this.setIndex(j),this[pe]("position",new c.Float32BufferAttribute(v,3)),this[pe]("uv",new c.Float32BufferAttribute(y,2)),this.computeVertexNormals()}}const qe=`
|
|
4
|
+
`};const o=new c.Points(t,s);return o.raycast=Ve,o},Le=(n,e)=>{const t=new c.Object3D;e.forEach((i,s)=>{const o=L.parseVector3(i.position),l=L.parseVector3(i.scale||[1,1,1]);t.position.copy(o),t.scale.copy(l),t.updateMatrix();const r=t.matrix.clone();if(n instanceof c.InstancedMesh||n.isInstantiate)n.setMatrixAt(s,r);else if(n instanceof c.Points||n.type==="Points"){const d=n.geometry,f=d.attributes.position.array,h=d.attributes.scaleAtt.array,p=new c.Vector3,u=new c.Vector3,m=new c.Quaternion,v=s*3,y=s*1;r.decompose(p,m,u),f[v]=p.x,f[v+1]=p.y,f[v+2]=p.z,h[y]=Math.max(u.x,u.y,u.z),d.attributes.position.needsUpdate=!0,d.attributes.scaleAtt.needsUpdate=!0}})};class ze{constructor(){this.onPointerIndex=[]}onPointerEvent(e,t){const i=this.lead.handlePick([this],e,t);this.onPointerIndex.push(i)}onClick(e){this.onPointerEvent("click",e)}onPointerEnter(e){this.onPointerEvent("enter",e)}onPointerEnterOnStop(e){this.onPointerEvent("enterOnStop",e)}onPointerLeave(e){this.onPointerEvent("leave",e)}onPointerMove(e){this.onPointerEvent("move",e)}onPointerDown(e){this.onPointerEvent("down",e)}dispose(){this.onPointerIndex.forEach(e=>{this.lead.removePick(e)})}}class ke extends ze{constructor(){super(...arguments),this.userData={},this.materialList={},this.useMaterialType="origin",this.disposeMaterialIfNotUsed=!0}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(i=>{const s=i.userData;i.userData={};const o=i.clone();return i.userData=s,o});{const i=t.userData;t.userData={};const s=t.clone();return t.userData=i,s}}setMaterialList(e,t){const i=this.object3d;if(!i||!i.material)return;this.materialList.origin||(this.materialList.origin=i.material);const s=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=s,s}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const i=this.mList.get(e);if(!i)return;const s=this.object3d;Array.isArray(s.material)&&t!==void 0?s.material[t]=i:s.material=i}useMListByName(e,t){if(!this.mList)return;const i=this.mList.getKeyByName(e);i&&this.useMListById(i,t)}dispose(){super.dispose(),this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed)}}class F extends ke{constructor(){super(...arguments),this.key="",this.objectType="BaseObject",this.userData={},this.isPrefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.isBaseObject=!0,this.disposeTrack=!0,this.isDispose=!1}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}lookAt(e){const t=e instanceof c.Vector3?e:new c.Vector3(...e);this.object3d.lookAt(t)}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{var i;this.lead.objMap.get(t)?(i=this.lead.objMap.get(t))==null||i.erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}isActuallyVisible(){if(!this.object3d.visible)return!1;const e=this.parent;return e?e.isActuallyVisible():!0}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this.isActuallyVisible()&&this._enableLayersRecursive(),this}hide(){return this.object3d.visible=!1,this._disableLayersRecursive(),this}_disableLayersRecursive(){var e;(e=this.object3d)==null||e.layers.disable(he),this.children.forEach(t=>{t._disableLayersRecursive()})}_enableLayersRecursive(){var e;this.object3d.visible&&((e=this.object3d)==null||e.layers.enable(he),this.children.forEach(t=>{t._enableLayersRecursive()}))}createGroup(){return this.object3d=new c.Group,this}createMesh(...e){return this.object3d=new c.Mesh(...e),this}createPoints(...e){return this.object3d=new c.Points(...e),this}createCSS2DObject(e){return this.object3d=new Oe.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new ue.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new ue.CSS3DSprite(e),this}createSprite(e){return this.object3d=new c.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new c.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new c.Vector3),center:e.getCenter(new c.Vector3)}}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}instantiate(e){return ce(this,null,function*(){var d,f;const t=(d=e==null?void 0:e.recursive)!=null?d:!0,i=(f=e==null?void 0:e.cloneMaterial)!=null?f:!1,{objectType:s,objectOptions:o}=this;let l=e==null?void 0:e.create,r,a=(e==null?void 0:e.target)||this.parent;return a===this.lead.prefabGroup&&(a=this.lead.group),this.objectType==="BaseObject"?r=this.lead.createBaseObject(this.object3d.clone(!1),{target:a}):(l===void 0&&(l=h=>{var p;if(this.object3d){if((p=e==null?void 0:e.instancedAttr)!=null&&p.length){const u=e.instancedAttr.length;if(this.object3d instanceof c.Sprite)h.object3d=Ee(this.object3d,u);else{const m=this.object3d,v=i?this.cloneMaterial():m.material;h.object3d=new c.InstancedMesh(m.geometry,v,u)}Le(h.object3d,e==null?void 0:e.instancedAttr)}else h.object3d=this.object3d.clone(!1),i&&h.object3d.material&&(h.object3d.material=this.cloneMaterial());h.object3d.userData.prefab&&delete h.object3d.userData.prefab}}),r=yield this.lead.draw(s,K(k({},o||{}),{create:l,prefab:!1,keyType:this.keyType,key:(e==null?void 0:e.key)||this.keyName,uId:(e==null?void 0:e.uId)||this.keyUId,target:a}))),this.isBloom&&r.enableBloom(),t&&(yield Promise.all(this.children.map(h=>h.instantiate({key:h.keyUId&&h.keyName?`${h.keyName}-${h.keyUId}`:h.keyName,uId:e==null?void 0:e.uId,cloneMaterial:i,target:r})))),r.isInstantiate=!0,r})}erase(){this.lead.erase(this)}handleMaterialChange(e){}enableBloom(e=!0){var t,i,s;if(!((t=this.pencil.composerController)!=null&&t.bloomComposer)){console.warn("err:pencil.options.bloom");return}if(e){this.traverse(o=>{o.enableBloom(!1)});return}this.object3d&&((i=this.pencil.composerController)==null||i.bloomSelection.add(this),this.object3d.layers.enable(ee)),(s=this.pencil.composerController)==null||s.checkBloomComposerActive(),this.isBloom=!0}disableBloom(e=!0){var t,i,s;if(!((t=this.pencil.composerController)!=null&&t.bloomComposer)){console.warn("err:pencil.options.bloom");return}if(e){this.traverse(o=>{o.disableBloom(!1)});return}this.object3d&&((i=this.pencil.composerController)==null||i.bloomSelection.delete(this),this.object3d.layers.disable(ee)),(s=this.pencil.composerController)==null||s.checkBloomComposerActive(),this.isBloom=!1}dispose(){var e,t;if(!this.isDispose&&(this.isDispose=!0,super.dispose(),this.isBloom&&(this.disableBloom(!1),(e=this.pencil.composerController)==null||e.checkBloomComposerActive()),(t=this.lead)==null||t.disableCursor(this),this.lead&&(this.lead.objects.delete(this.key),this.lead.objectWrapChindIdMap.delete(this),this.object3d&&this.lead.objMap.delete(this.object3d)),this.disposeTrack)){const i=new Me;i.disposeMaterial=!1,i.track(this),i.dispose()}}}function Re(n,e){return n.map(t=>{const i=[];let s;return t.forEach(o=>{if(s){const l=W.geoDistance(o,s)*180/Math.PI;if(l>e){const r=W.geoInterpolate(s,o),a=1/Math.ceil(l/e);let d=a;for(;d<1;)i.push(r(d)),d+=a}}i.push(s=o)}),i})}function We(n,{minLng:e,maxLng:t,minLat:i,maxLat:s}={}){const o=Math.round(oe(360/n,2)/Math.PI),l=(1+Math.sqrt(5))/2,r=u=>u/l*360%360-180,a=u=>Math.acos(2*u/o-1)/Math.PI*180-90,d=u=>o*(Math.cos((u+90)*Math.PI/180)+1)/2,f=[s!==void 0?Math.ceil(d(s)):0,i!==void 0?Math.floor(d(i)):o-1],h=e===void 0&&t===void 0?()=>!0:e===void 0?u=>u<=t:t===void 0?u=>u>=e:t>=e?u=>u>=e&&u<=t:u=>u>=e||u<=t,p=[];for(let u=f[0];u<=f[1];u++){const m=r(u);h(m)&&p.push([m,a(u)])}return p}function te(n,e,t=!1){return t?W.geoContains(e,n):Be(n,e)}function _e(n,e){const t={type:"Polygon",coordinates:n},[[i,s],[o,l]]=W.geoBounds(t);if(Math.min(Math.abs(o-i),Math.abs(l-s))<e)return[];const r=i>o||l>=89||s<=-89;return We(e,{minLng:i,maxLng:o,minLat:s,maxLat:l}).filter(a=>te(a,t,r))}function Ne(n,{resolution:e=1/0,bbox:t,projection:i}={}){const s=Re(n,e),o=R.merge(s),l=_e(n,e),r=[...o,...l],a={type:"Polygon",coordinates:n},[[d,f],[h,p]]=W.geoBounds(a),u=d>h||p>=89||f<=-89;let m=[];if(u){const g=Ie.geoVoronoi(r).triangles(),S=new Map(r.map(([B,I],E)=>[`${B}-${I}`,E]));g.features.forEach(B=>{const I=B.geometry.coordinates[0].slice(0,3).reverse(),E=[];if(I.forEach(([P,X])=>{const _=`${P}-${X}`;S.has(_)&&E.push(S.get(_))}),E.length===3){if(E.some(P=>P<o.length)){const P=B.properties.circumcenter;if(!te(P,a,u))return}m.push(...E)}})}else if(l.length){const g=Pe.from(r);for(let S=0,B=g.triangles.length;S<B;S+=3){const I=[2,1,0].map(P=>g.triangles[S+P]),E=I.map(P=>r[P]);if(I.some(P=>P<o.length)){const P=[0,1].map(X=>R.mean(E,_=>_[X]));if(!te(P,a,u))continue}m.push(...I)}}else{const{vertices:g,holes:S=[]}=H.flatten(s);m=H(g,S,2)}let v=t?[t[0],t[2]]:R.extent(r,g=>g[0]),y=t?[t[1],t[3]]:R.extent(r,g=>g[1]);if(i){const[g,S]=i([v[0],y[0]]),[B,I]=i([v[1],y[1]]);v=[g,B],y=[-S,-I]}const j=le.scaleLinear(v,[0,1]),V=le.scaleLinear(y,[0,1]),C=r.map(([g,S])=>{if(i){const[B,I]=i([g,S]);return[j(B),V(-I)]}else return[j(g),V(S)]});return{contour:s,triangles:{points:r,indices:m,uvs:C}}}const pe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function $(n,e,t){const i=n.map(s=>s.map(([o,l])=>{if(t==="cesium"){const r=1/L.WGS84.a,a=e/r,d=Math.max(0,a-L.WGS84.a),f=L.cartographicToCartesian(o,l,d,r,!1);return[f.x,f.y,f.z]}if(t==="sphere"){const r=L.cartographicToCartesian(o,l,e-L.WGS84.a,1,!0);return[r.x,r.y,r.z]}if(typeof t=="function"){const[r,a]=t([o,l]);return[r,-a,e]}return[o,l,e]}));return H.flatten(i)}function Ue(n,e,t,i){const{vertices:s,holes:o}=$(n,e,i),{vertices:l}=$(n,t,i),r=R.merge([l,s]),a=Math.round(l.length/3),d=new Set(o);let f=0;const h=[];for(let u=0;u<a;u++){let m=u+1;if(m===a)m=f;else if(d.has(m)){const v=m;m=f,f=v}h.push(u,u+a,m+a),h.push(m+a,m,u)}const p=[];for(let u=1;u>=0;u--)for(let m=0;m<a;m+=1)p.push(m/(a-1),u);return{indices:h,vertices:r,uvs:p,topVerts:l}}function me(n,e,t,i,s){return{indices:i?n.indices:n.indices.slice().reverse(),vertices:$([n.points],e,s).vertices,uvs:t}}const we=({polygonGeoJson:n,startHeight:e,endHeight:t,curvatureResolution:i=1,hasSide:s=!0,hasBottom:o=!1,hasTop:l=!1,projection:r="sphere",bbox:a})=>{n.forEach(j=>{Ae(j)||j.reverse()});const d=typeof r=="function"?r:void 0,{contour:f,triangles:h}=Ne(n,{resolution:i,bbox:a,projection:d});let p={},u;s&&(p=Ue(f,e!=null?e:t,t!=null?t:e,r),u=p.topVerts);let m=[];(o||l)&&(m=R.merge(h.uvs));let v={};o&&(v=me(h,e,m,!1,r));let y={};return l&&(y=me(h,t,m,!0,r)),{contour:f,triangles:h,sideTorso:p,bottomCap:v,topCap:y,topVerts:u}};class Ge extends c.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=k({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,projection:"sphere",userDataRsoOffset:0},t);const{endHeight:i,hasTop:s,topFirst:o,hasBottom:l,hasSide:r,userDataRsoOffset:a,projection:d}=this.parameters,{contour:f,sideTorso:h,topVerts:p,bottomCap:u,topCap:m}=we(k({},this.parameters));let v=[],y=[],j=[],V=0;const C=A=>{const g=Math.round(v.length/3),S=j.length;v=v.concat(A.vertices),y=y.concat(A.uvs),j=j.concat(g?A.indices.map(B=>B+g):A.indices),this.addGroup(S,j.length-S,V++)};s&&o&&C(m),r&&(C(h),this.userData.topVerts=a?$(f,i+a,d).vertices:p),l&&C(u),s&&!o&&C(m),this.setIndex(j),this[pe]("position",new c.Float32BufferAttribute(v,3)),this[pe]("uv",new c.Float32BufferAttribute(y,2)),this.computeVertexNormals()}}const qe=`
|
|
5
5
|
#include <fog_pars_fragment>
|
|
6
6
|
#include <logdepthbuf_pars_fragment>
|
|
7
7
|
|
|
@@ -137,4 +137,4 @@ void main() {
|
|
|
137
137
|
#include <logdepthbuf_vertex>
|
|
138
138
|
#include <fog_vertex>
|
|
139
139
|
}
|
|
140
|
-
`;class $e extends c.ShaderMaterial{constructor(e={}){const V=e,{lineWidth:t=1,color:i="#ffffff",opacity:s=1,map:o=null,dashOffset:l=0,dashArray:r=0,dashRatio:a=0,sizeAttenuation:d=!0,offsetLoop:f=!0,offset:h=new c.Vector2(0,0),scaleDown:p=0,alphaMap:u=void 0,alphaTest:m=0,repeat:v=new c.Vector2(1,1),resolution:y=new c.Vector2(1,1)}=V,j=ae(V,["lineWidth","color","opacity","map","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super(K(k({},j),{uniforms:{lineWidth:{value:t},color:{value:new c.Color(i)},opacity:{value:s},map:{value:o},useMap:{value:o?1:0},resolution:{value:y},sizeAttenuation:{value:d?1:0},offset:{value:h},offsetLoop:{value:f?1:0},dashArray:{value:r},dashOffset:{value:l},dashRatio:{value:a},useDash:{value:r>0?1:0},scaleDown:{value:p/10},alphaTest:{value:m},alphaMap:{value:u},useAlphaMap:{value:u?1:0},repeat:{value:v}},vertexShader:Fe,fragmentShader:qe})),this.type="MeshLineMaterial"}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new c.Color(e)}get opacity(){var e;return((e=this.uniforms)==null?void 0:e.opacity.value)||1}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get alphaTest(){return this.uniforms.alphaTest.value}set alphaTest(e){this.uniforms&&(this.uniforms.alphaTest.value=e)}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e,this.uniforms.useMap.value=e?1:0}get repeat(){return this.uniforms.repeat.value}set repeat(e){this.uniforms.repeat.value.copy(e)}get lineWidth(){return this.uniforms.lineWidth.value}set lineWidth(e){this.uniforms.lineWidth.value=e}get sizeAttenuation(){return this.uniforms.sizeAttenuation.value===1}set sizeAttenuation(e){this.uniforms.sizeAttenuation.value=e?1:0}}const Y=new c.Vector4,ve=new c.Vector3,be=new c.Vector3,M=new c.Vector4,x=new c.Vector4,T=new c.Vector4,Z=new c.Vector3,J=new c.Matrix4,w=new c.Line3,ye=new c.Vector3,G=new c.Box3,q=new c.Sphere,O=new c.Vector4;let D,z;function ge(n,e,t){return O.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),O.multiplyScalar(1/O.w),O.x=z/t.width,O.y=z/t.height,O.applyMatrix4(n.projectionMatrixInverse),O.multiplyScalar(1/O.w),Math.abs(Math.max(O.x,O.y))}function Xe(n,e){const t=n.matrixWorld,i=n.geometry,s=i.attributes.instanceStart,o=i.attributes.instanceEnd,l=Math.min(i.instanceCount,s.count);for(let r=0,a=l;r<a;r++){w.start.fromBufferAttribute(s,r),w.end.fromBufferAttribute(o,r),w.applyMatrix4(t);const d=new c.Vector3,f=new c.Vector3;D.distanceSqToSegment(w.start,w.end,f,d),f.distanceTo(d)<z*.5&&e.push({point:f,pointOnLine:d,distance:D.origin.distanceTo(f),object:n,face:null,faceIndex:r,uv:null,uv1:null})}}function Ke(n,e,t){const i=e.projectionMatrix,o=n.material.resolution,l=n.matrixWorld,r=n.geometry,a=r.attributes.instanceStart,d=r.attributes.instanceEnd,f=Math.min(r.instanceCount,a.count),h=-e.near;D.at(1,T),T.w=1,T.applyMatrix4(e.matrixWorldInverse),T.applyMatrix4(i),T.multiplyScalar(1/T.w),T.x*=o.x/2,T.y*=o.y/2,T.z=0,Z.copy(T),J.multiplyMatrices(e.matrixWorldInverse,l);for(let p=0,u=f;p<u;p++){if(M.fromBufferAttribute(a,p),x.fromBufferAttribute(d,p),M.w=1,x.w=1,M.applyMatrix4(J),x.applyMatrix4(J),M.z>h&&x.z>h)continue;if(M.z>h){const C=M.z-x.z,A=(M.z-h)/C;M.lerp(x,A)}else if(x.z>h){const C=x.z-M.z,A=(x.z-h)/C;x.lerp(M,A)}M.applyMatrix4(i),x.applyMatrix4(i),M.multiplyScalar(1/M.w),x.multiplyScalar(1/x.w),M.x*=o.x/2,M.y*=o.y/2,x.x*=o.x/2,x.y*=o.y/2,w.start.copy(M),w.start.z=0,w.end.copy(x),w.end.z=0;const v=w.closestPointToPointParameter(Z,!0);w.at(v,ye);const y=c.MathUtils.lerp(M.z,x.z,v),j=y>=-1&&y<=1,V=Z.distanceTo(ye)<z*.5;if(j&&V){w.start.fromBufferAttribute(a,p),w.end.fromBufferAttribute(d,p),w.start.applyMatrix4(l),w.end.applyMatrix4(l);const C=new c.Vector3,A=new c.Vector3;D.distanceSqToSegment(w.start,w.end,A,C),t.push({point:A,pointOnLine:C,distance:D.origin.distanceTo(A),object:n,face:null,faceIndex:p,uv:null,uv1:null})}}}class Qe extends c.Mesh{constructor(e=new Te.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let l=0,r=0,a=t.count;l<a;l++,r+=2)ve.fromBufferAttribute(t,l),be.fromBufferAttribute(i,l),s[r]=r===0?0:s[r-1],s[r+1]=s[r]+ve.distanceTo(be);const o=new c.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new c.InterleavedBufferAttribute(o,1,0)),e.setAttribute("instanceDistanceEnd",new c.InterleavedBufferAttribute(o,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;D=e.ray;const l=this.matrixWorld,r=this.geometry,a=this.material;z=a.linewidth+o,r.boundingSphere===null&&r.computeBoundingSphere(),q.copy(r.boundingSphere).applyMatrix4(l);let d;if(i)d=z*.5;else{const h=Math.max(s.near,q.distanceToPoint(D.origin));d=ge(s,h,a.resolution)}if(q.radius+=d,D.intersectsSphere(q)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),G.copy(r.boundingBox).applyMatrix4(l);let f;if(i)f=z*.5;else{const h=Math.max(s.near,G.distanceToPoint(D.origin));f=ge(s,h,a.resolution)}G.expandByScalar(f),D.intersectsBox(G)!==!1&&(i?Xe(this,t):Ke(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Y),this.material.uniforms.resolution.value.set(Y.z,Y.w))}}const b=class b extends F{constructor(e){super(),this.objectType="Node",this.onNodePointerIndex=[],this.options=k({type:"2d"},e)}create(){const{position:e,children:t}=this.options,i=document.createElement("div");this.element=i,t&&i.appendChild(t),this.options.type==="3d"?this.createCSS3DObject(i):this.options.type==="3dSprite"?this.createCSS3DSprite(i):this.createCSS2DObject(i),e&&this.object3d.position.copy(e)}setChildren(e){this.options.children=e,this.element.innerHTML="",this.element.appendChild(e)}showAndEnsureVisible(){const e=this.options.children;e&&(e.style.visibility="hidden",this.show(),setTimeout(()=>{e.style.visibility="",this.ensureVisible()}))}moveElementToViewport(){const e=this.options.children;if(!e)return;const t=e.getBoundingClientRect(),i=window.innerWidth,s=window.innerHeight,o=t.width,l=t.height;let r=0,a=0;o>i?t.left>0&&(r=-t.left):t.left<0?r=-t.left:t.right>i&&(r=i-t.right,t.left+r<0&&(r=-t.left)),l>s?t.top>0&&(a=-t.top):t.top<0?a=-t.top:t.bottom>s&&(a=s-t.bottom,t.top+a<0&&(a=-t.top)),(r!==0||a!==0)&&(e.style.transform=`translate(${r}px, ${a}px)`)}ensureVisible(){const e=this.options.children;e&&(e.style.transform&&(e.style.transform=""),!b.observerMap.has(e)&&(b.sharedObserver||(b.sharedObserver=new IntersectionObserver(t=>{t.forEach(i=>{const s=i.target,o=b.observerMap.get(s);o&&i.isIntersecting&&(o.moveElementToViewport(),b.observerMap.delete(s),b.sharedObserver&&(b.sharedObserver.unobserve(s),b.observerMap.size===0&&(b.sharedObserver.disconnect(),b.sharedObserver=void 0)))})})),b.observerMap.set(e,this),b.sharedObserver.observe(e)))}onPointerEvent(e,t){const i=this.lead.handlePickNode([this],e,t);this.onNodePointerIndex.push(i)}dispose(){const e=this.options.children;e&&b.sharedObserver&&(b.observerMap.delete(e),b.sharedObserver.unobserve(e),b.observerMap.size===0&&(b.sharedObserver.disconnect(),b.sharedObserver=void 0)),this.onNodePointerIndex.forEach(
|
|
140
|
+
`;class $e extends c.ShaderMaterial{constructor(e={}){const V=e,{lineWidth:t=1,color:i="#ffffff",opacity:s=1,map:o=null,dashOffset:l=0,dashArray:r=0,dashRatio:a=0,sizeAttenuation:d=!0,offsetLoop:f=!0,offset:h=new c.Vector2(0,0),scaleDown:p=0,alphaMap:u=void 0,alphaTest:m=0,repeat:v=new c.Vector2(1,1),resolution:y=new c.Vector2(1,1)}=V,j=ae(V,["lineWidth","color","opacity","map","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super(K(k({},j),{uniforms:{lineWidth:{value:t},color:{value:new c.Color(i)},opacity:{value:s},map:{value:o},useMap:{value:o?1:0},resolution:{value:y},sizeAttenuation:{value:d?1:0},offset:{value:h},offsetLoop:{value:f?1:0},dashArray:{value:r},dashOffset:{value:l},dashRatio:{value:a},useDash:{value:r>0?1:0},scaleDown:{value:p/10},alphaTest:{value:m},alphaMap:{value:u},useAlphaMap:{value:u?1:0},repeat:{value:v}},vertexShader:Fe,fragmentShader:qe})),this.type="MeshLineMaterial"}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new c.Color(e)}get opacity(){var e;return((e=this.uniforms)==null?void 0:e.opacity.value)||1}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get alphaTest(){return this.uniforms.alphaTest.value}set alphaTest(e){this.uniforms&&(this.uniforms.alphaTest.value=e)}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e,this.uniforms.useMap.value=e?1:0}get repeat(){return this.uniforms.repeat.value}set repeat(e){this.uniforms.repeat.value.copy(e)}get lineWidth(){return this.uniforms.lineWidth.value}set lineWidth(e){this.uniforms.lineWidth.value=e}get sizeAttenuation(){return this.uniforms.sizeAttenuation.value===1}set sizeAttenuation(e){this.uniforms.sizeAttenuation.value=e?1:0}}const Y=new c.Vector4,ve=new c.Vector3,be=new c.Vector3,M=new c.Vector4,x=new c.Vector4,T=new c.Vector4,Z=new c.Vector3,J=new c.Matrix4,w=new c.Line3,ye=new c.Vector3,G=new c.Box3,q=new c.Sphere,O=new c.Vector4;let D,z;function ge(n,e,t){return O.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),O.multiplyScalar(1/O.w),O.x=z/t.width,O.y=z/t.height,O.applyMatrix4(n.projectionMatrixInverse),O.multiplyScalar(1/O.w),Math.abs(Math.max(O.x,O.y))}function Xe(n,e){const t=n.matrixWorld,i=n.geometry,s=i.attributes.instanceStart,o=i.attributes.instanceEnd,l=Math.min(i.instanceCount,s.count);for(let r=0,a=l;r<a;r++){w.start.fromBufferAttribute(s,r),w.end.fromBufferAttribute(o,r),w.applyMatrix4(t);const d=new c.Vector3,f=new c.Vector3;D.distanceSqToSegment(w.start,w.end,f,d),f.distanceTo(d)<z*.5&&e.push({point:f,pointOnLine:d,distance:D.origin.distanceTo(f),object:n,face:null,faceIndex:r,uv:null,uv1:null})}}function Ke(n,e,t){const i=e.projectionMatrix,o=n.material.resolution,l=n.matrixWorld,r=n.geometry,a=r.attributes.instanceStart,d=r.attributes.instanceEnd,f=Math.min(r.instanceCount,a.count),h=-e.near;D.at(1,T),T.w=1,T.applyMatrix4(e.matrixWorldInverse),T.applyMatrix4(i),T.multiplyScalar(1/T.w),T.x*=o.x/2,T.y*=o.y/2,T.z=0,Z.copy(T),J.multiplyMatrices(e.matrixWorldInverse,l);for(let p=0,u=f;p<u;p++){if(M.fromBufferAttribute(a,p),x.fromBufferAttribute(d,p),M.w=1,x.w=1,M.applyMatrix4(J),x.applyMatrix4(J),M.z>h&&x.z>h)continue;if(M.z>h){const C=M.z-x.z,A=(M.z-h)/C;M.lerp(x,A)}else if(x.z>h){const C=x.z-M.z,A=(x.z-h)/C;x.lerp(M,A)}M.applyMatrix4(i),x.applyMatrix4(i),M.multiplyScalar(1/M.w),x.multiplyScalar(1/x.w),M.x*=o.x/2,M.y*=o.y/2,x.x*=o.x/2,x.y*=o.y/2,w.start.copy(M),w.start.z=0,w.end.copy(x),w.end.z=0;const v=w.closestPointToPointParameter(Z,!0);w.at(v,ye);const y=c.MathUtils.lerp(M.z,x.z,v),j=y>=-1&&y<=1,V=Z.distanceTo(ye)<z*.5;if(j&&V){w.start.fromBufferAttribute(a,p),w.end.fromBufferAttribute(d,p),w.start.applyMatrix4(l),w.end.applyMatrix4(l);const C=new c.Vector3,A=new c.Vector3;D.distanceSqToSegment(w.start,w.end,A,C),t.push({point:A,pointOnLine:C,distance:D.origin.distanceTo(A),object:n,face:null,faceIndex:p,uv:null,uv1:null})}}}class Qe extends c.Mesh{constructor(e=new Te.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let l=0,r=0,a=t.count;l<a;l++,r+=2)ve.fromBufferAttribute(t,l),be.fromBufferAttribute(i,l),s[r]=r===0?0:s[r-1],s[r+1]=s[r]+ve.distanceTo(be);const o=new c.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new c.InterleavedBufferAttribute(o,1,0)),e.setAttribute("instanceDistanceEnd",new c.InterleavedBufferAttribute(o,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;D=e.ray;const l=this.matrixWorld,r=this.geometry,a=this.material;z=a.linewidth+o,r.boundingSphere===null&&r.computeBoundingSphere(),q.copy(r.boundingSphere).applyMatrix4(l);let d;if(i)d=z*.5;else{const h=Math.max(s.near,q.distanceToPoint(D.origin));d=ge(s,h,a.resolution)}if(q.radius+=d,D.intersectsSphere(q)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),G.copy(r.boundingBox).applyMatrix4(l);let f;if(i)f=z*.5;else{const h=Math.max(s.near,G.distanceToPoint(D.origin));f=ge(s,h,a.resolution)}G.expandByScalar(f),D.intersectsBox(G)!==!1&&(i?Xe(this,t):Ke(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Y),this.material.uniforms.resolution.value.set(Y.z,Y.w))}}const b=class b extends F{constructor(e){super(),this.objectType="Node",this.onNodePointerIndex=[],this.options=k({type:"2d"},e)}create(){var s;const{position:e,children:t}=this.options,i=document.createElement("div");this.element=i,t&&i.appendChild(t),this.options.type==="3d"?this.createCSS3DObject(i):this.options.type==="3dSprite"?this.createCSS3DSprite(i):this.createCSS2DObject(i),e&&this.object3d.position.copy(e),(s=this.pencil.cssRendererController)==null||s.collisionManager.add(this)}setChildren(e){this.options.children=e,this.element.innerHTML="",this.element.appendChild(e)}showAndEnsureVisible(){const e=this.options.children;e&&(e.style.visibility="hidden",this.show(),setTimeout(()=>{e.style.visibility="",this.ensureVisible()}))}moveElementToViewport(){const e=this.options.children;if(!e)return;const t=e.getBoundingClientRect(),i=window.innerWidth,s=window.innerHeight,o=t.width,l=t.height;let r=0,a=0;o>i?t.left>0&&(r=-t.left):t.left<0?r=-t.left:t.right>i&&(r=i-t.right,t.left+r<0&&(r=-t.left)),l>s?t.top>0&&(a=-t.top):t.top<0?a=-t.top:t.bottom>s&&(a=s-t.bottom,t.top+a<0&&(a=-t.top)),(r!==0||a!==0)&&(e.style.transform=`translate(${r}px, ${a}px)`)}ensureVisible(){const e=this.options.children;e&&(e.style.transform&&(e.style.transform=""),!b.observerMap.has(e)&&(b.sharedObserver||(b.sharedObserver=new IntersectionObserver(t=>{t.forEach(i=>{const s=i.target,o=b.observerMap.get(s);o&&i.isIntersecting&&(o.moveElementToViewport(),b.observerMap.delete(s),b.sharedObserver&&(b.sharedObserver.unobserve(s),b.observerMap.size===0&&(b.sharedObserver.disconnect(),b.sharedObserver=void 0)))})})),b.observerMap.set(e,this),b.sharedObserver.observe(e)))}onPointerEvent(e,t){const i=this.lead.handlePickNode([this],e,t);this.onNodePointerIndex.push(i)}dispose(){var t;(t=this.pencil.cssRendererController)==null||t.collisionManager.remove(this);const e=this.options.children;e&&b.sharedObserver&&(b.observerMap.delete(e),b.sharedObserver.unobserve(e),b.observerMap.size===0&&(b.sharedObserver.disconnect(),b.sharedObserver=void 0)),this.onNodePointerIndex.forEach(i=>{this.lead.removePickNode(i)}),super.dispose()}};b.observerMap=new Map;let ie=b;exports.BLOOM_SCENE=ee;exports.BaseObject=F;exports.IS_DEV=De;exports.LineSegments2=Qe;exports.MeshLineMaterial=$e;exports.Node=ie;exports.PolygonGeometry=Ge;exports.ResourceTracker=Me;exports.getMetas=we;
|
package/dist/objects/index.d.ts
CHANGED
|
@@ -11,5 +11,4 @@ export { default as Line } from './line';
|
|
|
11
11
|
export { MeshLineGeometry, MeshLineMaterial, MeshLineRaycast, } from './line/meshLine';
|
|
12
12
|
export { default as Line2 } from './line2';
|
|
13
13
|
export { default as Node } from './node';
|
|
14
|
-
export { default as CollisionManage } from './node/CollisionManager';
|
|
15
14
|
export { default as Pie } from './pie';
|
package/dist/objects/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ye=Object.defineProperty,Ze=Object.defineProperties;var $e=Object.getOwnPropertyDescriptors;var ue=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable;var je=(d,e,t)=>e in d?Ye(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t,R=(d,e)=>{for(var t in e||(e={}))Pe.call(e,t)&&je(d,t,e[t]);if(ue)for(var t of ue(e))ze.call(e,t)&&je(d,t,e[t]);return d},fe=(d,e)=>Ze(d,$e(e));var ge=(d,e)=>{var t={};for(var s in d)Pe.call(d,s)&&e.indexOf(s)<0&&(t[s]=d[s]);if(d!=null&&ue)for(var s of ue(d))e.indexOf(s)<0&&ze.call(d,s)&&(t[s]=d[s]);return t};var oe=(d,e,t)=>new Promise((s,n)=>{var r=o=>{try{l(t.next(o))}catch(u){n(u)}},c=o=>{try{l(t.throw(o))}catch(u){n(u)}},l=o=>o.done?s(o.value):Promise.resolve(o.value).then(r,c);l((t=t.apply(d,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const De=require("three/examples/jsm/lines/LineMaterial"),qe=require("three/examples/jsm/lines/LineSegmentsGeometry"),O=require("../index2.js"),a=require("three"),ye=require("three/examples/jsm/utils/BufferGeometryUtils"),be=require("../cartographicToCartesian.js"),_e=require("../uvGenerator.js"),de=require("three-bvh-csg"),Je=require("three/examples/jsm/lights/RectAreaLightUniformsLib"),Qe=require("@tweenjs/tween.js"),Ke=require("three/examples/jsm/lines/LineSegments2");function et(d){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const t in d)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(d,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>d[t]})}}return e.default=d,Object.freeze(e)}const ne=et(Qe);function X(d,e=0){const t=d[0].index!==null,s=new Set(Object.keys(d[0].attributes)),n=new Set(Object.keys(d[0].morphAttributes)),r={},c={},l=d[0].morphTargetsRelative,o=new a.BufferGeometry;let u=0;for(let i=0;i<d.length;++i){const h=d[i];let y=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const p in h.attributes){if(!s.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;r[p]===void 0&&(r[p]=[]),r[p].push(h.attributes[p]),y++}if(y!==s.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". Make sure all geometries have the same number of attributes."),null;if(l!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const p in h.morphAttributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". .morphAttributes must be consistent throughout all geometries."),null;c[p]===void 0&&(c[p]=[]),c[p].push(h.morphAttributes[p])}if(e){let p;if(t)p=h.index.count;else if(h.attributes.position!==void 0)p=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". The geometry must have either an index or a position attribute"),null;if(e===1)o.addGroup(u,p,i);else if(e===2&&h.groups.length>0)for(let b of h.groups){let L=b.materialIndex;o.addGroup(u+b.start,Math.min(b.count,p),L)}u+=p}}if(t){let i=0;const h=[];for(let y=0;y<d.length;++y){const p=d[y].index;for(let b=0;b<p.count;++b)h.push(p.getX(b)+i);i+=d[y].attributes.position.count}o.setIndex(h)}for(const i in r){const h=ye.mergeAttributes(r[i]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+i+" attribute."),null;o.setAttribute(i,h)}for(const i in c){const h=c[i][0].length;if(h===0)break;o.morphAttributes=o.morphAttributes||{},o.morphAttributes[i]=[];for(let y=0;y<h;++y){const p=[];for(let L=0;L<c[i].length;++L)p.push(c[i][L][y]);const b=ye.mergeAttributes(p);if(!b)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+i+" morphAttribute."),null;o.morphAttributes[i].push(b)}}return e===2?ye.mergeGroups(o):o}const Oe=d=>{const l=d,{coordinate:e,startHeight:t,height:s}=l,n=ge(l,["coordinate","startHeight","height"]);let r=t||0;return typeof t!="undefined"&&typeof s!="undefined"&&(r=t+s),new O.PolygonGeometry([e],fe(R({},n),{startHeight:t,endHeight:r}))};class tt extends O.BaseObject{constructor(e){super(),this.options=R({},e)}create(){const o=this.options,{geometry:e,coordinateArr:t,coordinate:s,material:n,useGroups:r}=o,c=ge(o,["geometry","coordinateArr","coordinate","material","useGroups"]);let l=e;if(!l&&s)l=Oe(R({coordinate:s},c));else if(!l&&t){const u=t.map(i=>Oe(R({coordinate:i},c)));l=X(u,r!=null?r:0)}this.createMesh(l,n)}}function st(d={}){const{a:e=be.WGS84.a,b:t=be.WGS84.b,scaleFactor:s=1/be.WGS84.a,widthSegments:n=64,heightSegments:r=32}=d,c=new a.BufferGeometry,l=[],o=[],u=[],i=[],h=e*e,y=t*t,p=(h-y)/h;let b=0;const L=[];for(let v=0;v<=r;v++){const S=[],B=v/r,E=(.5-B)*180*Math.PI/180,I=Math.sin(E),U=Math.cos(E),N=e/Math.sqrt(1-p*I*I);for(let j=0;j<=n;j++){const $=j/n,H=($-.5)*360*Math.PI/180,ie=Math.sin(H),P=Math.cos(H),z=N*U*ie*s,xe=N*(1-p)*I*s,re=N*U*P*s;o.push(z,xe,re);const Q=U*ie/e,_=I*(1-p)/t,F=U*P/e,D=Math.sqrt(Q*Q+_*_+F*F);u.push(Q/D,_/D,F/D),i.push($,1-B),S.push(b++)}L.push(S)}for(let v=0;v<r;v++)for(let S=0;S<n;S++){const B=L[v][S+1],A=L[v][S],E=L[v+1][S],I=L[v+1][S+1];l.push(B,A,I),l.push(A,E,I)}return c.setIndex(l),c.setAttribute("position",new a.Float32BufferAttribute(o,3)),c.setAttribute("normal",new a.Float32BufferAttribute(u,3)),c.setAttribute("uv",new a.Float32BufferAttribute(i,2)),c}class nt extends O.BaseObject{constructor(e={}){super(),this.options=e}create(){const e=st(this.options),t=this.options.material||new a.MeshStandardMaterial({color:2200782,metalness:.1,roughness:.7,wireframe:!1}),s=new a.Mesh(e,t);return s.name="Ellipsoid",this.object3d=s,s}}const it={ArcCurve:a.ArcCurve,CatmullRomCurve3:a.CatmullRomCurve3,CubicBezierCurve:a.CubicBezierCurve,CubicBezierCurve3:a.CubicBezierCurve3,EllipseCurve:a.EllipseCurve,LineCurve:a.LineCurve,LineCurve3:a.LineCurve3,QuadraticBezierCurve:a.QuadraticBezierCurve,QuadraticBezierCurve3:a.QuadraticBezierCurve3,SplineCurve:a.SplineCurve};class te extends a.BufferGeometry{constructor(e=new a.Shape([new a.Vector2(.5,.5),new a.Vector2(-.5,.5),new a.Vector2(-.5,-.5),new a.Vector2(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const s=this,n=[],r=[];for(let l=0,o=e.length;l<o;l++){const u=e[l];c(u)}this.setAttribute("position",new a.Float32BufferAttribute(n,3)),this.setAttribute("uv",new a.Float32BufferAttribute(r,2)),this.computeVertexNormals();function c(l){var Me,Le,Ce;const o=[],u=t.curveSegments!==void 0?t.curveSegments:12,i=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let y=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,b=t.bevelSize!==void 0?t.bevelSize:p-.1,L=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const S=t.extrudePath,B=t.UVGenerator!==void 0?t.UVGenerator:ot,A=(Me=t.hasTop)!=null?Me:!0,E=(Le=t.hasBottom)!=null?Le:!0,I=(Ce=t.hasSide)!=null?Ce:!0;let U,N=!1,j,$,se,H;S&&(U=S.getSpacedPoints(i),N=!0,y=!1,j=S.computeFrenetFrames(i,!1),$=new a.Vector3,se=new a.Vector3,H=new a.Vector3),y||(v=0,p=0,b=0,L=0);const ie=l.extractPoints(u);let P=ie.shape;const z=ie.holes;if(!a.ShapeUtils.isClockWise(P)){P=P.reverse();for(let f=0,m=z.length;f<m;f++){const g=z[f];a.ShapeUtils.isClockWise(g)&&(z[f]=g.reverse())}}function re(f){const g=10000000000000001e-36;let x=f[0];for(let w=1;w<=f.length;w++){const C=w%f.length,M=f[C],T=M.x-x.x,G=M.y-x.y,V=T*T+G*G,q=Math.max(Math.abs(M.x),Math.abs(M.y),Math.abs(x.x),Math.abs(x.y)),ee=g*q*q;if(V<=ee){f.splice(C,1),w--;continue}x=M}}re(P),z.forEach(re);const Q=z.length,_=P;for(let f=0;f<Q;f++){const m=z[f];P=P.concat(m)}function F(f,m,g){return m||error("ExtrudeGeometry: vec does not exist"),f.clone().addScaledVector(m,g)}const D=P.length;function ve(f,m,g){let x,w,C;const M=f.x-m.x,T=f.y-m.y,G=g.x-f.x,V=g.y-f.y,q=M*M+T*T,ee=M*V-T*G;if(Math.abs(ee)>Number.EPSILON){const W=Math.sqrt(q),Te=Math.sqrt(G*G+V*V),Ge=m.x-T/W,Be=m.y+M/W,Xe=g.x-V/Te,ke=g.y+G/Te,Ve=((Xe-Ge)*V-(ke-Be)*G)/(M*V-T*G);x=Ge+M*Ve-f.x,w=Be+T*Ve-f.y;const Ee=x*x+w*w;if(Ee<=2)return new a.Vector2(x,w);C=Math.sqrt(Ee/2)}else{let W=!1;M>Number.EPSILON?G>Number.EPSILON&&(W=!0):M<-Number.EPSILON?G<-Number.EPSILON&&(W=!0):Math.sign(T)===Math.sign(V)&&(W=!0),W?(x=-T,w=M,C=Math.sqrt(q)):(x=M,w=T,C=Math.sqrt(q/2))}return new a.Vector2(x/C,w/C)}const ae=[];for(let f=0,m=_.length,g=m-1,x=f+1;f<m;f++,g++,x++)g===m&&(g=0),x===m&&(x=0),ae[f]=ve(_[f],_[g],_[x]);const me=[];let J,ce=ae.concat();for(let f=0,m=Q;f<m;f++){const g=z[f];J=[];for(let x=0,w=g.length,C=w-1,M=x+1;x<w;x++,C++,M++)C===w&&(C=0),M===w&&(M=0),J[x]=ve(g[x],g[C],g[M]);me.push(J),ce=ce.concat(J)}let K;if(v===0)K=a.ShapeUtils.triangulateShape(_,z);else{const f=[],m=[];for(let g=0;g<v;g++){const x=g/v,w=p*Math.cos(x*Math.PI/2),C=b*Math.sin(x*Math.PI/2)+L;for(let M=0,T=_.length;M<T;M++){const G=F(_[M],ae[M],C);k(G.x,G.y,-w),x===0&&f.push(G)}for(let M=0,T=Q;M<T;M++){const G=z[M];J=me[M];const V=[];for(let q=0,ee=G.length;q<ee;q++){const W=F(G[q],J[q],C);k(W.x,W.y,-w),x===0&&V.push(W)}x===0&&m.push(V)}}K=a.ShapeUtils.triangulateShape(f,m)}const le=K.length,Se=b+L;for(let f=0;f<D;f++){const m=y?F(P[f],ce[f],Se):P[f];N?(se.copy(j.normals[0]).multiplyScalar(m.x),$.copy(j.binormals[0]).multiplyScalar(m.y),H.copy(U[0]).add(se).add($),k(H.x,H.y,H.z)):k(m.x,m.y,0)}for(let f=1;f<=i;f++)for(let m=0;m<D;m++){const g=y?F(P[m],ce[m],Se):P[m];N?(se.copy(j.normals[f]).multiplyScalar(g.x),$.copy(j.binormals[f]).multiplyScalar(g.y),H.copy(U[f]).add(se).add($),k(H.x,H.y,H.z)):k(g.x,g.y,h/i*f)}for(let f=v-1;f>=0;f--){const m=f/v,g=p*Math.cos(m*Math.PI/2),x=b*Math.sin(m*Math.PI/2)+L;for(let w=0,C=_.length;w<C;w++){const M=F(_[w],ae[w],x);k(M.x,M.y,h+g)}for(let w=0,C=z.length;w<C;w++){const M=z[w];J=me[w];for(let T=0,G=M.length;T<G;T++){const V=F(M[T],J[T],x);N?k(V.x,V.y+U[i-1].y,U[i-1].x+g):k(V.x,V.y,h+g)}}}He(),I&&Ne();function He(){const f=n.length/3;if(y){let m=0,g=D*m;if(E)for(let x=0;x<le;x++){const w=K[x];he(w[2]+g,w[1]+g,w[0]+g)}if(m=i+v*2,g=D*m,A)for(let x=0;x<le;x++){const w=K[x];he(w[0]+g,w[1]+g,w[2]+g)}}else{if(E)for(let m=0;m<le;m++){const g=K[m];he(g[2],g[1],g[0])}if(A)for(let m=0;m<le;m++){const g=K[m];he(g[0]+D*i,g[1]+D*i,g[2]+D*i)}}s.addGroup(f,n.length/3-f,0)}function Ne(){const f=n.length/3;let m=0;Ae(_,m),m+=_.length;for(let g=0,x=z.length;g<x;g++){const w=z[g];Ae(w,m),m+=w.length}s.addGroup(f,n.length/3-f,1)}function Ae(f,m){let g=f.length;for(;--g>=0;){const x=g;let w=g-1;w<0&&(w=f.length-1);for(let C=0,M=i+v*2;C<M;C++){const T=D*C,G=D*(C+1),V=m+x+T,q=m+w+T,ee=m+w+G,W=m+x+G;Fe(V,q,ee,W)}}}function k(f,m,g){o.push(f),o.push(m),o.push(g)}function he(f,m,g){Y(f),Y(m),Y(g);const x=n.length/3,w=B.generateTopUV(s,n,x-3,x-2,x-1);Z(w[0]),Z(w[1]),Z(w[2])}function Fe(f,m,g,x){Y(f),Y(m),Y(x),Y(m),Y(g),Y(x);const w=n.length/3,C=B.generateSideWallUV(s,n,w-6,w-3,w-2,w-1);Z(C[0]),Z(C[1]),Z(C[3]),Z(C[1]),Z(C[2]),Z(C[3])}function Y(f){n.push(o[f*3+0]),n.push(o[f*3+1]),n.push(o[f*3+2])}function Z(f){r.push(f.x),r.push(f.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,s=this.parameters.options;return rt(t,s,e)}static fromJSON(e,t){const s=[];for(let r=0,c=e.shapes.length;r<c;r++){const l=t[e.shapes[r]];s.push(l)}const n=e.options.extrudePath;return n!==void 0&&(e.options.extrudePath=new it[n.type]().fromJSON(n)),new te(s,e.options)}}const ot={generateTopUV:function(d,e,t,s,n){const r=e[t*3],c=e[t*3+1],l=e[s*3],o=e[s*3+1],u=e[n*3],i=e[n*3+1];return[new a.Vector2(r,c),new a.Vector2(l,o),new a.Vector2(u,i)]},generateSideWallUV:function(d,e,t,s,n,r){const c=e[t*3],l=e[t*3+1],o=e[t*3+2],u=e[s*3],i=e[s*3+1],h=e[s*3+2],y=e[n*3],p=e[n*3+1],b=e[n*3+2],L=e[r*3],v=e[r*3+1],S=e[r*3+2];return Math.abs(l-i)<Math.abs(c-u)?[new a.Vector2(c,1-o),new a.Vector2(u,1-h),new a.Vector2(y,1-b),new a.Vector2(L,1-S)]:[new a.Vector2(l,1-o),new a.Vector2(i,1-h),new a.Vector2(p,1-b),new a.Vector2(v,1-S)]}};function rt(d,e,t){if(t.shapes=[],Array.isArray(d))for(let s=0,n=d.length;s<n;s++){const r=d[s];t.shapes.push(r.uuid)}else t.shapes.push(d.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class at extends te{constructor(e,t){super(e,t);const s=new de.Brush(new te(e,fe(R({},t),{hasTop:!0,hasSide:!0,hasBottom:!1})));s.updateMatrixWorld();const n=new a.Box3().setFromObject(s),r=new a.Vector3;n.getSize(r);const c=new a.Vector3(n.min.x+r.x/2,n.min.y+r.y/2,0);let l=t.topSegments,o=t.box3;if(o){o=o.union(n);const S=new a.Vector3;o.getSize(S);const B=Math.max(r.x/S.x,r.y/S.y);l=Math.ceil(t.topSegments*B)}if(l<4)return this;const u=new a.PlaneGeometry(r.x,r.y,l,l),i=new de.Brush(u);i.position.set(c.x,c.y,c.z),i.updateMatrixWorld();const y=new de.Evaluator().evaluate(i,s,de.INTERSECTION),p=y.geometry.getAttribute("position"),b=new a.Float32BufferAttribute(p.count*2,2);for(let S=0;S<p.count;S++){const B=p.getZ(S);p.setZ(S,t.depth+B)}if(o){const S=o.min,B=o.max,A=new a.Vector3().subVectors(B,S);for(let E=0;E<p.count;E++){const I=p.getX(E),U=p.getY(E),N=(I-S.x)/A.x,j=(U-S.y)/A.y;b.setXY(E,N,j)}y.geometry.setAttribute("uv",b)}p.needsUpdate=!0;const L=new te(e,fe(R({},t),{hasTop:!1})),v=X([y.geometry,L],2);this.copy(v.toNonIndexed())}}const Ie=d=>{const{split:e,depth:t,points:s,box3:n,hasTop:r,hasBottom:c,hasSide:l,sideRepeat:o,topSegments:u}=d,i=u?at:te,h=new i(new a.Shape(s),{depth:t,bevelEnabled:!1,box3:n,UVGenerator:_e.getUVGenerator({split:e,box3:n,sideRepeat:o}),hasTop:r,hasBottom:c,hasSide:l,topSegments:u});return _e.claerUVGenerator(),h};class ct extends O.BaseObject{constructor(e){super(),this.options=R({depth:1},e)}create(){return oe(this,null,function*(){const{points:e,pointsArr:t,useGroups:s,depth:n,geometry:r,geometryArr:c,material:l,box3:o,split:u,hasTop:i,hasBottom:h,hasSide:y}=this.options,p=Array.isArray(n)?n:[n],b=Array.isArray(o)?o:[o],L=l;let v=r;L||console.log("material is null"),!v&&e?v=Ie({points:e,depth:p[0],box3:b[0],split:u,hasTop:i,hasBottom:h,hasSide:y}):!v&&t?v=X(t.map((S,B)=>{var A,E;return Ie({points:S,depth:(A=p[B])!=null?A:p[0],box3:(E=b[B])!=null?E:b[0],split:u,hasTop:i,hasBottom:h,hasSide:y})}),s!=null?s:0):!v&&c&&c.length>1?v=X(c,s!=null?s:0):!v&&c&&c.length===1&&([v]=c),this.createMesh(v,L)})}addGeometries(e){const t=this.object3d,s=X([t.geometry,...e]);t.geometry=s}setTextureAnisotropic(e,t){e.anisotropy=t||this.pencil.renderer.capabilities.getMaxAnisotropy()}}const lt=d=>{const{topColor:e,sideColor:t,sideMap:s,createCanvasObjectURL:n,split:r,maxAnisotropy:c}=d;return new Promise(l=>{const o=s?document.createElement("img"):{src:"",onload:()=>{},width:128,height:128};o.onload=()=>{const u=r,i=document.createElement("canvas"),h=i.getContext("2d");i.height=o.height/(1-u),i.width=o.width,u&&e&&(h.fillStyle=e,h.fillRect(0,0,o.width,i.height*u)),s&&o instanceof HTMLImageElement?h.drawImage(o,0,i.height*u,o.width,o.height):t&&(h.fillStyle=t,h.fillRect(0,i.height*u,o.width,o.height)),n&&i.toBlob(p=>{console.log(URL.createObjectURL(p))});const y=new a.CanvasTexture(i);l(y)},s?o.src=s:o instanceof HTMLImageElement||o.onload()})};class ht extends O.BaseObject{create(){this.createGroup()}render(){this.object3d.raycast=(e,t)=>e.intersectObjects(this.object3d.children,!0,t)}}class ut extends O.BaseObject{constructor(e){super(),this.rectAreaLightUniformsLibInit=!1,this.options=e}create(){var t,s,n,r,c,l,o,u,i,h,y,p,b,L,v,S,B;const e=this.options;if(e.type==="AmbientLight"){const A=new a.AmbientLight(e.color);A.name="环境光",this.object3d=A}else if(e.type==="DirectionalLight"){const A=new a.DirectionalLight(e.color,e.intensity);A.name="平行光",A.target.position.set(0,0,0),this.object3d=A,A.target.name="平行光目标",A.shadow.camera.name="平行光阴影相机",A.shadow.camera.userData.directionalLightShadow=!0,this.directionalLight=A}else if(e.type==="PointLight"){const A=new a.PointLight((t=e.color)!=null?t:16777215,(s=e.intensity)!=null?s:1,(n=e.distance)!=null?n:0,(r=e.decay)!=null?r:2);A.name="点光源",this.object3d=A,this.pointLight=A}else if(e.type==="SpotLight"){const A=new a.SpotLight((c=e.color)!=null?c:16777215,(l=e.intensity)!=null?l:1,(o=e.distance)!=null?o:0,(u=e.angle)!=null?u:Math.PI/3,(i=e.penumbra)!=null?i:1,(h=e.decay)!=null?h:2);A.name="聚光灯",this.object3d=A,this.spotLight=A,A.target.name="聚光灯目标"}else if(e.type==="HemisphereLight"){const A=new a.HemisphereLight((y=e.color)!=null?y:16777215,(p=e.groundColor)!=null?p:16777215,(b=e.intensity)!=null?b:1);A.name="半球光",this.object3d=A,this.hemisphereLight=A}else if(e.type==="RectAreaLight"){this.rectAreaLightUniformsLibInit||(Je.RectAreaLightUniformsLib.init(),this.rectAreaLightUniformsLibInit=!0);const A=new a.RectAreaLight((L=e.color)!=null?L:16777215,(v=e.intensity)!=null?v:1,(S=e.width)!=null?S:10,(B=e.height)!=null?B:10);A.name="矩形区域光",this.object3d=A,this.rectAreaLight=A}}render(){const e=this.object3d;e.target&&this.pencil.scene.add(e.target);const t=this.pencil.cameraTarget;if(this.spotLight||this.directionalLight){const s=this.spotLight||this.directionalLight;s.position.copy(t),s.target.position.copy(t)}else this.pointLight&&this.pointLight.position.copy(t)}dispose(){const e=this.object3d;e.target&&this.pencil.scene.remove(e.target),super.dispose()}}class We extends a.BufferGeometry{constructor(e=[],t="none",s){super(),this.type="MeshLineGeometry",this.pointCount=0,this._points=[],this.shape="none",this.shapeFunction=n=>1,this.matrixWorld=new a.Matrix4,this.shape=t,s&&(this.shapeFunction=s),e.length>0&&this.setPoints(e)}convertToVector3Array(e){if(typeof e[0]=="number"){const t=[],s=e;for(let n=0;n<s.length;n+=3)t.push(new a.Vector3(s[n],s[n+1],s[n+2]));return t}else return e.map(t=>{if(t instanceof a.Vector2)return new a.Vector3(t.x,t.y,0);if(t instanceof a.Vector3)return t;if(Array.isArray(t)&&t.length===2)return new a.Vector3(t[0],t[1],0);if(Array.isArray(t)&&t.length===3)return new a.Vector3(t[0],t[1],t[2])}).filter(Boolean)}setMatrixWorld(e){this.matrixWorld=e}setPoints(e,t){!e||e.length===0||(this._points=this.convertToVector3Array(e),this.pointCount=this._points.length,t&&(this.shapeFunction=t,this.shape="custom"),this.initializeGeometry(),this.updateGeometry())}initializeGeometry(){const e=new a.BufferAttribute(new Float32Array(this.pointCount*6),3),t=new a.BufferAttribute(new Float32Array(this.pointCount*6),3),s=new a.BufferAttribute(new Float32Array(this.pointCount*6),3),n=new a.BufferAttribute(new Float32Array(this.pointCount*2),1),r=new a.BufferAttribute(new Float32Array(this.pointCount*2),1),c=new a.BufferAttribute(new Float32Array(this.pointCount*2),1),l=new a.BufferAttribute(new Float32Array(this.pointCount*4),2),o=new a.BufferAttribute(new Uint16Array((this.pointCount-1)*6),1);this.shape==="taper"&&(this.shapeFunction=u=>1*Math.pow(4*u*(1-u),1));for(let u=0,i=0,h=0;u<this.pointCount;u+=1,i+=2,h+=6){n.setX(i,u/this.pointCount),n.setX(i+1,u/this.pointCount),r.setX(i,1),r.setX(i+1,-1);const y=this.shape==="none"?1:this.shapeFunction(u/(this.pointCount-1));c.setX(i,y),c.setX(i+1,y);const p=u/(this.pointCount-1);if(l.setXY(i,p,0),l.setXY(i+1,p,1),u<this.pointCount-1){const b=u*2;o.setX(h+0,b+0),o.setX(h+1,b+1),o.setX(h+2,b+2),o.setX(h+3,b+2),o.setX(h+4,b+1),o.setX(h+5,b+3)}}this.setAttribute("position",e),this.setAttribute("previous",t),this.setAttribute("next",s),this.setAttribute("counters",n),this.setAttribute("side",r),this.setAttribute("width",c),this.setAttribute("uv",l),this.setIndex(o)}updateGeometry(){if(!this._points[0])return;const e=this.getAttribute("position"),t=this.getAttribute("previous"),s=this.getAttribute("next");let n=0,r=0,c=0;const l=this._points[0];t.setXYZ(r,l.x,l.y,l.z),r+=1,t.setXYZ(r,l.x,l.y,l.z),r+=1;for(let u=0;u<this.pointCount;u++){const i=this._points[u];e.setXYZ(n,i.x,i.y,i.z),n+=1,e.setXYZ(n,i.x,i.y,i.z),n+=1,u<this.pointCount-1&&(t.setXYZ(r,i.x,i.y,i.z),r+=1,t.setXYZ(r,i.x,i.y,i.z),r+=1),u>0&&u+1<=this.pointCount&&(s.setXYZ(c,i.x,i.y,i.z),c+=1,s.setXYZ(c,i.x,i.y,i.z),c+=1)}const o=this._points[this.pointCount-1];s.setXYZ(c,o.x,o.y,o.z),c+=1,s.setXYZ(c,o.x,o.y,o.z),c+=1,e.needsUpdate=!0,t.needsUpdate=!0,s.needsUpdate=!0,this.computeBoundingSphere(),this.computeBoundingBox()}get points(){return this._points}set points(e){this.setPoints(e)}updatePoints(e,t){const s=this.convertToVector3Array(e);if(s.length!==this.pointCount){console.warn("MeshLineGeometry: Cannot update points with different length. Use setPoints() instead.");return}this._points=s,t&&(this.shapeFunction=t,this.shape="custom",this.initializeGeometry()),this.updateGeometry()}setShape(e,t){this.shape=e,t&&(this.shapeFunction=t),this._points.length>0&&(this.initializeGeometry(),this.updateGeometry())}}function ft(d,e){const t=new a.Matrix4,s=new a.Ray,n=new a.Sphere,r=new a.Vector3,c=this.geometry;if(n.copy(c.boundingSphere),n.applyMatrix4(this.matrixWorld),!d.ray.intersectSphere(n,r))return;t.copy(this.matrixWorld).invert(),s.copy(d.ray).applyMatrix4(t);const l=new a.Vector3,o=new a.Vector3,u=new a.Vector3,i=this instanceof a.LineSegments?2:1,h=c.index,y=c.attributes;if(h!==null){const p=h.array,b=y.position.array,L=y.width.array;for(let v=0,S=p.length-1;v<S;v+=i){const B=p[v],A=p[v+1];l.fromArray(b,B*3),o.fromArray(b,A*3);const E=L[Math.floor(v/3)]!==void 0?L[Math.floor(v/3)]:1,I=d.params.Line.threshold+this.material.lineWidth*E/2,U=I*I;if(s.distanceSqToSegment(l,o,r,u)>U)continue;r.applyMatrix4(this.matrixWorld);const j=d.ray.origin.distanceTo(r);j<d.near||j>d.far||(e.push({distance:j,point:u.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:void 0,object:this}),v=S)}}}const we=d=>{const{setPointWidth:e,nodes:t}=d,s=new We;return s.setPoints(t,e),s},Ue=new WeakMap,pe=new Map;let dt=class extends O.BaseObject{constructor(e={}){super(),this.options=R({},e)}get material(){var e;return(e=this.object3d)==null?void 0:e.material}create(){return oe(this,null,function*(){const{nodes:e,nodesArr:t,geometry:s,geometryArr:n,material:r,useGroups:c,setPointWidth:l,lineWidthArr:o,materialParameters:u}=this.options;let i=r,h=s;!i&&u&&(i=this.getMaterial(u)),!h&&e?h=we({nodes:e,setPointWidth:l}):!h&&t?h=X(t.map((y,p)=>{let b=l;return!b&&o&&(b=()=>{var L;return(L=o[p])!=null?L:o[0]}),we({nodes:y,setPointWidth:b})}),c!=null?c:0):!h&&n&&n.length>1?h=X(n,c!=null?c:0):!h&&n&&n.length===1&&([h]=n),this.createMesh(h,i)})}setGeometry(e,t){const s=we({nodes:e,setPointWidth:t}),n=this.object3d,r=n.geometry;n.geometry=s,r.dispose()}getMaterial(e){const{width:t,height:s}=this.pencil.getSize(),n=new O.MeshLineMaterial(R({color:new a.Color("#ffffff")},e));return n.uniforms.resolution.value.set(t,s),n}addGeometries(e){const t=this.object3d,s=X([t.geometry,...e]);t.geometry=s}resize(e,t){var s,n;(n=(s=this.material)==null?void 0:s.uniforms)==null||n.resolution.value.set(e,t)}handleMaterialChange(e){if(e){const{width:t,height:s}=this.pencil.getSize();this.resize(t,s)}}animate({duration:e=1e3,delay:t=0,repeat:s=0,lineLoop:n,onRepeat:r,onUpdate:c,onComplete:l,startShow:o}={}){const{offset:u,offsetLoop:i}=this.material.uniforms,h=this.pencil.userData.debugLine?pe:Ue;if(h.get(this.material)&&this.stopAnimation(),e===0)return;const y=n!=null?n:!0;u.value.x=1,i.value=y&&o?1:0;let p=0;const b=new ne.Tween(u.value).to({x:-1},e).delay(t).repeat(s).onUpdate(({x:L})=>{y&&L<=0&&i.value===0&&(i.value=1),c==null||c(L)}).onRepeat(()=>{p+=1,r==null||r(p)}).onComplete(()=>{l==null||l()}).start();h.set(this.material,b),this.material.addEventListener("dispose",()=>{this.stopAnimation()}),this.pencil.userData.debugLine&&console.log("animate",pe.size)}stopAnimation(){const e=this.pencil.userData.debugLine?pe:Ue,t=e.get(this.material);t&&(t.stop(),ne.remove(t),e.delete(this.material),this.material.uniforms.offset.value.x=0,this.material.uniforms.offsetLoop.value=1),this.pencil.userData.debugLine&&console.log("stopAnimation",pe.size)}render(){const{width:e,height:t}=this.pencil.getSize();this.resize(e,t)}};const Re=d=>{const{points:e}=d,t=e.reduce((n,r,c)=>(c<e.length-1&&n.push(r,e[c+1]),n),[]);return new a.BufferGeometry().setFromPoints(t)};class pt extends O.BaseObject{constructor(e={}){super(),this.options=R({},e)}get material(){var e;return(e=this.object3d)==null?void 0:e.material}create(){return oe(this,null,function*(){const{points:e,pointsArr:t,geometry:s,geometryArr:n,material:r,useGroups:c,setPointWidth:l,lineWidthArr:o,materialParameters:u,instanceCount:i}=this.options;let h=r,y=s;!h&&u&&(h=this.getMaterial(u)),!y&&e?y=Re({points:e}):!y&&t?y=X(t.map(b=>Re({points:b})),c!=null?c:0):!y&&n&&n.length>1?y=X(n,c!=null?c:0):!y&&n&&n.length===1&&([y]=n);const p=new qe.LineSegmentsGeometry().fromLineSegments(new a.LineSegments(y));if(this.pencil.options.WebGPUTHREE){i&&(p.instanceCount=i);const b=new O.LineSegments2(p,h);b.computeLineDistances(),this.object3d=b}else{const b=new Ke.LineSegments2(p,h);b.computeLineDistances(),this.object3d=b}})}getMaterial(e){return new De.LineMaterial(R({color:new a.Color("#ffffff")},e))}}class mt{constructor(e={}){this.labels=new Map,this.lastUpdateTime=0,this.isUpdating=!1,this.options=R({padding:4,enabled:!0,throttleTime:16,viewportMargin:50},e)}add(e,t={}){var s,n;this.labels.set(e,{node:e,priority:(n=(s=t.priority)!=null?s:e.options.priority)!=null?n:0,visible:!0})}remove(e){this.labels.delete(e)}setPriority(e,t){const s=this.labels.get(e);s&&(s.priority=t)}addBatch(e,t){e.forEach((s,n)=>{this.add(s,{priority:t?t(s,n):0})})}setEnabled(e){this.options.enabled=e,e||this.labels.forEach(t=>{this.setNodeVisibility(t.node,!0),t.visible=!0})}update(e){if(!this.options.enabled)return;const t=performance.now();t-this.lastUpdateTime<this.options.throttleTime||(this.lastUpdateTime=t,this.camera=e,!this.isUpdating&&(this.isUpdating=!0,this.animationFrameId=requestAnimationFrame(()=>{this.performCollisionDetection(),this.isUpdating=!1})))}forceUpdate(){this.camera&&this.performCollisionDetection()}performCollisionDetection(){const{padding:e,viewportMargin:t}=this.options,s=window.innerWidth,n=window.innerHeight,r=[];this.labels.forEach(l=>{const o=l.node.element;if(!o)return;const u=o.style.display==="none";u&&(o.style.visibility="hidden",o.style.display="");const i=o.getBoundingClientRect();u&&(o.style.display="none",o.style.visibility=""),i.right>=-t&&i.left<=s+t&&i.bottom>=-t&&i.top<=n+t?(l.bounds=i,r.push(l)):(this.setNodeVisibility(l.node,!1),l.visible=!1)}),r.sort((l,o)=>o.priority-l.priority);const c=[];for(const l of r){if(!l.bounds)continue;this.checkCollision(l.bounds,c,e)?(this.setNodeVisibility(l.node,!1),l.visible=!1):(this.setNodeVisibility(l.node,!0),l.visible=!0,c.push(l.bounds))}}checkCollision(e,t,s){for(const n of t)if(this.rectsIntersect(e,n,s))return!0;return!1}rectsIntersect(e,t,s){return!(e.right+s<t.left||e.left-s>t.right||e.bottom+s<t.top||e.top-s>t.bottom)}setNodeVisibility(e,t){const s=e.element;s&&(t?(s.style.display="",s.style.opacity="1"):s.style.display="none")}getVisibleCount(){let e=0;return this.labels.forEach(t=>{t.visible&&e++}),e}getTotalCount(){return this.labels.size}clear(){this.labels.clear()}dispose(){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.labels.clear()}}class gt extends O.BaseObject{constructor(e){super(),this.options=R({maxDepth:10,percentDepth:!1,innerRadius:25,outRadius:42,activeIndex:-1},e)}create(){return oe(this,null,function*(){this.createGroup();const{data:e,maxDepth:t,colors:s,material:n,percentDepth:r,activeIndex:c}=this.options,l=Math.max(...e),o=e.reduce((i,h)=>i+h,0);let u=Math.PI/2;e.forEach((i,h)=>{if(i===0)return;const y=Math.PI*2*(i/o),p=s[h],b=r?t*(i/l):t,L=this.createGeometry(b,y),v=n?n.clone():new a.MeshBasicMaterial({color:p});n&&v.color.set(p);const S=new a.Mesh(L,v);S.userData.depth=b,S.userData.index=h,S.rotateZ(u),u+=y,this.add(S)}),c!==-1&&this.setActive(c)})}createGeometry(e,t){const{outRadius:s,innerRadius:n}=this.options,r=new a.Shape;return r.moveTo(s,0),r.lineTo(n,0),r.absarc(0,0,n,0,t,!1),r.absarc(0,0,s,t,0,!0),new te(r,{curveSegments:48,depth:e,bevelEnabled:!1})}handlePick(e,t=1.3){const{object:s}=this.pencil.pick(e,this.object3d.children)||{},n=s?this.object3d.children.findIndex(r=>r===s):this.options.activeIndex;return this.setActive(n,t)}setActive(e,t=1.3){const s=this.object3d.children[e];if(this.object3d.children.forEach(n=>{if(!(s&&s===n)&&n.scale.z!==1){if(n.userData.levTween)return;n.userData.enTween&&(n.userData.enTween.stop(),n.userData.enTween=null);const r=new ne.Tween(n.scale).to({z:1},100);n.userData.levTween=r,r.start()}}),s){if(s.userData.enTween)return;s.userData.levTween&&(s.userData.levTween.stop(),s.userData.levTween=null);const n=new ne.Tween(s.scale).to({z:t},100);return s.userData.enTween=n,n.start(),s.userData.index}return-1}render(){this.object3d.scale.z=0,new ne.Tween(this.object3d.scale).to({z:1},1e3).easing(ne.Easing.Sinusoidal.InOut).start()}}Object.defineProperty(exports,"Line2Material",{enumerable:!0,get:()=>De.LineMaterial});Object.defineProperty(exports,"LineSegmentsGeometry",{enumerable:!0,get:()=>qe.LineSegmentsGeometry});exports.MeshLineMaterial=O.MeshLineMaterial;exports.Node=O.Node;exports.getConicPolygonGeometry=O.PolygonGeometry;exports.getConicPolygonGeometryMetas=O.getMetas;exports.CollisionManage=mt;exports.ConicPolygon=tt;exports.Ellipsoid=nt;exports.ExtrudePolygon=ct;exports.Group=ht;exports.Light=ut;exports.Line=dt;exports.Line2=pt;exports.MeshLineGeometry=We;exports.MeshLineRaycast=ft;exports.Pie=gt;exports.getSplitTexture=lt;
|
|
1
|
+
"use strict";var Ye=Object.defineProperty,Ze=Object.defineProperties;var $e=Object.getOwnPropertyDescriptors;var ue=Object.getOwnPropertySymbols;var Ve=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable;var Pe=(d,e,t)=>e in d?Ye(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t,W=(d,e)=>{for(var t in e||(e={}))Ve.call(e,t)&&Pe(d,t,e[t]);if(ue)for(var t of ue(e))_e.call(e,t)&&Pe(d,t,e[t]);return d},fe=(d,e)=>Ze(d,$e(e));var ge=(d,e)=>{var t={};for(var n in d)Ve.call(d,n)&&e.indexOf(n)<0&&(t[n]=d[n]);if(d!=null&&ue)for(var n of ue(d))e.indexOf(n)<0&&_e.call(d,n)&&(t[n]=d[n]);return t};var ie=(d,e,t)=>new Promise((n,s)=>{var r=i=>{try{m(t.next(i))}catch(u){s(u)}},c=i=>{try{m(t.throw(i))}catch(u){s(u)}},m=i=>i.done?n(i.value):Promise.resolve(i.value).then(r,c);m((t=t.apply(d,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const qe=require("three/examples/jsm/lines/LineMaterial"),De=require("three/examples/jsm/lines/LineSegmentsGeometry"),O=require("../index2.js"),a=require("three"),ye=require("three/examples/jsm/utils/BufferGeometryUtils"),be=require("../cartographicToCartesian.js"),ze=require("../uvGenerator.js"),de=require("three-bvh-csg"),Je=require("three/examples/jsm/lights/RectAreaLightUniformsLib"),Qe=require("@tweenjs/tween.js"),Ke=require("three/examples/jsm/lines/LineSegments2");function et(d){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const t in d)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(d,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>d[t]})}}return e.default=d,Object.freeze(e)}const se=et(Qe);function F(d,e=0){const t=d[0].index!==null,n=new Set(Object.keys(d[0].attributes)),s=new Set(Object.keys(d[0].morphAttributes)),r={},c={},m=d[0].morphTargetsRelative,i=new a.BufferGeometry;let u=0;for(let o=0;o<d.length;++o){const l=d[o];let y=0;if(t!==(l.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const f in l.attributes){if(!n.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;r[f]===void 0&&(r[f]=[]),r[f].push(l.attributes[f]),y++}if(y!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". Make sure all geometries have the same number of attributes."),null;if(m!==l.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const f in l.morphAttributes){if(!s.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". .morphAttributes must be consistent throughout all geometries."),null;c[f]===void 0&&(c[f]=[]),c[f].push(l.morphAttributes[f])}if(e){let f;if(t)f=l.index.count;else if(l.attributes.position!==void 0)f=l.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". The geometry must have either an index or a position attribute"),null;if(e===1)i.addGroup(u,f,o);else if(e===2&&l.groups.length>0)for(let b of l.groups){let L=b.materialIndex;i.addGroup(u+b.start,Math.min(b.count,f),L)}u+=f}}if(t){let o=0;const l=[];for(let y=0;y<d.length;++y){const f=d[y].index;for(let b=0;b<f.count;++b)l.push(f.getX(b)+o);o+=d[y].attributes.position.count}i.setIndex(l)}for(const o in r){const l=ye.mergeAttributes(r[o]);if(!l)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+o+" attribute."),null;i.setAttribute(o,l)}for(const o in c){const l=c[o][0].length;if(l===0)break;i.morphAttributes=i.morphAttributes||{},i.morphAttributes[o]=[];for(let y=0;y<l;++y){const f=[];for(let L=0;L<c[o].length;++L)f.push(c[o][L][y]);const b=ye.mergeAttributes(f);if(!b)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+o+" morphAttribute."),null;i.morphAttributes[o].push(b)}}return e===2?ye.mergeGroups(i):i}const Oe=d=>{const m=d,{coordinate:e,startHeight:t,height:n}=m,s=ge(m,["coordinate","startHeight","height"]);let r=t||0;return typeof t!="undefined"&&typeof n!="undefined"&&(r=t+n),new O.PolygonGeometry([e],fe(W({},s),{startHeight:t,endHeight:r}))};class tt extends O.BaseObject{constructor(e){super(),this.options=W({},e)}create(){const i=this.options,{geometry:e,coordinateArr:t,coordinate:n,material:s,useGroups:r}=i,c=ge(i,["geometry","coordinateArr","coordinate","material","useGroups"]);let m=e;if(!m&&n)m=Oe(W({coordinate:n},c));else if(!m&&t){const u=t.map(o=>Oe(W({coordinate:o},c)));m=F(u,r!=null?r:0)}this.createMesh(m,s)}}function nt(d={}){const{a:e=be.WGS84.a,b:t=be.WGS84.b,scaleFactor:n=1/be.WGS84.a,widthSegments:s=64,heightSegments:r=32}=d,c=new a.BufferGeometry,m=[],i=[],u=[],o=[],l=e*e,y=t*t,f=(l-y)/l;let b=0;const L=[];for(let v=0;v<=r;v++){const S=[],C=v/r,E=(.5-C)*180*Math.PI/180,I=Math.sin(E),R=Math.cos(E),X=e/Math.sqrt(1-f*I*I);for(let P=0;P<=s;P++){const $=P/s,H=($-.5)*360*Math.PI/180,oe=Math.sin(H),V=Math.cos(H),_=X*R*oe*n,we=X*(1-f)*I*n,re=X*R*V*n;i.push(_,we,re);const Q=R*oe/e,z=I*(1-f)/t,N=R*V/e,U=Math.sqrt(Q*Q+z*z+N*N);u.push(Q/U,z/U,N/U),o.push($,1-C),S.push(b++)}L.push(S)}for(let v=0;v<r;v++)for(let S=0;S<s;S++){const C=L[v][S+1],A=L[v][S],E=L[v+1][S],I=L[v+1][S+1];m.push(C,A,I),m.push(A,E,I)}return c.setIndex(m),c.setAttribute("position",new a.Float32BufferAttribute(i,3)),c.setAttribute("normal",new a.Float32BufferAttribute(u,3)),c.setAttribute("uv",new a.Float32BufferAttribute(o,2)),c}class st extends O.BaseObject{constructor(e={}){super(),this.options=e}create(){const e=nt(this.options),t=this.options.material||new a.MeshStandardMaterial({color:2200782,metalness:.1,roughness:.7,wireframe:!1}),n=new a.Mesh(e,t);return n.name="Ellipsoid",this.object3d=n,n}}const ot={ArcCurve:a.ArcCurve,CatmullRomCurve3:a.CatmullRomCurve3,CubicBezierCurve:a.CubicBezierCurve,CubicBezierCurve3:a.CubicBezierCurve3,EllipseCurve:a.EllipseCurve,LineCurve:a.LineCurve,LineCurve3:a.LineCurve3,QuadraticBezierCurve:a.QuadraticBezierCurve,QuadraticBezierCurve3:a.QuadraticBezierCurve3,SplineCurve:a.SplineCurve};class te extends a.BufferGeometry{constructor(e=new a.Shape([new a.Vector2(.5,.5),new a.Vector2(-.5,.5),new a.Vector2(-.5,-.5),new a.Vector2(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,s=[],r=[];for(let m=0,i=e.length;m<i;m++){const u=e[m];c(u)}this.setAttribute("position",new a.Float32BufferAttribute(s,3)),this.setAttribute("uv",new a.Float32BufferAttribute(r,2)),this.computeVertexNormals();function c(m){var Me,Le,Ge;const i=[],u=t.curveSegments!==void 0?t.curveSegments:12,o=t.steps!==void 0?t.steps:1,l=t.depth!==void 0?t.depth:1;let y=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,b=t.bevelSize!==void 0?t.bevelSize:f-.1,L=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const S=t.extrudePath,C=t.UVGenerator!==void 0?t.UVGenerator:it,A=(Me=t.hasTop)!=null?Me:!0,E=(Le=t.hasBottom)!=null?Le:!0,I=(Ge=t.hasSide)!=null?Ge:!0;let R,X=!1,P,$,ne,H;S&&(R=S.getSpacedPoints(o),X=!0,y=!1,P=S.computeFrenetFrames(o,!1),$=new a.Vector3,ne=new a.Vector3,H=new a.Vector3),y||(v=0,f=0,b=0,L=0);const oe=m.extractPoints(u);let V=oe.shape;const _=oe.holes;if(!a.ShapeUtils.isClockWise(V)){V=V.reverse();for(let h=0,p=_.length;h<p;h++){const g=_[h];a.ShapeUtils.isClockWise(g)&&(_[h]=g.reverse())}}function re(h){const g=10000000000000001e-36;let w=h[0];for(let x=1;x<=h.length;x++){const G=x%h.length,M=h[G],T=M.x-w.x,B=M.y-w.y,j=T*T+B*B,q=Math.max(Math.abs(M.x),Math.abs(M.y),Math.abs(w.x),Math.abs(w.y)),ee=g*q*q;if(j<=ee){h.splice(G,1),x--;continue}w=M}}re(V),_.forEach(re);const Q=_.length,z=V;for(let h=0;h<Q;h++){const p=_[h];V=V.concat(p)}function N(h,p,g){return p||error("ExtrudeGeometry: vec does not exist"),h.clone().addScaledVector(p,g)}const U=V.length;function ve(h,p,g){let w,x,G;const M=h.x-p.x,T=h.y-p.y,B=g.x-h.x,j=g.y-h.y,q=M*M+T*T,ee=M*j-T*B;if(Math.abs(ee)>Number.EPSILON){const D=Math.sqrt(q),Te=Math.sqrt(B*B+j*j),Be=p.x-T/D,Ce=p.y+M/D,Fe=g.x-j/Te,ke=g.y+B/Te,je=((Fe-Be)*j-(ke-Ce)*B)/(M*j-T*B);w=Be+M*je-h.x,x=Ce+T*je-h.y;const Ee=w*w+x*x;if(Ee<=2)return new a.Vector2(w,x);G=Math.sqrt(Ee/2)}else{let D=!1;M>Number.EPSILON?B>Number.EPSILON&&(D=!0):M<-Number.EPSILON?B<-Number.EPSILON&&(D=!0):Math.sign(T)===Math.sign(j)&&(D=!0),D?(w=-T,x=M,G=Math.sqrt(q)):(w=M,x=T,G=Math.sqrt(q/2))}return new a.Vector2(w/G,x/G)}const ae=[];for(let h=0,p=z.length,g=p-1,w=h+1;h<p;h++,g++,w++)g===p&&(g=0),w===p&&(w=0),ae[h]=ve(z[h],z[g],z[w]);const pe=[];let J,ce=ae.concat();for(let h=0,p=Q;h<p;h++){const g=_[h];J=[];for(let w=0,x=g.length,G=x-1,M=w+1;w<x;w++,G++,M++)G===x&&(G=0),M===x&&(M=0),J[w]=ve(g[w],g[G],g[M]);pe.push(J),ce=ce.concat(J)}let K;if(v===0)K=a.ShapeUtils.triangulateShape(z,_);else{const h=[],p=[];for(let g=0;g<v;g++){const w=g/v,x=f*Math.cos(w*Math.PI/2),G=b*Math.sin(w*Math.PI/2)+L;for(let M=0,T=z.length;M<T;M++){const B=N(z[M],ae[M],G);k(B.x,B.y,-x),w===0&&h.push(B)}for(let M=0,T=Q;M<T;M++){const B=_[M];J=pe[M];const j=[];for(let q=0,ee=B.length;q<ee;q++){const D=N(B[q],J[q],G);k(D.x,D.y,-x),w===0&&j.push(D)}w===0&&p.push(j)}}K=a.ShapeUtils.triangulateShape(h,p)}const le=K.length,Se=b+L;for(let h=0;h<U;h++){const p=y?N(V[h],ce[h],Se):V[h];X?(ne.copy(P.normals[0]).multiplyScalar(p.x),$.copy(P.binormals[0]).multiplyScalar(p.y),H.copy(R[0]).add(ne).add($),k(H.x,H.y,H.z)):k(p.x,p.y,0)}for(let h=1;h<=o;h++)for(let p=0;p<U;p++){const g=y?N(V[p],ce[p],Se):V[p];X?(ne.copy(P.normals[h]).multiplyScalar(g.x),$.copy(P.binormals[h]).multiplyScalar(g.y),H.copy(R[h]).add(ne).add($),k(H.x,H.y,H.z)):k(g.x,g.y,l/o*h)}for(let h=v-1;h>=0;h--){const p=h/v,g=f*Math.cos(p*Math.PI/2),w=b*Math.sin(p*Math.PI/2)+L;for(let x=0,G=z.length;x<G;x++){const M=N(z[x],ae[x],w);k(M.x,M.y,l+g)}for(let x=0,G=_.length;x<G;x++){const M=_[x];J=pe[x];for(let T=0,B=M.length;T<B;T++){const j=N(M[T],J[T],w);X?k(j.x,j.y+R[o-1].y,R[o-1].x+g):k(j.x,j.y,l+g)}}}He(),I&&Xe();function He(){const h=s.length/3;if(y){let p=0,g=U*p;if(E)for(let w=0;w<le;w++){const x=K[w];he(x[2]+g,x[1]+g,x[0]+g)}if(p=o+v*2,g=U*p,A)for(let w=0;w<le;w++){const x=K[w];he(x[0]+g,x[1]+g,x[2]+g)}}else{if(E)for(let p=0;p<le;p++){const g=K[p];he(g[2],g[1],g[0])}if(A)for(let p=0;p<le;p++){const g=K[p];he(g[0]+U*o,g[1]+U*o,g[2]+U*o)}}n.addGroup(h,s.length/3-h,0)}function Xe(){const h=s.length/3;let p=0;Ae(z,p),p+=z.length;for(let g=0,w=_.length;g<w;g++){const x=_[g];Ae(x,p),p+=x.length}n.addGroup(h,s.length/3-h,1)}function Ae(h,p){let g=h.length;for(;--g>=0;){const w=g;let x=g-1;x<0&&(x=h.length-1);for(let G=0,M=o+v*2;G<M;G++){const T=U*G,B=U*(G+1),j=p+w+T,q=p+x+T,ee=p+x+B,D=p+w+B;Ne(j,q,ee,D)}}}function k(h,p,g){i.push(h),i.push(p),i.push(g)}function he(h,p,g){Y(h),Y(p),Y(g);const w=s.length/3,x=C.generateTopUV(n,s,w-3,w-2,w-1);Z(x[0]),Z(x[1]),Z(x[2])}function Ne(h,p,g,w){Y(h),Y(p),Y(w),Y(p),Y(g),Y(w);const x=s.length/3,G=C.generateSideWallUV(n,s,x-6,x-3,x-2,x-1);Z(G[0]),Z(G[1]),Z(G[3]),Z(G[1]),Z(G[2]),Z(G[3])}function Y(h){s.push(i[h*3+0]),s.push(i[h*3+1]),s.push(i[h*3+2])}function Z(h){r.push(h.x),r.push(h.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return rt(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,c=e.shapes.length;r<c;r++){const m=t[e.shapes[r]];n.push(m)}const s=e.options.extrudePath;return s!==void 0&&(e.options.extrudePath=new ot[s.type]().fromJSON(s)),new te(n,e.options)}}const it={generateTopUV:function(d,e,t,n,s){const r=e[t*3],c=e[t*3+1],m=e[n*3],i=e[n*3+1],u=e[s*3],o=e[s*3+1];return[new a.Vector2(r,c),new a.Vector2(m,i),new a.Vector2(u,o)]},generateSideWallUV:function(d,e,t,n,s,r){const c=e[t*3],m=e[t*3+1],i=e[t*3+2],u=e[n*3],o=e[n*3+1],l=e[n*3+2],y=e[s*3],f=e[s*3+1],b=e[s*3+2],L=e[r*3],v=e[r*3+1],S=e[r*3+2];return Math.abs(m-o)<Math.abs(c-u)?[new a.Vector2(c,1-i),new a.Vector2(u,1-l),new a.Vector2(y,1-b),new a.Vector2(L,1-S)]:[new a.Vector2(m,1-i),new a.Vector2(o,1-l),new a.Vector2(f,1-b),new a.Vector2(v,1-S)]}};function rt(d,e,t){if(t.shapes=[],Array.isArray(d))for(let n=0,s=d.length;n<s;n++){const r=d[n];t.shapes.push(r.uuid)}else t.shapes.push(d.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class at extends te{constructor(e,t){super(e,t);const n=new de.Brush(new te(e,fe(W({},t),{hasTop:!0,hasSide:!0,hasBottom:!1})));n.updateMatrixWorld();const s=new a.Box3().setFromObject(n),r=new a.Vector3;s.getSize(r);const c=new a.Vector3(s.min.x+r.x/2,s.min.y+r.y/2,0);let m=t.topSegments,i=t.box3;if(i){i=i.union(s);const S=new a.Vector3;i.getSize(S);const C=Math.max(r.x/S.x,r.y/S.y);m=Math.ceil(t.topSegments*C)}if(m<4)return this;const u=new a.PlaneGeometry(r.x,r.y,m,m),o=new de.Brush(u);o.position.set(c.x,c.y,c.z),o.updateMatrixWorld();const y=new de.Evaluator().evaluate(o,n,de.INTERSECTION),f=y.geometry.getAttribute("position"),b=new a.Float32BufferAttribute(f.count*2,2);for(let S=0;S<f.count;S++){const C=f.getZ(S);f.setZ(S,t.depth+C)}if(i){const S=i.min,C=i.max,A=new a.Vector3().subVectors(C,S);for(let E=0;E<f.count;E++){const I=f.getX(E),R=f.getY(E),X=(I-S.x)/A.x,P=(R-S.y)/A.y;b.setXY(E,X,P)}y.geometry.setAttribute("uv",b)}f.needsUpdate=!0;const L=new te(e,fe(W({},t),{hasTop:!1})),v=F([y.geometry,L],2);this.copy(v.toNonIndexed())}}const Ie=d=>{const{split:e,depth:t,points:n,box3:s,hasTop:r,hasBottom:c,hasSide:m,sideRepeat:i,topSegments:u}=d,o=u?at:te,l=new o(new a.Shape(n),{depth:t,bevelEnabled:!1,box3:s,UVGenerator:ze.getUVGenerator({split:e,box3:s,sideRepeat:i}),hasTop:r,hasBottom:c,hasSide:m,topSegments:u});return ze.claerUVGenerator(),l};class ct extends O.BaseObject{constructor(e){super(),this.options=W({depth:1},e)}create(){return ie(this,null,function*(){const{points:e,pointsArr:t,useGroups:n,depth:s,geometry:r,geometryArr:c,material:m,box3:i,split:u,hasTop:o,hasBottom:l,hasSide:y}=this.options,f=Array.isArray(s)?s:[s],b=Array.isArray(i)?i:[i],L=m;let v=r;L||console.log("material is null"),!v&&e?v=Ie({points:e,depth:f[0],box3:b[0],split:u,hasTop:o,hasBottom:l,hasSide:y}):!v&&t?v=F(t.map((S,C)=>{var A,E;return Ie({points:S,depth:(A=f[C])!=null?A:f[0],box3:(E=b[C])!=null?E:b[0],split:u,hasTop:o,hasBottom:l,hasSide:y})}),n!=null?n:0):!v&&c&&c.length>1?v=F(c,n!=null?n:0):!v&&c&&c.length===1&&([v]=c),this.createMesh(v,L)})}addGeometries(e){const t=this.object3d,n=F([t.geometry,...e]);t.geometry=n}setTextureAnisotropic(e,t){e.anisotropy=t||this.pencil.renderer.capabilities.getMaxAnisotropy()}}const lt=d=>{const{topColor:e,sideColor:t,sideMap:n,createCanvasObjectURL:s,split:r,maxAnisotropy:c}=d;return new Promise(m=>{const i=n?document.createElement("img"):{src:"",onload:()=>{},width:128,height:128};i.onload=()=>{const u=r,o=document.createElement("canvas"),l=o.getContext("2d");o.height=i.height/(1-u),o.width=i.width,u&&e&&(l.fillStyle=e,l.fillRect(0,0,i.width,o.height*u)),n&&i instanceof HTMLImageElement?l.drawImage(i,0,o.height*u,i.width,i.height):t&&(l.fillStyle=t,l.fillRect(0,o.height*u,i.width,i.height)),s&&o.toBlob(f=>{console.log(URL.createObjectURL(f))});const y=new a.CanvasTexture(o);m(y)},n?i.src=n:i instanceof HTMLImageElement||i.onload()})};class ht extends O.BaseObject{create(){this.createGroup()}render(){this.object3d.raycast=(e,t)=>e.intersectObjects(this.object3d.children,!0,t)}}class ut extends O.BaseObject{constructor(e){super(),this.rectAreaLightUniformsLibInit=!1,this.options=e}create(){var t,n,s,r,c,m,i,u,o,l,y,f,b,L,v,S,C;const e=this.options;if(e.type==="AmbientLight"){const A=new a.AmbientLight(e.color);A.name="环境光",this.object3d=A}else if(e.type==="DirectionalLight"){const A=new a.DirectionalLight(e.color,e.intensity);A.name="平行光",A.target.position.set(0,0,0),this.object3d=A,A.target.name="平行光目标",A.shadow.camera.name="平行光阴影相机",A.shadow.camera.userData.directionalLightShadow=!0,this.directionalLight=A}else if(e.type==="PointLight"){const A=new a.PointLight((t=e.color)!=null?t:16777215,(n=e.intensity)!=null?n:1,(s=e.distance)!=null?s:0,(r=e.decay)!=null?r:2);A.name="点光源",this.object3d=A,this.pointLight=A}else if(e.type==="SpotLight"){const A=new a.SpotLight((c=e.color)!=null?c:16777215,(m=e.intensity)!=null?m:1,(i=e.distance)!=null?i:0,(u=e.angle)!=null?u:Math.PI/3,(o=e.penumbra)!=null?o:1,(l=e.decay)!=null?l:2);A.name="聚光灯",this.object3d=A,this.spotLight=A,A.target.name="聚光灯目标"}else if(e.type==="HemisphereLight"){const A=new a.HemisphereLight((y=e.color)!=null?y:16777215,(f=e.groundColor)!=null?f:16777215,(b=e.intensity)!=null?b:1);A.name="半球光",this.object3d=A,this.hemisphereLight=A}else if(e.type==="RectAreaLight"){this.rectAreaLightUniformsLibInit||(Je.RectAreaLightUniformsLib.init(),this.rectAreaLightUniformsLibInit=!0);const A=new a.RectAreaLight((L=e.color)!=null?L:16777215,(v=e.intensity)!=null?v:1,(S=e.width)!=null?S:10,(C=e.height)!=null?C:10);A.name="矩形区域光",this.object3d=A,this.rectAreaLight=A}}render(){const e=this.object3d;e.target&&this.pencil.scene.add(e.target);const t=this.pencil.cameraTarget;if(this.spotLight||this.directionalLight){const n=this.spotLight||this.directionalLight;n.position.copy(t),n.target.position.copy(t)}else this.pointLight&&this.pointLight.position.copy(t)}dispose(){const e=this.object3d;e.target&&this.pencil.scene.remove(e.target),super.dispose()}}class We extends a.BufferGeometry{constructor(e=[],t="none",n){super(),this.type="MeshLineGeometry",this.pointCount=0,this._points=[],this.shape="none",this.shapeFunction=s=>1,this.matrixWorld=new a.Matrix4,this.shape=t,n&&(this.shapeFunction=n),e.length>0&&this.setPoints(e)}convertToVector3Array(e){if(typeof e[0]=="number"){const t=[],n=e;for(let s=0;s<n.length;s+=3)t.push(new a.Vector3(n[s],n[s+1],n[s+2]));return t}else return e.map(t=>{if(t instanceof a.Vector2)return new a.Vector3(t.x,t.y,0);if(t instanceof a.Vector3)return t;if(Array.isArray(t)&&t.length===2)return new a.Vector3(t[0],t[1],0);if(Array.isArray(t)&&t.length===3)return new a.Vector3(t[0],t[1],t[2])}).filter(Boolean)}setMatrixWorld(e){this.matrixWorld=e}setPoints(e,t){!e||e.length===0||(this._points=this.convertToVector3Array(e),this.pointCount=this._points.length,t&&(this.shapeFunction=t,this.shape="custom"),this.initializeGeometry(),this.updateGeometry())}initializeGeometry(){const e=new a.BufferAttribute(new Float32Array(this.pointCount*6),3),t=new a.BufferAttribute(new Float32Array(this.pointCount*6),3),n=new a.BufferAttribute(new Float32Array(this.pointCount*6),3),s=new a.BufferAttribute(new Float32Array(this.pointCount*2),1),r=new a.BufferAttribute(new Float32Array(this.pointCount*2),1),c=new a.BufferAttribute(new Float32Array(this.pointCount*2),1),m=new a.BufferAttribute(new Float32Array(this.pointCount*4),2),i=new a.BufferAttribute(new Uint16Array((this.pointCount-1)*6),1);this.shape==="taper"&&(this.shapeFunction=u=>1*Math.pow(4*u*(1-u),1));for(let u=0,o=0,l=0;u<this.pointCount;u+=1,o+=2,l+=6){s.setX(o,u/this.pointCount),s.setX(o+1,u/this.pointCount),r.setX(o,1),r.setX(o+1,-1);const y=this.shape==="none"?1:this.shapeFunction(u/(this.pointCount-1));c.setX(o,y),c.setX(o+1,y);const f=u/(this.pointCount-1);if(m.setXY(o,f,0),m.setXY(o+1,f,1),u<this.pointCount-1){const b=u*2;i.setX(l+0,b+0),i.setX(l+1,b+1),i.setX(l+2,b+2),i.setX(l+3,b+2),i.setX(l+4,b+1),i.setX(l+5,b+3)}}this.setAttribute("position",e),this.setAttribute("previous",t),this.setAttribute("next",n),this.setAttribute("counters",s),this.setAttribute("side",r),this.setAttribute("width",c),this.setAttribute("uv",m),this.setIndex(i)}updateGeometry(){if(!this._points[0])return;const e=this.getAttribute("position"),t=this.getAttribute("previous"),n=this.getAttribute("next");let s=0,r=0,c=0;const m=this._points[0];t.setXYZ(r,m.x,m.y,m.z),r+=1,t.setXYZ(r,m.x,m.y,m.z),r+=1;for(let u=0;u<this.pointCount;u++){const o=this._points[u];e.setXYZ(s,o.x,o.y,o.z),s+=1,e.setXYZ(s,o.x,o.y,o.z),s+=1,u<this.pointCount-1&&(t.setXYZ(r,o.x,o.y,o.z),r+=1,t.setXYZ(r,o.x,o.y,o.z),r+=1),u>0&&u+1<=this.pointCount&&(n.setXYZ(c,o.x,o.y,o.z),c+=1,n.setXYZ(c,o.x,o.y,o.z),c+=1)}const i=this._points[this.pointCount-1];n.setXYZ(c,i.x,i.y,i.z),c+=1,n.setXYZ(c,i.x,i.y,i.z),c+=1,e.needsUpdate=!0,t.needsUpdate=!0,n.needsUpdate=!0,this.computeBoundingSphere(),this.computeBoundingBox()}get points(){return this._points}set points(e){this.setPoints(e)}updatePoints(e,t){const n=this.convertToVector3Array(e);if(n.length!==this.pointCount){console.warn("MeshLineGeometry: Cannot update points with different length. Use setPoints() instead.");return}this._points=n,t&&(this.shapeFunction=t,this.shape="custom",this.initializeGeometry()),this.updateGeometry()}setShape(e,t){this.shape=e,t&&(this.shapeFunction=t),this._points.length>0&&(this.initializeGeometry(),this.updateGeometry())}}function ft(d,e){const t=new a.Matrix4,n=new a.Ray,s=new a.Sphere,r=new a.Vector3,c=this.geometry;if(s.copy(c.boundingSphere),s.applyMatrix4(this.matrixWorld),!d.ray.intersectSphere(s,r))return;t.copy(this.matrixWorld).invert(),n.copy(d.ray).applyMatrix4(t);const m=new a.Vector3,i=new a.Vector3,u=new a.Vector3,o=this instanceof a.LineSegments?2:1,l=c.index,y=c.attributes;if(l!==null){const f=l.array,b=y.position.array,L=y.width.array;for(let v=0,S=f.length-1;v<S;v+=o){const C=f[v],A=f[v+1];m.fromArray(b,C*3),i.fromArray(b,A*3);const E=L[Math.floor(v/3)]!==void 0?L[Math.floor(v/3)]:1,I=d.params.Line.threshold+this.material.lineWidth*E/2,R=I*I;if(n.distanceSqToSegment(m,i,r,u)>R)continue;r.applyMatrix4(this.matrixWorld);const P=d.ray.origin.distanceTo(r);P<d.near||P>d.far||(e.push({distance:P,point:u.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:void 0,object:this}),v=S)}}}const xe=d=>{const{setPointWidth:e,nodes:t}=d,n=new We;return n.setPoints(t,e),n},Re=new WeakMap,me=new Map;let dt=class extends O.BaseObject{constructor(e={}){super(),this.options=W({},e)}get material(){var e;return(e=this.object3d)==null?void 0:e.material}create(){return ie(this,null,function*(){const{nodes:e,nodesArr:t,geometry:n,geometryArr:s,material:r,useGroups:c,setPointWidth:m,lineWidthArr:i,materialParameters:u}=this.options;let o=r,l=n;!o&&u&&(o=this.getMaterial(u)),!l&&e?l=xe({nodes:e,setPointWidth:m}):!l&&t?l=F(t.map((y,f)=>{let b=m;return!b&&i&&(b=()=>{var L;return(L=i[f])!=null?L:i[0]}),xe({nodes:y,setPointWidth:b})}),c!=null?c:0):!l&&s&&s.length>1?l=F(s,c!=null?c:0):!l&&s&&s.length===1&&([l]=s),this.createMesh(l,o)})}setGeometry(e,t){const n=xe({nodes:e,setPointWidth:t}),s=this.object3d,r=s.geometry;s.geometry=n,r.dispose()}getMaterial(e){const{width:t,height:n}=this.pencil.getSize(),s=new O.MeshLineMaterial(W({color:new a.Color("#ffffff")},e));return s.uniforms.resolution.value.set(t,n),s}addGeometries(e){const t=this.object3d,n=F([t.geometry,...e]);t.geometry=n}resize(e,t){var n,s;(s=(n=this.material)==null?void 0:n.uniforms)==null||s.resolution.value.set(e,t)}handleMaterialChange(e){if(e){const{width:t,height:n}=this.pencil.getSize();this.resize(t,n)}}animate({duration:e=1e3,delay:t=0,repeat:n=0,lineLoop:s,onRepeat:r,onUpdate:c,onComplete:m,startShow:i}={}){const{offset:u,offsetLoop:o}=this.material.uniforms,l=this.pencil.userData.debugLine?me:Re;if(l.get(this.material)&&this.stopAnimation(),e===0)return;const y=s!=null?s:!0;u.value.x=1,o.value=y&&i?1:0;let f=0;const b=new se.Tween(u.value).to({x:-1},e).delay(t).repeat(n).onUpdate(({x:L})=>{y&&L<=0&&o.value===0&&(o.value=1),c==null||c(L)}).onRepeat(()=>{f+=1,r==null||r(f)}).onComplete(()=>{m==null||m()}).start();l.set(this.material,b),this.material.addEventListener("dispose",()=>{this.stopAnimation()}),this.pencil.userData.debugLine&&console.log("animate",me.size)}stopAnimation(){const e=this.pencil.userData.debugLine?me:Re,t=e.get(this.material);t&&(t.stop(),se.remove(t),e.delete(this.material),this.material.uniforms.offset.value.x=0,this.material.uniforms.offsetLoop.value=1),this.pencil.userData.debugLine&&console.log("stopAnimation",me.size)}render(){const{width:e,height:t}=this.pencil.getSize();this.resize(e,t)}};const Ue=d=>{const{points:e}=d,t=e.reduce((s,r,c)=>(c<e.length-1&&s.push(r,e[c+1]),s),[]);return new a.BufferGeometry().setFromPoints(t)};class mt extends O.BaseObject{constructor(e={}){super(),this.options=W({},e)}get material(){var e;return(e=this.object3d)==null?void 0:e.material}create(){return ie(this,null,function*(){const{points:e,pointsArr:t,geometry:n,geometryArr:s,material:r,useGroups:c,setPointWidth:m,lineWidthArr:i,materialParameters:u,instanceCount:o}=this.options;let l=r,y=n;!l&&u&&(l=this.getMaterial(u)),!y&&e?y=Ue({points:e}):!y&&t?y=F(t.map(b=>Ue({points:b})),c!=null?c:0):!y&&s&&s.length>1?y=F(s,c!=null?c:0):!y&&s&&s.length===1&&([y]=s);const f=new De.LineSegmentsGeometry().fromLineSegments(new a.LineSegments(y));if(this.pencil.options.WebGPUTHREE){o&&(f.instanceCount=o);const b=new O.LineSegments2(f,l);b.computeLineDistances(),this.object3d=b}else{const b=new Ke.LineSegments2(f,l);b.computeLineDistances(),this.object3d=b}})}getMaterial(e){return new qe.LineMaterial(W({color:new a.Color("#ffffff")},e))}}class pt extends O.BaseObject{constructor(e){super(),this.options=W({maxDepth:10,percentDepth:!1,innerRadius:25,outRadius:42,activeIndex:-1},e)}create(){return ie(this,null,function*(){this.createGroup();const{data:e,maxDepth:t,colors:n,material:s,percentDepth:r,activeIndex:c}=this.options,m=Math.max(...e),i=e.reduce((o,l)=>o+l,0);let u=Math.PI/2;e.forEach((o,l)=>{if(o===0)return;const y=Math.PI*2*(o/i),f=n[l],b=r?t*(o/m):t,L=this.createGeometry(b,y),v=s?s.clone():new a.MeshBasicMaterial({color:f});s&&v.color.set(f);const S=new a.Mesh(L,v);S.userData.depth=b,S.userData.index=l,S.rotateZ(u),u+=y,this.add(S)}),c!==-1&&this.setActive(c)})}createGeometry(e,t){const{outRadius:n,innerRadius:s}=this.options,r=new a.Shape;return r.moveTo(n,0),r.lineTo(s,0),r.absarc(0,0,s,0,t,!1),r.absarc(0,0,n,t,0,!0),new te(r,{curveSegments:48,depth:e,bevelEnabled:!1})}handlePick(e,t=1.3){const{object:n}=this.pencil.pick(e,this.object3d.children)||{},s=n?this.object3d.children.findIndex(r=>r===n):this.options.activeIndex;return this.setActive(s,t)}setActive(e,t=1.3){const n=this.object3d.children[e];if(this.object3d.children.forEach(s=>{if(!(n&&n===s)&&s.scale.z!==1){if(s.userData.levTween)return;s.userData.enTween&&(s.userData.enTween.stop(),s.userData.enTween=null);const r=new se.Tween(s.scale).to({z:1},100);s.userData.levTween=r,r.start()}}),n){if(n.userData.enTween)return;n.userData.levTween&&(n.userData.levTween.stop(),n.userData.levTween=null);const s=new se.Tween(n.scale).to({z:t},100);return n.userData.enTween=s,s.start(),n.userData.index}return-1}render(){this.object3d.scale.z=0,new se.Tween(this.object3d.scale).to({z:1},1e3).easing(se.Easing.Sinusoidal.InOut).start()}}Object.defineProperty(exports,"Line2Material",{enumerable:!0,get:()=>qe.LineMaterial});Object.defineProperty(exports,"LineSegmentsGeometry",{enumerable:!0,get:()=>De.LineSegmentsGeometry});exports.MeshLineMaterial=O.MeshLineMaterial;exports.Node=O.Node;exports.getConicPolygonGeometry=O.PolygonGeometry;exports.getConicPolygonGeometryMetas=O.getMetas;exports.ConicPolygon=tt;exports.Ellipsoid=st;exports.ExtrudePolygon=ct;exports.Group=ht;exports.Light=ut;exports.Line=dt;exports.Line2=mt;exports.MeshLineGeometry=We;exports.MeshLineRaycast=ft;exports.Pie=pt;exports.getSplitTexture=lt;
|