three-base 2.0.130 → 2.0.137
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/ApngTexture.d.ts +13 -13
- package/ApngTexture.js +61 -61
- package/ApngTextureManage.d.ts +18 -18
- package/ApngTextureManage.js +87 -87
- package/DirectionalLight.d.ts +6 -0
- package/DirectionalLight.js +68 -0
- package/EventMesh.d.ts +18 -18
- package/EventMesh.js +59 -59
- package/ExtrudeMesh.d.ts +112 -112
- package/ExtrudeMesh.js +366 -366
- package/FPScontrol.d.ts +78 -50
- package/FPScontrol.js +617 -232
- package/Fire/Fire.d.ts +28 -28
- package/Fire/Fire.js +79 -79
- package/Fire/FireGromtry.d.ts +9 -9
- package/Fire/FireGromtry.js +40 -40
- package/Fire/FireMaterial.d.ts +28 -28
- package/Fire/FireMaterial.js +32 -32
- package/Fire/index.d.ts +1 -1
- package/Fire/index.js +1 -1
- package/Grass/Grass.d.ts +8 -8
- package/Grass/Grass.js +38 -38
- package/Grass/index.d.ts +1 -1
- package/Grass/index.js +1 -1
- package/Ground1/Ground1.d.ts +11 -11
- package/Ground1/Ground1.js +54 -54
- package/Ground1/index.d.ts +1 -1
- package/Ground1/index.js +1 -1
- package/InstancedMeshBase.d.ts +39 -39
- package/InstancedMeshBase.js +293 -293
- package/KeyFrameAnimation.d.ts +25 -25
- package/KeyFrameAnimation.js +78 -78
- package/MeshBase.d.ts +35 -35
- package/MeshBase.js +223 -223
- package/Mirror.d.ts +25 -25
- package/Mirror.js +139 -139
- package/PipeMesh/PathGeometry.d.ts +44 -44
- package/PipeMesh/PathGeometry.js +300 -300
- package/PipeMesh/PathPoint.d.ts +17 -17
- package/PipeMesh/PathPoint.js +31 -31
- package/PipeMesh/PathPointList.d.ts +31 -31
- package/PipeMesh/PathPointList.js +208 -208
- package/PipeMesh/PathTubeGeometry.d.ts +25 -25
- package/PipeMesh/PathTubeGeometry.js +130 -130
- package/PipeMesh/PipeMesh.d.ts +25 -25
- package/PipeMesh/PipeMesh.js +63 -63
- package/PipeMesh/index.d.ts +1 -1
- package/PipeMesh/index.js +1 -1
- package/PlaneModal1/PlaneModal1.d.ts +31 -31
- package/PlaneModal1/PlaneModal1.js +105 -105
- package/PlaneModal1/index.d.ts +1 -1
- package/PlaneModal1/index.js +1 -1
- package/PlaneText.d.ts +39 -39
- package/PlaneText.js +30 -30
- package/PlaneWithHtml.d.ts +11 -11
- package/PlaneWithHtml.js +63 -68
- package/PointLight/PointLight.d.ts +14 -13
- package/PointLight/PointLight.js +70 -64
- package/PointLight/index.d.ts +1 -1
- package/PointLight/index.js +1 -1
- package/Sky/Sky.d.ts +9 -9
- package/Sky/Sky.js +22 -22
- package/Sky/index.d.ts +1 -1
- package/Sky/index.js +1 -1
- package/SpotLight.d.ts +6 -0
- package/SpotLight.js +72 -0
- package/SpriteModal1/SpriteModal1.d.ts +30 -30
- package/SpriteModal1/SpriteModal1.js +110 -110
- package/SpriteModal1/index.d.ts +1 -1
- package/SpriteModal1/index.js +1 -1
- package/SpriteText.d.ts +45 -45
- package/SpriteText.js +163 -163
- package/SpriteText2.d.ts +47 -47
- package/SpriteText2.js +198 -198
- package/SpriteWithHtml.d.ts +7 -7
- package/SpriteWithHtml.js +44 -49
- package/Text3D/Text3D.d.ts +20 -20
- package/Text3D/Text3D.js +62 -62
- package/Text3D/fontController.d.ts +59 -59
- package/Text3D/fontController.js +199 -199
- package/Text3D/index.d.ts +1 -1
- package/Text3D/index.js +1 -1
- package/ThreeBase.d.ts +111 -81
- package/ThreeBase.js +656 -560
- package/ThreeMouse.d.ts +40 -40
- package/ThreeMouse.js +407 -407
- package/Transition.d.ts +40 -40
- package/Transition.js +210 -210
- package/Water/Water.d.ts +5 -0
- package/Water/Water.js +26 -0
- package/Water/waternormals.jpg +0 -0
- package/declare.d.ts +167 -0
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/keyContorls.d.ts +25 -25
- package/keyContorls.js +98 -98
- package/package.json +3 -2
- package/pass/bloom_pass.d.ts +2 -2
- package/pass/bloom_pass.js +99 -99
- package/pass/cover_pass.d.ts +2 -2
- package/pass/cover_pass.js +95 -95
- package/pass/emissive_ao_pass.d.ts +13 -0
- package/pass/emissive_ao_pass.js +370 -0
- package/pass/frosted_glass_pass.d.ts +2 -0
- package/pass/frosted_glass_pass.js +275 -0
- package/pass/fsQuad.d.ts +9 -9
- package/pass/fsQuad.js +28 -28
- package/pass/glow_pass.d.ts +2 -2
- package/pass/glow_pass.js +310 -254
- package/pass/ssao_pass.d.ts +13 -0
- package/pass/ssao_pass.js +372 -0
- package/pass/stroke_pass.d.ts +2 -2
- package/pass/stroke_pass.js +199 -199
- package/shaders/FXAAShaderMaterial.d.ts +3 -3
- package/shaders/FXAAShaderMaterial.js +21 -21
- package/shaders/baseTextureToRenderShader.d.ts +2 -2
- package/shaders/baseTextureToRenderShader.js +14 -14
- package/shaders/copyShader.d.ts +3 -3
- package/shaders/copyShader.js +14 -14
- package/shaders.d.ts +5 -5
- package/shaders.js +42 -42
- package/threeLoader.d.ts +34 -34
- package/threeLoader.js +527 -527
- package/threeUtils.d.ts +52 -52
- package/threeUtils.js +330 -330
package/KeyFrameAnimation.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: xiaosihan
|
|
3
|
-
* @Date: 2023-02-16 00:22:31
|
|
4
|
-
* @Last Modified by: xiaosihan
|
|
5
|
-
* @Last Modified time: 2023-02-16 19:08:55
|
|
6
|
-
*/
|
|
7
|
-
import { last } from "lodash";
|
|
8
|
-
import { BufferAttribute, Line, LineBasicMaterial, Object3D } from "three";
|
|
9
|
-
import threeUtils from "./threeUtils";
|
|
10
|
-
// 关键帧动画对象
|
|
11
|
-
export default class KeyframeAnimation extends Object3D {
|
|
12
|
-
constructor(props) {
|
|
13
|
-
super();
|
|
14
|
-
// 速度调整
|
|
15
|
-
this.speedScale = props.speedScale || 1;
|
|
16
|
-
// 设置关键帧对象数组
|
|
17
|
-
this.setKeyframes(props.keyframes);
|
|
18
|
-
// 设置对象
|
|
19
|
-
this.setObject3D(props.object3d);
|
|
20
|
-
}
|
|
21
|
-
// 速度调整
|
|
22
|
-
speedScale = 1;
|
|
23
|
-
// 需要需要移动的对象
|
|
24
|
-
object3d;
|
|
25
|
-
//路径辅助线
|
|
26
|
-
halperLine = new Line(undefined, new LineBasicMaterial({ color: "#f00" }));
|
|
27
|
-
// 关键帧数组
|
|
28
|
-
keyframes = [];
|
|
29
|
-
// 设置需要移动的对象
|
|
30
|
-
setObject3D(object3d) {
|
|
31
|
-
this.object3d = object3d;
|
|
32
|
-
if (threeUtils.isDev) {
|
|
33
|
-
this.children = [object3d, this.halperLine];
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.children = [object3d];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// 获取单个关键帧
|
|
40
|
-
getKeyframe(i) {
|
|
41
|
-
return this.keyframes[i];
|
|
42
|
-
}
|
|
43
|
-
// 设置单个关键帧
|
|
44
|
-
setKeyframe(i, keyframe) {
|
|
45
|
-
this.keyframes[i] = keyframe;
|
|
46
|
-
this.setKeyframes(this.keyframes);
|
|
47
|
-
}
|
|
48
|
-
//设置全部关键帧
|
|
49
|
-
setKeyframes(keyframes) {
|
|
50
|
-
this.keyframes = keyframes;
|
|
51
|
-
const position = [];
|
|
52
|
-
keyframes.map(k => {
|
|
53
|
-
position.push(k.position.x);
|
|
54
|
-
position.push(k.position.y);
|
|
55
|
-
position.push(k.position.z);
|
|
56
|
-
});
|
|
57
|
-
this.halperLine.geometry.setAttribute("position", new BufferAttribute(new Float32Array(position), 3, false));
|
|
58
|
-
}
|
|
59
|
-
// 更具关键帧的信息更新 对象的位置
|
|
60
|
-
update() {
|
|
61
|
-
const { _timeTemp } = threeUtils;
|
|
62
|
-
const maxtimetemp = last(this.keyframes).timeTemp;
|
|
63
|
-
const currentTime = _timeTemp % maxtimetemp;
|
|
64
|
-
const currentKeyframeIndex = this.keyframes.findIndex(k => currentTime < k.timeTemp);
|
|
65
|
-
const startKeyframe = this.keyframes[currentKeyframeIndex - 1];
|
|
66
|
-
const endKeyframe = this.keyframes[currentKeyframeIndex];
|
|
67
|
-
const progress = (currentTime - startKeyframe.timeTemp) / (endKeyframe.timeTemp - startKeyframe.timeTemp);
|
|
68
|
-
this.object3d.position.copy(endKeyframe.position).sub(startKeyframe.position).multiplyScalar(progress).add(startKeyframe.position);
|
|
69
|
-
this.object3d.scale.copy(endKeyframe.scale).sub(startKeyframe.scale).multiplyScalar(progress).add(startKeyframe.scale);
|
|
70
|
-
this.object3d.rotation.set((endKeyframe.rotation.x - startKeyframe.rotation.x) * progress + startKeyframe.rotation.x, (endKeyframe.rotation.y - startKeyframe.rotation.y) * progress + startKeyframe.rotation.y, (endKeyframe.rotation.z - startKeyframe.rotation.z) * progress + startKeyframe.rotation.z);
|
|
71
|
-
this.dispatchEvent({ type: "update" });
|
|
72
|
-
}
|
|
73
|
-
//更新关键帧的实例矩阵
|
|
74
|
-
updateMatrix() {
|
|
75
|
-
this.update();
|
|
76
|
-
super.updateMatrix();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* @Author: xiaosihan
|
|
3
|
+
* @Date: 2023-02-16 00:22:31
|
|
4
|
+
* @Last Modified by: xiaosihan
|
|
5
|
+
* @Last Modified time: 2023-02-16 19:08:55
|
|
6
|
+
*/
|
|
7
|
+
import { last } from "lodash";
|
|
8
|
+
import { BufferAttribute, Line, LineBasicMaterial, Object3D } from "three";
|
|
9
|
+
import threeUtils from "./threeUtils";
|
|
10
|
+
// 关键帧动画对象
|
|
11
|
+
export default class KeyframeAnimation extends Object3D {
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super();
|
|
14
|
+
// 速度调整
|
|
15
|
+
this.speedScale = props.speedScale || 1;
|
|
16
|
+
// 设置关键帧对象数组
|
|
17
|
+
this.setKeyframes(props.keyframes);
|
|
18
|
+
// 设置对象
|
|
19
|
+
this.setObject3D(props.object3d);
|
|
20
|
+
}
|
|
21
|
+
// 速度调整
|
|
22
|
+
speedScale = 1;
|
|
23
|
+
// 需要需要移动的对象
|
|
24
|
+
object3d;
|
|
25
|
+
//路径辅助线
|
|
26
|
+
halperLine = new Line(undefined, new LineBasicMaterial({ color: "#f00" }));
|
|
27
|
+
// 关键帧数组
|
|
28
|
+
keyframes = [];
|
|
29
|
+
// 设置需要移动的对象
|
|
30
|
+
setObject3D(object3d) {
|
|
31
|
+
this.object3d = object3d;
|
|
32
|
+
if (threeUtils.isDev) {
|
|
33
|
+
this.children = [object3d, this.halperLine];
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.children = [object3d];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// 获取单个关键帧
|
|
40
|
+
getKeyframe(i) {
|
|
41
|
+
return this.keyframes[i];
|
|
42
|
+
}
|
|
43
|
+
// 设置单个关键帧
|
|
44
|
+
setKeyframe(i, keyframe) {
|
|
45
|
+
this.keyframes[i] = keyframe;
|
|
46
|
+
this.setKeyframes(this.keyframes);
|
|
47
|
+
}
|
|
48
|
+
//设置全部关键帧
|
|
49
|
+
setKeyframes(keyframes) {
|
|
50
|
+
this.keyframes = keyframes;
|
|
51
|
+
const position = [];
|
|
52
|
+
keyframes.map(k => {
|
|
53
|
+
position.push(k.position.x);
|
|
54
|
+
position.push(k.position.y);
|
|
55
|
+
position.push(k.position.z);
|
|
56
|
+
});
|
|
57
|
+
this.halperLine.geometry.setAttribute("position", new BufferAttribute(new Float32Array(position), 3, false));
|
|
58
|
+
}
|
|
59
|
+
// 更具关键帧的信息更新 对象的位置
|
|
60
|
+
update() {
|
|
61
|
+
const { _timeTemp } = threeUtils;
|
|
62
|
+
const maxtimetemp = last(this.keyframes).timeTemp;
|
|
63
|
+
const currentTime = _timeTemp % maxtimetemp;
|
|
64
|
+
const currentKeyframeIndex = this.keyframes.findIndex(k => currentTime < k.timeTemp);
|
|
65
|
+
const startKeyframe = this.keyframes[currentKeyframeIndex - 1];
|
|
66
|
+
const endKeyframe = this.keyframes[currentKeyframeIndex];
|
|
67
|
+
const progress = (currentTime - startKeyframe.timeTemp) / (endKeyframe.timeTemp - startKeyframe.timeTemp);
|
|
68
|
+
this.object3d.position.copy(endKeyframe.position).sub(startKeyframe.position).multiplyScalar(progress).add(startKeyframe.position);
|
|
69
|
+
this.object3d.scale.copy(endKeyframe.scale).sub(startKeyframe.scale).multiplyScalar(progress).add(startKeyframe.scale);
|
|
70
|
+
this.object3d.rotation.set((endKeyframe.rotation.x - startKeyframe.rotation.x) * progress + startKeyframe.rotation.x, (endKeyframe.rotation.y - startKeyframe.rotation.y) * progress + startKeyframe.rotation.y, (endKeyframe.rotation.z - startKeyframe.rotation.z) * progress + startKeyframe.rotation.z);
|
|
71
|
+
this.dispatchEvent({ type: "update" });
|
|
72
|
+
}
|
|
73
|
+
//更新关键帧的实例矩阵
|
|
74
|
+
updateMatrix() {
|
|
75
|
+
this.update();
|
|
76
|
+
super.updateMatrix();
|
|
77
|
+
}
|
|
78
|
+
}
|
package/MeshBase.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { AnimationAction, AnimationMixer, Clock, Group, Mesh, Object3D, Vector3 } from "three";
|
|
2
|
-
export default class MeshBase extends Group {
|
|
3
|
-
constructor(url?: string);
|
|
4
|
-
url: string;
|
|
5
|
-
static models: Map<string, Object3D>;
|
|
6
|
-
static loadModeling: Map<string, boolean>;
|
|
7
|
-
loaded: boolean;
|
|
8
|
-
hasAnimation: boolean;
|
|
9
|
-
mixer?: AnimationMixer;
|
|
10
|
-
animationActions: {
|
|
11
|
-
[key: string]: AnimationAction;
|
|
12
|
-
};
|
|
13
|
-
getSuffix(filename: string): string;
|
|
14
|
-
reset(...object: Object3D[]): this;
|
|
15
|
-
loadModel(url: string | File | Array<File>, filename?: string): Promise<void>;
|
|
16
|
-
frustumCulled: boolean;
|
|
17
|
-
castShadow: boolean;
|
|
18
|
-
receiveShadow: boolean;
|
|
19
|
-
resoles: Array<(value: void | PromiseLike<void>) => void>;
|
|
20
|
-
awaitLoaded(): Promise<void>;
|
|
21
|
-
traverseMesh(callback: (mesh: Mesh) => void): Promise<void>;
|
|
22
|
-
clock: Clock;
|
|
23
|
-
setClipActionWeight(weights?: {
|
|
24
|
-
[key: string]: number;
|
|
25
|
-
}): Promise<void>;
|
|
26
|
-
getAnimas(): string[];
|
|
27
|
-
setAnimas(anima?: string): void;
|
|
28
|
-
stop(): void;
|
|
29
|
-
updateMatrix(): void;
|
|
30
|
-
getSize(): Promise<Vector3>;
|
|
31
|
-
center(): Promise<void>;
|
|
32
|
-
alignBottom(y?: number): Promise<void>;
|
|
33
|
-
scaleTo(size?: number, key?: Array<"x" | "y" | "z">): Promise<void>;
|
|
34
|
-
expandBynormal(length: number): void;
|
|
35
|
-
}
|
|
1
|
+
import { AnimationAction, AnimationMixer, Clock, Group, Mesh, Object3D, Vector3 } from "three";
|
|
2
|
+
export default class MeshBase extends Group {
|
|
3
|
+
constructor(url?: string);
|
|
4
|
+
url: string;
|
|
5
|
+
static models: Map<string, Object3D>;
|
|
6
|
+
static loadModeling: Map<string, boolean>;
|
|
7
|
+
loaded: boolean;
|
|
8
|
+
hasAnimation: boolean;
|
|
9
|
+
mixer?: AnimationMixer;
|
|
10
|
+
animationActions: {
|
|
11
|
+
[key: string]: AnimationAction;
|
|
12
|
+
};
|
|
13
|
+
getSuffix(filename: string): string;
|
|
14
|
+
reset(...object: Object3D[]): this;
|
|
15
|
+
loadModel(url: string | File | Array<File>, filename?: string): Promise<void>;
|
|
16
|
+
frustumCulled: boolean;
|
|
17
|
+
castShadow: boolean;
|
|
18
|
+
receiveShadow: boolean;
|
|
19
|
+
resoles: Array<(value: void | PromiseLike<void>) => void>;
|
|
20
|
+
awaitLoaded(): Promise<void>;
|
|
21
|
+
traverseMesh(callback: (mesh: Mesh) => void): Promise<void>;
|
|
22
|
+
clock: Clock;
|
|
23
|
+
setClipActionWeight(weights?: {
|
|
24
|
+
[key: string]: number;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
getAnimas(): string[];
|
|
27
|
+
setAnimas(anima?: string): void;
|
|
28
|
+
stop(): void;
|
|
29
|
+
updateMatrix(): void;
|
|
30
|
+
getSize(): Promise<Vector3>;
|
|
31
|
+
center(): Promise<void>;
|
|
32
|
+
alignBottom(y?: number): Promise<void>;
|
|
33
|
+
scaleTo(size?: number, key?: Array<"x" | "y" | "z">): Promise<void>;
|
|
34
|
+
expandBynormal(length: number): void;
|
|
35
|
+
}
|