@p100-web/core-three 100.0.65 → 100.0.66

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 (153) hide show
  1. package/package.json +2 -2
  2. package/dist/src/App.d.ts +0 -40
  3. package/dist/src/App.d.ts.map +0 -1
  4. package/dist/src/App.js +0 -171
  5. package/dist/src/App.js.map +0 -1
  6. package/dist/src/ComponentFactory.d.ts +0 -5
  7. package/dist/src/ComponentFactory.d.ts.map +0 -1
  8. package/dist/src/ComponentFactory.js +0 -17
  9. package/dist/src/ComponentFactory.js.map +0 -1
  10. package/dist/src/PCanvas.d.ts +0 -171
  11. package/dist/src/PCanvas.d.ts.map +0 -1
  12. package/dist/src/PCanvas.js +0 -992
  13. package/dist/src/PCanvas.js.map +0 -1
  14. package/dist/src/ThreeEngine.d.ts +0 -25
  15. package/dist/src/ThreeEngine.d.ts.map +0 -1
  16. package/dist/src/ThreeEngine.js +0 -102
  17. package/dist/src/ThreeEngine.js.map +0 -1
  18. package/dist/src/ThreeNodeRenderer.d.ts +0 -32
  19. package/dist/src/ThreeNodeRenderer.d.ts.map +0 -1
  20. package/dist/src/ThreeNodeRenderer.js +0 -87
  21. package/dist/src/ThreeNodeRenderer.js.map +0 -1
  22. package/dist/src/media/AudioLoader.d.ts +0 -32
  23. package/dist/src/media/AudioLoader.d.ts.map +0 -1
  24. package/dist/src/media/AudioLoader.js +0 -110
  25. package/dist/src/media/AudioLoader.js.map +0 -1
  26. package/dist/src/media/EnvironmentLoader.d.ts +0 -40
  27. package/dist/src/media/EnvironmentLoader.d.ts.map +0 -1
  28. package/dist/src/media/EnvironmentLoader.js +0 -120
  29. package/dist/src/media/EnvironmentLoader.js.map +0 -1
  30. package/dist/src/media/ImageLoader.d.ts +0 -36
  31. package/dist/src/media/ImageLoader.d.ts.map +0 -1
  32. package/dist/src/media/ImageLoader.js +0 -160
  33. package/dist/src/media/ImageLoader.js.map +0 -1
  34. package/dist/src/media/MediaLoader.d.ts +0 -14
  35. package/dist/src/media/MediaLoader.d.ts.map +0 -1
  36. package/dist/src/media/MediaLoader.js +0 -70
  37. package/dist/src/media/MediaLoader.js.map +0 -1
  38. package/dist/src/media/ModelLoader.d.ts +0 -49
  39. package/dist/src/media/ModelLoader.d.ts.map +0 -1
  40. package/dist/src/media/ModelLoader.js +0 -223
  41. package/dist/src/media/ModelLoader.js.map +0 -1
  42. package/dist/src/media/VideoLoader.d.ts +0 -35
  43. package/dist/src/media/VideoLoader.d.ts.map +0 -1
  44. package/dist/src/media/VideoLoader.js +0 -105
  45. package/dist/src/media/VideoLoader.js.map +0 -1
  46. package/dist/src/pcomponents/PAnimator.d.ts +0 -24
  47. package/dist/src/pcomponents/PAnimator.d.ts.map +0 -1
  48. package/dist/src/pcomponents/PAnimator.js +0 -129
  49. package/dist/src/pcomponents/PAnimator.js.map +0 -1
  50. package/dist/src/pcomponents/PBasicMaterial.d.ts +0 -17
  51. package/dist/src/pcomponents/PBasicMaterial.d.ts.map +0 -1
  52. package/dist/src/pcomponents/PBasicMaterial.js +0 -142
  53. package/dist/src/pcomponents/PBasicMaterial.js.map +0 -1
  54. package/dist/src/pcomponents/PCollider.d.ts +0 -11
  55. package/dist/src/pcomponents/PCollider.d.ts.map +0 -1
  56. package/dist/src/pcomponents/PCollider.js +0 -61
  57. package/dist/src/pcomponents/PCollider.js.map +0 -1
  58. package/dist/src/pcomponents/PCubeGeometry.d.ts +0 -8
  59. package/dist/src/pcomponents/PCubeGeometry.d.ts.map +0 -1
  60. package/dist/src/pcomponents/PCubeGeometry.js +0 -23
  61. package/dist/src/pcomponents/PCubeGeometry.js.map +0 -1
  62. package/dist/src/pcomponents/PEnvironment.d.ts +0 -14
  63. package/dist/src/pcomponents/PEnvironment.d.ts.map +0 -1
  64. package/dist/src/pcomponents/PEnvironment.js +0 -86
  65. package/dist/src/pcomponents/PEnvironment.js.map +0 -1
  66. package/dist/src/pcomponents/PImageBackground.d.ts +0 -14
  67. package/dist/src/pcomponents/PImageBackground.d.ts.map +0 -1
  68. package/dist/src/pcomponents/PImageBackground.js +0 -85
  69. package/dist/src/pcomponents/PImageBackground.js.map +0 -1
  70. package/dist/src/pcomponents/PLight.d.ts +0 -8
  71. package/dist/src/pcomponents/PLight.d.ts.map +0 -1
  72. package/dist/src/pcomponents/PLight.js +0 -22
  73. package/dist/src/pcomponents/PLight.js.map +0 -1
  74. package/dist/src/pcomponents/PLightDirectional.d.ts +0 -8
  75. package/dist/src/pcomponents/PLightDirectional.d.ts.map +0 -1
  76. package/dist/src/pcomponents/PLightDirectional.js +0 -36
  77. package/dist/src/pcomponents/PLightDirectional.js.map +0 -1
  78. package/dist/src/pcomponents/PMaskedMaterial.d.ts +0 -17
  79. package/dist/src/pcomponents/PMaskedMaterial.d.ts.map +0 -1
  80. package/dist/src/pcomponents/PMaskedMaterial.js +0 -214
  81. package/dist/src/pcomponents/PMaskedMaterial.js.map +0 -1
  82. package/dist/src/pcomponents/PModelGLTF.d.ts +0 -18
  83. package/dist/src/pcomponents/PModelGLTF.d.ts.map +0 -1
  84. package/dist/src/pcomponents/PModelGLTF.js +0 -98
  85. package/dist/src/pcomponents/PModelGLTF.js.map +0 -1
  86. package/dist/src/pcomponents/PPhysicalMaterial.d.ts +0 -13
  87. package/dist/src/pcomponents/PPhysicalMaterial.d.ts.map +0 -1
  88. package/dist/src/pcomponents/PPhysicalMaterial.js +0 -106
  89. package/dist/src/pcomponents/PPhysicalMaterial.js.map +0 -1
  90. package/dist/src/pcomponents/PPlaneGeometry.d.ts +0 -8
  91. package/dist/src/pcomponents/PPlaneGeometry.d.ts.map +0 -1
  92. package/dist/src/pcomponents/PPlaneGeometry.js +0 -23
  93. package/dist/src/pcomponents/PPlaneGeometry.js.map +0 -1
  94. package/dist/src/pcomponents/PProjectRoot.d.ts +0 -8
  95. package/dist/src/pcomponents/PProjectRoot.d.ts.map +0 -1
  96. package/dist/src/pcomponents/PProjectRoot.js +0 -24
  97. package/dist/src/pcomponents/PProjectRoot.js.map +0 -1
  98. package/dist/src/pcomponents/PSlider.d.ts +0 -16
  99. package/dist/src/pcomponents/PSlider.d.ts.map +0 -1
  100. package/dist/src/pcomponents/PSlider.js +0 -69
  101. package/dist/src/pcomponents/PSlider.js.map +0 -1
  102. package/dist/src/pcomponents/PSound.d.ts +0 -17
  103. package/dist/src/pcomponents/PSound.d.ts.map +0 -1
  104. package/dist/src/pcomponents/PSound.js +0 -110
  105. package/dist/src/pcomponents/PSound.js.map +0 -1
  106. package/dist/src/pcomponents/PSphereGeometry.d.ts +0 -9
  107. package/dist/src/pcomponents/PSphereGeometry.d.ts.map +0 -1
  108. package/dist/src/pcomponents/PSphereGeometry.js +0 -24
  109. package/dist/src/pcomponents/PSphereGeometry.js.map +0 -1
  110. package/dist/src/pcomponents/PSprite.d.ts +0 -14
  111. package/dist/src/pcomponents/PSprite.d.ts.map +0 -1
  112. package/dist/src/pcomponents/PSprite.js +0 -79
  113. package/dist/src/pcomponents/PSprite.js.map +0 -1
  114. package/dist/src/pcomponents/PSpriteAnimation.d.ts +0 -15
  115. package/dist/src/pcomponents/PSpriteAnimation.d.ts.map +0 -1
  116. package/dist/src/pcomponents/PSpriteAnimation.js +0 -80
  117. package/dist/src/pcomponents/PSpriteAnimation.js.map +0 -1
  118. package/dist/src/pcomponents/PText.d.ts +0 -10
  119. package/dist/src/pcomponents/PText.d.ts.map +0 -1
  120. package/dist/src/pcomponents/PText.js +0 -44
  121. package/dist/src/pcomponents/PText.js.map +0 -1
  122. package/dist/src/pcomponents/PVideoBackground.d.ts +0 -13
  123. package/dist/src/pcomponents/PVideoBackground.d.ts.map +0 -1
  124. package/dist/src/pcomponents/PVideoBackground.js +0 -85
  125. package/dist/src/pcomponents/PVideoBackground.js.map +0 -1
  126. package/dist/src/pcomponents/PVideoPlayer.d.ts +0 -5
  127. package/dist/src/pcomponents/PVideoPlayer.d.ts.map +0 -1
  128. package/dist/src/pcomponents/PVideoPlayer.js +0 -12
  129. package/dist/src/pcomponents/PVideoPlayer.js.map +0 -1
  130. package/dist/src/postprocessing/PSSRPass.d.ts +0 -19
  131. package/dist/src/postprocessing/PSSRPass.d.ts.map +0 -1
  132. package/dist/src/postprocessing/PSSRPass.js +0 -69
  133. package/dist/src/postprocessing/PSSRPass.js.map +0 -1
  134. package/dist/src/postprocessing/ThreeJsPostProcessor.d.ts +0 -32
  135. package/dist/src/postprocessing/ThreeJsPostProcessor.d.ts.map +0 -1
  136. package/dist/src/postprocessing/ThreeJsPostProcessor.js +0 -264
  137. package/dist/src/postprocessing/ThreeJsPostProcessor.js.map +0 -1
  138. package/dist/src/three/ColliderObject3D.d.ts +0 -19
  139. package/dist/src/three/ColliderObject3D.d.ts.map +0 -1
  140. package/dist/src/three/ColliderObject3D.js +0 -146
  141. package/dist/src/three/ColliderObject3D.js.map +0 -1
  142. package/dist/src/three/FreeCameraControls.d.ts +0 -30
  143. package/dist/src/three/FreeCameraControls.d.ts.map +0 -1
  144. package/dist/src/three/FreeCameraControls.js +0 -158
  145. package/dist/src/three/FreeCameraControls.js.map +0 -1
  146. package/dist/src/three/OrbitCameraControls.d.ts +0 -24
  147. package/dist/src/three/OrbitCameraControls.d.ts.map +0 -1
  148. package/dist/src/three/OrbitCameraControls.js +0 -81
  149. package/dist/src/three/OrbitCameraControls.js.map +0 -1
  150. package/dist/src/three/VrCameraControls.d.ts +0 -28
  151. package/dist/src/three/VrCameraControls.d.ts.map +0 -1
  152. package/dist/src/three/VrCameraControls.js +0 -124
  153. package/dist/src/three/VrCameraControls.js.map +0 -1
@@ -1,223 +0,0 @@
1
- import { AnimationMixer } from "three";
2
- import { FBXLoader } from "three/addons/loaders/FBXLoader.js";
3
- import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
4
- const MAPS = [
5
- "map",
6
- "alphaMap",
7
- "emissiveMap",
8
- "normalMap",
9
- "metalnessMap",
10
- "roughnessMap",
11
- ];
12
- export { MAPS };
13
- export default class ModelLoader {
14
- constructor(url, context) {
15
- this._context = null;
16
- this.debug = false;
17
- this.debugDelay = false;
18
- this.onDelayedModelLoaded = (id, group) => {
19
- if (this.debug)
20
- console.log("Delaying model...");
21
- setTimeout(this.onModelLoaded, 3000, id, group);
22
- };
23
- this.onModelLoaded = async (id, value) => {
24
- const queueItem = this._queue[id];
25
- if (!queueItem) {
26
- this._context?.error("[ModelLoader] Missing QueueItem");
27
- return;
28
- }
29
- const file = queueItem.file;
30
- // Save id on loaded model
31
- value.userData.modelId = id;
32
- if (this.debug)
33
- console.log("onModelLoaded: ", value);
34
- // For now, we use the first loader to decide shadows
35
- const owner = queueItem.components[0];
36
- // Parse model
37
- let model = null;
38
- if (file.extension === "glb" || file.extension === "gltf") {
39
- model = await this.parseGLTF(value, owner.getCastShadow(), owner.getReceiveShadow());
40
- }
41
- else {
42
- console.error("Format not supported: " + file.extension);
43
- }
44
- // Remove from queue
45
- delete this._queue[id];
46
- if (queueItem.components.length > 0) {
47
- for (const target of queueItem.components) {
48
- // Notify event listeners
49
- target.onModelProgress(1);
50
- target.onModelLoaded(file, model);
51
- }
52
- }
53
- else {
54
- console.log("No textures were waiting for the media");
55
- }
56
- queueItem.resolve(file);
57
- };
58
- this.onModelError = (id, error) => {
59
- console.log("ERROR value: ", id, error);
60
- const queueItem = this._queue[id];
61
- if (queueItem) {
62
- // Remove from queue
63
- delete this._queue[id];
64
- }
65
- this._context?.error("Failed to load: " + id);
66
- };
67
- this.onProgress = (queueItem, e) => {
68
- const progress = (e.loaded * 0.9) / e.total;
69
- for (const owner of queueItem.components) {
70
- owner.onModelProgress(progress);
71
- }
72
- };
73
- this._fbxLoader = new FBXLoader();
74
- this._gltfLoader = new GLTFLoader();
75
- this._queue = {};
76
- this._baseUrl = url;
77
- this._context = context;
78
- }
79
- dispose() {
80
- this._context = null;
81
- this._queue = {};
82
- }
83
- queue() {
84
- return Promise.all(Object.values(this._queue).map((q) => q.promise));
85
- }
86
- disposeQueue() {
87
- console.log("disposeQueue()");
88
- }
89
- //
90
- // MODELS
91
- //
92
- disposeMaterial(material) {
93
- for (const map of MAPS) {
94
- if (material[map]) {
95
- material[map].dispose();
96
- material[map] = null;
97
- }
98
- }
99
- material.dispose();
100
- }
101
- disposeModel(owner, model) {
102
- if (this.debug)
103
- console.log("MM->disposeModel(): ", model);
104
- const id = model.userData.modelId;
105
- const queued = this._queue[id];
106
- if (queued) {
107
- queued.components = queued.components.filter((t) => t !== owner);
108
- }
109
- if (this.debug)
110
- console.log("MM->disposeModel(): No more uses, destroying model");
111
- model.traverse((child) => {
112
- if (child.skeleton) {
113
- child.skeleton.dispose();
114
- }
115
- if (child.material) {
116
- const materials = Array.isArray(child.material)
117
- ? child.material
118
- : [child.material];
119
- for (const material of materials) {
120
- this.disposeMaterial(material);
121
- }
122
- child.material = null;
123
- }
124
- if (child.geometry) {
125
- child.geometry.dispose();
126
- child.geometry = null;
127
- }
128
- });
129
- // }
130
- }
131
- async parseGLTF(root, castShadow, receiveShadow) {
132
- if (this._context === null) {
133
- console.error("[ModelLoader] No context");
134
- return null;
135
- }
136
- const pcanvas = this._context.getPCanvas();
137
- const scene = pcanvas.getThreeSceneNode();
138
- const renderer = pcanvas.getThreeRenderer();
139
- const camera = pcanvas.getThreeCamera();
140
- const modelScene = root.scene;
141
- // Wait until the model can be added to the scene without blocking due to shader compilation
142
- await renderer.compileAsync(modelScene, camera, scene);
143
- modelScene.traverse((child) => {
144
- if (child.isMesh) {
145
- child.castShadow = castShadow;
146
- child.receiveShadow = receiveShadow;
147
- }
148
- });
149
- let mixer = null;
150
- let actions = null;
151
- if (root.animations && root.animations.length) {
152
- mixer = new AnimationMixer(modelScene);
153
- actions = [];
154
- for (const animation of root.animations) {
155
- const action = mixer.clipAction(animation);
156
- actions.push(action);
157
- }
158
- }
159
- return {
160
- modelScene,
161
- mixer,
162
- actions,
163
- };
164
- }
165
- /**
166
- * Creates and returns a group that will be populated with the loaded model
167
- * when it has been loaded. Non cached.
168
- */
169
- load(owner, file) {
170
- let loader;
171
- if (file.extension === "fbx") {
172
- loader = this._fbxLoader;
173
- }
174
- else if (file.extension === "glb" || file.extension === "gltf") {
175
- loader = this._gltfLoader;
176
- }
177
- else {
178
- return false;
179
- }
180
- //loader.setCrossOrigin(this.crossOrigin);
181
- //loader.setPath(this.path);
182
- const queue = this._queue;
183
- // Are we loading the item?
184
- if (queue[file._id]) {
185
- if (this.debug)
186
- console.log("--> Using queued model item", file.url);
187
- const item = queue[file._id];
188
- // Add group to target list
189
- item.components = [...item.components, owner];
190
- return true;
191
- }
192
- if (this.debug)
193
- console.log("--> Loading model", file.url);
194
- // No, we need to load it
195
- const queueItem = {
196
- file: file,
197
- components: [owner],
198
- };
199
- queue[file._id] = queueItem;
200
- queueItem.promise = new Promise((resolve, reject) => {
201
- queueItem.resolve = resolve;
202
- queueItem.reject = reject;
203
- const url = this._baseUrl + file.url;
204
- if (this.debugDelay) {
205
- loader.load(url, (result) => this.onDelayedModelLoaded(file._id, result), undefined, (error) => this.onModelError(file._id, error));
206
- }
207
- else {
208
- loader.load(url, (result) => this.onModelLoaded(file._id, result), (progress) => this.onProgress(queueItem, progress), (error) => this.onModelError(file._id, error));
209
- }
210
- });
211
- return true;
212
- }
213
- getQueue() {
214
- return this._queue;
215
- }
216
- hasQueue() {
217
- return Object.keys(this._queue).length > 0;
218
- }
219
- debugLog() {
220
- console.log(this._queue);
221
- }
222
- }
223
- //# sourceMappingURL=ModelLoader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModelLoader.js","sourceRoot":"","sources":["../../../src/media/ModelLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,cAAc,EAAS,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAIhE,MAAM,IAAI,GAAG;IACX,KAAK;IACL,UAAU;IACV,aAAa;IACb,WAAW;IACX,cAAc;IACd,cAAc;CACf,CAAC;AACF,OAAO,EAAE,IAAI,EAAE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,CAAC,GAAG,CAAC;YAErC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CACT,GAAG,EACH,CAAC,MAAW,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,EAC5D,SAAS,EACT,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CACvD,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CACT,GAAG,EACH,CAAC,MAAW,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,EACrD,CAAC,QAAuB,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,EACjE,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CACvD,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,QAAQ;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,QAAQ;QACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;CACF"}
@@ -1,35 +0,0 @@
1
- import { IVideoLoader, PFile, GameContext } from "@p100-web/core";
2
- interface VideoQueueItem {
3
- file: PFile;
4
- promise?: Promise<any>;
5
- resolve?: (value: any) => void;
6
- reject?: () => void;
7
- components: IVideoLoader[];
8
- }
9
- interface VideoQueue {
10
- [key: string]: VideoQueueItem;
11
- }
12
- export default class VideoLoader {
13
- private _mediaLoader;
14
- private _queue;
15
- private _context;
16
- debug: boolean;
17
- debugDelay: boolean;
18
- constructor(baseUrl: string, context: GameContext);
19
- dispose(): void;
20
- queue(): Promise<any>;
21
- disposeVideo(owner: IVideoLoader, file: PFile): void;
22
- onDelayedLoaded: (value: any) => void;
23
- onLoaded: (value: any) => void;
24
- onError: (value: any) => void;
25
- /**
26
- * Creates and returns a texture that will be populated with the map
27
- * when it has been loaded.
28
- */
29
- load(owner: IVideoLoader, file: PFile): void;
30
- getQueue(): VideoQueue;
31
- hasQueue(): boolean;
32
- debugLog(): void;
33
- }
34
- export {};
35
- //# sourceMappingURL=VideoLoader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VideoLoader.d.ts","sourceRoot":"","sources":["../../../src/media/VideoLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElE,UAAU,cAAc;IACtB,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,YAAY,EAAE,CAAC;CAC5B;AAED,UAAU,UAAU;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC;CAC/B;AAED,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAA4B;IAE5C,KAAK,EAAE,OAAO,CAAS;IACvB,UAAU,EAAE,OAAO,CAAS;gBAEhB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;IAMjD,OAAO;IAKP,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;IAIrB,YAAY,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK;IAQ7C,eAAe,GAAI,OAAO,GAAG,UAG3B;IAEF,QAAQ,GAAI,OAAO,GAAG,UAkBpB;IAEF,OAAO,GAAI,OAAO,GAAG,UAWnB;IAEF;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK;IAsCrC,QAAQ;IAIR,QAAQ;IAIR,QAAQ;CAGT"}
@@ -1,105 +0,0 @@
1
- import MediaLoader from "./MediaLoader";
2
- export default class VideoLoader {
3
- constructor(baseUrl, context) {
4
- this._context = null;
5
- this.debug = false;
6
- this.debugDelay = false;
7
- this.onDelayedLoaded = (value) => {
8
- if (this.debug)
9
- console.log("Delaying media...");
10
- setTimeout(this.onLoaded, 3000, value);
11
- };
12
- this.onLoaded = (value) => {
13
- const id = value.dataset.id;
14
- const queueItem = this._queue[id];
15
- const file = queueItem.file;
16
- if (this.debug)
17
- console.log("onLoaded: ", file.name);
18
- // Remove from queue
19
- delete this._queue[id];
20
- if (queueItem.components.length > 0) {
21
- for (const target of queueItem.components) {
22
- target.onVideoLoaded(file, value);
23
- }
24
- }
25
- else {
26
- console.log("No textures were waiting for the media");
27
- }
28
- queueItem.resolve(file);
29
- };
30
- this.onError = (value) => {
31
- console.log("ERROR value: ", value);
32
- const id = value.dataset.id;
33
- const queueItem = this._queue[id];
34
- if (queueItem) {
35
- // Remove from queue
36
- delete this._queue[id];
37
- }
38
- this._context?.error("Failed to load: " + id);
39
- };
40
- this._mediaLoader = new MediaLoader(baseUrl, true);
41
- this._queue = {};
42
- this._context = context;
43
- }
44
- dispose() {
45
- this._queue = {};
46
- this._context = null;
47
- }
48
- queue() {
49
- return Promise.all(Object.values(this._queue).map((q) => q.promise));
50
- }
51
- disposeVideo(owner, file) {
52
- const id = file._id;
53
- const queued = this._queue[id];
54
- if (queued) {
55
- queued.components = queued.components.filter((t) => t !== owner);
56
- }
57
- }
58
- /**
59
- * Creates and returns a texture that will be populated with the map
60
- * when it has been loaded.
61
- */
62
- load(owner, file) {
63
- // texture.colorSpace = colorSpace;
64
- const loader = this._mediaLoader;
65
- const url = file.url;
66
- const queue = this._queue;
67
- // Are we loading the item?
68
- if (queue[file._id]) {
69
- if (this.debug)
70
- console.log("--> Using queued video item", url);
71
- const item = queue[file._id];
72
- // Add texture to target list
73
- item.components = [...item.components, owner];
74
- return;
75
- }
76
- if (this.debug)
77
- console.log("--> Loading video", url);
78
- // No, we need to load it
79
- const queueItem = {
80
- file: file,
81
- components: [owner],
82
- };
83
- queue[file._id] = queueItem;
84
- queueItem.promise = new Promise((resolve, reject) => {
85
- queueItem.resolve = resolve;
86
- queueItem.reject = reject;
87
- if (this.debugDelay) {
88
- loader.loadMedia(file, this.onDelayedLoaded, this.onError);
89
- }
90
- else {
91
- loader.loadMedia(file, this.onLoaded, this.onError);
92
- }
93
- });
94
- }
95
- getQueue() {
96
- return this._queue;
97
- }
98
- hasQueue() {
99
- return Object.keys(this._queue).length > 0;
100
- }
101
- debugLog() {
102
- console.log(this._queue);
103
- }
104
- }
105
- //# sourceMappingURL=VideoLoader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VideoLoader.js","sourceRoot":"","sources":["../../../src/media/VideoLoader.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AAexC,MAAM,CAAC,OAAO,OAAO,WAAW;IAQ9B,YAAY,OAAe,EAAE,OAAoB;QALzC,aAAQ,GAAuB,IAAI,CAAC;QAE5C,UAAK,GAAY,KAAK,CAAC;QACvB,eAAU,GAAY,KAAK,CAAC;QAyB5B,oBAAe,GAAG,CAAC,KAAU,EAAE,EAAE;YAC/B,IAAI,IAAI,CAAC,KAAK;gBAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YACjD,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACzC,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,KAAU,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AAG,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YAC9C,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;QAEtD,yBAAyB;QACzB,MAAM,SAAS,GAAmB;YAChC,IAAI,EAAE,IAAI;YACV,UAAU,EAAE,CAAC,KAAK,CAAC;SACpB,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;QAE5B,SAAS,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAClD,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC;YAC5B,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC;YAE1B,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAC7D,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YACtD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,QAAQ;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,QAAQ;QACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;CACF"}
@@ -1,24 +0,0 @@
1
- import { AnimationAction, AnimationMixer } from "three";
2
- import PModelGLTF from "./PModelGLTF";
3
- import { PAnimator as PAnimatorBase } from "@p100-web/core";
4
- export default class PAnimator extends PAnimatorBase {
5
- action: AnimationAction | null;
6
- mixer: AnimationMixer | null;
7
- private _playedDuration;
8
- private _segmentDuration;
9
- private _playing;
10
- render(): void;
11
- unrender(): void;
12
- /**
13
- * Stop playback and remove event listeners
14
- */
15
- private _stop;
16
- getAnimatedModel(): PModelGLTF | null;
17
- getAnimationClips(): string[];
18
- callback_onPlay(): void;
19
- onFinished: () => void;
20
- callback_onStop(): void;
21
- updateSegment: (dt: number) => void;
22
- update: (dt: number) => void;
23
- }
24
- //# sourceMappingURL=PAnimator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PAnimator.d.ts","sourceRoot":"","sources":["../../../src/pcomponents/PAnimator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,cAAc,EAEf,MAAM,OAAO,CAAC;AACf,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,aAAa;IAClD,MAAM,EAAE,eAAe,GAAG,IAAI,CAAQ;IACtC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAQ;IAEpC,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,QAAQ,CAAS;IAEzB,MAAM,IAAI,IAAI;IAEd,QAAQ;IAQR;;OAEG;IACH,OAAO,CAAC,KAAK;IAsBb,gBAAgB,IAAI,UAAU,GAAG,IAAI;IAYrC,iBAAiB,IAAI,MAAM,EAAE;IAc7B,eAAe,IAAI,IAAI;IAuCvB,UAAU,aAIR;IAEF,eAAe,IAAI,IAAI;IAMvB,aAAa,GAAI,IAAI,MAAM,UASzB;IAEF,MAAM,GAAI,IAAI,MAAM,UAElB;CACH"}
@@ -1,129 +0,0 @@
1
- import { PAnimator as PAnimatorBase } from "@p100-web/core";
2
- export default class PAnimator extends PAnimatorBase {
3
- constructor() {
4
- super(...arguments);
5
- this.action = null;
6
- this.mixer = null;
7
- this._playedDuration = 0;
8
- this._segmentDuration = 0;
9
- this._playing = false;
10
- this.onFinished = () => {
11
- this._playedDuration = 0;
12
- this._stop();
13
- this.outevent_onFinished?.emit(null, this);
14
- };
15
- this.updateSegment = (dt) => {
16
- this._playedDuration += dt;
17
- if (this._playedDuration >= this._segmentDuration) {
18
- this.mixer.time = this.to;
19
- this.action.paused = true;
20
- this.onFinished();
21
- return;
22
- }
23
- this.mixer?.update(dt);
24
- };
25
- this.update = (dt) => {
26
- this.mixer.update(dt);
27
- };
28
- }
29
- render() { }
30
- unrender() {
31
- if (this._playing) {
32
- this._stop();
33
- }
34
- this.action = null;
35
- this.mixer = null;
36
- }
37
- /**
38
- * Stop playback and remove event listeners
39
- */
40
- _stop() {
41
- if (this.action !== null) {
42
- if (this.action.isRunning()) {
43
- this.action.stop();
44
- }
45
- }
46
- if (this.segment) {
47
- this.context.getCanvas()?.unregisterUpdate(this.updateSegment);
48
- }
49
- else {
50
- this.context.getCanvas()?.unregisterUpdate(this.update);
51
- if (this.mixer !== null) {
52
- this.mixer.removeEventListener("finished", this.onFinished);
53
- }
54
- }
55
- this._playing = false;
56
- // Always call on stop
57
- this.outevent_onStopped?.emit(null, this);
58
- }
59
- getAnimatedModel() {
60
- let model = this.node.findComponent("PModelGLTF");
61
- if (model)
62
- return model;
63
- let parent = this.node.parent;
64
- while (parent) {
65
- model = parent.findComponent("PModelGLTF");
66
- if (model)
67
- return model;
68
- parent = parent.parent;
69
- }
70
- return null;
71
- }
72
- getAnimationClips() {
73
- const clips = [];
74
- const model = this.getAnimatedModel();
75
- if (model !== null && model.actions !== null) {
76
- for (const action of model.actions) {
77
- const clip = action.getClip();
78
- if (clips.indexOf(clip.name) === -1) {
79
- clips.push(clip.name);
80
- }
81
- }
82
- }
83
- return clips;
84
- }
85
- callback_onPlay() {
86
- if (this.clip === "")
87
- return;
88
- if (this.action === null) {
89
- const comp = this.getAnimatedModel();
90
- if (!comp) {
91
- this.context.error("No model found for Animator");
92
- return;
93
- }
94
- this.mixer = comp.mixer;
95
- this.action = comp.getAnimationAction(this.clip);
96
- }
97
- if (this._playing) {
98
- this._stop();
99
- }
100
- if (this.action !== null && this.mixer !== null) {
101
- this._playedDuration = 0;
102
- this._segmentDuration = this.to - this.from;
103
- this.action.setLoop(this.loop, Infinity);
104
- if (this.segment) {
105
- this.action.paused = false;
106
- this.action.time = this.from;
107
- this.context.getCanvas().registerUpdate(this.updateSegment);
108
- }
109
- else {
110
- this.action.time = 0;
111
- this.context.getCanvas().registerUpdate(this.update);
112
- this.mixer.addEventListener("finished", this.onFinished);
113
- }
114
- this._playing = true;
115
- this.action.play();
116
- this.outevent_onPlay?.emit("", this);
117
- }
118
- else {
119
- this.context.error("Animation not found: " + this.clip);
120
- }
121
- }
122
- callback_onStop() {
123
- if (this.clip === "")
124
- return;
125
- this._playedDuration = 0;
126
- this._stop();
127
- }
128
- }
129
- //# sourceMappingURL=PAnimator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PAnimator.js","sourceRoot":"","sources":["../../../src/pcomponents/PAnimator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,aAAa;IAApD;;QACE,WAAM,GAA2B,IAAI,CAAC;QACtC,UAAK,GAA0B,IAAI,CAAC;QAE5B,oBAAe,GAAG,CAAC,CAAC;QACpB,qBAAgB,GAAG,CAAC,CAAC;QACrB,aAAQ,GAAG,KAAK,CAAC;QAsGzB,eAAU,GAAG,GAAG,EAAE;YAChB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;YACzB,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7C,CAAC,CAAC;QAQF,kBAAa,GAAG,CAAC,EAAU,EAAE,EAAE;YAC7B,IAAI,CAAC,eAA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AAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAC3D,CAAC;YACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAEnB,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAQD,eAAe;QACb,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE;YAAE,OAAO;QAC7B,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CAgBF"}
@@ -1,17 +0,0 @@
1
- import { MeshBasicMaterial } from "three";
2
- import { PBasicMaterial as PBasicMaterialBase } from "@p100-web/core";
3
- import { IImageLoader, IVideoLoader, PFile } from "@p100-web/core";
4
- export default class PBasicMaterial extends PBasicMaterialBase implements IImageLoader, IVideoLoader {
5
- protected _material: MeshBasicMaterial | null;
6
- _cacheKey: number;
7
- _dispose(unrender: boolean): void;
8
- render(): void;
9
- callback_setOpacity(payloadValue: string | null): void;
10
- onVideoLoaded(file: PFile, value: any): void;
11
- onImageLoaded(file: PFile, data: any, cacheKey: number): void;
12
- /**
13
- * Called by this component and eg PSpriteAnimation.
14
- */
15
- setTextureRepeat(): void;
16
- }
17
- //# sourceMappingURL=PBasicMaterial.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PBasicMaterial.d.ts","sourceRoot":"","sources":["../../../src/pcomponents/PBasicMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EAMlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAGL,YAAY,EACZ,YAAY,EACZ,KAAK,EACN,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,OAAO,cACnB,SAAQ,kBACR,YAAW,YAAY,EAAE,YAAY;IAErC,SAAS,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IACrD,SAAS,SAAK;IAMd,QAAQ,CAAC,QAAQ,EAAE,OAAO;IAoC1B,MAAM;IA0CN,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAWtD,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG;IAqBrC,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAyB7D;;OAEG;IACH,gBAAgB;CAajB"}