@realsee/five 6.4.0 → 6.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/classes/five.Tile3DModel.html +1 -1
- package/five/index.js +4 -4
- package/five/index.mjs +6 -6
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/plugins/index.js +2 -2
- package/plugins/index.mjs +2 -2
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/shader-lib/index.js +34 -21
- package/shader-lib/index.mjs +140 -127
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +3 -3
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +2 -2
- package/umd/five-react.js +2 -2
- package/umd/five-shader-lib.js +34 -21
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five-vue.js +2 -2
- package/umd/five.js +4 -4
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
- package/work-downloader/index.d.ts +1 -0
- package/work-downloader/index.js +3 -3
- package/work-downloader/index.mjs +230 -266
package/shader-lib/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version: 6.4.
|
|
4
|
+
* Generated: 6/20/2025
|
|
5
|
+
* Version: 6.4.2
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -253,12 +253,12 @@
|
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
255
|
*/import { CustomShader as C } from "@realsee/five";
|
|
256
|
-
import * as
|
|
256
|
+
import * as r from "three";
|
|
257
257
|
var B = function(i, e) {
|
|
258
|
-
return B = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n,
|
|
259
|
-
n.__proto__ =
|
|
260
|
-
} || function(n,
|
|
261
|
-
for (var o in
|
|
258
|
+
return B = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, t) {
|
|
259
|
+
n.__proto__ = t;
|
|
260
|
+
} || function(n, t) {
|
|
261
|
+
for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (n[o] = t[o]);
|
|
262
262
|
}, B(i, e);
|
|
263
263
|
};
|
|
264
264
|
function S(i, e) {
|
|
@@ -270,12 +270,12 @@ function S(i, e) {
|
|
|
270
270
|
}
|
|
271
271
|
i.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
|
|
272
272
|
}
|
|
273
|
-
function
|
|
274
|
-
if (n || arguments.length === 2) for (var
|
|
275
|
-
(l || !(
|
|
273
|
+
function I(i, e, n) {
|
|
274
|
+
if (n || arguments.length === 2) for (var t = 0, o = e.length, l; t < o; t++)
|
|
275
|
+
(l || !(t in e)) && (l || (l = Array.prototype.slice.call(e, 0, t)), l[t] = e[t]);
|
|
276
276
|
return i.concat(l || Array.prototype.slice.call(e));
|
|
277
277
|
}
|
|
278
|
-
var
|
|
278
|
+
var b = `
|
|
279
279
|
#if defined(USE_PLANE_DISTANCE)
|
|
280
280
|
struct Plane {
|
|
281
281
|
vec3 normal;
|
|
@@ -286,7 +286,7 @@ var D = `
|
|
|
286
286
|
uniform float evennessPlaneConstant;
|
|
287
287
|
uniform float evennessPlaneDepth;
|
|
288
288
|
#endif
|
|
289
|
-
`,
|
|
289
|
+
`, A = `
|
|
290
290
|
#if defined(USE_PLANE_DISTANCE)
|
|
291
291
|
|
|
292
292
|
bool inside = true;
|
|
@@ -306,28 +306,28 @@ var D = `
|
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
#endif
|
|
309
|
-
`,
|
|
309
|
+
`, J = "", W = {
|
|
310
310
|
type: ["pointcloud"],
|
|
311
311
|
fragment: {
|
|
312
|
-
mainBefore:
|
|
313
|
-
mainStart:
|
|
314
|
-
mainEnd:
|
|
312
|
+
mainBefore: b,
|
|
313
|
+
mainStart: J,
|
|
314
|
+
mainEnd: A
|
|
315
315
|
},
|
|
316
316
|
uniforms: {
|
|
317
|
-
evennessPlaneNormal: new
|
|
318
|
-
evennessPlaneConstant: new
|
|
319
|
-
evennessPlanes: new
|
|
320
|
-
evennessPlaneDepth: new
|
|
317
|
+
evennessPlaneNormal: new r.Uniform(new r.Vector3()),
|
|
318
|
+
evennessPlaneConstant: new r.Uniform(0),
|
|
319
|
+
evennessPlanes: new r.Uniform([]),
|
|
320
|
+
evennessPlaneDepth: new r.Uniform(0)
|
|
321
321
|
},
|
|
322
322
|
defines: {
|
|
323
323
|
USE_PLANE_DISTANCE: !1
|
|
324
324
|
}
|
|
325
|
-
},
|
|
325
|
+
}, Z = (
|
|
326
326
|
/** @class */
|
|
327
327
|
function(i) {
|
|
328
328
|
S(e, i);
|
|
329
329
|
function e() {
|
|
330
|
-
var n = i.call(this,
|
|
330
|
+
var n = i.call(this, W) || this;
|
|
331
331
|
return Object.defineProperties(n, {
|
|
332
332
|
evennessPlane: {
|
|
333
333
|
get: function() {
|
|
@@ -336,18 +336,18 @@ var D = `
|
|
|
336
336
|
points: this.uniforms.evennessPoints.value
|
|
337
337
|
};
|
|
338
338
|
},
|
|
339
|
-
set: function(
|
|
340
|
-
var o =
|
|
339
|
+
set: function(t) {
|
|
340
|
+
var o = t.points, l = t.depth, m = !1;
|
|
341
341
|
if (o.length !== 0 && o.length % 4 === 0) {
|
|
342
342
|
m = !0;
|
|
343
|
-
var v = o[0],
|
|
343
|
+
var v = o[0], u = o[1], p = o[2], a = o[3], g = new r.Vector3().subVectors(u, v), h = new r.Vector3().subVectors(p, v), c = new r.Vector3().crossVectors(g, h).normalize(), x = -c.dot(v), s = l, d = v.clone().add(c.clone().negate().multiplyScalar(s)), f = v.clone().add(c.clone().multiplyScalar(s)), y = u.clone().add(c.clone().negate().multiplyScalar(s)), E = u.clone().add(c.clone().multiplyScalar(s)), _ = p.clone().add(c.clone().negate().multiplyScalar(s)), P = p.clone().add(c.clone().multiplyScalar(s)), w = a.clone().add(c.clone().negate().multiplyScalar(s)), F = a.clone().add(c.clone().multiplyScalar(s)), z = new r.Plane().setFromCoplanarPoints(f, E, P), N = new r.Plane().setFromCoplanarPoints(_, y, d), M = new r.Plane().setFromCoplanarPoints(E, f, d), O = new r.Plane().setFromCoplanarPoints(w, F, P), D = new r.Plane().setFromCoplanarPoints(P, E, y), T = new r.Plane().setFromCoplanarPoints(d, f, F);
|
|
344
344
|
this.uniforms.evennessPlanes.value = [
|
|
345
|
+
{ normal: z.normal, constant: z.constant },
|
|
345
346
|
{ normal: N.normal, constant: N.constant },
|
|
346
347
|
{ normal: M.normal, constant: M.constant },
|
|
347
348
|
{ normal: O.normal, constant: O.constant },
|
|
348
|
-
{ normal:
|
|
349
|
-
{ normal:
|
|
350
|
-
{ normal: I.normal, constant: I.constant }
|
|
349
|
+
{ normal: D.normal, constant: D.constant },
|
|
350
|
+
{ normal: T.normal, constant: T.constant }
|
|
351
351
|
], this.uniforms.evennessPlaneDepth.value = l, this.uniforms.evennessPlaneNormal.value = c, this.uniforms.evennessPlaneConstant.value = x;
|
|
352
352
|
}
|
|
353
353
|
this.defines.USE_PLANE_DISTANCE = m;
|
|
@@ -360,7 +360,7 @@ var D = `
|
|
|
360
360
|
}
|
|
361
361
|
return e;
|
|
362
362
|
}(C)
|
|
363
|
-
),
|
|
363
|
+
), H = `
|
|
364
364
|
#if NUM_SWEEP_OBJECTS > 0
|
|
365
365
|
uniform float sweepProgress;
|
|
366
366
|
uniform float sweepRange;
|
|
@@ -373,69 +373,82 @@ var D = `
|
|
|
373
373
|
};
|
|
374
374
|
uniform SWEEP_OBJECT sweepBoxs[NUM_SWEEP_OBJECTS];
|
|
375
375
|
#endif
|
|
376
|
-
`,
|
|
376
|
+
`, R = `
|
|
377
|
+
|
|
377
378
|
#if NUM_SWEEP_OBJECTS > 0
|
|
378
379
|
#pragma unroll_loop_start
|
|
379
380
|
for ( int i = 0; i < NUM_SWEEP_OBJECTS; i ++ ) {
|
|
380
381
|
vec3 minPos = sweepBoxs[ i ].min;
|
|
381
382
|
vec3 maxPos = sweepBoxs[ i ].max;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
383
|
+
|
|
384
|
+
// 计算包围盒中心点
|
|
385
|
+
vec3 center = (minPos + maxPos) * 0.5;
|
|
386
|
+
// 计算包围盒半尺寸
|
|
387
|
+
vec3 halfSize = (maxPos - minPos) * 0.5;
|
|
388
|
+
|
|
389
|
+
// 计算顶点到中心的相对距离(标准化到0-1范围)
|
|
390
|
+
vec3 relativePos = (vWorldPosition.xyz - center) / halfSize;
|
|
391
|
+
float maxDistance = length(relativePos) / sqrt(3.0);
|
|
392
|
+
// 计算扩散不透明度(基于进度和距离)+-sweepRange之间的才有opactiy,其他的为0
|
|
393
|
+
float distanceFromSweep = abs(maxDistance - sweepProgress);
|
|
394
|
+
// 指数衰减:exp(-k*x) 形式
|
|
395
|
+
float k = 5.0 / sweepRange; // 控制衰减速度
|
|
396
|
+
float sweepOpacity = exp(-k * distanceFromSweep) * 0.8;
|
|
397
|
+
if(vWorldPosition.x > minPos.x && vWorldPosition.x < maxPos.x &&
|
|
398
|
+
vWorldPosition.y > minPos.y && vWorldPosition.y < maxPos.y &&
|
|
399
|
+
vWorldPosition.z > minPos.z && vWorldPosition.z < maxPos.z) {
|
|
400
|
+
|
|
401
|
+
if(maxDistance < sweepProgress + sweepRange && maxDistance > sweepProgress - sweepRange) {
|
|
402
|
+
// 混合颜色
|
|
403
|
+
gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(1.0,1.0,1.0), sweepOpacity);
|
|
389
404
|
}
|
|
390
|
-
float mixProgress = realProgress * realProgress * realProgress * 2.0;
|
|
391
|
-
gl_FragColor.rgb += shineColor * mixProgress;
|
|
392
405
|
}
|
|
393
406
|
}
|
|
394
407
|
#pragma unroll_loop_end
|
|
395
408
|
#endif
|
|
396
|
-
`,
|
|
397
|
-
type: ["basic", "phong"],
|
|
398
|
-
fragment: {
|
|
399
|
-
mainBefore: V,
|
|
400
|
-
mainStart: W,
|
|
401
|
-
mainEnd: L
|
|
402
|
-
},
|
|
403
|
-
uniforms: {
|
|
404
|
-
sweepProgress: new t.Uniform(0),
|
|
405
|
-
sweepRange: new t.Uniform(0),
|
|
406
|
-
sweepBoxs: new t.Uniform([]),
|
|
407
|
-
interval: new t.Uniform(0.04),
|
|
408
|
-
// 线间距
|
|
409
|
-
threshold: new t.Uniform(2e-3)
|
|
410
|
-
// 线宽
|
|
411
|
-
},
|
|
412
|
-
defines: {
|
|
413
|
-
NUM_SWEEP_OBJECTS: 0
|
|
414
|
-
}
|
|
415
|
-
}, nn = (
|
|
409
|
+
`, V = "", X = (
|
|
416
410
|
/** @class */
|
|
417
411
|
function(i) {
|
|
418
412
|
S(e, i);
|
|
419
413
|
function e() {
|
|
420
|
-
var n = i.call(this,
|
|
414
|
+
var n = i.call(this, {
|
|
415
|
+
type: ["basic", "phong", "pointcloud"],
|
|
416
|
+
fragment: {
|
|
417
|
+
mainBefore: H,
|
|
418
|
+
mainStart: V,
|
|
419
|
+
mainEnd: R
|
|
420
|
+
},
|
|
421
|
+
uniforms: {
|
|
422
|
+
sweepProgress: new r.Uniform(0),
|
|
423
|
+
sweepRange: new r.Uniform(0),
|
|
424
|
+
sweepBoxs: new r.Uniform([]),
|
|
425
|
+
interval: new r.Uniform(0.04),
|
|
426
|
+
// 线间距
|
|
427
|
+
threshold: new r.Uniform(2e-3)
|
|
428
|
+
// 线宽
|
|
429
|
+
},
|
|
430
|
+
defines: {
|
|
431
|
+
NUM_SWEEP_OBJECTS: 0
|
|
432
|
+
}
|
|
433
|
+
}) || this;
|
|
421
434
|
return Object.defineProperties(n, {
|
|
422
435
|
sweepBoxs: {
|
|
423
436
|
get: function() {
|
|
424
437
|
return this.uniforms.sweepBoxs.value;
|
|
425
438
|
},
|
|
426
|
-
set: function(
|
|
427
|
-
var o =
|
|
428
|
-
o > 0 && (this.defines.NUM_SWEEP_OBJECTS = o, this.uniforms.sweepBoxs.value =
|
|
439
|
+
set: function(t) {
|
|
440
|
+
var o = t.length;
|
|
441
|
+
o > 0 && (this.defines.NUM_SWEEP_OBJECTS = o, this.uniforms.sweepBoxs.value = t);
|
|
429
442
|
}
|
|
430
443
|
}
|
|
431
444
|
}), n.sweepBoxs = [], n;
|
|
432
445
|
}
|
|
433
|
-
return e.prototype.onBeforeCompile = function(n,
|
|
446
|
+
return e.prototype.onBeforeCompile = function(n, t) {
|
|
434
447
|
var o = String(this.sweepBoxs.length);
|
|
435
448
|
n.vertexShader = n.vertexShader.replace(/NUM_SWEEP_OBJECTS/g, o), n.fragmentShader = n.fragmentShader.replace(/NUM_SWEEP_OBJECTS/g, o);
|
|
436
449
|
}, e;
|
|
437
450
|
}(C)
|
|
438
|
-
),
|
|
451
|
+
), L = `
|
|
439
452
|
uniform float pointCloudExpand_progress;
|
|
440
453
|
|
|
441
454
|
vec4 pointCloudExpand_permute(vec4 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); }
|
|
@@ -508,7 +521,7 @@ float pointCloudExpand_gln_simplex(vec3 v) {
|
|
|
508
521
|
m = m * m;
|
|
509
522
|
return 42.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
|
|
510
523
|
}
|
|
511
|
-
`,
|
|
524
|
+
`, G = `
|
|
512
525
|
float pointCloudExpand_sizeScale = 1.0;
|
|
513
526
|
float pointCloudExpand_sizeBasis = 0.0;
|
|
514
527
|
vec4 pointCloudExpand_basis = vec4((modelBoundingMax + modelBoundingMin) / 2.0, 1.0);
|
|
@@ -522,7 +535,7 @@ float pointCloudExpand_progress2 = step(pointCloudExpand_progress, 1.0 - pointCl
|
|
|
522
535
|
pointCloudExpand_sizeBasis = mix(0.1 * step(abs(pointCloudExpand_noise), 0.5 / pointCloudExpand_boundingRadius), pointCloudExpand_sizeBasis, pointCloudExpand_progress2);
|
|
523
536
|
gl_PointSize = gl_PointSize * pointCloudExpand_sizeScale + pointCloudExpand_sizeBasis;
|
|
524
537
|
vPointSize = gl_PointSize;
|
|
525
|
-
`,
|
|
538
|
+
`, nn = (
|
|
526
539
|
/** @class */
|
|
527
540
|
function(i) {
|
|
528
541
|
S(e, i);
|
|
@@ -530,11 +543,11 @@ vPointSize = gl_PointSize;
|
|
|
530
543
|
return i.call(this, {
|
|
531
544
|
type: ["pointcloud"],
|
|
532
545
|
vertex: {
|
|
533
|
-
mainBefore:
|
|
534
|
-
mainEnd:
|
|
546
|
+
mainBefore: L,
|
|
547
|
+
mainEnd: G
|
|
535
548
|
},
|
|
536
549
|
uniforms: {
|
|
537
|
-
pointCloudExpand_progress: new
|
|
550
|
+
pointCloudExpand_progress: new r.Uniform(0)
|
|
538
551
|
}
|
|
539
552
|
}) || this;
|
|
540
553
|
}
|
|
@@ -549,7 +562,7 @@ vPointSize = gl_PointSize;
|
|
|
549
562
|
configurable: !0
|
|
550
563
|
}), e;
|
|
551
564
|
}(C)
|
|
552
|
-
),
|
|
565
|
+
), j = `
|
|
553
566
|
uniform sampler2D polygonTexture;
|
|
554
567
|
|
|
555
568
|
struct PolygonClipper {
|
|
@@ -563,7 +576,7 @@ vPointSize = gl_PointSize;
|
|
|
563
576
|
#if NUM_POLYGON_CLIPPER > 0
|
|
564
577
|
uniform PolygonClipper polygonClippers[NUM_POLYGON_CLIPPER];
|
|
565
578
|
#endif
|
|
566
|
-
`,
|
|
579
|
+
`, $ = `
|
|
567
580
|
|
|
568
581
|
for(int i = 0; i < NUM_POLYGON_CLIPPER; i++){
|
|
569
582
|
PolygonClipper polygonClipper = polygonClippers[i];
|
|
@@ -611,11 +624,11 @@ vPointSize = gl_PointSize;
|
|
|
611
624
|
}
|
|
612
625
|
}
|
|
613
626
|
|
|
614
|
-
`,
|
|
627
|
+
`, q = (
|
|
615
628
|
/** @class */
|
|
616
629
|
function() {
|
|
617
630
|
function i() {
|
|
618
|
-
this.canvasCache = /* @__PURE__ */ new Map(), this.canvas = document.createElement("canvas"), this.canvas.width = 512, this.canvas.height = 512, this.polygonTexture = new
|
|
631
|
+
this.canvasCache = /* @__PURE__ */ new Map(), this.canvas = document.createElement("canvas"), this.canvas.width = 512, this.canvas.height = 512, this.polygonTexture = new r.CanvasTexture(this.canvas), this.polygonCount = 0;
|
|
619
632
|
}
|
|
620
633
|
return i.prototype.setSize = function(e) {
|
|
621
634
|
this.canvas.width = e, this.canvas.height = e;
|
|
@@ -623,20 +636,20 @@ vPointSize = gl_PointSize;
|
|
|
623
636
|
var n = JSON.stringify(e);
|
|
624
637
|
if (this.canvasCache.has(n))
|
|
625
638
|
return this.canvasCache.get(n);
|
|
626
|
-
var
|
|
627
|
-
|
|
628
|
-
var o =
|
|
639
|
+
var t = document.createElement("canvas");
|
|
640
|
+
t.width = this.canvas.width, t.height = this.canvas.height;
|
|
641
|
+
var o = t.getContext("2d");
|
|
629
642
|
if (!o)
|
|
630
643
|
throw new Error("Failed to get canvas context");
|
|
631
644
|
if (this.polygonCount >= 24)
|
|
632
645
|
throw new Error("polygon count exceed 24, please clear the canvas");
|
|
633
646
|
o.clearRect(0, 0, this.canvas.width, this.canvas.height), o.fillStyle = "rgba(0,0,0,1.0)", o.beginPath();
|
|
634
|
-
var l = e[0][0], m = e[0][0], v = e[0][1],
|
|
647
|
+
var l = e[0][0], m = e[0][0], v = e[0][1], u = e[0][1];
|
|
635
648
|
e.forEach(function(s) {
|
|
636
649
|
var d = s[0], f = s[1];
|
|
637
|
-
l = Math.min(l, d), m = Math.max(m, d), v = Math.min(v, f),
|
|
650
|
+
l = Math.min(l, d), m = Math.max(m, d), v = Math.min(v, f), u = Math.max(u, f);
|
|
638
651
|
});
|
|
639
|
-
var
|
|
652
|
+
var p = m - l, a = u - v, g = this.canvas.width, h = p >= a ? g / p : g / a, c = e.map(function(s) {
|
|
640
653
|
var d = s[0] - l, f = s[1] - v;
|
|
641
654
|
return [d, f];
|
|
642
655
|
}), x = c.map(function(s) {
|
|
@@ -645,44 +658,44 @@ vPointSize = gl_PointSize;
|
|
|
645
658
|
return x.forEach(function(s, d) {
|
|
646
659
|
var f = s[0], y = s[1];
|
|
647
660
|
d === 0 ? o.moveTo(f, y) : o.lineTo(f, y);
|
|
648
|
-
}), o.closePath(), o.fill(), this.polygonCount++, this.canvasCache.set(n,
|
|
661
|
+
}), o.closePath(), o.fill(), this.polygonCount++, this.canvasCache.set(n, t), t;
|
|
649
662
|
}, i.generatePolygonGeometry = function(e, n) {
|
|
650
|
-
for (var
|
|
663
|
+
for (var t = new r.BufferGeometry(), o = e.slice(0, -1), l = o.map(function(g) {
|
|
651
664
|
return [g[0], 0, g[1]];
|
|
652
665
|
}), m = o.map(function(g) {
|
|
653
666
|
return [g[0], n, g[1]];
|
|
654
|
-
}), v =
|
|
655
|
-
|
|
656
|
-
for (var a = 1; a <
|
|
657
|
-
|
|
658
|
-
for (var a = 0; a <
|
|
659
|
-
|
|
660
|
-
return
|
|
667
|
+
}), v = I(I([], l, !0), m, !0), u = o.length, p = [], a = 1; a < u - 1; a++)
|
|
668
|
+
p.push(0, a, a + 1);
|
|
669
|
+
for (var a = 1; a < u - 1; a++)
|
|
670
|
+
p.push(u, u + a, u + a + 1);
|
|
671
|
+
for (var a = 0; a < u - 1; a++)
|
|
672
|
+
p.push(a, a + 1, u + a), p.push(a + 1, a + 1 + u, u + a);
|
|
673
|
+
return t.setAttribute("position", new r.Float32BufferAttribute(v.flat(), 3)), t.setIndex(p), t.computeVertexNormals(), t;
|
|
661
674
|
}, i.prototype.generatePolygonTexture = function(e) {
|
|
662
675
|
var n = this.canvas.getContext("2d", {
|
|
663
676
|
willReadFrequently: !0
|
|
664
677
|
});
|
|
665
678
|
if (!n)
|
|
666
679
|
throw new Error("Failed to get canvas context");
|
|
667
|
-
for (var
|
|
680
|
+
for (var t = n.createImageData(this.canvas.width, this.canvas.height), o = 0; o < this.canvas.width; o++)
|
|
668
681
|
for (var l = 0; l < this.canvas.height; l++) {
|
|
669
|
-
for (var m = 0, v = 0,
|
|
670
|
-
var a = e[
|
|
682
|
+
for (var m = 0, v = 0, u = 0, p = 0; p < e.length; p++) {
|
|
683
|
+
var a = e[p].getContext("2d", { willReadFrequently: !0 });
|
|
671
684
|
if (!a)
|
|
672
685
|
throw new Error("Failed to get canvas context");
|
|
673
686
|
var g = a.getImageData(o, l, 1, 1).data;
|
|
674
687
|
if (g[3] === 255) {
|
|
675
|
-
var h =
|
|
676
|
-
c === 0 ? m = m | 1 << h : c === 1 ? v = v | 1 << h : c === 2 && (
|
|
688
|
+
var h = p % 8, c = Math.floor(p / 8);
|
|
689
|
+
c === 0 ? m = m | 1 << h : c === 1 ? v = v | 1 << h : c === 2 && (u = u | 1 << h);
|
|
677
690
|
}
|
|
678
691
|
}
|
|
679
692
|
var x = (o + l * this.canvas.width) * 4;
|
|
680
|
-
|
|
693
|
+
t.data[x] = m, t.data[x + 1] = v, t.data[x + 2] = u, t.data[x + 3] = 255;
|
|
681
694
|
}
|
|
682
|
-
return n.putImageData(
|
|
695
|
+
return n.putImageData(t, 0, 0), new r.CanvasTexture(this.canvas);
|
|
683
696
|
}, i;
|
|
684
697
|
}()
|
|
685
|
-
),
|
|
698
|
+
), U = new q(), en = (
|
|
686
699
|
/** @class */
|
|
687
700
|
function(i) {
|
|
688
701
|
S(e, i);
|
|
@@ -690,12 +703,12 @@ vPointSize = gl_PointSize;
|
|
|
690
703
|
var n = i.call(this, {
|
|
691
704
|
type: ["basic", "phong", "pointcloud"],
|
|
692
705
|
fragment: {
|
|
693
|
-
mainBefore:
|
|
694
|
-
mainEnd:
|
|
706
|
+
mainBefore: j,
|
|
707
|
+
mainEnd: $
|
|
695
708
|
},
|
|
696
709
|
uniforms: {
|
|
697
|
-
polygonClippers: new
|
|
698
|
-
polygonTexture: new
|
|
710
|
+
polygonClippers: new r.Uniform([]),
|
|
711
|
+
polygonTexture: new r.Uniform(null)
|
|
699
712
|
}
|
|
700
713
|
}) || this;
|
|
701
714
|
return n._polygonClippers = [], n._radio = 512, n;
|
|
@@ -706,14 +719,14 @@ vPointSize = gl_PointSize;
|
|
|
706
719
|
},
|
|
707
720
|
set: function(n) {
|
|
708
721
|
this._polygonClippers = n;
|
|
709
|
-
var
|
|
710
|
-
|
|
711
|
-
var a = new
|
|
722
|
+
var t = this.uniforms;
|
|
723
|
+
t.polygonClippers.value = n.map(function(p) {
|
|
724
|
+
var a = new r.Matrix4().getInverse(p.polygonTransform), g = p.polygonHeight, h = p.cutOutSide, c = p.polygon, x = c[0][0], s = c[0][0], d = c[0][1], f = c[0][1];
|
|
712
725
|
c.forEach(function(_) {
|
|
713
726
|
var P = _[0], w = _[1];
|
|
714
727
|
x = Math.min(x, P), s = Math.max(s, P), d = Math.min(d, w), f = Math.max(f, w);
|
|
715
728
|
});
|
|
716
|
-
var y = new
|
|
729
|
+
var y = new r.Vector2(x, d), E = s - x >= f - d ? s - x : f - d;
|
|
717
730
|
return {
|
|
718
731
|
polygonTransformInverse: a,
|
|
719
732
|
polygonHeight: g,
|
|
@@ -723,20 +736,20 @@ vPointSize = gl_PointSize;
|
|
|
723
736
|
};
|
|
724
737
|
});
|
|
725
738
|
for (var o = [], l = 0; l < n.length; l++) {
|
|
726
|
-
var m = n[l].polygon, v =
|
|
739
|
+
var m = n[l].polygon, v = U.generatePolygonCanvas(m);
|
|
727
740
|
o.push(v);
|
|
728
741
|
}
|
|
729
|
-
var
|
|
730
|
-
this.uniforms.polygonTexture.value =
|
|
742
|
+
var u = U.generatePolygonTexture(o);
|
|
743
|
+
this.uniforms.polygonTexture.value = u;
|
|
731
744
|
},
|
|
732
745
|
enumerable: !1,
|
|
733
746
|
configurable: !0
|
|
734
|
-
}), e.prototype.onBeforeCompile = function(n,
|
|
747
|
+
}), e.prototype.onBeforeCompile = function(n, t) {
|
|
735
748
|
var o = String(this.polygonClippers.length);
|
|
736
749
|
n.vertexShader = n.vertexShader.replace(/NUM_POLYGON_CLIPPER/g, o), n.fragmentShader = n.fragmentShader.replace(/NUM_POLYGON_CLIPPER/g, o);
|
|
737
750
|
}, e;
|
|
738
751
|
}(C)
|
|
739
|
-
),
|
|
752
|
+
), Y = `
|
|
740
753
|
#if NUM_SHINE_OBJECTS > 0
|
|
741
754
|
uniform float shineProgress;
|
|
742
755
|
struct SHINE_OBJECT {
|
|
@@ -745,7 +758,7 @@ vPointSize = gl_PointSize;
|
|
|
745
758
|
};
|
|
746
759
|
uniform SHINE_OBJECT shineBoxes[NUM_SHINE_OBJECTS];
|
|
747
760
|
#endif
|
|
748
|
-
`,
|
|
761
|
+
`, K = `
|
|
749
762
|
#if NUM_SHINE_OBJECTS > 0
|
|
750
763
|
#pragma unroll_loop_start
|
|
751
764
|
for ( int i = 0; i < NUM_SHINE_OBJECTS; i ++ ) {
|
|
@@ -761,7 +774,7 @@ vPointSize = gl_PointSize;
|
|
|
761
774
|
}
|
|
762
775
|
#pragma unroll_loop_end
|
|
763
776
|
#endif
|
|
764
|
-
`,
|
|
777
|
+
`, k = "", on = (
|
|
765
778
|
/** @class */
|
|
766
779
|
function(i) {
|
|
767
780
|
S(e, i);
|
|
@@ -769,13 +782,13 @@ vPointSize = gl_PointSize;
|
|
|
769
782
|
var n = i.call(this, {
|
|
770
783
|
type: ["basic", "phong", "none"],
|
|
771
784
|
fragment: {
|
|
772
|
-
mainBefore:
|
|
773
|
-
mainStart:
|
|
774
|
-
mainEnd:
|
|
785
|
+
mainBefore: Y,
|
|
786
|
+
mainStart: k,
|
|
787
|
+
mainEnd: K
|
|
775
788
|
},
|
|
776
789
|
uniforms: {
|
|
777
|
-
shineProgress: new
|
|
778
|
-
shineBoxes: new
|
|
790
|
+
shineProgress: new r.Uniform(0),
|
|
791
|
+
shineBoxes: new r.Uniform([])
|
|
779
792
|
},
|
|
780
793
|
defines: {
|
|
781
794
|
NUM_SHINE_OBJECTS: 0
|
|
@@ -786,24 +799,24 @@ vPointSize = gl_PointSize;
|
|
|
786
799
|
get: function() {
|
|
787
800
|
return this.uniforms.shineBoxes.value;
|
|
788
801
|
},
|
|
789
|
-
set: function(
|
|
790
|
-
var o =
|
|
791
|
-
o > 0 && (this.defines.NUM_SHINE_OBJECTS = o, this.uniforms.shineBoxes.value =
|
|
802
|
+
set: function(t) {
|
|
803
|
+
var o = t.length;
|
|
804
|
+
o > 0 && (this.defines.NUM_SHINE_OBJECTS = o, this.uniforms.shineBoxes.value = t);
|
|
792
805
|
}
|
|
793
806
|
}
|
|
794
807
|
}), n.shineBoxes = [], n;
|
|
795
808
|
}
|
|
796
|
-
return e.prototype.onBeforeCompile = function(n,
|
|
809
|
+
return e.prototype.onBeforeCompile = function(n, t) {
|
|
797
810
|
var o = String(this.shineBoxes.length);
|
|
798
811
|
n.vertexShader = n.vertexShader.replace(/NUM_SHINE_OBJECTS/g, o), n.fragmentShader = n.fragmentShader.replace(/NUM_SHINE_OBJECTS/g, o);
|
|
799
812
|
}, e;
|
|
800
813
|
}(C)
|
|
801
814
|
);
|
|
802
815
|
export {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
816
|
+
Z as EvenessPlaneShader,
|
|
817
|
+
nn as PointCloudExpandShader,
|
|
818
|
+
en as PolygonCuterShader,
|
|
819
|
+
q as PolygonGenerater,
|
|
820
|
+
on as ShineModelShader,
|
|
821
|
+
X as SweepModelShader
|
|
809
822
|
};
|
package/sticker/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version: 6.4.
|
|
4
|
+
* Generated: 6/20/2025
|
|
5
|
+
* Version: 6.4.2
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,4 +252,4 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("three");function w(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const a=w(g);var m=function(t,n){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])},m(t,n)};function h(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");m(t,n);function e(){this.constructor=t}t.prototype=n===null?Object.create(n):(e.prototype=n.prototype,new e)}var E=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),T=new Float32Array([0,0,1,0,0,1,1,1]),_=new Uint8Array([0,1,2,1,3,2]),d=new a.BufferGeometry;d.setAttribute("position",new a.BufferAttribute(E,3));d.setAttribute("uv",new a.BufferAttribute(T,2));d.setIndex(new a.BufferAttribute(_,1));var u=window,y=u.requestAnimationFrame||u.mozRequestAnimationFrame||u.webkitRequestAnimationFrame||u.msRequestAnimationFrame||function(t){return setTimeout(t,16)},R=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),l=typeof performance!="undefined"?function(){return R+performance.now()}:function(){return Date.now()};function S(t,n){t.naturalWidth>0&&y(function(){return n()});var e=function(){return n()};return t.addEventListener("load",e,!1),function(){return t.removeEventListener("load",e,!1)}}function A(t,n){var e=l(),i=!1,r=function(){i=!0,n();var s=l();s-e<3e3?y(r):i=!1},o=function(){e=l(),i===!1&&r()};return t.addEventListener("timeupdate",o,!1),function(){t.removeEventListener("timeupdate",o,!1),i=!1}}function v(t,n){var e=t.dispose;t.dispose=function(){n(),e.call(t)}}var b=function(t){h(n,t);function n(e,i,r){var o=this,s=new a.MeshBasicMaterial;if(o=t.call(this,d,s)||this,o._needsRender=!1,o.scale.set(e,i,1),typeof r=="string"){s.transparent=/\.png$/.test(r);var c=new Image;c.src=r,c.crossOrigin="",r=c}if(r instanceof HTMLImageElement){var f=s.map=new a.Texture;f.wrapS=a.ClampToEdgeWrapping,f.wrapT=a.ClampToEdgeWrapping,f.minFilter=a.LinearFilter,f.encoding=a.sRGBEncoding,v(f,S(r,function(){f.image=r,f.needsUpdate=!0,o._needsRender=!0}))}else if(r instanceof HTMLCanvasElement)s.map=new a.CanvasTexture(r);else if(r instanceof HTMLVideoElement){var p=s.map=new a.VideoTexture(r);p.wrapS=a.ClampToEdgeWrapping,p.wrapT=a.ClampToEdgeWrapping,p.minFilter=a.LinearFilter,p.encoding=a.sRGBEncoding,v(p,A(r,function(){o._needsRender=!0}))}return o}return Object.defineProperty(n,"version",{get:function(){return"6.4.
|
|
255
|
+
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("three");function w(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const a=w(g);var m=function(t,n){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])},m(t,n)};function h(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");m(t,n);function e(){this.constructor=t}t.prototype=n===null?Object.create(n):(e.prototype=n.prototype,new e)}var E=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),T=new Float32Array([0,0,1,0,0,1,1,1]),_=new Uint8Array([0,1,2,1,3,2]),d=new a.BufferGeometry;d.setAttribute("position",new a.BufferAttribute(E,3));d.setAttribute("uv",new a.BufferAttribute(T,2));d.setIndex(new a.BufferAttribute(_,1));var u=window,y=u.requestAnimationFrame||u.mozRequestAnimationFrame||u.webkitRequestAnimationFrame||u.msRequestAnimationFrame||function(t){return setTimeout(t,16)},R=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),l=typeof performance!="undefined"?function(){return R+performance.now()}:function(){return Date.now()};function S(t,n){t.naturalWidth>0&&y(function(){return n()});var e=function(){return n()};return t.addEventListener("load",e,!1),function(){return t.removeEventListener("load",e,!1)}}function A(t,n){var e=l(),i=!1,r=function(){i=!0,n();var s=l();s-e<3e3?y(r):i=!1},o=function(){e=l(),i===!1&&r()};return t.addEventListener("timeupdate",o,!1),function(){t.removeEventListener("timeupdate",o,!1),i=!1}}function v(t,n){var e=t.dispose;t.dispose=function(){n(),e.call(t)}}var b=function(t){h(n,t);function n(e,i,r){var o=this,s=new a.MeshBasicMaterial;if(o=t.call(this,d,s)||this,o._needsRender=!1,o.scale.set(e,i,1),typeof r=="string"){s.transparent=/\.png$/.test(r);var c=new Image;c.src=r,c.crossOrigin="",r=c}if(r instanceof HTMLImageElement){var f=s.map=new a.Texture;f.wrapS=a.ClampToEdgeWrapping,f.wrapT=a.ClampToEdgeWrapping,f.minFilter=a.LinearFilter,f.encoding=a.sRGBEncoding,v(f,S(r,function(){f.image=r,f.needsUpdate=!0,o._needsRender=!0}))}else if(r instanceof HTMLCanvasElement)s.map=new a.CanvasTexture(r);else if(r instanceof HTMLVideoElement){var p=s.map=new a.VideoTexture(r);p.wrapS=a.ClampToEdgeWrapping,p.wrapT=a.ClampToEdgeWrapping,p.minFilter=a.LinearFilter,p.encoding=a.sRGBEncoding,v(p,A(r,function(){o._needsRender=!0}))}return o}return Object.defineProperty(n,"version",{get:function(){return"6.4.2"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"needsRender",{get:function(){return this._needsRender},set:function(e){this._needsRender=e,e===!0&&this.material.map&&(this.material.map.needsUpdate=!0)},enumerable:!1,configurable:!0}),n.prototype.setSize=function(e,i){this.scale.set(e,i,1),this._needsRender=!0},n.prototype.setTransparent=function(e){this.material.transparent=e,this._needsRender=!0},n.prototype.locationWithIntersection=function(e,i){i===void 0&&(i=.005);var r=e.point,o=e.face;this.position.copy(r),o&&(this.position.add(o.normal.clone().setLength(i)),this.lookAt(r.clone().add(o.normal))),this._needsRender=!0},n.prototype.dispose=function(){var e;(e=this.material.map)===null||e===void 0||e.dispose(),this.material.dispose()},n}(a.Mesh);exports.Sticker=b;
|
package/sticker/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version: 6.4.
|
|
4
|
+
* Generated: 6/20/2025
|
|
5
|
+
* Version: 6.4.2
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -366,7 +366,7 @@ var A = (
|
|
|
366
366
|
}
|
|
367
367
|
return Object.defineProperty(n, "version", {
|
|
368
368
|
get: function() {
|
|
369
|
-
return "6.4.
|
|
369
|
+
return "6.4.2";
|
|
370
370
|
},
|
|
371
371
|
enumerable: !1,
|
|
372
372
|
configurable: !0
|