three-base 2.0.44 → 2.0.46
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/InstancedMeshBase.js +1 -1
- package/InstancedMeshBase.ts +1 -2
- package/MeshBase.js +1 -4
- package/MeshBase.ts +2 -6
- package/README.md +0 -2
- package/package.json +1 -1
- package/pass/glow_pass.js +1 -1
- package/pass/glow_pass.ts +1 -1
- package/pass/stroke_pass.js +1 -1
- package/pass/stroke_pass.ts +1 -1
package/InstancedMeshBase.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: xiaosihan
|
|
3
3
|
* @Date: 2024-02-05 09:31:57
|
|
4
4
|
* @Last Modified by: xiaosihan
|
|
5
|
-
* @Last Modified time: 2024-
|
|
5
|
+
* @Last Modified time: 2024-06-07 22:14:53
|
|
6
6
|
*/
|
|
7
7
|
import { throttle } from "lodash";
|
|
8
8
|
import { InstancedBufferAttribute, InstancedMesh, Matrix4, Object3D, Vector3 } from "three";
|
package/InstancedMeshBase.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: xiaosihan
|
|
3
3
|
* @Date: 2024-02-05 09:31:57
|
|
4
4
|
* @Last Modified by: xiaosihan
|
|
5
|
-
* @Last Modified time: 2024-
|
|
5
|
+
* @Last Modified time: 2024-06-07 22:14:53
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { throttle } from "lodash";
|
|
@@ -169,7 +169,6 @@ export default class InstancedMeshBase extends MeshBase {
|
|
|
169
169
|
//初始实例矩阵的数量
|
|
170
170
|
setCount(count: number = 0) {
|
|
171
171
|
|
|
172
|
-
|
|
173
172
|
const instanceMatrix = new InstancedBufferAttribute(new Float32Array(count * 16), 16);
|
|
174
173
|
const instanceColor = new InstancedBufferAttribute(new Float32Array(count * 3).fill(1), 3);
|
|
175
174
|
|
package/MeshBase.js
CHANGED
|
@@ -48,9 +48,6 @@ export default class MeshBase extends Group {
|
|
|
48
48
|
else {
|
|
49
49
|
console.error(`${url},不支持的格式`);
|
|
50
50
|
}
|
|
51
|
-
threeUtils.center(modal);
|
|
52
|
-
threeUtils.alignBottom(modal);
|
|
53
|
-
modal.updateMatrixWorld(true);
|
|
54
51
|
MeshBase.models.set(url, modal);
|
|
55
52
|
MeshBase.loadModeling.set(url, false);
|
|
56
53
|
}
|
|
@@ -79,9 +76,9 @@ export default class MeshBase extends Group {
|
|
|
79
76
|
}
|
|
80
77
|
}
|
|
81
78
|
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
79
|
+
this.loaded = true;
|
|
82
80
|
// 加载完成事件
|
|
83
81
|
this.dispatchEvent({ type: "loaded" });
|
|
84
|
-
this.loaded = true;
|
|
85
82
|
}
|
|
86
83
|
// 超出绘制区域时不绘制
|
|
87
84
|
frustumCulled = false;
|
package/MeshBase.ts
CHANGED
|
@@ -60,10 +60,6 @@ export default class MeshBase extends Group {
|
|
|
60
60
|
console.error(`${url},不支持的格式`);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
threeUtils.center(modal);
|
|
64
|
-
threeUtils.alignBottom(modal);
|
|
65
|
-
modal.updateMatrixWorld(true);
|
|
66
|
-
|
|
67
63
|
MeshBase.models.set(url, modal);
|
|
68
64
|
MeshBase.loadModeling.set(url, false);
|
|
69
65
|
}
|
|
@@ -100,10 +96,10 @@ export default class MeshBase extends Group {
|
|
|
100
96
|
|
|
101
97
|
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
102
98
|
|
|
99
|
+
this.loaded = true;
|
|
100
|
+
|
|
103
101
|
// 加载完成事件
|
|
104
102
|
this.dispatchEvent({ type: "loaded" } as never);
|
|
105
|
-
|
|
106
|
-
this.loaded = true;
|
|
107
103
|
}
|
|
108
104
|
|
|
109
105
|
// 超出绘制区域时不绘制
|
package/README.md
CHANGED
|
@@ -4,8 +4,6 @@ import { AmbientLight, BoxGeometry, Mesh, MeshLambertMaterial, PointLight } from
|
|
|
4
4
|
import ThreeBase from "three-base";
|
|
5
5
|
import Transition from "three-base/Transition";
|
|
6
6
|
|
|
7
|
-
// 仅支持vite编译的项目安装
|
|
8
|
-
// 做项目找我 qq:389652405
|
|
9
7
|
class HomeRender extends ThreeBase {
|
|
10
8
|
|
|
11
9
|
constructor() {
|
package/package.json
CHANGED
package/pass/glow_pass.js
CHANGED
|
@@ -467,7 +467,7 @@ const scene = new Scene();
|
|
|
467
467
|
// 对象发光
|
|
468
468
|
export default function glow_pass(renderer, camera, object3d, baseDepthTexture) {
|
|
469
469
|
const { glow_enable = false, glow_color = "#04fa12", glow_width = 1, glow_opacity = 1 } = object3d.userData;
|
|
470
|
-
if (!glow_enable || glow_width === 0) {
|
|
470
|
+
if (!glow_enable || glow_width === 0 || !object3d.visible) {
|
|
471
471
|
return;
|
|
472
472
|
}
|
|
473
473
|
// 保存原帧缓冲区
|
package/pass/glow_pass.ts
CHANGED
|
@@ -486,7 +486,7 @@ export default function glow_pass(renderer: WebGLRenderer, camera: Camera, objec
|
|
|
486
486
|
|
|
487
487
|
const { glow_enable = false, glow_color = "#04fa12", glow_width = 1, glow_opacity = 1 } = object3d.userData;
|
|
488
488
|
|
|
489
|
-
if (!glow_enable || glow_width === 0) {
|
|
489
|
+
if (!glow_enable || glow_width === 0 || !object3d.visible) {
|
|
490
490
|
return;
|
|
491
491
|
}
|
|
492
492
|
|
package/pass/stroke_pass.js
CHANGED
|
@@ -463,7 +463,7 @@ const scene = new Scene();
|
|
|
463
463
|
// 对象描边
|
|
464
464
|
export default function stroke_pass(renderer, camera, object3d, baseDepthTexture) {
|
|
465
465
|
const { stroke_enable = false, stroke_color = "#04fa12", stroke_width = 1 } = object3d.userData;
|
|
466
|
-
if (!stroke_enable || stroke_width === 0) {
|
|
466
|
+
if (!stroke_enable || stroke_width === 0 || !object3d.visible) {
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
// 保存原帧缓冲区
|
package/pass/stroke_pass.ts
CHANGED
|
@@ -480,7 +480,7 @@ const scene = new Scene();
|
|
|
480
480
|
export default function stroke_pass(renderer: WebGLRenderer, camera: Camera, object3d: Object3D, baseDepthTexture: DepthTexture) {
|
|
481
481
|
|
|
482
482
|
const { stroke_enable = false, stroke_color = "#04fa12", stroke_width = 1 } = object3d.userData;
|
|
483
|
-
if (!stroke_enable || stroke_width === 0) {
|
|
483
|
+
if (!stroke_enable || stroke_width === 0 || !object3d.visible) {
|
|
484
484
|
return;
|
|
485
485
|
}
|
|
486
486
|
|