@realsee/five 6.4.2 → 6.4.4
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/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/plugins-1.BasePlugin.Controller.html +1 -1
- package/docs/classes/plugins-1.PanoAnimeController.html +33 -0
- package/docs/functions/plugins-1.PanoAnimePlugin.html +1 -0
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/plugins-1.BasePlugin.State.html +1 -1
- package/docs/interfaces/plugins-1.PanoAnimePluginType.Config.html +2 -0
- package/docs/interfaces/plugins-1.PanoAnimePluginType.EventMap.html +11 -0
- package/docs/interfaces/plugins-1.PanoAnimePluginType.Params.html +4 -0
- package/docs/interfaces/plugins-1.PanoAnimePluginType.State.html +8 -0
- package/docs/modules/plugins-1.PanoAnimePluginType.html +7 -0
- package/docs/modules/plugins-1.html +3 -0
- package/docs/types/plugins-1.PanoAnimePluginType.PluginData.html +1 -0
- package/docs/types/plugins-1.PanoAnimePluginType.ServerData.html +1 -0
- package/five/index.js +3 -3
- package/five/index.mjs +4 -4
- 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.d.ts +77 -0
- package/plugins/index.js +39 -12
- package/plugins/index.mjs +781 -644
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/shader-lib/index.js +42 -20
- package/shader-lib/index.mjs +69 -47
- 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 +39 -12
- package/umd/five-react.js +2 -2
- package/umd/five-shader-lib.js +43 -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 +3 -3
- 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/react/index.js
CHANGED
package/react/index.mjs
CHANGED
package/shader-lib/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version: 6.4.
|
|
4
|
+
* Generated: 2025/7/23
|
|
5
|
+
* Version: 6.4.4
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,7 +252,7 @@
|
|
|
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 C=require("@realsee/five"),A=require("three");function J(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,t.get?t:{enumerable:!0,get:()=>r[n]})}}return e.default=r,Object.freeze(e)}const a=J(A);var B=function(r,e){return B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])},B(r,e)};function S(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");B(r,e);function n(){this.constructor=r}r.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function
|
|
255
|
+
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@realsee/five"),A=require("three");function J(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,t.get?t:{enumerable:!0,get:()=>r[n]})}}return e.default=r,Object.freeze(e)}const a=J(A);var B=function(r,e){return B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])},B(r,e)};function S(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");B(r,e);function n(){this.constructor=r}r.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function D(r,e,n){if(n||arguments.length===2)for(var t=0,o=e.length,l;t<o;t++)(l||!(t in e))&&(l||(l=Array.prototype.slice.call(e,0,t)),l[t]=e[t]);return r.concat(l||Array.prototype.slice.call(e))}var V=`
|
|
256
256
|
#if defined(USE_PLANE_DISTANCE)
|
|
257
257
|
struct Plane {
|
|
258
258
|
vec3 normal;
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
uniform float evennessPlaneConstant;
|
|
264
264
|
uniform float evennessPlaneDepth;
|
|
265
265
|
#endif
|
|
266
|
-
`,
|
|
266
|
+
`,W=`
|
|
267
267
|
#if defined(USE_PLANE_DISTANCE)
|
|
268
268
|
|
|
269
269
|
bool inside = true;
|
|
@@ -283,7 +283,7 @@
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
#endif
|
|
286
|
-
`,
|
|
286
|
+
`,H="",R={type:["pointcloud"],fragment:{mainBefore:V,mainStart:H,mainEnd:W},uniforms:{evennessPlaneNormal:new a.Uniform(new a.Vector3),evennessPlaneConstant:new a.Uniform(0),evennessPlanes:new a.Uniform([]),evennessPlaneDepth:new a.Uniform(0)},defines:{USE_PLANE_DISTANCE:!1}},L=function(r){S(e,r);function e(){var n=r.call(this,R)||this;return Object.defineProperties(n,{evennessPlane:{get:function(){return{depth:this.uniforms.evennessPlaneDepth.value,points:this.uniforms.evennessPoints.value}},set:function(t){var o=t.points,l=t.depth,m=!1;if(o.length!==0&&o.length%4===0){m=!0;var d=o[0],u=o[1],p=o[2],i=o[3],g=new a.Vector3().subVectors(u,d),x=new a.Vector3().subVectors(p,d),c=new a.Vector3().crossVectors(g,x).normalize(),h=-c.dot(d),s=l,v=d.clone().add(c.clone().negate().multiplyScalar(s)),f=d.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=i.clone().add(c.clone().negate().multiplyScalar(s)),F=i.clone().add(c.clone().multiplyScalar(s)),z=new a.Plane().setFromCoplanarPoints(f,E,P),N=new a.Plane().setFromCoplanarPoints(_,y,v),M=new a.Plane().setFromCoplanarPoints(E,f,v),O=new a.Plane().setFromCoplanarPoints(w,F,P),T=new a.Plane().setFromCoplanarPoints(P,E,y),b=new a.Plane().setFromCoplanarPoints(v,f,F);this.uniforms.evennessPlanes.value=[{normal:z.normal,constant:z.constant},{normal:N.normal,constant:N.constant},{normal:M.normal,constant:M.constant},{normal:O.normal,constant:O.constant},{normal:T.normal,constant:T.constant},{normal:b.normal,constant:b.constant}],this.uniforms.evennessPlaneDepth.value=l,this.uniforms.evennessPlaneNormal.value=c,this.uniforms.evennessPlaneConstant.value=h}this.defines.USE_PLANE_DISTANCE=m}}}),n.evennessPlane={depth:0,points:[]},n}return e}(C.CustomShader),j=`
|
|
287
287
|
#if NUM_SWEEP_OBJECTS > 0
|
|
288
288
|
uniform float sweepProgress;
|
|
289
289
|
uniform float sweepRange;
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
}
|
|
330
330
|
#pragma unroll_loop_end
|
|
331
331
|
#endif
|
|
332
|
-
`,q="",$=function(r){S(e,r);function e(){var n=r.call(this,{type:["basic","phong","pointcloud"],fragment:{mainBefore:j,mainStart:q,mainEnd:G},uniforms:{sweepProgress:new a.Uniform(0),sweepRange:new a.Uniform(0),sweepBoxs:new a.Uniform([]),interval:new a.Uniform(.04),threshold:new a.Uniform(.002)},defines:{NUM_SWEEP_OBJECTS:0}})||this;return Object.defineProperties(n,{sweepBoxs:{get:function(){return this.uniforms.sweepBoxs.value},set:function(t){var o=t.length;o>0&&(this.defines.NUM_SWEEP_OBJECTS=o,this.uniforms.sweepBoxs.value=t)}}}),n.sweepBoxs=[],n}return e.prototype.onBeforeCompile=function(n,t){var o=String(this.sweepBoxs.length);n.vertexShader=n.vertexShader.replace(/NUM_SWEEP_OBJECTS/g,o),n.fragmentShader=n.fragmentShader.replace(/NUM_SWEEP_OBJECTS/g,o)},e}(C.CustomShader),
|
|
332
|
+
`,q="",$=function(r){S(e,r);function e(){var n=r.call(this,{type:["basic","phong","pointcloud"],fragment:{mainBefore:j,mainStart:q,mainEnd:G},uniforms:{sweepProgress:new a.Uniform(0),sweepRange:new a.Uniform(0),sweepBoxs:new a.Uniform([]),interval:new a.Uniform(.04),threshold:new a.Uniform(.002)},defines:{NUM_SWEEP_OBJECTS:0}})||this;return Object.defineProperties(n,{sweepBoxs:{get:function(){return this.uniforms.sweepBoxs.value},set:function(t){var o=t.length;o>0&&(this.defines.NUM_SWEEP_OBJECTS=o,this.uniforms.sweepBoxs.value=t)}}}),n.sweepBoxs=[],n}return e.prototype.onBeforeCompile=function(n,t){var o=String(this.sweepBoxs.length);n.vertexShader=n.vertexShader.replace(/NUM_SWEEP_OBJECTS/g,o),n.fragmentShader=n.fragmentShader.replace(/NUM_SWEEP_OBJECTS/g,o)},e}(C.CustomShader),k=`
|
|
333
333
|
uniform float pointCloudExpand_progress;
|
|
334
334
|
|
|
335
335
|
vec4 pointCloudExpand_permute(vec4 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); }
|
|
@@ -402,7 +402,7 @@ float pointCloudExpand_gln_simplex(vec3 v) {
|
|
|
402
402
|
m = m * m;
|
|
403
403
|
return 42.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
|
|
404
404
|
}
|
|
405
|
-
`,
|
|
405
|
+
`,Y=`
|
|
406
406
|
float pointCloudExpand_sizeScale = 1.0;
|
|
407
407
|
float pointCloudExpand_sizeBasis = 0.0;
|
|
408
408
|
vec4 pointCloudExpand_basis = vec4((modelBoundingMax + modelBoundingMin) / 2.0, 1.0);
|
|
@@ -416,7 +416,7 @@ float pointCloudExpand_progress2 = step(pointCloudExpand_progress, 1.0 - pointCl
|
|
|
416
416
|
pointCloudExpand_sizeBasis = mix(0.1 * step(abs(pointCloudExpand_noise), 0.5 / pointCloudExpand_boundingRadius), pointCloudExpand_sizeBasis, pointCloudExpand_progress2);
|
|
417
417
|
gl_PointSize = gl_PointSize * pointCloudExpand_sizeScale + pointCloudExpand_sizeBasis;
|
|
418
418
|
vPointSize = gl_PointSize;
|
|
419
|
-
`,K=function(r){S(e,r);function e(){return r.call(this,{type:["pointcloud"],vertex:{mainBefore:
|
|
419
|
+
`,K=function(r){S(e,r);function e(){return r.call(this,{type:["pointcloud"],vertex:{mainBefore:k,mainEnd:Y},uniforms:{pointCloudExpand_progress:new a.Uniform(0)}})||this}return Object.defineProperty(e.prototype,"progress",{get:function(){return this.uniforms.pointCloudExpand_progress.value},set:function(n){this.uniforms.pointCloudExpand_progress.value=n},enumerable:!1,configurable:!0}),e}(C.CustomShader),Q=`
|
|
420
420
|
uniform sampler2D polygonTexture;
|
|
421
421
|
|
|
422
422
|
struct PolygonClipper {
|
|
@@ -455,12 +455,23 @@ vPointSize = gl_PointSize;
|
|
|
455
455
|
vec2 uv = vec2(normalizedPos.x, 1.0 - normalizedPos.y);
|
|
456
456
|
vec4 color = texture2D(polygonTexture, uv);
|
|
457
457
|
int channel = i / 8;
|
|
458
|
-
|
|
459
|
-
float
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
458
|
+
float bit = (float(i) / 8.0 - floor(float(i) / 8.0)) * 8.0;
|
|
459
|
+
float power = pow(2.0, bit);
|
|
460
|
+
|
|
461
|
+
float channelValue;
|
|
462
|
+
if(i < 8) { // 使用r通道
|
|
463
|
+
channelValue = color.r * 255.0;
|
|
464
|
+
} else if(i < 16) { // 使用g通道
|
|
465
|
+
channelValue = color.g * 255.0;
|
|
466
|
+
} else if(i < 24) { // 使用b通道
|
|
467
|
+
channelValue = color.b * 255.0;
|
|
468
|
+
} else { // 使用a通道
|
|
469
|
+
channelValue = color.a * 255.0;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
float masked = floor(channelValue / power + 0.001);
|
|
473
|
+
if(mod(masked, 2.0) < 0.5) {
|
|
474
|
+
discard;
|
|
464
475
|
}
|
|
465
476
|
}
|
|
466
477
|
}else{
|
|
@@ -468,17 +479,28 @@ vPointSize = gl_PointSize;
|
|
|
468
479
|
vec2 uv = vec2(normalizedPos.x, 1.0 - normalizedPos.y);
|
|
469
480
|
vec4 color = texture2D(polygonTexture, uv);
|
|
470
481
|
int channel = i / 8;
|
|
471
|
-
|
|
472
|
-
float
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
482
|
+
|
|
483
|
+
float bit = (float(i) / 8.0 - floor(float(i) / 8.0)) * 8.0;
|
|
484
|
+
float power = pow(2.0, bit);
|
|
485
|
+
float channelValue;
|
|
486
|
+
if(i < 8) { // 使用r通道
|
|
487
|
+
channelValue = color.r * 255.0;
|
|
488
|
+
} else if(i < 16) { // 使用g通道
|
|
489
|
+
channelValue = color.g * 255.0;
|
|
490
|
+
} else if(i < 24) { // 使用b通道
|
|
491
|
+
channelValue = color.b * 255.0;
|
|
492
|
+
} else { // 使用a通道
|
|
493
|
+
channelValue = color.a * 255.0;
|
|
494
|
+
}
|
|
495
|
+
float masked = floor(channelValue / power + 0.001);
|
|
496
|
+
if(mod(masked, 2.0) > 0.0) {
|
|
497
|
+
discard;
|
|
476
498
|
}
|
|
477
499
|
}
|
|
478
500
|
}
|
|
479
501
|
}
|
|
480
502
|
|
|
481
|
-
`,U=function(){function r(){this.canvasCache=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}return r.prototype.setSize=function(e){this.canvas.width=e,this.canvas.height=e},r.prototype.generatePolygonCanvas=function(e){var n=JSON.stringify(e);if(this.canvasCache.has(n))return this.canvasCache.get(n);var t=document.createElement("canvas");t.width=this.canvas.width,t.height=this.canvas.height;var o=t.getContext("2d");if(!o)throw new Error("Failed to get canvas context");if(this.polygonCount>=24)throw new Error("polygon count exceed 24, please clear the canvas");o.clearRect(0,0,this.canvas.width,this.canvas.height),o.fillStyle="rgba(0,0,0,1.0)",o.beginPath();var l=e[0][0],m=e[0][0],
|
|
503
|
+
`,U=function(){function r(){this.canvasCache=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}return r.prototype.setSize=function(e){this.canvas.width=e,this.canvas.height=e},r.prototype.generatePolygonCanvas=function(e){var n=JSON.stringify(e);if(this.canvasCache.has(n))return this.canvasCache.get(n);var t=document.createElement("canvas");t.width=this.canvas.width,t.height=this.canvas.height;var o=t.getContext("2d");if(!o)throw new Error("Failed to get canvas context");if(this.polygonCount>=24)throw new Error("polygon count exceed 24, please clear the canvas");o.clearRect(0,0,this.canvas.width,this.canvas.height),o.fillStyle="rgba(0,0,0,1.0)",o.beginPath();var l=e[0][0],m=e[0][0],d=e[0][1],u=e[0][1];e.forEach(function(s){var v=s[0],f=s[1];l=Math.min(l,v),m=Math.max(m,v),d=Math.min(d,f),u=Math.max(u,f)});var p=m-l,i=u-d,g=this.canvas.width,x=p>=i?g/p:g/i,c=e.map(function(s){var v=s[0]-l,f=s[1]-d;return[v,f]}),h=c.map(function(s){return[s[0]*x,s[1]*x]});return h.forEach(function(s,v){var f=s[0],y=s[1];v===0?o.moveTo(f,y):o.lineTo(f,y)}),o.closePath(),o.fill(),this.polygonCount++,this.canvasCache.set(n,t),t},r.generatePolygonGeometry=function(e,n){for(var t=new a.BufferGeometry,o=e.slice(0,-1),l=o.map(function(g){return[g[0],0,g[1]]}),m=o.map(function(g){return[g[0],n,g[1]]}),d=D(D([],l,!0),m,!0),u=o.length,p=[],i=1;i<u-1;i++)p.push(0,i,i+1);for(var i=1;i<u-1;i++)p.push(u,u+i,u+i+1);for(var i=0;i<u-1;i++)p.push(i,i+1,u+i),p.push(i+1,i+1+u,u+i);return t.setAttribute("position",new a.Float32BufferAttribute(d.flat(),3)),t.setIndex(p),t.computeVertexNormals(),t},r.prototype.generatePolygonTexture=function(e){var n=this.canvas.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("Failed to get canvas context");for(var t=n.createImageData(this.canvas.width,this.canvas.height),o=0;o<this.canvas.width;o++)for(var l=0;l<this.canvas.height;l++){for(var m=0,d=0,u=0,p=0;p<e.length;p++){var i=e[p].getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Failed to get canvas context");var g=i.getImageData(o,l,1,1).data;if(g[3]===255){var x=p%8,c=Math.floor(p/8);c===0?m=m|1<<x:c===1?d=d|1<<x:c===2&&(u=u|1<<x)}}var h=(o+l*this.canvas.width)*4;t.data[h]=m,t.data[h+1]=d,t.data[h+2]=u,t.data[h+3]=255}return n.putImageData(t,0,0),new a.CanvasTexture(this.canvas)},r}(),I=new U,X=function(r){S(e,r);function e(){var n=r.call(this,{type:["basic","phong","pointcloud"],fragment:{mainBefore:Q,mainEnd:Z},uniforms:{polygonClippers:new a.Uniform([]),polygonTexture:new a.Uniform(null)}})||this;return n._polygonClippers=[],n._radio=512,n}return Object.defineProperty(e.prototype,"polygonClippers",{get:function(){return this._polygonClippers},set:function(n){this._polygonClippers=n;var t=this.uniforms;t.polygonClippers.value=n.map(function(p){var i=new a.Matrix4().getInverse(p.polygonTransform),g=p.polygonHeight,x=p.cutOutSide,c=p.polygon,h=c[0][0],s=c[0][0],v=c[0][1],f=c[0][1];c.forEach(function(_){var P=_[0],w=_[1];h=Math.min(h,P),s=Math.max(s,P),v=Math.min(v,w),f=Math.max(f,w)});var y=new a.Vector2(h,v),E=s-h>=f-v?s-h:f-v;return{polygonTransformInverse:i,polygonHeight:g,minPos:y,polygonScale:E,cutOutSide:x}});for(var o=[],l=0;l<n.length;l++){var m=n[l].polygon,d=I.generatePolygonCanvas(m);o.push(d)}var u=I.generatePolygonTexture(o);this.uniforms.polygonTexture.value=u},enumerable:!1,configurable:!0}),e.prototype.onBeforeCompile=function(n,t){var o=String(this.polygonClippers.length);n.vertexShader=n.vertexShader.replace(/NUM_POLYGON_CLIPPER/g,o),n.fragmentShader=n.fragmentShader.replace(/NUM_POLYGON_CLIPPER/g,o)},e}(C.CustomShader),nn=`
|
|
482
504
|
#if NUM_SHINE_OBJECTS > 0
|
|
483
505
|
uniform float shineProgress;
|
|
484
506
|
struct SHINE_OBJECT {
|
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: 2025/7/23
|
|
5
|
+
* Version: 6.4.4
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -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
|
|
273
|
+
function b(i, e, n) {
|
|
274
274
|
if (n || arguments.length === 2) for (var t = 0, o = e.length, l; t < o; t++)
|
|
275
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;
|
|
@@ -306,10 +306,10 @@ var b = `
|
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
#endif
|
|
309
|
-
`, J = "",
|
|
309
|
+
`, J = "", V = {
|
|
310
310
|
type: ["pointcloud"],
|
|
311
311
|
fragment: {
|
|
312
|
-
mainBefore:
|
|
312
|
+
mainBefore: U,
|
|
313
313
|
mainStart: J,
|
|
314
314
|
mainEnd: A
|
|
315
315
|
},
|
|
@@ -327,7 +327,7 @@ var b = `
|
|
|
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() {
|
|
@@ -340,14 +340,14 @@ var b = `
|
|
|
340
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], 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,
|
|
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
345
|
{ normal: z.normal, constant: z.constant },
|
|
346
346
|
{ normal: N.normal, constant: N.constant },
|
|
347
347
|
{ normal: M.normal, constant: M.constant },
|
|
348
348
|
{ normal: O.normal, constant: O.constant },
|
|
349
|
-
{ normal:
|
|
350
|
-
{ normal:
|
|
349
|
+
{ normal: T.normal, constant: T.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 b = `
|
|
|
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,7 +373,7 @@ var b = `
|
|
|
373
373
|
};
|
|
374
374
|
uniform SWEEP_OBJECT sweepBoxs[NUM_SWEEP_OBJECTS];
|
|
375
375
|
#endif
|
|
376
|
-
`,
|
|
376
|
+
`, H = `
|
|
377
377
|
|
|
378
378
|
#if NUM_SWEEP_OBJECTS > 0
|
|
379
379
|
#pragma unroll_loop_start
|
|
@@ -406,7 +406,7 @@ var b = `
|
|
|
406
406
|
}
|
|
407
407
|
#pragma unroll_loop_end
|
|
408
408
|
#endif
|
|
409
|
-
`,
|
|
409
|
+
`, R = "", X = (
|
|
410
410
|
/** @class */
|
|
411
411
|
function(i) {
|
|
412
412
|
S(e, i);
|
|
@@ -414,9 +414,9 @@ var b = `
|
|
|
414
414
|
var n = i.call(this, {
|
|
415
415
|
type: ["basic", "phong", "pointcloud"],
|
|
416
416
|
fragment: {
|
|
417
|
-
mainBefore:
|
|
418
|
-
mainStart:
|
|
419
|
-
mainEnd:
|
|
417
|
+
mainBefore: W,
|
|
418
|
+
mainStart: R,
|
|
419
|
+
mainEnd: H
|
|
420
420
|
},
|
|
421
421
|
uniforms: {
|
|
422
422
|
sweepProgress: new r.Uniform(0),
|
|
@@ -601,12 +601,23 @@ vPointSize = gl_PointSize;
|
|
|
601
601
|
vec2 uv = vec2(normalizedPos.x, 1.0 - normalizedPos.y);
|
|
602
602
|
vec4 color = texture2D(polygonTexture, uv);
|
|
603
603
|
int channel = i / 8;
|
|
604
|
-
|
|
605
|
-
float
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
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;
|
|
610
621
|
}
|
|
611
622
|
}
|
|
612
623
|
}else{
|
|
@@ -614,11 +625,22 @@ vPointSize = gl_PointSize;
|
|
|
614
625
|
vec2 uv = vec2(normalizedPos.x, 1.0 - normalizedPos.y);
|
|
615
626
|
vec4 color = texture2D(polygonTexture, uv);
|
|
616
627
|
int channel = i / 8;
|
|
617
|
-
|
|
618
|
-
float
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
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;
|
|
622
644
|
}
|
|
623
645
|
}
|
|
624
646
|
}
|
|
@@ -646,25 +668,25 @@ vPointSize = gl_PointSize;
|
|
|
646
668
|
o.clearRect(0, 0, this.canvas.width, this.canvas.height), o.fillStyle = "rgba(0,0,0,1.0)", o.beginPath();
|
|
647
669
|
var l = e[0][0], m = e[0][0], v = e[0][1], u = e[0][1];
|
|
648
670
|
e.forEach(function(s) {
|
|
649
|
-
var
|
|
650
|
-
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);
|
|
651
673
|
});
|
|
652
674
|
var p = m - l, a = u - v, g = this.canvas.width, h = p >= a ? g / p : g / a, c = e.map(function(s) {
|
|
653
|
-
var
|
|
654
|
-
return [
|
|
675
|
+
var f = s[0] - l, d = s[1] - v;
|
|
676
|
+
return [f, d];
|
|
655
677
|
}), x = c.map(function(s) {
|
|
656
678
|
return [s[0] * h, s[1] * h];
|
|
657
679
|
});
|
|
658
|
-
return x.forEach(function(s,
|
|
659
|
-
var
|
|
660
|
-
|
|
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);
|
|
661
683
|
}), o.closePath(), o.fill(), this.polygonCount++, this.canvasCache.set(n, t), t;
|
|
662
684
|
}, i.generatePolygonGeometry = function(e, n) {
|
|
663
685
|
for (var t = new r.BufferGeometry(), o = e.slice(0, -1), l = o.map(function(g) {
|
|
664
686
|
return [g[0], 0, g[1]];
|
|
665
687
|
}), m = o.map(function(g) {
|
|
666
688
|
return [g[0], n, g[1]];
|
|
667
|
-
}), v =
|
|
689
|
+
}), v = b(b([], l, !0), m, !0), u = o.length, p = [], a = 1; a < u - 1; a++)
|
|
668
690
|
p.push(0, a, a + 1);
|
|
669
691
|
for (var a = 1; a < u - 1; a++)
|
|
670
692
|
p.push(u, u + a, u + a + 1);
|
|
@@ -695,7 +717,7 @@ vPointSize = gl_PointSize;
|
|
|
695
717
|
return n.putImageData(t, 0, 0), new r.CanvasTexture(this.canvas);
|
|
696
718
|
}, i;
|
|
697
719
|
}()
|
|
698
|
-
),
|
|
720
|
+
), I = new q(), en = (
|
|
699
721
|
/** @class */
|
|
700
722
|
function(i) {
|
|
701
723
|
S(e, i);
|
|
@@ -721,12 +743,12 @@ vPointSize = gl_PointSize;
|
|
|
721
743
|
this._polygonClippers = n;
|
|
722
744
|
var t = this.uniforms;
|
|
723
745
|
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],
|
|
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];
|
|
725
747
|
c.forEach(function(_) {
|
|
726
748
|
var P = _[0], w = _[1];
|
|
727
|
-
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);
|
|
728
750
|
});
|
|
729
|
-
var y = new r.Vector2(x,
|
|
751
|
+
var y = new r.Vector2(x, f), E = s - x >= d - f ? s - x : d - f;
|
|
730
752
|
return {
|
|
731
753
|
polygonTransformInverse: a,
|
|
732
754
|
polygonHeight: g,
|
|
@@ -736,10 +758,10 @@ vPointSize = gl_PointSize;
|
|
|
736
758
|
};
|
|
737
759
|
});
|
|
738
760
|
for (var o = [], l = 0; l < n.length; l++) {
|
|
739
|
-
var m = n[l].polygon, v =
|
|
761
|
+
var m = n[l].polygon, v = I.generatePolygonCanvas(m);
|
|
740
762
|
o.push(v);
|
|
741
763
|
}
|
|
742
|
-
var u =
|
|
764
|
+
var u = I.generatePolygonTexture(o);
|
|
743
765
|
this.uniforms.polygonTexture.value = u;
|
|
744
766
|
},
|
|
745
767
|
enumerable: !1,
|
|
@@ -749,7 +771,7 @@ vPointSize = gl_PointSize;
|
|
|
749
771
|
n.vertexShader = n.vertexShader.replace(/NUM_POLYGON_CLIPPER/g, o), n.fragmentShader = n.fragmentShader.replace(/NUM_POLYGON_CLIPPER/g, o);
|
|
750
772
|
}, e;
|
|
751
773
|
}(C)
|
|
752
|
-
),
|
|
774
|
+
), k = `
|
|
753
775
|
#if NUM_SHINE_OBJECTS > 0
|
|
754
776
|
uniform float shineProgress;
|
|
755
777
|
struct SHINE_OBJECT {
|
|
@@ -758,7 +780,7 @@ vPointSize = gl_PointSize;
|
|
|
758
780
|
};
|
|
759
781
|
uniform SHINE_OBJECT shineBoxes[NUM_SHINE_OBJECTS];
|
|
760
782
|
#endif
|
|
761
|
-
`,
|
|
783
|
+
`, Y = `
|
|
762
784
|
#if NUM_SHINE_OBJECTS > 0
|
|
763
785
|
#pragma unroll_loop_start
|
|
764
786
|
for ( int i = 0; i < NUM_SHINE_OBJECTS; i ++ ) {
|
|
@@ -774,7 +796,7 @@ vPointSize = gl_PointSize;
|
|
|
774
796
|
}
|
|
775
797
|
#pragma unroll_loop_end
|
|
776
798
|
#endif
|
|
777
|
-
`,
|
|
799
|
+
`, K = "", on = (
|
|
778
800
|
/** @class */
|
|
779
801
|
function(i) {
|
|
780
802
|
S(e, i);
|
|
@@ -782,9 +804,9 @@ vPointSize = gl_PointSize;
|
|
|
782
804
|
var n = i.call(this, {
|
|
783
805
|
type: ["basic", "phong", "none"],
|
|
784
806
|
fragment: {
|
|
785
|
-
mainBefore:
|
|
786
|
-
mainStart:
|
|
787
|
-
mainEnd:
|
|
807
|
+
mainBefore: k,
|
|
808
|
+
mainStart: K,
|
|
809
|
+
mainEnd: Y
|
|
788
810
|
},
|
|
789
811
|
uniforms: {
|
|
790
812
|
shineProgress: new r.Uniform(0),
|
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: 2025/7/23
|
|
5
|
+
* Version: 6.4.4
|
|
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.4"},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: 2025/7/23
|
|
5
|
+
* Version: 6.4.4
|
|
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.4";
|
|
370
370
|
},
|
|
371
371
|
enumerable: !1,
|
|
372
372
|
configurable: !0
|
package/umd/five-gltf-loader.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version: 6.4.
|
|
4
|
+
* Generated: 2025/7/23
|
|
5
|
+
* Version: 6.4.4
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -258,4 +258,4 @@
|
|
|
258
258
|
`),a=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP"," vec4 texelGlossiness = texture2D( glossinessMap, vUv );"," // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture"," glossinessFactor *= texelGlossiness.a;","#endif"].join(`
|
|
259
259
|
`),i=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join(`
|
|
260
260
|
`),s={specular:{value:new l.Color().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(o){for(var f in s)o.uniforms[f]=s[f];o.fragmentShader=o.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),o.fragmentShader=o.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),o.fragmentShader=o.fragmentShader.replace("#include <roughnessmap_pars_fragment>",r),o.fragmentShader=o.fragmentShader.replace("#include <metalnessmap_pars_fragment>",n),o.fragmentShader=o.fragmentShader.replace("#include <roughnessmap_fragment>",t),o.fragmentShader=o.fragmentShader.replace("#include <metalnessmap_fragment>",a),o.fragmentShader=o.fragmentShader.replace("#include <lights_physical_fragment>",i)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(o){s.specular.value=o}},specularMap:{get:function(){return s.specularMap.value},set:function(o){s.specularMap.value=o}},glossiness:{get:function(){return s.glossiness.value},set:function(o){s.glossiness.value=o}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(o){s.glossinessMap.value=o,o?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}C.prototype=Object.create(l.MeshStandardMaterial.prototype),C.prototype.constructor=C,C.prototype.copy=function(e){return l.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this};function X(){return{name:u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return C},extendParams:function(e,r,n){var t=r.extensions[this.name];e.color=new l.Color(1,1,1),e.opacity=1;var a=[];if(Array.isArray(t.diffuseFactor)){var i=t.diffuseFactor;e.color.fromArray(i),e.opacity=i[3]}if(t.diffuseTexture!==void 0&&a.push(n.assignTexture(e,"map",t.diffuseTexture)),e.emissive=new l.Color(0,0,0),e.glossiness=t.glossinessFactor!==void 0?t.glossinessFactor:1,e.specular=new l.Color(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),t.specularGlossinessTexture!==void 0){var s=t.specularGlossinessTexture;a.push(n.assignTexture(e,"glossinessMap",s)),a.push(n.assignTexture(e,"specularMap",s))}return Promise.all(a)},createMaterial:function(e){var r=new C(e);return r.fog=!0,r.color=e.color,r.map=e.map===void 0?null:e.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=e.aoMap===void 0?null:e.aoMap,r.aoMapIntensity=1,r.emissive=e.emissive,r.emissiveIntensity=1,r.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,r.bumpMap=e.bumpMap===void 0?null:e.bumpMap,r.bumpScale=1,r.normalMap=e.normalMap===void 0?null:e.normalMap,r.normalMapType=l.TangentSpaceNormalMap,e.normalScale&&(r.normalScale=e.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=e.specularMap===void 0?null:e.specularMap,r.specular=e.specular,r.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,r.glossiness=e.glossiness,r.alphaMap=null,r.envMap=e.envMap===void 0?null:e.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function ne(){this.name=u.KHR_MESH_QUANTIZATION}function U(e,r,n,t){l.Interpolant.call(this,e,r,n,t)}U.prototype=Object.create(l.Interpolant.prototype),U.prototype.constructor=U,U.prototype.copySampleValue_=function(e){for(var r=this.resultBuffer,n=this.sampleValues,t=this.valueSize,a=e*t*3+t,i=0;i!==t;i++)r[i]=n[a+i];return r},U.prototype.beforeStart_=U.prototype.copySampleValue_,U.prototype.afterEnd_=U.prototype.copySampleValue_,U.prototype.interpolate_=function(e,r,n,t){for(var a=this.resultBuffer,i=this.sampleValues,s=this.valueSize,o=s*2,f=s*3,c=t-r,v=(n-r)/c,d=v*v,h=d*v,y=e*f,_=y-f,L=-2*h+3*d,T=h-d,b=1-L,D=T-d+v,k=0;k!==s;k++){var ae=i[_+k+s],se=i[_+k+o]*c,re=i[y+k+s],j=i[y+k]*c;a[k]=b*ae+D*se+L*re+T*j}return a};function Z(e){this.parser=e,this.name=u.REALSEE_MATERIALS_LIGHTMAP}Z.prototype.getMaterialType=function(e){return l.MeshPhongMaterial},Z.prototype.extendParams=function(e,r,n){if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var t=[],a=r.extensions[this.name];return a.lightMapTexture!==void 0&&t.push(n.assignTexture(e,"lightMap",a.lightMapTexture)),a.lightMapIntensity!==void 0&&(e.lightMapIntensity=a.lightMapIntensity),Promise.all(t)};var K={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},$={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ee={9728:l.NearestFilter,9729:l.LinearFilter,9984:l.NearestMipmapNearestFilter,9985:l.LinearMipmapNearestFilter,9986:l.NearestMipmapLinearFilter,9987:l.LinearMipmapLinearFilter},H={33071:l.ClampToEdgeWrapping,33648:l.MirroredRepeatWrapping,10497:l.RepeatWrapping},Y={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},fe={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},z={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},_e={CUBICSPLINE:void 0,LINEAR:l.InterpolateLinear,STEP:l.InterpolateDiscrete},ce={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"},ve={"image/png":l.RGBAFormat,"image/jpeg":l.RGBFormat};function ge(e,r){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(r)&&/^\//.test(e)&&(r=r.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:r+e)}function Me(e){return e.DefaultMaterial===void 0&&(e.DefaultMaterial=new l.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:l.FrontSide})),e.DefaultMaterial}function ie(e,r,n){for(var t in n.extensions)e[t]===void 0&&(r.userData.gltfExtensions=r.userData.gltfExtensions||{},r.userData.gltfExtensions[t]=n.extensions[t])}function q(e,r){r.extras!==void 0&&(typeof r.extras=="object"?Object.assign(e.userData,r.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+r.extras))}function we(e,r,n){for(var t=!1,a=!1,i=0,s=r.length;i<s;i++){var o=r[i];if(o.POSITION!==void 0&&(t=!0),o.NORMAL!==void 0&&(a=!0),t&&a)break}if(!t&&!a)return Promise.resolve(e);for(var f=[],c=[],i=0,s=r.length;i<s;i++){var o=r[i];if(t){var v=o.POSITION!==void 0?n.getDependency("accessor",o.POSITION):e.attributes.position;f.push(v)}if(a){var v=o.NORMAL!==void 0?n.getDependency("accessor",o.NORMAL):e.attributes.normal;c.push(v)}}return Promise.all([Promise.all(f),Promise.all(c)]).then(function(d){var h=d[0],y=d[1];return t&&(e.morphAttributes.position=h),a&&(e.morphAttributes.normal=y),e.morphTargetsRelative=!0,e})}function be(e,r){if(e.updateMorphTargets(),r.weights!==void 0)for(var n=0,t=r.weights.length;n<t;n++)e.morphTargetInfluences[n]=r.weights[n];if(r.extras&&Array.isArray(r.extras.targetNames)){var a=r.extras.targetNames;if(e.morphTargetInfluences.length===a.length){e.morphTargetDictionary={};for(var n=0,t=a.length;n<t;n++)e.morphTargetDictionary[a[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function N(e){var r=e.extensions&&e.extensions[u.KHR_DRACO_MESH_COMPRESSION],n;return r?n="draco:"+r.bufferView+":"+r.indices+":"+J(r.attributes):n=e.indices+":"+J(e.attributes)+":"+e.mode,n}function J(e){for(var r="",n=Object.keys(e).sort(),t=0,a=n.length;t<a;t++)r+=n[t]+":"+e[n[t]]+";";return r}function F(e,r,n){this.json=e||{},this.extensions=r||{},this.options=n||{},this.cache=new g,this.associations=new Map,this.primitiveCache={},this.textureLoader=new l.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new l.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}F.prototype.parse=function(e,r){var n=this,t=this.json,a=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then(function(i){var s={scene:i[0][t.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:t.asset,parser:n,userData:{}};ie(a,s,t),q(s,t),e(s)}).catch(r)},F.prototype.markDefs=function(){for(var e=this.json.nodes||[],r=this.json.skins||[],n=this.json.meshes||[],t={},a={},i=0,s=r.length;i<s;i++)for(var o=r[i].joints,f=0,c=o.length;f<c;f++)e[o[f]].isBone=!0;for(var v=0,d=e.length;v<d;v++){var h=e[v];h.mesh!==void 0&&(t[h.mesh]===void 0&&(t[h.mesh]=a[h.mesh]=0),t[h.mesh]++,h.skin!==void 0&&(n[h.mesh].isSkinnedMesh=!0))}this.json.meshReferences=t,this.json.meshUses=a},F.prototype.getDependency=function(e,r){var n=e+":"+r,t=this.cache.get(n);if(!t){switch(e){case"scene":t=this.loadScene(r);break;case"node":t=this.loadNode(r);break;case"mesh":t=this.loadMesh(r);break;case"accessor":t=this.loadAccessor(r);break;case"bufferView":t=this.loadBufferView(r);break;case"buffer":t=this.loadBuffer(r);break;case"material":t=this.loadMaterial(r);break;case"texture":t=this.loadTexture(r);break;case"skin":t=this.loadSkin(r);break;case"animation":t=this.loadAnimation(r);break;case"camera":t=this.loadCamera(r);break;case"light":t=this.extensions[u.KHR_LIGHTS_PUNCTUAL].loadLight(r);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,t)}return t},F.prototype.getDependencies=function(e){var r=this.cache.get(e);if(!r){var n=this,t=this.json[e+(e==="mesh"?"es":"s")]||[];r=Promise.all(t.map(function(a,i){return n.getDependency(e,i)})),this.cache.add(e,r)}return r},F.prototype.loadBuffer=function(e){var r=this.json.buffers[e],n=this.fileLoader;if(r.type&&r.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+r.type+" buffer type is not supported.");if(r.uri===void 0&&e===0)return Promise.resolve(this.extensions[u.KHR_BINARY_GLTF].body);var t=this.options;return new Promise(function(a,i){n.load(ge(r.uri,t.path),a,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+r.uri+'".'))})})},F.prototype.loadBufferView=function(e){var r=this.json.bufferViews[e];return this.getDependency("buffer",r.buffer).then(function(n){var t=r.byteLength||0,a=r.byteOffset||0;return n.slice(a,a+t)})},F.prototype.loadAccessor=function(e){var r=this,n=this.json,t=this.json.accessors[e];if(t.bufferView===void 0&&t.sparse===void 0)return Promise.resolve(null);var a=[];return t.bufferView!==void 0?a.push(this.getDependency("bufferView",t.bufferView)):a.push(null),t.sparse!==void 0&&(a.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(a).then(function(i){var s=i[0],o=Y[t.type],f=$[t.componentType],c=f.BYTES_PER_ELEMENT,v=c*o,d=t.byteOffset||0,h=t.bufferView!==void 0?n.bufferViews[t.bufferView].byteStride:void 0,y=t.normalized===!0,_,L;if(h&&h!==v){var T=Math.floor(d/h),b="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+T+":"+t.count,D=r.cache.get(b);D||(_=new f(s,T*h,t.count*h/c),D=new l.InterleavedBuffer(_,h/c),r.cache.add(b,D)),L=new l.InterleavedBufferAttribute(D,o,d%h/c,y)}else s===null?_=new f(t.count*o):_=new f(s,d,t.count*o),L=new l.BufferAttribute(_,o,y);if(t.sparse!==void 0){var k=Y.SCALAR,ae=$[t.sparse.indices.componentType],se=t.sparse.indices.byteOffset||0,re=t.sparse.values.byteOffset||0,j=new ae(i[1],se,t.sparse.count*k),le=new f(i[2],re,t.sparse.count*o);s!==null&&(L=new l.BufferAttribute(L.array.slice(),L.itemSize,L.normalized));for(var E=0,Ie=j.length;E<Ie;E++){var oe=j[E];if(L.setX(oe,le[E*o]),o>=2&&L.setY(oe,le[E*o+1]),o>=3&&L.setZ(oe,le[E*o+2]),o>=4&&L.setW(oe,le[E*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return L})},F.prototype.loadTexture=function(e){var r=this,n=this.json,t=this.options,a=this.textureLoader,i=self.URL||self.webkitURL,s=n.textures[e],o=s.extensions||{},f;o[u.MSFT_TEXTURE_DDS]?f=n.images[o[u.MSFT_TEXTURE_DDS].source]:f=n.images[s.source];var c=f.uri,v=!1;return f.bufferView!==void 0&&(c=r.getDependency("bufferView",f.bufferView).then(function(d){v=!0;var h=new Blob([d],{type:f.mimeType});return c=i.createObjectURL(h),c})),Promise.resolve(c).then(function(d){var h=t.manager.getHandler(d);return h||(h=o[u.MSFT_TEXTURE_DDS]?r.extensions[u.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise(function(y,_){h.load(ge(d,t.path),y,void 0,_)})}).then(function(d){v===!0&&i.revokeObjectURL(c),d.flipY=!1,s.name&&(d.name=s.name),f.mimeType in ve&&(d.format=ve[f.mimeType]);var h=n.samplers||{},y=h[s.sampler]||{};return d.magFilter=ee[y.magFilter]||l.LinearFilter,d.minFilter=ee[y.minFilter]||l.LinearMipmapLinearFilter,d.wrapS=H[y.wrapS]||l.RepeatWrapping,d.wrapT=H[y.wrapT]||l.RepeatWrapping,r.associations.set(d,{type:"textures",index:e}),d})},F.prototype.assignTexture=function(e,r,n){var t=this;return this.getDependency("texture",n.index).then(function(a){if(!a.isCompressedTexture)switch(r){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=l.RGBFormat;break}if(n.texCoord!==void 0&&n.texCoord!=0&&!(r==="aoMap"&&n.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+r+" not yet supported."),t.extensions[u.KHR_TEXTURE_TRANSFORM]){var i=n.extensions!==void 0?n.extensions[u.KHR_TEXTURE_TRANSFORM]:void 0;if(i){var s=t.associations.get(a);a=t.extensions[u.KHR_TEXTURE_TRANSFORM].extendTexture(a,i),t.associations.set(a,s)}}e[r]=a})},F.prototype.assignFinalMaterial=function(e){var r=e.geometry,n=e.material,t=r.attributes.tangent!==void 0,a=r.attributes.color!==void 0,i=r.attributes.normal===void 0,s=e.isSkinnedMesh===!0,o=Object.keys(r.morphAttributes).length>0,f=o&&r.morphAttributes.normal!==void 0;if(e.isPoints){var c="PointsMaterial:"+n.uuid,v=this.cache.get(c);v||(v=new l.PointsMaterial,l.Material.prototype.copy.call(v,n),v.color.copy(n.color),v.map=n.map,v.sizeAttenuation=!1,this.cache.add(c,v)),n=v}else if(e.isLine){var c="LineBasicMaterial:"+n.uuid,d=this.cache.get(c);d||(d=new l.LineBasicMaterial,l.Material.prototype.copy.call(d,n),d.color.copy(n.color),this.cache.add(c,d)),n=d}if(t||a||i||s||o){var c="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),s&&(c+="skinning:"),t&&(c+="vertex-tangents:"),a&&(c+="vertex-colors:"),i&&(c+="flat-shading:"),o&&(c+="morph-targets:"),f&&(c+="morph-normals:");var h=this.cache.get(c);h||(h=n.clone(),s&&(h.skinning=!0),t&&(h.vertexTangents=!0),a&&(h.vertexColors=!0),i&&(h.flatShading=!0),o&&(h.morphTargets=!0),f&&(h.morphNormals=!0),this.cache.add(c,h),this.associations.set(h,this.associations.get(n))),n=h}n.aoMap&&r.attributes.uv2===void 0&&r.attributes.uv!==void 0&&r.setAttribute("uv2",r.attributes.uv),n.normalScale&&!t&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!t&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),e.material=n},F.prototype.loadMaterial=function(e){var r=this,n=this.json,t=this.extensions,a=n.materials[e],i,s={},o=a.extensions||{},f=[];if(o[u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var c=t[u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];i=c.getMaterialType(),f.push(c.extendParams(s,a,r))}else if(o[u.KHR_MATERIALS_UNLIT]){var v=t[u.KHR_MATERIALS_UNLIT];i=v.getMaterialType(),f.push(v.extendParams(s,a,r))}else{i=l.MeshStandardMaterial;var d=a.pbrMetallicRoughness||{};if(s.color=new l.Color(1,1,1),s.opacity=1,Array.isArray(d.baseColorFactor)){var h=d.baseColorFactor;s.color.fromArray(h),s.opacity=h[3]}d.baseColorTexture!==void 0&&f.push(r.assignTexture(s,"map",d.baseColorTexture)),s.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,s.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(f.push(r.assignTexture(s,"metalnessMap",d.metallicRoughnessTexture)),f.push(r.assignTexture(s,"roughnessMap",d.metallicRoughnessTexture)))}a.doubleSided===!0&&(s.side=l.DoubleSide);var y=a.alphaMode||ce.OPAQUE;if(y===ce.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,y===ce.MASK&&(s.alphaTest=a.alphaCutoff!==void 0?a.alphaCutoff:.5)),a.normalTexture!==void 0&&i!==l.MeshBasicMaterial&&(f.push(r.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new l.Vector2(1,1),a.normalTexture.scale!==void 0&&s.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),a.occlusionTexture!==void 0&&i!==l.MeshBasicMaterial&&(f.push(r.assignTexture(s,"aoMap",a.occlusionTexture)),a.occlusionTexture.strength!==void 0&&(s.aoMapIntensity=a.occlusionTexture.strength)),a.emissiveFactor!==void 0&&i!==l.MeshBasicMaterial&&(s.emissive=new l.Color().fromArray(a.emissiveFactor)),a.emissiveTexture!==void 0&&i!==l.MeshBasicMaterial&&f.push(r.assignTexture(s,"emissiveMap",a.emissiveTexture)),o[u.KHR_MATERIALS_CLEARCOAT]){var _=t[u.KHR_MATERIALS_CLEARCOAT];i=_.getMaterialType(),f.push(_.extendParams(s,{extensions:o},r))}if(o[u.KHR_MATERIALS_TRANSMISSION]){var _=t[u.KHR_MATERIALS_TRANSMISSION];i=_.getMaterialType(),f.push(_.extendParams(s,{extensions:o},r))}if(o[u.REALSEE_MATERIALS_LIGHTMAP]){var L=t[u.REALSEE_MATERIALS_LIGHTMAP];i=L.getMaterialType(),f.push(L.extendParams(s,{extensions:o},r))}return Promise.all(f).then(function(){var T;return i===C?T=t[u.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):T=new i(s),a.name&&(T.name=a.name),T.map&&(T.map.encoding=l.sRGBEncoding),T.emissiveMap&&(T.emissiveMap.encoding=l.sRGBEncoding),q(T,a),r.associations.set(T,{type:"materials",index:e}),a.extensions&&ie(t,T,a),T})};function me(e,r,n){var t=r.attributes,a=new l.Box3;if(t.POSITION!==void 0){var i=n.json.accessors[t.POSITION],s=i.min,o=i.max;if(s!==void 0&&o!==void 0)a.set(new l.Vector3(s[0],s[1],s[2]),new l.Vector3(o[0],o[1],o[2]));else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;var f=r.targets;if(f!==void 0){for(var c=new l.Vector3,v=new l.Vector3,d=0,h=f.length;d<h;d++){var y=f[d];if(y.POSITION!==void 0){var i=n.json.accessors[y.POSITION],s=i.min,o=i.max;s!==void 0&&o!==void 0?(v.setX(Math.max(Math.abs(s[0]),Math.abs(o[0]))),v.setY(Math.max(Math.abs(s[1]),Math.abs(o[1]))),v.setZ(Math.max(Math.abs(s[2]),Math.abs(o[2]))),c.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}a.expandByVector(c)}e.boundingBox=a;var _=new l.Sphere;a.getCenter(_.center),_.radius=a.min.distanceTo(a.max)/2,e.boundingSphere=_}function W(e,r,n){var t=r.attributes,a=[];function i(c,v){return n.getDependency("accessor",c).then(function(d){e.setAttribute(v,d)})}for(var s in t){var o=fe[s]||s.toLowerCase();o in e.attributes||a.push(i(t[s],o))}if(r.indices!==void 0&&!e.index){var f=n.getDependency("accessor",r.indices).then(function(c){e.setIndex(c)});a.push(f)}return q(e,r),me(e,r,n),Promise.all(a).then(function(){return r.targets!==void 0?we(e,r.targets,n):e})}function ue(e,r){var n=e.getIndex();if(n===null){var t=[],a=e.getAttribute("position");if(a!==void 0){for(var i=0;i<a.count;i++)t.push(i);e.setIndex(t),n=e.getIndex()}else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}var s=n.count-2,o=[];if(r===l.TriangleFanDrawMode)for(var i=1;i<=s;i++)o.push(n.getX(0)),o.push(n.getX(i)),o.push(n.getX(i+1));else for(var i=0;i<s;i++)i%2===0?(o.push(n.getX(i)),o.push(n.getX(i+1)),o.push(n.getX(i+2))):(o.push(n.getX(i+2)),o.push(n.getX(i+1)),o.push(n.getX(i)));o.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var f=e.clone();return f.setIndex(o),f}return F.prototype.loadGeometries=function(e){var r=this,n=this.extensions,t=this.primitiveCache;function a(h){return n[u.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h,r).then(function(y){return W(y,h,r)})}for(var i=[],s=0,o=e.length;s<o;s++){var f=e[s],c=N(f),v=t[c];if(v)i.push(v.promise);else{var d;f.extensions&&f.extensions[u.KHR_DRACO_MESH_COMPRESSION]?d=a(f):d=W(new l.BufferGeometry,f,r),t[c]={primitive:f,promise:d},i.push(d)}}return Promise.all(i)},F.prototype.loadMesh=function(e){for(var r=this,n=this.json,t=n.meshes[e],a=t.primitives,i=[],s=0,o=a.length;s<o;s++){var f=a[s].material===void 0?Me(this.cache):this.getDependency("material",a[s].material);i.push(f)}return i.push(r.loadGeometries(a)),Promise.all(i).then(function(c){for(var v=c.slice(0,c.length-1),d=c[c.length-1],h=[],y=0,_=d.length;y<_;y++){var L=d[y],T=a[y],b,D=v[y];if(T.mode===K.TRIANGLES||T.mode===K.TRIANGLE_STRIP||T.mode===K.TRIANGLE_FAN||T.mode===void 0)b=t.isSkinnedMesh===!0?new l.SkinnedMesh(L,D):new l.Mesh(L,D),b.isSkinnedMesh===!0&&!b.geometry.attributes.skinWeight.normalized&&b.normalizeSkinWeights(),T.mode===K.TRIANGLE_STRIP?b.geometry=ue(b.geometry,l.TriangleStripDrawMode):T.mode===K.TRIANGLE_FAN&&(b.geometry=ue(b.geometry,l.TriangleFanDrawMode));else if(T.mode===K.LINES)b=new l.LineSegments(L,D);else if(T.mode===K.LINE_STRIP)b=new l.Line(L,D);else if(T.mode===K.LINE_LOOP)b=new l.LineLoop(L,D);else if(T.mode===K.POINTS)b=new l.Points(L,D);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+T.mode);Object.keys(b.geometry.morphAttributes).length>0&&be(b,t),b.name=t.name||"mesh_"+e,d.length>1&&(b.name+="_"+y),q(b,t),r.assignFinalMaterial(b),h.push(b)}if(h.length===1)return h[0];for(var k=new l.Group,y=0,_=h.length;y<_;y++)k.add(h[y]);return k})},F.prototype.loadCamera=function(e){var r,n=this.json.cameras[e],t=n[n.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?r=new l.PerspectiveCamera(l.MathUtils.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):n.type==="orthographic"&&(r=new l.OrthographicCamera(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),n.name&&(r.name=n.name),q(r,n),Promise.resolve(r)},F.prototype.loadSkin=function(e){var r=this.json.skins[e],n={joints:r.joints};return r.inverseBindMatrices===void 0?Promise.resolve(n):this.getDependency("accessor",r.inverseBindMatrices).then(function(t){return n.inverseBindMatrices=t,n})},F.prototype.loadAnimation=function(e){for(var r=this.json,n=r.animations[e],t=[],a=[],i=[],s=[],o=[],f=0,c=n.channels.length;f<c;f++){var v=n.channels[f],d=n.samplers[v.sampler],h=v.target,y=h.node!==void 0?h.node:h.id,_=n.parameters!==void 0?n.parameters[d.input]:d.input,L=n.parameters!==void 0?n.parameters[d.output]:d.output;t.push(this.getDependency("node",y)),a.push(this.getDependency("accessor",_)),i.push(this.getDependency("accessor",L)),s.push(d),o.push(h)}return Promise.all([Promise.all(t),Promise.all(a),Promise.all(i),Promise.all(s),Promise.all(o)]).then(function(T){for(var b=T[0],D=T[1],k=T[2],ae=T[3],se=T[4],re=[],j=0,le=b.length;j<le;j++){var E=b[j],Ie=D[j],oe=k[j],Ce=ae[j],xe=se[j];if(E!==void 0){E.updateMatrix(),E.matrixAutoUpdate=!0;var Ae;switch(z[xe.path]){case z.weights:Ae=l.NumberKeyframeTrack;break;case z.rotation:Ae=l.QuaternionKeyframeTrack;break;case z.position:case z.scale:default:Ae=l.VectorKeyframeTrack;break}var ke=E.name?E.name:E.uuid,Ee=Ce.interpolation!==void 0?_e[Ce.interpolation]:l.InterpolateLinear,Se=[];z[xe.path]===z.weights?E.traverse(function(pe){pe.isMesh===!0&&pe.morphTargetInfluences&&Se.push(pe.name?pe.name:pe.uuid)}):Se.push(ke);var Q=oe.array;if(oe.normalized){var de;if(Q.constructor===Int8Array)de=1/127;else if(Q.constructor===Uint8Array)de=1/255;else if(Q.constructor==Int16Array)de=1/32767;else if(Q.constructor===Uint16Array)de=1/65535;else throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");for(var Pe=new Float32Array(Q.length),te=0,Re=Q.length;te<Re;te++)Pe[te]=Q[te]*de;Q=Pe}for(var te=0,Re=Se.length;te<Re;te++){var Oe=new Ae(Se[te]+"."+z[xe.path],Ie.array,Q,Ee);Ce.interpolation==="CUBICSPLINE"&&(Oe.createInterpolant=function(Ke){return new U(this.times,this.values,this.getValueSize()/3,Ke)},Oe.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),re.push(Oe)}}}var Be=n.name?n.name:"animation_"+e;return new l.AnimationClip(Be,void 0,re)})},F.prototype.loadNode=function(e){var r=this.json,n=this.extensions,t=this,a=r.meshReferences,i=r.meshUses,s=r.nodes[e];return function(){var o=[];return s.mesh!==void 0&&o.push(t.getDependency("mesh",s.mesh).then(function(f){var c;if(a[s.mesh]>1){var v=i[s.mesh]++;c=f.clone(),c.name+="_instance_"+v}else c=f;return s.weights!==void 0&&c.traverse(function(d){if(d.isMesh)for(var h=0,y=s.weights.length;h<y;h++)d.morphTargetInfluences[h]=s.weights[h]}),c})),s.camera!==void 0&&o.push(t.getDependency("camera",s.camera)),s.extensions&&s.extensions[u.KHR_LIGHTS_PUNCTUAL]&&s.extensions[u.KHR_LIGHTS_PUNCTUAL].light!==void 0&&o.push(t.getDependency("light",s.extensions[u.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(o)}().then(function(o){var f;if(s.isBone===!0?f=new l.Bone:o.length>1?f=new l.Group:o.length===1?f=o[0]:f=new l.Object3D,f!==o[0])for(var c=0,v=o.length;c<v;c++)f.add(o[c]);if(s.name&&(f.userData.name=s.name,f.name=l.PropertyBinding.sanitizeNodeName(s.name)),q(f,s),s.extensions&&ie(n,f,s),s.matrix!==void 0){var d=new l.Matrix4;d.fromArray(s.matrix),f.applyMatrix4(d)}else s.translation!==void 0&&f.position.fromArray(s.translation),s.rotation!==void 0&&f.quaternion.fromArray(s.rotation),s.scale!==void 0&&f.scale.fromArray(s.scale);return t.associations.set(f,{type:"nodes",index:e}),f})},F.prototype.loadScene=function(){function e(r,n,t,a){var i=t.nodes[r];return a.getDependency("node",r).then(function(s){if(i.skin===void 0)return s;var o;return a.getDependency("skin",i.skin).then(function(f){o=f;for(var c=[],v=0,d=o.joints.length;v<d;v++)c.push(a.getDependency("node",o.joints[v]));return Promise.all(c)}).then(function(f){return s.traverse(function(c){if(c.isMesh){for(var v=[],d=[],h=0,y=f.length;h<y;h++){var _=f[h];if(_){v.push(_);var L=new l.Matrix4;o.inverseBindMatrices!==void 0&&L.fromArray(o.inverseBindMatrices.array,h*16),d.push(L)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',o.joints[h])}c.bind(new l.Skeleton(v,d),c.matrixWorld)}}),s})}).then(function(s){n.add(s);var o=[];if(i.children)for(var f=i.children,c=0,v=f.length;c<v;c++){var d=f[c];o.push(e(d,s,t,a))}return Promise.all(o)})}return function(n){var t=this.json,a=this.extensions,i=this.json.scenes[n],s=this,o=new l.Group;i.name&&(o.name=i.name),q(o,i),i.extensions&&ie(a,o,i);for(var f=i.nodes||[],c=[],v=0,d=f.length;v<d;v++)c.push(e(f[v],o,t,s));return Promise.all(c).then(function(){return o})}}(),p}(),B=function(p){l.Loader.call(this,p),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};B.prototype=Object.assign(Object.create(l.Loader.prototype),{constructor:B,setDecoderPath:function(p){return this.decoderPath=p,this},setDecoderConfig:function(p){return this.decoderConfig=p,this},setWorkerLimit:function(p){return this.workerLimit=p,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(p,g,u,A){var m=new l.FileLoader(this.manager);m.setPath(this.path),m.setResponseType("arraybuffer"),this.crossOrigin==="use-credentials"&&m.setWithCredentials(!0),m.load(p,S=>{var M={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(S,M).then(g).catch(A)},u,A)},decodeDracoFile:function(p,g,u,A){var m={attributeIDs:u||this.defaultAttributeIDs,attributeTypes:A||this.defaultAttributeTypes,useUniqueIDs:!!u};this.decodeGeometry(p,m).then(g)},decodeGeometry:function(p,g){for(var u in g.attributeTypes){var A=g.attributeTypes[u];A.BYTES_PER_ELEMENT!==void 0&&(g.attributeTypes[u]=A.name)}var m=JSON.stringify(g);if(B.taskCache.has(p)){var S=B.taskCache.get(p);if(S.key===m)return S.promise;if(p.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var M,O=this.workerNextTaskID++,P=p.byteLength,w=this._getWorker(O,P).then(x=>(M=x,new Promise((G,R)=>{M._callbacks[O]={resolve:G,reject:R},M.postMessage({type:"decode",id:O,taskConfig:g,buffer:p},[p])}))).then(x=>this._createGeometry(x.geometry));return w.catch(()=>!0).then(()=>{M&&O&&this._releaseTask(M,O)}),B.taskCache.set(p,{key:m,promise:w}),w},_createGeometry:function(p){var g=new l.BufferGeometry;p.index&&g.setIndex(new l.BufferAttribute(p.index.array,1));for(var u=0;u<p.attributes.length;u++){var A=p.attributes[u],m=A.name,S=A.array,M=A.itemSize;g.setAttribute(m,new l.BufferAttribute(S,M))}return g},_loadLibrary:function(p,g){var u=new l.FileLoader(this.manager);return u.setPath(this.decoderPath),u.setResponseType(g),new Promise((A,m)=>{u.load(p,A,void 0,m)})},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var p=typeof WebAssembly!="object"||this.decoderConfig.type==="js",g=[];return p?g.push(this._loadLibrary("draco_decoder.js","text")):(g.push(this._loadLibrary("draco_wasm_wrapper.js","text")),g.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(g).then(u=>{var A=u[0];p||(this.decoderConfig.wasmBinary=u[1]);var m=B.DRACOWorker.toString(),S=["/* draco decoder */",A,"","/* worker */",m.substring(m.indexOf("{")+1,m.lastIndexOf("}"))].join(`
|
|
261
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([S]))}),this.decoderPending},_getWorker:function(p,g){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){var u=new Worker(this.workerSourceURL);u._callbacks={},u._taskCosts={},u._taskLoad=0,u.postMessage({type:"init",decoderConfig:this.decoderConfig}),u.onmessage=function(m){var S=m.data;switch(S.type){case"decode":u._callbacks[S.id].resolve(S);break;case"error":u._callbacks[S.id].reject(S);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+S.type+'"')}},this.workerPool.push(u)}else this.workerPool.sort(function(A,m){return A._taskLoad>m._taskLoad?-1:1});var u=this.workerPool[this.workerPool.length-1];return u._taskCosts[p]=g,u._taskLoad+=g,u})},_releaseTask:function(p,g){p._taskLoad-=p._taskCosts[g],delete p._callbacks[g],delete p._taskCosts[g]},debug:function(){console.log("Task load: ",this.workerPool.map(p=>p._taskLoad))},dispose:function(){for(var p=0;p<this.workerPool.length;++p)this.workerPool[p].terminate();return this.workerPool.length=0,this}}),B.DRACOWorker=function(){var p,g;onmessage=function(m){var S=m.data;switch(S.type){case"init":p=S.decoderConfig,g=new Promise(function(P){p.onModuleLoaded=function(w){P({draco:w})},DracoDecoderModule(p)});break;case"decode":var M=S.buffer,O=S.taskConfig;g.then(P=>{var w=P.draco,x=new w.Decoder,G=new w.DecoderBuffer;G.Init(new Int8Array(M),M.byteLength);try{var R=u(w,x,G,O),I=R.attributes.map(C=>C.array.buffer);R.index&&I.push(R.index.array.buffer),self.postMessage({type:"decode",id:S.id,geometry:R},I)}catch(C){console.error(C),self.postMessage({type:"error",id:S.id,error:C.message})}finally{w.destroy(G),w.destroy(x)}});break}};function u(m,S,M,O){var P=O.attributeIDs,w=O.attributeTypes,x,G,R=S.GetEncodedGeometryType(M);if(R===m.TRIANGULAR_MESH)x=new m.Mesh,G=S.DecodeBufferToMesh(M,x);else if(R===m.POINT_CLOUD)x=new m.PointCloud,G=S.DecodeBufferToPointCloud(M,x);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!G.ok()||x.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+G.error_msg());var I={index:null,attributes:[]};for(var C in P){var X=self[w[C]],ne,U;if(O.useUniqueIDs)U=P[C],ne=S.GetAttributeByUniqueId(x,U);else{if(U=S.GetAttributeId(x,m[P[C]]),U===-1)continue;ne=S.GetAttribute(x,U)}I.attributes.push(A(m,S,x,C,X,ne))}if(R===m.TRIANGULAR_MESH){for(var Z=x.num_faces(),K=Z*3,$=new Uint32Array(K),ee=new m.DracoInt32Array,H=0;H<Z;++H){S.GetFaceFromMesh(x,H,ee);for(var Y=0;Y<3;++Y)$[H*3+Y]=ee.GetValue(Y)}I.index={array:$,itemSize:1},m.destroy(ee)}return m.destroy(x),I}function A(m,S,M,O,P,w){var x=w.num_components(),G=M.num_points(),R=G*x,I,C;switch(P){case Float32Array:I=new m.DracoFloat32Array,S.GetAttributeFloatForAllPoints(M,w,I),C=new Float32Array(R);break;case Int8Array:I=new m.DracoInt8Array,S.GetAttributeInt8ForAllPoints(M,w,I),C=new Int8Array(R);break;case Int16Array:I=new m.DracoInt16Array,S.GetAttributeInt16ForAllPoints(M,w,I),C=new Int16Array(R);break;case Int32Array:I=new m.DracoInt32Array,S.GetAttributeInt32ForAllPoints(M,w,I),C=new Int32Array(R);break;case Uint8Array:I=new m.DracoUInt8Array,S.GetAttributeUInt8ForAllPoints(M,w,I),C=new Uint8Array(R);break;case Uint16Array:I=new m.DracoUInt16Array,S.GetAttributeUInt16ForAllPoints(M,w,I),C=new Uint16Array(R);break;case Uint32Array:I=new m.DracoUInt32Array,S.GetAttributeUInt32ForAllPoints(M,w,I),C=new Uint32Array(R);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var X=0;X<R;X++)C[X]=I.GetValue(X);return m.destroy(I),{name:O,array:C,itemSize:x}}},B.taskCache=new WeakMap,B.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},B.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},B.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},B.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var he=function(p){l.CompressedTextureLoader.call(this,p)};he.prototype=Object.assign(Object.create(l.CompressedTextureLoader.prototype),{constructor:he,parse:function(p,g){var u={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},A=542327876,m=131072,S=512,M=1024,O=2048,P=4096,w=8192,x=16384,G=32768,R=4;function I(f){return f.charCodeAt(0)+(f.charCodeAt(1)<<8)+(f.charCodeAt(2)<<16)+(f.charCodeAt(3)<<24)}function C(f){return String.fromCharCode(f&255,f>>8&255,f>>16&255,f>>24&255)}function X(f,c,v,d){for(var h=v*d*4,y=new Uint8Array(f,c,h),_=new Uint8Array(h),L=0,T=0,b=0;b<d;b++)for(var D=0;D<v;D++){var k=y[T];T++;var ae=y[T];T++;var se=y[T];T++;var re=y[T];T++,_[L]=se,L++,_[L]=ae,L++,_[L]=k,L++,_[L]=re,L++}return _}var ne=I("DXT1"),U=I("DXT3"),Z=I("DXT5"),K=I("ETC1"),$=31,ee=0,H=1,Y=2,fe=3,z=4,_e=7,ce=20,ve=21,ge=22,Me=23,ie=24,q=25,we=26,be=28,N=new Int32Array(p,0,$);if(N[ee]!==A)return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),u;if(!N[ce]&R)return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),u;var J,F=N[ve],me=!1;switch(F){case ne:J=8,u.format=l.RGB_S3TC_DXT1_Format;break;case U:J=16,u.format=l.RGBA_S3TC_DXT3_Format;break;case Z:J=16,u.format=l.RGBA_S3TC_DXT5_Format;break;case K:J=8,u.format=l.RGB_ETC1_Format;break;default:if(N[ge]===32&&N[Me]&16711680&&N[ie]&65280&&N[q]&255&&N[we]&4278190080)me=!0,J=64,u.format=l.RGBAFormat;else return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",C(F)),u}u.mipmapCount=1,N[Y]&m&&g!==!1&&(u.mipmapCount=Math.max(1,N[_e]));var W=N[be];if(u.isCubemap=!!(W&S),u.isCubemap&&(!(W&M)||!(W&O)||!(W&P)||!(W&w)||!(W&x)||!(W&G)))return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),u;u.width=N[z],u.height=N[fe];for(var ue=N[H]+4,e=u.isCubemap?6:1,r=0;r<e;r++)for(var n=u.width,t=u.height,a=0;a<u.mipmapCount;a++){if(me)var i=X(p,ue,n,t),s=i.length;else var s=Math.max(4,n)/4*Math.max(4,t)/4*J,i=new Uint8Array(p,ue,s);var o={data:i,width:n,height:t};u.mipmaps.push(o),ue+=s,n=Math.max(n>>1,1),t=Math.max(t>>1,1)}return u}});var Le=function(p){Fe(g,p);function g(u){var A=p.call(this)||this;return A.needsRender=!0,u&&u.children.length&&A.add.apply(A,u.children),A.mixer=new ye.AnimationMixer(A),A}return g.prototype.clone=function(){var u=p.prototype.clone.call(this,!0),A=new ye.AnimationMixer(u);return u.mixer=A,u.needsRender=!0,u},g}(ye.Group),Ge="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",Ne=function(p){Fe(g,p);function g(u){var A=p.call(this,u)||this;return A.ddsLoader=new he(u),A.dracoLoader=new B(u),A.dracoLoader.setDecoderPath(Ge),A}return Object.defineProperty(g,"version",{get:function(){return"6.4.
|
|
261
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([S]))}),this.decoderPending},_getWorker:function(p,g){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){var u=new Worker(this.workerSourceURL);u._callbacks={},u._taskCosts={},u._taskLoad=0,u.postMessage({type:"init",decoderConfig:this.decoderConfig}),u.onmessage=function(m){var S=m.data;switch(S.type){case"decode":u._callbacks[S.id].resolve(S);break;case"error":u._callbacks[S.id].reject(S);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+S.type+'"')}},this.workerPool.push(u)}else this.workerPool.sort(function(A,m){return A._taskLoad>m._taskLoad?-1:1});var u=this.workerPool[this.workerPool.length-1];return u._taskCosts[p]=g,u._taskLoad+=g,u})},_releaseTask:function(p,g){p._taskLoad-=p._taskCosts[g],delete p._callbacks[g],delete p._taskCosts[g]},debug:function(){console.log("Task load: ",this.workerPool.map(p=>p._taskLoad))},dispose:function(){for(var p=0;p<this.workerPool.length;++p)this.workerPool[p].terminate();return this.workerPool.length=0,this}}),B.DRACOWorker=function(){var p,g;onmessage=function(m){var S=m.data;switch(S.type){case"init":p=S.decoderConfig,g=new Promise(function(P){p.onModuleLoaded=function(w){P({draco:w})},DracoDecoderModule(p)});break;case"decode":var M=S.buffer,O=S.taskConfig;g.then(P=>{var w=P.draco,x=new w.Decoder,G=new w.DecoderBuffer;G.Init(new Int8Array(M),M.byteLength);try{var R=u(w,x,G,O),I=R.attributes.map(C=>C.array.buffer);R.index&&I.push(R.index.array.buffer),self.postMessage({type:"decode",id:S.id,geometry:R},I)}catch(C){console.error(C),self.postMessage({type:"error",id:S.id,error:C.message})}finally{w.destroy(G),w.destroy(x)}});break}};function u(m,S,M,O){var P=O.attributeIDs,w=O.attributeTypes,x,G,R=S.GetEncodedGeometryType(M);if(R===m.TRIANGULAR_MESH)x=new m.Mesh,G=S.DecodeBufferToMesh(M,x);else if(R===m.POINT_CLOUD)x=new m.PointCloud,G=S.DecodeBufferToPointCloud(M,x);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!G.ok()||x.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+G.error_msg());var I={index:null,attributes:[]};for(var C in P){var X=self[w[C]],ne,U;if(O.useUniqueIDs)U=P[C],ne=S.GetAttributeByUniqueId(x,U);else{if(U=S.GetAttributeId(x,m[P[C]]),U===-1)continue;ne=S.GetAttribute(x,U)}I.attributes.push(A(m,S,x,C,X,ne))}if(R===m.TRIANGULAR_MESH){for(var Z=x.num_faces(),K=Z*3,$=new Uint32Array(K),ee=new m.DracoInt32Array,H=0;H<Z;++H){S.GetFaceFromMesh(x,H,ee);for(var Y=0;Y<3;++Y)$[H*3+Y]=ee.GetValue(Y)}I.index={array:$,itemSize:1},m.destroy(ee)}return m.destroy(x),I}function A(m,S,M,O,P,w){var x=w.num_components(),G=M.num_points(),R=G*x,I,C;switch(P){case Float32Array:I=new m.DracoFloat32Array,S.GetAttributeFloatForAllPoints(M,w,I),C=new Float32Array(R);break;case Int8Array:I=new m.DracoInt8Array,S.GetAttributeInt8ForAllPoints(M,w,I),C=new Int8Array(R);break;case Int16Array:I=new m.DracoInt16Array,S.GetAttributeInt16ForAllPoints(M,w,I),C=new Int16Array(R);break;case Int32Array:I=new m.DracoInt32Array,S.GetAttributeInt32ForAllPoints(M,w,I),C=new Int32Array(R);break;case Uint8Array:I=new m.DracoUInt8Array,S.GetAttributeUInt8ForAllPoints(M,w,I),C=new Uint8Array(R);break;case Uint16Array:I=new m.DracoUInt16Array,S.GetAttributeUInt16ForAllPoints(M,w,I),C=new Uint16Array(R);break;case Uint32Array:I=new m.DracoUInt32Array,S.GetAttributeUInt32ForAllPoints(M,w,I),C=new Uint32Array(R);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var X=0;X<R;X++)C[X]=I.GetValue(X);return m.destroy(I),{name:O,array:C,itemSize:x}}},B.taskCache=new WeakMap,B.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},B.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},B.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},B.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var he=function(p){l.CompressedTextureLoader.call(this,p)};he.prototype=Object.assign(Object.create(l.CompressedTextureLoader.prototype),{constructor:he,parse:function(p,g){var u={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},A=542327876,m=131072,S=512,M=1024,O=2048,P=4096,w=8192,x=16384,G=32768,R=4;function I(f){return f.charCodeAt(0)+(f.charCodeAt(1)<<8)+(f.charCodeAt(2)<<16)+(f.charCodeAt(3)<<24)}function C(f){return String.fromCharCode(f&255,f>>8&255,f>>16&255,f>>24&255)}function X(f,c,v,d){for(var h=v*d*4,y=new Uint8Array(f,c,h),_=new Uint8Array(h),L=0,T=0,b=0;b<d;b++)for(var D=0;D<v;D++){var k=y[T];T++;var ae=y[T];T++;var se=y[T];T++;var re=y[T];T++,_[L]=se,L++,_[L]=ae,L++,_[L]=k,L++,_[L]=re,L++}return _}var ne=I("DXT1"),U=I("DXT3"),Z=I("DXT5"),K=I("ETC1"),$=31,ee=0,H=1,Y=2,fe=3,z=4,_e=7,ce=20,ve=21,ge=22,Me=23,ie=24,q=25,we=26,be=28,N=new Int32Array(p,0,$);if(N[ee]!==A)return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),u;if(!N[ce]&R)return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),u;var J,F=N[ve],me=!1;switch(F){case ne:J=8,u.format=l.RGB_S3TC_DXT1_Format;break;case U:J=16,u.format=l.RGBA_S3TC_DXT3_Format;break;case Z:J=16,u.format=l.RGBA_S3TC_DXT5_Format;break;case K:J=8,u.format=l.RGB_ETC1_Format;break;default:if(N[ge]===32&&N[Me]&16711680&&N[ie]&65280&&N[q]&255&&N[we]&4278190080)me=!0,J=64,u.format=l.RGBAFormat;else return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",C(F)),u}u.mipmapCount=1,N[Y]&m&&g!==!1&&(u.mipmapCount=Math.max(1,N[_e]));var W=N[be];if(u.isCubemap=!!(W&S),u.isCubemap&&(!(W&M)||!(W&O)||!(W&P)||!(W&w)||!(W&x)||!(W&G)))return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),u;u.width=N[z],u.height=N[fe];for(var ue=N[H]+4,e=u.isCubemap?6:1,r=0;r<e;r++)for(var n=u.width,t=u.height,a=0;a<u.mipmapCount;a++){if(me)var i=X(p,ue,n,t),s=i.length;else var s=Math.max(4,n)/4*Math.max(4,t)/4*J,i=new Uint8Array(p,ue,s);var o={data:i,width:n,height:t};u.mipmaps.push(o),ue+=s,n=Math.max(n>>1,1),t=Math.max(t>>1,1)}return u}});var Le=function(p){Fe(g,p);function g(u){var A=p.call(this)||this;return A.needsRender=!0,u&&u.children.length&&A.add.apply(A,u.children),A.mixer=new ye.AnimationMixer(A),A}return g.prototype.clone=function(){var u=p.prototype.clone.call(this,!0),A=new ye.AnimationMixer(u);return u.mixer=A,u.needsRender=!0,u},g}(ye.Group),Ge="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",Ne=function(p){Fe(g,p);function g(u){var A=p.call(this,u)||this;return A.ddsLoader=new he(u),A.dracoLoader=new B(u),A.dracoLoader.setDecoderPath(Ge),A}return Object.defineProperty(g,"version",{get:function(){return"6.4.4"},enumerable:!1,configurable:!0}),g.prototype.load=function(u,A,m,S){return p.prototype.load.call(this,u,A,m,S)},g.prototype.parse=function(u,A,m,S){return p.prototype.parse.call(this,u,A,function(M){var O=new Le(M.scene),P=M.scenes.map(function(w){return w===M.scene?O:new Le(w)});m(Object.assign(M,{scene:O,scenes:P}))},S)},g}(De);V.DDSLoader=he,V.DRACOLoader=B,V.GLTFLoader=Ne,V.GLTFObject=Le,V.THREEGLTFLoader=De,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})});
|