@realsee/five 6.4.1 → 6.4.3
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 +67 -32
- package/shader-lib/index.mjs +179 -144
- 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 +67 -32
- 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.js +2 -2
- package/work-downloader/index.mjs +2 -2
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/24/2025
|
|
5
|
+
* Version: 6.4.3
|
|
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 b(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 U = `
|
|
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 = "", V = {
|
|
310
310
|
type: ["pointcloud"],
|
|
311
311
|
fragment: {
|
|
312
|
-
mainBefore:
|
|
313
|
-
mainStart:
|
|
314
|
-
mainEnd:
|
|
312
|
+
mainBefore: U,
|
|
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, V) || 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, f = v.clone().add(c.clone().negate().multiplyScalar(s)), d = 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(d, E, P), N = new r.Plane().setFromCoplanarPoints(_, y, f), M = new r.Plane().setFromCoplanarPoints(E, d, f), O = new r.Plane().setFromCoplanarPoints(w, F, P), T = new r.Plane().setFromCoplanarPoints(P, E, y), D = new r.Plane().setFromCoplanarPoints(f, d, 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
349
|
{ normal: T.normal, constant: T.constant },
|
|
349
|
-
{ normal:
|
|
350
|
-
{ normal: I.normal, constant: I.constant }
|
|
350
|
+
{ normal: D.normal, constant: D.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
|
+
), W = `
|
|
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
|
+
`, H = `
|
|
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
|
+
`, R = "", 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: W,
|
|
418
|
+
mainStart: R,
|
|
419
|
+
mainEnd: H
|
|
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];
|
|
@@ -588,12 +601,23 @@ vPointSize = gl_PointSize;
|
|
|
588
601
|
vec2 uv = vec2(normalizedPos.x, 1.0 - normalizedPos.y);
|
|
589
602
|
vec4 color = texture2D(polygonTexture, uv);
|
|
590
603
|
int channel = i / 8;
|
|
591
|
-
|
|
592
|
-
float
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
604
|
+
float bit = (float(i) / 8.0 - floor(float(i) / 8.0)) * 8.0;
|
|
605
|
+
float power = pow(2.0, bit);
|
|
606
|
+
|
|
607
|
+
float channelValue;
|
|
608
|
+
if(i < 8) { // 使用r通道
|
|
609
|
+
channelValue = color.r * 255.0;
|
|
610
|
+
} else if(i < 16) { // 使用g通道
|
|
611
|
+
channelValue = color.g * 255.0;
|
|
612
|
+
} else if(i < 24) { // 使用b通道
|
|
613
|
+
channelValue = color.b * 255.0;
|
|
614
|
+
} else { // 使用a通道
|
|
615
|
+
channelValue = color.a * 255.0;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
float masked = floor(channelValue / power + 0.001);
|
|
619
|
+
if(mod(masked, 2.0) < 0.5) {
|
|
620
|
+
discard;
|
|
597
621
|
}
|
|
598
622
|
}
|
|
599
623
|
}else{
|
|
@@ -601,21 +625,32 @@ vPointSize = gl_PointSize;
|
|
|
601
625
|
vec2 uv = vec2(normalizedPos.x, 1.0 - normalizedPos.y);
|
|
602
626
|
vec4 color = texture2D(polygonTexture, uv);
|
|
603
627
|
int channel = i / 8;
|
|
604
|
-
|
|
605
|
-
float
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
628
|
+
|
|
629
|
+
float bit = (float(i) / 8.0 - floor(float(i) / 8.0)) * 8.0;
|
|
630
|
+
float power = pow(2.0, bit);
|
|
631
|
+
float channelValue;
|
|
632
|
+
if(i < 8) { // 使用r通道
|
|
633
|
+
channelValue = color.r * 255.0;
|
|
634
|
+
} else if(i < 16) { // 使用g通道
|
|
635
|
+
channelValue = color.g * 255.0;
|
|
636
|
+
} else if(i < 24) { // 使用b通道
|
|
637
|
+
channelValue = color.b * 255.0;
|
|
638
|
+
} else { // 使用a通道
|
|
639
|
+
channelValue = color.a * 255.0;
|
|
640
|
+
}
|
|
641
|
+
float masked = floor(channelValue / power + 0.001);
|
|
642
|
+
if(mod(masked, 2.0) > 0.0) {
|
|
643
|
+
discard;
|
|
609
644
|
}
|
|
610
645
|
}
|
|
611
646
|
}
|
|
612
647
|
}
|
|
613
648
|
|
|
614
|
-
`,
|
|
649
|
+
`, q = (
|
|
615
650
|
/** @class */
|
|
616
651
|
function() {
|
|
617
652
|
function i() {
|
|
618
|
-
this.canvasCache = /* @__PURE__ */ new Map(), this.canvas = document.createElement("canvas"), this.canvas.width = 512, this.canvas.height = 512, this.polygonTexture = new
|
|
653
|
+
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
654
|
}
|
|
620
655
|
return i.prototype.setSize = function(e) {
|
|
621
656
|
this.canvas.width = e, this.canvas.height = e;
|
|
@@ -623,66 +658,66 @@ vPointSize = gl_PointSize;
|
|
|
623
658
|
var n = JSON.stringify(e);
|
|
624
659
|
if (this.canvasCache.has(n))
|
|
625
660
|
return this.canvasCache.get(n);
|
|
626
|
-
var
|
|
627
|
-
|
|
628
|
-
var o =
|
|
661
|
+
var t = document.createElement("canvas");
|
|
662
|
+
t.width = this.canvas.width, t.height = this.canvas.height;
|
|
663
|
+
var o = t.getContext("2d");
|
|
629
664
|
if (!o)
|
|
630
665
|
throw new Error("Failed to get canvas context");
|
|
631
666
|
if (this.polygonCount >= 24)
|
|
632
667
|
throw new Error("polygon count exceed 24, please clear the canvas");
|
|
633
668
|
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],
|
|
669
|
+
var l = e[0][0], m = e[0][0], v = e[0][1], u = e[0][1];
|
|
635
670
|
e.forEach(function(s) {
|
|
636
|
-
var
|
|
637
|
-
l = Math.min(l,
|
|
671
|
+
var f = s[0], d = s[1];
|
|
672
|
+
l = Math.min(l, f), m = Math.max(m, f), v = Math.min(v, d), u = Math.max(u, d);
|
|
638
673
|
});
|
|
639
|
-
var
|
|
640
|
-
var
|
|
641
|
-
return [
|
|
674
|
+
var p = m - l, a = u - v, g = this.canvas.width, h = p >= a ? g / p : g / a, c = e.map(function(s) {
|
|
675
|
+
var f = s[0] - l, d = s[1] - v;
|
|
676
|
+
return [f, d];
|
|
642
677
|
}), x = c.map(function(s) {
|
|
643
678
|
return [s[0] * h, s[1] * h];
|
|
644
679
|
});
|
|
645
|
-
return x.forEach(function(s,
|
|
646
|
-
var
|
|
647
|
-
|
|
648
|
-
}), o.closePath(), o.fill(), this.polygonCount++, this.canvasCache.set(n,
|
|
680
|
+
return x.forEach(function(s, f) {
|
|
681
|
+
var d = s[0], y = s[1];
|
|
682
|
+
f === 0 ? o.moveTo(d, y) : o.lineTo(d, y);
|
|
683
|
+
}), o.closePath(), o.fill(), this.polygonCount++, this.canvasCache.set(n, t), t;
|
|
649
684
|
}, i.generatePolygonGeometry = function(e, n) {
|
|
650
|
-
for (var
|
|
685
|
+
for (var t = new r.BufferGeometry(), o = e.slice(0, -1), l = o.map(function(g) {
|
|
651
686
|
return [g[0], 0, g[1]];
|
|
652
687
|
}), m = o.map(function(g) {
|
|
653
688
|
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
|
|
689
|
+
}), v = b(b([], l, !0), m, !0), u = o.length, p = [], a = 1; a < u - 1; a++)
|
|
690
|
+
p.push(0, a, a + 1);
|
|
691
|
+
for (var a = 1; a < u - 1; a++)
|
|
692
|
+
p.push(u, u + a, u + a + 1);
|
|
693
|
+
for (var a = 0; a < u - 1; a++)
|
|
694
|
+
p.push(a, a + 1, u + a), p.push(a + 1, a + 1 + u, u + a);
|
|
695
|
+
return t.setAttribute("position", new r.Float32BufferAttribute(v.flat(), 3)), t.setIndex(p), t.computeVertexNormals(), t;
|
|
661
696
|
}, i.prototype.generatePolygonTexture = function(e) {
|
|
662
697
|
var n = this.canvas.getContext("2d", {
|
|
663
698
|
willReadFrequently: !0
|
|
664
699
|
});
|
|
665
700
|
if (!n)
|
|
666
701
|
throw new Error("Failed to get canvas context");
|
|
667
|
-
for (var
|
|
702
|
+
for (var t = n.createImageData(this.canvas.width, this.canvas.height), o = 0; o < this.canvas.width; o++)
|
|
668
703
|
for (var l = 0; l < this.canvas.height; l++) {
|
|
669
|
-
for (var m = 0, v = 0,
|
|
670
|
-
var a = e[
|
|
704
|
+
for (var m = 0, v = 0, u = 0, p = 0; p < e.length; p++) {
|
|
705
|
+
var a = e[p].getContext("2d", { willReadFrequently: !0 });
|
|
671
706
|
if (!a)
|
|
672
707
|
throw new Error("Failed to get canvas context");
|
|
673
708
|
var g = a.getImageData(o, l, 1, 1).data;
|
|
674
709
|
if (g[3] === 255) {
|
|
675
|
-
var h =
|
|
676
|
-
c === 0 ? m = m | 1 << h : c === 1 ? v = v | 1 << h : c === 2 && (
|
|
710
|
+
var h = p % 8, c = Math.floor(p / 8);
|
|
711
|
+
c === 0 ? m = m | 1 << h : c === 1 ? v = v | 1 << h : c === 2 && (u = u | 1 << h);
|
|
677
712
|
}
|
|
678
713
|
}
|
|
679
714
|
var x = (o + l * this.canvas.width) * 4;
|
|
680
|
-
|
|
715
|
+
t.data[x] = m, t.data[x + 1] = v, t.data[x + 2] = u, t.data[x + 3] = 255;
|
|
681
716
|
}
|
|
682
|
-
return n.putImageData(
|
|
717
|
+
return n.putImageData(t, 0, 0), new r.CanvasTexture(this.canvas);
|
|
683
718
|
}, i;
|
|
684
719
|
}()
|
|
685
|
-
),
|
|
720
|
+
), I = new q(), en = (
|
|
686
721
|
/** @class */
|
|
687
722
|
function(i) {
|
|
688
723
|
S(e, i);
|
|
@@ -690,12 +725,12 @@ vPointSize = gl_PointSize;
|
|
|
690
725
|
var n = i.call(this, {
|
|
691
726
|
type: ["basic", "phong", "pointcloud"],
|
|
692
727
|
fragment: {
|
|
693
|
-
mainBefore:
|
|
694
|
-
mainEnd:
|
|
728
|
+
mainBefore: j,
|
|
729
|
+
mainEnd: $
|
|
695
730
|
},
|
|
696
731
|
uniforms: {
|
|
697
|
-
polygonClippers: new
|
|
698
|
-
polygonTexture: new
|
|
732
|
+
polygonClippers: new r.Uniform([]),
|
|
733
|
+
polygonTexture: new r.Uniform(null)
|
|
699
734
|
}
|
|
700
735
|
}) || this;
|
|
701
736
|
return n._polygonClippers = [], n._radio = 512, n;
|
|
@@ -706,14 +741,14 @@ vPointSize = gl_PointSize;
|
|
|
706
741
|
},
|
|
707
742
|
set: function(n) {
|
|
708
743
|
this._polygonClippers = n;
|
|
709
|
-
var
|
|
710
|
-
|
|
711
|
-
var a = new
|
|
744
|
+
var t = this.uniforms;
|
|
745
|
+
t.polygonClippers.value = n.map(function(p) {
|
|
746
|
+
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], f = c[0][1], d = c[0][1];
|
|
712
747
|
c.forEach(function(_) {
|
|
713
748
|
var P = _[0], w = _[1];
|
|
714
|
-
x = Math.min(x, P), s = Math.max(s, P),
|
|
749
|
+
x = Math.min(x, P), s = Math.max(s, P), f = Math.min(f, w), d = Math.max(d, w);
|
|
715
750
|
});
|
|
716
|
-
var y = new
|
|
751
|
+
var y = new r.Vector2(x, f), E = s - x >= d - f ? s - x : d - f;
|
|
717
752
|
return {
|
|
718
753
|
polygonTransformInverse: a,
|
|
719
754
|
polygonHeight: g,
|
|
@@ -723,20 +758,20 @@ vPointSize = gl_PointSize;
|
|
|
723
758
|
};
|
|
724
759
|
});
|
|
725
760
|
for (var o = [], l = 0; l < n.length; l++) {
|
|
726
|
-
var m = n[l].polygon, v =
|
|
761
|
+
var m = n[l].polygon, v = I.generatePolygonCanvas(m);
|
|
727
762
|
o.push(v);
|
|
728
763
|
}
|
|
729
|
-
var
|
|
730
|
-
this.uniforms.polygonTexture.value =
|
|
764
|
+
var u = I.generatePolygonTexture(o);
|
|
765
|
+
this.uniforms.polygonTexture.value = u;
|
|
731
766
|
},
|
|
732
767
|
enumerable: !1,
|
|
733
768
|
configurable: !0
|
|
734
|
-
}), e.prototype.onBeforeCompile = function(n,
|
|
769
|
+
}), e.prototype.onBeforeCompile = function(n, t) {
|
|
735
770
|
var o = String(this.polygonClippers.length);
|
|
736
771
|
n.vertexShader = n.vertexShader.replace(/NUM_POLYGON_CLIPPER/g, o), n.fragmentShader = n.fragmentShader.replace(/NUM_POLYGON_CLIPPER/g, o);
|
|
737
772
|
}, e;
|
|
738
773
|
}(C)
|
|
739
|
-
),
|
|
774
|
+
), k = `
|
|
740
775
|
#if NUM_SHINE_OBJECTS > 0
|
|
741
776
|
uniform float shineProgress;
|
|
742
777
|
struct SHINE_OBJECT {
|
|
@@ -745,7 +780,7 @@ vPointSize = gl_PointSize;
|
|
|
745
780
|
};
|
|
746
781
|
uniform SHINE_OBJECT shineBoxes[NUM_SHINE_OBJECTS];
|
|
747
782
|
#endif
|
|
748
|
-
`,
|
|
783
|
+
`, Y = `
|
|
749
784
|
#if NUM_SHINE_OBJECTS > 0
|
|
750
785
|
#pragma unroll_loop_start
|
|
751
786
|
for ( int i = 0; i < NUM_SHINE_OBJECTS; i ++ ) {
|
|
@@ -761,7 +796,7 @@ vPointSize = gl_PointSize;
|
|
|
761
796
|
}
|
|
762
797
|
#pragma unroll_loop_end
|
|
763
798
|
#endif
|
|
764
|
-
`,
|
|
799
|
+
`, K = "", on = (
|
|
765
800
|
/** @class */
|
|
766
801
|
function(i) {
|
|
767
802
|
S(e, i);
|
|
@@ -769,13 +804,13 @@ vPointSize = gl_PointSize;
|
|
|
769
804
|
var n = i.call(this, {
|
|
770
805
|
type: ["basic", "phong", "none"],
|
|
771
806
|
fragment: {
|
|
772
|
-
mainBefore:
|
|
773
|
-
mainStart:
|
|
774
|
-
mainEnd:
|
|
807
|
+
mainBefore: k,
|
|
808
|
+
mainStart: K,
|
|
809
|
+
mainEnd: Y
|
|
775
810
|
},
|
|
776
811
|
uniforms: {
|
|
777
|
-
shineProgress: new
|
|
778
|
-
shineBoxes: new
|
|
812
|
+
shineProgress: new r.Uniform(0),
|
|
813
|
+
shineBoxes: new r.Uniform([])
|
|
779
814
|
},
|
|
780
815
|
defines: {
|
|
781
816
|
NUM_SHINE_OBJECTS: 0
|
|
@@ -786,24 +821,24 @@ vPointSize = gl_PointSize;
|
|
|
786
821
|
get: function() {
|
|
787
822
|
return this.uniforms.shineBoxes.value;
|
|
788
823
|
},
|
|
789
|
-
set: function(
|
|
790
|
-
var o =
|
|
791
|
-
o > 0 && (this.defines.NUM_SHINE_OBJECTS = o, this.uniforms.shineBoxes.value =
|
|
824
|
+
set: function(t) {
|
|
825
|
+
var o = t.length;
|
|
826
|
+
o > 0 && (this.defines.NUM_SHINE_OBJECTS = o, this.uniforms.shineBoxes.value = t);
|
|
792
827
|
}
|
|
793
828
|
}
|
|
794
829
|
}), n.shineBoxes = [], n;
|
|
795
830
|
}
|
|
796
|
-
return e.prototype.onBeforeCompile = function(n,
|
|
831
|
+
return e.prototype.onBeforeCompile = function(n, t) {
|
|
797
832
|
var o = String(this.shineBoxes.length);
|
|
798
833
|
n.vertexShader = n.vertexShader.replace(/NUM_SHINE_OBJECTS/g, o), n.fragmentShader = n.fragmentShader.replace(/NUM_SHINE_OBJECTS/g, o);
|
|
799
834
|
}, e;
|
|
800
835
|
}(C)
|
|
801
836
|
);
|
|
802
837
|
export {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
838
|
+
Z as EvenessPlaneShader,
|
|
839
|
+
nn as PointCloudExpandShader,
|
|
840
|
+
en as PolygonCuterShader,
|
|
841
|
+
q as PolygonGenerater,
|
|
842
|
+
on as ShineModelShader,
|
|
843
|
+
X as SweepModelShader
|
|
809
844
|
};
|
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/24/2025
|
|
5
|
+
* Version: 6.4.3
|
|
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.3"},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/24/2025
|
|
5
|
+
* Version: 6.4.3
|
|
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.3";
|
|
370
370
|
},
|
|
371
371
|
enumerable: !1,
|
|
372
372
|
configurable: !0
|