@babylonjs/core 7.51.2 → 7.52.0
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/Audio/Interfaces/IAudioEngineOptions.d.ts +2 -0
- package/Audio/Interfaces/IAudioEngineOptions.js.map +1 -1
- package/AudioV2/abstractAudio/abstractAudioBus.d.ts +22 -0
- package/AudioV2/abstractAudio/abstractAudioBus.js +35 -0
- package/AudioV2/abstractAudio/abstractAudioBus.js.map +1 -0
- package/AudioV2/abstractAudio/abstractAudioNode.d.ts +99 -0
- package/AudioV2/abstractAudio/abstractAudioNode.js +149 -0
- package/AudioV2/abstractAudio/abstractAudioNode.js.map +1 -0
- package/AudioV2/abstractAudio/abstractSound.d.ts +152 -0
- package/AudioV2/abstractAudio/abstractSound.js +202 -0
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -0
- package/AudioV2/abstractAudio/abstractSoundInstance.d.ts +34 -0
- package/AudioV2/abstractAudio/abstractSoundInstance.js +35 -0
- package/AudioV2/abstractAudio/abstractSoundInstance.js.map +1 -0
- package/AudioV2/abstractAudio/audioBus.d.ts +48 -0
- package/AudioV2/abstractAudio/audioBus.js +53 -0
- package/AudioV2/abstractAudio/audioBus.js.map +1 -0
- package/AudioV2/abstractAudio/audioEngineV2.d.ts +193 -0
- package/AudioV2/abstractAudio/audioEngineV2.js +155 -0
- package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -0
- package/AudioV2/abstractAudio/index.d.ts +10 -0
- package/AudioV2/abstractAudio/index.js +12 -0
- package/AudioV2/abstractAudio/index.js.map +1 -0
- package/AudioV2/abstractAudio/mainAudioBus.d.ts +22 -0
- package/AudioV2/abstractAudio/mainAudioBus.js +18 -0
- package/AudioV2/abstractAudio/mainAudioBus.js.map +1 -0
- package/AudioV2/abstractAudio/mainAudioOut.d.ts +13 -0
- package/AudioV2/abstractAudio/mainAudioOut.js +15 -0
- package/AudioV2/abstractAudio/mainAudioOut.js.map +1 -0
- package/AudioV2/abstractAudio/staticSound.d.ts +134 -0
- package/AudioV2/abstractAudio/staticSound.js +113 -0
- package/AudioV2/abstractAudio/staticSound.js.map +1 -0
- package/AudioV2/abstractAudio/staticSoundBuffer.d.ts +46 -0
- package/AudioV2/abstractAudio/staticSoundBuffer.js +17 -0
- package/AudioV2/abstractAudio/staticSoundBuffer.js.map +1 -0
- package/AudioV2/abstractAudio/staticSoundInstance.d.ts +15 -0
- package/AudioV2/abstractAudio/staticSoundInstance.js +5 -0
- package/AudioV2/abstractAudio/staticSoundInstance.js.map +1 -0
- package/AudioV2/abstractAudio/streamingSound.d.ts +77 -0
- package/AudioV2/abstractAudio/streamingSound.js +109 -0
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -0
- package/AudioV2/abstractAudio/streamingSoundInstance.d.ts +25 -0
- package/AudioV2/abstractAudio/streamingSoundInstance.js +29 -0
- package/AudioV2/abstractAudio/streamingSoundInstance.js.map +1 -0
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +53 -0
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +97 -0
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -0
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubNode.d.ts +13 -0
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubNode.js +33 -0
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubNode.js.map +1 -0
- package/AudioV2/abstractAudio/subNodes/audioSubNode.d.ts +6 -0
- package/AudioV2/abstractAudio/subNodes/audioSubNode.js +8 -0
- package/AudioV2/abstractAudio/subNodes/audioSubNode.js.map +1 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +31 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +46 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -0
- package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.d.ts +19 -0
- package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.js +27 -0
- package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.js.map +1 -0
- package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.d.ts +28 -0
- package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js +24 -0
- package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +187 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +41 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +59 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js +21 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/abstractStereoAudio.d.ts +38 -0
- package/AudioV2/abstractAudio/subProperties/abstractStereoAudio.js +18 -0
- package/AudioV2/abstractAudio/subProperties/abstractStereoAudio.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/index.d.ts +3 -0
- package/AudioV2/abstractAudio/subProperties/index.js +4 -0
- package/AudioV2/abstractAudio/subProperties/index.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +49 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +129 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.d.ts +9 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js +22 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/stereoAudio.d.ts +11 -0
- package/AudioV2/abstractAudio/subProperties/stereoAudio.js +18 -0
- package/AudioV2/abstractAudio/subProperties/stereoAudio.js.map +1 -0
- package/AudioV2/audioUtils.d.ts +3 -0
- package/AudioV2/audioUtils.js +6 -0
- package/AudioV2/audioUtils.js.map +1 -0
- package/AudioV2/index.d.ts +3 -0
- package/AudioV2/index.js +5 -0
- package/AudioV2/index.js.map +1 -0
- package/AudioV2/soundState.d.ts +29 -0
- package/AudioV2/soundState.js +31 -0
- package/AudioV2/soundState.js.map +1 -0
- package/AudioV2/webAudio/index.d.ts +5 -0
- package/AudioV2/webAudio/index.js +6 -0
- package/AudioV2/webAudio/index.js.map +1 -0
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +59 -0
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +156 -0
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -0
- package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.d.ts +24 -0
- package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.js +55 -0
- package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.js.map +1 -0
- package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.d.ts +24 -0
- package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.js +55 -0
- package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.js.map +1 -0
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.d.ts +26 -0
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js +54 -0
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js.map +1 -0
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.d.ts +21 -0
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +112 -0
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -0
- package/AudioV2/webAudio/subProperties/spatialWebAudio.d.ts +10 -0
- package/AudioV2/webAudio/subProperties/spatialWebAudio.js +26 -0
- package/AudioV2/webAudio/subProperties/spatialWebAudio.js.map +1 -0
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.d.ts +4 -0
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +108 -0
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -0
- package/AudioV2/webAudio/webAudioBus.d.ts +35 -0
- package/AudioV2/webAudio/webAudioBus.js +63 -0
- package/AudioV2/webAudio/webAudioBus.js.map +1 -0
- package/AudioV2/webAudio/webAudioEngine.d.ts +110 -0
- package/AudioV2/webAudio/webAudioEngine.js +227 -0
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -0
- package/AudioV2/webAudio/webAudioMainBus.d.ts +29 -0
- package/AudioV2/webAudio/webAudioMainBus.js +64 -0
- package/AudioV2/webAudio/webAudioMainBus.js.map +1 -0
- package/AudioV2/webAudio/webAudioMainOut.d.ts +20 -0
- package/AudioV2/webAudio/webAudioMainOut.js +35 -0
- package/AudioV2/webAudio/webAudioMainOut.js.map +1 -0
- package/AudioV2/webAudio/webAudioNode.d.ts +24 -0
- package/AudioV2/webAudio/webAudioNode.js +2 -0
- package/AudioV2/webAudio/webAudioNode.js.map +1 -0
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +106 -0
- package/AudioV2/webAudio/webAudioStaticSound.js +368 -0
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -0
- package/AudioV2/webAudio/webAudioStreamingSound.d.ts +94 -0
- package/AudioV2/webAudio/webAudioStreamingSound.js +358 -0
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -0
- package/Engines/ICanvas.d.ts +96 -1
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +7 -1
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +3 -3
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +11 -1
- package/Engines/abstractEngine.js +12 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.common.js +0 -4
- package/Engines/engine.common.js.map +1 -1
- package/Engines/engine.d.ts +0 -1
- package/Engines/engine.js +0 -1
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +7 -1
- package/Engines/nativeEngine.js +12 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.d.ts +5 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +16 -5
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js.map +1 -1
- package/Layers/effectLayer.d.ts +5 -0
- package/Layers/effectLayer.js +7 -0
- package/Layers/effectLayer.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +33 -20
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Loading/sceneLoader.d.ts +25 -11
- package/Loading/sceneLoader.js +28 -11
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js +4 -1
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/material.js +1 -0
- package/Materials/material.js.map +1 -1
- package/Meshes/csg2.d.ts +2 -2
- package/Meshes/csg2.js +2 -2
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/geometry.js +7 -15
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +5 -0
- package/Meshes/instancedMesh.js +6 -0
- package/Meshes/instancedMesh.js.map +1 -1
- package/Misc/environmentTextureTools.js +2 -2
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +26 -18
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
- package/Shaders/ShadersInclude/shadowMapFragment.js +1 -0
- package/Shaders/ShadersInclude/shadowMapFragment.js.map +1 -1
- package/Shaders/iblCdfDebug.fragment.js +2 -2
- package/Shaders/iblCdfDebug.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.js +1 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.js.map +1 -1
- package/ShadersWGSL/iblCdfDebug.fragment.js +2 -2
- package/ShadersWGSL/iblCdfDebug.fragment.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +8 -0
- package/scene.js.map +1 -1
|
@@ -77,6 +77,10 @@ export declare class FlowGraphMatrixDecomposeBlock extends FlowGraphBlock {
|
|
|
77
77
|
* The scaling output of this block
|
|
78
78
|
*/
|
|
79
79
|
readonly scaling: FlowGraphDataConnection<Vector3>;
|
|
80
|
+
/**
|
|
81
|
+
* Is the matrix valid
|
|
82
|
+
*/
|
|
83
|
+
readonly isValid: FlowGraphDataConnection<boolean>;
|
|
80
84
|
constructor(config?: IFlowGraphBlockConfiguration);
|
|
81
85
|
_updateOutputs(context: FlowGraphContext): void;
|
|
82
86
|
getClassName(): string;
|
|
@@ -100,7 +104,7 @@ export declare class FlowGraphMatrixComposeBlock extends FlowGraphBlock {
|
|
|
100
104
|
/**
|
|
101
105
|
* The output of this block
|
|
102
106
|
*/
|
|
103
|
-
readonly
|
|
107
|
+
readonly value: FlowGraphDataConnection<Matrix>;
|
|
104
108
|
constructor(config?: IFlowGraphBlockConfiguration);
|
|
105
109
|
_updateOutputs(context: FlowGraphContext): void;
|
|
106
110
|
getClassName(): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlowGraphBlock } from "../../../flowGraphBlock.js";
|
|
2
|
-
import { getRichTypeByFlowGraphType, RichTypeMatrix, RichTypeNumber, RichTypeQuaternion, RichTypeVector3 } from "../../../flowGraphRichTypes.js";
|
|
2
|
+
import { getRichTypeByFlowGraphType, RichTypeBoolean, RichTypeMatrix, RichTypeNumber, RichTypeQuaternion, RichTypeVector3, } from "../../../flowGraphRichTypes.js";
|
|
3
3
|
import { Matrix, Quaternion, Vector3 } from "../../../../Maths/math.vector.js";
|
|
4
4
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
5
5
|
import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock.js";
|
|
@@ -67,6 +67,7 @@ export class FlowGraphMatrixDecomposeBlock extends FlowGraphBlock {
|
|
|
67
67
|
this.position = this.registerDataOutput("position", RichTypeVector3);
|
|
68
68
|
this.rotationQuaternion = this.registerDataOutput("rotationQuaternion", RichTypeQuaternion);
|
|
69
69
|
this.scaling = this.registerDataOutput("scaling", RichTypeVector3);
|
|
70
|
+
this.isValid = this.registerDataOutput("isValid", RichTypeBoolean, false);
|
|
70
71
|
}
|
|
71
72
|
_updateOutputs(context) {
|
|
72
73
|
const cachedExecutionId = context._getExecutionVariable(this, "executionId", -1);
|
|
@@ -83,7 +84,17 @@ export class FlowGraphMatrixDecomposeBlock extends FlowGraphBlock {
|
|
|
83
84
|
const position = cachedPosition || new Vector3();
|
|
84
85
|
const rotation = cachedRotation || new Quaternion();
|
|
85
86
|
const scaling = cachedScaling || new Vector3();
|
|
86
|
-
matrix
|
|
87
|
+
// check matrix last column components should be 0,0,0,1
|
|
88
|
+
if (matrix.m[3] !== 0 || matrix.m[7] !== 0 || matrix.m[11] !== 0 || matrix.m[15] !== 1) {
|
|
89
|
+
this.isValid.setValue(false, context);
|
|
90
|
+
this.position.setValue(Vector3.Zero(), context);
|
|
91
|
+
this.rotationQuaternion.setValue(Quaternion.Identity(), context);
|
|
92
|
+
this.scaling.setValue(Vector3.One(), context);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// make the checks for validity
|
|
96
|
+
const valid = matrix.decompose(scaling, rotation, position);
|
|
97
|
+
this.isValid.setValue(valid, context);
|
|
87
98
|
this.position.setValue(position, context);
|
|
88
99
|
this.rotationQuaternion.setValue(rotation, context);
|
|
89
100
|
this.scaling.setValue(scaling, context);
|
|
@@ -107,17 +118,17 @@ export class FlowGraphMatrixComposeBlock extends FlowGraphBlock {
|
|
|
107
118
|
this.position = this.registerDataInput("position", RichTypeVector3);
|
|
108
119
|
this.rotationQuaternion = this.registerDataInput("rotationQuaternion", RichTypeQuaternion);
|
|
109
120
|
this.scaling = this.registerDataInput("scaling", RichTypeVector3);
|
|
110
|
-
this.
|
|
121
|
+
this.value = this.registerDataOutput("value", RichTypeMatrix);
|
|
111
122
|
}
|
|
112
123
|
_updateOutputs(context) {
|
|
113
124
|
const cachedExecutionId = context._getExecutionVariable(this, "executionId", -1);
|
|
114
125
|
const cachedMatrix = context._getExecutionVariable(this, "cachedMatrix", null);
|
|
115
126
|
if (cachedExecutionId === context.executionId && cachedMatrix) {
|
|
116
|
-
this.
|
|
127
|
+
this.value.setValue(cachedMatrix, context);
|
|
117
128
|
}
|
|
118
129
|
else {
|
|
119
130
|
const matrix = Matrix.Compose(this.scaling.getValue(context), this.rotationQuaternion.getValue(context), this.position.getValue(context));
|
|
120
|
-
this.
|
|
131
|
+
this.value.setValue(matrix, context);
|
|
121
132
|
context._setExecutionVariable(this, "cachedMatrix", matrix);
|
|
122
133
|
context._setExecutionVariable(this, "executionId", context.executionId);
|
|
123
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphMatrixMathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mCAAsC;AAG/D,OAAO,EAAkB,0BAA0B,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,uCAA0C;AACpK,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,yCAA+B;AAErE,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAYjF;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,4BAA8D;IACvG;;;OAGG;IACH,YAAY,MAA2C;QACnD,KAAK,CACD,0BAA0B,CAAC,MAAM,EAAE,UAAU,wCAAyB,CAAC,EAC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AE,MAAM,CAAC,CAAC;YAC5D,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAC5E,CAAC;IACL,CAAC;IAEe,YAAY;QACxB,wEAAyC;IAC7C,CAAC;CACJ;AAED,aAAa,mEAAoC,2BAA2B,CAAC,CAAC","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport type { FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { FlowGraphTypes, getRichTypeByFlowGraphType, RichTypeMatrix, RichTypeNumber, RichTypeQuaternion, RichTypeVector3 } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { Matrix, Quaternion, Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport type { FlowGraphMatrix2D } from \"core/FlowGraph/CustomTypes/flowGraphMatrix\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport type { FlowGraphMatrix } from \"core/FlowGraph/utils\";\n\n/**\n * Configuration for the matrix blocks.\n */\nexport interface IFlowGraphMatrixBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The type of the matrix. Default is Matrix (which is 4x4)\n */\n matrixType: FlowGraphTypes;\n}\n/**\n * Transposes a matrix.\n */\nexport class FlowGraphTransposeBlock extends FlowGraphUnaryOperationBlock<FlowGraphMatrix, FlowGraphMatrix> {\n /**\n * Creates a new instance of the block.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n (a) => (a.transpose ? a.transpose() : Matrix.Transpose(a as Matrix)),\n FlowGraphBlockNames.Transpose,\n config\n );\n }\n}\nRegisterClass(FlowGraphBlockNames.Transpose, FlowGraphTransposeBlock);\n\n/**\n * Gets the determinant of a matrix.\n */\nexport class FlowGraphDeterminantBlock extends FlowGraphUnaryOperationBlock<FlowGraphMatrix, number> {\n /**\n * Creates a new instance of the block.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix), RichTypeNumber, (a) => a.determinant(), FlowGraphBlockNames.Determinant, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Determinant, FlowGraphDeterminantBlock);\n\n/**\n * Inverts a matrix.\n */\nexport class FlowGraphInvertMatrixBlock extends FlowGraphUnaryOperationBlock<FlowGraphMatrix, FlowGraphMatrix> {\n /**\n * Creates a new instance of the inverse block.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n (a) => ((a as FlowGraphMatrix2D).inverse ? (a as FlowGraphMatrix2D).inverse() : Matrix.Invert(a as Matrix)),\n FlowGraphBlockNames.InvertMatrix,\n config\n );\n }\n}\nRegisterClass(FlowGraphBlockNames.InvertMatrix, FlowGraphInvertMatrixBlock);\n\n/**\n * Multiplies two matrices.\n */\nexport class FlowGraphMatrixMultiplicationBlock extends FlowGraphBinaryOperationBlock<FlowGraphMatrix, FlowGraphMatrix, FlowGraphMatrix> {\n /**\n * Creates a new instance of the multiplication block.\n * Note - this is similar to the math multiplication if not using matrix per-component multiplication.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n (a, b) => a.multiply(b as any),\n FlowGraphBlockNames.MatrixMultiplication,\n config\n );\n }\n}\nRegisterClass(FlowGraphBlockNames.MatrixMultiplication, FlowGraphMatrixMultiplicationBlock);\n\n/**\n * Matrix decompose block\n */\nexport class FlowGraphMatrixDecomposeBlock extends FlowGraphBlock {\n /**\n * The input of this block\n */\n public readonly input: FlowGraphDataConnection<Matrix>;\n\n /**\n * The position output of this block\n */\n public readonly position: FlowGraphDataConnection<Vector3>;\n /**\n * The rotation output of this block\n */\n public readonly rotationQuaternion: FlowGraphDataConnection<Quaternion>;\n /**\n * The scaling output of this block\n */\n public readonly scaling: FlowGraphDataConnection<Vector3>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.input = this.registerDataInput(\"input\", RichTypeMatrix);\n this.position = this.registerDataOutput(\"position\", RichTypeVector3);\n this.rotationQuaternion = this.registerDataOutput(\"rotationQuaternion\", RichTypeQuaternion);\n this.scaling = this.registerDataOutput(\"scaling\", RichTypeVector3);\n }\n\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, \"executionId\", -1);\n const cachedPosition = context._getExecutionVariable(this, \"cachedPosition\", null);\n const cachedRotation = context._getExecutionVariable(this, \"cachedRotation\", null);\n const cachedScaling = context._getExecutionVariable(this, \"cachedScaling\", null);\n if (cachedExecutionId === context.executionId && cachedPosition && cachedRotation && cachedScaling) {\n this.position.setValue(cachedPosition, context);\n this.rotationQuaternion.setValue(cachedRotation, context);\n this.scaling.setValue(cachedScaling, context);\n } else {\n const matrix = this.input.getValue(context);\n const position = cachedPosition || new Vector3();\n const rotation = cachedRotation || new Quaternion();\n const scaling = cachedScaling || new Vector3();\n matrix.decompose(scaling, rotation, position);\n this.position.setValue(position, context);\n this.rotationQuaternion.setValue(rotation, context);\n this.scaling.setValue(scaling, context);\n context._setExecutionVariable(this, \"cachedPosition\", position);\n context._setExecutionVariable(this, \"cachedRotation\", rotation);\n context._setExecutionVariable(this, \"cachedScaling\", scaling);\n context._setExecutionVariable(this, \"executionId\", context.executionId);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.MatrixDecompose;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.MatrixDecompose, FlowGraphMatrixDecomposeBlock);\n\n/**\n * Matrix compose block\n */\nexport class FlowGraphMatrixComposeBlock extends FlowGraphBlock {\n /**\n * The position input of this block\n */\n public readonly position: FlowGraphDataConnection<Vector3>;\n /**\n * The rotation input of this block\n */\n public readonly rotationQuaternion: FlowGraphDataConnection<Quaternion>;\n /**\n * The scaling input of this block\n */\n public readonly scaling: FlowGraphDataConnection<Vector3>;\n /**\n * The output of this block\n */\n public readonly output: FlowGraphDataConnection<Matrix>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.position = this.registerDataInput(\"position\", RichTypeVector3);\n this.rotationQuaternion = this.registerDataInput(\"rotationQuaternion\", RichTypeQuaternion);\n this.scaling = this.registerDataInput(\"scaling\", RichTypeVector3);\n this.output = this.registerDataOutput(\"output\", RichTypeMatrix);\n }\n\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, \"executionId\", -1);\n const cachedMatrix = context._getExecutionVariable(this, \"cachedMatrix\", null);\n if (cachedExecutionId === context.executionId && cachedMatrix) {\n this.output.setValue(cachedMatrix, context);\n } else {\n const matrix = Matrix.Compose(this.scaling.getValue(context), this.rotationQuaternion.getValue(context), this.position.getValue(context));\n this.output.setValue(matrix, context);\n context._setExecutionVariable(this, \"cachedMatrix\", matrix);\n context._setExecutionVariable(this, \"executionId\", context.executionId);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.MatrixCompose;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.MatrixCompose, FlowGraphMatrixComposeBlock);\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphMatrixMathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mCAAsC;AAG/D,OAAO,EAEH,0BAA0B,EAC1B,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,GAClB,uCAA0C;AAC3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,yCAA+B;AAErE,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAYjF;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,4BAA8D;IACvG;;;OAGG;IACH,YAAY,MAA2C;QACnD,KAAK,CACD,0BAA0B,CAAC,MAAM,EAAE,UAAU,wCAAyB,CAAC,EACvE,0BAA0B,CAAC,MAAM,EAAE,UAAU,wCAAyB,CAAC,EACvE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAW,CAAC,CAAC,iEAEpE,MAAM,CACT,CAAC;IACN,CAAC;CACJ;AACD,aAAa,gEAAgC,uBAAuB,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,4BAAqD;IAChG;;;OAGG;IACH,YAAY,MAA2C;QACnD,KAAK,CAAC,0BAA0B,CAAC,MAAM,EAAE,UAAU,wCAAyB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,qEAAmC,MAAM,CAAC,CAAC;IACpK,CAAC;CACJ;AACD,aAAa,oEAAkC,yBAAyB,CAAC,C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C,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YAC1I,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACrC,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;YAC5D,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAC5E,CAAC;IACL,CAAC;IAEe,YAAY;QACxB,wEAAyC;IAC7C,CAAC;CACJ;AAED,aAAa,mEAAoC,2BAA2B,CAAC,CAAC","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport type { FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport {\n FlowGraphTypes,\n getRichTypeByFlowGraphType,\n RichTypeBoolean,\n RichTypeMatrix,\n RichTypeNumber,\n RichTypeQuaternion,\n RichTypeVector3,\n} from \"core/FlowGraph/flowGraphRichTypes\";\nimport { Matrix, Quaternion, Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport type { FlowGraphMatrix2D } from \"core/FlowGraph/CustomTypes/flowGraphMatrix\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport type { FlowGraphMatrix } from \"core/FlowGraph/utils\";\n\n/**\n * Configuration for the matrix blocks.\n */\nexport interface IFlowGraphMatrixBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The type of the matrix. Default is Matrix (which is 4x4)\n */\n matrixType: FlowGraphTypes;\n}\n/**\n * Transposes a matrix.\n */\nexport class FlowGraphTransposeBlock extends FlowGraphUnaryOperationBlock<FlowGraphMatrix, FlowGraphMatrix> {\n /**\n * Creates a new instance of the block.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n (a) => (a.transpose ? a.transpose() : Matrix.Transpose(a as Matrix)),\n FlowGraphBlockNames.Transpose,\n config\n );\n }\n}\nRegisterClass(FlowGraphBlockNames.Transpose, FlowGraphTransposeBlock);\n\n/**\n * Gets the determinant of a matrix.\n */\nexport class FlowGraphDeterminantBlock extends FlowGraphUnaryOperationBlock<FlowGraphMatrix, number> {\n /**\n * Creates a new instance of the block.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix), RichTypeNumber, (a) => a.determinant(), FlowGraphBlockNames.Determinant, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Determinant, FlowGraphDeterminantBlock);\n\n/**\n * Inverts a matrix.\n */\nexport class FlowGraphInvertMatrixBlock extends FlowGraphUnaryOperationBlock<FlowGraphMatrix, FlowGraphMatrix> {\n /**\n * Creates a new instance of the inverse block.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n (a) => ((a as FlowGraphMatrix2D).inverse ? (a as FlowGraphMatrix2D).inverse() : Matrix.Invert(a as Matrix)),\n FlowGraphBlockNames.InvertMatrix,\n config\n );\n }\n}\nRegisterClass(FlowGraphBlockNames.InvertMatrix, FlowGraphInvertMatrixBlock);\n\n/**\n * Multiplies two matrices.\n */\nexport class FlowGraphMatrixMultiplicationBlock extends FlowGraphBinaryOperationBlock<FlowGraphMatrix, FlowGraphMatrix, FlowGraphMatrix> {\n /**\n * Creates a new instance of the multiplication block.\n * Note - this is similar to the math multiplication if not using matrix per-component multiplication.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n (a, b) => a.multiply(b as any),\n FlowGraphBlockNames.MatrixMultiplication,\n config\n );\n }\n}\nRegisterClass(FlowGraphBlockNames.MatrixMultiplication, FlowGraphMatrixMultiplicationBlock);\n\n/**\n * Matrix decompose block\n */\nexport class FlowGraphMatrixDecomposeBlock extends FlowGraphBlock {\n /**\n * The input of this block\n */\n public readonly input: FlowGraphDataConnection<Matrix>;\n\n /**\n * The position output of this block\n */\n public readonly position: FlowGraphDataConnection<Vector3>;\n /**\n * The rotation output of this block\n */\n public readonly rotationQuaternion: FlowGraphDataConnection<Quaternion>;\n /**\n * The scaling output of this block\n */\n public readonly scaling: FlowGraphDataConnection<Vector3>;\n\n /**\n * Is the matrix valid\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.input = this.registerDataInput(\"input\", RichTypeMatrix);\n this.position = this.registerDataOutput(\"position\", RichTypeVector3);\n this.rotationQuaternion = this.registerDataOutput(\"rotationQuaternion\", RichTypeQuaternion);\n this.scaling = this.registerDataOutput(\"scaling\", RichTypeVector3);\n this.isValid = this.registerDataOutput(\"isValid\", RichTypeBoolean, false);\n }\n\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, \"executionId\", -1);\n const cachedPosition = context._getExecutionVariable(this, \"cachedPosition\", null);\n const cachedRotation = context._getExecutionVariable(this, \"cachedRotation\", null);\n const cachedScaling = context._getExecutionVariable(this, \"cachedScaling\", null);\n if (cachedExecutionId === context.executionId && cachedPosition && cachedRotation && cachedScaling) {\n this.position.setValue(cachedPosition, context);\n this.rotationQuaternion.setValue(cachedRotation, context);\n this.scaling.setValue(cachedScaling, context);\n } else {\n const matrix = this.input.getValue(context);\n const position = cachedPosition || new Vector3();\n const rotation = cachedRotation || new Quaternion();\n const scaling = cachedScaling || new Vector3();\n // check matrix last column components should be 0,0,0,1\n if (matrix.m[3] !== 0 || matrix.m[7] !== 0 || matrix.m[11] !== 0 || matrix.m[15] !== 1) {\n this.isValid.setValue(false, context);\n this.position.setValue(Vector3.Zero(), context);\n this.rotationQuaternion.setValue(Quaternion.Identity(), context);\n this.scaling.setValue(Vector3.One(), context);\n return;\n }\n // make the checks for validity\n const valid = matrix.decompose(scaling, rotation, position);\n this.isValid.setValue(valid, context);\n this.position.setValue(position, context);\n this.rotationQuaternion.setValue(rotation, context);\n this.scaling.setValue(scaling, context);\n context._setExecutionVariable(this, \"cachedPosition\", position);\n context._setExecutionVariable(this, \"cachedRotation\", rotation);\n context._setExecutionVariable(this, \"cachedScaling\", scaling);\n context._setExecutionVariable(this, \"executionId\", context.executionId);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.MatrixDecompose;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.MatrixDecompose, FlowGraphMatrixDecomposeBlock);\n\n/**\n * Matrix compose block\n */\nexport class FlowGraphMatrixComposeBlock extends FlowGraphBlock {\n /**\n * The position input of this block\n */\n public readonly position: FlowGraphDataConnection<Vector3>;\n /**\n * The rotation input of this block\n */\n public readonly rotationQuaternion: FlowGraphDataConnection<Quaternion>;\n /**\n * The scaling input of this block\n */\n public readonly scaling: FlowGraphDataConnection<Vector3>;\n /**\n * The output of this block\n */\n public readonly value: FlowGraphDataConnection<Matrix>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.position = this.registerDataInput(\"position\", RichTypeVector3);\n this.rotationQuaternion = this.registerDataInput(\"rotationQuaternion\", RichTypeQuaternion);\n this.scaling = this.registerDataInput(\"scaling\", RichTypeVector3);\n this.value = this.registerDataOutput(\"value\", RichTypeMatrix);\n }\n\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, \"executionId\", -1);\n const cachedMatrix = context._getExecutionVariable(this, \"cachedMatrix\", null);\n if (cachedExecutionId === context.executionId && cachedMatrix) {\n this.value.setValue(cachedMatrix, context);\n } else {\n const matrix = Matrix.Compose(this.scaling.getValue(context), this.rotationQuaternion.getValue(context), this.position.getValue(context));\n this.value.setValue(matrix, context);\n context._setExecutionVariable(this, \"cachedMatrix\", matrix);\n context._setExecutionVariable(this, \"executionId\", context.executionId);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.MatrixCompose;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.MatrixCompose, FlowGraphMatrixComposeBlock);\n"]}
|
package/Layers/effectLayer.d.ts
CHANGED
|
@@ -273,6 +273,11 @@ export declare abstract class EffectLayer {
|
|
|
273
273
|
protected _isReady(subMesh: SubMesh, useInstances: boolean, emissiveTexture: Nullable<BaseTexture>): boolean;
|
|
274
274
|
protected _importShadersAsync(): Promise<void>;
|
|
275
275
|
protected _arePostProcessAndMergeReady(): boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Checks if the layer is ready to be used.
|
|
278
|
+
* @returns true if the layer is ready to be used
|
|
279
|
+
*/
|
|
280
|
+
isLayerReady(): boolean;
|
|
276
281
|
/**
|
|
277
282
|
* Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
|
|
278
283
|
*/
|
package/Layers/effectLayer.js
CHANGED
|
@@ -325,6 +325,13 @@ export class EffectLayer {
|
|
|
325
325
|
_arePostProcessAndMergeReady() {
|
|
326
326
|
return this._internalThinEffectLayer ? this._thinEffectLayer._internalIsLayerReady() : this._thinEffectLayer.isLayerReady();
|
|
327
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Checks if the layer is ready to be used.
|
|
330
|
+
* @returns true if the layer is ready to be used
|
|
331
|
+
*/
|
|
332
|
+
isLayerReady() {
|
|
333
|
+
return this._arePostProcessAndMergeReady() && this._mainTexture.isReady();
|
|
334
|
+
}
|
|
328
335
|
/**
|
|
329
336
|
* Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
|
|
330
337
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effectLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/effectLayer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA4CpD;;;;;;;GAOG;AACH,MAAM,OAAgB,WAAW;IAQ7B,IAAc,aAAa;QACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC;IAC/C,CAAC;IACD,IAAc,aAAa,CAAC,KAAK;QAC7B,IAAI,CAAC,gBAAgB,CAAC,aAAa,GAAG,KAAK,CAAC;IAChD,CAAC;IAGD,IAAc,wBAAwB;QAClC,OAAO,IAAI,CAAC,gBAAgB,CAAC,wBAAwB,CAAC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ADC,0BAA0B,EAAE;yCAG5B;AAMD;IADC,SAAS,EAAE;mDAGX;AASD;IADC,SAAS,EAAE;sEAGX","sourcesContent":["import { serialize, serializeAsColor4, serializeAsCameraReference } from \"../Misc/decorators\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ISize } from \"../Maths/math.size\";\r\nimport type { Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Material } from \"../Materials/material\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { _WarnImport } from \"../Misc/devTools\";\r\nimport { GetExponentOfTwo } from \"../Misc/tools.functions\";\r\nimport type { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { ThinEffectLayer } from \"./thinEffectLayer\";\r\n\r\n/**\r\n * Effect layer options. This helps customizing the behaviour\r\n * of the effect layer.\r\n */\r\nexport interface IEffectLayerOptions {\r\n /**\r\n * Multiplication factor apply to the canvas size to compute the render target size\r\n * used to generated the objects (the smaller the faster). Default: 0.5\r\n */\r\n mainTextureRatio: number;\r\n\r\n /**\r\n * Enforces a fixed size texture to ensure effect stability across devices. Default: undefined\r\n */\r\n mainTextureFixedSize?: number;\r\n\r\n /**\r\n * Alpha blending mode used to apply the blur. Default depends of the implementation. Default: ALPHA_COMBINE\r\n */\r\n alphaBlendingMode: number;\r\n\r\n /**\r\n * The camera attached to the layer. Default: null\r\n */\r\n camera: Nullable<Camera>;\r\n\r\n /**\r\n * The rendering group to draw the layer in. Default: -1\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_BYTE\r\n */\r\n mainTextureType: number;\r\n\r\n /**\r\n * Whether or not to generate a stencil buffer. Default: false\r\n */\r\n generateStencilBuffer: boolean;\r\n}\r\n\r\n/**\r\n * The effect layer Helps adding post process effect blended with the main pass.\r\n *\r\n * This can be for instance use to generate glow or highlight effects on the scene.\r\n *\r\n * The effect layer class can not be used directly and is intented to inherited from to be\r\n * customized per effects.\r\n */\r\nexport abstract class EffectLayer {\r\n private _effectLayerOptions: IEffectLayerOptions;\r\n\r\n protected _scene: Scene;\r\n protected _engine: AbstractEngine;\r\n protected _maxSize: number = 0;\r\n protected _mainTextureDesiredSize: ISize = { width: 0, height: 0 };\r\n protected _mainTexture: RenderTargetTexture;\r\n protected get _shouldRender() {\r\n return this._thinEffectLayer._shouldRender;\r\n }\r\n protected set _shouldRender(value) {\r\n this._thinEffectLayer._shouldRender = value;\r\n }\r\n protected _postProcesses: PostProcess[] = [];\r\n protected _textures: BaseTexture[] = [];\r\n protected get _emissiveTextureAndColor(): { texture: Nullable<BaseTexture>; color: Color4 } {\r\n return this._thinEffectLayer._emissiveTextureAndColor;\r\n }\r\n protected set _emissiveTextureAndColor(value) {\r\n this._thinEffectLayer._emissiveTextureAndColor = value;\r\n }\r\n protected get _effectIntensity(): { [meshUniqueId: number]: number } {\r\n return this._thinEffectLayer._effectIntensity;\r\n }\r\n protected set _effectIntensity(value) {\r\n this._thinEffectLayer._effectIntensity = value;\r\n }\r\n protected readonly _thinEffectLayer: ThinEffectLayer;\r\n private readonly _internalThinEffectLayer: boolean;\r\n\r\n /**\r\n * Force all the effect layers to compile to glsl even on WebGPU engines.\r\n * False by default. This is mostly meant for backward compatibility.\r\n */\r\n public static get ForceGLSL() {\r\n return ThinEffectLayer.ForceGLSL;\r\n }\r\n\r\n public static set ForceGLSL(value: boolean) {\r\n ThinEffectLayer.ForceGLSL = value;\r\n }\r\n\r\n /**\r\n * The name of the layer\r\n */\r\n @serialize()\r\n public get name() {\r\n return this._thinEffectLayer.name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._thinEffectLayer.name = value;\r\n }\r\n\r\n /**\r\n * The clear color of the texture used to generate the glow map.\r\n */\r\n @serializeAsColor4()\r\n public get neutralColor(): Color4 {\r\n return this._thinEffectLayer.neutralColor;\r\n }\r\n\r\n public set neutralColor(value: Color4) {\r\n this._thinEffectLayer.neutralColor = value;\r\n }\r\n\r\n /**\r\n * Specifies whether the highlight layer is enabled or not.\r\n */\r\n @serialize()\r\n public get isEnabled(): boolean {\r\n return this._thinEffectLayer.isEnabled;\r\n }\r\n\r\n public set isEnabled(value: boolean) {\r\n this._thinEffectLayer.isEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets the camera attached to the layer.\r\n */\r\n @serializeAsCameraReference()\r\n public get camera(): Nullable<Camera> {\r\n return this._thinEffectLayer.camera;\r\n }\r\n\r\n /**\r\n * Gets the rendering group id the layer should render in.\r\n */\r\n @serialize()\r\n public get renderingGroupId(): number {\r\n return this._thinEffectLayer.renderingGroupId;\r\n }\r\n public set renderingGroupId(renderingGroupId: number) {\r\n this._thinEffectLayer.renderingGroupId = renderingGroupId;\r\n }\r\n\r\n /**\r\n * Specifies if the bounding boxes should be rendered normally or if they should undergo the effect of the layer\r\n */\r\n @serialize()\r\n public get disableBoundingBoxesFromEffectLayer() {\r\n return this._thinEffectLayer.disableBoundingBoxesFromEffectLayer;\r\n }\r\n\r\n public set disableBoundingBoxesFromEffectLayer(value: boolean) {\r\n this._thinEffectLayer.disableBoundingBoxesFromEffectLayer = value;\r\n }\r\n\r\n /**\r\n * An event triggered when the effect layer has been disposed.\r\n */\r\n public onDisposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the effect layer is about rendering the main texture with the glowy parts.\r\n */\r\n public onBeforeRenderMainTextureObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the generated texture is being merged in the scene.\r\n */\r\n public onBeforeComposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the mesh is rendered into the effect render target.\r\n */\r\n public onBeforeRenderMeshToEffect = new Observable<AbstractMesh>();\r\n\r\n /**\r\n * An event triggered after the mesh has been rendered into the effect render target.\r\n */\r\n public onAfterRenderMeshToEffect = new Observable<AbstractMesh>();\r\n\r\n /**\r\n * An event triggered when the generated texture has been merged in the scene.\r\n */\r\n public onAfterComposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the effect layer changes its size.\r\n */\r\n public onSizeChangedObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * Gets the main texture where the effect is rendered\r\n */\r\n public get mainTexture() {\r\n return this._mainTexture;\r\n }\r\n\r\n protected get _shaderLanguage(): ShaderLanguage {\r\n return this._thinEffectLayer.shaderLanguage;\r\n }\r\n\r\n /**\r\n * Gets the shader language used in this material.\r\n */\r\n public get shaderLanguage(): ShaderLanguage {\r\n return this._thinEffectLayer.shaderLanguage;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _SceneComponentInitialization: (scene: Scene) => void = (_) => {\r\n throw _WarnImport(\"EffectLayerSceneComponent\");\r\n };\r\n /**\r\n * Sets a specific material to be used to render a mesh/a list of meshes in the layer\r\n * @param mesh mesh or array of meshes\r\n * @param material material to use by the layer when rendering the mesh(es). If undefined is passed, the specific material created by the layer will be used.\r\n */\r\n public setMaterialForRendering(mesh: AbstractMesh | AbstractMesh[], material?: Material): void {\r\n this._thinEffectLayer.setMaterialForRendering(mesh, material);\r\n }\r\n\r\n /**\r\n * Gets the intensity of the effect for a specific mesh.\r\n * @param mesh The mesh to get the effect intensity for\r\n * @returns The intensity of the effect for the mesh\r\n */\r\n public getEffectIntensity(mesh: AbstractMesh) {\r\n return this._thinEffectLayer.getEffectIntensity(mesh);\r\n }\r\n\r\n /**\r\n * Sets the intensity of the effect for a specific mesh.\r\n * @param mesh The mesh to set the effect intensity for\r\n * @param intensity The intensity of the effect for the mesh\r\n */\r\n public setEffectIntensity(mesh: AbstractMesh, intensity: number): void {\r\n this._thinEffectLayer.setEffectIntensity(mesh, intensity);\r\n }\r\n\r\n /**\r\n * Instantiates a new effect Layer and references it in the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n * @param thinEffectLayer The thin instance of the effect layer (optional)\r\n */\r\n constructor(\r\n /** The Friendly of the effect in the scene */\r\n name: string,\r\n scene?: Scene,\r\n forceGLSL = false,\r\n thinEffectLayer?: ThinEffectLayer\r\n ) {\r\n this._internalThinEffectLayer = !thinEffectLayer;\r\n if (!thinEffectLayer) {\r\n thinEffectLayer = new ThinEffectLayer(name, scene, forceGLSL, false, this._importShadersAsync.bind(this));\r\n thinEffectLayer.getEffectName = this.getEffectName.bind(this);\r\n thinEffectLayer.isReady = this.isReady.bind(this);\r\n thinEffectLayer._createMergeEffect = this._createMergeEffect.bind(this);\r\n thinEffectLayer._createTextureAndPostProcesses = this._createTextureAndPostProcesses.bind(this);\r\n thinEffectLayer._internalCompose = this._internalRender.bind(this);\r\n thinEffectLayer._setEmissiveTextureAndColor = this._setEmissiveTextureAndColor.bind(this);\r\n thinEffectLayer._numInternalDraws = this._numInternalDraws.bind(this);\r\n thinEffectLayer._addCustomEffectDefines = this._addCustomEffectDefines.bind(this);\r\n thinEffectLayer.hasMesh = this.hasMesh.bind(this);\r\n thinEffectLayer.shouldRender = this.shouldRender.bind(this);\r\n thinEffectLayer._shouldRenderMesh = this._shouldRenderMesh.bind(this);\r\n thinEffectLayer._canRenderMesh = this._canRenderMesh.bind(this);\r\n thinEffectLayer._useMeshMaterial = this._useMeshMaterial.bind(this);\r\n }\r\n\r\n this._thinEffectLayer = thinEffectLayer;\r\n this.name = name;\r\n\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n EffectLayer._SceneComponentInitialization(this._scene);\r\n\r\n this._engine = this._scene.getEngine();\r\n this._maxSize = this._engine.getCaps().maxTextureSize;\r\n this._scene.effectLayers.push(this);\r\n\r\n this._thinEffectLayer.onDisposeObservable.add(() => {\r\n this.onDisposeObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeRenderLayerObservable.add(() => {\r\n this.onBeforeRenderMainTextureObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeComposeObservable.add(() => {\r\n this.onBeforeComposeObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeRenderMeshToEffect.add((mesh) => {\r\n this.onBeforeRenderMeshToEffect.notifyObservers(mesh);\r\n });\r\n\r\n this._thinEffectLayer.onAfterRenderMeshToEffect.add((mesh) => {\r\n this.onAfterRenderMeshToEffect.notifyObservers(mesh);\r\n });\r\n\r\n this._thinEffectLayer.onAfterComposeObservable.add(() => {\r\n this.onAfterComposeObservable.notifyObservers(this);\r\n });\r\n }\r\n\r\n protected get _shadersLoaded() {\r\n return this._thinEffectLayer._shadersLoaded;\r\n }\r\n\r\n protected set _shadersLoaded(value: boolean) {\r\n this._thinEffectLayer._shadersLoaded = value;\r\n }\r\n\r\n /**\r\n * Get the effect name of the layer.\r\n * @returns The effect name\r\n */\r\n public abstract getEffectName(): string;\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @returns true if ready otherwise, false\r\n */\r\n public abstract isReady(subMesh: SubMesh, useInstances: boolean): boolean;\r\n\r\n /**\r\n * Returns whether or not the layer needs stencil enabled during the mesh rendering.\r\n * @returns true if the effect requires stencil during the main canvas render pass.\r\n */\r\n public abstract needStencil(): boolean;\r\n\r\n /**\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n * @returns The effect containing the shader used to merge the effect on the main canvas\r\n */\r\n protected abstract _createMergeEffect(): Effect;\r\n\r\n /**\r\n * Creates the render target textures and post processes used in the effect layer.\r\n */\r\n protected abstract _createTextureAndPostProcesses(): void;\r\n\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n * @param renderNum Index of the _internalRender call (0 for the first time _internalRender is called, 1 for the second time, etc. _internalRender is called the number of times returned by _numInternalDraws())\r\n */\r\n protected abstract _internalRender(effect: Effect, renderIndex: number): void;\r\n\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n */\r\n protected abstract _setEmissiveTextureAndColor(mesh: Mesh, subMesh: SubMesh, material: Material): void;\r\n\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n */\r\n public abstract _disposeMesh(mesh: Mesh): void;\r\n\r\n /**\r\n * Serializes this layer (Glow or Highlight for example)\r\n * @returns a serialized layer object\r\n */\r\n public abstract serialize?(): any;\r\n\r\n /**\r\n * Number of times _internalRender will be called. Some effect layers need to render the mesh several times, so they should override this method with the number of times the mesh should be rendered\r\n * @returns Number of times a mesh must be rendered in the layer\r\n */\r\n protected _numInternalDraws(): number {\r\n return this._internalThinEffectLayer ? 1 : this._thinEffectLayer._numInternalDraws();\r\n }\r\n\r\n /**\r\n * Initializes the effect layer with the required options.\r\n * @param options Sets of none mandatory options to use with the layer (see IEffectLayerOptions for more information)\r\n */\r\n protected _init(options: Partial<IEffectLayerOptions>): void {\r\n // Adapt options\r\n this._effectLayerOptions = {\r\n mainTextureRatio: 0.5,\r\n alphaBlendingMode: Constants.ALPHA_COMBINE,\r\n camera: null,\r\n renderingGroupId: -1,\r\n mainTextureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n generateStencilBuffer: false,\r\n ...options,\r\n };\r\n\r\n this._setMainTextureSize();\r\n this._thinEffectLayer._init(options);\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n }\r\n\r\n /**\r\n * Sets the main texture desired size which is the closest power of two\r\n * of the engine canvas size.\r\n */\r\n private _setMainTextureSize(): void {\r\n if (this._effectLayerOptions.mainTextureFixedSize) {\r\n this._mainTextureDesiredSize.width = this._effectLayerOptions.mainTextureFixedSize;\r\n this._mainTextureDesiredSize.height = this._effectLayerOptions.mainTextureFixedSize;\r\n } else {\r\n this._mainTextureDesiredSize.width = this._engine.getRenderWidth() * this._effectLayerOptions.mainTextureRatio;\r\n this._mainTextureDesiredSize.height = this._engine.getRenderHeight() * this._effectLayerOptions.mainTextureRatio;\r\n\r\n this._mainTextureDesiredSize.width = this._engine.needPOTTextures\r\n ? GetExponentOfTwo(this._mainTextureDesiredSize.width, this._maxSize)\r\n : this._mainTextureDesiredSize.width;\r\n this._mainTextureDesiredSize.height = this._engine.needPOTTextures\r\n ? GetExponentOfTwo(this._mainTextureDesiredSize.height, this._maxSize)\r\n : this._mainTextureDesiredSize.height;\r\n }\r\n\r\n this._mainTextureDesiredSize.width = Math.floor(this._mainTextureDesiredSize.width);\r\n this._mainTextureDesiredSize.height = Math.floor(this._mainTextureDesiredSize.height);\r\n }\r\n\r\n /**\r\n * Creates the main texture for the effect layer.\r\n */\r\n protected _createMainTexture(): void {\r\n this._mainTexture = new RenderTargetTexture(\r\n \"EffectLayerMainRTT\",\r\n {\r\n width: this._mainTextureDesiredSize.width,\r\n height: this._mainTextureDesiredSize.height,\r\n },\r\n this._scene,\r\n {\r\n type: this._effectLayerOptions.mainTextureType,\r\n samplingMode: Texture.TRILINEAR_SAMPLINGMODE,\r\n generateStencilBuffer: this._effectLayerOptions.generateStencilBuffer,\r\n existingObjectRenderer: this._thinEffectLayer.objectRenderer,\r\n }\r\n );\r\n this._mainTexture.activeCamera = this._effectLayerOptions.camera;\r\n this._mainTexture.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._mainTexture.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._mainTexture.anisotropicFilteringLevel = 1;\r\n this._mainTexture.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._mainTexture.renderParticles = false;\r\n this._mainTexture.renderList = null;\r\n this._mainTexture.ignoreCameraViewport = true;\r\n\r\n this._mainTexture.onClearObservable.add((engine: AbstractEngine) => {\r\n engine.clear(this.neutralColor, true, true, true);\r\n });\r\n }\r\n\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _addCustomEffectDefines(defines: string[]): void {\r\n // Nothing to add by default.\r\n }\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @param emissiveTexture the associated emissive texture used to generate the glow\r\n * @returns true if ready otherwise, false\r\n */\r\n protected _isReady(subMesh: SubMesh, useInstances: boolean, emissiveTexture: Nullable<BaseTexture>): boolean {\r\n return this._internalThinEffectLayer\r\n ? this._thinEffectLayer._internalIsSubMeshReady(subMesh, useInstances, emissiveTexture)\r\n : this._thinEffectLayer._isSubMeshReady(subMesh, useInstances, emissiveTexture);\r\n }\r\n\r\n protected async _importShadersAsync(): Promise<void> {}\r\n\r\n protected _arePostProcessAndMergeReady(): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalIsLayerReady() : this._thinEffectLayer.isLayerReady();\r\n }\r\n\r\n /**\r\n * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.\r\n */\r\n public render(): void {\r\n if (!this._thinEffectLayer.compose()) {\r\n return;\r\n }\r\n\r\n // Handle size changes.\r\n const size = this._mainTexture.getSize();\r\n this._setMainTextureSize();\r\n if (\r\n (size.width !== this._mainTextureDesiredSize.width || size.height !== this._mainTextureDesiredSize.height) &&\r\n this._mainTextureDesiredSize.width !== 0 &&\r\n this._mainTextureDesiredSize.height !== 0\r\n ) {\r\n // Recreate RTT and post processes on size change.\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n this._disposeTextureAndPostProcesses();\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n }\r\n }\r\n\r\n /**\r\n * Determine if a given mesh will be used in the current effect.\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be used\r\n */\r\n public hasMesh(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalHasMesh(mesh) : this._thinEffectLayer.hasMesh(mesh);\r\n }\r\n\r\n /**\r\n * Returns true if the layer contains information to display, otherwise false.\r\n * @returns true if the glow layer should be rendered\r\n */\r\n public shouldRender(): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalShouldRender() : this._thinEffectLayer.shouldRender();\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _shouldRenderMesh(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? true : this._thinEffectLayer._shouldRenderMesh(mesh);\r\n }\r\n\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n protected _canRenderMesh(mesh: AbstractMesh, material: Material): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalCanRenderMesh(mesh, material) : this._thinEffectLayer._canRenderMesh(mesh, material);\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @returns true if it should render otherwise false\r\n */\r\n protected _shouldRenderEmissiveTextureForMesh(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Defines whether the current material of the mesh should be use to render the effect.\r\n * @param mesh defines the current mesh to render\r\n * @returns true if the mesh material should be use\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _useMeshMaterial(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? false : this._thinEffectLayer._useMeshMaterial(mesh);\r\n }\r\n\r\n /**\r\n * Rebuild the required buffers.\r\n * @internal Internal use only.\r\n */\r\n public _rebuild(): void {\r\n this._thinEffectLayer._rebuild();\r\n }\r\n\r\n /**\r\n * Dispose only the render target textures and post process.\r\n */\r\n private _disposeTextureAndPostProcesses(): void {\r\n this._mainTexture.dispose();\r\n\r\n for (let i = 0; i < this._postProcesses.length; i++) {\r\n if (this._postProcesses[i]) {\r\n this._postProcesses[i].dispose();\r\n }\r\n }\r\n this._postProcesses = [];\r\n\r\n for (let i = 0; i < this._textures.length; i++) {\r\n if (this._textures[i]) {\r\n this._textures[i].dispose();\r\n }\r\n }\r\n this._textures = [];\r\n }\r\n\r\n /**\r\n * Dispose the highlight layer and free resources.\r\n */\r\n public dispose(): void {\r\n this._thinEffectLayer.dispose();\r\n\r\n // Clean textures and post processes\r\n this._disposeTextureAndPostProcesses();\r\n\r\n // Remove from scene\r\n const index = this._scene.effectLayers.indexOf(this, 0);\r\n if (index > -1) {\r\n this._scene.effectLayers.splice(index, 1);\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.clear();\r\n this.onBeforeRenderMainTextureObservable.clear();\r\n this.onBeforeComposeObservable.clear();\r\n this.onBeforeRenderMeshToEffect.clear();\r\n this.onAfterRenderMeshToEffect.clear();\r\n this.onAfterComposeObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n }\r\n\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n public getClassName(): string {\r\n return \"EffectLayer\";\r\n }\r\n\r\n /**\r\n * Creates an effect layer from parsed effect layer data\r\n * @param parsedEffectLayer defines effect layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the effect layer information\r\n * @returns a parsed effect Layer\r\n */\r\n public static Parse(parsedEffectLayer: any, scene: Scene, rootUrl: string): EffectLayer {\r\n const effectLayerType = Tools.Instantiate(parsedEffectLayer.customType);\r\n\r\n return effectLayerType.Parse(parsedEffectLayer, scene, rootUrl);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"effectLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/effectLayer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA4CpD;;;;;;;GAOG;AACH,MAAM,OAAgB,WAAW;IAQ7B,IAAc,aAAa;QACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC;IAC/C,CAAC;IACD,IAAc,aAAa,CAAC,KAAK;QAC7B,IAAI,CAAC,gBAAgB,CAAC,aAAa,GAAG,KAAK,CAAC;IAChD,CAAC;IAGD,IAAc,wBAAwB;QAClC,OAAO,IAAI,CAAC,gBAAgB,CAAC,wBAAwB,CAAC;IAC1D,CAAC;IACD,IAAc,wBAAwB,CAAC,KAAK;QACxC,IAAI,CAAC,gBAAgB,CAAC,wBAAwB,GAAG,KAAK,CAAC;IAC3D,CAAC;IACD,IAAc,gBAAgB;QAC1B,OAAO,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC;IAClD,CAAC;IACD,IAAc,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ent":["import { serialize, serializeAsColor4, serializeAsCameraReference } from \"../Misc/decorators\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ISize } from \"../Maths/math.size\";\r\nimport type { Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Material } from \"../Materials/material\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { _WarnImport } from \"../Misc/devTools\";\r\nimport { GetExponentOfTwo } from \"../Misc/tools.functions\";\r\nimport type { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { ThinEffectLayer } from \"./thinEffectLayer\";\r\n\r\n/**\r\n * Effect layer options. This helps customizing the behaviour\r\n * of the effect layer.\r\n */\r\nexport interface IEffectLayerOptions {\r\n /**\r\n * Multiplication factor apply to the canvas size to compute the render target size\r\n * used to generated the objects (the smaller the faster). Default: 0.5\r\n */\r\n mainTextureRatio: number;\r\n\r\n /**\r\n * Enforces a fixed size texture to ensure effect stability across devices. Default: undefined\r\n */\r\n mainTextureFixedSize?: number;\r\n\r\n /**\r\n * Alpha blending mode used to apply the blur. Default depends of the implementation. Default: ALPHA_COMBINE\r\n */\r\n alphaBlendingMode: number;\r\n\r\n /**\r\n * The camera attached to the layer. Default: null\r\n */\r\n camera: Nullable<Camera>;\r\n\r\n /**\r\n * The rendering group to draw the layer in. Default: -1\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_BYTE\r\n */\r\n mainTextureType: number;\r\n\r\n /**\r\n * Whether or not to generate a stencil buffer. Default: false\r\n */\r\n generateStencilBuffer: boolean;\r\n}\r\n\r\n/**\r\n * The effect layer Helps adding post process effect blended with the main pass.\r\n *\r\n * This can be for instance use to generate glow or highlight effects on the scene.\r\n *\r\n * The effect layer class can not be used directly and is intented to inherited from to be\r\n * customized per effects.\r\n */\r\nexport abstract class EffectLayer {\r\n private _effectLayerOptions: IEffectLayerOptions;\r\n\r\n protected _scene: Scene;\r\n protected _engine: AbstractEngine;\r\n protected _maxSize: number = 0;\r\n protected _mainTextureDesiredSize: ISize = { width: 0, height: 0 };\r\n protected _mainTexture: RenderTargetTexture;\r\n protected get _shouldRender() {\r\n return this._thinEffectLayer._shouldRender;\r\n }\r\n protected set _shouldRender(value) {\r\n this._thinEffectLayer._shouldRender = value;\r\n }\r\n protected _postProcesses: PostProcess[] = [];\r\n protected _textures: BaseTexture[] = [];\r\n protected get _emissiveTextureAndColor(): { texture: Nullable<BaseTexture>; color: Color4 } {\r\n return this._thinEffectLayer._emissiveTextureAndColor;\r\n }\r\n protected set _emissiveTextureAndColor(value) {\r\n this._thinEffectLayer._emissiveTextureAndColor = value;\r\n }\r\n protected get _effectIntensity(): { [meshUniqueId: number]: number } {\r\n return this._thinEffectLayer._effectIntensity;\r\n }\r\n protected set _effectIntensity(value) {\r\n this._thinEffectLayer._effectIntensity = value;\r\n }\r\n protected readonly _thinEffectLayer: ThinEffectLayer;\r\n private readonly _internalThinEffectLayer: boolean;\r\n\r\n /**\r\n * Force all the effect layers to compile to glsl even on WebGPU engines.\r\n * False by default. This is mostly meant for backward compatibility.\r\n */\r\n public static get ForceGLSL() {\r\n return ThinEffectLayer.ForceGLSL;\r\n }\r\n\r\n public static set ForceGLSL(value: boolean) {\r\n ThinEffectLayer.ForceGLSL = value;\r\n }\r\n\r\n /**\r\n * The name of the layer\r\n */\r\n @serialize()\r\n public get name() {\r\n return this._thinEffectLayer.name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._thinEffectLayer.name = value;\r\n }\r\n\r\n /**\r\n * The clear color of the texture used to generate the glow map.\r\n */\r\n @serializeAsColor4()\r\n public get neutralColor(): Color4 {\r\n return this._thinEffectLayer.neutralColor;\r\n }\r\n\r\n public set neutralColor(value: Color4) {\r\n this._thinEffectLayer.neutralColor = value;\r\n }\r\n\r\n /**\r\n * Specifies whether the highlight layer is enabled or not.\r\n */\r\n @serialize()\r\n public get isEnabled(): boolean {\r\n return this._thinEffectLayer.isEnabled;\r\n }\r\n\r\n public set isEnabled(value: boolean) {\r\n this._thinEffectLayer.isEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets the camera attached to the layer.\r\n */\r\n @serializeAsCameraReference()\r\n public get camera(): Nullable<Camera> {\r\n return this._thinEffectLayer.camera;\r\n }\r\n\r\n /**\r\n * Gets the rendering group id the layer should render in.\r\n */\r\n @serialize()\r\n public get renderingGroupId(): number {\r\n return this._thinEffectLayer.renderingGroupId;\r\n }\r\n public set renderingGroupId(renderingGroupId: number) {\r\n this._thinEffectLayer.renderingGroupId = renderingGroupId;\r\n }\r\n\r\n /**\r\n * Specifies if the bounding boxes should be rendered normally or if they should undergo the effect of the layer\r\n */\r\n @serialize()\r\n public get disableBoundingBoxesFromEffectLayer() {\r\n return this._thinEffectLayer.disableBoundingBoxesFromEffectLayer;\r\n }\r\n\r\n public set disableBoundingBoxesFromEffectLayer(value: boolean) {\r\n this._thinEffectLayer.disableBoundingBoxesFromEffectLayer = value;\r\n }\r\n\r\n /**\r\n * An event triggered when the effect layer has been disposed.\r\n */\r\n public onDisposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the effect layer is about rendering the main texture with the glowy parts.\r\n */\r\n public onBeforeRenderMainTextureObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the generated texture is being merged in the scene.\r\n */\r\n public onBeforeComposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the mesh is rendered into the effect render target.\r\n */\r\n public onBeforeRenderMeshToEffect = new Observable<AbstractMesh>();\r\n\r\n /**\r\n * An event triggered after the mesh has been rendered into the effect render target.\r\n */\r\n public onAfterRenderMeshToEffect = new Observable<AbstractMesh>();\r\n\r\n /**\r\n * An event triggered when the generated texture has been merged in the scene.\r\n */\r\n public onAfterComposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the effect layer changes its size.\r\n */\r\n public onSizeChangedObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * Gets the main texture where the effect is rendered\r\n */\r\n public get mainTexture() {\r\n return this._mainTexture;\r\n }\r\n\r\n protected get _shaderLanguage(): ShaderLanguage {\r\n return this._thinEffectLayer.shaderLanguage;\r\n }\r\n\r\n /**\r\n * Gets the shader language used in this material.\r\n */\r\n public get shaderLanguage(): ShaderLanguage {\r\n return this._thinEffectLayer.shaderLanguage;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _SceneComponentInitialization: (scene: Scene) => void = (_) => {\r\n throw _WarnImport(\"EffectLayerSceneComponent\");\r\n };\r\n /**\r\n * Sets a specific material to be used to render a mesh/a list of meshes in the layer\r\n * @param mesh mesh or array of meshes\r\n * @param material material to use by the layer when rendering the mesh(es). If undefined is passed, the specific material created by the layer will be used.\r\n */\r\n public setMaterialForRendering(mesh: AbstractMesh | AbstractMesh[], material?: Material): void {\r\n this._thinEffectLayer.setMaterialForRendering(mesh, material);\r\n }\r\n\r\n /**\r\n * Gets the intensity of the effect for a specific mesh.\r\n * @param mesh The mesh to get the effect intensity for\r\n * @returns The intensity of the effect for the mesh\r\n */\r\n public getEffectIntensity(mesh: AbstractMesh) {\r\n return this._thinEffectLayer.getEffectIntensity(mesh);\r\n }\r\n\r\n /**\r\n * Sets the intensity of the effect for a specific mesh.\r\n * @param mesh The mesh to set the effect intensity for\r\n * @param intensity The intensity of the effect for the mesh\r\n */\r\n public setEffectIntensity(mesh: AbstractMesh, intensity: number): void {\r\n this._thinEffectLayer.setEffectIntensity(mesh, intensity);\r\n }\r\n\r\n /**\r\n * Instantiates a new effect Layer and references it in the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n * @param thinEffectLayer The thin instance of the effect layer (optional)\r\n */\r\n constructor(\r\n /** The Friendly of the effect in the scene */\r\n name: string,\r\n scene?: Scene,\r\n forceGLSL = false,\r\n thinEffectLayer?: ThinEffectLayer\r\n ) {\r\n this._internalThinEffectLayer = !thinEffectLayer;\r\n if (!thinEffectLayer) {\r\n thinEffectLayer = new ThinEffectLayer(name, scene, forceGLSL, false, this._importShadersAsync.bind(this));\r\n thinEffectLayer.getEffectName = this.getEffectName.bind(this);\r\n thinEffectLayer.isReady = this.isReady.bind(this);\r\n thinEffectLayer._createMergeEffect = this._createMergeEffect.bind(this);\r\n thinEffectLayer._createTextureAndPostProcesses = this._createTextureAndPostProcesses.bind(this);\r\n thinEffectLayer._internalCompose = this._internalRender.bind(this);\r\n thinEffectLayer._setEmissiveTextureAndColor = this._setEmissiveTextureAndColor.bind(this);\r\n thinEffectLayer._numInternalDraws = this._numInternalDraws.bind(this);\r\n thinEffectLayer._addCustomEffectDefines = this._addCustomEffectDefines.bind(this);\r\n thinEffectLayer.hasMesh = this.hasMesh.bind(this);\r\n thinEffectLayer.shouldRender = this.shouldRender.bind(this);\r\n thinEffectLayer._shouldRenderMesh = this._shouldRenderMesh.bind(this);\r\n thinEffectLayer._canRenderMesh = this._canRenderMesh.bind(this);\r\n thinEffectLayer._useMeshMaterial = this._useMeshMaterial.bind(this);\r\n }\r\n\r\n this._thinEffectLayer = thinEffectLayer;\r\n this.name = name;\r\n\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n EffectLayer._SceneComponentInitialization(this._scene);\r\n\r\n this._engine = this._scene.getEngine();\r\n this._maxSize = this._engine.getCaps().maxTextureSize;\r\n this._scene.effectLayers.push(this);\r\n\r\n this._thinEffectLayer.onDisposeObservable.add(() => {\r\n this.onDisposeObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeRenderLayerObservable.add(() => {\r\n this.onBeforeRenderMainTextureObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeComposeObservable.add(() => {\r\n this.onBeforeComposeObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeRenderMeshToEffect.add((mesh) => {\r\n this.onBeforeRenderMeshToEffect.notifyObservers(mesh);\r\n });\r\n\r\n this._thinEffectLayer.onAfterRenderMeshToEffect.add((mesh) => {\r\n this.onAfterRenderMeshToEffect.notifyObservers(mesh);\r\n });\r\n\r\n this._thinEffectLayer.onAfterComposeObservable.add(() => {\r\n this.onAfterComposeObservable.notifyObservers(this);\r\n });\r\n }\r\n\r\n protected get _shadersLoaded() {\r\n return this._thinEffectLayer._shadersLoaded;\r\n }\r\n\r\n protected set _shadersLoaded(value: boolean) {\r\n this._thinEffectLayer._shadersLoaded = value;\r\n }\r\n\r\n /**\r\n * Get the effect name of the layer.\r\n * @returns The effect name\r\n */\r\n public abstract getEffectName(): string;\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @returns true if ready otherwise, false\r\n */\r\n public abstract isReady(subMesh: SubMesh, useInstances: boolean): boolean;\r\n\r\n /**\r\n * Returns whether or not the layer needs stencil enabled during the mesh rendering.\r\n * @returns true if the effect requires stencil during the main canvas render pass.\r\n */\r\n public abstract needStencil(): boolean;\r\n\r\n /**\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n * @returns The effect containing the shader used to merge the effect on the main canvas\r\n */\r\n protected abstract _createMergeEffect(): Effect;\r\n\r\n /**\r\n * Creates the render target textures and post processes used in the effect layer.\r\n */\r\n protected abstract _createTextureAndPostProcesses(): void;\r\n\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n * @param renderNum Index of the _internalRender call (0 for the first time _internalRender is called, 1 for the second time, etc. _internalRender is called the number of times returned by _numInternalDraws())\r\n */\r\n protected abstract _internalRender(effect: Effect, renderIndex: number): void;\r\n\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n */\r\n protected abstract _setEmissiveTextureAndColor(mesh: Mesh, subMesh: SubMesh, material: Material): void;\r\n\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n */\r\n public abstract _disposeMesh(mesh: Mesh): void;\r\n\r\n /**\r\n * Serializes this layer (Glow or Highlight for example)\r\n * @returns a serialized layer object\r\n */\r\n public abstract serialize?(): any;\r\n\r\n /**\r\n * Number of times _internalRender will be called. Some effect layers need to render the mesh several times, so they should override this method with the number of times the mesh should be rendered\r\n * @returns Number of times a mesh must be rendered in the layer\r\n */\r\n protected _numInternalDraws(): number {\r\n return this._internalThinEffectLayer ? 1 : this._thinEffectLayer._numInternalDraws();\r\n }\r\n\r\n /**\r\n * Initializes the effect layer with the required options.\r\n * @param options Sets of none mandatory options to use with the layer (see IEffectLayerOptions for more information)\r\n */\r\n protected _init(options: Partial<IEffectLayerOptions>): void {\r\n // Adapt options\r\n this._effectLayerOptions = {\r\n mainTextureRatio: 0.5,\r\n alphaBlendingMode: Constants.ALPHA_COMBINE,\r\n camera: null,\r\n renderingGroupId: -1,\r\n mainTextureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n generateStencilBuffer: false,\r\n ...options,\r\n };\r\n\r\n this._setMainTextureSize();\r\n this._thinEffectLayer._init(options);\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n }\r\n\r\n /**\r\n * Sets the main texture desired size which is the closest power of two\r\n * of the engine canvas size.\r\n */\r\n private _setMainTextureSize(): void {\r\n if (this._effectLayerOptions.mainTextureFixedSize) {\r\n this._mainTextureDesiredSize.width = this._effectLayerOptions.mainTextureFixedSize;\r\n this._mainTextureDesiredSize.height = this._effectLayerOptions.mainTextureFixedSize;\r\n } else {\r\n this._mainTextureDesiredSize.width = this._engine.getRenderWidth() * this._effectLayerOptions.mainTextureRatio;\r\n this._mainTextureDesiredSize.height = this._engine.getRenderHeight() * this._effectLayerOptions.mainTextureRatio;\r\n\r\n this._mainTextureDesiredSize.width = this._engine.needPOTTextures\r\n ? GetExponentOfTwo(this._mainTextureDesiredSize.width, this._maxSize)\r\n : this._mainTextureDesiredSize.width;\r\n this._mainTextureDesiredSize.height = this._engine.needPOTTextures\r\n ? GetExponentOfTwo(this._mainTextureDesiredSize.height, this._maxSize)\r\n : this._mainTextureDesiredSize.height;\r\n }\r\n\r\n this._mainTextureDesiredSize.width = Math.floor(this._mainTextureDesiredSize.width);\r\n this._mainTextureDesiredSize.height = Math.floor(this._mainTextureDesiredSize.height);\r\n }\r\n\r\n /**\r\n * Creates the main texture for the effect layer.\r\n */\r\n protected _createMainTexture(): void {\r\n this._mainTexture = new RenderTargetTexture(\r\n \"EffectLayerMainRTT\",\r\n {\r\n width: this._mainTextureDesiredSize.width,\r\n height: this._mainTextureDesiredSize.height,\r\n },\r\n this._scene,\r\n {\r\n type: this._effectLayerOptions.mainTextureType,\r\n samplingMode: Texture.TRILINEAR_SAMPLINGMODE,\r\n generateStencilBuffer: this._effectLayerOptions.generateStencilBuffer,\r\n existingObjectRenderer: this._thinEffectLayer.objectRenderer,\r\n }\r\n );\r\n this._mainTexture.activeCamera = this._effectLayerOptions.camera;\r\n this._mainTexture.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._mainTexture.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._mainTexture.anisotropicFilteringLevel = 1;\r\n this._mainTexture.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._mainTexture.renderParticles = false;\r\n this._mainTexture.renderList = null;\r\n this._mainTexture.ignoreCameraViewport = true;\r\n\r\n this._mainTexture.onClearObservable.add((engine: AbstractEngine) => {\r\n engine.clear(this.neutralColor, true, true, true);\r\n });\r\n }\r\n\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _addCustomEffectDefines(defines: string[]): void {\r\n // Nothing to add by default.\r\n }\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @param emissiveTexture the associated emissive texture used to generate the glow\r\n * @returns true if ready otherwise, false\r\n */\r\n protected _isReady(subMesh: SubMesh, useInstances: boolean, emissiveTexture: Nullable<BaseTexture>): boolean {\r\n return this._internalThinEffectLayer\r\n ? this._thinEffectLayer._internalIsSubMeshReady(subMesh, useInstances, emissiveTexture)\r\n : this._thinEffectLayer._isSubMeshReady(subMesh, useInstances, emissiveTexture);\r\n }\r\n\r\n protected async _importShadersAsync(): Promise<void> {}\r\n\r\n protected _arePostProcessAndMergeReady(): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalIsLayerReady() : this._thinEffectLayer.isLayerReady();\r\n }\r\n\r\n /**\r\n * Checks if the layer is ready to be used.\r\n * @returns true if the layer is ready to be used\r\n */\r\n public isLayerReady(): boolean {\r\n return this._arePostProcessAndMergeReady() && this._mainTexture.isReady();\r\n }\r\n\r\n /**\r\n * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.\r\n */\r\n public render(): void {\r\n if (!this._thinEffectLayer.compose()) {\r\n return;\r\n }\r\n\r\n // Handle size changes.\r\n const size = this._mainTexture.getSize();\r\n this._setMainTextureSize();\r\n if (\r\n (size.width !== this._mainTextureDesiredSize.width || size.height !== this._mainTextureDesiredSize.height) &&\r\n this._mainTextureDesiredSize.width !== 0 &&\r\n this._mainTextureDesiredSize.height !== 0\r\n ) {\r\n // Recreate RTT and post processes on size change.\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n this._disposeTextureAndPostProcesses();\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n }\r\n }\r\n\r\n /**\r\n * Determine if a given mesh will be used in the current effect.\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be used\r\n */\r\n public hasMesh(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalHasMesh(mesh) : this._thinEffectLayer.hasMesh(mesh);\r\n }\r\n\r\n /**\r\n * Returns true if the layer contains information to display, otherwise false.\r\n * @returns true if the glow layer should be rendered\r\n */\r\n public shouldRender(): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalShouldRender() : this._thinEffectLayer.shouldRender();\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _shouldRenderMesh(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? true : this._thinEffectLayer._shouldRenderMesh(mesh);\r\n }\r\n\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n protected _canRenderMesh(mesh: AbstractMesh, material: Material): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalCanRenderMesh(mesh, material) : this._thinEffectLayer._canRenderMesh(mesh, material);\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @returns true if it should render otherwise false\r\n */\r\n protected _shouldRenderEmissiveTextureForMesh(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Defines whether the current material of the mesh should be use to render the effect.\r\n * @param mesh defines the current mesh to render\r\n * @returns true if the mesh material should be use\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _useMeshMaterial(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? false : this._thinEffectLayer._useMeshMaterial(mesh);\r\n }\r\n\r\n /**\r\n * Rebuild the required buffers.\r\n * @internal Internal use only.\r\n */\r\n public _rebuild(): void {\r\n this._thinEffectLayer._rebuild();\r\n }\r\n\r\n /**\r\n * Dispose only the render target textures and post process.\r\n */\r\n private _disposeTextureAndPostProcesses(): void {\r\n this._mainTexture.dispose();\r\n\r\n for (let i = 0; i < this._postProcesses.length; i++) {\r\n if (this._postProcesses[i]) {\r\n this._postProcesses[i].dispose();\r\n }\r\n }\r\n this._postProcesses = [];\r\n\r\n for (let i = 0; i < this._textures.length; i++) {\r\n if (this._textures[i]) {\r\n this._textures[i].dispose();\r\n }\r\n }\r\n this._textures = [];\r\n }\r\n\r\n /**\r\n * Dispose the highlight layer and free resources.\r\n */\r\n public dispose(): void {\r\n this._thinEffectLayer.dispose();\r\n\r\n // Clean textures and post processes\r\n this._disposeTextureAndPostProcesses();\r\n\r\n // Remove from scene\r\n const index = this._scene.effectLayers.indexOf(this, 0);\r\n if (index > -1) {\r\n this._scene.effectLayers.splice(index, 1);\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.clear();\r\n this.onBeforeRenderMainTextureObservable.clear();\r\n this.onBeforeComposeObservable.clear();\r\n this.onBeforeRenderMeshToEffect.clear();\r\n this.onAfterRenderMeshToEffect.clear();\r\n this.onAfterComposeObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n }\r\n\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n public getClassName(): string {\r\n return \"EffectLayer\";\r\n }\r\n\r\n /**\r\n * Creates an effect layer from parsed effect layer data\r\n * @param parsedEffectLayer defines effect layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the effect layer information\r\n * @returns a parsed effect Layer\r\n */\r\n public static Parse(parsedEffectLayer: any, scene: Scene, rootUrl: string): EffectLayer {\r\n const effectLayerType = Tools.Instantiate(parsedEffectLayer.customType);\r\n\r\n return effectLayerType.Parse(parsedEffectLayer, scene, rootUrl);\r\n }\r\n}\r\n"]}
|
|
@@ -75,16 +75,6 @@ export class CascadedShadowGenerator extends ShadowGenerator {
|
|
|
75
75
|
this._scbiMin.minimizeInPlace(boundingBox.minimumWorld);
|
|
76
76
|
this._scbiMax.maximizeInPlace(boundingBox.maximumWorld);
|
|
77
77
|
}
|
|
78
|
-
const meshes = this._scene.meshes;
|
|
79
|
-
for (let meshIndex = 0; meshIndex < meshes.length; meshIndex++) {
|
|
80
|
-
const mesh = meshes[meshIndex];
|
|
81
|
-
if (!mesh || !mesh.isVisible || !mesh.isEnabled || !mesh.receiveShadows) {
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
const boundingInfo = mesh.getBoundingInfo(), boundingBox = boundingInfo.boundingBox;
|
|
85
|
-
this._scbiMin.minimizeInPlace(boundingBox.minimumWorld);
|
|
86
|
-
this._scbiMax.maximizeInPlace(boundingBox.maximumWorld);
|
|
87
|
-
}
|
|
88
78
|
}
|
|
89
79
|
this._shadowCastersBoundingInfo.reConstruct(this._scbiMin, this._scbiMax);
|
|
90
80
|
}
|
|
@@ -376,22 +366,45 @@ export class CascadedShadowGenerator extends ShadowGenerator {
|
|
|
376
366
|
this._frustumCenter[cascadeIndex].addToRef(this._lightDirection.scale(this._cascadeMinExtents[cascadeIndex].z), this._shadowCameraPos[cascadeIndex]);
|
|
377
367
|
// Come up with a new orthographic camera for the shadow caster
|
|
378
368
|
Matrix.LookAtLHToRef(this._shadowCameraPos[cascadeIndex], this._frustumCenter[cascadeIndex], UpDir, this._viewMatrices[cascadeIndex]);
|
|
379
|
-
|
|
369
|
+
// Z extents of the current cascade, in cascade view coordinate system
|
|
370
|
+
let viewMinZ = 0, viewMaxZ = tmpv1.z;
|
|
380
371
|
// Try to tighten minZ and maxZ based on the bounding box of the shadow casters
|
|
381
372
|
const boundingInfo = this._shadowCastersBoundingInfo;
|
|
382
373
|
boundingInfo.update(this._viewMatrices[cascadeIndex]);
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
374
|
+
// Note that after the call to update, the boundingInfo properties that are identified as "world" coordinates are in fact view coordinates for the current cascade!
|
|
375
|
+
// This is because the boundingInfo properties that are identifed as "local" are in fact world coordinates (see _computeShadowCastersBoundingInfo()), and we multiply them by the current cascade view matrix when we call update.
|
|
376
|
+
const castersViewMinZ = boundingInfo.boundingBox.minimumWorld.z;
|
|
377
|
+
const castersViewMaxZ = boundingInfo.boundingBox.maximumWorld.z;
|
|
378
|
+
if (castersViewMinZ > viewMaxZ) {
|
|
379
|
+
// Do nothing, keep the current z extents.
|
|
380
|
+
// All the casters are too far from the light to have an impact on the current cascade.
|
|
381
|
+
// Possible optimization: skip the rendering of the shadow map for this cascade, as all the casters will be clipped by the GPU anyway.
|
|
387
382
|
}
|
|
388
383
|
else {
|
|
389
|
-
|
|
390
|
-
|
|
384
|
+
if (!this._depthClamp || this.filter === ShadowGenerator.FILTER_PCSS) {
|
|
385
|
+
// If we don't use depth clamping, we must define minZ so that all shadow casters are in the cascade frustum
|
|
386
|
+
viewMinZ = Math.min(viewMinZ, castersViewMinZ);
|
|
387
|
+
if (this.filter !== ShadowGenerator.FILTER_PCSS) {
|
|
388
|
+
// We do not need the actual distance between the currently shaded pixel and the occluder when generating shadows, so we can lower the far plane to increase the accuracy of the shadow map.
|
|
389
|
+
viewMaxZ = Math.min(viewMaxZ, castersViewMaxZ);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
// If we use depth clamping (but not PCSS!), we can adjust minZ/maxZ to reduce the range [minZ, maxZ] (and obtain additional precision in the shadow map)
|
|
394
|
+
viewMaxZ = Math.min(viewMaxZ, castersViewMaxZ);
|
|
395
|
+
// Thanks to depth clamping, casters won't be Z clipped even if they fall outside the [-1,1] range, so we can move the near plane to 0 if castersViewMinZ < 0.
|
|
396
|
+
// We will generate negative Z values in the shadow map, but that's okay (they will be clamped to the 0..1 range anyway), except in PCSS case
|
|
397
|
+
// where we need the actual distance between the currently shader pixel and the occluder: that's why we don't use depth clamping in PCSS case.
|
|
398
|
+
viewMinZ = Math.max(viewMinZ, castersViewMinZ);
|
|
399
|
+
// If all the casters are behind the near plane of the cascade, minZ = 0 due to the previous line, and maxZ < 0 at this point.
|
|
400
|
+
// We need to make sure that maxZ > minZ, so in this case we set maxZ a little higher than minZ. As we are using depth clamping, the casters won't be Z clipped, so we just need to make sure that we have a valid Z range for the cascade.
|
|
401
|
+
// Having a 0 range is not ok, due to undefined behavior in the calculation in this case.
|
|
402
|
+
viewMaxZ = Math.max(viewMinZ + 1.0, viewMaxZ);
|
|
403
|
+
}
|
|
391
404
|
}
|
|
392
|
-
Matrix.OrthoOffCenterLHToRef(this._cascadeMinExtents[cascadeIndex].x, this._cascadeMaxExtents[cascadeIndex].x, this._cascadeMinExtents[cascadeIndex].y, this._cascadeMaxExtents[cascadeIndex].y, useReverseDepthBuffer ?
|
|
393
|
-
this._cascadeMinExtents[cascadeIndex].z =
|
|
394
|
-
this._cascadeMaxExtents[cascadeIndex].z =
|
|
405
|
+
Matrix.OrthoOffCenterLHToRef(this._cascadeMinExtents[cascadeIndex].x, this._cascadeMaxExtents[cascadeIndex].x, this._cascadeMinExtents[cascadeIndex].y, this._cascadeMaxExtents[cascadeIndex].y, useReverseDepthBuffer ? viewMaxZ : viewMinZ, useReverseDepthBuffer ? viewMinZ : viewMaxZ, this._projectionMatrices[cascadeIndex], scene.getEngine().isNDCHalfZRange);
|
|
406
|
+
this._cascadeMinExtents[cascadeIndex].z = viewMinZ;
|
|
407
|
+
this._cascadeMaxExtents[cascadeIndex].z = viewMaxZ;
|
|
395
408
|
this._viewMatrices[cascadeIndex].multiplyToRef(this._projectionMatrices[cascadeIndex], this._transformMatrices[cascadeIndex]);
|
|
396
409
|
// Create the rounding matrix, by projecting the world-space origin and determining
|
|
397
410
|
// the fractional offset in texel space
|