@ridp/threejs 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ImageLoader-6mmE7g5P.cjs +24 -0
- package/dist/ImageLoader-CnBqJLru.js +1444 -0
- package/dist/PredictiveLoader-DTN7SDRI.js +3842 -0
- package/dist/PredictiveLoader-KOCZXzGy.cjs +2 -0
- package/dist/assets/{gltfParser.worker-Bqz8BBJx.js → gltfParser.worker-D2lwod50.js} +2 -2
- package/dist/assets/{gltfParserOptimized.worker-DfipxPjm.js → gltfParserOptimized.worker-yo8WMPFM.js} +2 -2
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.js +9 -12
- package/dist/{packages/threejs/src/utils/modelOptimizer.js → modelOptimizer-D6fRg-DF.js} +1 -1
- package/dist/threejs.cjs +3 -1
- package/dist/threejs.js +428 -58
- package/dist/useBatchGLTFLoader-19GZ1dxv.cjs +5 -0
- package/dist/useBatchGLTFLoader-DPT0_95u.js +493 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +32 -40
- package/package.json +1 -1
- package/dist/packages/threejs/package.json.cjs +0 -1
- package/dist/packages/threejs/package.json.js +0 -4
- package/dist/packages/threejs/src/hooks/useBatchGLTFLoader.cjs +0 -1
- package/dist/packages/threejs/src/hooks/useBatchGLTFLoader.js +0 -83
- package/dist/packages/threejs/src/hooks/useGLTFLoader.cjs +0 -1
- package/dist/packages/threejs/src/hooks/useGLTFLoader.js +0 -292
- package/dist/packages/threejs/src/hooks/useObb.cjs +0 -1
- package/dist/packages/threejs/src/hooks/useObb.js +0 -41
- package/dist/packages/threejs/src/hooks/useRaycaster.cjs +0 -1
- package/dist/packages/threejs/src/hooks/useRaycaster.js +0 -35
- package/dist/packages/threejs/src/hooks/useThreeJs.cjs +0 -5
- package/dist/packages/threejs/src/hooks/useThreeJs.js +0 -153
- package/dist/packages/threejs/src/instance/IDBCache.cjs +0 -1
- package/dist/packages/threejs/src/instance/IDBCache.js +0 -142
- package/dist/packages/threejs/src/instance/threeIns.cjs +0 -3
- package/dist/packages/threejs/src/instance/threeIns.js +0 -393
- package/dist/packages/threejs/src/utils/CacheMonitor.cjs +0 -1
- package/dist/packages/threejs/src/utils/CacheMonitor.js +0 -125
- package/dist/packages/threejs/src/utils/ImageLoader.cjs +0 -1
- package/dist/packages/threejs/src/utils/ImageLoader.js +0 -33
- package/dist/packages/threejs/src/utils/PredictiveLoader.cjs +0 -1
- package/dist/packages/threejs/src/utils/PredictiveLoader.js +0 -155
- package/dist/packages/threejs/src/utils/RetryHelper.cjs +0 -1
- package/dist/packages/threejs/src/utils/RetryHelper.js +0 -108
- package/dist/packages/threejs/src/utils/common.cjs +0 -1
- package/dist/packages/threejs/src/utils/common.js +0 -15
- package/dist/packages/threejs/src/utils/css3dHelper.cjs +0 -15
- package/dist/packages/threejs/src/utils/css3dHelper.js +0 -42
- package/dist/packages/threejs/src/utils/disposeObject.cjs +0 -1
- package/dist/packages/threejs/src/utils/disposeObject.js +0 -13
- package/dist/packages/threejs/src/utils/helper.cjs +0 -1
- package/dist/packages/threejs/src/utils/helper.js +0 -47
- package/dist/packages/threejs/src/utils/modelSerialize.cjs +0 -1
- package/dist/packages/threejs/src/utils/modelSerialize.js +0 -225
- package/dist/packages/threejs/src/utils/sceneRebuilder.cjs +0 -1
- package/dist/packages/threejs/src/utils/sceneRebuilder.js +0 -138
- package/dist/packages/threejs/src/workers/gltfParser.worker.cjs +0 -1
- package/dist/packages/threejs/src/workers/gltfParser.worker.js +0 -11
- package/dist/packages/threejs/src/workers/gltfParserOptimized.worker.cjs +0 -1
- package/dist/packages/threejs/src/workers/gltfParserOptimized.worker.js +0 -11
- /package/dist/{packages/threejs/src/utils/modelOptimizer.cjs → modelOptimizer-A0Cs6f9e.cjs} +0 -0
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import * as l from "three";
|
|
2
|
-
const f = {};
|
|
3
|
-
async function D(e, s = 50) {
|
|
4
|
-
const t = {
|
|
5
|
-
type: e.type,
|
|
6
|
-
name: e.name,
|
|
7
|
-
position: e.position.toArray(),
|
|
8
|
-
rotation: e.rotation.toArray(),
|
|
9
|
-
scale: e.scale.toArray(),
|
|
10
|
-
visible: e.visible,
|
|
11
|
-
children: [],
|
|
12
|
-
geometry: null,
|
|
13
|
-
material: null,
|
|
14
|
-
userData: e.userData
|
|
15
|
-
};
|
|
16
|
-
e.isMesh && (t.geometry = y(e.geometry), t.material = u(e.material));
|
|
17
|
-
const a = [{ object: e, parentData: t }];
|
|
18
|
-
let i = 0;
|
|
19
|
-
for (; a.length > 0; ) {
|
|
20
|
-
const { object: r, parentData: n } = a.pop();
|
|
21
|
-
for (const o of r.children) {
|
|
22
|
-
const c = {
|
|
23
|
-
type: o.type,
|
|
24
|
-
name: o.name,
|
|
25
|
-
position: o.position.toArray(),
|
|
26
|
-
rotation: o.rotation.toArray(),
|
|
27
|
-
scale: o.scale.toArray(),
|
|
28
|
-
visible: o.visible,
|
|
29
|
-
children: [],
|
|
30
|
-
geometry: null,
|
|
31
|
-
material: null,
|
|
32
|
-
userData: o.userData
|
|
33
|
-
};
|
|
34
|
-
o.isMesh && (c.geometry = y(o.geometry), c.material = u(o.material)), n.children.push(c), a.push({ object: o, parentData: c }), i++, i % s === 0 && await new Promise((p) => requestAnimationFrame(p));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return t;
|
|
38
|
-
}
|
|
39
|
-
function A(e) {
|
|
40
|
-
const s = {
|
|
41
|
-
type: e.type,
|
|
42
|
-
name: e.name,
|
|
43
|
-
position: e.position.toArray(),
|
|
44
|
-
rotation: e.rotation.toArray(),
|
|
45
|
-
scale: e.scale.toArray(),
|
|
46
|
-
visible: e.visible,
|
|
47
|
-
children: [],
|
|
48
|
-
geometry: null,
|
|
49
|
-
material: null,
|
|
50
|
-
userData: e.userData
|
|
51
|
-
};
|
|
52
|
-
e.isMesh && (s.geometry = y(e.geometry), s.material = u(e.material));
|
|
53
|
-
const t = [{ object: e, parentData: s }];
|
|
54
|
-
for (; t.length > 0; ) {
|
|
55
|
-
const { object: a, parentData: i } = t.pop();
|
|
56
|
-
for (const r of a.children) {
|
|
57
|
-
const n = {
|
|
58
|
-
type: r.type,
|
|
59
|
-
name: r.name,
|
|
60
|
-
position: r.position.toArray(),
|
|
61
|
-
rotation: r.rotation.toArray(),
|
|
62
|
-
scale: r.scale.toArray(),
|
|
63
|
-
visible: r.visible,
|
|
64
|
-
children: [],
|
|
65
|
-
geometry: null,
|
|
66
|
-
material: null,
|
|
67
|
-
userData: r.userData
|
|
68
|
-
};
|
|
69
|
-
r.isMesh && (n.geometry = y(r.geometry), n.material = u(r.material)), i.children.push(n), t.push({ object: r, parentData: n });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return s;
|
|
73
|
-
}
|
|
74
|
-
async function w(e, s = 50) {
|
|
75
|
-
const t = [];
|
|
76
|
-
let a;
|
|
77
|
-
switch (e.type) {
|
|
78
|
-
case "Mesh":
|
|
79
|
-
const r = m(e.geometry), n = h(e.material);
|
|
80
|
-
a = new l.Mesh(r, n);
|
|
81
|
-
break;
|
|
82
|
-
case "Group":
|
|
83
|
-
a = new l.Group();
|
|
84
|
-
break;
|
|
85
|
-
case "Object3D":
|
|
86
|
-
a = new l.Object3D();
|
|
87
|
-
break;
|
|
88
|
-
default:
|
|
89
|
-
return console.warn(`Unsupported object type: ${e.type}`), null;
|
|
90
|
-
}
|
|
91
|
-
a.name = e.name, a.position.fromArray(e.position), a.rotation.fromArray(e.rotation), a.scale.fromArray(e.scale), a.visible = e.visible, a.userData = e.userData, t.push({ data: e, object: a });
|
|
92
|
-
let i = 0;
|
|
93
|
-
for (; t.length > 0; ) {
|
|
94
|
-
const { data: r, object: n } = t.pop();
|
|
95
|
-
for (const o of [...r.children].reverse()) {
|
|
96
|
-
let c;
|
|
97
|
-
switch (o.type) {
|
|
98
|
-
case "Mesh":
|
|
99
|
-
const p = m(o.geometry), b = h(o.material);
|
|
100
|
-
c = new l.Mesh(p, b);
|
|
101
|
-
break;
|
|
102
|
-
case "Group":
|
|
103
|
-
c = new l.Group();
|
|
104
|
-
break;
|
|
105
|
-
case "Object3D":
|
|
106
|
-
c = new l.Object3D();
|
|
107
|
-
break;
|
|
108
|
-
default:
|
|
109
|
-
console.warn(`Unsupported object type: ${o.type}`);
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
c && (c.name = o.name, c.position.fromArray(o.position), c.rotation.fromArray(o.rotation), c.scale.fromArray(o.scale), c.visible = o.visible, c.userData = o.userData, n.add(c), t.push({ data: o, object: c }), i++, i % s === 0 && await new Promise((p) => requestAnimationFrame(p)));
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return a;
|
|
116
|
-
}
|
|
117
|
-
function d(e) {
|
|
118
|
-
const s = [];
|
|
119
|
-
let t;
|
|
120
|
-
switch (e.type) {
|
|
121
|
-
case "Mesh":
|
|
122
|
-
const a = m(e.geometry), i = h(e.material);
|
|
123
|
-
t = new l.Mesh(a, i);
|
|
124
|
-
break;
|
|
125
|
-
case "Group":
|
|
126
|
-
t = new l.Group();
|
|
127
|
-
break;
|
|
128
|
-
case "Object3D":
|
|
129
|
-
t = new l.Object3D();
|
|
130
|
-
break;
|
|
131
|
-
default:
|
|
132
|
-
return console.warn(`Unsupported object type: ${e.type}`), null;
|
|
133
|
-
}
|
|
134
|
-
for (t.name = e.name, t.position.fromArray(e.position), t.rotation.fromArray(e.rotation), t.scale.fromArray(e.scale), t.visible = e.visible, t.userData = e.userData, s.push({ data: e, object: t }); s.length > 0; ) {
|
|
135
|
-
const { data: a, object: i } = s.pop();
|
|
136
|
-
for (const r of [...a.children].reverse()) {
|
|
137
|
-
let n;
|
|
138
|
-
switch (r.type) {
|
|
139
|
-
case "Mesh":
|
|
140
|
-
const o = m(r.geometry), c = h(r.material);
|
|
141
|
-
n = new l.Mesh(o, c);
|
|
142
|
-
break;
|
|
143
|
-
case "Group":
|
|
144
|
-
n = new l.Group();
|
|
145
|
-
break;
|
|
146
|
-
case "Object3D":
|
|
147
|
-
n = new l.Object3D();
|
|
148
|
-
break;
|
|
149
|
-
default:
|
|
150
|
-
console.warn(`Unsupported object type: ${r.type}`);
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
n && (n.name = r.name, n.position.fromArray(r.position), n.rotation.fromArray(r.rotation), n.scale.fromArray(r.scale), n.visible = r.visible, n.userData = r.userData, i.add(n), s.push({ data: r, object: n }));
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return t;
|
|
157
|
-
}
|
|
158
|
-
function y(e) {
|
|
159
|
-
const s = {}, { attributes: t, index: a, type: i } = e;
|
|
160
|
-
t.position && (s.position = {
|
|
161
|
-
type: "Float32Array",
|
|
162
|
-
array: Array.from(t.position.array),
|
|
163
|
-
itemSize: 3
|
|
164
|
-
}), t.normal && (s.normal = {
|
|
165
|
-
type: "Float32Array",
|
|
166
|
-
array: Array.from(t.normal.array),
|
|
167
|
-
itemSize: 3
|
|
168
|
-
}), t.uv && (s.uv = {
|
|
169
|
-
type: "Float32Array",
|
|
170
|
-
array: Array.from(t.uv.array),
|
|
171
|
-
itemSize: 2
|
|
172
|
-
});
|
|
173
|
-
const r = {
|
|
174
|
-
type: i,
|
|
175
|
-
attributes: s
|
|
176
|
-
};
|
|
177
|
-
return a && a.array && (r.index = {
|
|
178
|
-
type: "Uint32Array",
|
|
179
|
-
array: Array.from(a.array),
|
|
180
|
-
itemSize: 1
|
|
181
|
-
}), r;
|
|
182
|
-
}
|
|
183
|
-
function m(e) {
|
|
184
|
-
const { type: s, attributes: t, index: a } = e, i = new l.BufferGeometry();
|
|
185
|
-
for (const r in t)
|
|
186
|
-
if (t.hasOwnProperty(r)) {
|
|
187
|
-
const { type: n, array: o, itemSize: c } = t[r];
|
|
188
|
-
i.setAttribute(
|
|
189
|
-
r,
|
|
190
|
-
new l.BufferAttribute(new Float32Array(o), c)
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
return a && i.setIndex(a.array), i;
|
|
194
|
-
}
|
|
195
|
-
function u(e) {
|
|
196
|
-
return {
|
|
197
|
-
type: e.type,
|
|
198
|
-
color: e.color.getHex(),
|
|
199
|
-
map: e.map ? e.map.image.src : null,
|
|
200
|
-
opacity: e.opacity,
|
|
201
|
-
name: e.name,
|
|
202
|
-
depthTest: e.depthTest,
|
|
203
|
-
depthWrite: e.depthWrite,
|
|
204
|
-
transparent: e.transparent,
|
|
205
|
-
side: e.side,
|
|
206
|
-
roughness: e.roughness,
|
|
207
|
-
metalness: e.metalness,
|
|
208
|
-
emissive: e.emissive.getHex()
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
function h(e) {
|
|
212
|
-
if (f[e.name]) return f[e.name];
|
|
213
|
-
const { type: s, ...t } = e, a = s || "MeshStandardMaterial", i = new l[a]({ ...t });
|
|
214
|
-
if (e.map) {
|
|
215
|
-
const r = new l.TextureLoader().load(e.map);
|
|
216
|
-
i.map = r;
|
|
217
|
-
}
|
|
218
|
-
return i.needsUpdate = !0, f[e.name] = i, i;
|
|
219
|
-
}
|
|
220
|
-
export {
|
|
221
|
-
w as dataToObject3D,
|
|
222
|
-
d as dataToObject3DSync,
|
|
223
|
-
D as object3DToData,
|
|
224
|
-
A as object3DToDataSync
|
|
225
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("three");function y(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(i,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return i.default=e,Object.freeze(i)}const o=y(a);function h(e){const{geometries:i,materials:r,hierarchy:n}=e,c=new Map;i.forEach((s,t)=>{const u=b(s);c.set(t,u)});const f=new Map;r.forEach((s,t)=>{const u=g(s);f.set(t,u)});const l=new o.Group;l.name="Scene";const d=new Map;return n.forEach(s=>{let t;if(s.type==="Mesh"){const u=s.geometryIndex>=0?c.get(s.geometryIndex):null,p=s.materialIndex>=0?f.get(s.materialIndex):null;t=new o.Mesh(u,p)}else s.type==="Group"?t=new o.Group:s.type==="Object3D"?t=new o.Object3D:t=new o.Object3D;t.name=s.name,t.position.fromArray(s.position),t.rotation.fromArray(s.rotation),t.scale.fromArray(s.scale),t.visible=s.visible,d.set(s.id,t)}),n.forEach(s=>{const t=d.get(s.id);if(s.parentId!==null){const u=d.get(s.parentId);u&&u.add(t)}else l.add(t)}),l}function b(e){const i=new o.BufferGeometry;for(const r in e.attributes){const n=e.attributes[r],c=n.array;let f;if(c.byteLength===0){console.warn(`[ sceneRebuilder ] 属性 ${r} 的数组为空`);continue}if(c.buffer&&c.buffer.byteLength===0){console.warn(`[ sceneRebuilder ] 属性 ${r} 的 buffer 已被转移,尝试重建`);continue}f=c;const l=new o.BufferAttribute(f,n.itemSize);l.normalized=n.normalized,i.setAttribute(r,l)}if(e.index){const r=e.index,n=r.array;if(n&&n.byteLength>0){const c=new o.BufferAttribute(n,r.itemSize);i.setIndex(c)}}return i}function g(e){let i;const r={color:e.color!==void 0?e.color:16777215,opacity:e.opacity!==void 0?e.opacity:1,transparent:e.transparent!==void 0?e.transparent:!1,alphaTest:e.alphaTest!==void 0?e.alphaTest:0,side:e.side!==void 0?e.side:o.FrontSide,depthTest:e.depthTest!==void 0?e.depthTest:!0,depthWrite:e.depthWrite!==void 0?e.depthWrite:!0,wireframe:e.wireframe!==void 0?e.wireframe:!1,vertexColors:e.vertexColors!==void 0?e.vertexColors:!1};switch(e.type){case"MeshStandardMaterial":i=new o.MeshStandardMaterial({...r,roughness:e.roughness!==void 0?e.roughness:.5,metalness:e.metalness!==void 0?e.metalness:.5,emissive:e.emissive!==void 0?e.emissive:0,emissiveIntensity:e.emissiveIntensity!==void 0?e.emissiveIntensity:1});break;case"MeshBasicMaterial":i=new o.MeshBasicMaterial({...r});break;case"MeshPhongMaterial":i=new o.MeshPhongMaterial({...r,shininess:e.shininess!==void 0?e.shininess:30,specular:e.specular!==void 0?e.specular:1118481,emissive:e.emissive!==void 0?e.emissive:0,emissiveIntensity:e.emissiveIntensity!==void 0?e.emissiveIntensity:1});break;default:i=new o.MeshStandardMaterial(r)}return i.uuid=e.uuid,i}class m{constructor(){this.geometries=[],this.materials=[],this.hierarchy=[],this.geometryMap=new Map,this.materialMap=new Map}addChunk(i){i.geometries&&i.geometries.forEach(r=>{const n=this.geometries.length;this.geometries.push(r),this.geometryMap.set(r.uuid,n)}),i.materials&&i.materials.forEach(r=>{const n=this.materials.length;this.materials.push(r),this.materialMap.set(r.uuid,n)}),i.hierarchy&&this.hierarchy.push(...i.hierarchy)}buildCurrent(){const i={geometries:this.geometries,materials:this.materials,hierarchy:this.hierarchy};return h(i)}finalize(){return this.buildCurrent()}}exports.ProgressiveSceneBuilder=m;exports.rebuildScene=h;
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import * as o from "three";
|
|
2
|
-
function p(e) {
|
|
3
|
-
const { geometries: i, materials: r, hierarchy: t } = e, l = /* @__PURE__ */ new Map();
|
|
4
|
-
i.forEach((s, n) => {
|
|
5
|
-
const u = y(s);
|
|
6
|
-
l.set(n, u);
|
|
7
|
-
});
|
|
8
|
-
const h = /* @__PURE__ */ new Map();
|
|
9
|
-
r.forEach((s, n) => {
|
|
10
|
-
const u = a(s);
|
|
11
|
-
h.set(n, u);
|
|
12
|
-
});
|
|
13
|
-
const c = new o.Group();
|
|
14
|
-
c.name = "Scene";
|
|
15
|
-
const f = /* @__PURE__ */ new Map();
|
|
16
|
-
return t.forEach((s) => {
|
|
17
|
-
let n;
|
|
18
|
-
if (s.type === "Mesh") {
|
|
19
|
-
const u = s.geometryIndex >= 0 ? l.get(s.geometryIndex) : null, d = s.materialIndex >= 0 ? h.get(s.materialIndex) : null;
|
|
20
|
-
n = new o.Mesh(u, d);
|
|
21
|
-
} else s.type === "Group" ? n = new o.Group() : s.type === "Object3D" ? n = new o.Object3D() : n = new o.Object3D();
|
|
22
|
-
n.name = s.name, n.position.fromArray(s.position), n.rotation.fromArray(s.rotation), n.scale.fromArray(s.scale), n.visible = s.visible, f.set(s.id, n);
|
|
23
|
-
}), t.forEach((s) => {
|
|
24
|
-
const n = f.get(s.id);
|
|
25
|
-
if (s.parentId !== null) {
|
|
26
|
-
const u = f.get(s.parentId);
|
|
27
|
-
u && u.add(n);
|
|
28
|
-
} else
|
|
29
|
-
c.add(n);
|
|
30
|
-
}), c;
|
|
31
|
-
}
|
|
32
|
-
function y(e) {
|
|
33
|
-
const i = new o.BufferGeometry();
|
|
34
|
-
for (const r in e.attributes) {
|
|
35
|
-
const t = e.attributes[r], l = t.array;
|
|
36
|
-
let h;
|
|
37
|
-
if (l.byteLength === 0) {
|
|
38
|
-
console.warn(`[ sceneRebuilder ] 属性 ${r} 的数组为空`);
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
if (l.buffer && l.buffer.byteLength === 0) {
|
|
42
|
-
console.warn(`[ sceneRebuilder ] 属性 ${r} 的 buffer 已被转移,尝试重建`);
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
h = l;
|
|
46
|
-
const c = new o.BufferAttribute(h, t.itemSize);
|
|
47
|
-
c.normalized = t.normalized, i.setAttribute(r, c);
|
|
48
|
-
}
|
|
49
|
-
if (e.index) {
|
|
50
|
-
const r = e.index, t = r.array;
|
|
51
|
-
if (t && t.byteLength > 0) {
|
|
52
|
-
const l = new o.BufferAttribute(t, r.itemSize);
|
|
53
|
-
i.setIndex(l);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return i;
|
|
57
|
-
}
|
|
58
|
-
function a(e) {
|
|
59
|
-
let i;
|
|
60
|
-
const r = {
|
|
61
|
-
color: e.color !== void 0 ? e.color : 16777215,
|
|
62
|
-
opacity: e.opacity !== void 0 ? e.opacity : 1,
|
|
63
|
-
transparent: e.transparent !== void 0 ? e.transparent : !1,
|
|
64
|
-
alphaTest: e.alphaTest !== void 0 ? e.alphaTest : 0,
|
|
65
|
-
// 关键渲染属性 - 这些缺失会导致渲染抖动和显示错误
|
|
66
|
-
side: e.side !== void 0 ? e.side : o.FrontSide,
|
|
67
|
-
depthTest: e.depthTest !== void 0 ? e.depthTest : !0,
|
|
68
|
-
depthWrite: e.depthWrite !== void 0 ? e.depthWrite : !0,
|
|
69
|
-
wireframe: e.wireframe !== void 0 ? e.wireframe : !1,
|
|
70
|
-
vertexColors: e.vertexColors !== void 0 ? e.vertexColors : !1
|
|
71
|
-
};
|
|
72
|
-
switch (e.type) {
|
|
73
|
-
case "MeshStandardMaterial":
|
|
74
|
-
i = new o.MeshStandardMaterial({
|
|
75
|
-
...r,
|
|
76
|
-
roughness: e.roughness !== void 0 ? e.roughness : 0.5,
|
|
77
|
-
metalness: e.metalness !== void 0 ? e.metalness : 0.5,
|
|
78
|
-
emissive: e.emissive !== void 0 ? e.emissive : 0,
|
|
79
|
-
emissiveIntensity: e.emissiveIntensity !== void 0 ? e.emissiveIntensity : 1
|
|
80
|
-
});
|
|
81
|
-
break;
|
|
82
|
-
case "MeshBasicMaterial":
|
|
83
|
-
i = new o.MeshBasicMaterial({
|
|
84
|
-
...r
|
|
85
|
-
});
|
|
86
|
-
break;
|
|
87
|
-
case "MeshPhongMaterial":
|
|
88
|
-
i = new o.MeshPhongMaterial({
|
|
89
|
-
...r,
|
|
90
|
-
shininess: e.shininess !== void 0 ? e.shininess : 30,
|
|
91
|
-
specular: e.specular !== void 0 ? e.specular : 1118481,
|
|
92
|
-
emissive: e.emissive !== void 0 ? e.emissive : 0,
|
|
93
|
-
emissiveIntensity: e.emissiveIntensity !== void 0 ? e.emissiveIntensity : 1
|
|
94
|
-
});
|
|
95
|
-
break;
|
|
96
|
-
default:
|
|
97
|
-
i = new o.MeshStandardMaterial(r);
|
|
98
|
-
}
|
|
99
|
-
return i.uuid = e.uuid, i;
|
|
100
|
-
}
|
|
101
|
-
class b {
|
|
102
|
-
constructor() {
|
|
103
|
-
this.geometries = [], this.materials = [], this.hierarchy = [], this.geometryMap = /* @__PURE__ */ new Map(), this.materialMap = /* @__PURE__ */ new Map();
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* 添加场景数据块
|
|
107
|
-
*/
|
|
108
|
-
addChunk(i) {
|
|
109
|
-
i.geometries && i.geometries.forEach((r) => {
|
|
110
|
-
const t = this.geometries.length;
|
|
111
|
-
this.geometries.push(r), this.geometryMap.set(r.uuid, t);
|
|
112
|
-
}), i.materials && i.materials.forEach((r) => {
|
|
113
|
-
const t = this.materials.length;
|
|
114
|
-
this.materials.push(r), this.materialMap.set(r.uuid, t);
|
|
115
|
-
}), i.hierarchy && this.hierarchy.push(...i.hierarchy);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* 构建当前可渲染的场景
|
|
119
|
-
*/
|
|
120
|
-
buildCurrent() {
|
|
121
|
-
const i = {
|
|
122
|
-
geometries: this.geometries,
|
|
123
|
-
materials: this.materials,
|
|
124
|
-
hierarchy: this.hierarchy
|
|
125
|
-
};
|
|
126
|
-
return p(i);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* 完成构建
|
|
130
|
-
*/
|
|
131
|
-
finalize() {
|
|
132
|
-
return this.buildCurrent();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
export {
|
|
136
|
-
b as ProgressiveSceneBuilder,
|
|
137
|
-
p as rebuildScene
|
|
138
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function r(e){return new Worker(""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../../../assets/gltfParser.worker-Bqz8BBJx.js").href:new URL("../../../../assets/gltfParser.worker-Bqz8BBJx.js",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),{name:e==null?void 0:e.name})}module.exports=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function r(e){return new Worker(""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/../../../../assets/gltfParserOptimized.worker-DfipxPjm.js").href:new URL("../../../../assets/gltfParserOptimized.worker-DfipxPjm.js",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),{name:e==null?void 0:e.name})}module.exports=r;
|
|
File without changes
|