@babylonjs/core 7.51.2 → 7.51.3
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/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 +7 -1
- package/Engines/abstractEngine.js +10 -2
- package/Engines/abstractEngine.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/Loading/sceneLoader.d.ts +25 -11
- package/Loading/sceneLoader.js +28 -11
- package/Loading/sceneLoader.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/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/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,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,CAA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AAoC,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,0BAA0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AAO,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;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;I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CAAC,CAAC,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;QAED,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC,mCAAmC,CAAC,KAAK,EAAE,CAAC;QACjD,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QACvC,IAAI,CAAC,0BAA0B,CAAC,KAAK,EAAE,CAAC;QACxC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QACvC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QACtC,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,aAAa,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,iBAAsB,EAAE,KAAY,EAAE,OAAe;QACrE,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAExE,OAAO,eAAe,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;;AA/aD;;GAEG;AACW,yCAA6B,GAA2B,CAAC,CAAC,EAAE,EAAE;IACxE,MAAM,WAAW,CAAC,2BAA2B,CAAC,CAAC;AACnD,CAAC,AAF0C,CAEzC;AAzHF;IADC,SAAS,EAAE;uCAGX;AAUD;IADC,iBAAiB,EAAE;+CAGnB;AAUD;IADC,SAAS,EAAE;4CAGX;AAUD;IADC,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,SA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AC,CAAC,CAAC;QAC9C,CAAC;QAED,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC,mCAAmC,CAAC,KAAK,EAAE,CAAC;QACjD,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QACvC,IAAI,CAAC,0BAA0B,CAAC,KAAK,EAAE,CAAC;QACxC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QACvC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QACtC,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,aAAa,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,iBAAsB,EAAE,KAAY,EAAE,OAAe;QACrE,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAExE,OAAO,eAAe,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;;AAvbD;;GAEG;AACW,yCAA6B,GAA2B,CAAC,CAAC,EAAE,EAAE;IACxE,MAAM,WAAW,CAAC,2BAA2B,CAAC,CAAC;AACnD,CAAC,AAF0C,CAEzC;AAzHF;IADC,SAAS,EAAE;uCAGX;AAUD;IADC,iBAAiB,EAAE;+CAGnB;AAUD;IADC,SAAS,EAAE;4CAGX;AAUD;IADC,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 * 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"]}
|
package/Loading/sceneLoader.d.ts
CHANGED
|
@@ -354,7 +354,7 @@ export interface ImportAnimationsOptions extends SceneLoaderOptions {
|
|
|
354
354
|
export declare function RegisterSceneLoaderPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory): void;
|
|
355
355
|
/**
|
|
356
356
|
* Adds a new plugin to the list of registered plugins
|
|
357
|
-
* @deprecated Please use
|
|
357
|
+
* @deprecated Please use {@link RegisterSceneLoaderPlugin} instead.
|
|
358
358
|
* @param plugin defines the plugin to add
|
|
359
359
|
*/
|
|
360
360
|
export declare function registerSceneLoaderPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory): void;
|
|
@@ -373,6 +373,14 @@ export declare function GetRegisteredSceneLoaderPluginMetadata(): DeepImmutable<
|
|
|
373
373
|
extension: string;
|
|
374
374
|
} & ISceneLoaderPluginExtensions[string])[];
|
|
375
375
|
}>>;
|
|
376
|
+
/**
|
|
377
|
+
* Import meshes into a scene
|
|
378
|
+
* @param source a string that defines the name of the scene file, or starts with "data:" following by the stringified version of the scene, or a File object, or an ArrayBufferView
|
|
379
|
+
* @param scene the instance of BABYLON.Scene to append to
|
|
380
|
+
* @param options an object that configures aspects of how the scene is loaded
|
|
381
|
+
* @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups
|
|
382
|
+
*/
|
|
383
|
+
export declare function ImportMeshAsync(source: SceneSource, scene: Scene, options?: ImportMeshOptions): Promise<ISceneLoaderAsyncResult>;
|
|
376
384
|
/**
|
|
377
385
|
* Load a scene
|
|
378
386
|
* @param source a string that defines the name of the scene file, or starts with "data:" following by the stringified version of the scene, or a File object, or an ArrayBufferView
|
|
@@ -383,7 +391,7 @@ export declare function GetRegisteredSceneLoaderPluginMetadata(): DeepImmutable<
|
|
|
383
391
|
export declare function LoadSceneAsync(source: SceneSource, engine: AbstractEngine, options?: LoadOptions): Promise<Scene>;
|
|
384
392
|
/**
|
|
385
393
|
* Load a scene
|
|
386
|
-
* @deprecated Please use
|
|
394
|
+
* @deprecated Please use {@link LoadSceneAsync} instead.
|
|
387
395
|
* @param source a string that defines the name of the scene file, or starts with "data:" following by the stringified version of the scene, or a File object, or an ArrayBufferView
|
|
388
396
|
* @param engine is the instance of BABYLON.Engine to use to create the scene
|
|
389
397
|
* @param options an object that configures aspects of how the scene is loaded
|
|
@@ -400,7 +408,7 @@ export declare function loadSceneAsync(source: SceneSource, engine: AbstractEngi
|
|
|
400
408
|
export declare function AppendSceneAsync(source: SceneSource, scene: Scene, options?: AppendOptions): Promise<void>;
|
|
401
409
|
/**
|
|
402
410
|
* Append a scene
|
|
403
|
-
* @deprecated Please use
|
|
411
|
+
* @deprecated Please use {@link AppendSceneAsync} instead.
|
|
404
412
|
* @param source a string that defines the name of the scene file, or starts with "data:" following by the stringified version of the scene, or a File object, or an ArrayBufferView
|
|
405
413
|
* @param scene is the instance of BABYLON.Scene to append to
|
|
406
414
|
* @param options an object that configures aspects of how the scene is loaded
|
|
@@ -417,7 +425,7 @@ export declare function appendSceneAsync(source: SceneSource, scene: Scene, opti
|
|
|
417
425
|
export declare function LoadAssetContainerAsync(source: SceneSource, scene: Scene, options?: LoadAssetContainerOptions): Promise<AssetContainer>;
|
|
418
426
|
/**
|
|
419
427
|
* Load a scene into an asset container
|
|
420
|
-
* @deprecated Please use
|
|
428
|
+
* @deprecated Please use {@link LoadAssetContainerAsync} instead.
|
|
421
429
|
* @param source a string that defines the name of the scene file, or starts with "data:" following by the stringified version of the scene, or a File object, or an ArrayBufferView
|
|
422
430
|
* @param scene is the instance of Scene to append to
|
|
423
431
|
* @param options an object that configures aspects of how the scene is loaded
|
|
@@ -434,7 +442,7 @@ export declare function loadAssetContainerAsync(source: SceneSource, scene: Scen
|
|
|
434
442
|
export declare function ImportAnimationsAsync(source: SceneSource, scene: Scene, options?: ImportAnimationsOptions): Promise<void>;
|
|
435
443
|
/**
|
|
436
444
|
* Import animations from a file into a scene
|
|
437
|
-
* @deprecated Please use
|
|
445
|
+
* @deprecated Please use {@link ImportAnimationsAsync} instead.
|
|
438
446
|
* @param source a string that defines the name of the scene file, or starts with "data:" following by the stringified version of the scene, or a File object, or an ArrayBufferView
|
|
439
447
|
* @param scene is the instance of BABYLON.Scene to append to
|
|
440
448
|
* @param options an object that configures aspects of how the scene is loaded
|
|
@@ -444,7 +452,8 @@ export declare function importAnimationsAsync(source: SceneSource, scene: Scene,
|
|
|
444
452
|
/**
|
|
445
453
|
* Class used to load scene from various file formats using registered plugins
|
|
446
454
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes
|
|
447
|
-
* @deprecated The module level functions
|
|
455
|
+
* @deprecated The module level functions are more efficient for bundler tree shaking and allow plugin options to be passed through. Future improvements to scene loading will primarily be in the module level functions. The SceneLoader class will remain available, but it will be beneficial to prefer the module level functions.
|
|
456
|
+
* @see {@link ImportMeshAsync}, {@link LoadSceneAsync}, {@link AppendSceneAsync}, {@link ImportAnimationsAsync}, {@link LoadAssetContainerAsync}
|
|
448
457
|
*/
|
|
449
458
|
export declare class SceneLoader {
|
|
450
459
|
/**
|
|
@@ -521,7 +530,7 @@ export declare class SceneLoader {
|
|
|
521
530
|
* @param onError a callback with the scene, a message, and possibly an exception when import fails
|
|
522
531
|
* @param pluginExtension the extension used to determine the plugin
|
|
523
532
|
* @param name defines the name of the file, if the data is binary
|
|
524
|
-
* @deprecated Please use ImportMeshAsync instead
|
|
533
|
+
* @deprecated Please use the module level {@link ImportMeshAsync} instead
|
|
525
534
|
*/
|
|
526
535
|
static ImportMesh(meshNames: string | readonly string[] | null | undefined, rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onSuccess?: Nullable<SceneLoaderSuccessCallback>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): void;
|
|
527
536
|
/**
|
|
@@ -534,6 +543,7 @@ export declare class SceneLoader {
|
|
|
534
543
|
* @param pluginExtension the extension used to determine the plugin
|
|
535
544
|
* @param name defines the name of the file
|
|
536
545
|
* @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups
|
|
546
|
+
* @deprecated Please use the module level {@link ImportMeshAsync} instead
|
|
537
547
|
*/
|
|
538
548
|
static ImportMeshAsync(meshNames: string | readonly string[] | null | undefined, rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, pluginExtension?: Nullable<string>, name?: string): Promise<ISceneLoaderAsyncResult>;
|
|
539
549
|
/**
|
|
@@ -546,7 +556,7 @@ export declare class SceneLoader {
|
|
|
546
556
|
* @param onError a callback with the scene, a message, and possibly an exception when import fails
|
|
547
557
|
* @param pluginExtension the extension used to determine the plugin
|
|
548
558
|
* @param name defines the filename, if the data is binary
|
|
549
|
-
* @deprecated Please use
|
|
559
|
+
* @deprecated Please use the module level {@link LoadSceneAsync} instead
|
|
550
560
|
*/
|
|
551
561
|
static Load(rootUrl: string, sceneFilename?: SceneSource, engine?: Nullable<AbstractEngine>, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): void;
|
|
552
562
|
/**
|
|
@@ -558,6 +568,7 @@ export declare class SceneLoader {
|
|
|
558
568
|
* @param pluginExtension the extension used to determine the plugin
|
|
559
569
|
* @param name defines the filename, if the data is binary
|
|
560
570
|
* @returns The loaded scene
|
|
571
|
+
* @deprecated Please use the module level {@link LoadSceneAsync} instead
|
|
561
572
|
*/
|
|
562
573
|
static LoadAsync(rootUrl: string, sceneFilename?: SceneSource, engine?: Nullable<AbstractEngine>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, pluginExtension?: Nullable<string>, name?: string): Promise<Scene>;
|
|
563
574
|
/**
|
|
@@ -570,7 +581,7 @@ export declare class SceneLoader {
|
|
|
570
581
|
* @param onError a callback with the scene, a message, and possibly an exception when import fails
|
|
571
582
|
* @param pluginExtension the extension used to determine the plugin
|
|
572
583
|
* @param name defines the name of the file, if the data is binary
|
|
573
|
-
* @deprecated Please use
|
|
584
|
+
* @deprecated Please use the module level {@link AppendSceneAsync} instead
|
|
574
585
|
*/
|
|
575
586
|
static Append(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): void;
|
|
576
587
|
/**
|
|
@@ -582,6 +593,7 @@ export declare class SceneLoader {
|
|
|
582
593
|
* @param pluginExtension the extension used to determine the plugin
|
|
583
594
|
* @param name defines the name of the file, if the data is binary
|
|
584
595
|
* @returns The given scene
|
|
596
|
+
* @deprecated Please use the module level {@link AppendSceneAsync} instead
|
|
585
597
|
*/
|
|
586
598
|
static AppendAsync(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, pluginExtension?: Nullable<string>, name?: string): Promise<Scene>;
|
|
587
599
|
/**
|
|
@@ -594,7 +606,7 @@ export declare class SceneLoader {
|
|
|
594
606
|
* @param onError a callback with the scene, a message, and possibly an exception when import fails
|
|
595
607
|
* @param pluginExtension the extension used to determine the plugin
|
|
596
608
|
* @param name defines the filename, if the data is binary
|
|
597
|
-
* @deprecated Please use LoadAssetContainerAsync instead
|
|
609
|
+
* @deprecated Please use the module level {@link LoadAssetContainerAsync} instead
|
|
598
610
|
*/
|
|
599
611
|
static LoadAssetContainer(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onSuccess?: Nullable<(assets: AssetContainer) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): void;
|
|
600
612
|
/**
|
|
@@ -606,6 +618,7 @@ export declare class SceneLoader {
|
|
|
606
618
|
* @param pluginExtension the extension used to determine the plugin
|
|
607
619
|
* @param name defines the filename, if the data is binary
|
|
608
620
|
* @returns The loaded asset container
|
|
621
|
+
* @deprecated Please use the module level {@link LoadAssetContainerAsync} instead
|
|
609
622
|
*/
|
|
610
623
|
static LoadAssetContainerAsync(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, pluginExtension?: Nullable<string>, name?: string): Promise<AssetContainer>;
|
|
611
624
|
/**
|
|
@@ -621,7 +634,7 @@ export declare class SceneLoader {
|
|
|
621
634
|
* @param onError a callback with the scene, a message, and possibly an exception when import fails
|
|
622
635
|
* @param pluginExtension the extension used to determine the plugin
|
|
623
636
|
* @param name defines the filename, if the data is binary
|
|
624
|
-
* @deprecated Please use ImportAnimationsAsync instead
|
|
637
|
+
* @deprecated Please use the module level {@link ImportAnimationsAsync} instead
|
|
625
638
|
*/
|
|
626
639
|
static ImportAnimations(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, overwriteAnimations?: boolean, animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode, targetConverter?: Nullable<(target: any) => any>, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): void;
|
|
627
640
|
/**
|
|
@@ -638,6 +651,7 @@ export declare class SceneLoader {
|
|
|
638
651
|
* @param pluginExtension the extension used to determine the plugin
|
|
639
652
|
* @param name defines the filename, if the data is binary
|
|
640
653
|
* @returns the updated scene with imported animations
|
|
654
|
+
* @deprecated Please use the module level {@link ImportAnimationsAsync} instead
|
|
641
655
|
*/
|
|
642
656
|
static ImportAnimationsAsync(rootUrl: string, sceneFilename?: SceneSource, scene?: Nullable<Scene>, overwriteAnimations?: boolean, animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode, targetConverter?: Nullable<(target: any) => any>, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>, name?: string): Promise<Scene>;
|
|
643
657
|
}
|