three-base 2.0.101 → 2.0.104
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/Grass/grass.jpg +0 -0
- package/Ground1/floorMap1.png +0 -0
- package/Ground1/floorMap2.png +0 -0
- package/Ground1/floorMap3.png +0 -0
- package/PlaneModal1/planeModal.png +0 -0
- package/Sky/skyMap.png +0 -0
- package/SpriteModal1/spriteModal1.png +0 -0
- package/ThreeBase.js +2 -3
- package/package.json +1 -1
- package/threeLoader.d.ts +1 -0
- package/threeLoader.js +13 -1
package/Grass/grass.jpg
CHANGED
|
Binary file
|
package/Ground1/floorMap1.png
CHANGED
|
Binary file
|
package/Ground1/floorMap2.png
CHANGED
|
Binary file
|
package/Ground1/floorMap3.png
CHANGED
|
Binary file
|
|
Binary file
|
package/Sky/skyMap.png
CHANGED
|
Binary file
|
|
Binary file
|
package/ThreeBase.js
CHANGED
|
@@ -104,9 +104,9 @@ export default class ThreeBase extends EventDispatcher {
|
|
|
104
104
|
return renderer;
|
|
105
105
|
})();
|
|
106
106
|
//透视相机
|
|
107
|
-
perspectiveCamera = new PerspectiveCamera(45, 1, 0.01,
|
|
107
|
+
perspectiveCamera = new PerspectiveCamera(45, 1, 0.01, 20000);
|
|
108
108
|
//正交相机
|
|
109
|
-
orthographicCamera = new OrthographicCamera(-1, 1, 1, -1, 0.01,
|
|
109
|
+
orthographicCamera = new OrthographicCamera(-1, 1, 1, -1, 0.01, 20000);
|
|
110
110
|
//相机的类型 有透视相机和正交相机
|
|
111
111
|
cameraType = "perspectiveCamera";
|
|
112
112
|
setCameraType(cameraType) {
|
|
@@ -539,7 +539,6 @@ export default class ThreeBase extends EventDispatcher {
|
|
|
539
539
|
async download(fileName = "download") {
|
|
540
540
|
this.render();
|
|
541
541
|
const blob = await this.getThumbBlob();
|
|
542
|
-
const base64 = this.renderer.domElement.toDataURL("image/png");
|
|
543
542
|
let saveLink = document.createElement("a");
|
|
544
543
|
saveLink.download = `${fileName}.png`;
|
|
545
544
|
saveLink.href = URL.createObjectURL(blob);
|
package/package.json
CHANGED
package/threeLoader.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { STLLoader } from "three/examples/jsm/loaders/STLLoader";
|
|
|
7
7
|
import { USDZLoader } from "three/examples/jsm/loaders/USDZLoader";
|
|
8
8
|
declare class ThreeLoader extends EventDispatcher {
|
|
9
9
|
constructor();
|
|
10
|
+
getFilename(url: string): string;
|
|
10
11
|
uuid: string;
|
|
11
12
|
anisotropy: number;
|
|
12
13
|
setAnisotropy(v: number): void;
|
package/threeLoader.js
CHANGED
|
@@ -49,18 +49,30 @@ class ThreeLoader extends EventDispatcher {
|
|
|
49
49
|
};
|
|
50
50
|
// 资源替换
|
|
51
51
|
DefaultLoadingManager.setURLModifier((url) => {
|
|
52
|
+
//全路径匹配资源
|
|
53
|
+
if (this._blobs[url]) {
|
|
54
|
+
return this._blobs[url];
|
|
55
|
+
}
|
|
52
56
|
const filename = url
|
|
53
57
|
.replace(`blob:${location.origin}/`, "")
|
|
54
58
|
.replace(/^\.\//, "");
|
|
55
59
|
let new_url = this._blobs[filename] || url;
|
|
56
60
|
//如果全匹配没有匹配到资源,就尝试文件名匹配
|
|
57
61
|
if (!this._blobs[filename]) {
|
|
58
|
-
const blobKey = Object.keys(this._blobs).find((key) =>
|
|
62
|
+
const blobKey = Object.keys(this._blobs).find((key) => this.getFilename(key) === this.getFilename(filename)) || "";
|
|
59
63
|
new_url = this._blobs[blobKey] || url;
|
|
60
64
|
}
|
|
61
65
|
return new_url;
|
|
62
66
|
});
|
|
63
67
|
}
|
|
68
|
+
// 从url 中提取文件名
|
|
69
|
+
getFilename(url) {
|
|
70
|
+
// 移除URL的查询字符串和哈希部分
|
|
71
|
+
const path = url.split("?")[0].split("#")[0];
|
|
72
|
+
// 使用lastIndexOf和substring从路径中提取文件名
|
|
73
|
+
const filename = path.substring(path.lastIndexOf("/") + 1);
|
|
74
|
+
return filename;
|
|
75
|
+
}
|
|
64
76
|
uuid = generateUUID();
|
|
65
77
|
// 各向异性
|
|
66
78
|
anisotropy = 16;
|