@p100-web/core-three 100.1.1 → 100.1.2
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/App.d.ts +41 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +171 -0
- package/dist/App.js.map +1 -0
- package/dist/ComponentFactory.d.ts +5 -0
- package/dist/ComponentFactory.d.ts.map +1 -0
- package/dist/ComponentFactory.js +13 -0
- package/dist/ComponentFactory.js.map +1 -0
- package/dist/ThreeCanvas.d.ts +56 -0
- package/dist/ThreeCanvas.d.ts.map +1 -0
- package/dist/ThreeCanvas.js +418 -0
- package/dist/ThreeCanvas.js.map +1 -0
- package/dist/ThreeEngine.d.ts +24 -0
- package/dist/ThreeEngine.d.ts.map +1 -0
- package/dist/ThreeEngine.js +102 -0
- package/dist/ThreeEngine.js.map +1 -0
- package/dist/ThreeNodeRenderer.d.ts +42 -0
- package/dist/ThreeNodeRenderer.d.ts.map +1 -0
- package/dist/ThreeNodeRenderer.js +119 -0
- package/dist/ThreeNodeRenderer.js.map +1 -0
- package/dist/animations/ModelAnimation.d.ts +21 -0
- package/dist/animations/ModelAnimation.d.ts.map +1 -0
- package/dist/animations/ModelAnimation.js +45 -0
- package/dist/animations/ModelAnimation.js.map +1 -0
- package/dist/assets/ThreeAssetLoader.d.ts +98 -0
- package/dist/assets/ThreeAssetLoader.d.ts.map +1 -0
- package/dist/assets/ThreeAssetLoader.js +495 -0
- package/dist/assets/ThreeAssetLoader.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/pcomponents/PAnimator.d.ts +24 -0
- package/dist/pcomponents/PAnimator.d.ts.map +1 -0
- package/dist/pcomponents/PAnimator.js +133 -0
- package/dist/pcomponents/PAnimator.js.map +1 -0
- package/dist/pcomponents/PBackground.d.ts +15 -0
- package/dist/pcomponents/PBackground.d.ts.map +1 -0
- package/dist/pcomponents/PBackground.js +104 -0
- package/dist/pcomponents/PBackground.js.map +1 -0
- package/dist/pcomponents/PBasicMaterial.d.ts +20 -0
- package/dist/pcomponents/PBasicMaterial.d.ts.map +1 -0
- package/dist/pcomponents/PBasicMaterial.js +161 -0
- package/dist/pcomponents/PBasicMaterial.js.map +1 -0
- package/dist/pcomponents/PCollider.d.ts +18 -0
- package/dist/pcomponents/PCollider.d.ts.map +1 -0
- package/dist/pcomponents/PCollider.js +59 -0
- package/dist/pcomponents/PCollider.js.map +1 -0
- package/dist/pcomponents/PCubeGeometry.d.ts +8 -0
- package/dist/pcomponents/PCubeGeometry.d.ts.map +1 -0
- package/dist/pcomponents/PCubeGeometry.js +23 -0
- package/dist/pcomponents/PCubeGeometry.js.map +1 -0
- package/dist/pcomponents/PEnvironment.d.ts +12 -0
- package/dist/pcomponents/PEnvironment.d.ts.map +1 -0
- package/dist/pcomponents/PEnvironment.js +39 -0
- package/dist/pcomponents/PEnvironment.js.map +1 -0
- 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.d.ts +8 -0
- package/dist/pcomponents/PLight.d.ts.map +1 -0
- package/dist/pcomponents/PLight.js +45 -0
- package/dist/pcomponents/PLight.js.map +1 -0
- package/dist/pcomponents/PLightDirectional.d.ts +8 -0
- package/dist/pcomponents/PLightDirectional.d.ts.map +1 -0
- package/dist/pcomponents/PLightDirectional.js +36 -0
- package/dist/pcomponents/PLightDirectional.js.map +1 -0
- package/dist/pcomponents/PMaskedMaterial.d.ts +17 -0
- package/dist/pcomponents/PMaskedMaterial.d.ts.map +1 -0
- package/dist/pcomponents/PMaskedMaterial.js +195 -0
- package/dist/pcomponents/PMaskedMaterial.js.map +1 -0
- package/dist/pcomponents/PMaterialModifier.d.ts +8 -0
- package/dist/pcomponents/PMaterialModifier.d.ts.map +1 -0
- package/dist/pcomponents/PMaterialModifier.js +22 -0
- package/dist/pcomponents/PMaterialModifier.js.map +1 -0
- package/dist/pcomponents/PModelAnnotation.d.ts +11 -0
- package/dist/pcomponents/PModelAnnotation.d.ts.map +1 -0
- package/dist/pcomponents/PModelAnnotation.js +21 -0
- package/dist/pcomponents/PModelAnnotation.js.map +1 -0
- package/dist/pcomponents/PModelAnnotations.d.ts +10 -0
- package/dist/pcomponents/PModelAnnotations.d.ts.map +1 -0
- package/dist/pcomponents/PModelAnnotations.js +25 -0
- package/dist/pcomponents/PModelAnnotations.js.map +1 -0
- package/dist/pcomponents/PModelGLTF.d.ts +15 -0
- package/dist/pcomponents/PModelGLTF.d.ts.map +1 -0
- package/dist/pcomponents/PModelGLTF.js +111 -0
- package/dist/pcomponents/PModelGLTF.js.map +1 -0
- package/dist/pcomponents/PModelNode.d.ts +13 -0
- package/dist/pcomponents/PModelNode.d.ts.map +1 -0
- package/dist/pcomponents/PModelNode.js +71 -0
- package/dist/pcomponents/PModelNode.js.map +1 -0
- package/dist/pcomponents/PPhysicalMaterial.d.ts +13 -0
- package/dist/pcomponents/PPhysicalMaterial.d.ts.map +1 -0
- package/dist/pcomponents/PPhysicalMaterial.js +100 -0
- package/dist/pcomponents/PPhysicalMaterial.js.map +1 -0
- package/dist/pcomponents/PPlaneGeometry.d.ts +8 -0
- package/dist/pcomponents/PPlaneGeometry.d.ts.map +1 -0
- package/dist/pcomponents/PPlaneGeometry.js +23 -0
- package/dist/pcomponents/PPlaneGeometry.js.map +1 -0
- package/dist/pcomponents/PProjectRoot.d.ts +8 -0
- package/dist/pcomponents/PProjectRoot.d.ts.map +1 -0
- package/dist/pcomponents/PProjectRoot.js +24 -0
- package/dist/pcomponents/PProjectRoot.js.map +1 -0
- package/dist/pcomponents/PSlider.d.ts +18 -0
- package/dist/pcomponents/PSlider.d.ts.map +1 -0
- package/dist/pcomponents/PSlider.js +62 -0
- package/dist/pcomponents/PSlider.js.map +1 -0
- package/dist/pcomponents/PSound.d.ts +17 -0
- package/dist/pcomponents/PSound.d.ts.map +1 -0
- package/dist/pcomponents/PSound.js +119 -0
- package/dist/pcomponents/PSound.js.map +1 -0
- package/dist/pcomponents/PSphereGeometry.d.ts +9 -0
- package/dist/pcomponents/PSphereGeometry.d.ts.map +1 -0
- package/dist/pcomponents/PSphereGeometry.js +24 -0
- package/dist/pcomponents/PSphereGeometry.js.map +1 -0
- package/dist/pcomponents/PSprite.d.ts +13 -0
- package/dist/pcomponents/PSprite.d.ts.map +1 -0
- package/dist/pcomponents/PSprite.js +73 -0
- package/dist/pcomponents/PSprite.js.map +1 -0
- package/dist/pcomponents/PSpriteSheet.d.ts +13 -0
- package/dist/pcomponents/PSpriteSheet.d.ts.map +1 -0
- package/dist/pcomponents/PSpriteSheet.js +49 -0
- package/dist/pcomponents/PSpriteSheet.js.map +1 -0
- package/dist/pcomponents/PText.d.ts +10 -0
- package/dist/pcomponents/PText.d.ts.map +1 -0
- package/dist/pcomponents/PText.js +44 -0
- package/dist/pcomponents/PText.js.map +1 -0
- package/dist/pcomponents/PVideoPlayer.d.ts +5 -0
- package/dist/pcomponents/PVideoPlayer.d.ts.map +1 -0
- package/dist/pcomponents/PVideoPlayer.js +12 -0
- package/dist/pcomponents/PVideoPlayer.js.map +1 -0
- package/dist/pcomponents.d.ts +27 -0
- package/dist/pcomponents.d.ts.map +1 -0
- package/dist/pcomponents.js +33 -0
- package/dist/pcomponents.js.map +1 -0
- package/dist/postprocessing/PSSRPass.d.ts +19 -0
- package/dist/postprocessing/PSSRPass.d.ts.map +1 -0
- package/dist/postprocessing/PSSRPass.js +69 -0
- package/dist/postprocessing/PSSRPass.js.map +1 -0
- package/dist/postprocessing/ThreeJsPostProcessor.d.ts +32 -0
- package/dist/postprocessing/ThreeJsPostProcessor.d.ts.map +1 -0
- package/dist/postprocessing/ThreeJsPostProcessor.js +264 -0
- package/dist/postprocessing/ThreeJsPostProcessor.js.map +1 -0
- package/dist/three/ColliderObject3D.d.ts +19 -0
- package/dist/three/ColliderObject3D.d.ts.map +1 -0
- package/dist/three/ColliderObject3D.js +96 -0
- package/dist/three/ColliderObject3D.js.map +1 -0
- package/dist/three/FreeCameraControls.d.ts +32 -0
- package/dist/three/FreeCameraControls.d.ts.map +1 -0
- package/dist/three/FreeCameraControls.js +173 -0
- package/dist/three/FreeCameraControls.js.map +1 -0
- package/dist/three/OrbitCameraControls.d.ts +32 -0
- package/dist/three/OrbitCameraControls.d.ts.map +1 -0
- package/dist/three/OrbitCameraControls.js +247 -0
- package/dist/three/OrbitCameraControls.js.map +1 -0
- package/dist/three/VrCameraControls.d.ts +30 -0
- package/dist/three/VrCameraControls.d.ts.map +1 -0
- package/dist/three/VrCameraControls.js +140 -0
- package/dist/three/VrCameraControls.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Audio as StaticAudio, PositionalAudio } from "three";
|
|
2
|
+
import { PSound as PSoundBase } from "@p100-web/core";
|
|
3
|
+
export default class PSound extends PSoundBase {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._staticSound = null;
|
|
7
|
+
this._positionalSound = null;
|
|
8
|
+
this._waitingForPlay = false;
|
|
9
|
+
//
|
|
10
|
+
// LOADING
|
|
11
|
+
//
|
|
12
|
+
this.onAudioTaskLoaded = (task) => {
|
|
13
|
+
const buffer = task.buffer;
|
|
14
|
+
if (!buffer) {
|
|
15
|
+
this.context.error("onAudioTaskLoaded: no buffer");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (this._positionalSound) {
|
|
19
|
+
const sound = this._positionalSound;
|
|
20
|
+
sound.setBuffer(buffer);
|
|
21
|
+
sound.setVolume(this.volume);
|
|
22
|
+
sound.setRefDistance(this.distance);
|
|
23
|
+
sound.setLoop(this.loop);
|
|
24
|
+
sound.onEnded = this.onEnded;
|
|
25
|
+
this._positionalSound = sound;
|
|
26
|
+
}
|
|
27
|
+
else if (this._staticSound) {
|
|
28
|
+
const sound = this._staticSound;
|
|
29
|
+
sound.setBuffer(buffer);
|
|
30
|
+
sound.setVolume(this.volume);
|
|
31
|
+
sound.onEnded = this.onEnded;
|
|
32
|
+
sound.setLoop(this.loop);
|
|
33
|
+
this._staticSound = sound;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//
|
|
37
|
+
// EVENTS
|
|
38
|
+
//
|
|
39
|
+
this.onEnded = () => {
|
|
40
|
+
this.outevent_onEnd?.emit(null, this);
|
|
41
|
+
};
|
|
42
|
+
this.callback_onPlay = () => {
|
|
43
|
+
if (this.positional) {
|
|
44
|
+
if (this._positionalSound !== null) {
|
|
45
|
+
this._positionalSound.play();
|
|
46
|
+
this.outevent_onStart?.emit(null, this);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
console.error("Positional sound not loaded", this);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
if (this._staticSound !== null) {
|
|
54
|
+
this._staticSound.play();
|
|
55
|
+
this.outevent_onStart?.emit(null, this);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
console.error("Static sound not loaded", this);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
this.callback_onStop = () => {
|
|
63
|
+
if (this._positionalSound?.isPlaying) {
|
|
64
|
+
this._positionalSound.stop();
|
|
65
|
+
}
|
|
66
|
+
else if (this._staticSound?.isPlaying) {
|
|
67
|
+
this._staticSound.stop();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
if (!this.context.editor) {
|
|
73
|
+
this.loadAudio();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
unrender() {
|
|
77
|
+
if (!this.context.editor) {
|
|
78
|
+
this.disposeAudio();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
disposeAudio() {
|
|
82
|
+
// Positional sound
|
|
83
|
+
if (this._positionalSound !== null) {
|
|
84
|
+
if (this._positionalSound.isPlaying)
|
|
85
|
+
this._positionalSound.stop();
|
|
86
|
+
this._positionalSound.onEnded = undefined;
|
|
87
|
+
this._positionalSound.disconnect();
|
|
88
|
+
this._positionalSound.setBuffer(null);
|
|
89
|
+
this._positionalSound = null;
|
|
90
|
+
}
|
|
91
|
+
// Static sound
|
|
92
|
+
else if (this._staticSound !== null) {
|
|
93
|
+
if (this._staticSound?.isPlaying)
|
|
94
|
+
this._staticSound.stop();
|
|
95
|
+
this._staticSound.onEnded = undefined;
|
|
96
|
+
this._staticSound.disconnect();
|
|
97
|
+
this._staticSound.setBuffer(null);
|
|
98
|
+
this._staticSound = null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
loadAudio() {
|
|
102
|
+
if (this.file_sound !== null) {
|
|
103
|
+
this.context.setupAudioListener();
|
|
104
|
+
const audioListener = this.context.getAudioListener();
|
|
105
|
+
if (this.positional) {
|
|
106
|
+
this._positionalSound = new PositionalAudio(audioListener);
|
|
107
|
+
this.node.set_el(this._positionalSound);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this._staticSound = new StaticAudio(audioListener);
|
|
111
|
+
this.node.set_el(this._staticSound);
|
|
112
|
+
}
|
|
113
|
+
this.context
|
|
114
|
+
.assetLoader()
|
|
115
|
+
.addAudioTask(this, this.file_sound);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=PSound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PSound.js","sourceRoot":"","sources":["../../src/pcomponents/PSound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,eAAe,EAAiB,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOtD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,UAAU;IAA9C;;QACE,iBAA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BAC3D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,YAAY,GAAG,IAAI,WAAW,CAAC,aAAa,CAAC,CAAC;gBACnD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACtC,CAAC;YACD,IAAI,CAAC,OAAO;iBACT,WAAW,EAAoB;iBAC/B,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;CAmCF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SphereGeometry } from "three";
|
|
2
|
+
import { PSphereGeometry as PSphereGeometryBase } from "@p100-web/core";
|
|
3
|
+
export default class PSphereGeometry extends PSphereGeometryBase {
|
|
4
|
+
el: SphereGeometry | null;
|
|
5
|
+
unrender(): void;
|
|
6
|
+
render(): void;
|
|
7
|
+
debug(): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=PSphereGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PSphereGeometry.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PSphereGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,mBAAmB;IAC9D,EAAE,EAAE,cAAc,GAAG,IAAI,CAAQ;IAEjC,QAAQ;IAOR,MAAM;IAeN,KAAK;CACN"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Mesh, SphereGeometry } from "three";
|
|
2
|
+
import { PSphereGeometry as PSphereGeometryBase } from "@p100-web/core";
|
|
3
|
+
export default class PSphereGeometry extends PSphereGeometryBase {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.el = null;
|
|
7
|
+
}
|
|
8
|
+
unrender() {
|
|
9
|
+
if (this.el !== null) {
|
|
10
|
+
this.el.dispose();
|
|
11
|
+
this.el = null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const geometry = new SphereGeometry(this.radius, (this.segments + 1) * 12, (this.segments + 1) * 12);
|
|
16
|
+
this.el = geometry;
|
|
17
|
+
const mesh = new Mesh(geometry);
|
|
18
|
+
mesh.castShadow = this.castShadow;
|
|
19
|
+
mesh.receiveShadow = this.receiveShadow;
|
|
20
|
+
this.node.set_el(mesh);
|
|
21
|
+
}
|
|
22
|
+
debug() { }
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=PSphereGeometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PSphereGeometry.js","sourceRoot":"","sources":["../../src/pcomponents/PSphereGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,mBAAmB;IAAhE;;QACE,OAAE,GAA0B,IAAI,CAAC;IAyBnC,CAAC;IAvBC,QAAQ;QACN,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;YACrB,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;IAED,MAAM;QACJ,MAAM,QAAQ,GAAG,IAAI,cAAc,CACjC,IAAI,CAAC,MAAM,EACX,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,EAAE,EACxB,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,EAAE,CACzB,CAAC;QACF,IAAI,CAAC,EAAE,GAAG,QAAQ,CAAC;QAEnB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QAExC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,KAAK,KAAI,CAAC;CACX"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SpriteMaterial } from "three";
|
|
2
|
+
import { PSprite as PSpriteBase } from "@p100-web/core";
|
|
3
|
+
import { TextureTask, ITextureTaskLoader } from "../assets/ThreeAssetLoader";
|
|
4
|
+
export default class PSprite extends PSpriteBase implements ITextureTaskLoader {
|
|
5
|
+
protected _material_back: SpriteMaterial | null;
|
|
6
|
+
protected _material_front: SpriteMaterial | null;
|
|
7
|
+
private _unrenderMaterial;
|
|
8
|
+
_unrender(unrender: boolean): void;
|
|
9
|
+
unrender(): void;
|
|
10
|
+
render(): void;
|
|
11
|
+
onTextureTaskLoaded: (task: TextureTask) => void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=PSprite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PSprite.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PSprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,cAAc,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAyB,EACvB,WAAW,EACX,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,WAAY,YAAW,kBAAkB;IAC5E,SAAS,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAQ;IACvD,SAAS,CAAC,eAAe,EAAE,cAAc,GAAG,IAAI,CAAQ;IAExD,OAAO,CAAC,iBAAiB;IAYzB,SAAS,CAAC,QAAQ,EAAE,OAAO;IAU3B,QAAQ;IAIR,MAAM;IAqCN,mBAAmB,GAAI,MAAM,WAAW,KAAG,IAAI,CAY7C;CACH"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Sprite, SpriteMaterial } from "three";
|
|
2
|
+
import { PSprite as PSpriteBase } from "@p100-web/core";
|
|
3
|
+
export default class PSprite extends PSpriteBase {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._material_back = null;
|
|
7
|
+
this._material_front = null;
|
|
8
|
+
//
|
|
9
|
+
// TextureTask
|
|
10
|
+
//
|
|
11
|
+
this.onTextureTaskLoaded = (task) => {
|
|
12
|
+
if (task.texture === null) {
|
|
13
|
+
this.context.error("onTextureLoaded and texture was null");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const texture = task.texture;
|
|
17
|
+
this._material_back.map = texture;
|
|
18
|
+
this._material_front.map = texture;
|
|
19
|
+
this._material_back.needsUpdate = true;
|
|
20
|
+
this._material_front.needsUpdate = true;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
_unrenderMaterial(material, unrender) {
|
|
24
|
+
if (material.map) {
|
|
25
|
+
material.map.dispose();
|
|
26
|
+
material.map = null;
|
|
27
|
+
}
|
|
28
|
+
material.needsUpdate = true;
|
|
29
|
+
// Dispose material
|
|
30
|
+
if (unrender) {
|
|
31
|
+
material.dispose();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
_unrender(unrender) {
|
|
35
|
+
if (this._material_back)
|
|
36
|
+
this._unrenderMaterial(this._material_back, unrender);
|
|
37
|
+
if (this._material_front)
|
|
38
|
+
this._unrenderMaterial(this._material_front, unrender);
|
|
39
|
+
this._material_back = null;
|
|
40
|
+
this._material_front = null;
|
|
41
|
+
}
|
|
42
|
+
unrender() {
|
|
43
|
+
this._unrender(true);
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
this._material_back = new SpriteMaterial({
|
|
47
|
+
color: this.color,
|
|
48
|
+
transparent: true,
|
|
49
|
+
opacity: this.opacity * 0.25,
|
|
50
|
+
depthTest: false,
|
|
51
|
+
depthWrite: false,
|
|
52
|
+
});
|
|
53
|
+
this._material_front = new SpriteMaterial({
|
|
54
|
+
color: this.color,
|
|
55
|
+
transparent: true,
|
|
56
|
+
opacity: this.opacity,
|
|
57
|
+
depthTest: true,
|
|
58
|
+
depthWrite: false,
|
|
59
|
+
});
|
|
60
|
+
const mesh_back = new Sprite(this._material_back);
|
|
61
|
+
const mesh_front = new Sprite(this._material_front);
|
|
62
|
+
mesh_back.renderOrder = 9999;
|
|
63
|
+
mesh_front.renderOrder = 9999;
|
|
64
|
+
mesh_front.add(mesh_back);
|
|
65
|
+
this.node.set_el(mesh_front);
|
|
66
|
+
if (this.file_image !== null) {
|
|
67
|
+
this.context
|
|
68
|
+
.assetLoader()
|
|
69
|
+
.addTextureTask(this, this.file_image);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=PSprite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PSprite.js","sourceRoot":"","sources":["../../src/pcomponents/PSprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOxD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,WAAW;IAAhD;;QACY,mBAAc,GAA0B,IAAI,CAAC;QAC7C,oBAAe,GAA0B,IAAI,CAAC;QA6DxD,EAAE;QACF,eAAe;QACf,EAAE;QAEF,wBAAmB,GAAG,CAAC,IAAiB,EAAQ,EAAE;YAChD,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC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jB,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI;YAC5B,SAAS,EAAE,KAAK;YAChB,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,GAAG,IAAI,cAAc,CAAC;YACxC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAClD,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAEpD,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC;QAC7B,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC;QAE9B,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAE7B,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC7B,IAAI,CAAC,OAAO;iBACT,WAAW,EAAoB;iBAC/B,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;CAmBF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Texture } from "three";
|
|
2
|
+
import { INodeEventSender, NodeEvents, PSpriteSheet as PSpriteSheetBase, PVector2 } from "@p100-web/core";
|
|
3
|
+
import { INodeEventListener } from "@p100-web/core";
|
|
4
|
+
export default class PSpriteSheet extends PSpriteSheetBase implements INodeEventListener {
|
|
5
|
+
private _target;
|
|
6
|
+
render(): void;
|
|
7
|
+
unrender(): void;
|
|
8
|
+
onNodeEvent: (_component: INodeEventSender, type: NodeEvents, texture: Texture) => void;
|
|
9
|
+
protected callback_setIndex(payload: string | null): void;
|
|
10
|
+
setIndex(index: number): void;
|
|
11
|
+
setSize(value: PVector2): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=PSpriteSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PSpriteSheet.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PSpriteSheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,IAAI,gBAAgB,EAChC,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAiB,YAAW,kBAAkB;IACtF,OAAO,CAAC,OAAO,CAAwB;IAEvC,MAAM;IAIN,QAAQ;IAKR,WAAW,GACT,YAAY,gBAAgB,EAC5B,MAAM,UAAU,EAChB,SAAS,OAAO,KACf,IAAI,CAOL;IAEF,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IASzD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAS7B,OAAO,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;CAS/B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { NodeEvents, PSpriteSheet as PSpriteSheetBase, } from "@p100-web/core";
|
|
2
|
+
export default class PSpriteSheet extends PSpriteSheetBase {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this._target = null;
|
|
6
|
+
this.onNodeEvent = (_component, type, texture) => {
|
|
7
|
+
if ((type & NodeEvents.TextureLoaded) === 0)
|
|
8
|
+
return;
|
|
9
|
+
this._target = texture;
|
|
10
|
+
if (this._target !== null) {
|
|
11
|
+
this.setSize(this.size);
|
|
12
|
+
this.setIndex(this.index);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
this.node.addNodeEventListener(this);
|
|
18
|
+
}
|
|
19
|
+
unrender() {
|
|
20
|
+
this.node.removeNodeEventListener(this);
|
|
21
|
+
this._target = null;
|
|
22
|
+
}
|
|
23
|
+
callback_setIndex(payload) {
|
|
24
|
+
const value = parseInt(payload || "0");
|
|
25
|
+
if (value !== this._currentValue) {
|
|
26
|
+
this._currentValue = value;
|
|
27
|
+
this.setIndex(value);
|
|
28
|
+
this.outevent_onChange?.emit(payload, this);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
setIndex(index) {
|
|
32
|
+
const width = this.size.x;
|
|
33
|
+
const height = this.size.y;
|
|
34
|
+
const currentColumn = index % width;
|
|
35
|
+
this._target.offset.x = currentColumn / width;
|
|
36
|
+
const currentRow = Math.floor(index / width);
|
|
37
|
+
this._target.offset.y = currentRow / height;
|
|
38
|
+
}
|
|
39
|
+
setSize(value) {
|
|
40
|
+
this.size = value;
|
|
41
|
+
const material = this.node.material;
|
|
42
|
+
if (material) {
|
|
43
|
+
material.repeat.x = 1 / this.size.x;
|
|
44
|
+
material.repeat.y = 1 / this.size.y;
|
|
45
|
+
material.setTextureRepeat();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=PSpriteSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PSpriteSheet.js","sourceRoot":"","sources":["../../src/pcomponents/PSpriteSheet.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,UAAU,EACV,YAAY,IAAI,gBAAgB,GAEjC,MAAM,gBAAgB,CAAC;AAIxB,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB;IAA1D;;QACU,YAAO,GAAmB,IAAI,CAAC;QAWvC,gBAAW,GAAG,CACZ,UAA4B,EAC5B,IAAgB,EAChB,OAAgB,EACV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AAK,GAAG,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,GAAG,MAAM,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,KAAe;QACrB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAA0B,CAAC;QACtD,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACpC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACpC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Text } from "troika-three-text";
|
|
2
|
+
import { PText as PTextBase } from "@p100-web/core";
|
|
3
|
+
export default class PText extends PTextBase {
|
|
4
|
+
protected _el: Text | null;
|
|
5
|
+
dispose(): void;
|
|
6
|
+
callback_setText: (payloadValue: string | null) => void;
|
|
7
|
+
render(): void;
|
|
8
|
+
unrender(): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=PText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PText.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PText.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,SAAS;IAC1C,SAAS,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAQ;IAElC,OAAO;IAIP,gBAAgB,GAAI,cAAc,MAAM,GAAG,IAAI,UAM7C;IAEF,MAAM;IAqBN,QAAQ;CAMT"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import { Text } from "troika-three-text";
|
|
3
|
+
import { PText as PTextBase } from "@p100-web/core";
|
|
4
|
+
export default class PText extends PTextBase {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this._el = null;
|
|
8
|
+
this.callback_setText = (payloadValue) => {
|
|
9
|
+
if (this._el !== null) {
|
|
10
|
+
this._el.text = (payloadValue || "").replace(/\\n/g, "\n");
|
|
11
|
+
this._el.sync();
|
|
12
|
+
}
|
|
13
|
+
this.outevent_onSetText?.emit(payloadValue, this);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
dispose() {
|
|
17
|
+
if (this.file_font)
|
|
18
|
+
this.context.releaseFile(this.file_font);
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
// Create:
|
|
22
|
+
const el = new Text();
|
|
23
|
+
this._el = el;
|
|
24
|
+
// Set properties to configure:
|
|
25
|
+
el.text = this.text.replace(/\\n/g, "\n");
|
|
26
|
+
el.fontSize = this.fontSize;
|
|
27
|
+
el.font = this.file_font ? this.context.s3Url + this.file_font.url : null;
|
|
28
|
+
el.color = this.color;
|
|
29
|
+
el.anchorX = this.textAlign;
|
|
30
|
+
el.anchorY = this.verticalAlign;
|
|
31
|
+
el.outlineColor = this.outlineColor;
|
|
32
|
+
el.outlineWidth = this.outlineWidth > 0 ? this.outlineWidth + "%" : 0;
|
|
33
|
+
// Update the rendering:
|
|
34
|
+
el.sync();
|
|
35
|
+
this.node.set_el(el);
|
|
36
|
+
}
|
|
37
|
+
unrender() {
|
|
38
|
+
if (this._el) {
|
|
39
|
+
this._el.dispose();
|
|
40
|
+
this._el = null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=PText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PText.js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1E,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACtB,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5B,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QAChC,EAAE,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACpC,EAAE,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtE,wBAAwB;QACxB,EAAE,CAAC,IAAI,EAAE,CAAC;QAEV,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAClB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PVideoPlayer.d.ts","sourceRoot":"","sources":["../../src/pcomponents/PVideoPlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlE,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB;IACxD,SAAS,CAAC,QAAQ,IAAI,gBAAgB,GAAG,IAAI;CAQ9C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PVideoPlayer as PVideoPlayerBase } from "@p100-web/core";
|
|
2
|
+
export default class PVideoPlayer extends PVideoPlayerBase {
|
|
3
|
+
getVideo() {
|
|
4
|
+
// Get material
|
|
5
|
+
if (this.node.material) {
|
|
6
|
+
const texture = this.node.material.getTexture();
|
|
7
|
+
return texture?.source?.data || null;
|
|
8
|
+
}
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=PVideoPlayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PVideoPlayer.js","sourceRoot":"","sources":["../../src/pcomponents/PVideoPlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlE,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB;IAC9C,QAAQ;QAChB,eAAe;QACf,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAgB,CAAC;YAC9D,OAAO,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,IAAI,CAAC;QACvC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { PSceneRoot, PTransform, PCallAction, PCallActions, PCompareNumber, PCompareInteger, PCompareBoolean, PCompareVariable, PCompareString, PVisibility, PDebug, PSceneContainer, PVarList, PVarWriter, PVarReader, PXRTools, PImageDetector, PPlaneDetector, PControllerInput, PCameraPosition, PCameraTarget, PHud, PMoveAnimation, PMoveToAnimation, PFadeAnimation, PRotateAnimation, PScaleAnimation, PIntegerAnimator, PInteger } from "@p100-web/core";
|
|
2
|
+
export { default as PProjectRoot } from "./pcomponents/PProjectRoot";
|
|
3
|
+
export { default as PBackground } from "./pcomponents/PBackground";
|
|
4
|
+
export { default as PVideoPlayer } from "./pcomponents/PVideoPlayer";
|
|
5
|
+
export { default as PBasicMaterial } from "./pcomponents/PBasicMaterial";
|
|
6
|
+
export { default as PAnimator } from "./pcomponents/PAnimator";
|
|
7
|
+
export { default as PPlaneGeometry } from "./pcomponents/PPlaneGeometry";
|
|
8
|
+
export { default as PPhysicalMaterial } from "./pcomponents/PPhysicalMaterial";
|
|
9
|
+
export { default as PSphereGeometry } from "./pcomponents/PSphereGeometry";
|
|
10
|
+
export { default as PText } from "./pcomponents/PText";
|
|
11
|
+
export { default as PModelGLTF } from "./pcomponents/PModelGLTF";
|
|
12
|
+
export { default as PLight } from "./pcomponents/PLight";
|
|
13
|
+
export { default as PLightDirectional } from "./pcomponents/PLightDirectional";
|
|
14
|
+
export { default as PSlider } from "./pcomponents/PSlider";
|
|
15
|
+
export { default as PEnvironment } from "./pcomponents/PEnvironment";
|
|
16
|
+
export { default as PSound } from "./pcomponents/PSound";
|
|
17
|
+
export { default as PCubeGeometry } from "./pcomponents/PCubeGeometry";
|
|
18
|
+
export { default as PSprite } from "./pcomponents/PSprite";
|
|
19
|
+
export { default as PMaskedMaterial } from "./pcomponents/PMaskedMaterial";
|
|
20
|
+
export { default as PCollider } from "./pcomponents/PCollider";
|
|
21
|
+
export { default as PModelNode } from "./pcomponents/PModelNode";
|
|
22
|
+
export { default as PMaterialModifier } from "./pcomponents/PMaterialModifier";
|
|
23
|
+
export { default as PModelAnnotations } from "./pcomponents/PModelAnnotations";
|
|
24
|
+
export { default as PModelAnnotation } from "./pcomponents/PModelAnnotation";
|
|
25
|
+
export { default as PImageCache } from "./pcomponents/PImageCache";
|
|
26
|
+
export { default as PSpriteSheet } from "./pcomponents/PSpriteSheet";
|
|
27
|
+
//# sourceMappingURL=pcomponents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pcomponents.d.ts","sourceRoot":"","sources":["../src/pcomponents.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,MAAM,EACN,eAAe,EACf,QAAQ,EACR,UAAU,EACV,UAAU,EACV,QAAQ,EACR,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,IAAI,EACJ,cAAc,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+B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// DEFAULT COMPONENTS
|
|
3
|
+
//
|
|
4
|
+
export { PSceneRoot, PTransform, PCallAction, PCallActions, PCompareNumber, PCompareInteger, PCompareBoolean, PCompareVariable, PCompareString, PVisibility, PDebug, PSceneContainer, PVarList, PVarWriter, PVarReader, PXRTools, PImageDetector, PPlaneDetector, PControllerInput, PCameraPosition, PCameraTarget, PHud, PMoveAnimation, PMoveToAnimation, PFadeAnimation, PRotateAnimation, PScaleAnimation, PIntegerAnimator, PInteger } from "@p100-web/core";
|
|
5
|
+
//
|
|
6
|
+
// THREE OVERRIDE COMPONENTS
|
|
7
|
+
//
|
|
8
|
+
export { default as PProjectRoot } from "./pcomponents/PProjectRoot";
|
|
9
|
+
export { default as PBackground } from "./pcomponents/PBackground";
|
|
10
|
+
export { default as PVideoPlayer } from "./pcomponents/PVideoPlayer";
|
|
11
|
+
export { default as PBasicMaterial } from "./pcomponents/PBasicMaterial";
|
|
12
|
+
export { default as PAnimator } from "./pcomponents/PAnimator";
|
|
13
|
+
export { default as PPlaneGeometry } from "./pcomponents/PPlaneGeometry";
|
|
14
|
+
export { default as PPhysicalMaterial } from "./pcomponents/PPhysicalMaterial";
|
|
15
|
+
export { default as PSphereGeometry } from "./pcomponents/PSphereGeometry";
|
|
16
|
+
export { default as PText } from "./pcomponents/PText";
|
|
17
|
+
export { default as PModelGLTF } from "./pcomponents/PModelGLTF";
|
|
18
|
+
export { default as PLight } from "./pcomponents/PLight";
|
|
19
|
+
export { default as PLightDirectional } from "./pcomponents/PLightDirectional";
|
|
20
|
+
export { default as PSlider } from "./pcomponents/PSlider";
|
|
21
|
+
export { default as PEnvironment } from "./pcomponents/PEnvironment";
|
|
22
|
+
export { default as PSound } from "./pcomponents/PSound";
|
|
23
|
+
export { default as PCubeGeometry } from "./pcomponents/PCubeGeometry";
|
|
24
|
+
export { default as PSprite } from "./pcomponents/PSprite";
|
|
25
|
+
export { default as PMaskedMaterial } from "./pcomponents/PMaskedMaterial";
|
|
26
|
+
export { default as PCollider } from "./pcomponents/PCollider";
|
|
27
|
+
export { default as PModelNode } from "./pcomponents/PModelNode";
|
|
28
|
+
export { default as PMaterialModifier } from "./pcomponents/PMaterialModifier";
|
|
29
|
+
export { default as PModelAnnotations } from "./pcomponents/PModelAnnotations";
|
|
30
|
+
export { default as PModelAnnotation } from "./pcomponents/PModelAnnotation";
|
|
31
|
+
export { default as PImageCache } from "./pcomponents/PImageCache";
|
|
32
|
+
export { default as PSpriteSheet } from "./pcomponents/PSpriteSheet";
|
|
33
|
+
//# sourceMappingURL=pcomponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pcomponents.js","sourceRoot":"","sources":["../src/pcomponents.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,qBAAqB;AACrB,EAAE;AAEF,OAAO,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,MAAM,EACN,eAAe,EACf,QAAQ,EACR,UAAU,EACV,UAAU,EACV,QAAQ,EACR,cAAc,EACd,cAAc,EACd,gBAAgB,EACh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AAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IThreePostProcessingSettings } from "@p100-web/core";
|
|
2
|
+
import { SSRPass } from "three/addons/postprocessing/SSRPass.js";
|
|
3
|
+
export default class PSSRPass extends SSRPass {
|
|
4
|
+
private _maxScale;
|
|
5
|
+
private _minScale;
|
|
6
|
+
private _renderScale;
|
|
7
|
+
private _currentQuality;
|
|
8
|
+
updateSettings(settings: IThreePostProcessingSettings): boolean;
|
|
9
|
+
setQuality(quality: number): void;
|
|
10
|
+
private updateRenderScale;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the size of the pass.
|
|
13
|
+
*
|
|
14
|
+
* @param {number} rawWidth - The width to set. Pre-multiplied with pixel ratio.
|
|
15
|
+
* @param {number} rawHeight - The height to set. Pre-multiplied with pixel ratio.
|
|
16
|
+
*/
|
|
17
|
+
setSize(rawWidth: number, rawHeight: number): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=PSSRPass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PSSRPass.d.ts","sourceRoot":"","sources":["../../src/postprocessing/PSSRPass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO;IAC3C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,eAAe,CAAO;IAG9B,cAAc,CAAC,QAAQ,EAAE,4BAA4B;IAWrD,UAAU,CAAC,OAAO,EAAE,MAAM;IAO1B,OAAO,CAAC,iBAAiB;IAwBzB;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAqC5C"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { MathUtils } from "three";
|
|
2
|
+
import { SSRPass } from "three/addons/postprocessing/SSRPass.js";
|
|
3
|
+
export default class PSSRPass extends SSRPass {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._maxScale = 1;
|
|
7
|
+
this._minScale = 1;
|
|
8
|
+
this._renderScale = 1;
|
|
9
|
+
this._currentQuality = 100;
|
|
10
|
+
}
|
|
11
|
+
// private _blur = false;
|
|
12
|
+
updateSettings(settings) {
|
|
13
|
+
this._maxScale = settings.ssr.maxScale;
|
|
14
|
+
this._minScale = settings.ssr.minScale;
|
|
15
|
+
// this._blur = settings.ssr.blur > 0;
|
|
16
|
+
const newScale = Math.min(Math.max(this._renderScale, this._minScale), this._maxScale);
|
|
17
|
+
return Math.abs(this._renderScale - newScale) > 0.01;
|
|
18
|
+
}
|
|
19
|
+
setQuality(quality) {
|
|
20
|
+
// console.log("[PSSRPass] setQuality: ", quality);
|
|
21
|
+
this._currentQuality = quality;
|
|
22
|
+
//this.blur = this._currentQuality > 75 && this._blur;
|
|
23
|
+
this.updateRenderScale();
|
|
24
|
+
}
|
|
25
|
+
updateRenderScale() {
|
|
26
|
+
const qualityScale = MathUtils.lerp(this._minScale, this._maxScale, this._currentQuality * 0.01);
|
|
27
|
+
const newScale = Math.min(Math.max(qualityScale, this._minScale), this._maxScale);
|
|
28
|
+
const resizePixelRatio = Math.abs(this._renderScale - newScale) >= 0.04;
|
|
29
|
+
if (resizePixelRatio) {
|
|
30
|
+
// console.log(
|
|
31
|
+
// "[PSSRPass] Change scale [",
|
|
32
|
+
// this._renderScale.toFixed(2),
|
|
33
|
+
// "] -> [",
|
|
34
|
+
// newScale.toFixed(2),
|
|
35
|
+
// "]"
|
|
36
|
+
// );
|
|
37
|
+
this._renderScale = newScale;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Sets the size of the pass.
|
|
42
|
+
*
|
|
43
|
+
* @param {number} rawWidth - The width to set. Pre-multiplied with pixel ratio.
|
|
44
|
+
* @param {number} rawHeight - The height to set. Pre-multiplied with pixel ratio.
|
|
45
|
+
*/
|
|
46
|
+
setSize(rawWidth, rawHeight) {
|
|
47
|
+
this.width = rawWidth;
|
|
48
|
+
this.height = rawHeight;
|
|
49
|
+
const effectiveScale = Math.min(Math.max(this._renderScale, this._minScale), this._maxScale);
|
|
50
|
+
// console.log("[PSSRPass] setSize: x", effectiveScale.toFixed(2));
|
|
51
|
+
const width = rawWidth * effectiveScale;
|
|
52
|
+
const height = rawHeight * effectiveScale;
|
|
53
|
+
this.ssrMaterial.defines.MAX_STEP = Math.sqrt(width * width + height * height);
|
|
54
|
+
this.ssrMaterial.needsUpdate = true;
|
|
55
|
+
this.beautyRenderTarget.setSize(rawWidth, rawHeight);
|
|
56
|
+
this.prevRenderTarget.setSize(width, height);
|
|
57
|
+
this.ssrRenderTarget.setSize(width, height);
|
|
58
|
+
this.normalRenderTarget.setSize(width, height);
|
|
59
|
+
this.metalnessRenderTarget.setSize(width, height);
|
|
60
|
+
this.blurRenderTarget.setSize(width, height);
|
|
61
|
+
this.blurRenderTarget2.setSize(width, height);
|
|
62
|
+
this.ssrMaterial.uniforms["resolution"].value.set(width, height);
|
|
63
|
+
this.ssrMaterial.uniforms["cameraProjectionMatrix"].value.copy(this.camera.projectionMatrix);
|
|
64
|
+
this.ssrMaterial.uniforms["cameraInverseProjectionMatrix"].value.copy(this.camera.projectionMatrixInverse);
|
|
65
|
+
this.blurMaterial.uniforms["resolution"].value.set(width, height);
|
|
66
|
+
this.blurMaterial2.uniforms["resolution"].value.set(width, height);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=PSSRPass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PSSRPass.js","sourceRoot":"","sources":["../../src/postprocessing/PSSRPass.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO;IAA7C;;QACU,cAAS,GAAG,CAAC,CAAC;QACd,cAAS,GAAG,CAAC,CAAC;QACd,iBAAY,GAAG,CAAC,CAAC;QACjB,oBAAe,GAAG,GAAG,CAAC;IAwFhC,CAAC;IAvFC,0BAA0B;IAE1B,cAAc,CAAC,QAAsC;QACnD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;QACvC,wCAAwC;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CACvB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,EAC3C,IAAI,CAAC,SAAS,CACf,CAAC;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC;IACvD,CAAC;I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