@p100-web/core-three 100.0.86 → 100.0.88
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/dist/ThreeCanvas.d.ts.map +1 -1
- package/dist/ThreeCanvas.js +0 -1
- package/dist/ThreeCanvas.js.map +1 -1
- package/dist/ThreeEngine.d.ts +4 -10
- package/dist/ThreeEngine.d.ts.map +1 -1
- package/dist/ThreeEngine.js +9 -21
- package/dist/ThreeEngine.js.map +1 -1
- package/dist/assets/ThreeAssetLoader.d.ts +98 -0
- package/dist/assets/ThreeAssetLoader.d.ts.map +1 -0
- package/dist/assets/ThreeAssetLoader.js +487 -0
- package/dist/assets/ThreeAssetLoader.js.map +1 -0
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/pcomponents/PAnimator.d.ts +2 -2
- package/dist/pcomponents/PAnimator.d.ts.map +1 -1
- package/dist/pcomponents/PAnimator.js +1 -8
- package/dist/pcomponents/PAnimator.js.map +1 -1
- package/dist/pcomponents/PBackground.d.ts +5 -6
- package/dist/pcomponents/PBackground.d.ts.map +1 -1
- package/dist/pcomponents/PBackground.js +47 -60
- package/dist/pcomponents/PBackground.js.map +1 -1
- package/dist/pcomponents/PBasicMaterial.d.ts +4 -5
- package/dist/pcomponents/PBasicMaterial.d.ts.map +1 -1
- package/dist/pcomponents/PBasicMaterial.js +48 -60
- package/dist/pcomponents/PBasicMaterial.js.map +1 -1
- package/dist/pcomponents/PEnvironment.d.ts +4 -5
- package/dist/pcomponents/PEnvironment.d.ts.map +1 -1
- package/dist/pcomponents/PEnvironment.js +31 -51
- package/dist/pcomponents/PEnvironment.js.map +1 -1
- package/dist/pcomponents/PImageCache.d.ts +11 -0
- package/dist/pcomponents/PImageCache.d.ts.map +1 -0
- package/dist/pcomponents/PImageCache.js +35 -0
- package/dist/pcomponents/PImageCache.js.map +1 -0
- package/dist/pcomponents/PLight.js +23 -0
- package/dist/pcomponents/PLight.js.map +1 -1
- package/dist/pcomponents/PMaskedMaterial.d.ts +5 -5
- package/dist/pcomponents/PMaskedMaterial.d.ts.map +1 -1
- package/dist/pcomponents/PMaskedMaterial.js +43 -58
- package/dist/pcomponents/PMaskedMaterial.js.map +1 -1
- package/dist/pcomponents/PModelAnnotation.d.ts.map +1 -1
- package/dist/pcomponents/PModelAnnotation.js +2 -0
- package/dist/pcomponents/PModelAnnotation.js.map +1 -1
- package/dist/pcomponents/PModelGLTF.d.ts +4 -8
- package/dist/pcomponents/PModelGLTF.d.ts.map +1 -1
- package/dist/pcomponents/PModelGLTF.js +16 -19
- package/dist/pcomponents/PModelGLTF.js.map +1 -1
- package/dist/pcomponents/PModelNode.d.ts.map +1 -1
- package/dist/pcomponents/PModelNode.js +1 -8
- package/dist/pcomponents/PModelNode.js.map +1 -1
- package/dist/pcomponents/PPhysicalMaterial.d.ts +3 -4
- package/dist/pcomponents/PPhysicalMaterial.d.ts.map +1 -1
- package/dist/pcomponents/PPhysicalMaterial.js +21 -30
- package/dist/pcomponents/PPhysicalMaterial.js.map +1 -1
- package/dist/pcomponents/PSound.d.ts +4 -4
- package/dist/pcomponents/PSound.d.ts.map +1 -1
- package/dist/pcomponents/PSound.js +26 -18
- package/dist/pcomponents/PSound.js.map +1 -1
- package/dist/pcomponents/PSprite.d.ts +3 -4
- package/dist/pcomponents/PSprite.d.ts.map +1 -1
- package/dist/pcomponents/PSprite.js +18 -24
- package/dist/pcomponents/PSprite.js.map +1 -1
- package/dist/pcomponents.d.ts +2 -1
- package/dist/pcomponents.d.ts.map +1 -1
- package/dist/pcomponents.js +2 -1
- package/dist/pcomponents.js.map +1 -1
- package/package.json +2 -2
- package/dist/media/AudioLoader.d.ts +0 -32
- package/dist/media/AudioLoader.d.ts.map +0 -1
- package/dist/media/AudioLoader.js +0 -110
- package/dist/media/AudioLoader.js.map +0 -1
- package/dist/media/EnvironmentLoader.d.ts +0 -40
- package/dist/media/EnvironmentLoader.d.ts.map +0 -1
- package/dist/media/EnvironmentLoader.js +0 -120
- package/dist/media/EnvironmentLoader.js.map +0 -1
- package/dist/media/ImageLoader.d.ts +0 -36
- package/dist/media/ImageLoader.d.ts.map +0 -1
- package/dist/media/ImageLoader.js +0 -160
- package/dist/media/ImageLoader.js.map +0 -1
- package/dist/media/MediaLoader.d.ts +0 -14
- package/dist/media/MediaLoader.d.ts.map +0 -1
- package/dist/media/MediaLoader.js +0 -70
- package/dist/media/MediaLoader.js.map +0 -1
- package/dist/media/ModelLoader.d.ts +0 -49
- package/dist/media/ModelLoader.d.ts.map +0 -1
- package/dist/media/ModelLoader.js +0 -223
- package/dist/media/ModelLoader.js.map +0 -1
- package/dist/media/VideoLoader.d.ts +0 -35
- package/dist/media/VideoLoader.d.ts.map +0 -1
- package/dist/media/VideoLoader.js +0 -105
- package/dist/media/VideoLoader.js.map +0 -1
|
@@ -1,29 +1,48 @@
|
|
|
1
|
-
import { BackSide, MathUtils, Mesh, MeshBasicMaterial, SphereGeometry,
|
|
1
|
+
import { BackSide, MathUtils, Mesh, MeshBasicMaterial, SphereGeometry, } from "three";
|
|
2
2
|
import { FileType, PBackground as PBackgroundBase, } from "@p100-web/core";
|
|
3
|
-
import { FileSubType } from "@p100-web/core";
|
|
4
3
|
export default class PBackground extends PBackgroundBase {
|
|
5
4
|
constructor() {
|
|
6
5
|
super(...arguments);
|
|
7
6
|
this._material = null;
|
|
8
7
|
this._geometry = null;
|
|
9
8
|
this._texture = null;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (this.
|
|
15
|
-
this.context
|
|
16
|
-
|
|
17
|
-
.disposeImage(this, this.file_texture, this._cacheKey);
|
|
9
|
+
//
|
|
10
|
+
// VideoTextureTask
|
|
11
|
+
//
|
|
12
|
+
this.onVideoTextureTaskLoaded = (task) => {
|
|
13
|
+
if (this._material === null) {
|
|
14
|
+
this.context.error("onVideoTextureLoaded and material was null");
|
|
15
|
+
return;
|
|
18
16
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
videoPlayer?.onDisposeMaterial();
|
|
23
|
-
this.context.videoLoader().disposeVideo(this, this.file_texture);
|
|
17
|
+
if (task.texture === null) {
|
|
18
|
+
this.context.error("onVideoTextureLoaded and texture was null");
|
|
19
|
+
return;
|
|
24
20
|
}
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
const texture = task.texture;
|
|
22
|
+
this._material.map = texture;
|
|
23
|
+
this._material.needsUpdate = true;
|
|
24
|
+
this._texture = texture;
|
|
25
|
+
};
|
|
26
|
+
//
|
|
27
|
+
// TextureTask
|
|
28
|
+
//
|
|
29
|
+
this.onTextureTaskLoaded = (task) => {
|
|
30
|
+
if (this._material === null) {
|
|
31
|
+
this.context.error("onTextureLoaded and material was null");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (task.texture === null) {
|
|
35
|
+
this.context.error("onTextureLoaded and texture was null");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const texture = task.texture;
|
|
39
|
+
this._material.map = texture;
|
|
40
|
+
this._material.needsUpdate = true;
|
|
41
|
+
this._texture = texture;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
_dispose(unrender) {
|
|
45
|
+
// AssetLoader will take care of cleaning up the html elements
|
|
27
46
|
this._texture?.dispose();
|
|
28
47
|
this._texture = null;
|
|
29
48
|
// Check if we should dispose Material
|
|
@@ -66,55 +85,23 @@ export default class PBackground extends PBackgroundBase {
|
|
|
66
85
|
transparent: false,
|
|
67
86
|
fog: false,
|
|
68
87
|
// shadowSide: DoubleSide,
|
|
69
|
-
|
|
88
|
+
depthTest: false, // ?? maybe
|
|
70
89
|
});
|
|
71
90
|
this._material = material;
|
|
72
91
|
mesh.material = material;
|
|
73
92
|
mesh.scale.x = mesh.scale.x * -1;
|
|
74
93
|
if (this.file_texture !== null) {
|
|
75
|
-
if (this.file_texture.type === FileType.Image)
|
|
76
|
-
this.context
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
//
|
|
86
|
-
onImageLoaded(file, data, cacheKey) {
|
|
87
|
-
this._cacheKey = cacheKey;
|
|
88
|
-
if (this._material === null) {
|
|
89
|
-
this.context.error("onImageLoaded and material was null");
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const texture = new Texture();
|
|
93
|
-
this._texture = texture;
|
|
94
|
-
texture.userData.id = file._id;
|
|
95
|
-
texture.colorSpace = SRGBColorSpace;
|
|
96
|
-
texture.image = data;
|
|
97
|
-
if (file.subType === FileSubType.Stereo)
|
|
98
|
-
texture.repeat = new Vector2(1, 0.5);
|
|
99
|
-
texture.needsUpdate = true;
|
|
100
|
-
this._material.map = texture;
|
|
101
|
-
this._material.needsUpdate = true;
|
|
102
|
-
}
|
|
103
|
-
//
|
|
104
|
-
// IVideoLoader
|
|
105
|
-
//
|
|
106
|
-
onVideoLoaded(file, video) {
|
|
107
|
-
if (this._material === null) {
|
|
108
|
-
this.context.error("onVideoLoaded and material was null");
|
|
109
|
-
return;
|
|
94
|
+
if (this.file_texture.type === FileType.Image) {
|
|
95
|
+
this.context
|
|
96
|
+
.assetLoader()
|
|
97
|
+
.addTextureTask(this, this.file_texture);
|
|
98
|
+
}
|
|
99
|
+
else if (this.file_texture.type === FileType.Video) {
|
|
100
|
+
this.context
|
|
101
|
+
.assetLoader()
|
|
102
|
+
.addVideoTextureTask(this, this.file_texture);
|
|
103
|
+
}
|
|
110
104
|
}
|
|
111
|
-
const texture = new VideoTexture(video);
|
|
112
|
-
texture.colorSpace = SRGBColorSpace;
|
|
113
|
-
if (file.subType === FileSubType.Stereo)
|
|
114
|
-
texture.repeat = new Vector2(1, 0.5);
|
|
115
|
-
this._texture = texture;
|
|
116
|
-
this._material.map = texture;
|
|
117
|
-
this._material.needsUpdate = true;
|
|
118
105
|
}
|
|
119
106
|
}
|
|
120
107
|
//# sourceMappingURL=PBackground.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PBackground.js","sourceRoot":"","sources":["../../src/pcomponents/PBackground.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,iBAAiB,EACjB,cAAc,
|
|
1
|
+
{"version":3,"file":"PBackground.js","sourceRoot":"","sources":["../../src/pcomponents/PBackground.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,iBAAiB,EACjB,cAAc,GAEf,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,QAAQ,EAER,WAAW,IAAI,eAAe,GAC/B,MAAM,gBAAgB,CAAC;AASxB,MAAM,CAAC,OAAO,OAAO,WACnB,SAAQ,eAAe;IADzB;;QAIY,cAAS,GAA6B,IAAI,CAAC;QAC3C,cAAS,GAA0B,IAAI,CAAC;QACxC,aAAQ,GAAmB,IAAI,CAAC;QA8E1C,EAAE;QACF,oBAAoB;QACpB,EAAE;QAEF,6BAAwB,GAAG,CAAC,IAAsB,EAAQ,EAAE;YAC1D,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;gBAC5B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;gBACjE,OAAO;YACT,CAAC;YACD,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;gBAC1B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;gBAChE,OAAO;YACT,CAAC;YAED,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC7B,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC;YAC7B,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC;YAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC1B,CAAC,CAAC;QAEF,E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CAAC,YAAY,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAC9C,IAAI,CAAC,OAAO;qBACT,WAAW,EAAoB;qBAC/B,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAC7C,CAAC;iBAAM,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACrD,IAAI,CAAC,OAAO;qBACT,WAAW,EAAoB;qBAC/B,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;IACH,CAAC;CAyCF"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { MeshBasicMaterial } from "three";
|
|
2
2
|
import { PBasicMaterial as PBasicMaterialBase } from "@p100-web/core";
|
|
3
|
-
import {
|
|
4
|
-
export default class PBasicMaterial extends PBasicMaterialBase implements
|
|
3
|
+
import { TextureTask, VideoTextureTask, ITextureTaskLoader, IVideoTextureTaskLoader } from "../assets/ThreeAssetLoader";
|
|
4
|
+
export default class PBasicMaterial extends PBasicMaterialBase implements ITextureTaskLoader, IVideoTextureTaskLoader {
|
|
5
5
|
protected _material: MeshBasicMaterial | null;
|
|
6
|
-
_cacheKey: number;
|
|
7
6
|
getTexture<T>(): T | null;
|
|
8
7
|
_dispose(unrender: boolean): void;
|
|
9
8
|
render(): void;
|
|
10
9
|
callback_setOpacity(payloadValue: string | null): void;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
onVideoTextureTaskLoaded: (task: VideoTextureTask) => void;
|
|
11
|
+
onTextureTaskLoaded: (task: TextureTask) => void;
|
|
13
12
|
/**
|
|
14
13
|
* Called by this component and eg PSpriteAnimation.
|
|
15
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PBasicMaterial.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PBasicMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"PBasicMaterial.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PBasicMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EAIlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAItE,OAAyB,EACvB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,OAAO,OAAO,cACnB,SAAQ,kBACR,YAAW,kBAAkB,EAAE,uBAAuB;IAEtD,SAAS,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IAErD,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI;IAQzB,QAAQ,CAAC,QAAQ,EAAE,OAAO;IAoB1B,MAAM;IA+CN,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAWtD,wBAAwB,GAAI,MAAM,gBAAgB,KAAG,IAAI,CAcvD;IAMF,mBAAmB,GAAI,MAAM,WAAW,KAAG,IAAI,CAc7C;IAMF;;OAEG;IACH,gBAAgB;CAajB"}
|
|
@@ -1,11 +1,44 @@
|
|
|
1
|
-
import { BackSide, ClampToEdgeWrapping, FrontSide, MeshBasicMaterial, RepeatWrapping,
|
|
2
|
-
import { PBasicMaterial as PBasicMaterialBase
|
|
3
|
-
import { FileSubType, FileType
|
|
1
|
+
import { BackSide, ClampToEdgeWrapping, FrontSide, MeshBasicMaterial, RepeatWrapping, Vector2, } from "three";
|
|
2
|
+
import { PBasicMaterial as PBasicMaterialBase } from "@p100-web/core";
|
|
3
|
+
import { FileSubType, FileType } from "@p100-web/core";
|
|
4
4
|
export default class PBasicMaterial extends PBasicMaterialBase {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this._material = null;
|
|
8
|
-
|
|
8
|
+
//
|
|
9
|
+
// VideoTextureTask
|
|
10
|
+
//
|
|
11
|
+
this.onVideoTextureTaskLoaded = (task) => {
|
|
12
|
+
if (this._material === null) {
|
|
13
|
+
this.context.error("onVideoTextureLoaded and material was null");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (task.texture === null) {
|
|
17
|
+
this.context.error("onVideoTextureLoaded and texture was null");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const texture = task.texture;
|
|
21
|
+
this._material.map = texture;
|
|
22
|
+
this._material.needsUpdate = true;
|
|
23
|
+
this.setTextureRepeat();
|
|
24
|
+
};
|
|
25
|
+
//
|
|
26
|
+
// TextureTask
|
|
27
|
+
//
|
|
28
|
+
this.onTextureTaskLoaded = (task) => {
|
|
29
|
+
if (this._material === null) {
|
|
30
|
+
this.context.error("onTextureLoaded and material was null");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (task.texture === null) {
|
|
34
|
+
this.context.error("onTextureLoaded and texture was null");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const texture = task.texture;
|
|
38
|
+
this._material.map = texture;
|
|
39
|
+
this._material.needsUpdate = true;
|
|
40
|
+
this.setTextureRepeat();
|
|
41
|
+
};
|
|
9
42
|
}
|
|
10
43
|
getTexture() {
|
|
11
44
|
return this._material?.map;
|
|
@@ -14,26 +47,12 @@ export default class PBasicMaterial extends PBasicMaterialBase {
|
|
|
14
47
|
// PComponent
|
|
15
48
|
//
|
|
16
49
|
_dispose(unrender) {
|
|
17
|
-
if (this.file_texture) {
|
|
18
|
-
if (this.file_texture.type === FileType.Image) {
|
|
19
|
-
this.context
|
|
20
|
-
.imageLoader()
|
|
21
|
-
.disposeImage(this, this.file_texture, this._cacheKey);
|
|
22
|
-
}
|
|
23
|
-
else if (this.file_texture.type === FileType.Video) {
|
|
24
|
-
// Notify any video player
|
|
25
|
-
const videoPlayer = this.node.findComponent("PVideoPlayer");
|
|
26
|
-
videoPlayer?.onDisposeMaterial();
|
|
27
|
-
this.context.videoLoader().disposeVideo(this, this.file_texture);
|
|
28
|
-
}
|
|
29
|
-
this._cacheKey = 0;
|
|
30
|
-
}
|
|
31
50
|
// Check if we should dispose Material
|
|
32
51
|
if (this._material) {
|
|
33
52
|
// Do we have a texture as well?
|
|
34
53
|
if (this._material.map) {
|
|
54
|
+
// AssetLoader will take care of cleaning up the html elements
|
|
35
55
|
this._material.map.dispose();
|
|
36
|
-
this._material.map.source.data = null;
|
|
37
56
|
this._material.map = null;
|
|
38
57
|
}
|
|
39
58
|
this._material.needsUpdate = true;
|
|
@@ -69,12 +88,16 @@ export default class PBasicMaterial extends PBasicMaterialBase {
|
|
|
69
88
|
mesh.renderOrder = this.renderOrder;
|
|
70
89
|
if (this.file_texture !== null) {
|
|
71
90
|
// Check which loader to use
|
|
72
|
-
if (this.file_texture.type === FileType.Image)
|
|
73
|
-
this.context
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
91
|
+
if (this.file_texture.type === FileType.Image) {
|
|
92
|
+
this.context
|
|
93
|
+
.assetLoader()
|
|
94
|
+
.addTextureTask(this, this.file_texture);
|
|
95
|
+
}
|
|
96
|
+
else if (this.file_texture.type === FileType.Video) {
|
|
97
|
+
this.context
|
|
98
|
+
.assetLoader()
|
|
99
|
+
.addVideoTextureTask(this, this.file_texture);
|
|
100
|
+
}
|
|
78
101
|
}
|
|
79
102
|
material.needsUpdate = true;
|
|
80
103
|
}
|
|
@@ -88,41 +111,6 @@ export default class PBasicMaterial extends PBasicMaterialBase {
|
|
|
88
111
|
}
|
|
89
112
|
}
|
|
90
113
|
//
|
|
91
|
-
// IVideoLoader
|
|
92
|
-
//
|
|
93
|
-
onVideoLoaded(file, value) {
|
|
94
|
-
if (this._material === null) {
|
|
95
|
-
this.context.error("onVideoLoaded and material was null");
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const texture = new VideoTexture(value);
|
|
99
|
-
texture.colorSpace = SRGBColorSpace;
|
|
100
|
-
if (file.subType === FileSubType.Stereo)
|
|
101
|
-
texture.repeat = new Vector2(1, 0.5);
|
|
102
|
-
this._material.map = texture;
|
|
103
|
-
this.setTextureRepeat();
|
|
104
|
-
this._material.needsUpdate = true;
|
|
105
|
-
}
|
|
106
|
-
//
|
|
107
|
-
// IImageLoader
|
|
108
|
-
//
|
|
109
|
-
onImageLoaded(file, data, cacheKey) {
|
|
110
|
-
this._cacheKey = cacheKey;
|
|
111
|
-
if (this._material === null) {
|
|
112
|
-
this.context.error("onImageLoaded and material was null");
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const texture = new Texture();
|
|
116
|
-
texture.userData.id = file._id;
|
|
117
|
-
texture.colorSpace = SRGBColorSpace;
|
|
118
|
-
texture.image = data;
|
|
119
|
-
if (file.subType === FileSubType.Stereo)
|
|
120
|
-
texture.repeat = new Vector2(1, 0.5);
|
|
121
|
-
this._material.map = texture;
|
|
122
|
-
this.setTextureRepeat();
|
|
123
|
-
this._material.needsUpdate = true;
|
|
124
|
-
}
|
|
125
|
-
//
|
|
126
114
|
// Tools
|
|
127
115
|
//
|
|
128
116
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PBasicMaterial.js","sourceRoot":"","sources":["../../src/pcomponents/PBasicMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,SAAS,EAET,iBAAiB,EACjB,cAAc,
|
|
1
|
+
{"version":3,"file":"PBasicMaterial.js","sourceRoot":"","sources":["../../src/pcomponents/PBasicMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,SAAS,EAET,iBAAiB,EACjB,cAAc,EAEd,OAAO,GACR,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAA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AAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,mBAAmB,CAAC;YACzE,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,mBAAmB,CAAC;YACzE,MAAM,OAAO,GACX,IAAI,CAAC,YAAa,CAAC,OAAO,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9D,OAAO,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;YACrE,OAAO,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3D,IAAI,IAAI,CAAC,SAAS;gBAAE,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC;YACtD,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;QAC7B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Texture } from "three";
|
|
2
2
|
import { PEnvironment as PEnvironmentBase } from "@p100-web/core";
|
|
3
|
-
import {
|
|
4
|
-
export default class PEnvironment extends PEnvironmentBase implements
|
|
3
|
+
import { TextureTask, HDRTextureTask, type ITextureTaskLoader, type IHDRTextureTaskLoader } from "../assets/ThreeAssetLoader";
|
|
4
|
+
export default class PEnvironment extends PEnvironmentBase implements ITextureTaskLoader, IHDRTextureTaskLoader {
|
|
5
5
|
_texture: Texture | null;
|
|
6
|
-
_cacheKey: number;
|
|
7
6
|
getTexture<T>(): T | null;
|
|
8
7
|
_dispose(): void;
|
|
9
8
|
unrender(): void;
|
|
10
9
|
render(): void;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
onHDRTextureTaskLoaded: (task: HDRTextureTask) => void;
|
|
11
|
+
onTextureTaskLoaded: (task: TextureTask) => void;
|
|
13
12
|
}
|
|
14
13
|
//# sourceMappingURL=PEnvironment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PEnvironment.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PEnvironment.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,OAAO,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKlE,OAAyB,EACvB,WAAW,EACX,cAAc,EACd,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,OAAO,OAAO,YACnB,SAAQ,gBACR,YAAW,kBAAkB,EAAE,qBAAqB;IAEpD,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAQ;IAEhC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI;IAQzB,QAAQ;IASR,QAAQ;IAIR,MAAM;IAmBN,sBAAsB,GAAI,MAAM,cAAc,KAAG,IAAI,CAInD;IAMF,mBAAmB,GAAI,MAAM,WAAW,KAAG,IAAI,CAe7C;CACH"}
|
|
@@ -1,11 +1,34 @@
|
|
|
1
|
-
import { EquirectangularReflectionMapping
|
|
1
|
+
import { EquirectangularReflectionMapping } from "three";
|
|
2
2
|
import { PEnvironment as PEnvironmentBase } from "@p100-web/core";
|
|
3
3
|
import { FileType } from "@p100-web/core";
|
|
4
4
|
export default class PEnvironment extends PEnvironmentBase {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this._texture = null;
|
|
8
|
-
|
|
8
|
+
//
|
|
9
|
+
// HDRTextureTask
|
|
10
|
+
//
|
|
11
|
+
this.onHDRTextureTaskLoaded = (task) => {
|
|
12
|
+
this._texture = task.texture;
|
|
13
|
+
const pcanvas = this.context.getPCanvas();
|
|
14
|
+
pcanvas.setEnvironment(this);
|
|
15
|
+
};
|
|
16
|
+
//
|
|
17
|
+
// TextureTask
|
|
18
|
+
//
|
|
19
|
+
this.onTextureTaskLoaded = (task) => {
|
|
20
|
+
if (task.texture === null) {
|
|
21
|
+
this.context.error("onTextureLoaded and texture was null");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const texture = task.texture;
|
|
25
|
+
this._texture = texture;
|
|
26
|
+
if (this.equirectangular) {
|
|
27
|
+
texture.mapping = EquirectangularReflectionMapping;
|
|
28
|
+
}
|
|
29
|
+
const pcanvas = this.context.getPCanvas();
|
|
30
|
+
pcanvas.setEnvironment(this);
|
|
31
|
+
};
|
|
9
32
|
}
|
|
10
33
|
getTexture() {
|
|
11
34
|
return this._texture;
|
|
@@ -18,19 +41,6 @@ export default class PEnvironment extends PEnvironmentBase {
|
|
|
18
41
|
if (this._texture) {
|
|
19
42
|
pcanvas.clearEnvironment(this);
|
|
20
43
|
}
|
|
21
|
-
if (this.file_texture) {
|
|
22
|
-
if (this.file_texture.type & FileType.Environment) {
|
|
23
|
-
this.context
|
|
24
|
-
.environmentLoader()
|
|
25
|
-
.disposeEnvironment(this, this.file_texture);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
this.context
|
|
29
|
-
.imageLoader()
|
|
30
|
-
.disposeImage(this, this.file_texture, this._cacheKey);
|
|
31
|
-
this._cacheKey = 0;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
44
|
this._texture?.dispose();
|
|
35
45
|
this._texture = null;
|
|
36
46
|
}
|
|
@@ -41,46 +51,16 @@ export default class PEnvironment extends PEnvironmentBase {
|
|
|
41
51
|
if (this.file_texture !== null) {
|
|
42
52
|
// Check image type
|
|
43
53
|
if (this.file_texture.type & FileType.Environment) {
|
|
44
|
-
this.context
|
|
54
|
+
this.context
|
|
55
|
+
.assetLoader()
|
|
56
|
+
.addHDRTextureTask(this, this.file_texture);
|
|
45
57
|
}
|
|
46
58
|
else {
|
|
47
|
-
this.context
|
|
59
|
+
this.context
|
|
60
|
+
.assetLoader()
|
|
61
|
+
.addTextureTask(this, this.file_texture);
|
|
48
62
|
}
|
|
49
63
|
}
|
|
50
64
|
}
|
|
51
|
-
//
|
|
52
|
-
// IEnvironmentLoader
|
|
53
|
-
//
|
|
54
|
-
onEnvironmentLoaded(_file, texture) {
|
|
55
|
-
this._texture = texture;
|
|
56
|
-
const pcanvas = this.context.getPCanvas();
|
|
57
|
-
pcanvas.setEnvironment(this);
|
|
58
|
-
// if (this.background)
|
|
59
|
-
// pcanvas.setBackground(this._texture, this.rotation, this.intensity);
|
|
60
|
-
// if (this.environment)
|
|
61
|
-
// pcanvas.setEnvironment(this._texture, this.rotation, this.intensity);
|
|
62
|
-
}
|
|
63
|
-
//
|
|
64
|
-
// IImageLoader
|
|
65
|
-
//
|
|
66
|
-
onImageLoaded(file, data, cacheKey) {
|
|
67
|
-
this._cacheKey = cacheKey;
|
|
68
|
-
const texture = new Texture();
|
|
69
|
-
this._texture = texture;
|
|
70
|
-
if (this.equirectangular) {
|
|
71
|
-
texture.mapping = EquirectangularReflectionMapping;
|
|
72
|
-
}
|
|
73
|
-
texture.colorSpace = SRGBColorSpace;
|
|
74
|
-
texture.userData.id = file._id;
|
|
75
|
-
texture.colorSpace = SRGBColorSpace;
|
|
76
|
-
texture.image = data;
|
|
77
|
-
texture.needsUpdate = true;
|
|
78
|
-
const pcanvas = this.context.getPCanvas();
|
|
79
|
-
pcanvas.setEnvironment(this);
|
|
80
|
-
// if (this.background)
|
|
81
|
-
// pcanvas.setBackground(this._texture, this.rotation, this.intensity);
|
|
82
|
-
// if (this.environment)
|
|
83
|
-
// pcanvas.setEnvironment(this._texture, this.rotation, this.intensity);
|
|
84
|
-
}
|
|
85
65
|
}
|
|
86
66
|
//# sourceMappingURL=PEnvironment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PEnvironment.js","sourceRoot":"","sources":["../../src/pcomponents/PEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PEnvironment.js","sourceRoot":"","sources":["../../src/pcomponents/PEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAW,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAU1C,MAAM,CAAC,OAAO,OAAO,YACnB,SAAQ,gBAAgB;IAD1B;;QAIE,aAAQ,GAAmB,IAAI,CAAC;QAsChC,EAAE;QACF,kBAAkB;QAClB,EAAE;QAEF,2BAAsB,GAAG,CAAC,IAAoB,EAAQ,EAAE;YACtD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;YAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAe,CAAC;YACvD,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC;QAEF,EAAE;QACF,eAAe;QACf,EAAE;QAEF,wBAAmB,GAAG,CAAC,IAAiB,EAAQ,EAAE;YAChD,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;gBAC1B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;gBAC3D,OAAO;YACT,CAAC;YAED,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAE7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;YACxB,IAAI,IAAI,CAAC,eAAe,EAAE,CAA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import { Texture } from "three";
|
|
4
|
+
export default class PImageCache extends PImageCacheBase implements ITextureTaskLoader {
|
|
5
|
+
protected _cache: (Texture | null)[];
|
|
6
|
+
unrender(): void;
|
|
7
|
+
render(): void;
|
|
8
|
+
onTextureTaskLoaded: (task: TextureTask) => void;
|
|
9
|
+
editor_setFile(_index: number, _file: string | null): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=PImageCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PImageCache.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PImageCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAyB,EACvB,WAAW,EACX,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,MAAM,CAAC,OAAO,OAAO,WACnB,SAAQ,eACR,YAAW,kBAAkB;IAE7B,SAAS,CAAC,MAAM,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAM;IAE1C,QAAQ;IAQR,MAAM;IAYN,mBAAmB,GAAI,MAAM,WAAW,KAAG,IAAI,CAI7C;IAMF,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CACpD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PImageCache as PImageCacheBase } from "@p100-web/core";
|
|
2
|
+
export default class PImageCache extends PImageCacheBase {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this._cache = [];
|
|
6
|
+
//
|
|
7
|
+
// TextureTask
|
|
8
|
+
//
|
|
9
|
+
this.onTextureTaskLoaded = (task) => {
|
|
10
|
+
if (task.texture === null)
|
|
11
|
+
return;
|
|
12
|
+
const index = this.files_textures.indexOf(task.pfile);
|
|
13
|
+
this._cache[index] = task.texture;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
unrender() {
|
|
17
|
+
// Dispose textures
|
|
18
|
+
for (const texture of this._cache) {
|
|
19
|
+
texture?.dispose();
|
|
20
|
+
}
|
|
21
|
+
this._cache.length = 0;
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
for (const file of this.files_textures) {
|
|
25
|
+
if (file) {
|
|
26
|
+
this.context.assetLoader().addTextureTask(this, file);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//
|
|
31
|
+
// EDITOR
|
|
32
|
+
//
|
|
33
|
+
editor_setFile(_index, _file) { }
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=PImageCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PImageCache.js","sourceRoot":"","sources":["../../src/pcomponents/PImageCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAQhE,MAAM,CAAC,OAAO,OAAO,WACnB,SAAQ,eAAe;IADzB;;QAIY,WAAM,GAAuB,EAAE,CAAC;QAkB1C,EAAE;QACF,eAAe;QACf,EAAE;QAEF,wBAAmB,GAAG,CAAC,IAAiB,EAAQ,EAAE;YAChD,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI;gBAAE,OAAO;YAClC,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACpC,CAAC,CAAC;IAOJ,CAAC;IA/BC,QAAQ;QACN,mBAAmB;QACnB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,EAAE,OAAO,EAAE,CAAC;QACrB,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,MAAM;QACJ,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACvC,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC,OAAO,CAAC,WAAW,EAAoB,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;IACH,CAAC;IAYD,EAAE;IACF,UAAU;IACV,EAAE;IAEF,cAAc,CAAC,MAAc,EAAE,KAAoB,IAAG,CAAC;CACxD"}
|
|
@@ -19,4 +19,27 @@ export default class PLight extends PLightBase {
|
|
|
19
19
|
this.node.set_el(light);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
/*
|
|
23
|
+
import { HemisphereLight } from "three";
|
|
24
|
+
|
|
25
|
+
import { PLight as PLightBase } from "@p100-web/core";
|
|
26
|
+
|
|
27
|
+
export default class PLight extends PLightBase {
|
|
28
|
+
light: HemisphereLight | null = null;
|
|
29
|
+
|
|
30
|
+
unrender() {
|
|
31
|
+
if (this.light !== null) {
|
|
32
|
+
this.light.dispose();
|
|
33
|
+
this.light = null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
render() {
|
|
38
|
+
const light = new HemisphereLight(this.color, this.color, this.intensity);
|
|
39
|
+
this.light = light;
|
|
40
|
+
light.intensity = this.intensity;
|
|
41
|
+
this.node.set_el(light);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
*/
|
|
22
45
|
//# sourceMappingURL=PLight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PLight.js","sourceRoot":"","sources":["../../src/pcomponents/PLight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,UAAU;IAA9C;;QACE,UAAK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AS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;EAsBE"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Texture, ShaderMaterial } from "three";
|
|
2
2
|
import { PMaskedMaterial as PMaskedMaterialBase } from "@p100-web/core";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { PFile } from "@p100-web/core";
|
|
4
|
+
import { TextureTask, VideoTextureTask, ITextureTaskLoader, IVideoTextureTaskLoader } from "../assets/ThreeAssetLoader";
|
|
5
|
+
export default class PMaskedMaterial extends PMaskedMaterialBase implements ITextureTaskLoader, IVideoTextureTaskLoader {
|
|
5
6
|
private _material;
|
|
6
|
-
private _cacheKey;
|
|
7
7
|
getTexture<T>(): T | null;
|
|
8
8
|
getMaterial(): ShaderMaterial | null;
|
|
9
9
|
dispose(): void;
|
|
@@ -11,7 +11,7 @@ export default class PMaskedMaterial extends PMaskedMaterialBase implements IIma
|
|
|
11
11
|
unrender(): void;
|
|
12
12
|
render(): void;
|
|
13
13
|
protected setTextureRepeat(file: PFile, texture: Texture): void;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
onVideoTextureTaskLoaded: (task: VideoTextureTask) => void;
|
|
15
|
+
onTextureTaskLoaded: (task: TextureTask) => void;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=PMaskedMaterial.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PMaskedMaterial.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PMaskedMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,
|
|
1
|
+
{"version":3,"file":"PMaskedMaterial.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PMaskedMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EACP,cAAc,EAGf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAEL,KAAK,EAEN,MAAM,gBAAgB,CAAC;AAExB,OAAyB,EACvB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,OAAO,OAAO,eACnB,SAAQ,mBACR,YAAW,kBAAkB,EAAE,uBAAuB;IAEtD,OAAO,CAAC,SAAS,CAA+B;IAEhD,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI;IAIzB,WAAW;IAQX,OAAO;IAKP,QAAQ,CAAC,QAAQ,EAAE,OAAO;IAmB1B,QAAQ;IAMR,MAAM;IAgDN,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO;IAexD,wBAAwB,GAAI,MAAM,gBAAgB,KAAG,IAAI,CAcvD;IAMF,mBAAmB,GAAI,MAAM,WAAW,KAAG,IAAI,CAc7C;CACH"}
|