gl-draw 0.15.21 → 0.15.22
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/WebGPULineSegments2.js +1 -1
- package/dist/WebGPULineSegments2.module.js +22 -16
- package/dist/core/Pencil.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.module.js +427 -332
- package/dist/objects/line/meshLine/MeshLineMaterial.d.ts +2 -0
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +10 -10
- package/dist/utils/Timer.d.ts +72 -0
- package/package.json +1 -1
|
@@ -136,4 +136,4 @@ void main() {
|
|
|
136
136
|
${o.ShaderChunk.logdepthbuf_vertex}
|
|
137
137
|
${o.ShaderChunk.fog_vertex}
|
|
138
138
|
}
|
|
139
|
-
`;class We extends o.ShaderMaterial{constructor(e={}){const j=e,{lineWidth:t=1,color:r="#ffffff",opacity:i=1,map:c=null,dashOffset:u=0,dashArray:s=0,dashRatio:l=0,sizeAttenuation:a=!0,offsetLoop:p=!0,offset:f=new o.Vector2(0,0),scaleDown:m=0,alphaMap:d=void 0,alphaTest:v=0,repeat:h=new o.Vector2(1,1),resolution:y=new o.Vector2(1,1)}=j,w=re(j,["lineWidth","color","opacity","map","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super(q(_({},w),{uniforms:{lineWidth:{value:t},color:{value:new o.Color(r)},opacity:{value:i},map:{value:c},useMap:{value:c?1:0},resolution:{value:y},sizeAttenuation:{value:a?1:0},offset:{value:f},offsetLoop:{value:p?1:0},dashArray:{value:s},dashOffset:{value:u},dashRatio:{value:l},useDash:{value:s>0?1:0},scaleDown:{value:m/10},alphaTest:{value:v},alphaMap:{value:d},useAlphaMap:{value:d?1:0},repeat:{value:h}},vertexShader:ke,fragmentShader:Oe})),this.type="MeshLineMaterial"}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new o.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 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 F=new o.Vector4,ce=new o.Vector3,le=new o.Vector3,g=new o.Vector4,M=new o.Vector4,D=new o.Vector4,$=new o.Vector3,K=new o.Matrix4,S=new o.Line3,ue=new o.Vector3,N=new o.Box3,U=new o.Sphere,V=new o.Vector4;let T,E;function de(n,e,t){return V.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),V.multiplyScalar(1/V.w),V.x=E/t.width,V.y=E/t.height,V.applyMatrix4(n.projectionMatrixInverse),V.multiplyScalar(1/V.w),Math.abs(Math.max(V.x,V.y))}function Ne(n,e){const t=n.matrixWorld,r=n.geometry,i=r.attributes.instanceStart,c=r.attributes.instanceEnd,u=Math.min(r.instanceCount,i.count);for(let s=0,l=u;s<l;s++){S.start.fromBufferAttribute(i,s),S.end.fromBufferAttribute(c,s),S.applyMatrix4(t);const a=new o.Vector3,p=new o.Vector3;T.distanceSqToSegment(S.start,S.end,p,a),p.distanceTo(a)<E*.5&&e.push({point:p,pointOnLine:a,distance:T.origin.distanceTo(p),object:n,face:null,faceIndex:s,uv:null,uv1:null})}}function Ue(n,e,t){const r=e.projectionMatrix,c=n.material.resolution,u=n.matrixWorld,s=n.geometry,l=s.attributes.instanceStart,a=s.attributes.instanceEnd,p=Math.min(s.instanceCount,l.count),f=-e.near;T.at(1,D),D.w=1,D.applyMatrix4(e.matrixWorldInverse),D.applyMatrix4(r),D.multiplyScalar(1/D.w),D.x*=c.x/2,D.y*=c.y/2,D.z=0,$.copy(D),K.multiplyMatrices(e.matrixWorldInverse,u);for(let m=0,d=p;m<d;m++){if(g.fromBufferAttribute(l,m),M.fromBufferAttribute(a,m),g.w=1,M.w=1,g.applyMatrix4(K),M.applyMatrix4(K),g.z>f&&M.z>f)continue;if(g.z>f){const I=g.z-M.z,A=(g.z-f)/I;g.lerp(M,A)}else if(M.z>f){const I=M.z-g.z,A=(M.z-f)/I;M.lerp(g,A)}g.applyMatrix4(r),M.applyMatrix4(r),g.multiplyScalar(1/g.w),M.multiplyScalar(1/M.w),g.x*=c.x/2,g.y*=c.y/2,M.x*=c.x/2,M.y*=c.y/2,S.start.copy(g),S.start.z=0,S.end.copy(M),S.end.z=0;const h=S.closestPointToPointParameter($,!0);S.at(h,ue);const y=o.MathUtils.lerp(g.z,M.z,h),w=y>=-1&&y<=1,j=$.distanceTo(ue)<E*.5;if(w&&j){S.start.fromBufferAttribute(l,m),S.end.fromBufferAttribute(a,m),S.start.applyMatrix4(u),S.end.applyMatrix4(u);const I=new o.Vector3,A=new o.Vector3;T.distanceSqToSegment(S.start,S.end,A,I),t.push({point:A,pointOnLine:I,distance:T.origin.distanceTo(A),object:n,face:null,faceIndex:m,uv:null,uv1:null})}}}class Ge extends o.Mesh{constructor(e=new xe.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let u=0,s=0,l=t.count;u<l;u++,s+=2)ce.fromBufferAttribute(t,u),le.fromBufferAttribute(r,u),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+ce.distanceTo(le);const c=new o.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new o.InterleavedBufferAttribute(c,1,0)),e.setAttribute("instanceDistanceEnd",new o.InterleavedBufferAttribute(c,1,1)),this}raycast(e,t){const r=this.material.worldUnits,i=e.camera;i===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const c=e.params.Line2!==void 0&&e.params.Line2.threshold||0;T=e.ray;const u=this.matrixWorld,s=this.geometry,l=this.material;E=l.linewidth+c,s.boundingSphere===null&&s.computeBoundingSphere(),U.copy(s.boundingSphere).applyMatrix4(u);let a;if(r)a=E*.5;else{const f=Math.max(i.near,U.distanceToPoint(T.origin));a=de(i,f,l.resolution)}if(U.radius+=a,T.intersectsSphere(U)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),N.copy(s.boundingBox).applyMatrix4(u);let p;if(r)p=E*.5;else{const f=Math.max(i.near,N.distanceToPoint(T.origin));p=de(i,f,l.resolution)}N.expandByScalar(p),T.intersectsBox(N)!==!1&&(r?Ne(this,t):Ue(this,i,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(F),this.material.uniforms.resolution.value.set(F.z,F.w))}}exports.BLOOM_SCENE=je;exports.BaseObject=Y;exports.IS_DEV=Ce;exports.LineSegments2=Ge;exports.MeshLineMaterial=We;exports.PolygonGeometry=_e;exports.ResourceTracker=fe;exports.getMetas=he;
|
|
139
|
+
`;class We extends o.ShaderMaterial{constructor(e={}){const j=e,{lineWidth:t=1,color:r="#ffffff",opacity:i=1,map:c=null,dashOffset:u=0,dashArray:s=0,dashRatio:l=0,sizeAttenuation:a=!0,offsetLoop:p=!0,offset:f=new o.Vector2(0,0),scaleDown:m=0,alphaMap:d=void 0,alphaTest:v=0,repeat:h=new o.Vector2(1,1),resolution:y=new o.Vector2(1,1)}=j,w=re(j,["lineWidth","color","opacity","map","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super(q(_({},w),{uniforms:{lineWidth:{value:t},color:{value:new o.Color(r)},opacity:{value:i},map:{value:c},useMap:{value:c?1:0},resolution:{value:y},sizeAttenuation:{value:a?1:0},offset:{value:f},offsetLoop:{value:p?1:0},dashArray:{value:s},dashOffset:{value:u},dashRatio:{value:l},useDash:{value:s>0?1:0},scaleDown:{value:m/10},alphaTest:{value:v},alphaMap:{value:d},useAlphaMap:{value:d?1:0},repeat:{value:h}},vertexShader:ke,fragmentShader:Oe})),this.type="MeshLineMaterial"}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new o.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 F=new o.Vector4,ce=new o.Vector3,le=new o.Vector3,g=new o.Vector4,M=new o.Vector4,D=new o.Vector4,$=new o.Vector3,K=new o.Matrix4,S=new o.Line3,ue=new o.Vector3,N=new o.Box3,U=new o.Sphere,V=new o.Vector4;let T,E;function de(n,e,t){return V.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),V.multiplyScalar(1/V.w),V.x=E/t.width,V.y=E/t.height,V.applyMatrix4(n.projectionMatrixInverse),V.multiplyScalar(1/V.w),Math.abs(Math.max(V.x,V.y))}function Ne(n,e){const t=n.matrixWorld,r=n.geometry,i=r.attributes.instanceStart,c=r.attributes.instanceEnd,u=Math.min(r.instanceCount,i.count);for(let s=0,l=u;s<l;s++){S.start.fromBufferAttribute(i,s),S.end.fromBufferAttribute(c,s),S.applyMatrix4(t);const a=new o.Vector3,p=new o.Vector3;T.distanceSqToSegment(S.start,S.end,p,a),p.distanceTo(a)<E*.5&&e.push({point:p,pointOnLine:a,distance:T.origin.distanceTo(p),object:n,face:null,faceIndex:s,uv:null,uv1:null})}}function Ue(n,e,t){const r=e.projectionMatrix,c=n.material.resolution,u=n.matrixWorld,s=n.geometry,l=s.attributes.instanceStart,a=s.attributes.instanceEnd,p=Math.min(s.instanceCount,l.count),f=-e.near;T.at(1,D),D.w=1,D.applyMatrix4(e.matrixWorldInverse),D.applyMatrix4(r),D.multiplyScalar(1/D.w),D.x*=c.x/2,D.y*=c.y/2,D.z=0,$.copy(D),K.multiplyMatrices(e.matrixWorldInverse,u);for(let m=0,d=p;m<d;m++){if(g.fromBufferAttribute(l,m),M.fromBufferAttribute(a,m),g.w=1,M.w=1,g.applyMatrix4(K),M.applyMatrix4(K),g.z>f&&M.z>f)continue;if(g.z>f){const I=g.z-M.z,A=(g.z-f)/I;g.lerp(M,A)}else if(M.z>f){const I=M.z-g.z,A=(M.z-f)/I;M.lerp(g,A)}g.applyMatrix4(r),M.applyMatrix4(r),g.multiplyScalar(1/g.w),M.multiplyScalar(1/M.w),g.x*=c.x/2,g.y*=c.y/2,M.x*=c.x/2,M.y*=c.y/2,S.start.copy(g),S.start.z=0,S.end.copy(M),S.end.z=0;const h=S.closestPointToPointParameter($,!0);S.at(h,ue);const y=o.MathUtils.lerp(g.z,M.z,h),w=y>=-1&&y<=1,j=$.distanceTo(ue)<E*.5;if(w&&j){S.start.fromBufferAttribute(l,m),S.end.fromBufferAttribute(a,m),S.start.applyMatrix4(u),S.end.applyMatrix4(u);const I=new o.Vector3,A=new o.Vector3;T.distanceSqToSegment(S.start,S.end,A,I),t.push({point:A,pointOnLine:I,distance:T.origin.distanceTo(A),object:n,face:null,faceIndex:m,uv:null,uv1:null})}}}class Ge extends o.Mesh{constructor(e=new xe.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let u=0,s=0,l=t.count;u<l;u++,s+=2)ce.fromBufferAttribute(t,u),le.fromBufferAttribute(r,u),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+ce.distanceTo(le);const c=new o.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new o.InterleavedBufferAttribute(c,1,0)),e.setAttribute("instanceDistanceEnd",new o.InterleavedBufferAttribute(c,1,1)),this}raycast(e,t){const r=this.material.worldUnits,i=e.camera;i===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const c=e.params.Line2!==void 0&&e.params.Line2.threshold||0;T=e.ray;const u=this.matrixWorld,s=this.geometry,l=this.material;E=l.linewidth+c,s.boundingSphere===null&&s.computeBoundingSphere(),U.copy(s.boundingSphere).applyMatrix4(u);let a;if(r)a=E*.5;else{const f=Math.max(i.near,U.distanceToPoint(T.origin));a=de(i,f,l.resolution)}if(U.radius+=a,T.intersectsSphere(U)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),N.copy(s.boundingBox).applyMatrix4(u);let p;if(r)p=E*.5;else{const f=Math.max(i.near,N.distanceToPoint(T.origin));p=de(i,f,l.resolution)}N.expandByScalar(p),T.intersectsBox(N)!==!1&&(r?Ne(this,t):Ue(this,i,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(F),this.material.uniforms.resolution.value.set(F.z,F.w))}}exports.BLOOM_SCENE=je;exports.BaseObject=Y;exports.IS_DEV=Ce;exports.LineSegments2=Ge;exports.MeshLineMaterial=We;exports.PolygonGeometry=_e;exports.ResourceTracker=fe;exports.getMetas=he;
|
|
@@ -35,7 +35,7 @@ var ot = (n, t, e) => new Promise((i, s) => {
|
|
|
35
35
|
}, r = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(a, l);
|
|
36
36
|
r((e = e.apply(n, t)).next());
|
|
37
37
|
});
|
|
38
|
-
import { Material as at, Object3D as R, Texture as ct, VideoTexture as Bt, BufferGeometry as J, Float32BufferAttribute as G, PointsMaterial as
|
|
38
|
+
import { Material as at, Object3D as R, Texture as ct, VideoTexture as Bt, BufferGeometry as J, Float32BufferAttribute as G, PointsMaterial as Tt, Points as H, InstancedMesh as wt, Vector3 as I, Quaternion as zt, Group as _t, Mesh as St, Sprite as lt, Box3 as jt, REVISION as Et, ShaderChunk as W, ShaderMaterial as Lt, Vector2 as K, Color as ut, Vector4 as O, Matrix4 as Ot, Line3 as Vt, Sphere as kt, InstancedInterleavedBuffer as Wt, InterleavedBufferAttribute as ft, MathUtils as Nt } from "three";
|
|
39
39
|
import { CSS2DObject as Ut } from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
40
40
|
import { CSS3DObject as Rt, CSS3DSprite as Gt } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
41
41
|
import { geoBounds as At, geoContains as $t, geoDistance as Ft, geoInterpolate as qt } from "d3-geo";
|
|
@@ -100,7 +100,7 @@ const ne = (n, t = 1) => {
|
|
|
100
100
|
"scaleAtt",
|
|
101
101
|
new G(new Array(t).fill(1), 1)
|
|
102
102
|
);
|
|
103
|
-
const i = n.material, s = new
|
|
103
|
+
const i = n.material, s = new Tt({
|
|
104
104
|
size: 10,
|
|
105
105
|
map: i.map,
|
|
106
106
|
alphaMap: i.alphaMap,
|
|
@@ -131,7 +131,7 @@ const ne = (n, t = 1) => {
|
|
|
131
131
|
if (n instanceof wt || n.isInstantiate)
|
|
132
132
|
n.setMatrixAt(s, r);
|
|
133
133
|
else if (n instanceof H || n.type === "Points") {
|
|
134
|
-
const o = n.geometry, h = o.attributes.position.array, f = o.attributes.scaleAtt.array, p = new I(), u = new I(), m = new
|
|
134
|
+
const o = n.geometry, h = o.attributes.position.array, f = o.attributes.scaleAtt.array, p = new I(), u = new I(), m = new zt(), d = s * 3, v = s * 1;
|
|
135
135
|
r.decompose(p, m, u), h[d] = p.x, h[d + 1] = p.y, h[d + 2] = p.z, f[v] = Math.max(u.x, u.y, u.z), o.attributes.position.needsUpdate = !0, o.attributes.scaleAtt.needsUpdate = !0;
|
|
136
136
|
}
|
|
137
137
|
});
|
|
@@ -850,6 +850,12 @@ class Oe extends Lt {
|
|
|
850
850
|
set opacity(t) {
|
|
851
851
|
this.uniforms && (this.uniforms.opacity.value = t);
|
|
852
852
|
}
|
|
853
|
+
get alphaTest() {
|
|
854
|
+
return this.uniforms.alphaTest.value;
|
|
855
|
+
}
|
|
856
|
+
set alphaTest(t) {
|
|
857
|
+
this.uniforms && (this.uniforms.alphaTest.value = t);
|
|
858
|
+
}
|
|
853
859
|
// Getter and setter for map
|
|
854
860
|
get map() {
|
|
855
861
|
return this.uniforms.map.value;
|
|
@@ -878,20 +884,20 @@ class Oe extends Lt {
|
|
|
878
884
|
this.uniforms.sizeAttenuation.value = t ? 1 : 0;
|
|
879
885
|
}
|
|
880
886
|
}
|
|
881
|
-
const Q = new O(), gt = new I(), bt = new I(), g = new O(), b = new O(), B = new O(), X = new I(), Y = new Ot(), M = new Vt(), Mt = new I(), N = new jt(), U = new kt(),
|
|
882
|
-
let
|
|
887
|
+
const Q = new O(), gt = new I(), bt = new I(), g = new O(), b = new O(), B = new O(), X = new I(), Y = new Ot(), M = new Vt(), Mt = new I(), N = new jt(), U = new kt(), T = new O();
|
|
888
|
+
let z, E;
|
|
883
889
|
function xt(n, t, e) {
|
|
884
|
-
return
|
|
890
|
+
return T.set(0, 0, -t, 1).applyMatrix4(n.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = E / e.width, T.y = E / e.height, T.applyMatrix4(n.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
|
|
885
891
|
}
|
|
886
892
|
function ve(n, t) {
|
|
887
893
|
const e = n.matrixWorld, i = n.geometry, s = i.attributes.instanceStart, a = i.attributes.instanceEnd, l = Math.min(i.instanceCount, s.count);
|
|
888
894
|
for (let r = 0, c = l; r < c; r++) {
|
|
889
895
|
M.start.fromBufferAttribute(s, r), M.end.fromBufferAttribute(a, r), M.applyMatrix4(e);
|
|
890
896
|
const o = new I(), h = new I();
|
|
891
|
-
|
|
897
|
+
z.distanceSqToSegment(M.start, M.end, h, o), h.distanceTo(o) < E * 0.5 && t.push({
|
|
892
898
|
point: h,
|
|
893
899
|
pointOnLine: o,
|
|
894
|
-
distance:
|
|
900
|
+
distance: z.origin.distanceTo(h),
|
|
895
901
|
object: n,
|
|
896
902
|
face: null,
|
|
897
903
|
faceIndex: r,
|
|
@@ -902,7 +908,7 @@ function ve(n, t) {
|
|
|
902
908
|
}
|
|
903
909
|
function ye(n, t, e) {
|
|
904
910
|
const i = t.projectionMatrix, a = n.material.resolution, l = n.matrixWorld, r = n.geometry, c = r.attributes.instanceStart, o = r.attributes.instanceEnd, h = Math.min(r.instanceCount, c.count), f = -t.near;
|
|
905
|
-
|
|
911
|
+
z.at(1, B), B.w = 1, B.applyMatrix4(t.matrixWorldInverse), B.applyMatrix4(i), B.multiplyScalar(1 / B.w), B.x *= a.x / 2, B.y *= a.y / 2, B.z = 0, X.copy(B), Y.multiplyMatrices(t.matrixWorldInverse, l);
|
|
906
912
|
for (let p = 0, u = h; p < u; p++) {
|
|
907
913
|
if (g.fromBufferAttribute(c, p), b.fromBufferAttribute(o, p), g.w = 1, b.w = 1, g.applyMatrix4(Y), b.applyMatrix4(Y), g.z > f && b.z > f)
|
|
908
914
|
continue;
|
|
@@ -920,10 +926,10 @@ function ye(n, t, e) {
|
|
|
920
926
|
if (w && S) {
|
|
921
927
|
M.start.fromBufferAttribute(c, p), M.end.fromBufferAttribute(o, p), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
|
|
922
928
|
const D = new I(), j = new I();
|
|
923
|
-
|
|
929
|
+
z.distanceSqToSegment(M.start, M.end, j, D), e.push({
|
|
924
930
|
point: j,
|
|
925
931
|
pointOnLine: D,
|
|
926
|
-
distance:
|
|
932
|
+
distance: z.origin.distanceTo(j),
|
|
927
933
|
object: n,
|
|
928
934
|
face: null,
|
|
929
935
|
faceIndex: p,
|
|
@@ -961,7 +967,7 @@ class Ve extends St {
|
|
|
961
967
|
'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
|
|
962
968
|
);
|
|
963
969
|
const a = t.params.Line2 !== void 0 && t.params.Line2.threshold || 0;
|
|
964
|
-
|
|
970
|
+
z = t.ray;
|
|
965
971
|
const l = this.matrixWorld, r = this.geometry, c = this.material;
|
|
966
972
|
E = c.linewidth + a, r.boundingSphere === null && r.computeBoundingSphere(), U.copy(r.boundingSphere).applyMatrix4(l);
|
|
967
973
|
let o;
|
|
@@ -970,7 +976,7 @@ class Ve extends St {
|
|
|
970
976
|
else {
|
|
971
977
|
const f = Math.max(
|
|
972
978
|
s.near,
|
|
973
|
-
U.distanceToPoint(
|
|
979
|
+
U.distanceToPoint(z.origin)
|
|
974
980
|
);
|
|
975
981
|
o = xt(
|
|
976
982
|
s,
|
|
@@ -978,7 +984,7 @@ class Ve extends St {
|
|
|
978
984
|
c.resolution
|
|
979
985
|
);
|
|
980
986
|
}
|
|
981
|
-
if (U.radius += o,
|
|
987
|
+
if (U.radius += o, z.intersectsSphere(U) === !1)
|
|
982
988
|
return;
|
|
983
989
|
r.boundingBox === null && r.computeBoundingBox(), N.copy(r.boundingBox).applyMatrix4(l);
|
|
984
990
|
let h;
|
|
@@ -987,7 +993,7 @@ class Ve extends St {
|
|
|
987
993
|
else {
|
|
988
994
|
const f = Math.max(
|
|
989
995
|
s.near,
|
|
990
|
-
N.distanceToPoint(
|
|
996
|
+
N.distanceToPoint(z.origin)
|
|
991
997
|
);
|
|
992
998
|
h = xt(
|
|
993
999
|
s,
|
|
@@ -995,7 +1001,7 @@ class Ve extends St {
|
|
|
995
1001
|
c.resolution
|
|
996
1002
|
);
|
|
997
1003
|
}
|
|
998
|
-
N.expandByScalar(h),
|
|
1004
|
+
N.expandByScalar(h), z.intersectsBox(N) !== !1 && (i ? ve(this, e) : ye(this, s, e));
|
|
999
1005
|
}
|
|
1000
1006
|
onBeforeRender(t) {
|
|
1001
1007
|
const e = this.material.uniforms;
|
package/dist/core/Pencil.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import Stats from 'stats-gl';
|
|
3
3
|
import { type Object3D, type PerspectiveCamera, Vector3 } from 'three';
|
|
4
|
-
import { Timer } from 'three/examples/jsm/misc/Timer';
|
|
5
4
|
import CameraController, { type CameraParams } from "./Camera";
|
|
6
5
|
import ComposerController, { type BloomParams, type ComposerParams, type SSAOParams } from "./Composer";
|
|
7
6
|
import ControlsController, { type ControlsParams } from "./Controls";
|
|
@@ -14,6 +13,7 @@ import RendererController, { type RendererParams } from "./Renderer";
|
|
|
14
13
|
import SceneController, { type SceneParams } from "./Scene";
|
|
15
14
|
import TransformController from "./TransformControls";
|
|
16
15
|
import type { Wk } from "../plugins";
|
|
16
|
+
import { Timer } from "../utils/Timer";
|
|
17
17
|
type DeepRequired<T> = T extends Function | HTMLElement ? T : T extends object ? {
|
|
18
18
|
[P in keyof T]-?: DeepRequired<T[P]>;
|
|
19
19
|
} : T;
|