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.
Files changed (125) hide show
  1. package/ApngTexture.d.ts +13 -13
  2. package/ApngTexture.js +61 -61
  3. package/ApngTextureManage.d.ts +18 -18
  4. package/ApngTextureManage.js +87 -87
  5. package/DirectionalLight.d.ts +6 -0
  6. package/DirectionalLight.js +68 -0
  7. package/EventMesh.d.ts +18 -18
  8. package/EventMesh.js +59 -59
  9. package/ExtrudeMesh.d.ts +112 -112
  10. package/ExtrudeMesh.js +366 -366
  11. package/FPScontrol.d.ts +78 -50
  12. package/FPScontrol.js +617 -232
  13. package/Fire/Fire.d.ts +28 -28
  14. package/Fire/Fire.js +79 -79
  15. package/Fire/FireGromtry.d.ts +9 -9
  16. package/Fire/FireGromtry.js +40 -40
  17. package/Fire/FireMaterial.d.ts +28 -28
  18. package/Fire/FireMaterial.js +32 -32
  19. package/Fire/index.d.ts +1 -1
  20. package/Fire/index.js +1 -1
  21. package/Grass/Grass.d.ts +8 -8
  22. package/Grass/Grass.js +38 -38
  23. package/Grass/index.d.ts +1 -1
  24. package/Grass/index.js +1 -1
  25. package/Ground1/Ground1.d.ts +11 -11
  26. package/Ground1/Ground1.js +54 -54
  27. package/Ground1/index.d.ts +1 -1
  28. package/Ground1/index.js +1 -1
  29. package/InstancedMeshBase.d.ts +39 -39
  30. package/InstancedMeshBase.js +293 -293
  31. package/KeyFrameAnimation.d.ts +25 -25
  32. package/KeyFrameAnimation.js +78 -78
  33. package/MeshBase.d.ts +35 -35
  34. package/MeshBase.js +223 -223
  35. package/Mirror.d.ts +25 -25
  36. package/Mirror.js +139 -139
  37. package/PipeMesh/PathGeometry.d.ts +44 -44
  38. package/PipeMesh/PathGeometry.js +300 -300
  39. package/PipeMesh/PathPoint.d.ts +17 -17
  40. package/PipeMesh/PathPoint.js +31 -31
  41. package/PipeMesh/PathPointList.d.ts +31 -31
  42. package/PipeMesh/PathPointList.js +208 -208
  43. package/PipeMesh/PathTubeGeometry.d.ts +25 -25
  44. package/PipeMesh/PathTubeGeometry.js +130 -130
  45. package/PipeMesh/PipeMesh.d.ts +25 -25
  46. package/PipeMesh/PipeMesh.js +63 -63
  47. package/PipeMesh/index.d.ts +1 -1
  48. package/PipeMesh/index.js +1 -1
  49. package/PlaneModal1/PlaneModal1.d.ts +31 -31
  50. package/PlaneModal1/PlaneModal1.js +105 -105
  51. package/PlaneModal1/index.d.ts +1 -1
  52. package/PlaneModal1/index.js +1 -1
  53. package/PlaneText.d.ts +39 -39
  54. package/PlaneText.js +30 -30
  55. package/PlaneWithHtml.d.ts +11 -11
  56. package/PlaneWithHtml.js +63 -68
  57. package/PointLight/PointLight.d.ts +14 -13
  58. package/PointLight/PointLight.js +70 -64
  59. package/PointLight/index.d.ts +1 -1
  60. package/PointLight/index.js +1 -1
  61. package/Sky/Sky.d.ts +9 -9
  62. package/Sky/Sky.js +22 -22
  63. package/Sky/index.d.ts +1 -1
  64. package/Sky/index.js +1 -1
  65. package/SpotLight.d.ts +6 -0
  66. package/SpotLight.js +72 -0
  67. package/SpriteModal1/SpriteModal1.d.ts +30 -30
  68. package/SpriteModal1/SpriteModal1.js +110 -110
  69. package/SpriteModal1/index.d.ts +1 -1
  70. package/SpriteModal1/index.js +1 -1
  71. package/SpriteText.d.ts +45 -45
  72. package/SpriteText.js +163 -163
  73. package/SpriteText2.d.ts +47 -47
  74. package/SpriteText2.js +198 -198
  75. package/SpriteWithHtml.d.ts +7 -7
  76. package/SpriteWithHtml.js +44 -49
  77. package/Text3D/Text3D.d.ts +20 -20
  78. package/Text3D/Text3D.js +62 -62
  79. package/Text3D/fontController.d.ts +59 -59
  80. package/Text3D/fontController.js +199 -199
  81. package/Text3D/index.d.ts +1 -1
  82. package/Text3D/index.js +1 -1
  83. package/ThreeBase.d.ts +111 -81
  84. package/ThreeBase.js +656 -560
  85. package/ThreeMouse.d.ts +40 -40
  86. package/ThreeMouse.js +407 -407
  87. package/Transition.d.ts +40 -40
  88. package/Transition.js +210 -210
  89. package/Water/Water.d.ts +5 -0
  90. package/Water/Water.js +26 -0
  91. package/Water/waternormals.jpg +0 -0
  92. package/declare.d.ts +167 -0
  93. package/index.d.ts +1 -1
  94. package/index.js +2 -2
  95. package/keyContorls.d.ts +25 -25
  96. package/keyContorls.js +98 -98
  97. package/package.json +3 -2
  98. package/pass/bloom_pass.d.ts +2 -2
  99. package/pass/bloom_pass.js +99 -99
  100. package/pass/cover_pass.d.ts +2 -2
  101. package/pass/cover_pass.js +95 -95
  102. package/pass/emissive_ao_pass.d.ts +13 -0
  103. package/pass/emissive_ao_pass.js +370 -0
  104. package/pass/frosted_glass_pass.d.ts +2 -0
  105. package/pass/frosted_glass_pass.js +275 -0
  106. package/pass/fsQuad.d.ts +9 -9
  107. package/pass/fsQuad.js +28 -28
  108. package/pass/glow_pass.d.ts +2 -2
  109. package/pass/glow_pass.js +310 -254
  110. package/pass/ssao_pass.d.ts +13 -0
  111. package/pass/ssao_pass.js +372 -0
  112. package/pass/stroke_pass.d.ts +2 -2
  113. package/pass/stroke_pass.js +199 -199
  114. package/shaders/FXAAShaderMaterial.d.ts +3 -3
  115. package/shaders/FXAAShaderMaterial.js +21 -21
  116. package/shaders/baseTextureToRenderShader.d.ts +2 -2
  117. package/shaders/baseTextureToRenderShader.js +14 -14
  118. package/shaders/copyShader.d.ts +3 -3
  119. package/shaders/copyShader.js +14 -14
  120. package/shaders.d.ts +5 -5
  121. package/shaders.js +42 -42
  122. package/threeLoader.d.ts +34 -34
  123. package/threeLoader.js +527 -527
  124. package/threeUtils.d.ts +52 -52
  125. package/threeUtils.js +330 -330
@@ -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
+ }