@realsee/five 6.4.0-alpha.30 → 6.4.0-alpha.32

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.
Files changed (81) hide show
  1. package/docs/assets/navigation.js +1 -1
  2. package/docs/assets/search.js +1 -1
  3. package/docs/classes/five.Camera.html +6 -5
  4. package/docs/classes/five.CustomShader.html +1 -1
  5. package/docs/classes/five.Draco.html +13 -0
  6. package/docs/classes/five.Five.html +20 -20
  7. package/docs/classes/five.KTX2.html +10 -0
  8. package/docs/classes/five.Model.html +24 -24
  9. package/docs/classes/five.ModelViewLayer.html +6 -6
  10. package/docs/classes/five.PBMMesh.html +1 -1
  11. package/docs/classes/five.PBMMeshMaterial.html +51 -37
  12. package/docs/classes/five.PBMPointCloudMaterial.html +40 -34
  13. package/docs/classes/five.TextureLoader.html +2 -2
  14. package/docs/classes/five.Tile.html +3 -2
  15. package/docs/classes/five.Tile3DModel.html +11 -4
  16. package/docs/classes/five.TileCubeTextureTarget.html +1 -1
  17. package/docs/classes/five.Tileset.html +13 -3
  18. package/docs/classes/five.Trajectory.html +2 -2
  19. package/docs/functions/five.defaultImageURLTransform.html +1 -1
  20. package/docs/functions/five.loadAt3d.html +1 -1
  21. package/docs/functions/five.loadB3dm.html +1 -1
  22. package/docs/functions/five.loadDome.html +1 -1
  23. package/docs/functions/five.loadDomez.html +1 -1
  24. package/docs/functions/five.loadFbx.html +1 -1
  25. package/docs/functions/five.loadGltf.html +1 -1
  26. package/docs/functions/five.loadPbm.html +1 -1
  27. package/docs/functions/five.loadPly.html +1 -1
  28. package/docs/functions/five.loadPnts.html +1 -1
  29. package/docs/functions/five.loadX3p.html +1 -1
  30. package/docs/functions/five.parseWork.html +1 -1
  31. package/docs/interfaces/five.CustomShaderInitArgs.html +2 -2
  32. package/docs/interfaces/five.FiveLoadOptions.html +10 -24
  33. package/docs/interfaces/five.ImageOptions.html +2 -2
  34. package/docs/interfaces/five.ImageURLMappings.html +1 -1
  35. package/docs/interfaces/five.ImageURLOptions.html +8 -8
  36. package/docs/interfaces/five.PBMParameters.html +12 -6
  37. package/docs/interfaces/five.TextureOptions.html +2 -2
  38. package/docs/interfaces/five.Tile3DModelLoaderOptions.html +3 -2
  39. package/docs/interfaces/five.Tile3dLayerOptions.html +14 -10
  40. package/docs/modules/five.html +4 -0
  41. package/docs/types/five.ModelMaterialValues.html +1 -1
  42. package/docs/types/five.Models.html +5 -5
  43. package/docs/types/five.ParsedResultType.html +1 -1
  44. package/docs/types/five.Tile3dOptions.html +1 -1
  45. package/docs/types/five.TileContentData.html +1 -1
  46. package/docs/types/five.TilesetFrameState.html +1 -1
  47. package/docs/types/five.TrajectoryContentData.html +1 -1
  48. package/docs/types/five.Works.html +1 -1
  49. package/docs/variables/five.defaultPbmParameters.html +1 -1
  50. package/docs/variables/five.draco-1.html +1 -0
  51. package/docs/variables/five.ktx2-1.html +1 -0
  52. package/five/index.d.ts +147 -44
  53. package/five/index.js +86 -86
  54. package/five/index.mjs +6325 -5913
  55. package/gltf-loader/index.js +3 -3
  56. package/gltf-loader/index.mjs +3 -3
  57. package/line/index.js +3 -3
  58. package/line/index.mjs +3 -3
  59. package/package.json +1 -1
  60. package/plugins/index.js +2 -2
  61. package/plugins/index.mjs +2 -2
  62. package/react/index.js +2 -2
  63. package/react/index.mjs +2 -2
  64. package/shader-lib/index.d.ts +32 -0
  65. package/shader-lib/index.js +71 -9
  66. package/shader-lib/index.mjs +280 -86
  67. package/sticker/index.js +3 -3
  68. package/sticker/index.mjs +3 -3
  69. package/umd/five-gltf-loader.js +3 -3
  70. package/umd/five-line.js +3 -3
  71. package/umd/five-plugins.js +2 -2
  72. package/umd/five-react.js +2 -2
  73. package/umd/five-shader-lib.js +71 -9
  74. package/umd/five-sticker.js +3 -3
  75. package/umd/five-vfx.js +2 -2
  76. package/umd/five-vue.js +2 -2
  77. package/umd/five.js +45 -45
  78. package/vfx/index.js +2 -2
  79. package/vfx/index.mjs +2 -2
  80. package/vue/index.js +2 -2
  81. package/vue/index.mjs +2 -2
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 2025/4/23
5
- * Version: 6.4.0-alpha.30
4
+ * Generated: 5/23/2025
5
+ * Version: 6.4.0-alpha.32
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -252,25 +252,30 @@
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
- */import { CustomShader as f } from "@realsee/five";
256
- import * as o from "three";
257
- var m = function(r, e) {
258
- return m = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, a) {
259
- n.__proto__ = a;
260
- } || function(n, a) {
261
- for (var t in a) Object.prototype.hasOwnProperty.call(a, t) && (n[t] = a[t]);
262
- }, m(r, e);
255
+ */import { CustomShader as _ } from "@realsee/five";
256
+ import * as a from "three";
257
+ var z = function(i, n) {
258
+ return z = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
259
+ e.__proto__ = t;
260
+ } || function(e, t) {
261
+ for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
262
+ }, z(i, n);
263
263
  };
264
- function E(r, e) {
265
- if (typeof e != "function" && e !== null)
266
- throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
267
- m(r, e);
268
- function n() {
269
- this.constructor = r;
264
+ function w(i, n) {
265
+ if (typeof n != "function" && n !== null)
266
+ throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
267
+ z(i, n);
268
+ function e() {
269
+ this.constructor = i;
270
270
  }
271
- r.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
271
+ i.prototype = n === null ? Object.create(n) : (e.prototype = n.prototype, new e());
272
272
  }
273
- var T = `
273
+ function U(i, n, e) {
274
+ if (e || arguments.length === 2) for (var t = 0, o = n.length, l; t < o; t++)
275
+ (l || !(t in n)) && (l || (l = Array.prototype.slice.call(n, 0, t)), l[t] = n[t]);
276
+ return i.concat(l || Array.prototype.slice.call(n));
277
+ }
278
+ var W = `
274
279
  #if defined(USE_PLANE_DISTANCE)
275
280
  struct Plane {
276
281
  vec3 normal;
@@ -281,7 +286,7 @@ var T = `
281
286
  uniform float evennessPlaneConstant;
282
287
  uniform float evennessPlaneDepth;
283
288
  #endif
284
- `, D = `
289
+ `, F = `
285
290
  #if defined(USE_PLANE_DISTANCE)
286
291
 
287
292
  bool inside = true;
@@ -301,29 +306,29 @@ var T = `
301
306
  }
302
307
  }
303
308
  #endif
304
- `, A = "", F = {
309
+ `, A = "", V = {
305
310
  type: ["pointcloud"],
306
311
  fragment: {
307
- mainBefore: T,
312
+ mainBefore: W,
308
313
  mainStart: A,
309
- mainEnd: D
314
+ mainEnd: F
310
315
  },
311
316
  uniforms: {
312
- evennessPlaneNormal: new o.Uniform(new o.Vector3()),
313
- evennessPlaneConstant: new o.Uniform(0),
314
- evennessPlanes: new o.Uniform([]),
315
- evennessPlaneDepth: new o.Uniform(0)
317
+ evennessPlaneNormal: new a.Uniform(new a.Vector3()),
318
+ evennessPlaneConstant: new a.Uniform(0),
319
+ evennessPlanes: new a.Uniform([]),
320
+ evennessPlaneDepth: new a.Uniform(0)
316
321
  },
317
322
  defines: {
318
323
  USE_PLANE_DISTANCE: !1
319
324
  }
320
- }, H = (
325
+ }, Q = (
321
326
  /** @class */
322
- function(r) {
323
- E(e, r);
324
- function e() {
325
- var n = r.call(this, F) || this;
326
- return Object.defineProperties(n, {
327
+ function(i) {
328
+ w(n, i);
329
+ function n() {
330
+ var e = i.call(this, V) || this;
331
+ return Object.defineProperties(e, {
327
332
  evennessPlane: {
328
333
  get: function() {
329
334
  return {
@@ -331,31 +336,31 @@ var T = `
331
336
  points: this.uniforms.evennessPoints.value
332
337
  };
333
338
  },
334
- set: function(a) {
335
- var t = a.points, _ = a.depth, g = !1;
336
- if (t.length !== 0 && t.length % 4 === 0) {
339
+ set: function(t) {
340
+ var o = t.points, l = t.depth, g = !1;
341
+ if (o.length !== 0 && o.length % 4 === 0) {
337
342
  g = !0;
338
- var l = t[0], p = t[1], d = t[2], C = t[3], b = new o.Vector3().subVectors(p, l), M = new o.Vector3().subVectors(d, l), i = new o.Vector3().crossVectors(b, M).normalize(), W = -i.dot(l), s = _, c = l.clone().add(i.clone().negate().multiplyScalar(s)), x = l.clone().add(i.clone().multiplyScalar(s)), P = p.clone().add(i.clone().negate().multiplyScalar(s)), u = p.clone().add(i.clone().multiplyScalar(s)), O = d.clone().add(i.clone().negate().multiplyScalar(s)), v = d.clone().add(i.clone().multiplyScalar(s)), U = C.clone().add(i.clone().negate().multiplyScalar(s)), y = C.clone().add(i.clone().multiplyScalar(s)), S = new o.Plane().setFromCoplanarPoints(x, u, v), h = new o.Plane().setFromCoplanarPoints(O, P, c), w = new o.Plane().setFromCoplanarPoints(u, x, c), z = new o.Plane().setFromCoplanarPoints(U, y, v), B = new o.Plane().setFromCoplanarPoints(v, u, P), N = new o.Plane().setFromCoplanarPoints(c, x, y);
343
+ var v = o[0], p = o[1], c = o[2], r = o[3], m = new a.Vector3().subVectors(p, v), y = new a.Vector3().subVectors(c, v), u = new a.Vector3().crossVectors(m, y).normalize(), x = -u.dot(v), s = l, d = v.clone().add(u.clone().negate().multiplyScalar(s)), f = v.clone().add(u.clone().multiplyScalar(s)), h = p.clone().add(u.clone().negate().multiplyScalar(s)), C = p.clone().add(u.clone().multiplyScalar(s)), E = c.clone().add(u.clone().negate().multiplyScalar(s)), P = c.clone().add(u.clone().multiplyScalar(s)), S = r.clone().add(u.clone().negate().multiplyScalar(s)), M = r.clone().add(u.clone().multiplyScalar(s)), B = new a.Plane().setFromCoplanarPoints(f, C, P), N = new a.Plane().setFromCoplanarPoints(E, h, d), O = new a.Plane().setFromCoplanarPoints(C, f, d), T = new a.Plane().setFromCoplanarPoints(S, M, P), b = new a.Plane().setFromCoplanarPoints(P, C, h), I = new a.Plane().setFromCoplanarPoints(d, f, M);
339
344
  this.uniforms.evennessPlanes.value = [
340
- { normal: S.normal, constant: S.constant },
341
- { normal: h.normal, constant: h.constant },
342
- { normal: w.normal, constant: w.constant },
343
- { normal: z.normal, constant: z.constant },
344
345
  { normal: B.normal, constant: B.constant },
345
- { normal: N.normal, constant: N.constant }
346
- ], this.uniforms.evennessPlaneDepth.value = _, this.uniforms.evennessPlaneNormal.value = i, this.uniforms.evennessPlaneConstant.value = W;
346
+ { normal: N.normal, constant: N.constant },
347
+ { normal: O.normal, constant: O.constant },
348
+ { normal: T.normal, constant: T.constant },
349
+ { normal: b.normal, constant: b.constant },
350
+ { normal: I.normal, constant: I.constant }
351
+ ], this.uniforms.evennessPlaneDepth.value = l, this.uniforms.evennessPlaneNormal.value = u, this.uniforms.evennessPlaneConstant.value = x;
347
352
  }
348
353
  this.defines.USE_PLANE_DISTANCE = g;
349
354
  }
350
355
  }
351
- }), n.evennessPlane = {
356
+ }), e.evennessPlane = {
352
357
  depth: 0,
353
358
  points: []
354
- }, n;
359
+ }, e;
355
360
  }
356
- return e;
357
- }(f)
358
- ), J = `
361
+ return n;
362
+ }(_)
363
+ ), L = `
359
364
  #if NUM_SWEEP_OBJECTS > 0
360
365
  uniform float sweepProgress;
361
366
  uniform float sweepRange;
@@ -365,7 +370,7 @@ var T = `
365
370
  };
366
371
  uniform SWEEP_OBJECT sweepBoxs[NUM_SWEEP_OBJECTS];
367
372
  #endif
368
- `, j = `
373
+ `, R = `
369
374
  #if NUM_SWEEP_OBJECTS > 0
370
375
  #pragma unroll_loop_start
371
376
  for ( int i = 0; i < NUM_SWEEP_OBJECTS; i ++ ) {
@@ -381,45 +386,45 @@ var T = `
381
386
  }
382
387
  #pragma unroll_loop_end
383
388
  #endif
384
- `, I = "", V = {
389
+ `, J = "", G = {
385
390
  type: ["basic", "phong"],
386
391
  fragment: {
387
- mainBefore: J,
388
- mainStart: I,
389
- mainEnd: j
392
+ mainBefore: L,
393
+ mainStart: J,
394
+ mainEnd: R
390
395
  },
391
396
  uniforms: {
392
- sweepProgress: new o.Uniform(0),
393
- sweepRange: new o.Uniform(0),
394
- sweepBoxs: new o.Uniform([])
397
+ sweepProgress: new a.Uniform(0),
398
+ sweepRange: new a.Uniform(0),
399
+ sweepBoxs: new a.Uniform([])
395
400
  },
396
401
  defines: {
397
402
  NUM_SWEEP_OBJECTS: 0
398
403
  }
399
- }, $ = (
404
+ }, Z = (
400
405
  /** @class */
401
- function(r) {
402
- E(e, r);
403
- function e() {
404
- var n = r.call(this, V) || this;
405
- return Object.defineProperties(n, {
406
+ function(i) {
407
+ w(n, i);
408
+ function n() {
409
+ var e = i.call(this, G) || this;
410
+ return Object.defineProperties(e, {
406
411
  sweepBoxs: {
407
412
  get: function() {
408
413
  return this.uniforms.sweepBoxs.value;
409
414
  },
410
- set: function(a) {
411
- var t = a.length;
412
- t > 0 && (this.defines.NUM_SWEEP_OBJECTS = t, this.uniforms.sweepBoxs.value = a);
415
+ set: function(t) {
416
+ var o = t.length;
417
+ o > 0 && (this.defines.NUM_SWEEP_OBJECTS = o, this.uniforms.sweepBoxs.value = t);
413
418
  }
414
419
  }
415
- }), n.sweepBoxs = [], n;
420
+ }), e.sweepBoxs = [], e;
416
421
  }
417
- return e.prototype.onBeforeCompile = function(n, a) {
418
- var t = String(this.sweepBoxs.length);
419
- n.vertexShader = n.vertexShader.replace(/NUM_SWEEP_OBJECTS/g, t), n.fragmentShader = n.fragmentShader.replace(/NUM_SWEEP_OBJECTS/g, t);
420
- }, e;
421
- }(f)
422
- ), R = `
422
+ return n.prototype.onBeforeCompile = function(e, t) {
423
+ var o = String(this.sweepBoxs.length);
424
+ e.vertexShader = e.vertexShader.replace(/NUM_SWEEP_OBJECTS/g, o), e.fragmentShader = e.fragmentShader.replace(/NUM_SWEEP_OBJECTS/g, o);
425
+ }, n;
426
+ }(_)
427
+ ), H = `
423
428
  uniform float pointCloudExpand_progress;
424
429
 
425
430
  vec4 pointCloudExpand_permute(vec4 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); }
@@ -492,7 +497,7 @@ float pointCloudExpand_gln_simplex(vec3 v) {
492
497
  m = m * m;
493
498
  return 42.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
494
499
  }
495
- `, L = `
500
+ `, j = `
496
501
  float pointCloudExpand_sizeScale = 1.0;
497
502
  float pointCloudExpand_sizeBasis = 0.0;
498
503
  vec4 pointCloudExpand_basis = vec4((modelBoundingMax + modelBoundingMin) / 2.0, 1.0);
@@ -508,34 +513,223 @@ gl_PointSize = gl_PointSize * pointCloudExpand_sizeScale + pointCloudExpand_size
508
513
  vPointSize = gl_PointSize;
509
514
  `, k = (
510
515
  /** @class */
511
- function(r) {
512
- E(e, r);
513
- function e() {
514
- return r.call(this, {
516
+ function(i) {
517
+ w(n, i);
518
+ function n() {
519
+ return i.call(this, {
515
520
  type: ["pointcloud"],
516
521
  vertex: {
517
- mainBefore: R,
518
- mainEnd: L
522
+ mainBefore: H,
523
+ mainEnd: j
519
524
  },
520
525
  uniforms: {
521
- pointCloudExpand_progress: new o.Uniform(0)
526
+ pointCloudExpand_progress: new a.Uniform(0)
522
527
  }
523
528
  }) || this;
524
529
  }
525
- return Object.defineProperty(e.prototype, "progress", {
530
+ return Object.defineProperty(n.prototype, "progress", {
526
531
  get: function() {
527
532
  return this.uniforms.pointCloudExpand_progress.value;
528
533
  },
529
- set: function(n) {
530
- this.uniforms.pointCloudExpand_progress.value = n;
534
+ set: function(e) {
535
+ this.uniforms.pointCloudExpand_progress.value = e;
536
+ },
537
+ enumerable: !1,
538
+ configurable: !0
539
+ }), n;
540
+ }(_)
541
+ ), q = `
542
+ uniform sampler2D polygonTexture;
543
+
544
+ struct PolygonClipper {
545
+ mat4 polygonTransformInverse;
546
+ float polygonHeight;
547
+ vec2 minPos;
548
+ float polygonScale;
549
+ bool cutOutSide;
550
+ };
551
+
552
+ #if NUM_POLYGON_CLIPPER > 0
553
+ uniform PolygonClipper polygonClippers[NUM_POLYGON_CLIPPER];
554
+ #endif
555
+ `, $ = `
556
+
557
+ for(int i = 0; i < NUM_POLYGON_CLIPPER; i++){
558
+ PolygonClipper polygonClipper = polygonClippers[i];
559
+ mat4 polygonTransformInverse = polygonClipper.polygonTransformInverse;
560
+ float polygonHeight = polygonClipper.polygonHeight;
561
+ vec2 minPos = polygonClipper.minPos;
562
+ float polygonScale = polygonClipper.polygonScale;
563
+ bool cutOutSide = polygonClipper.cutOutSide;
564
+
565
+ vec4 worldPosition = vWorldPosition;
566
+ vec4 positionInPolygonSpace = polygonTransformInverse * worldPosition;
567
+
568
+ vec2 normalizedPos = vec2(
569
+ (positionInPolygonSpace.x - minPos.x) / polygonScale,
570
+ (positionInPolygonSpace.z - minPos.y) / polygonScale
571
+ );
572
+
573
+ if(cutOutSide) {
574
+ if (normalizedPos.x < 0.0 || normalizedPos.x > 1.0 || normalizedPos.y < 0.0 || normalizedPos.y > 1.0 || positionInPolygonSpace.y < 0.0 || positionInPolygonSpace.y > polygonHeight) {
575
+ discard;
576
+ }else{
577
+ vec2 uv = vec2(normalizedPos.x, 1.0 - normalizedPos.y);
578
+ vec4 color = texture2D(polygonTexture, uv);
579
+ int channel = i / 8;
580
+ int bit = i % 8;
581
+ float channelValue = color[channel] * 255.0;
582
+ int intValue = int(channelValue + 0.5); // 四舍五入避免精度丢失
583
+ if ((intValue & (1 << bit)) == 0) {
584
+ //不属于该多边形
585
+ discard;
586
+ }
587
+ }
588
+ }else{
589
+ if (normalizedPos.x > 0.0 && normalizedPos.x < 1.0 && normalizedPos.y > 0.0 && normalizedPos.y < 1.0 && positionInPolygonSpace.y > 0.0 && positionInPolygonSpace.y < polygonHeight) {
590
+ vec2 uv = vec2(normalizedPos.x, 1.0 - normalizedPos.y);
591
+ vec4 color = texture2D(polygonTexture, uv);
592
+ int channel = i / 8;
593
+ int bit = i % 8;
594
+ float channelValue = color[channel] * 255.0;
595
+ int intValue = int(channelValue + 0.5);
596
+ if ((intValue & (1 << bit)) != 0) {
597
+ discard;
598
+ }
599
+ }
600
+ }
601
+ }
602
+
603
+ `, Y = (
604
+ /** @class */
605
+ function() {
606
+ function i() {
607
+ this.canvasCache = /* @__PURE__ */ new Map(), this.canvas = document.createElement("canvas"), this.canvas.width = 512, this.canvas.height = 512, this.polygonTexture = new a.CanvasTexture(this.canvas), this.polygonCount = 0;
608
+ }
609
+ return i.prototype.setSize = function(n) {
610
+ this.canvas.width = n, this.canvas.height = n;
611
+ }, i.prototype.generatePolygonCanvas = function(n) {
612
+ var e = JSON.stringify(n);
613
+ if (this.canvasCache.has(e))
614
+ return this.canvasCache.get(e);
615
+ var t = document.createElement("canvas");
616
+ t.width = this.canvas.width, t.height = this.canvas.height;
617
+ var o = t.getContext("2d");
618
+ if (!o)
619
+ throw new Error("Failed to get canvas context");
620
+ if (this.polygonCount >= 24)
621
+ throw new Error("polygon count exceed 24, please clear the canvas");
622
+ o.clearRect(0, 0, this.canvas.width, this.canvas.height), o.fillStyle = "rgba(0,0,0,1.0)", o.beginPath();
623
+ var l = n[0][0], g = n[0][0], v = n[0][1], p = n[0][1];
624
+ n.forEach(function(s) {
625
+ var d = s[0], f = s[1];
626
+ l = Math.min(l, d), g = Math.max(g, d), v = Math.min(v, f), p = Math.max(p, f);
627
+ });
628
+ var c = g - l, r = p - v, m = this.canvas.width, y = c >= r ? m / c : m / r, u = n.map(function(s) {
629
+ var d = s[0] - l, f = s[1] - v;
630
+ return [d, f];
631
+ }), x = u.map(function(s) {
632
+ return [s[0] * y, s[1] * y];
633
+ });
634
+ return x.forEach(function(s, d) {
635
+ var f = s[0], h = s[1];
636
+ d === 0 ? o.moveTo(f, h) : o.lineTo(f, h);
637
+ }), o.closePath(), o.fill(), this.polygonCount++, this.canvasCache.set(e, t), t;
638
+ }, i.generatePolygonGeometry = function(n, e) {
639
+ for (var t = new a.BufferGeometry(), o = n.slice(0, -1), l = o.map(function(m) {
640
+ return [m[0], 0, m[1]];
641
+ }), g = o.map(function(m) {
642
+ return [m[0], e, m[1]];
643
+ }), v = U(U([], l, !0), g, !0), p = o.length, c = [], r = 1; r < p - 1; r++)
644
+ c.push(0, r, r + 1);
645
+ for (var r = 1; r < p - 1; r++)
646
+ c.push(p, p + r, p + r + 1);
647
+ for (var r = 0; r < p - 1; r++)
648
+ c.push(r, r + 1, p + r), c.push(r + 1, r + 1 + p, p + r);
649
+ return t.setAttribute("position", new a.Float32BufferAttribute(v.flat(), 3)), t.setIndex(c), t.computeVertexNormals(), t;
650
+ }, i.prototype.generatePolygonTexture = function(n) {
651
+ var e = this.canvas.getContext("2d", {
652
+ willReadFrequently: !0
653
+ });
654
+ if (!e)
655
+ throw new Error("Failed to get canvas context");
656
+ for (var t = e.createImageData(this.canvas.width, this.canvas.height), o = 0; o < this.canvas.width; o++)
657
+ for (var l = 0; l < this.canvas.height; l++) {
658
+ for (var g = 0, v = 0, p = 0, c = 0; c < n.length; c++) {
659
+ var r = n[c].getContext("2d", { willReadFrequently: !0 });
660
+ if (!r)
661
+ throw new Error("Failed to get canvas context");
662
+ var m = r.getImageData(o, l, 1, 1).data;
663
+ if (m[3] === 255) {
664
+ var y = c % 8, u = Math.floor(c / 8);
665
+ u === 0 ? g = g | 1 << y : u === 1 ? v = v | 1 << y : u === 2 && (p = p | 1 << y);
666
+ }
667
+ }
668
+ var x = (o + l * this.canvas.width) * 4;
669
+ t.data[x] = g, t.data[x + 1] = v, t.data[x + 2] = p, t.data[x + 3] = 255;
670
+ }
671
+ return e.putImageData(t, 0, 0), new a.CanvasTexture(this.canvas);
672
+ }, i;
673
+ }()
674
+ ), D = new Y(), X = (
675
+ /** @class */
676
+ function(i) {
677
+ w(n, i);
678
+ function n() {
679
+ var e = i.call(this, {
680
+ type: ["basic", "phong", "pointcloud"],
681
+ fragment: {
682
+ mainBefore: q,
683
+ mainEnd: $
684
+ },
685
+ uniforms: {
686
+ polygonClippers: new a.Uniform([]),
687
+ polygonTexture: new a.Uniform(null)
688
+ }
689
+ }) || this;
690
+ return e._polygonClippers = [], e._radio = 512, e;
691
+ }
692
+ return Object.defineProperty(n.prototype, "polygonClippers", {
693
+ get: function() {
694
+ return this._polygonClippers;
695
+ },
696
+ set: function(e) {
697
+ this._polygonClippers = e;
698
+ var t = this.uniforms;
699
+ t.polygonClippers.value = e.map(function(c) {
700
+ var r = new a.Matrix4().getInverse(c.polygonTransform), m = c.polygonHeight, y = c.cutOutSide, u = c.polygon, x = u[0][0], s = u[0][0], d = u[0][1], f = u[0][1];
701
+ u.forEach(function(E) {
702
+ var P = E[0], S = E[1];
703
+ x = Math.min(x, P), s = Math.max(s, P), d = Math.min(d, S), f = Math.max(f, S);
704
+ });
705
+ var h = new a.Vector2(x, d), C = s - x >= f - d ? s - x : f - d;
706
+ return {
707
+ polygonTransformInverse: r,
708
+ polygonHeight: m,
709
+ minPos: h,
710
+ polygonScale: C,
711
+ cutOutSide: y
712
+ };
713
+ });
714
+ for (var o = [], l = 0; l < e.length; l++) {
715
+ var g = e[l].polygon, v = D.generatePolygonCanvas(g);
716
+ o.push(v);
717
+ }
718
+ var p = D.generatePolygonTexture(o);
719
+ this.uniforms.polygonTexture.value = p;
531
720
  },
532
721
  enumerable: !1,
533
722
  configurable: !0
534
- }), e;
535
- }(f)
723
+ }), n.prototype.onBeforeCompile = function(e, t) {
724
+ var o = String(this.polygonClippers.length);
725
+ e.vertexShader = e.vertexShader.replace(/NUM_POLYGON_CLIPPER/g, o), e.fragmentShader = e.fragmentShader.replace(/NUM_POLYGON_CLIPPER/g, o);
726
+ }, n;
727
+ }(_)
536
728
  );
537
729
  export {
538
- H as EvenessPlaneShader,
730
+ Q as EvenessPlaneShader,
539
731
  k as PointCloudExpandShader,
540
- $ as SweepModelShader
732
+ X as PolygonCuterShader,
733
+ Y as PolygonGenerater,
734
+ Z as SweepModelShader
541
735
  };
package/sticker/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 2025/4/23
5
- * Version: 6.4.0-alpha.30
4
+ * Generated: 5/23/2025
5
+ * Version: 6.4.0-alpha.32
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 p=s.map=new a.Texture;p.wrapS=a.ClampToEdgeWrapping,p.wrapT=a.ClampToEdgeWrapping,p.minFilter=a.LinearFilter,p.encoding=a.sRGBEncoding,v(p,S(r,function(){p.image=r,p.needsUpdate=!0,o._needsRender=!0}))}else if(r instanceof HTMLCanvasElement)s.map=new a.CanvasTexture(r);else if(r instanceof HTMLVideoElement){var f=s.map=new a.VideoTexture(r);f.wrapS=a.ClampToEdgeWrapping,f.wrapT=a.ClampToEdgeWrapping,f.minFilter=a.LinearFilter,f.encoding=a.sRGBEncoding,v(f,A(r,function(){o._needsRender=!0}))}return o}return Object.defineProperty(n,"version",{get:function(){return"6.4.0-alpha.30"},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;
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 p=s.map=new a.Texture;p.wrapS=a.ClampToEdgeWrapping,p.wrapT=a.ClampToEdgeWrapping,p.minFilter=a.LinearFilter,p.encoding=a.sRGBEncoding,v(p,S(r,function(){p.image=r,p.needsUpdate=!0,o._needsRender=!0}))}else if(r instanceof HTMLCanvasElement)s.map=new a.CanvasTexture(r);else if(r instanceof HTMLVideoElement){var f=s.map=new a.VideoTexture(r);f.wrapS=a.ClampToEdgeWrapping,f.wrapT=a.ClampToEdgeWrapping,f.minFilter=a.LinearFilter,f.encoding=a.sRGBEncoding,v(f,A(r,function(){o._needsRender=!0}))}return o}return Object.defineProperty(n,"version",{get:function(){return"6.4.0-alpha.32"},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: 2025/4/23
5
- * Version: 6.4.0-alpha.30
4
+ * Generated: 5/23/2025
5
+ * Version: 6.4.0-alpha.32
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.0-alpha.30";
369
+ return "6.4.0-alpha.32";
370
370
  },
371
371
  enumerable: !1,
372
372
  configurable: !0