@babylonjs/core 8.45.1 → 8.45.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cameras/Inputs/index.d.ts +1 -0
- package/Cameras/Inputs/index.js +1 -0
- package/Cameras/Inputs/index.js.map +1 -1
- package/Engines/Extensions/engine.debugging.d.ts +4 -0
- package/Engines/Extensions/engine.debugging.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -1
- package/FrameGraph/frameGraphContext.js +3 -3
- package/FrameGraph/frameGraphContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.js +4 -4
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +3 -3
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/lightingVolume.js +6 -6
- package/Lights/lightingVolume.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +2 -1
- package/Materials/PBR/pbrBaseMaterial.js +1 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +2 -0
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +8 -4
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +2 -2
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Misc/minMaxReducer.js +2 -2
- package/Misc/minMaxReducer.js.map +1 -1
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.js +2 -0
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateRemapBlock.d.ts +39 -0
- package/Particles/Node/Blocks/Update/updateRemapBlock.js +93 -0
- package/Particles/Node/Blocks/Update/updateRemapBlock.js.map +1 -0
- package/Particles/Node/nodeParticleSystemSet.helper.js +70 -0
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Probes/reflectionProbe.js +2 -2
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/depthRenderer.js +2 -2
- package/Rendering/depthRenderer.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.d.ts +30 -1
- package/XR/features/WebXRControllerPhysics.js +269 -16
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +36 -2
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { NodeParticleConnectionPoint } from "../../nodeParticleBlockConnectionPoint.js";
|
|
2
|
+
import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
|
|
3
|
+
import { NodeParticleBlock } from "../../nodeParticleBlock.js";
|
|
4
|
+
/**
|
|
5
|
+
* Block used to update the remap value of a particle
|
|
6
|
+
*/
|
|
7
|
+
export declare class UpdateRemapBlock extends NodeParticleBlock {
|
|
8
|
+
/**
|
|
9
|
+
* Create a new UpdateRemapBlock
|
|
10
|
+
* @param name defines the block name
|
|
11
|
+
*/
|
|
12
|
+
constructor(name: string);
|
|
13
|
+
/**
|
|
14
|
+
* Gets the particle component
|
|
15
|
+
*/
|
|
16
|
+
get particle(): NodeParticleConnectionPoint;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the remapColor input component
|
|
19
|
+
*/
|
|
20
|
+
get remapColor(): NodeParticleConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the remapAlpha input component
|
|
23
|
+
*/
|
|
24
|
+
get remapAlpha(): NodeParticleConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the output component
|
|
27
|
+
*/
|
|
28
|
+
get output(): NodeParticleConnectionPoint;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the current class name
|
|
31
|
+
* @returns the class name
|
|
32
|
+
*/
|
|
33
|
+
getClassName(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Builds the block
|
|
36
|
+
* @param state defines the current build state
|
|
37
|
+
*/
|
|
38
|
+
_build(state: NodeParticleBuildState): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Vector2, Vector4 } from "../../../../Maths/math.vector.js";
|
|
2
|
+
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeParticleBlock } from "../../nodeParticleBlock.js";
|
|
4
|
+
import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
5
|
+
import { _ConnectAtTheEnd } from "../../../Queue/executionQueue.js";
|
|
6
|
+
/**
|
|
7
|
+
* Block used to update the remap value of a particle
|
|
8
|
+
*/
|
|
9
|
+
export class UpdateRemapBlock extends NodeParticleBlock {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new UpdateRemapBlock
|
|
12
|
+
* @param name defines the block name
|
|
13
|
+
*/
|
|
14
|
+
constructor(name) {
|
|
15
|
+
super(name);
|
|
16
|
+
this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
|
|
17
|
+
this.registerInput("remapColor", NodeParticleBlockConnectionPointTypes.Vector2, true);
|
|
18
|
+
this.registerInput("remapAlpha", NodeParticleBlockConnectionPointTypes.Vector2, true);
|
|
19
|
+
this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Gets the particle component
|
|
23
|
+
*/
|
|
24
|
+
get particle() {
|
|
25
|
+
return this._inputs[0];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets the remapColor input component
|
|
29
|
+
*/
|
|
30
|
+
get remapColor() {
|
|
31
|
+
return this._inputs[1];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Gets the remapAlpha input component
|
|
35
|
+
*/
|
|
36
|
+
get remapAlpha() {
|
|
37
|
+
return this._inputs[2];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Gets the output component
|
|
41
|
+
*/
|
|
42
|
+
get output() {
|
|
43
|
+
return this._outputs[0];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets the current class name
|
|
47
|
+
* @returns the class name
|
|
48
|
+
*/
|
|
49
|
+
getClassName() {
|
|
50
|
+
return "UpdateRemapBlock";
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Builds the block
|
|
54
|
+
* @param state defines the current build state
|
|
55
|
+
*/
|
|
56
|
+
_build(state) {
|
|
57
|
+
const system = this.particle.getConnectedValue(state);
|
|
58
|
+
this.output._storedValue = system;
|
|
59
|
+
if (!this.remapColor.isConnected && !this.remapAlpha.isConnected) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const processRemap = (particle) => {
|
|
63
|
+
state.particleContext = particle;
|
|
64
|
+
state.systemContext = system;
|
|
65
|
+
const colorRemap = this.remapColor.isConnected ? this.remapColor.getConnectedValue(state) : new Vector2(0, 1);
|
|
66
|
+
const alphaRemap = this.remapAlpha.isConnected ? this.remapAlpha.getConnectedValue(state) : new Vector2(0, 1);
|
|
67
|
+
if (!particle.remapData) {
|
|
68
|
+
particle.remapData = new Vector4(0, 1, 0, 1);
|
|
69
|
+
}
|
|
70
|
+
if (colorRemap) {
|
|
71
|
+
particle.remapData.x = colorRemap.x;
|
|
72
|
+
particle.remapData.y = colorRemap.y;
|
|
73
|
+
}
|
|
74
|
+
if (alphaRemap) {
|
|
75
|
+
particle.remapData.z = alphaRemap.x;
|
|
76
|
+
particle.remapData.w = alphaRemap.y;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const remapProcessing = {
|
|
80
|
+
process: processRemap,
|
|
81
|
+
previousItem: null,
|
|
82
|
+
nextItem: null,
|
|
83
|
+
};
|
|
84
|
+
if (system._updateQueueStart) {
|
|
85
|
+
_ConnectAtTheEnd(remapProcessing, system._updateQueueStart);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
system._updateQueueStart = remapProcessing;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
RegisterClass("BABYLON.UpdateRemapBlock", UpdateRemapBlock);
|
|
93
|
+
//# sourceMappingURL=updateRemapBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateRemapBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateRemapBlock.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\n\r\nimport { Vector2, Vector4 } from \"../../../../Maths/math.vector\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to update the remap value of a particle\r\n */\r\nexport class UpdateRemapBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateRemapBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"remapColor\", NodeParticleBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"remapAlpha\", NodeParticleBlockConnectionPointTypes.Vector2, true);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the remapColor input component\r\n */\r\n public get remapColor(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the remapAlpha input component\r\n */\r\n public get remapAlpha(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"UpdateRemapBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n\r\n this.output._storedValue = system;\r\n\r\n if (!this.remapColor.isConnected && !this.remapAlpha.isConnected) {\r\n return;\r\n }\r\n\r\n const processRemap = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n const colorRemap = this.remapColor.isConnected ? (this.remapColor.getConnectedValue(state) as Vector2) : new Vector2(0, 1);\r\n const alphaRemap = this.remapAlpha.isConnected ? (this.remapAlpha.getConnectedValue(state) as Vector2) : new Vector2(0, 1);\r\n\r\n if (!particle.remapData) {\r\n particle.remapData = new Vector4(0, 1, 0, 1);\r\n }\r\n\r\n if (colorRemap) {\r\n particle.remapData.x = colorRemap.x;\r\n particle.remapData.y = colorRemap.y;\r\n }\r\n\r\n if (alphaRemap) {\r\n particle.remapData.z = alphaRemap.x;\r\n particle.remapData.w = alphaRemap.y;\r\n }\r\n };\r\n\r\n const remapProcessing = {\r\n process: processRemap,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(remapProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = remapProcessing;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateRemapBlock\", UpdateRemapBlock);\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Color4 } from "../../Maths/math.color.js";
|
|
2
2
|
import { Vector2, Vector3 } from "../../Maths/math.vector.js";
|
|
3
|
+
import { FactorGradient } from "../../Misc/gradients.js";
|
|
3
4
|
import { NodeParticleBlockConnectionPointTypes } from "./Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
4
5
|
import { NodeParticleSystemSet } from "./nodeParticleSystemSet.js";
|
|
5
6
|
import { NodeParticleContextualSources } from "./Enums/nodeParticleContextualSources.js";
|
|
@@ -31,6 +32,7 @@ import { UpdateDirectionBlock } from "./Blocks/Update/updateDirectionBlock.js";
|
|
|
31
32
|
import { UpdateNoiseBlock } from "./Blocks/Update/updateNoiseBlock.js";
|
|
32
33
|
import { UpdatePositionBlock } from "./Blocks/Update/updatePositionBlock.js";
|
|
33
34
|
import { UpdateSizeBlock } from "./Blocks/Update/updateSizeBlock.js";
|
|
35
|
+
import { UpdateRemapBlock } from "./Blocks/Update/updateRemapBlock.js";
|
|
34
36
|
/**
|
|
35
37
|
* Converts a ParticleSystem to a NodeParticleSystemSet.
|
|
36
38
|
* @param name The name of the node particle system set.
|
|
@@ -378,6 +380,9 @@ function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
|
|
|
378
380
|
if (oldSystem.gravity.equalsToFloats(0, 0, 0) === false) {
|
|
379
381
|
updatedParticle = _UpdateParticleGravityBlockGroup(updatedParticle, oldSystem.gravity);
|
|
380
382
|
}
|
|
383
|
+
if (oldSystem.useRampGradients) {
|
|
384
|
+
updatedParticle = _UpdateParticleRemapGradientBlockGroup(updatedParticle, oldSystem.getColorRemapGradients(), oldSystem.getAlphaRemapGradients(), context);
|
|
385
|
+
}
|
|
381
386
|
if (oldSystem.isAnimationSheetEnabled) {
|
|
382
387
|
updatedParticle = _UpdateParticleSpriteCellBlockGroup(updatedParticle);
|
|
383
388
|
}
|
|
@@ -619,6 +624,71 @@ function _UpdateParticleGravityBlockGroup(inputParticle, gravity) {
|
|
|
619
624
|
addDirectionBlock.output.connectTo(updateDirection.direction);
|
|
620
625
|
return updateDirection.output;
|
|
621
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* Creates the group of blocks that represent the color and alpha remap update
|
|
629
|
+
* @param inputParticle The input particle to update
|
|
630
|
+
* @param colorRemapGradients The color remap gradients
|
|
631
|
+
* @param alphaRemapGradients The alpha remap gradients
|
|
632
|
+
* @param context The context of the current conversion
|
|
633
|
+
* @returns The ouput of the group of blocks that represent the particle remap update
|
|
634
|
+
*/
|
|
635
|
+
function _UpdateParticleRemapGradientBlockGroup(inputParticle, colorRemapGradients, alphaRemapGradients, context) {
|
|
636
|
+
let hasUpdate = false;
|
|
637
|
+
const remapUpdateBlock = new UpdateRemapBlock("Remap Update");
|
|
638
|
+
if (colorRemapGradients && colorRemapGradients.length > 0) {
|
|
639
|
+
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
640
|
+
// Split the color gradient into factor1 and factor2 gradients
|
|
641
|
+
const colorFactor1Gradients = [];
|
|
642
|
+
const colorFactor2Gradients = [];
|
|
643
|
+
for (let i = 0; i < colorRemapGradients.length; i++) {
|
|
644
|
+
const gradientValue = colorRemapGradients[i];
|
|
645
|
+
colorFactor1Gradients.push(new FactorGradient(gradientValue.gradient, gradientValue.factor1));
|
|
646
|
+
colorFactor2Gradients.push(new FactorGradient(gradientValue.gradient, gradientValue.factor2));
|
|
647
|
+
}
|
|
648
|
+
// Generate the gradient
|
|
649
|
+
const colorFactor1BlockGroup = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, colorFactor1Gradients, ParticleRandomBlockLocks.OncePerParticle, "Color Min");
|
|
650
|
+
// Generate the gradient
|
|
651
|
+
const colorFactor2BlockGroup = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, colorFactor2Gradients, ParticleRandomBlockLocks.OncePerParticle, "Color Max");
|
|
652
|
+
const substractBlock = new ParticleMathBlock("Color Max - Min");
|
|
653
|
+
substractBlock.operation = ParticleMathBlockOperations.Subtract;
|
|
654
|
+
colorFactor2BlockGroup.connectTo(substractBlock.left);
|
|
655
|
+
colorFactor1BlockGroup.connectTo(substractBlock.right);
|
|
656
|
+
const colorConverterBlock = new ParticleConverterBlock("Color Remap Converter");
|
|
657
|
+
colorFactor1BlockGroup.connectTo(colorConverterBlock.xIn);
|
|
658
|
+
substractBlock.output.connectTo(colorConverterBlock.yIn);
|
|
659
|
+
colorConverterBlock.xyOut.connectTo(remapUpdateBlock.remapColor);
|
|
660
|
+
hasUpdate = true;
|
|
661
|
+
}
|
|
662
|
+
if (alphaRemapGradients && alphaRemapGradients.length > 0) {
|
|
663
|
+
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
664
|
+
// Split the color gradient into factor1 and factor2 gradients
|
|
665
|
+
const alphaFactor1Gradients = [];
|
|
666
|
+
const alphaFactor2Gradients = [];
|
|
667
|
+
for (let i = 0; i < alphaRemapGradients.length; i++) {
|
|
668
|
+
const gradientValue = alphaRemapGradients[i];
|
|
669
|
+
alphaFactor1Gradients.push(new FactorGradient(gradientValue.gradient, gradientValue.factor1));
|
|
670
|
+
alphaFactor2Gradients.push(new FactorGradient(gradientValue.gradient, gradientValue.factor2));
|
|
671
|
+
}
|
|
672
|
+
// Generate the gradient
|
|
673
|
+
const alphaFactor1BlockGroup = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, alphaFactor1Gradients, ParticleRandomBlockLocks.OncePerParticle, "Alpha Min");
|
|
674
|
+
// Generate the gradient
|
|
675
|
+
const alphaFactor2BlockGroup = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, alphaFactor2Gradients, ParticleRandomBlockLocks.OncePerParticle, "Alpha Max");
|
|
676
|
+
const substractBlock = new ParticleMathBlock("Alpha Max - Min");
|
|
677
|
+
substractBlock.operation = ParticleMathBlockOperations.Subtract;
|
|
678
|
+
alphaFactor2BlockGroup.connectTo(substractBlock.left);
|
|
679
|
+
alphaFactor1BlockGroup.connectTo(substractBlock.right);
|
|
680
|
+
const alphaConverterBlock = new ParticleConverterBlock("Alpha Remap Converter");
|
|
681
|
+
alphaFactor1BlockGroup.connectTo(alphaConverterBlock.xIn);
|
|
682
|
+
substractBlock.output.connectTo(alphaConverterBlock.yIn);
|
|
683
|
+
alphaConverterBlock.xyOut.connectTo(remapUpdateBlock.remapAlpha);
|
|
684
|
+
hasUpdate = true;
|
|
685
|
+
}
|
|
686
|
+
if (hasUpdate) {
|
|
687
|
+
inputParticle.connectTo(remapUpdateBlock.particle);
|
|
688
|
+
return remapUpdateBlock.output;
|
|
689
|
+
}
|
|
690
|
+
return inputParticle;
|
|
691
|
+
}
|
|
622
692
|
/**
|
|
623
693
|
* Creates the group of blocks that represent the particle sprite cell update
|
|
624
694
|
* @param inputParticle The input particle to update
|