three-base 1.129.15 → 2.0.1

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 (91) hide show
  1. package/README.md +1 -0
  2. package/index.js +1 -37
  3. package/index.ts +1 -61
  4. package/package.json +3 -4
  5. package/lib/ApngTexture.d.ts +0 -13
  6. package/lib/ApngTexture.js +0 -61
  7. package/lib/ApngTexture.ts +0 -91
  8. package/lib/ApngTextureManage.d.ts +0 -18
  9. package/lib/ApngTextureManage.js +0 -87
  10. package/lib/ApngTextureManage.ts +0 -130
  11. package/lib/EventMesh.d.ts +0 -18
  12. package/lib/EventMesh.js +0 -59
  13. package/lib/EventMesh.ts +0 -79
  14. package/lib/ExtrudeMesh.d.ts +0 -111
  15. package/lib/ExtrudeMesh.js +0 -363
  16. package/lib/ExtrudeMesh.ts +0 -571
  17. package/lib/FPScontrol.d.ts +0 -44
  18. package/lib/FPScontrol.js +0 -170
  19. package/lib/FPScontrol.ts +0 -209
  20. package/lib/InstancedGroupMesh.d.ts +0 -10
  21. package/lib/InstancedGroupMesh.js +0 -63
  22. package/lib/InstancedGroupMesh.ts +0 -80
  23. package/lib/KeyFrameAnimation.d.ts +0 -25
  24. package/lib/KeyFrameAnimation.js +0 -78
  25. package/lib/KeyFrameAnimation.ts +0 -122
  26. package/lib/PlaneText.d.ts +0 -37
  27. package/lib/PlaneText.js +0 -30
  28. package/lib/PlaneText.ts +0 -58
  29. package/lib/PlaneWithHtml.d.ts +0 -11
  30. package/lib/PlaneWithHtml.js +0 -67
  31. package/lib/PlaneWithHtml.ts +0 -84
  32. package/lib/PointLight/PointLight.d.ts +0 -13
  33. package/lib/PointLight/PointLight.js +0 -63
  34. package/lib/PointLight/PointLight.ts +0 -74
  35. package/lib/PointLight/pointLight_map.png +0 -0
  36. package/lib/Sky/Sky.d.ts +0 -13
  37. package/lib/Sky/Sky.js +0 -28
  38. package/lib/Sky/Sky.ts +0 -36
  39. package/lib/Sky/bluesky.jpg +0 -0
  40. package/lib/SpriteText.d.ts +0 -45
  41. package/lib/SpriteText.js +0 -162
  42. package/lib/SpriteText.ts +0 -189
  43. package/lib/SpriteText2.d.ts +0 -47
  44. package/lib/SpriteText2.js +0 -197
  45. package/lib/SpriteText2.ts +0 -236
  46. package/lib/Text3D/Text3D.d.ts +0 -20
  47. package/lib/Text3D/Text3D.js +0 -61
  48. package/lib/Text3D/Text3D.ts +0 -92
  49. package/lib/Text3D/fontController.d.ts +0 -59
  50. package/lib/Text3D/fontController.js +0 -200
  51. package/lib/Text3D/fontController.ts +0 -285
  52. package/lib/Text3D/gentilis.json +0 -811
  53. package/lib/ThreeBase.d.ts +0 -59
  54. package/lib/ThreeBase.js +0 -395
  55. package/lib/ThreeBase.ts +0 -475
  56. package/lib/ThreeMouse.d.ts +0 -39
  57. package/lib/ThreeMouse.js +0 -357
  58. package/lib/ThreeMouse.ts +0 -464
  59. package/lib/Transition.d.ts +0 -43
  60. package/lib/Transition.js +0 -196
  61. package/lib/Transition.ts +0 -268
  62. package/lib/index.d.ts +0 -22
  63. package/lib/keyContorls.d.ts +0 -25
  64. package/lib/keyContorls.js +0 -98
  65. package/lib/keyContorls.ts +0 -127
  66. package/lib/planeModal1/PlaneModal1.d.ts +0 -31
  67. package/lib/planeModal1/PlaneModal1.js +0 -104
  68. package/lib/planeModal1/PlaneModal1.ts +0 -150
  69. package/lib/planeModal1/planeModal.png +0 -0
  70. package/lib/shaders.d.ts +0 -17
  71. package/lib/shaders.js +0 -245
  72. package/lib/shaders.ts +0 -264
  73. package/lib/spriteModal1/SpriteModal1.d.ts +0 -30
  74. package/lib/spriteModal1/SpriteModal1.js +0 -109
  75. package/lib/spriteModal1/SpriteModal1.ts +0 -159
  76. package/lib/spriteModal1/spriteModal1.png +0 -0
  77. package/lib/stroke_pass/FullScreenQuad.d.ts +0 -7
  78. package/lib/stroke_pass/FullScreenQuad.js +0 -25
  79. package/lib/stroke_pass/FullScreenQuad.ts +0 -33
  80. package/lib/stroke_pass/stroke_pass.d.ts +0 -2
  81. package/lib/stroke_pass/stroke_pass.js +0 -190
  82. package/lib/stroke_pass/stroke_pass.ts +0 -211
  83. package/lib/threeLoader.d.ts +0 -20
  84. package/lib/threeLoader.js +0 -110
  85. package/lib/threeLoader.ts +0 -136
  86. package/lib/threeUtils.d.ts +0 -41
  87. package/lib/threeUtils.js +0 -179
  88. package/lib/threeUtils.ts +0 -212
  89. package/lib/type.d.ts +0 -0
  90. package/lib/type.js +0 -10
  91. package/lib/type.ts +0 -13
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  .创建一个 homeRender.ts 模块
3
3
  import { AmbientLight, BoxGeometry, Mesh, MeshLambertMaterial, PointLight } from "three";
4
4
  import ThreeBase, { Transition } from "three-base";
5
+ import Transition from "three-base/Transition";
5
6
 
6
7
  // 做项目找我 qq:389652405
7
8
  class HomeRender extends ThreeBase {
package/index.js CHANGED
@@ -1,38 +1,2 @@
1
1
  // 基类
2
- export { default } from "./lib/ThreeBase";
3
- // 事件对象
4
- export { default as EventMesh } from "./lib/EventMesh";
5
- // 挤出模型
6
- export { default as ExtrudeMesh } from "./lib/ExtrudeMesh";
7
- // 关键帧动画对象
8
- export { default as KeyFrameAnimation } from "./lib/KeyFrameAnimation";
9
- //实例模型组对象
10
- export { default as InstancedGroupMesh } from "./lib/InstancedGroupMesh";
11
- //点光源
12
- export { default as PointLight } from "./lib/PointLight/PointLight";
13
- //天空球
14
- export { default as Sky } from "./lib/Sky/Sky";
15
- //键盘控制器
16
- export { default as keyContorls } from "./lib/keyContorls";
17
- // 动画过度对象
18
- export { default as Transition } from "./lib/Transition";
19
- // 公共方法
20
- export { default as threeUtils } from "./lib/threeUtils";
21
- // 加载器
22
- export { default as threeLoader } from "./lib/threeLoader";
23
- // 第一人称控制器
24
- export { default as FPScontrol } from "./lib/FPScontrol";
25
- // 平面文字
26
- export { default as PlaneText } from "./lib/PlaneText";
27
- // 精灵文字
28
- export { default as SpriteText } from "./lib/SpriteText";
29
- // 精灵文字样式2
30
- export { default as SpriteText2 } from "./lib/SpriteText2";
31
- //精灵文本框
32
- export { default as SpriteModal1 } from "./lib/spriteModal1/SpriteModal1";
33
- //平面文本框
34
- export { default as PlaneModal1 } from "./lib/planeModal1/PlaneModal1";
35
- // 3D文字
36
- export { default as Text3D } from "./lib/Text3D/Text3D";
37
- // html面板
38
- export { default as PlaneWithHtml } from "./lib/PlaneWithHtml";
2
+ export { default } from "./ThreeBase";
package/index.ts CHANGED
@@ -1,62 +1,2 @@
1
1
  // 基类
2
- export { default } from "./lib/ThreeBase";
3
-
4
- // 事件对象
5
- export { default as EventMesh } from "./lib/EventMesh";
6
-
7
- // 挤出模型
8
- export { default as ExtrudeMesh } from "./lib/ExtrudeMesh";
9
- export type { ExtrudePath } from "./lib/ExtrudeMesh";
10
- export type { ExtrudeMeshProps } from "./lib/ExtrudeMesh";
11
-
12
-
13
- // 关键帧动画对象
14
- export { default as KeyFrameAnimation } from "./lib/KeyFrameAnimation";
15
- export type { KeyframeAnimationProps } from "./lib/KeyFrameAnimation";
16
- export type { Keyframe } from "./lib/KeyFrameAnimation";
17
-
18
- //实例模型组对象
19
- export { default as InstancedGroupMesh } from "./lib/InstancedGroupMesh";
20
-
21
- //点光源
22
- export { default as PointLight } from "./lib/PointLight/PointLight";
23
-
24
- //天空球
25
- export { default as Sky } from "./lib/Sky/Sky";
26
-
27
- //键盘控制器
28
- export { default as keyContorls } from "./lib/keyContorls";
29
-
30
- // 动画过度对象
31
- export { default as Transition } from "./lib/Transition";
32
-
33
- // 公共方法
34
- export { default as threeUtils } from "./lib/threeUtils";
35
-
36
- // 加载器
37
- export { default as threeLoader } from "./lib/threeLoader";
38
-
39
- // 第一人称控制器
40
- export { default as FPScontrol } from "./lib/FPScontrol";
41
-
42
- // 平面文字
43
- export { default as PlaneText } from "./lib/PlaneText";
44
-
45
- // 精灵文字
46
- export { default as SpriteText } from "./lib/SpriteText";
47
-
48
- // 精灵文字样式2
49
- export { default as SpriteText2 } from "./lib/SpriteText2";
50
-
51
- //精灵文本框
52
- export { default as SpriteModal1 } from "./lib/spriteModal1/SpriteModal1";
53
-
54
- //平面文本框
55
- export { default as PlaneModal1 } from "./lib/planeModal1/PlaneModal1";
56
-
57
- // 3D文字
58
- export { default as Text3D } from "./lib/Text3D/Text3D";
59
- export type { Text3DProps } from "./lib/Text3D/Text3D";
60
-
61
- // html面板
62
- export { default as PlaneWithHtml } from "./lib/PlaneWithHtml";
2
+ export { default } from "./ThreeBase";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-base",
3
- "version": "1.129.15",
3
+ "version": "2.0.1",
4
4
  "description": "three 3d three-base",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,6 @@
17
17
  "files": [
18
18
  "index.js",
19
19
  "index.ts",
20
- "index.js",
21
20
  "declare.d.ts",
22
21
  "lib/*.js",
23
22
  "lib/*.ts",
@@ -41,9 +40,9 @@
41
40
  "dependencies": {
42
41
  "apng-js": "^1",
43
42
  "lodash": "^4",
44
- "three": "0.129.0",
43
+ "three": "^0.152.0",
45
44
  "dexie": "^3",
46
- "@types/three": "0.152.0",
45
+ "@types/three": "^0.152.0",
47
46
  "@types/lodash": "^4",
48
47
  "vite": "*",
49
48
  "@types/node": "*",
@@ -1,13 +0,0 @@
1
- import { APNG } from "apng-js";
2
- import Player from "apng-js/types/library/player";
3
- import { CanvasTexture } from "three";
4
- export default class ApngTexture extends CanvasTexture {
5
- constructor(url: string);
6
- static TimeTemp: number;
7
- preUpdate: number;
8
- player?: Player;
9
- apng?: APNG;
10
- onUpdate: () => void;
11
- getUuid(): number | "";
12
- loadApng(url: string): Promise<void>;
13
- }
@@ -1,61 +0,0 @@
1
- import parseAPNG from "apng-js";
2
- import axios from "axios";
3
- import { CanvasTexture } from "three";
4
- import threeUtils from "./threeUtils";
5
- export default class ApngTexture extends CanvasTexture {
6
- constructor(url) {
7
- super(document.createElement("canvas"));
8
- this.loadApng(url);
9
- }
10
- // 获取时间戳
11
- static TimeTemp = performance.now();
12
- // 上一次更新时间
13
- preUpdate = 0;
14
- player;
15
- // apng 对象
16
- apng;
17
- // 更新纹理
18
- onUpdate = () => {
19
- if (this.preUpdate === ApngTexture.TimeTemp) {
20
- return;
21
- }
22
- this.preUpdate = ApngTexture.TimeTemp;
23
- if (this.player) {
24
- this.player.renderNextFrame();
25
- }
26
- };
27
- // 获取当前帧id
28
- getUuid() {
29
- if (this.apng) {
30
- let currentTime = ApngTexture.TimeTemp % this.apng.playTime;
31
- let i = 0;
32
- while (this.apng.frames[i] && currentTime > this.apng.frames[i].delay) {
33
- currentTime -= this.apng.frames[i].delay;
34
- i++;
35
- }
36
- return this.apng.frames[i].delay;
37
- }
38
- else {
39
- return "";
40
- }
41
- }
42
- // 加载apng图片
43
- async loadApng(url) {
44
- const res = await axios.get(url, { method: "post", responseType: "blob" });
45
- const blob = new Blob([res.data]);
46
- const reader = new FileReader();
47
- await new Promise((resolve) => {
48
- reader.onload = () => resolve();
49
- reader.readAsArrayBuffer(blob);
50
- });
51
- const apng = parseAPNG(reader.result);
52
- this.dispose();
53
- this.image.width = apng.width;
54
- this.image.height = apng.height;
55
- this.player = await apng.getPlayer(this.image.getContext("2d"));
56
- }
57
- }
58
- // 定时更新时间戳
59
- threeUtils.addEventListener("requestAnimationFrame", (e) => {
60
- ApngTexture.TimeTemp = e.timeTemp;
61
- });
@@ -1,91 +0,0 @@
1
-
2
-
3
- import parseAPNG, { APNG } from "apng-js";
4
- import Player from "apng-js/types/library/player";
5
- import axios from "axios";
6
- import { CanvasTexture } from "three";
7
- import threeUtils from "./threeUtils";
8
-
9
-
10
- export default class ApngTexture extends CanvasTexture {
11
-
12
- constructor(url: string) {
13
- super(document.createElement("canvas"));
14
- this.loadApng(url);
15
- }
16
- // 获取时间戳
17
- static TimeTemp = performance.now();
18
-
19
- // 上一次更新时间
20
- preUpdate = 0;
21
-
22
- player?: Player;
23
-
24
- // apng 对象
25
- apng?: APNG;
26
-
27
- // 更新纹理
28
- onUpdate = () => {
29
-
30
- if (this.preUpdate === ApngTexture.TimeTemp) {
31
- return;
32
- }
33
-
34
- this.preUpdate = ApngTexture.TimeTemp;
35
-
36
- if (this.player) {
37
- this.player.renderNextFrame();
38
- }
39
- };
40
-
41
- // 获取当前帧id
42
- getUuid() {
43
-
44
- if (this.apng) {
45
-
46
- let currentTime = ApngTexture.TimeTemp % this.apng.playTime;
47
-
48
- let i = 0;
49
- while (this.apng.frames[i] && currentTime > this.apng.frames[i].delay) {
50
- currentTime -= this.apng.frames[i].delay;
51
- i++;
52
- }
53
-
54
- return this.apng.frames[i].delay;
55
-
56
- } else {
57
-
58
- return "";
59
-
60
- }
61
-
62
- }
63
-
64
- // 加载apng图片
65
- async loadApng(url: string) {
66
-
67
- const res = await axios.get(url, { method: "post", responseType: "blob" });
68
-
69
- const blob = new Blob([res.data]);
70
-
71
- const reader = new FileReader();
72
-
73
- await new Promise<void>((resolve) => {
74
- reader.onload = () => resolve();
75
- reader.readAsArrayBuffer(blob);
76
- });
77
-
78
- const apng = (parseAPNG(reader.result as ArrayBuffer) as APNG);
79
-
80
- this.dispose();
81
- this.image.width = apng.width;
82
- this.image.height = apng.height;
83
- this.player = await apng.getPlayer(this.image.getContext("2d")!);
84
- }
85
-
86
- }
87
-
88
- // 定时更新时间戳
89
- threeUtils.addEventListener("requestAnimationFrame", (e) => {
90
- ApngTexture.TimeTemp = e.timeTemp;
91
- });
@@ -1,18 +0,0 @@
1
- import { Texture, TextureLoader } from "three";
2
- /**
3
- * apng 纹理管理对象
4
- */
5
- declare class apngTextureManage {
6
- constructor();
7
- static TextureLoader: TextureLoader;
8
- static isInit: boolean;
9
- static TimeTemp: number;
10
- playTimes: Map<any, any>;
11
- anpgTextList: {
12
- [key: string]: Texture[];
13
- };
14
- getTexture(path: string): Texture;
15
- loadApng(url: string): Promise<void>;
16
- }
17
- declare const ApngTextureManage: apngTextureManage;
18
- export default ApngTextureManage;
@@ -1,87 +0,0 @@
1
- import parseAPNG from "apng-js";
2
- import axios from "axios";
3
- import { isEmpty } from "lodash";
4
- import { MirroredRepeatWrapping, TextureLoader } from "three";
5
- import threeUtils from "./threeUtils";
6
- /**
7
- * apng 纹理管理对象
8
- */
9
- class apngTextureManage {
10
- constructor() {
11
- // 初始化定时更新时间戳
12
- if (apngTextureManage.isInit) {
13
- apngTextureManage.isInit = false;
14
- threeUtils.addEventListener("requestAnimationFrame5000", (e) => {
15
- apngTextureManage.TimeTemp = e.timeTemp;
16
- });
17
- }
18
- }
19
- static TextureLoader = new TextureLoader();
20
- static isInit = true;
21
- // 获取时间戳
22
- static TimeTemp = performance.now();
23
- // 每个动态纹理的播放总时长
24
- playTimes = new Map();
25
- // 保存所有的动态纹理
26
- anpgTextList = {};
27
- // 获取动态纹理 需要每帧都获取一下
28
- getTexture(path) {
29
- // 如果 没有这个纹理就返回空同时开始加载这个纹理
30
- if (!this.anpgTextList[path]) {
31
- this.anpgTextList[path] = [];
32
- this.loadApng(path);
33
- return null;
34
- }
35
- else if (isEmpty(this.anpgTextList[path])) {
36
- return null;
37
- }
38
- else {
39
- const playTime = this.playTimes.get(path);
40
- let currentTime = apngTextureManage.TimeTemp % playTime;
41
- let i = 0;
42
- while (this.anpgTextList[path][i] && currentTime > Number(this.anpgTextList[path][i].name)) {
43
- currentTime -= Number(this.anpgTextList[path][i].name);
44
- i++;
45
- }
46
- this.anpgTextList[path][i].needsUpdate = true;
47
- return this.anpgTextList[path][i];
48
- }
49
- }
50
- // 加载apng图片
51
- async loadApng(url) {
52
- const res = await axios.get(url, { method: "post", responseType: "blob" });
53
- const blob = new Blob([res.data]);
54
- const reader = new FileReader();
55
- await new Promise((resolve) => {
56
- reader.onload = () => resolve();
57
- reader.readAsArrayBuffer(blob);
58
- });
59
- const apng = parseAPNG(reader.result);
60
- // 存储播放时长
61
- this.playTimes.set(url, apng.playTime);
62
- // for (let i = 0; i < apng.frames.length; i++) {
63
- // const frame = apng.frames[i];
64
- // frame.createImage();
65
- // await new Promise(resolve => frame.imageElement!.onload = resolve);
66
- // }
67
- for (let i = 0; i < apng.frames.length; i++) {
68
- const frame = apng.frames[i];
69
- var blobUrl = URL.createObjectURL(frame.imageData);
70
- const texture = apngTextureManage.TextureLoader.load(blobUrl);
71
- texture.anisotropy = 16;
72
- texture.wrapS = texture.wrapT = MirroredRepeatWrapping;
73
- // export const RepeatWrapping: Wrapping;
74
- // export const ClampToEdgeWrapping: Wrapping;
75
- // export const MirroredRepeatWrapping: Wrapping;
76
- // magFilter: TextureFilter;
77
- // minFilter: TextureFilter;
78
- texture.name = String(frame.delay);
79
- texture.center.set(0.5, 0.5);
80
- texture.repeat.set(apng.width / frame.width, apng.height / frame.height);
81
- // texture.needsUpdate = true;
82
- this.anpgTextList[url].push(texture);
83
- }
84
- }
85
- }
86
- const ApngTextureManage = new apngTextureManage();
87
- export default ApngTextureManage;
@@ -1,130 +0,0 @@
1
-
2
-
3
- import parseAPNG, { APNG } from "apng-js";
4
- import axios from "axios";
5
- import { isEmpty } from "lodash";
6
- import { MirroredRepeatWrapping, Texture, TextureLoader } from "three";
7
- import threeUtils from "./threeUtils";
8
-
9
-
10
-
11
- /**
12
- * apng 纹理管理对象
13
- */
14
- class apngTextureManage {
15
-
16
- constructor() {
17
-
18
- // 初始化定时更新时间戳
19
- if (apngTextureManage.isInit) {
20
- apngTextureManage.isInit = false;
21
- threeUtils.addEventListener("requestAnimationFrame5000", (e) => {
22
- apngTextureManage.TimeTemp = e.timeTemp;
23
- });
24
- }
25
-
26
- }
27
-
28
- static TextureLoader = new TextureLoader();
29
-
30
- static isInit = true;
31
-
32
- // 获取时间戳
33
- static TimeTemp = performance.now();
34
-
35
- // 每个动态纹理的播放总时长
36
- playTimes = new Map();
37
-
38
- // 保存所有的动态纹理
39
- anpgTextList: { [key: string]: Texture[] } = {};
40
-
41
- // 获取动态纹理 需要每帧都获取一下
42
- getTexture(path: string) {
43
- // 如果 没有这个纹理就返回空同时开始加载这个纹理
44
- if (!this.anpgTextList[path]) {
45
- this.anpgTextList[path] = [];
46
-
47
- this.loadApng(path);
48
-
49
- return null;
50
-
51
- } else if (isEmpty(this.anpgTextList[path])) {
52
-
53
- return null;
54
-
55
- } else {
56
-
57
- const playTime = this.playTimes.get(path);
58
- let currentTime = apngTextureManage.TimeTemp % playTime;
59
-
60
- let i = 0;
61
- while (this.anpgTextList[path][i] && currentTime > Number(this.anpgTextList[path][i].name)) {
62
- currentTime -= Number(this.anpgTextList[path][i].name);
63
- i++;
64
- }
65
-
66
- this.anpgTextList[path][i].needsUpdate = true;
67
-
68
- return this.anpgTextList[path][i];
69
- }
70
- }
71
-
72
- // 加载apng图片
73
- async loadApng(url: string) {
74
-
75
- const res = await axios.get(url, { method: "post", responseType: "blob" });
76
-
77
- const blob = new Blob([res.data]);
78
-
79
- const reader = new FileReader();
80
-
81
- await new Promise<void>((resolve) => {
82
- reader.onload = () => resolve();
83
- reader.readAsArrayBuffer(blob);
84
- });
85
-
86
- const apng = (parseAPNG(reader.result as ArrayBuffer) as APNG);
87
-
88
- // 存储播放时长
89
- this.playTimes.set(url, apng.playTime);
90
-
91
- // for (let i = 0; i < apng.frames.length; i++) {
92
- // const frame = apng.frames[i];
93
- // frame.createImage();
94
- // await new Promise(resolve => frame.imageElement!.onload = resolve);
95
- // }
96
-
97
- for (let i = 0; i < apng.frames.length; i++) {
98
- const frame = apng.frames[i];
99
-
100
- var blobUrl = URL.createObjectURL(frame.imageData!);
101
-
102
- const texture = apngTextureManage.TextureLoader.load(blobUrl);
103
-
104
- texture.anisotropy = 16;
105
-
106
- texture.wrapS = texture.wrapT = MirroredRepeatWrapping;
107
-
108
- // export const RepeatWrapping: Wrapping;
109
- // export const ClampToEdgeWrapping: Wrapping;
110
- // export const MirroredRepeatWrapping: Wrapping;
111
-
112
- // magFilter: TextureFilter;
113
- // minFilter: TextureFilter;
114
-
115
-
116
- texture.name = String(frame.delay);
117
- texture.center.set(0.5, 0.5);
118
- texture.repeat.set(apng.width / frame.width, apng.height / frame.height);
119
- // texture.needsUpdate = true;
120
- this.anpgTextList[url].push(texture);
121
- }
122
-
123
- }
124
-
125
-
126
- }
127
-
128
- const ApngTextureManage = new apngTextureManage();
129
-
130
- export default ApngTextureManage;
@@ -1,18 +0,0 @@
1
- import { BoxGeometry, BufferGeometry, CylinderGeometry, Material, Mesh, MeshNormalMaterial } from "three";
2
- export declare enum CollisionShaere {
3
- cube = "cube",
4
- cylinder = "cylinder"
5
- }
6
- /**
7
- * 碰撞检测用的模型
8
- */
9
- export default class EventMesh extends Mesh<BufferGeometry, Material> {
10
- constructor(type?: CollisionShaere);
11
- static type: typeof CollisionShaere;
12
- static material: MeshNormalMaterial;
13
- renderOrder: number;
14
- static cubeGeo: BoxGeometry;
15
- static cylinderGeo: CylinderGeometry;
16
- isEventMesh: boolean;
17
- setType(type: CollisionShaere): void;
18
- }
package/lib/EventMesh.js DELETED
@@ -1,59 +0,0 @@
1
- /*
2
- * @Author: xiaosihan
3
- * @Date: 2022-03-20 12:55:37
4
- * @Last Modified by: xiaosihan
5
- * @Last Modified time: 2023-02-07 11:19:56
6
- */
7
- import { BoxGeometry, CylinderGeometry, DoubleSide, Mesh, MeshBasicMaterial, MeshNormalMaterial } from "three";
8
- import threeUtils from "./threeUtils";
9
- // 碰撞的形状
10
- export var CollisionShaere;
11
- (function (CollisionShaere) {
12
- CollisionShaere["cube"] = "cube";
13
- CollisionShaere["cylinder"] = "cylinder"; // 圆柱体
14
- })(CollisionShaere || (CollisionShaere = {}));
15
- /**
16
- * 碰撞检测用的模型
17
- */
18
- export default class EventMesh extends Mesh {
19
- constructor(type = CollisionShaere.cube) {
20
- super();
21
- this.material = EventMesh.material;
22
- this.setType(type);
23
- // 生产环境 不用渲染
24
- if (threeUtils.isProd) {
25
- this.material = new MeshBasicMaterial({
26
- side: DoubleSide,
27
- transparent: true,
28
- opacity: 0.25,
29
- alphaTest: 1
30
- });
31
- }
32
- }
33
- static type = CollisionShaere;
34
- static material = new MeshNormalMaterial({
35
- side: DoubleSide,
36
- transparent: true,
37
- opacity: 0.3,
38
- });
39
- renderOrder = 99;
40
- // 正方体 网格模型
41
- static cubeGeo = new BoxGeometry(1, 1, 1, 1, 1, 1);
42
- // 圆柱体 网格模型
43
- static cylinderGeo = new CylinderGeometry(1, 1, 1, 50, 1, false, 0, Math.PI * 2);
44
- // 是否是碰撞检测专用的模型
45
- isEventMesh = true;
46
- setType(type) {
47
- switch (type) {
48
- case EventMesh.type.cube:
49
- this.geometry = EventMesh.cubeGeo;
50
- break;
51
- case EventMesh.type.cylinder:
52
- this.geometry = EventMesh.cylinderGeo;
53
- break;
54
- default:
55
- break;
56
- }
57
- this.geometry.computeVertexNormals();
58
- }
59
- }