@babylonjs/core 6.37.0 → 6.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Behaviors/Cameras/bouncingBehavior.js +8 -6
- package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
- package/Behaviors/Cameras/framingBehavior.js +3 -3
- package/Behaviors/Cameras/framingBehavior.js.map +1 -1
- package/Behaviors/Meshes/baseSixDofDragBehavior.js +1 -1
- package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
- package/Behaviors/Meshes/sixDofDragBehavior.js +26 -6
- package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
- package/Bones/skeleton.js +2 -2
- package/Bones/skeleton.js.map +1 -1
- package/Buffers/buffer.align.js +4 -1
- package/Buffers/buffer.align.js.map +1 -1
- package/Buffers/buffer.d.ts +10 -3
- package/Buffers/buffer.js +34 -5
- package/Buffers/buffer.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +9 -8
- package/Cameras/arcRotateCamera.js +5 -5
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.d.ts +1 -3
- package/Engines/Extensions/engine.cubeTexture.js +1 -3
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +6 -17
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +11 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js +27 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js +8 -4
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +3 -0
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/renderTargetWrapper.js +7 -1
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +3 -3
- package/Engines/thinEngine.js +16 -8
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +2 -2
- package/Engines/webgpuEngine.js +7 -12
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.js +1 -1
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/cameraGizmo.d.ts +9 -2
- package/Gizmos/cameraGizmo.js +29 -10
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Lights/shadowLight.d.ts +2 -2
- package/Lights/shadowLight.js +1 -1
- package/Lights/shadowLight.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +1 -1
- package/Materials/Textures/baseTexture.js +1 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.js +5 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +1 -1
- package/Materials/Textures/multiRenderTarget.js +4 -4
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/videoTexture.js +2 -0
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/materialPluginManager.d.ts +1 -1
- package/Materials/materialPluginManager.js.map +1 -1
- package/Meshes/Builders/groundBuilder.d.ts +57 -91
- package/Meshes/Builders/groundBuilder.js +57 -91
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/Node/Blocks/geometryArcTan2Block.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryArcTan2Block.js +81 -0
- package/Meshes/Node/Blocks/geometryArcTan2Block.js.map +1 -0
- package/Meshes/Node/Blocks/geometryClampBlock.d.ts +33 -0
- package/Meshes/Node/Blocks/geometryClampBlock.js +101 -0
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryCrossBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryCrossBlock.js +76 -0
- package/Meshes/Node/Blocks/geometryCrossBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryLerpBlock.d.ts +34 -0
- package/Meshes/Node/Blocks/geometryLerpBlock.js +90 -0
- package/Meshes/Node/Blocks/geometryLerpBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryModBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryModBlock.js +82 -0
- package/Meshes/Node/Blocks/geometryModBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryNLerpBlock.d.ts +34 -0
- package/Meshes/Node/Blocks/geometryNLerpBlock.js +96 -0
- package/Meshes/Node/Blocks/geometryNLerpBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryPowBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryPowBlock.js +82 -0
- package/Meshes/Node/Blocks/geometryPowBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.d.ts +34 -0
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.js +91 -0
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryStepBlock.d.ts +30 -0
- package/Meshes/Node/Blocks/geometryStepBlock.js +84 -0
- package/Meshes/Node/Blocks/geometryStepBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.d.ts +19 -15
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +37 -17
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/index.d.ts +9 -0
- package/Meshes/Node/index.js +9 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/geometry.js +8 -5
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/thinInstanceMesh.d.ts +1 -1
- package/Meshes/thinInstanceMesh.js +2 -2
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +1 -0
- package/Particles/gpuParticleSystem.js +10 -3
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Rendering/GaussianSplatting/gaussianSplatting.d.ts +6 -0
- package/Rendering/GaussianSplatting/gaussianSplatting.js +124 -39
- package/Rendering/GaussianSplatting/gaussianSplatting.js.map +1 -1
- package/Rendering/GlobalIllumination/giRSM.d.ts +54 -0
- package/Rendering/GlobalIllumination/giRSM.js +54 -0
- package/Rendering/GlobalIllumination/giRSM.js.map +1 -0
- package/Rendering/GlobalIllumination/giRSMManager.d.ts +256 -0
- package/Rendering/GlobalIllumination/giRSMManager.js +715 -0
- package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -0
- package/Rendering/GlobalIllumination/index.d.ts +2 -0
- package/Rendering/GlobalIllumination/index.js +3 -0
- package/Rendering/GlobalIllumination/index.js.map +1 -0
- package/Rendering/fluidRenderer/fluidRenderer.js +20 -1
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Rendering/index.d.ts +2 -0
- package/Rendering/index.js +2 -0
- package/Rendering/index.js.map +1 -1
- package/Rendering/prePassRendererSceneComponent.js +1 -4
- package/Rendering/prePassRendererSceneComponent.js.map +1 -1
- package/Rendering/reflectiveShadowMap.d.ts +152 -0
- package/Rendering/reflectiveShadowMap.js +389 -0
- package/Rendering/reflectiveShadowMap.js.map +1 -0
- package/Shaders/bilateralBlur.fragment.d.ts +5 -0
- package/Shaders/bilateralBlur.fragment.js +20 -0
- package/Shaders/bilateralBlur.fragment.js.map +1 -0
- package/Shaders/bilateralBlurQuality.fragment.d.ts +5 -0
- package/Shaders/bilateralBlurQuality.fragment.js +20 -0
- package/Shaders/bilateralBlurQuality.fragment.js.map +1 -0
- package/Shaders/rsmFullGlobalIllumination.fragment.d.ts +5 -0
- package/Shaders/rsmFullGlobalIllumination.fragment.js +28 -0
- package/Shaders/rsmFullGlobalIllumination.fragment.js.map +1 -0
- package/Shaders/rsmGlobalIllumination.fragment.d.ts +5 -0
- package/Shaders/rsmGlobalIllumination.fragment.js +33 -0
- package/Shaders/rsmGlobalIllumination.fragment.js.map +1 -0
- package/XR/features/WebXRControllerTeleportation.d.ts +9 -1
- package/XR/features/WebXRControllerTeleportation.js +3 -0
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/webXRCamera.d.ts +2 -0
- package/XR/webXRCamera.js +2 -0
- package/XR/webXRCamera.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +1 -1
- package/scene.js.map +1 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
2
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
3
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
4
|
+
import { Vector2, Vector3, Vector4 } from "../../../Maths/math.vector.js";
|
|
5
|
+
/**
|
|
6
|
+
* Block used to lerp between 2 values
|
|
7
|
+
*/
|
|
8
|
+
export class GeometryLerpBlock extends NodeGeometryBlock {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new GeometryLerpBlock
|
|
11
|
+
* @param name defines the block name
|
|
12
|
+
*/
|
|
13
|
+
constructor(name) {
|
|
14
|
+
super(name);
|
|
15
|
+
this.registerInput("left", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
|
+
this.registerInput("right", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
17
|
+
this.registerInput("gradient", NodeGeometryBlockConnectionPointTypes.Float);
|
|
18
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
19
|
+
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
20
|
+
this._linkConnectionTypes(0, 1);
|
|
21
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
22
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
23
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the current class name
|
|
27
|
+
* @returns the class name
|
|
28
|
+
*/
|
|
29
|
+
getClassName() {
|
|
30
|
+
return "GeometryLerpBlock";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets the left operand input component
|
|
34
|
+
*/
|
|
35
|
+
get left() {
|
|
36
|
+
return this._inputs[0];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gets the right operand input component
|
|
40
|
+
*/
|
|
41
|
+
get right() {
|
|
42
|
+
return this._inputs[1];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Gets the gradient operand input component
|
|
46
|
+
*/
|
|
47
|
+
get gradient() {
|
|
48
|
+
return this._inputs[2];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets the output component
|
|
52
|
+
*/
|
|
53
|
+
get output() {
|
|
54
|
+
return this._outputs[0];
|
|
55
|
+
}
|
|
56
|
+
_buildBlock() {
|
|
57
|
+
if (!this.left.isConnected || !this.right.isConnected || !this.gradient.isConnected) {
|
|
58
|
+
this.output._storedFunction = null;
|
|
59
|
+
this.output._storedValue = null;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const func = (gradient, left, right) => {
|
|
63
|
+
return (1 - gradient) * left + gradient * right;
|
|
64
|
+
};
|
|
65
|
+
this.output._storedFunction = (state) => {
|
|
66
|
+
const left = this.left.getConnectedValue(state);
|
|
67
|
+
const right = this.right.getConnectedValue(state);
|
|
68
|
+
const gradient = this.gradient.getConnectedValue(state);
|
|
69
|
+
switch (this.left.type) {
|
|
70
|
+
case NodeGeometryBlockConnectionPointTypes.Int:
|
|
71
|
+
case NodeGeometryBlockConnectionPointTypes.Float: {
|
|
72
|
+
return func(gradient, left, right);
|
|
73
|
+
}
|
|
74
|
+
case NodeGeometryBlockConnectionPointTypes.Vector2: {
|
|
75
|
+
return new Vector2(func(gradient, left.x, right.x), func(gradient, left.y, right.y));
|
|
76
|
+
}
|
|
77
|
+
case NodeGeometryBlockConnectionPointTypes.Vector3: {
|
|
78
|
+
return new Vector3(func(gradient, left.x, right.x), func(gradient, left.y, right.y), func(gradient, left.z, right.z));
|
|
79
|
+
}
|
|
80
|
+
case NodeGeometryBlockConnectionPointTypes.Vector4: {
|
|
81
|
+
return new Vector4(func(gradient, left.x, right.x), func(gradient, left.y, right.y), func(gradient, left.z, right.z), func(gradient, left.w, right.w));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return 0;
|
|
85
|
+
};
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
RegisterClass("BABYLON.GeometryLerpBlock", GeometryLerpBlock);
|
|
90
|
+
//# sourceMappingURL=geometryLerpBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryLerpBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryLerpBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACnE;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,iBAAiB;IACpD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,KAA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C,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC5H;gBACD,KAAK,qCAAqC,CAAC,OAAO,CAAC,CAAC;oBAChD,OAAO,IAAI,OAAO,CAAC,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC9J;aACJ;YAED,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\n/**\r\n * Block used to lerp between 2 values\r\n */\r\nexport class GeometryLerpBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryLerpBlock\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(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"gradient\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryLerpBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the gradient operand input component\r\n */\r\n public get gradient(): NodeGeometryConnectionPoint {\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(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.left.isConnected || !this.right.isConnected || !this.gradient.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (gradient: number, left: number, right: number) => {\r\n return (1 - gradient) * left + gradient * right;\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const left = this.left.getConnectedValue(state);\r\n const right = this.right.getConnectedValue(state);\r\n const gradient = this.gradient.getConnectedValue(state);\r\n switch (this.left.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n return func!(gradient, left, right);\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n return new Vector2(func!(gradient, left.x, right.x), func!(gradient, left.y, right.y));\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n return new Vector3(func!(gradient, left.x, right.x), func!(gradient, left.y, right.y), func!(gradient, left.z, right.z));\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n return new Vector4(func!(gradient, left.x, right.x), func!(gradient, left.y, right.y), func!(gradient, left.z, right.z), func!(gradient, left.w, right.w));\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryLerpBlock\", GeometryLerpBlock);\r\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to compute value of one parameter modulo another
|
|
5
|
+
*/
|
|
6
|
+
export declare class GeometryModBlock extends NodeGeometryBlock {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new GeometryModBlock
|
|
9
|
+
* @param name defines the block name
|
|
10
|
+
*/
|
|
11
|
+
constructor(name: string);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the current class name
|
|
14
|
+
* @returns the class name
|
|
15
|
+
*/
|
|
16
|
+
getClassName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the left operand input component
|
|
19
|
+
*/
|
|
20
|
+
get left(): NodeGeometryConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the right operand input component
|
|
23
|
+
*/
|
|
24
|
+
get right(): NodeGeometryConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the output component
|
|
27
|
+
*/
|
|
28
|
+
get output(): NodeGeometryConnectionPoint;
|
|
29
|
+
protected _buildBlock(): this | undefined;
|
|
30
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Vector2, Vector3, Vector4 } from "../../../Maths/math.vector.js";
|
|
2
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
4
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
5
|
+
/**
|
|
6
|
+
* Block used to compute value of one parameter modulo another
|
|
7
|
+
*/
|
|
8
|
+
export class GeometryModBlock extends NodeGeometryBlock {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new GeometryModBlock
|
|
11
|
+
* @param name defines the block name
|
|
12
|
+
*/
|
|
13
|
+
constructor(name) {
|
|
14
|
+
super(name);
|
|
15
|
+
this.registerInput("left", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
|
+
this.registerInput("right", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
17
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
18
|
+
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
19
|
+
this._linkConnectionTypes(0, 1);
|
|
20
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
21
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
22
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets the current class name
|
|
26
|
+
* @returns the class name
|
|
27
|
+
*/
|
|
28
|
+
getClassName() {
|
|
29
|
+
return "GeometryModBlock";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Gets the left operand input component
|
|
33
|
+
*/
|
|
34
|
+
get left() {
|
|
35
|
+
return this._inputs[0];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets the right operand input component
|
|
39
|
+
*/
|
|
40
|
+
get right() {
|
|
41
|
+
return this._inputs[1];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets the output component
|
|
45
|
+
*/
|
|
46
|
+
get output() {
|
|
47
|
+
return this._outputs[0];
|
|
48
|
+
}
|
|
49
|
+
_buildBlock() {
|
|
50
|
+
if (!this.left.isConnected || !this.right.isConnected) {
|
|
51
|
+
this.output._storedFunction = null;
|
|
52
|
+
this.output._storedValue = null;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const func = (left, right) => {
|
|
56
|
+
return left - Math.floor(left / right) * right;
|
|
57
|
+
};
|
|
58
|
+
this.output._storedFunction = (state) => {
|
|
59
|
+
const left = this.left.getConnectedValue(state);
|
|
60
|
+
const right = this.right.getConnectedValue(state);
|
|
61
|
+
switch (this.left.type) {
|
|
62
|
+
case NodeGeometryBlockConnectionPointTypes.Int:
|
|
63
|
+
case NodeGeometryBlockConnectionPointTypes.Float: {
|
|
64
|
+
return func(left, right);
|
|
65
|
+
}
|
|
66
|
+
case NodeGeometryBlockConnectionPointTypes.Vector2: {
|
|
67
|
+
return new Vector2(func(left.x, right.x), func(left.y, right.y));
|
|
68
|
+
}
|
|
69
|
+
case NodeGeometryBlockConnectionPointTypes.Vector3: {
|
|
70
|
+
return new Vector3(func(left.x, right.x), func(left.y, right.y), func(left.z, right.z));
|
|
71
|
+
}
|
|
72
|
+
case NodeGeometryBlockConnectionPointTypes.Vector4: {
|
|
73
|
+
return new Vector4(func(left.x, right.x), func(left.y, right.y), func(left.z, right.z), func(left.w, right.w));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return 0;
|
|
77
|
+
};
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
RegisterClass("BABYLON.GeometryModBlock", GeometryModBlock);
|
|
82
|
+
//# sourceMappingURL=geometryModBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryModBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryModBlock.ts"],"names":[],"mappings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,CAAC;iBACtE;gBACD,KAAK,qCAAqC,CAAC,OAAO,CAAC,CAAC;oBAChD,OAAO,IAAI,OAAO,CAAC,IAAK,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC9F;gBACD,KAAK,qCAAqC,CAAC,OAAO,CAAC,CAAC;oBAChD,OAAO,IAAI,OAAO,CAAC,IAAK,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;iBACtH;aACJ;YAED,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n/**\r\n * Block used to compute value of one parameter modulo another\r\n */\r\nexport class GeometryModBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryModBlock\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(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryModBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.left.isConnected || !this.right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (left: number, right: number) => {\r\n return left - Math.floor(left / right) * right;\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const left = this.left.getConnectedValue(state);\r\n const right = this.right.getConnectedValue(state);\r\n switch (this.left.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n return func!(left, right);\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n return new Vector2(func!(left.x, right.x), func!(left.y, right.y));\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n return new Vector3(func!(left.x, right.x), func!(left.y, right.y), func!(left.z, right.z));\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n return new Vector4(func!(left.x, right.x), func!(left.y, right.y), func!(left.z, right.z), func!(left.w, right.w));\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryModBlock\", GeometryModBlock);\r\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to normalize lerp between 2 values
|
|
5
|
+
*/
|
|
6
|
+
export declare class GeometryNLerpBlock extends NodeGeometryBlock {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new GeometryNLerpBlock
|
|
9
|
+
* @param name defines the block name
|
|
10
|
+
*/
|
|
11
|
+
constructor(name: string);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the current class name
|
|
14
|
+
* @returns the class name
|
|
15
|
+
*/
|
|
16
|
+
getClassName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the left operand input component
|
|
19
|
+
*/
|
|
20
|
+
get left(): NodeGeometryConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the right operand input component
|
|
23
|
+
*/
|
|
24
|
+
get right(): NodeGeometryConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the gradient operand input component
|
|
27
|
+
*/
|
|
28
|
+
get gradient(): NodeGeometryConnectionPoint;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the output component
|
|
31
|
+
*/
|
|
32
|
+
get output(): NodeGeometryConnectionPoint;
|
|
33
|
+
protected _buildBlock(): this | undefined;
|
|
34
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Vector2, Vector3, Vector4 } from "../../../Maths/math.vector.js";
|
|
2
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
4
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
5
|
+
/**
|
|
6
|
+
* Block used to normalize lerp between 2 values
|
|
7
|
+
*/
|
|
8
|
+
export class GeometryNLerpBlock extends NodeGeometryBlock {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new GeometryNLerpBlock
|
|
11
|
+
* @param name defines the block name
|
|
12
|
+
*/
|
|
13
|
+
constructor(name) {
|
|
14
|
+
super(name);
|
|
15
|
+
this.registerInput("left", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
|
+
this.registerInput("right", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
17
|
+
this.registerInput("gradient", NodeGeometryBlockConnectionPointTypes.Float);
|
|
18
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
19
|
+
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
20
|
+
this._linkConnectionTypes(0, 1);
|
|
21
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
22
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
23
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the current class name
|
|
27
|
+
* @returns the class name
|
|
28
|
+
*/
|
|
29
|
+
getClassName() {
|
|
30
|
+
return "GeometryNLerpBlock";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Gets the left operand input component
|
|
34
|
+
*/
|
|
35
|
+
get left() {
|
|
36
|
+
return this._inputs[0];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gets the right operand input component
|
|
40
|
+
*/
|
|
41
|
+
get right() {
|
|
42
|
+
return this._inputs[1];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Gets the gradient operand input component
|
|
46
|
+
*/
|
|
47
|
+
get gradient() {
|
|
48
|
+
return this._inputs[2];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets the output component
|
|
52
|
+
*/
|
|
53
|
+
get output() {
|
|
54
|
+
return this._outputs[0];
|
|
55
|
+
}
|
|
56
|
+
_buildBlock() {
|
|
57
|
+
if (!this.left.isConnected || !this.right.isConnected || !this.gradient.isConnected) {
|
|
58
|
+
this.output._storedFunction = null;
|
|
59
|
+
this.output._storedValue = null;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const func = (gradient, left, right) => {
|
|
63
|
+
return (1 - gradient) * left + gradient * right;
|
|
64
|
+
};
|
|
65
|
+
this.output._storedFunction = (state) => {
|
|
66
|
+
const left = this.left.getConnectedValue(state);
|
|
67
|
+
const right = this.right.getConnectedValue(state);
|
|
68
|
+
const gradient = this.gradient.getConnectedValue(state);
|
|
69
|
+
switch (this.left.type) {
|
|
70
|
+
case NodeGeometryBlockConnectionPointTypes.Int:
|
|
71
|
+
case NodeGeometryBlockConnectionPointTypes.Float: {
|
|
72
|
+
return func(gradient, left, right); // NLerp is really lerp in that case
|
|
73
|
+
}
|
|
74
|
+
case NodeGeometryBlockConnectionPointTypes.Vector2: {
|
|
75
|
+
const result = new Vector2(func(gradient, left.x, right.x), func(gradient, left.y, right.y));
|
|
76
|
+
result.normalize();
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
case NodeGeometryBlockConnectionPointTypes.Vector3: {
|
|
80
|
+
const result = new Vector3(func(gradient, left.x, right.x), func(gradient, left.y, right.y), func(gradient, left.z, right.z));
|
|
81
|
+
result.normalize();
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
case NodeGeometryBlockConnectionPointTypes.Vector4: {
|
|
85
|
+
const result = new Vector4(func(gradient, left.x, right.x), func(gradient, left.y, right.y), func(gradient, left.z, right.z), func(gradient, left.w, right.w));
|
|
86
|
+
result.normalize();
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return 0;
|
|
91
|
+
};
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
RegisterClass("BABYLON.GeometryNLerpBlock", GeometryNLerpBlock);
|
|
96
|
+
//# sourceMappingURL=geometryNLerpBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryNLerpBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryNLerpBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IACrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,KAAK,CAAC,CAAC;QAC5E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAElF,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC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AAC;oBAEnB,OAAO,MAAM,CAAC;iBACjB;gBACD,KAAK,qCAAqC,CAAC,OAAO,CAAC,CAAC;oBAChD,MAAM,MAAM,GAAG,IAAI,OAAO,CACtB,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAChC,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAChC,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAChC,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CACnC,CAAC;oBACF,MAAM,CAAC,SAAS,EAAE,CAAC;oBAEnB,OAAO,MAAM,CAAC;iBACjB;aACJ;YAED,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n/**\r\n * Block used to normalize lerp between 2 values\r\n */\r\nexport class GeometryNLerpBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryNLerpBlock\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(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"gradient\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryNLerpBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the gradient operand input component\r\n */\r\n public get gradient(): NodeGeometryConnectionPoint {\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(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.left.isConnected || !this.right.isConnected || !this.gradient.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (gradient: number, left: number, right: number) => {\r\n return (1 - gradient) * left + gradient * right;\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const left = this.left.getConnectedValue(state);\r\n const right = this.right.getConnectedValue(state);\r\n const gradient = this.gradient.getConnectedValue(state);\r\n switch (this.left.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n return func!(gradient, left, right); // NLerp is really lerp in that case\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n const result = new Vector2(func!(gradient, left.x, right.x), func!(gradient, left.y, right.y));\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n const result = new Vector3(func!(gradient, left.x, right.x), func!(gradient, left.y, right.y), func!(gradient, left.z, right.z));\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n const result = new Vector4(\r\n func!(gradient, left.x, right.x),\r\n func!(gradient, left.y, right.y),\r\n func!(gradient, left.z, right.z),\r\n func!(gradient, left.w, right.w)\r\n );\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryNLerpBlock\", GeometryNLerpBlock);\r\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to get the value of the first parameter raised to the power of the second
|
|
5
|
+
*/
|
|
6
|
+
export declare class GeometryPowBlock extends NodeGeometryBlock {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new GeometryPowBlock
|
|
9
|
+
* @param name defines the block name
|
|
10
|
+
*/
|
|
11
|
+
constructor(name: string);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the current class name
|
|
14
|
+
* @returns the class name
|
|
15
|
+
*/
|
|
16
|
+
getClassName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the value operand input component
|
|
19
|
+
*/
|
|
20
|
+
get value(): NodeGeometryConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the power operand input component
|
|
23
|
+
*/
|
|
24
|
+
get power(): NodeGeometryConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the output component
|
|
27
|
+
*/
|
|
28
|
+
get output(): NodeGeometryConnectionPoint;
|
|
29
|
+
protected _buildBlock(): this | undefined;
|
|
30
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Vector2, Vector3, Vector4 } from "../../../Maths/math.vector.js";
|
|
2
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
4
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
5
|
+
/**
|
|
6
|
+
* Block used to get the value of the first parameter raised to the power of the second
|
|
7
|
+
*/
|
|
8
|
+
export class GeometryPowBlock extends NodeGeometryBlock {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new GeometryPowBlock
|
|
11
|
+
* @param name defines the block name
|
|
12
|
+
*/
|
|
13
|
+
constructor(name) {
|
|
14
|
+
super(name);
|
|
15
|
+
this.registerInput("value", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
|
+
this.registerInput("power", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
17
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
18
|
+
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
19
|
+
this._linkConnectionTypes(0, 1);
|
|
20
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
21
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
22
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets the current class name
|
|
26
|
+
* @returns the class name
|
|
27
|
+
*/
|
|
28
|
+
getClassName() {
|
|
29
|
+
return "GeometryPowBlock";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Gets the value operand input component
|
|
33
|
+
*/
|
|
34
|
+
get value() {
|
|
35
|
+
return this._inputs[0];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets the power operand input component
|
|
39
|
+
*/
|
|
40
|
+
get power() {
|
|
41
|
+
return this._inputs[1];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets the output component
|
|
45
|
+
*/
|
|
46
|
+
get output() {
|
|
47
|
+
return this._outputs[0];
|
|
48
|
+
}
|
|
49
|
+
_buildBlock() {
|
|
50
|
+
if (!this.value.isConnected || !this.power.isConnected) {
|
|
51
|
+
this.output._storedFunction = null;
|
|
52
|
+
this.output._storedValue = null;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const func = (value, power) => {
|
|
56
|
+
return Math.pow(value, power);
|
|
57
|
+
};
|
|
58
|
+
this.output._storedFunction = (state) => {
|
|
59
|
+
const source = this.value.getConnectedValue(state);
|
|
60
|
+
const power = this.power.getConnectedValue(state);
|
|
61
|
+
switch (this.value.type) {
|
|
62
|
+
case NodeGeometryBlockConnectionPointTypes.Int:
|
|
63
|
+
case NodeGeometryBlockConnectionPointTypes.Float: {
|
|
64
|
+
return func(source, power);
|
|
65
|
+
}
|
|
66
|
+
case NodeGeometryBlockConnectionPointTypes.Vector2: {
|
|
67
|
+
return new Vector2(func(source.x, power), func(source.y, power));
|
|
68
|
+
}
|
|
69
|
+
case NodeGeometryBlockConnectionPointTypes.Vector3: {
|
|
70
|
+
return new Vector3(func(source.x, power), func(source.y, power), func(source.z, power));
|
|
71
|
+
}
|
|
72
|
+
case NodeGeometryBlockConnectionPointTypes.Vector4: {
|
|
73
|
+
return new Vector4(func(source.x, power), func(source.y, power), func(source.z, power), func(source.w, power));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return 0;
|
|
77
|
+
};
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
RegisterClass("BABYLON.GeometryPowBlock", GeometryPowBlock);
|
|
82
|
+
//# sourceMappingURL=geometryPowBlock.js.map
|
|
@@ -0,0 +1 @@
|
|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AAC,EAAE,IAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;iBACtE;gBACD,KAAK,qCAAqC,CAAC,OAAO,CAAC,CAAC;oBAChD,OAAO,IAAI,OAAO,CAAC,IAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,IAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,IAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;iBAC9F;gBACD,KAAK,qCAAqC,CAAC,OAAO,CAAC,CAAC;oBAChD,OAAO,IAAI,OAAO,CAAC,IAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,IAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,IAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,IAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;iBACtH;aACJ;YAED,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n/**\r\n * Block used to get the value of the first parameter raised to the power of the second\r\n */\r\nexport class GeometryPowBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryPowBlock\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(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"power\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryPowBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value operand input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the power operand input component\r\n */\r\n public get power(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock() {\r\n if (!this.value.isConnected || !this.power.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n const func = (value: number, power: number) => {\r\n return Math.pow(value, power);\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const source = this.value.getConnectedValue(state);\r\n const power = this.power.getConnectedValue(state);\r\n switch (this.value.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n return func!(source, power);\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n return new Vector2(func!(source.x, power), func!(source.y, power));\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n return new Vector3(func!(source.x, power), func!(source.y, power), func!(source.z, power));\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n return new Vector4(func!(source.x, power), func!(source.y, power), func!(source.z, power), func!(source.w, power));\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryPowBlock\", GeometryPowBlock);\r\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to smooth step a value
|
|
5
|
+
*/
|
|
6
|
+
export declare class GeometrySmoothStepBlock extends NodeGeometryBlock {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new GeometrySmoothStepBlock
|
|
9
|
+
* @param name defines the block name
|
|
10
|
+
*/
|
|
11
|
+
constructor(name: string);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the current class name
|
|
14
|
+
* @returns the class name
|
|
15
|
+
*/
|
|
16
|
+
getClassName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the value operand input component
|
|
19
|
+
*/
|
|
20
|
+
get value(): NodeGeometryConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the first edge operand input component
|
|
23
|
+
*/
|
|
24
|
+
get edge0(): NodeGeometryConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the second edge operand input component
|
|
27
|
+
*/
|
|
28
|
+
get edge1(): NodeGeometryConnectionPoint;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the output component
|
|
31
|
+
*/
|
|
32
|
+
get output(): NodeGeometryConnectionPoint;
|
|
33
|
+
protected _buildBlock(): this | undefined;
|
|
34
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Vector2, Vector3, Vector4 } from "../../../Maths/math.vector.js";
|
|
2
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
4
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
5
|
+
/**
|
|
6
|
+
* Block used to smooth step a value
|
|
7
|
+
*/
|
|
8
|
+
export class GeometrySmoothStepBlock extends NodeGeometryBlock {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new GeometrySmoothStepBlock
|
|
11
|
+
* @param name defines the block name
|
|
12
|
+
*/
|
|
13
|
+
constructor(name) {
|
|
14
|
+
super(name);
|
|
15
|
+
this.registerInput("value", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
|
+
this.registerInput("edge0", NodeGeometryBlockConnectionPointTypes.Float);
|
|
17
|
+
this.registerInput("edge1", NodeGeometryBlockConnectionPointTypes.Float);
|
|
18
|
+
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
19
|
+
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
20
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
21
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
22
|
+
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets the current class name
|
|
26
|
+
* @returns the class name
|
|
27
|
+
*/
|
|
28
|
+
getClassName() {
|
|
29
|
+
return "GeometrySmoothStepBlock";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Gets the value operand input component
|
|
33
|
+
*/
|
|
34
|
+
get value() {
|
|
35
|
+
return this._inputs[0];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets the first edge operand input component
|
|
39
|
+
*/
|
|
40
|
+
get edge0() {
|
|
41
|
+
return this._inputs[1];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets the second edge operand input component
|
|
45
|
+
*/
|
|
46
|
+
get edge1() {
|
|
47
|
+
return this._inputs[2];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Gets the output component
|
|
51
|
+
*/
|
|
52
|
+
get output() {
|
|
53
|
+
return this._outputs[0];
|
|
54
|
+
}
|
|
55
|
+
_buildBlock() {
|
|
56
|
+
if (!this.value.isConnected || !this.edge0.isConnected || !this.edge1.isConnected) {
|
|
57
|
+
this.output._storedFunction = null;
|
|
58
|
+
this.output._storedValue = null;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const func = (value, edge0, edge1) => {
|
|
62
|
+
const x = Math.max(0, Math.min((value - edge0) / (edge1 - edge0), 1));
|
|
63
|
+
// Smoothstep formula: 3x^2 - 2x^3
|
|
64
|
+
return x * x * (3 - 2 * x);
|
|
65
|
+
};
|
|
66
|
+
this.output._storedFunction = (state) => {
|
|
67
|
+
const source = this.value.getConnectedValue(state);
|
|
68
|
+
const edge0 = this.edge0.getConnectedValue(state);
|
|
69
|
+
const edge1 = this.edge1.getConnectedValue(state);
|
|
70
|
+
switch (this.value.type) {
|
|
71
|
+
case NodeGeometryBlockConnectionPointTypes.Int:
|
|
72
|
+
case NodeGeometryBlockConnectionPointTypes.Float: {
|
|
73
|
+
return func(source, edge0, edge1);
|
|
74
|
+
}
|
|
75
|
+
case NodeGeometryBlockConnectionPointTypes.Vector2: {
|
|
76
|
+
return new Vector2(func(source.x, edge0, edge1), func(source.y, edge0, edge1));
|
|
77
|
+
}
|
|
78
|
+
case NodeGeometryBlockConnectionPointTypes.Vector3: {
|
|
79
|
+
return new Vector3(func(source.x, edge0, edge1), func(source.y, edge0, edge1), func(source.z, edge0, edge1));
|
|
80
|
+
}
|
|
81
|
+
case NodeGeometryBlockConnectionPointTypes.Vector4: {
|
|
82
|
+
return new Vector4(func(source.x, edge0, edge1), func(source.y, edge0, edge1), func(source.z, edge0, edge1), func(source.w, edge0, edge1));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return 0;
|
|
86
|
+
};
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
RegisterClass("BABYLON.GeometrySmoothStepBlock", GeometrySmoothStepBlock);
|
|
91
|
+
//# sourceMappingURL=geometrySmoothStepBlock.js.map
|