@p100-web/core-three 100.0.65 → 100.0.67
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 +2 -2
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +11 -10
- package/dist/App.js.map +1 -1
- package/dist/ThreeCanvas.d.ts +55 -0
- package/dist/ThreeCanvas.d.ts.map +1 -0
- package/dist/ThreeCanvas.js +430 -0
- package/dist/ThreeCanvas.js.map +1 -0
- package/dist/ThreeEngine.d.ts +5 -2
- package/dist/ThreeEngine.d.ts.map +1 -1
- package/dist/ThreeEngine.js +8 -3
- package/dist/ThreeEngine.js.map +1 -1
- package/dist/ThreeNodeRenderer.js +1 -1
- package/dist/ThreeNodeRenderer.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/media/EnvironmentLoader.js.map +1 -1
- package/dist/media/ImageLoader.d.ts +1 -1
- package/dist/media/ImageLoader.d.ts.map +1 -1
- package/dist/media/ModelLoader.js.map +1 -1
- package/dist/media/VideoLoader.d.ts +1 -1
- package/dist/media/VideoLoader.d.ts.map +1 -1
- package/dist/pcomponents/PCollider.js.map +1 -1
- package/dist/pcomponents/PEnvironment.d.ts +1 -1
- package/dist/pcomponents/PEnvironment.d.ts.map +1 -1
- package/dist/pcomponents/PEnvironment.js.map +1 -1
- package/dist/pcomponents/PModelGLTF.js.map +1 -1
- package/dist/pcomponents/PProjectRoot.js.map +1 -1
- package/dist/pcomponents/PSlider.js.map +1 -1
- package/dist/three/FreeCameraControls.d.ts +2 -2
- package/dist/three/FreeCameraControls.d.ts.map +1 -1
- package/dist/three/FreeCameraControls.js.map +1 -1
- package/dist/three/OrbitCameraControls.d.ts +2 -2
- package/dist/three/OrbitCameraControls.d.ts.map +1 -1
- package/dist/three/OrbitCameraControls.js +1 -0
- package/dist/three/OrbitCameraControls.js.map +1 -1
- package/dist/three/VrCameraControls.d.ts +2 -2
- package/dist/three/VrCameraControls.d.ts.map +1 -1
- package/dist/three/VrCameraControls.js.map +1 -1
- package/package.json +2 -8
- package/dist/PCanvas.d.ts +0 -171
- package/dist/PCanvas.d.ts.map +0 -1
- package/dist/PCanvas.js +0 -992
- package/dist/PCanvas.js.map +0 -1
- package/dist/src/App.d.ts +0 -40
- package/dist/src/App.d.ts.map +0 -1
- package/dist/src/App.js +0 -171
- package/dist/src/App.js.map +0 -1
- package/dist/src/ComponentFactory.d.ts +0 -5
- package/dist/src/ComponentFactory.d.ts.map +0 -1
- package/dist/src/ComponentFactory.js +0 -17
- package/dist/src/ComponentFactory.js.map +0 -1
- package/dist/src/PCanvas.d.ts +0 -171
- package/dist/src/PCanvas.d.ts.map +0 -1
- package/dist/src/PCanvas.js +0 -992
- package/dist/src/PCanvas.js.map +0 -1
- package/dist/src/ThreeEngine.d.ts +0 -25
- package/dist/src/ThreeEngine.d.ts.map +0 -1
- package/dist/src/ThreeEngine.js +0 -102
- package/dist/src/ThreeEngine.js.map +0 -1
- package/dist/src/ThreeNodeRenderer.d.ts +0 -32
- package/dist/src/ThreeNodeRenderer.d.ts.map +0 -1
- package/dist/src/ThreeNodeRenderer.js +0 -87
- package/dist/src/ThreeNodeRenderer.js.map +0 -1
- package/dist/src/media/AudioLoader.d.ts +0 -32
- package/dist/src/media/AudioLoader.d.ts.map +0 -1
- package/dist/src/media/AudioLoader.js +0 -110
- package/dist/src/media/AudioLoader.js.map +0 -1
- package/dist/src/media/EnvironmentLoader.d.ts +0 -40
- package/dist/src/media/EnvironmentLoader.d.ts.map +0 -1
- package/dist/src/media/EnvironmentLoader.js +0 -120
- package/dist/src/media/EnvironmentLoader.js.map +0 -1
- package/dist/src/media/ImageLoader.d.ts +0 -36
- package/dist/src/media/ImageLoader.d.ts.map +0 -1
- package/dist/src/media/ImageLoader.js +0 -160
- package/dist/src/media/ImageLoader.js.map +0 -1
- package/dist/src/media/MediaLoader.d.ts +0 -14
- package/dist/src/media/MediaLoader.d.ts.map +0 -1
- package/dist/src/media/MediaLoader.js +0 -70
- package/dist/src/media/MediaLoader.js.map +0 -1
- package/dist/src/media/ModelLoader.d.ts +0 -49
- package/dist/src/media/ModelLoader.d.ts.map +0 -1
- package/dist/src/media/ModelLoader.js +0 -223
- package/dist/src/media/ModelLoader.js.map +0 -1
- package/dist/src/media/VideoLoader.d.ts +0 -35
- package/dist/src/media/VideoLoader.d.ts.map +0 -1
- package/dist/src/media/VideoLoader.js +0 -105
- package/dist/src/media/VideoLoader.js.map +0 -1
- package/dist/src/pcomponents/PAnimator.d.ts +0 -24
- package/dist/src/pcomponents/PAnimator.d.ts.map +0 -1
- package/dist/src/pcomponents/PAnimator.js +0 -129
- package/dist/src/pcomponents/PAnimator.js.map +0 -1
- package/dist/src/pcomponents/PBasicMaterial.d.ts +0 -17
- package/dist/src/pcomponents/PBasicMaterial.d.ts.map +0 -1
- package/dist/src/pcomponents/PBasicMaterial.js +0 -142
- package/dist/src/pcomponents/PBasicMaterial.js.map +0 -1
- package/dist/src/pcomponents/PCollider.d.ts +0 -11
- package/dist/src/pcomponents/PCollider.d.ts.map +0 -1
- package/dist/src/pcomponents/PCollider.js +0 -61
- package/dist/src/pcomponents/PCollider.js.map +0 -1
- package/dist/src/pcomponents/PCubeGeometry.d.ts +0 -8
- package/dist/src/pcomponents/PCubeGeometry.d.ts.map +0 -1
- package/dist/src/pcomponents/PCubeGeometry.js +0 -23
- package/dist/src/pcomponents/PCubeGeometry.js.map +0 -1
- package/dist/src/pcomponents/PEnvironment.d.ts +0 -14
- package/dist/src/pcomponents/PEnvironment.d.ts.map +0 -1
- package/dist/src/pcomponents/PEnvironment.js +0 -86
- package/dist/src/pcomponents/PEnvironment.js.map +0 -1
- package/dist/src/pcomponents/PImageBackground.d.ts +0 -14
- package/dist/src/pcomponents/PImageBackground.d.ts.map +0 -1
- package/dist/src/pcomponents/PImageBackground.js +0 -85
- package/dist/src/pcomponents/PImageBackground.js.map +0 -1
- package/dist/src/pcomponents/PLight.d.ts +0 -8
- package/dist/src/pcomponents/PLight.d.ts.map +0 -1
- package/dist/src/pcomponents/PLight.js +0 -22
- package/dist/src/pcomponents/PLight.js.map +0 -1
- package/dist/src/pcomponents/PLightDirectional.d.ts +0 -8
- package/dist/src/pcomponents/PLightDirectional.d.ts.map +0 -1
- package/dist/src/pcomponents/PLightDirectional.js +0 -36
- package/dist/src/pcomponents/PLightDirectional.js.map +0 -1
- package/dist/src/pcomponents/PMaskedMaterial.d.ts +0 -17
- package/dist/src/pcomponents/PMaskedMaterial.d.ts.map +0 -1
- package/dist/src/pcomponents/PMaskedMaterial.js +0 -214
- package/dist/src/pcomponents/PMaskedMaterial.js.map +0 -1
- package/dist/src/pcomponents/PModelGLTF.d.ts +0 -18
- package/dist/src/pcomponents/PModelGLTF.d.ts.map +0 -1
- package/dist/src/pcomponents/PModelGLTF.js +0 -98
- package/dist/src/pcomponents/PModelGLTF.js.map +0 -1
- package/dist/src/pcomponents/PPhysicalMaterial.d.ts +0 -13
- package/dist/src/pcomponents/PPhysicalMaterial.d.ts.map +0 -1
- package/dist/src/pcomponents/PPhysicalMaterial.js +0 -106
- package/dist/src/pcomponents/PPhysicalMaterial.js.map +0 -1
- package/dist/src/pcomponents/PPlaneGeometry.d.ts +0 -8
- package/dist/src/pcomponents/PPlaneGeometry.d.ts.map +0 -1
- package/dist/src/pcomponents/PPlaneGeometry.js +0 -23
- package/dist/src/pcomponents/PPlaneGeometry.js.map +0 -1
- package/dist/src/pcomponents/PProjectRoot.d.ts +0 -8
- package/dist/src/pcomponents/PProjectRoot.d.ts.map +0 -1
- package/dist/src/pcomponents/PProjectRoot.js +0 -24
- package/dist/src/pcomponents/PProjectRoot.js.map +0 -1
- package/dist/src/pcomponents/PSlider.d.ts +0 -16
- package/dist/src/pcomponents/PSlider.d.ts.map +0 -1
- package/dist/src/pcomponents/PSlider.js +0 -69
- package/dist/src/pcomponents/PSlider.js.map +0 -1
- package/dist/src/pcomponents/PSound.d.ts +0 -17
- package/dist/src/pcomponents/PSound.d.ts.map +0 -1
- package/dist/src/pcomponents/PSound.js +0 -110
- package/dist/src/pcomponents/PSound.js.map +0 -1
- package/dist/src/pcomponents/PSphereGeometry.d.ts +0 -9
- package/dist/src/pcomponents/PSphereGeometry.d.ts.map +0 -1
- package/dist/src/pcomponents/PSphereGeometry.js +0 -24
- package/dist/src/pcomponents/PSphereGeometry.js.map +0 -1
- package/dist/src/pcomponents/PSprite.d.ts +0 -14
- package/dist/src/pcomponents/PSprite.d.ts.map +0 -1
- package/dist/src/pcomponents/PSprite.js +0 -79
- package/dist/src/pcomponents/PSprite.js.map +0 -1
- package/dist/src/pcomponents/PSpriteAnimation.d.ts +0 -15
- package/dist/src/pcomponents/PSpriteAnimation.d.ts.map +0 -1
- package/dist/src/pcomponents/PSpriteAnimation.js +0 -80
- package/dist/src/pcomponents/PSpriteAnimation.js.map +0 -1
- package/dist/src/pcomponents/PText.d.ts +0 -10
- package/dist/src/pcomponents/PText.d.ts.map +0 -1
- package/dist/src/pcomponents/PText.js +0 -44
- package/dist/src/pcomponents/PText.js.map +0 -1
- package/dist/src/pcomponents/PVideoBackground.d.ts +0 -13
- package/dist/src/pcomponents/PVideoBackground.d.ts.map +0 -1
- package/dist/src/pcomponents/PVideoBackground.js +0 -85
- package/dist/src/pcomponents/PVideoBackground.js.map +0 -1
- package/dist/src/pcomponents/PVideoPlayer.d.ts +0 -5
- package/dist/src/pcomponents/PVideoPlayer.d.ts.map +0 -1
- package/dist/src/pcomponents/PVideoPlayer.js +0 -12
- package/dist/src/pcomponents/PVideoPlayer.js.map +0 -1
- package/dist/src/postprocessing/PSSRPass.d.ts +0 -19
- package/dist/src/postprocessing/PSSRPass.d.ts.map +0 -1
- package/dist/src/postprocessing/PSSRPass.js +0 -69
- package/dist/src/postprocessing/PSSRPass.js.map +0 -1
- package/dist/src/postprocessing/ThreeJsPostProcessor.d.ts +0 -32
- package/dist/src/postprocessing/ThreeJsPostProcessor.d.ts.map +0 -1
- package/dist/src/postprocessing/ThreeJsPostProcessor.js +0 -264
- package/dist/src/postprocessing/ThreeJsPostProcessor.js.map +0 -1
- package/dist/src/three/ColliderObject3D.d.ts +0 -19
- package/dist/src/three/ColliderObject3D.d.ts.map +0 -1
- package/dist/src/three/ColliderObject3D.js +0 -146
- package/dist/src/three/ColliderObject3D.js.map +0 -1
- package/dist/src/three/FreeCameraControls.d.ts +0 -30
- package/dist/src/three/FreeCameraControls.d.ts.map +0 -1
- package/dist/src/three/FreeCameraControls.js +0 -158
- package/dist/src/three/FreeCameraControls.js.map +0 -1
- package/dist/src/three/OrbitCameraControls.d.ts +0 -24
- package/dist/src/three/OrbitCameraControls.d.ts.map +0 -1
- package/dist/src/three/OrbitCameraControls.js +0 -81
- package/dist/src/three/OrbitCameraControls.js.map +0 -1
- package/dist/src/three/VrCameraControls.d.ts +0 -28
- package/dist/src/three/VrCameraControls.d.ts.map +0 -1
- package/dist/src/three/VrCameraControls.js +0 -124
- package/dist/src/three/VrCameraControls.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,69 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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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G,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC;CACF"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Mesh, PerspectiveCamera, Scene, Vector2, WebGLRenderer } from "three";
|
|
2
|
-
import { IPostProcessor, IThreePostProcessingSettings } from "@p100-web/core";
|
|
3
|
-
export default class ThreeJsPostProcessor implements IPostProcessor {
|
|
4
|
-
private _composer;
|
|
5
|
-
private pp_bloom;
|
|
6
|
-
private pp_ssao;
|
|
7
|
-
private pp_sao;
|
|
8
|
-
private pp_dof;
|
|
9
|
-
private pp_ssr;
|
|
10
|
-
private pp_ssr_reflectors;
|
|
11
|
-
private pp_smaa;
|
|
12
|
-
private _pixelRatio;
|
|
13
|
-
constructor(settings: IThreePostProcessingSettings, scene: Scene, renderer: WebGLRenderer, camera: PerspectiveCamera, size: Vector2);
|
|
14
|
-
setPixelRatio(scale: number): void;
|
|
15
|
-
updateAASamples(value: number): void;
|
|
16
|
-
render(): void;
|
|
17
|
-
dispose(): void;
|
|
18
|
-
_width: number;
|
|
19
|
-
_height: number;
|
|
20
|
-
_throttle: any;
|
|
21
|
-
_delay: boolean;
|
|
22
|
-
setSize(x: number, y: number): void;
|
|
23
|
-
resize(x: number, y: number): void;
|
|
24
|
-
private setComposerSize;
|
|
25
|
-
updatePostProcessing(settings: IThreePostProcessingSettings, field: string): boolean;
|
|
26
|
-
private updateSSR;
|
|
27
|
-
addSSRSelectors(objects: Mesh[]): void;
|
|
28
|
-
removeSSRSelectors(): void;
|
|
29
|
-
setCurrentQuality(quality: number): boolean;
|
|
30
|
-
resizeEffects(): void;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=ThreeJsPostProcessor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeJsPostProcessor.d.ts","sourceRoot":"","sources":["../../../src/postprocessing/ThreeJsPostProcessor.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,IAAI,EACJ,iBAAi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ing/EffectComposer.js";
|
|
2
|
-
import { RenderPass } from "three/addons/postprocessing/RenderPass.js";
|
|
3
|
-
import { SSAOPass } from "three/addons/postprocessing/SSAOPass.js";
|
|
4
|
-
import { SAOPass } from "three/addons/postprocessing/SAOPass.js";
|
|
5
|
-
import { OutputPass } from "three/addons/postprocessing/OutputPass.js";
|
|
6
|
-
import { UnrealBloomPass } from "three/addons/postprocessing/UnrealBloomPass.js";
|
|
7
|
-
import { BokehPass } from "three/addons/postprocessing/BokehPass.js";
|
|
8
|
-
import SSRPass from "./PSSRPass";
|
|
9
|
-
import { SMAAPass } from "three/addons/postprocessing/SMAAPass.js";
|
|
10
|
-
import { Vector2, WebGLRenderTarget, } from "three";
|
|
11
|
-
export default class ThreeJsPostProcessor {
|
|
12
|
-
constructor(settings, scene, renderer, camera, size) {
|
|
13
|
-
this._composer = null;
|
|
14
|
-
this.pp_bloom = null;
|
|
15
|
-
this.pp_ssao = null;
|
|
16
|
-
this.pp_sao = null;
|
|
17
|
-
this.pp_dof = null;
|
|
18
|
-
this.pp_ssr = null;
|
|
19
|
-
this.pp_ssr_reflectors = null;
|
|
20
|
-
this.pp_smaa = null;
|
|
21
|
-
this._width = 0;
|
|
22
|
-
this._height = 0;
|
|
23
|
-
this._throttle = -1;
|
|
24
|
-
this._delay = false;
|
|
25
|
-
this.setComposerSize = () => {
|
|
26
|
-
if (this._delay) {
|
|
27
|
-
this._delay = false;
|
|
28
|
-
this._throttle = setTimeout(this.setComposerSize, 250);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
this._throttle = -1;
|
|
32
|
-
this._composer?.setSize(this._width, this._height);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
this._pixelRatio = renderer.getPixelRatio();
|
|
36
|
-
// console.log(
|
|
37
|
-
// "---< POST PROCESSING [3JS] >--- PixelRatio: ",
|
|
38
|
-
// this._pixelRatio
|
|
39
|
-
// );
|
|
40
|
-
const renderTarget = new WebGLRenderTarget(size.x * this._pixelRatio, size.y * this._pixelRatio);
|
|
41
|
-
renderTarget.samples = settings.samples;
|
|
42
|
-
renderTarget.depthBuffer = true;
|
|
43
|
-
const composer = new EffectComposer(renderer, renderTarget);
|
|
44
|
-
// No need to set size and pixel ratio, it will be fetched from the renderer
|
|
45
|
-
// AA
|
|
46
|
-
// if (renderer.getContext() instanceof WebGL2RenderingContext) {
|
|
47
|
-
// }
|
|
48
|
-
const renderPass = new RenderPass(scene, camera);
|
|
49
|
-
composer.addPass(renderPass);
|
|
50
|
-
if (settings.ssr.enabled) {
|
|
51
|
-
if (!(renderer.getContext() instanceof WebGL2RenderingContext)) {
|
|
52
|
-
console.warn("WebGL2 is not supported. SSR will not work.");
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
const ssrPass = new SSRPass({
|
|
56
|
-
renderer,
|
|
57
|
-
scene,
|
|
58
|
-
camera,
|
|
59
|
-
width: size.x,
|
|
60
|
-
height: size.y,
|
|
61
|
-
groundReflector: null,
|
|
62
|
-
selects: null,
|
|
63
|
-
});
|
|
64
|
-
this.pp_ssr = ssrPass;
|
|
65
|
-
this.updateSSR(settings);
|
|
66
|
-
composer.addPass(ssrPass);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (settings.ssao.enabled) {
|
|
70
|
-
const ssaoPass = new SSAOPass(scene, camera, size.x, size.y);
|
|
71
|
-
composer.addPass(ssaoPass);
|
|
72
|
-
ssaoPass.kernelRadius = settings.ssao.radius;
|
|
73
|
-
ssaoPass.minDistance = settings.ssao.minDistance;
|
|
74
|
-
ssaoPass.maxDistance = settings.ssao.maxDistance;
|
|
75
|
-
this.pp_ssao = ssaoPass;
|
|
76
|
-
ssaoPass.output = settings.ssao.debug;
|
|
77
|
-
}
|
|
78
|
-
if (settings.sao.enabled) {
|
|
79
|
-
const saoPass = new SAOPass(scene, camera, size);
|
|
80
|
-
composer.addPass(saoPass);
|
|
81
|
-
saoPass.params.saoBias = settings.sao.saoBias;
|
|
82
|
-
saoPass.params.saoIntensity = settings.sao.saoIntensity;
|
|
83
|
-
saoPass.params.saoScale = settings.sao.saoScale;
|
|
84
|
-
saoPass.params.saoKernelRadius = settings.sao.saoKernelRadius;
|
|
85
|
-
saoPass.params.saoMinResolution = settings.sao.saoMinResolution;
|
|
86
|
-
saoPass.params.saoBlur = settings.sao.saoBlur === 1;
|
|
87
|
-
saoPass.params.saoBlurRadius = settings.sao.saoBlurRadius;
|
|
88
|
-
saoPass.params.saoBlurStdDev = settings.sao.saoBlurStdDev;
|
|
89
|
-
saoPass.params.saoBlurDepthCutoff = settings.sao.saoBlurDepthCutoff;
|
|
90
|
-
this.pp_sao = saoPass;
|
|
91
|
-
saoPass.params.output = settings.sao.debug;
|
|
92
|
-
}
|
|
93
|
-
if (settings.dof.enabled) {
|
|
94
|
-
const bokehPass = new BokehPass(scene, camera, {
|
|
95
|
-
focus: settings.dof.focus,
|
|
96
|
-
aperture: settings.dof.aperture * 0.00001,
|
|
97
|
-
maxblur: settings.dof.maxBlur,
|
|
98
|
-
});
|
|
99
|
-
composer.addPass(bokehPass);
|
|
100
|
-
this.pp_dof = bokehPass;
|
|
101
|
-
}
|
|
102
|
-
if (settings.bloom.enabled) {
|
|
103
|
-
const bloomPass = new UnrealBloomPass(new Vector2(size.x, size.y), settings.bloom.intensity, settings.bloom.radius, settings.bloom.threshold);
|
|
104
|
-
composer.addPass(bloomPass);
|
|
105
|
-
this.pp_bloom = bloomPass;
|
|
106
|
-
}
|
|
107
|
-
if (settings.smaa.enabled) {
|
|
108
|
-
this.pp_smaa = new SMAAPass();
|
|
109
|
-
this.pp_smaa.setSize(this._width, this._height);
|
|
110
|
-
composer.addPass(this.pp_smaa);
|
|
111
|
-
}
|
|
112
|
-
const outputPass = new OutputPass();
|
|
113
|
-
composer.addPass(outputPass);
|
|
114
|
-
this._composer = composer;
|
|
115
|
-
}
|
|
116
|
-
setPixelRatio(scale) {
|
|
117
|
-
// console.log("[PP] setPixelRatio: ", scale);
|
|
118
|
-
this._pixelRatio = scale;
|
|
119
|
-
this._composer.setPixelRatio(scale);
|
|
120
|
-
}
|
|
121
|
-
updateAASamples(value) {
|
|
122
|
-
if (!this._composer)
|
|
123
|
-
return;
|
|
124
|
-
if (this._composer.renderer.getContext() instanceof WebGL2RenderingContext) {
|
|
125
|
-
this._composer.renderTarget1.dispose();
|
|
126
|
-
this._composer.renderTarget1.samples = value;
|
|
127
|
-
this._composer.renderTarget1.setSize(this._width, this._height);
|
|
128
|
-
this._composer.renderTarget2.dispose();
|
|
129
|
-
this._composer.renderTarget2.samples = value;
|
|
130
|
-
this._composer.renderTarget2.setSize(this._width, this._height);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
render() {
|
|
134
|
-
this._composer.render();
|
|
135
|
-
}
|
|
136
|
-
dispose() {
|
|
137
|
-
this.pp_bloom?.dispose();
|
|
138
|
-
this.pp_bloom = null;
|
|
139
|
-
this.pp_dof?.dispose();
|
|
140
|
-
this.pp_dof = null;
|
|
141
|
-
this.pp_ssao?.dispose();
|
|
142
|
-
this.pp_ssao = null;
|
|
143
|
-
this.pp_sao?.dispose();
|
|
144
|
-
this.pp_sao = null;
|
|
145
|
-
this.pp_ssr?.dispose();
|
|
146
|
-
this.pp_ssr = null;
|
|
147
|
-
this._composer?.dispose();
|
|
148
|
-
this._composer = null;
|
|
149
|
-
}
|
|
150
|
-
setSize(x, y) {
|
|
151
|
-
this._width = x;
|
|
152
|
-
this._height = y;
|
|
153
|
-
this._composer?.setSize(this._width, this._height);
|
|
154
|
-
}
|
|
155
|
-
resize(x, y) {
|
|
156
|
-
this._width = x;
|
|
157
|
-
this._height = y;
|
|
158
|
-
if (this._throttle >= 0) {
|
|
159
|
-
// We have a timeout running
|
|
160
|
-
this._delay = true;
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
this._delay = false;
|
|
164
|
-
this._throttle = setTimeout(this.setComposerSize, 250);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
updatePostProcessing(settings, field) {
|
|
168
|
-
let needsResize = false;
|
|
169
|
-
if (field.startsWith("postProcessing.bloom.") && this.pp_bloom !== null) {
|
|
170
|
-
// Bloom
|
|
171
|
-
if (field === "postProcessing.bloom.intensity") {
|
|
172
|
-
this.pp_bloom.strength = settings.bloom.intensity;
|
|
173
|
-
}
|
|
174
|
-
else if (field === "postProcessing.bloom.radius") {
|
|
175
|
-
this.pp_bloom.radius = settings.bloom.radius;
|
|
176
|
-
}
|
|
177
|
-
else if (field === "postProcessing.bloom.threshold") {
|
|
178
|
-
this.pp_bloom.threshold = settings.bloom.threshold;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (field.startsWith("postProcessing.ssao.") && this.pp_ssao !== null) {
|
|
182
|
-
// SSAO
|
|
183
|
-
if (field === "postProcessing.ssao.radius") {
|
|
184
|
-
this.pp_ssao.kernelRadius = settings.ssao.radius;
|
|
185
|
-
}
|
|
186
|
-
else if (field === "postProcessing.ssao.minDistance") {
|
|
187
|
-
this.pp_ssao.minDistance = settings.ssao.minDistance;
|
|
188
|
-
}
|
|
189
|
-
else if (field === "postProcessing.ssao.maxDistance") {
|
|
190
|
-
this.pp_ssao.maxDistance = settings.ssao.maxDistance;
|
|
191
|
-
}
|
|
192
|
-
else if (field === "postProcessing.ssao.debug") {
|
|
193
|
-
this.pp_ssao.output = settings.ssao.debug;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
if (field.startsWith("postProcessing.sao.") && this.pp_sao !== null) {
|
|
197
|
-
// SAO
|
|
198
|
-
if (field === "postProcessing.sao.debug") {
|
|
199
|
-
this.pp_sao.params.output = settings.sao.debug;
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
this.pp_sao.params.saoBias = settings.sao.saoBias;
|
|
203
|
-
this.pp_sao.params.saoBlur = settings.sao.saoBlur == 1;
|
|
204
|
-
this.pp_sao.params.saoBlurDepthCutoff = settings.sao.saoBlurDepthCutoff;
|
|
205
|
-
this.pp_sao.params.saoBlurRadius = settings.sao.saoBlurRadius;
|
|
206
|
-
this.pp_sao.params.saoBlurStdDev = settings.sao.saoBlurStdDev;
|
|
207
|
-
this.pp_sao.params.saoIntensity = settings.sao.saoIntensity;
|
|
208
|
-
this.pp_sao.params.saoKernelRadius = settings.sao.saoKernelRadius;
|
|
209
|
-
this.pp_sao.params.saoMinResolution = settings.sao.saoMinResolution;
|
|
210
|
-
this.pp_sao.params.saoScale = settings.sao.saoScale;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
if (field.startsWith("postProcessing.dof.") && this.pp_dof !== null) {
|
|
214
|
-
// DOF
|
|
215
|
-
this.pp_dof.materialBokeh.uniforms["focus"].value = settings.dof.focus;
|
|
216
|
-
this.pp_dof.materialBokeh.uniforms["aperture"].value =
|
|
217
|
-
settings.dof.aperture * 0.00001;
|
|
218
|
-
this.pp_dof.materialBokeh.uniforms["maxblur"].value =
|
|
219
|
-
settings.dof.maxBlur;
|
|
220
|
-
}
|
|
221
|
-
if (field.startsWith("postProcessing.ssr.")) {
|
|
222
|
-
// SSR
|
|
223
|
-
needsResize = this.updateSSR(settings);
|
|
224
|
-
}
|
|
225
|
-
return needsResize;
|
|
226
|
-
}
|
|
227
|
-
updateSSR(settings) {
|
|
228
|
-
if (!this.pp_ssr)
|
|
229
|
-
return false;
|
|
230
|
-
this.pp_ssr.blur = settings.ssr.blur === 1;
|
|
231
|
-
this.pp_ssr.maxDistance = settings.ssr.maxDistance;
|
|
232
|
-
this.pp_ssr.thickness = settings.ssr.thickness;
|
|
233
|
-
this.pp_ssr.infiniteThick = settings.ssr.infiniteThick === 1;
|
|
234
|
-
this.pp_ssr.opacity = settings.ssr.opacity;
|
|
235
|
-
this.pp_ssr.distanceAttenuation = settings.ssr.distanceAttenuation === 1;
|
|
236
|
-
this.pp_ssr.selects = this.pp_ssr_reflectors;
|
|
237
|
-
this.pp_ssr.output = settings.ssr.debug;
|
|
238
|
-
const needsResize = this.pp_ssr.updateSettings(settings);
|
|
239
|
-
return needsResize;
|
|
240
|
-
}
|
|
241
|
-
addSSRSelectors(objects) {
|
|
242
|
-
if (this.pp_ssr) {
|
|
243
|
-
this.pp_ssr.selects = objects;
|
|
244
|
-
this.pp_ssr_reflectors = objects;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
removeSSRSelectors() {
|
|
248
|
-
if (this.pp_ssr) {
|
|
249
|
-
this.pp_ssr.selects = null;
|
|
250
|
-
this.pp_ssr_reflectors = null;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
setCurrentQuality(quality) {
|
|
254
|
-
// console.log("[PP] setCurrentQuality: ", quality);
|
|
255
|
-
return this.pp_ssr?.setQuality(quality) || false;
|
|
256
|
-
}
|
|
257
|
-
resizeEffects() {
|
|
258
|
-
if (this.pp_ssr) {
|
|
259
|
-
// Force a resize of the buffers
|
|
260
|
-
this.pp_ssr.setSize(this._width, this._height);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
//# sourceMappingURL=ThreeJsPostProcessor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeJsPostProcessor.js","sourceRoot":"","sources":["../../../src/postprocessing/ThreeJsPostProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAEnE,OAAO,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C,CAAC;QACzD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,eAAe,CAAC,OAAe;QAC7B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;YAC9B,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC;QACnC,CAAC;IACH,CAAC;IAED,kBAAkB;QAChB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;YAC3B,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAChC,CAAC;IACH,CAAC;IAED,iBAAiB,CAAC,OAAe;QACnC,uDAAuD;QACnD,OAAO,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC;IACnD,CAAC;IAED,aAAa;QACX,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,gCAAgC;YAChC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IColliderObject } from "@p100-web/core";
|
|
2
|
-
import PCollider from "../pcomponents/PCollider";
|
|
3
|
-
import { Box3, Object3D, Raycaster, Sphere } from "three";
|
|
4
|
-
export default class ColliderObject3D extends Object3D implements IColliderObject {
|
|
5
|
-
boundingBox: Box3 | null;
|
|
6
|
-
boundingSphere: Sphere | null;
|
|
7
|
-
private raycastBox;
|
|
8
|
-
private raycastSphere;
|
|
9
|
-
collider: PCollider | null;
|
|
10
|
-
constructor(collider: PCollider);
|
|
11
|
-
show(): void;
|
|
12
|
-
hide(): void;
|
|
13
|
-
computeBounds(): void;
|
|
14
|
-
computeBoundingBox(): void;
|
|
15
|
-
computeBoundingSphere(): void;
|
|
16
|
-
dispose(): void;
|
|
17
|
-
raycast(raycaster: Raycaster, intersects: any): null | undefined;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=ColliderObject3D.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColliderObject3D.d.ts","sourceRoot":"","sources":["../../../src/three/ColliderObject3D.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,EACL,IAAI,EAEJ,QAAQ,EAER,SAAS,EACT,MAAM,EAEP,MAAM,OAAO,CAAC;AAQf,MAAM,CAAC,OAAO,OAAO,gBACnB,SAAQ,QACR,YAAW,eAAe;IAE1B,WAAW,EAAE,IAAI,GAAG,IAAI,CAAQ;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAQ;IAErC,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,aAAa,CAAiB;IAEtC,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAC;gBAEf,QAAQ,EAAE,SAAS;IAM/B,IAAI,IAAI,IAAI;IAMZ,IAAI,IAAI,IAAI;IAIZ,aAAa;IAab,kBAAkB;IAqClB,qBAAqB;IAyBrB,OAAO;IAIP,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG;CAsD9C"}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Box3, Matrix4, Object3D, Ray, Sphere, Vector3, } from "three";
|
|
2
|
-
const _ray = new Ray();
|
|
3
|
-
const _sphere = new Sphere();
|
|
4
|
-
const _sphereHitAt = new Vector3();
|
|
5
|
-
const _worldPosition = new Vector3();
|
|
6
|
-
const _inverseMatrix = new Matrix4();
|
|
7
|
-
export default class ColliderObject3D extends Object3D {
|
|
8
|
-
constructor(collider) {
|
|
9
|
-
super();
|
|
10
|
-
this.boundingBox = null;
|
|
11
|
-
this.boundingSphere = null;
|
|
12
|
-
this.raycastBox = true;
|
|
13
|
-
this.raycastSphere = true;
|
|
14
|
-
this.collider = collider;
|
|
15
|
-
this.layers.mask = 2;
|
|
16
|
-
}
|
|
17
|
-
show() {
|
|
18
|
-
if (this.collider) {
|
|
19
|
-
this.layers.mask = this.collider.hidden ? 2 : 3;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
hide() {
|
|
23
|
-
this.layers.mask = 0;
|
|
24
|
-
}
|
|
25
|
-
computeBounds() {
|
|
26
|
-
if (this.collider) {
|
|
27
|
-
this.raycastBox = this.collider.box;
|
|
28
|
-
this.raycastSphere = this.collider.sphere;
|
|
29
|
-
}
|
|
30
|
-
this.boundingBox = null;
|
|
31
|
-
this.boundingSphere = null;
|
|
32
|
-
this.computeBoundingBox();
|
|
33
|
-
this.computeBoundingSphere();
|
|
34
|
-
}
|
|
35
|
-
computeBoundingBox() {
|
|
36
|
-
if (!this.collider)
|
|
37
|
-
return;
|
|
38
|
-
if (this.collider.autoSize) {
|
|
39
|
-
if (this.parent === null)
|
|
40
|
-
return;
|
|
41
|
-
const parent = this.parent;
|
|
42
|
-
if (parent !== null && parent.isMesh && parent.geometry) {
|
|
43
|
-
if (parent.geometry.boundingBox === null) {
|
|
44
|
-
parent.geometry.computeBoundingBox();
|
|
45
|
-
}
|
|
46
|
-
this.boundingBox = parent.geometry.boundingBox;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
const box = new Box3();
|
|
50
|
-
for (const child of parent.children) {
|
|
51
|
-
if (child === this)
|
|
52
|
-
continue;
|
|
53
|
-
child.traverse((c) => {
|
|
54
|
-
if (c.isMesh && c.geometry) {
|
|
55
|
-
if (c.geometry.boundingBox === null) {
|
|
56
|
-
c.geometry.computeBoundingBox();
|
|
57
|
-
}
|
|
58
|
-
box.union(c.geometry.boundingBox);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
this.boundingBox = box;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
const size = this.collider.box_size;
|
|
67
|
-
const box = new Box3(new Vector3(size.x * -0.5, size.y * -0.5, size.z * -0.5), new Vector3(size.x * 0.5, size.y * 0.5, size.z * 0.5));
|
|
68
|
-
this.boundingBox = box;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
computeBoundingSphere() {
|
|
72
|
-
if (!this.collider)
|
|
73
|
-
return;
|
|
74
|
-
if (this.collider.autoSize) {
|
|
75
|
-
const center = new Vector3();
|
|
76
|
-
const sphere = new Sphere();
|
|
77
|
-
if (this.boundingBox === null) {
|
|
78
|
-
console.error("No bounding box");
|
|
79
|
-
sphere.radius = 1;
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
this.boundingBox.getCenter(center);
|
|
83
|
-
const width = this.boundingBox.max.x - this.boundingBox.min.x;
|
|
84
|
-
const height = this.boundingBox.max.y - this.boundingBox.min.y;
|
|
85
|
-
const depth = this.boundingBox.max.z - this.boundingBox.min.z;
|
|
86
|
-
const radius = Math.max(width, height, depth) * 0.5;
|
|
87
|
-
sphere.center = center;
|
|
88
|
-
sphere.radius = radius;
|
|
89
|
-
this.boundingSphere = sphere;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
const sphere = new Sphere();
|
|
93
|
-
sphere.radius = this.collider.sphere_radius;
|
|
94
|
-
this.boundingSphere = sphere;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
dispose() {
|
|
98
|
-
this.collider = null;
|
|
99
|
-
}
|
|
100
|
-
raycast(raycaster, intersects) {
|
|
101
|
-
const matrixWorld = this.matrixWorld;
|
|
102
|
-
if (this.boundingSphere === null) {
|
|
103
|
-
console.error("Missing bounding sphere");
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
_sphere.copy(this.boundingSphere);
|
|
107
|
-
_sphere.applyMatrix4(matrixWorld);
|
|
108
|
-
// check distance from ray origin to bounding sphere
|
|
109
|
-
_ray.copy(raycaster.ray).recast(raycaster.near);
|
|
110
|
-
if (this.raycastSphere && _sphere.containsPoint(_ray.origin) === false) {
|
|
111
|
-
if (_ray.intersectSphere(_sphere, _sphereHitAt) === null)
|
|
112
|
-
return;
|
|
113
|
-
if (_ray.origin.distanceToSquared(_sphereHitAt) >
|
|
114
|
-
(raycaster.far - raycaster.near) ** 2)
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
this.getWorldPosition(_worldPosition);
|
|
118
|
-
const distance = raycaster.ray.origin.distanceTo(_worldPosition);
|
|
119
|
-
if (this.raycastBox === false) {
|
|
120
|
-
if (this.raycastSphere) {
|
|
121
|
-
intersects.push({
|
|
122
|
-
distance: distance,
|
|
123
|
-
point: _worldPosition,
|
|
124
|
-
object: this,
|
|
125
|
-
});
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
// convert ray to local space of mesh
|
|
130
|
-
_inverseMatrix.copy(matrixWorld).invert();
|
|
131
|
-
_ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);
|
|
132
|
-
// test with bounding box in local space
|
|
133
|
-
if (this.boundingBox !== null) {
|
|
134
|
-
if (_ray.intersectsBox(this.boundingBox) === false)
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (distance < raycaster.near || distance > raycaster.far)
|
|
138
|
-
return null;
|
|
139
|
-
intersects.push({
|
|
140
|
-
distance: distance,
|
|
141
|
-
point: _worldPosition,
|
|
142
|
-
object: this,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
//# sourceMappingURL=ColliderObject3D.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColliderObject3D.js","sourceRoot":"","sources":["../../../src/three/ColliderObject3D.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,GAAG,EAEH,MAAM,EACN,OAAO,GACR,MAAM,OAAO,CAAC;AAEf,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;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