three-base 1.0.82 → 1.0.84
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/index.js +1 -1
- package/index.ts +1 -1
- package/lib/ApngTexture.js +40 -107
- package/lib/ApngTextureManage.js +51 -100
- package/lib/EventMesh.js +22 -42
- package/lib/ExtrudeMesh.js +147 -178
- package/lib/FPScontrol.js +116 -133
- package/lib/InstancedGroupMesh.js +25 -45
- package/lib/KeyFrameAnimation.js +37 -54
- package/lib/PlaneText.d.ts +2 -2
- package/lib/PlaneText.js +16 -36
- package/lib/PlaneText.ts +2 -3
- package/lib/PlaneWithHtml.js +48 -126
- package/lib/PointLight/PointLight.d.ts +2 -2
- package/lib/PointLight/PointLight.js +47 -67
- package/lib/PointLight/PointLight.ts +3 -3
- package/lib/Sky/Sky.js +11 -30
- package/lib/SpriteText.d.ts +45 -0
- package/lib/SpriteText.js +162 -0
- package/lib/SpriteText.ts +189 -0
- package/lib/SpriteText2.d.ts +4 -4
- package/lib/SpriteText2.js +90 -166
- package/lib/Text3D/Text3D.js +40 -61
- package/lib/Text3D/fontController.js +149 -284
- package/lib/ThreeBase.js +204 -341
- package/lib/ThreeMouse.js +244 -203
- package/lib/Transition.js +95 -161
- package/lib/keyContorls.js +74 -102
- package/lib/planeModal1/PlaneModal1.js +90 -162
- package/lib/shaders.js +178 -36
- package/lib/spriteModal1/SpriteModal1.js +93 -165
- package/lib/threeLoader.js +66 -89
- package/lib/threeUtils.js +61 -85
- package/lib/threeUtils.ts +2 -1
- package/package.json +3 -5
|
@@ -4,178 +4,106 @@
|
|
|
4
4
|
* @Last Modified by: xiaosihan
|
|
5
5
|
* @Last Modified time: 2023-03-08 02:05:25
|
|
6
6
|
*/
|
|
7
|
-
var __extends = (this && this.__extends) || (function () {
|
|
8
|
-
var extendStatics = function (d, b) {
|
|
9
|
-
extendStatics = Object.setPrototypeOf ||
|
|
10
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
11
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
12
|
-
return extendStatics(d, b);
|
|
13
|
-
};
|
|
14
|
-
return function (d, b) {
|
|
15
|
-
if (typeof b !== "function" && b !== null)
|
|
16
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
17
|
-
extendStatics(d, b);
|
|
18
|
-
function __() { this.constructor = d; }
|
|
19
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
20
|
-
};
|
|
21
|
-
})();
|
|
22
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
23
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
24
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
25
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
26
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
27
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
28
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
32
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
33
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
34
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
35
|
-
function step(op) {
|
|
36
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
37
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
38
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
39
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
40
|
-
switch (op[0]) {
|
|
41
|
-
case 0: case 1: t = op; break;
|
|
42
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
43
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
44
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
45
|
-
default:
|
|
46
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
47
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
48
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
49
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
50
|
-
if (t[2]) _.ops.pop();
|
|
51
|
-
_.trys.pop(); continue;
|
|
52
|
-
}
|
|
53
|
-
op = body.call(thisArg, _);
|
|
54
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
55
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
7
|
import { Sprite, CanvasTexture, Vector2 } from "three";
|
|
59
8
|
import spriteModal1PNG from "./spriteModal1.png";
|
|
60
9
|
// sprit弹窗1
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
canvas.width = 1024;
|
|
69
|
-
canvas.height = 1024;
|
|
70
|
-
return canvas;
|
|
71
|
-
})();
|
|
72
|
-
_this.context = _this.canvas.getContext("2d");
|
|
73
|
-
_this.texture = new CanvasTexture(_this.canvas);
|
|
74
|
-
// 配置
|
|
75
|
-
_this._config = {
|
|
76
|
-
size: 10,
|
|
77
|
-
title: "SpritModal1",
|
|
78
|
-
titleColor: "#ffffff",
|
|
79
|
-
texts: []
|
|
80
|
-
// [
|
|
81
|
-
// {
|
|
82
|
-
// text: "1",
|
|
83
|
-
// color: "#ffff00",
|
|
84
|
-
// size: 40
|
|
85
|
-
// },
|
|
86
|
-
// {
|
|
87
|
-
// text: "2",
|
|
88
|
-
// color: "#ff00ff",
|
|
89
|
-
// size: 40
|
|
90
|
-
// },
|
|
91
|
-
// ]
|
|
92
|
-
};
|
|
93
|
-
_this.updata(config);
|
|
94
|
-
_this.material.map = _this.texture;
|
|
95
|
-
_this.material.transparent = true;
|
|
96
|
-
_this.material.alphaTest = 0.01;
|
|
97
|
-
return _this;
|
|
10
|
+
export default class SpritModal1 extends Sprite {
|
|
11
|
+
constructor(config = {}) {
|
|
12
|
+
super();
|
|
13
|
+
this.updata(config);
|
|
14
|
+
this.material.map = this.texture;
|
|
15
|
+
this.material.transparent = true;
|
|
16
|
+
this.material.alphaTest = 0.01;
|
|
98
17
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
18
|
+
// 背景图
|
|
19
|
+
static img = (() => {
|
|
20
|
+
const img = new Image();
|
|
21
|
+
img.src = spriteModal1PNG;
|
|
22
|
+
return img;
|
|
23
|
+
})();
|
|
24
|
+
canvas = (() => {
|
|
25
|
+
const canvas = document.createElement("canvas");
|
|
26
|
+
canvas.width = 1024;
|
|
27
|
+
canvas.height = 1024;
|
|
28
|
+
return canvas;
|
|
29
|
+
})();
|
|
30
|
+
context = this.canvas.getContext("2d");
|
|
31
|
+
texture = new CanvasTexture(this.canvas);
|
|
32
|
+
// 配置
|
|
33
|
+
_config = {
|
|
34
|
+
size: 10,
|
|
35
|
+
title: "SpritModal1",
|
|
36
|
+
titleColor: "#ffffff",
|
|
37
|
+
texts: []
|
|
38
|
+
// [
|
|
39
|
+
// {
|
|
40
|
+
// text: "1",
|
|
41
|
+
// color: "#ffff00",
|
|
42
|
+
// size: 40
|
|
43
|
+
// },
|
|
44
|
+
// {
|
|
45
|
+
// text: "2",
|
|
46
|
+
// color: "#ff00ff",
|
|
47
|
+
// size: 40
|
|
48
|
+
// },
|
|
49
|
+
// ]
|
|
50
|
+
};
|
|
51
|
+
async updata(config) {
|
|
52
|
+
Object.assign(this._config, config);
|
|
53
|
+
//绘制背景
|
|
54
|
+
this.context.clearRect(0, 0, 1024, 1024);
|
|
55
|
+
while (!SpritModal1.img.complete) {
|
|
56
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
57
|
+
}
|
|
58
|
+
// 设置大小
|
|
59
|
+
this.scale.set(this._config.size, this._config.size, this._config.size);
|
|
60
|
+
// this.context.fillStyle = "#00000088";
|
|
61
|
+
// this.context.fillRect(0, 0, 1024, 1024);
|
|
62
|
+
//绘制背景
|
|
63
|
+
this.context.drawImage(SpritModal1.img, 186, 0);
|
|
64
|
+
// 绘制标题
|
|
65
|
+
this.context.fillStyle = this._config.titleColor;
|
|
66
|
+
this.context.font = '40px serif'; // 设置字体大小
|
|
67
|
+
this.context.textAlign = "left";
|
|
68
|
+
this.context.textBaseline = "top";
|
|
69
|
+
this.context.fillText(this._config.title, 250, 72);
|
|
70
|
+
let textPos = new Vector2(250, 150);
|
|
71
|
+
let maxWidth = 530;
|
|
72
|
+
// 绘制内容
|
|
73
|
+
this._config.texts.map(({ text = "text", color = "#ffffff", size = 40 }) => {
|
|
74
|
+
this.context.fillStyle = color;
|
|
75
|
+
this.context.font = `${size}px serif`; // 设置字体大小
|
|
76
|
+
this.context.textAlign = "left";
|
|
77
|
+
this.context.textBaseline = "top";
|
|
78
|
+
// 字符分隔为数组
|
|
79
|
+
var arrText = text.split('');
|
|
80
|
+
var line = '';
|
|
81
|
+
// 文字自动换行计算
|
|
82
|
+
for (var n = 0; n < arrText.length; n++) {
|
|
83
|
+
var metrics = this.context.measureText(line + arrText[n]);
|
|
84
|
+
var testWidth = metrics.width;
|
|
85
|
+
if ((testWidth > maxWidth && n > 0) || arrText[n] === "\n") {
|
|
86
|
+
this.context.fillText(line, textPos.x, textPos.y);
|
|
87
|
+
line = "";
|
|
88
|
+
textPos.y += size;
|
|
160
89
|
}
|
|
161
|
-
|
|
90
|
+
else {
|
|
91
|
+
line += arrText[n];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
this.context.fillText(line, textPos.x, textPos.y);
|
|
95
|
+
textPos.y += size;
|
|
162
96
|
});
|
|
163
|
-
|
|
97
|
+
this.texture.needsUpdate = true;
|
|
98
|
+
this.dispatchEvent({ type: "loaded" });
|
|
99
|
+
}
|
|
164
100
|
//鼠标拾取计算
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
101
|
+
raycast(raycaster, intersects) {
|
|
102
|
+
let intersect = [];
|
|
103
|
+
super.raycast(raycaster, intersect);
|
|
104
|
+
let inte = intersect[0];
|
|
169
105
|
if (inte && (inte.uv.x > 0.22 && inte.uv.x < 0.78) && (inte.uv.y > 0.54 && inte.uv.y < 0.94)) {
|
|
170
106
|
intersects.push(inte);
|
|
171
107
|
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
SpritModal1.img = (function () {
|
|
175
|
-
var img = new Image();
|
|
176
|
-
img.src = spriteModal1PNG;
|
|
177
|
-
return img;
|
|
178
|
-
})();
|
|
179
|
-
return SpritModal1;
|
|
180
|
-
}(Sprite));
|
|
181
|
-
export default SpritModal1;
|
|
108
|
+
}
|
|
109
|
+
}
|
package/lib/threeLoader.js
CHANGED
|
@@ -4,21 +4,6 @@
|
|
|
4
4
|
* @Last Modified by: xiaosihan
|
|
5
5
|
* @Last Modified time: 2023-02-07 11:11:48
|
|
6
6
|
*/
|
|
7
|
-
var __extends = (this && this.__extends) || (function () {
|
|
8
|
-
var extendStatics = function (d, b) {
|
|
9
|
-
extendStatics = Object.setPrototypeOf ||
|
|
10
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
11
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
12
|
-
return extendStatics(d, b);
|
|
13
|
-
};
|
|
14
|
-
return function (d, b) {
|
|
15
|
-
if (typeof b !== "function" && b !== null)
|
|
16
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
17
|
-
extendStatics(d, b);
|
|
18
|
-
function __() { this.constructor = d; }
|
|
19
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
20
|
-
};
|
|
21
|
-
})();
|
|
22
7
|
import { DefaultLoadingManager, EventDispatcher, RepeatWrapping, TextureLoader, VideoTexture } from "three";
|
|
23
8
|
import { FBXLoader } from "three/examples/jsm/loaders/FBXLoader";
|
|
24
9
|
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
|
|
@@ -33,90 +18,51 @@ import dracoDecoderJS from "./draco/draco_decoder.js?url";
|
|
|
33
18
|
//@ts-ignore
|
|
34
19
|
import dracoDecoderWASM from "./draco/draco_decoder.wasm?url";
|
|
35
20
|
// 加载器
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_this.anisotropy = 1;
|
|
42
|
-
// 纹理对向缓存
|
|
43
|
-
_this.textureMap = new Map();
|
|
44
|
-
// 纹理加载器
|
|
45
|
-
_this.textureLoader = new TextureLoader();
|
|
46
|
-
// fbx模型加载器
|
|
47
|
-
_this.fbxLoader = new FBXLoader();
|
|
48
|
-
//obj 加载器
|
|
49
|
-
_this.objLoader = new OBJLoader();
|
|
50
|
-
// 材质加载器
|
|
51
|
-
_this.mtlLoader = new MTLLoader();
|
|
52
|
-
// gltf 加载器
|
|
53
|
-
_this.gltfLoader = (function () {
|
|
54
|
-
var loader = new GLTFLoader();
|
|
55
|
-
var dracoLoader = new /** @class */ (function (_super) {
|
|
56
|
-
__extends(ThreeBaseDRACOLoader, _super);
|
|
57
|
-
function ThreeBaseDRACOLoader() {
|
|
58
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
59
|
-
}
|
|
60
|
-
ThreeBaseDRACOLoader.prototype._loadLibrary = function (url, responseType) {
|
|
61
|
-
//@ts-ignore
|
|
62
|
-
var urlConf = (process.env.NODE_ENV === "development") ? {
|
|
63
|
-
"draco_decoder.js": "draco_decoder.js",
|
|
64
|
-
"draco_wasm_wrapper.js": "draco_wasm_wrapper.js",
|
|
65
|
-
"draco_decoder.wasm": "draco_decoder.wasm"
|
|
66
|
-
} : {
|
|
67
|
-
"draco_decoder.js": dracoWasmWrapperJS,
|
|
68
|
-
"draco_wasm_wrapper.js": dracoDecoderJS,
|
|
69
|
-
"draco_decoder.wasm": dracoDecoderWASM
|
|
70
|
-
};
|
|
71
|
-
//@ts-ignore
|
|
72
|
-
return _super.prototype._loadLibrary.call(this, urlConf[url], responseType);
|
|
73
|
-
};
|
|
74
|
-
return ThreeBaseDRACOLoader;
|
|
75
|
-
}(DRACOLoader))();
|
|
76
|
-
//@ts-ignore
|
|
77
|
-
dracoLoader.setDecoderPath((process.env.NODE_ENV === "development") ? '/node_modules/three/examples/jsm/libs/draco/' : '');
|
|
78
|
-
loader.setDRACOLoader(dracoLoader);
|
|
79
|
-
return loader;
|
|
80
|
-
})();
|
|
81
|
-
// 是否加载完成
|
|
82
|
-
_this.onload = true;
|
|
83
|
-
DefaultLoadingManager.onStart = function () {
|
|
84
|
-
_this.onload = false;
|
|
21
|
+
class ThreeLoader extends EventDispatcher {
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
DefaultLoadingManager.onStart = () => {
|
|
25
|
+
this.onload = false;
|
|
85
26
|
};
|
|
86
27
|
// 有资源加载完成时通知渲染器
|
|
87
|
-
DefaultLoadingManager.onProgress =
|
|
88
|
-
|
|
28
|
+
DefaultLoadingManager.onProgress = () => {
|
|
29
|
+
this.dispatchEvent({ type: "progress" });
|
|
89
30
|
};
|
|
90
|
-
DefaultLoadingManager.onLoad =
|
|
91
|
-
|
|
31
|
+
DefaultLoadingManager.onLoad = () => {
|
|
32
|
+
this.onload = true;
|
|
92
33
|
};
|
|
93
|
-
return _this;
|
|
94
34
|
}
|
|
35
|
+
// 各向异性
|
|
36
|
+
anisotropy = 1;
|
|
95
37
|
// 设置各向异性 由渲染器来调用并设置
|
|
96
|
-
|
|
38
|
+
setAnisotropy(v) {
|
|
97
39
|
this.anisotropy = v;
|
|
98
|
-
}
|
|
40
|
+
}
|
|
99
41
|
;
|
|
42
|
+
// 纹理对向缓存
|
|
43
|
+
textureMap = new Map();
|
|
44
|
+
// 纹理加载器
|
|
45
|
+
textureLoader = new TextureLoader();
|
|
100
46
|
// 获取地址对应的单例纹理对象
|
|
101
|
-
|
|
102
|
-
|
|
47
|
+
getTexture(src) {
|
|
48
|
+
let texture = this.textureMap.get(src);
|
|
103
49
|
if (!texture) {
|
|
104
50
|
if (/\.mp4$/.test(src)) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
document.addEventListener("pointerup",
|
|
113
|
-
|
|
114
|
-
|
|
51
|
+
const videoDom = document.createElement("video");
|
|
52
|
+
videoDom.autoplay = true;
|
|
53
|
+
videoDom.loop = true;
|
|
54
|
+
videoDom.muted = true;
|
|
55
|
+
videoDom.preload = "auto";
|
|
56
|
+
videoDom.playsInline = true;
|
|
57
|
+
videoDom.src = src;
|
|
58
|
+
document.addEventListener("pointerup", () => {
|
|
59
|
+
videoDom.pause();
|
|
60
|
+
videoDom.play();
|
|
115
61
|
});
|
|
116
|
-
texture = new VideoTexture(
|
|
62
|
+
texture = new VideoTexture(videoDom);
|
|
117
63
|
}
|
|
118
64
|
else {
|
|
119
|
-
texture = this.textureLoader.load(src,
|
|
65
|
+
texture = this.textureLoader.load(src, tex => {
|
|
120
66
|
tex.image.crossOrigin = "anonymous";
|
|
121
67
|
});
|
|
122
68
|
}
|
|
@@ -125,9 +71,40 @@ var ThreeLoader = /** @class */ (function (_super) {
|
|
|
125
71
|
texture.wrapS = texture.wrapT = RepeatWrapping;
|
|
126
72
|
texture.anisotropy = this.anisotropy;
|
|
127
73
|
return texture;
|
|
128
|
-
}
|
|
74
|
+
}
|
|
129
75
|
;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
76
|
+
// fbx模型加载器
|
|
77
|
+
fbxLoader = new FBXLoader();
|
|
78
|
+
//obj 加载器
|
|
79
|
+
objLoader = new OBJLoader();
|
|
80
|
+
// 材质加载器
|
|
81
|
+
mtlLoader = new MTLLoader();
|
|
82
|
+
// gltf 加载器
|
|
83
|
+
gltfLoader = (() => {
|
|
84
|
+
const loader = new GLTFLoader();
|
|
85
|
+
const dracoLoader = new class ThreeBaseDRACOLoader extends DRACOLoader {
|
|
86
|
+
_loadLibrary(url, responseType) {
|
|
87
|
+
//@ts-ignore
|
|
88
|
+
let urlConf = (process.env.NODE_ENV === "development") ? {
|
|
89
|
+
"draco_decoder.js": "draco_decoder.js",
|
|
90
|
+
"draco_wasm_wrapper.js": "draco_wasm_wrapper.js",
|
|
91
|
+
"draco_decoder.wasm": "draco_decoder.wasm"
|
|
92
|
+
} : {
|
|
93
|
+
"draco_decoder.js": dracoWasmWrapperJS,
|
|
94
|
+
"draco_wasm_wrapper.js": dracoDecoderJS,
|
|
95
|
+
"draco_decoder.wasm": dracoDecoderWASM
|
|
96
|
+
};
|
|
97
|
+
//@ts-ignore
|
|
98
|
+
return super._loadLibrary(urlConf[url], responseType);
|
|
99
|
+
}
|
|
100
|
+
}();
|
|
101
|
+
//@ts-ignore
|
|
102
|
+
dracoLoader.setDecoderPath((process.env.NODE_ENV === "development") ? '/node_modules/three/examples/jsm/libs/draco/' : '');
|
|
103
|
+
loader.setDRACOLoader(dracoLoader);
|
|
104
|
+
return loader;
|
|
105
|
+
})();
|
|
106
|
+
// 是否加载完成
|
|
107
|
+
onload = true;
|
|
108
|
+
}
|
|
109
|
+
const threeLoader = new ThreeLoader();
|
|
133
110
|
export default threeLoader;
|