@onerjs/core 8.54.4 → 8.54.5
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/WebGPU/Extensions/engine.cubeTexture.pure.js +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js +2 -2
- package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -0
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -4
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheTextureView.d.ts +13 -0
- package/Engines/WebGPU/webgpuCacheTextureView.js +32 -0
- package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -0
- package/Engines/WebGPU/webgpuRenderTargetWrapper.d.ts +10 -0
- package/Engines/WebGPU/webgpuRenderTargetWrapper.js +10 -0
- package/Engines/WebGPU/webgpuRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js +57 -4
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +4 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.pure.js +2 -2
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +5 -0
- package/Engines/thinNativeEngine.pure.js +29 -6
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +1 -0
- package/Engines/webgpuEngine.pure.js +21 -8
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.d.ts +95 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +169 -4
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.d.ts +21 -6
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js +28 -26
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.d.ts +30 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js +111 -29
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.d.ts +56 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js +99 -14
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +10 -2
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +21 -1
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +18 -0
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +29 -2
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +15 -0
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +44 -7
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +9 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +9 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +7 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +8 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.d.ts +5 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js +8 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.d.ts +37 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js +44 -0
- package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js.map +1 -0
- package/FlowGraph/Blocks/Event/index.d.ts +1 -0
- package/FlowGraph/Blocks/Event/index.js +1 -0
- package/FlowGraph/Blocks/Event/index.js.map +1 -1
- package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
- package/FlowGraph/Blocks/Event/pure.js +1 -0
- package/FlowGraph/Blocks/Event/pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.d.ts +4 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js +67 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +13 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +102 -7
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.d.ts +11 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +21 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js +25 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +18 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +9 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js +9 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +17 -3
- package/FlowGraph/CustomTypes/flowGraphMatrix.js +27 -21
- package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +23 -0
- package/FlowGraph/flowGraphContext.js +29 -0
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +58 -1
- package/FlowGraph/flowGraphCoordinator.js +72 -0
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDelayRegistry.d.ts +31 -0
- package/FlowGraph/flowGraphDelayRegistry.js +50 -0
- package/FlowGraph/flowGraphDelayRegistry.js.map +1 -0
- package/FlowGraph/flowGraphHostResolver.d.ts +69 -0
- package/FlowGraph/flowGraphHostResolver.js +25 -0
- package/FlowGraph/flowGraphHostResolver.js.map +1 -0
- package/FlowGraph/flowGraphMath.d.ts +48 -1
- package/FlowGraph/flowGraphMath.js +169 -4
- package/FlowGraph/flowGraphMath.js.map +1 -1
- package/FlowGraph/flowGraphPathConverterComponent.d.ts +14 -3
- package/FlowGraph/flowGraphPathConverterComponent.js +110 -18
- package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.pure.js +7 -1
- package/FlowGraph/flowGraphSignalConnection.pure.js.map +1 -1
- package/FlowGraph/index.d.ts +2 -0
- package/FlowGraph/index.js +2 -0
- package/FlowGraph/index.js.map +1 -1
- package/FlowGraph/pure.d.ts +2 -0
- package/FlowGraph/pure.js +2 -0
- package/FlowGraph/pure.js.map +1 -1
- package/Maths/math.vector.pure.d.ts +10 -0
- package/Maths/math.vector.pure.js +13 -0
- package/Maths/math.vector.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +216 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +714 -67
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +81 -4
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +466 -52
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +19 -0
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +24 -0
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +31 -6
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +5 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
- package/Misc/greasedLineTools.js +1 -1
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/tools.pure.js +14 -2
- package/Misc/tools.pure.js.map +1 -1
- package/Particles/gpuParticleSystem.pure.d.ts +66 -1
- package/Particles/gpuParticleSystem.pure.js +189 -49
- package/Particles/gpuParticleSystem.pure.js.map +1 -1
- package/Physics/v2/characterController.js +69 -17
- package/Physics/v2/characterController.js.map +1 -1
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +3 -9
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +4 -11
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
- package/XR/features/WebXRAbstractFeature.d.ts +9 -0
- package/XR/features/WebXRAbstractFeature.js +16 -0
- package/XR/features/WebXRAbstractFeature.js.map +1 -1
- package/XR/features/WebXRDepthSensing.pure.d.ts +7 -0
- package/XR/features/WebXRDepthSensing.pure.js +350 -39
- package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
- package/XR/features/WebXRImageTracking.pure.js.map +1 -1
- package/XR/features/WebXRLayers.pure.d.ts +6 -5
- package/XR/features/WebXRLayers.pure.js +65 -8
- package/XR/features/WebXRLayers.pure.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.pure.js +9 -2
- package/XR/features/WebXRRawCameraAccess.pure.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.pure.d.ts +0 -1
- package/XR/features/WebXRSpaceWarp.pure.js +13 -4
- package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
- package/XR/features/WebXRWalkingLocomotion.pure.js.map +1 -1
- package/XR/webXRCamera.js +27 -0
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRFeatureWarningRegistry.d.ts +14 -0
- package/XR/webXRFeatureWarningRegistry.js +19 -0
- package/XR/webXRFeatureWarningRegistry.js.map +1 -0
- package/XR/webXRFeaturesManager.d.ts +5 -0
- package/XR/webXRFeaturesManager.js +23 -4
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/XR/webXRGraphicsBinding.d.ts +17 -10
- package/XR/webXRGraphicsBinding.js +8 -5
- package/XR/webXRGraphicsBinding.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +3 -5
- package/XR/webXRSessionManager.js +1 -3
- package/XR/webXRSessionManager.js.map +1 -1
- package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +21 -5
- package/XR/webXRWebGPURenderTargetTextureProvider.js +38 -10
- package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/** This file must only contain pure code and pure imports */
|
|
2
|
-
import { type IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
|
|
2
|
+
import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
|
|
3
3
|
import { FlowGraphTypes } from "../../../flowGraphRichTypes.pure.js";
|
|
4
4
|
import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock.js";
|
|
5
5
|
import { FlowGraphConstantOperationBlock } from "../flowGraphConstantOperationBlock.js";
|
|
6
|
+
import { Quaternion } from "../../../../Maths/math.vector.pure.js";
|
|
6
7
|
import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock.js";
|
|
7
8
|
import { FlowGraphTernaryOperationBlock } from "../flowGraphTernaryOperationBlock.js";
|
|
8
9
|
import { FlowGraphInteger } from "../../../CustomTypes/flowGraphInteger.pure.js";
|
|
9
10
|
import { type FlowGraphDataConnection } from "../../../flowGraphDataConnection.pure.js";
|
|
11
|
+
import { type FlowGraphContext } from "../../../flowGraphContext.js";
|
|
10
12
|
import { type FlowGraphMathOperationType, type FlowGraphNumber } from "../../../utils.js";
|
|
11
13
|
/**
|
|
12
14
|
* A configuration interface for math blocks
|
|
@@ -122,6 +124,12 @@ export declare class FlowGraphEBlock extends FlowGraphConstantOperationBlock<num
|
|
|
122
124
|
export declare class FlowGraphPiBlock extends FlowGraphConstantOperationBlock<number> {
|
|
123
125
|
constructor(config?: IFlowGraphBlockConfiguration);
|
|
124
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Tau constant (2 * Pi), the ratio of a circle's circumference to its radius.
|
|
129
|
+
*/
|
|
130
|
+
export declare class FlowGraphTauBlock extends FlowGraphConstantOperationBlock<number> {
|
|
131
|
+
constructor(config?: IFlowGraphBlockConfiguration);
|
|
132
|
+
}
|
|
125
133
|
/**
|
|
126
134
|
* Positive inf constant.
|
|
127
135
|
*/
|
|
@@ -246,6 +254,28 @@ export declare class FlowGraphMathInterpolationBlock extends FlowGraphTernaryOpe
|
|
|
246
254
|
constructor(config?: IFlowGraphBlockConfiguration);
|
|
247
255
|
private _polymorphicInterpolate;
|
|
248
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Spherical linear interpolation between two unit quaternions, matching the
|
|
259
|
+
* quaternion slerp operation. The two inputs are treated as
|
|
260
|
+
* Babylon `Quaternion` values regardless of their concrete class (the spec
|
|
261
|
+
* defines them as `float4`), and the output is a `Quaternion`.
|
|
262
|
+
*
|
|
263
|
+
* The underlying implementation is `Quaternion.Slerp`, whose algorithm matches
|
|
264
|
+
* the spec step-for-step (dot product, conditional sign-flip on `b`, sin-based
|
|
265
|
+
* weighting, and a near-identity short-circuit to a linear blend).
|
|
266
|
+
*/
|
|
267
|
+
export declare class FlowGraphMathSlerpBlock extends FlowGraphTernaryOperationBlock<Quaternion, Quaternion, number, Quaternion> {
|
|
268
|
+
constructor(config?: IFlowGraphBlockConfiguration);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Smooth-step block, returning the Hermite interpolation coefficient.
|
|
272
|
+
* Operates component-wise over floatN inputs (the two edges `a`/`b` and the
|
|
273
|
+
* value `c`).
|
|
274
|
+
*/
|
|
275
|
+
export declare class FlowGraphMathSmoothStepBlock extends FlowGraphTernaryOperationBlock<FlowGraphMathOperationType, FlowGraphMathOperationType, FlowGraphMathOperationType, FlowGraphMathOperationType> {
|
|
276
|
+
constructor(config?: IFlowGraphBlockConfiguration);
|
|
277
|
+
private _polymorphicSmoothStep;
|
|
278
|
+
}
|
|
249
279
|
/**
|
|
250
280
|
* Equals block.
|
|
251
281
|
*/
|
|
@@ -520,6 +550,70 @@ export declare class FlowGraphTrailingZerosBlock extends FlowGraphUnaryOperation
|
|
|
520
550
|
export declare class FlowGraphOneBitsCounterBlock extends FlowGraphUnaryOperationBlock<FlowGraphInteger, FlowGraphInteger> {
|
|
521
551
|
constructor(config?: IFlowGraphBlockConfiguration);
|
|
522
552
|
}
|
|
553
|
+
/**
|
|
554
|
+
* Block that converts a linear sRGB color (r, g, b) to OkLCh (l, c, h). Hue is in radians.
|
|
555
|
+
*/
|
|
556
|
+
export declare class FlowGraphRGBToOkLChBlock extends FlowGraphBlock {
|
|
557
|
+
/**
|
|
558
|
+
* Input connection: the linear red component.
|
|
559
|
+
*/
|
|
560
|
+
readonly r: FlowGraphDataConnection<number>;
|
|
561
|
+
/**
|
|
562
|
+
* Input connection: the linear green component.
|
|
563
|
+
*/
|
|
564
|
+
readonly g: FlowGraphDataConnection<number>;
|
|
565
|
+
/**
|
|
566
|
+
* Input connection: the linear blue component.
|
|
567
|
+
*/
|
|
568
|
+
readonly b: FlowGraphDataConnection<number>;
|
|
569
|
+
/**
|
|
570
|
+
* Output connection: the OkLCh lightness.
|
|
571
|
+
*/
|
|
572
|
+
readonly l: FlowGraphDataConnection<number>;
|
|
573
|
+
/**
|
|
574
|
+
* Output connection: the OkLCh chroma.
|
|
575
|
+
*/
|
|
576
|
+
readonly c: FlowGraphDataConnection<number>;
|
|
577
|
+
/**
|
|
578
|
+
* Output connection: the OkLCh hue, in radians.
|
|
579
|
+
*/
|
|
580
|
+
readonly h: FlowGraphDataConnection<number>;
|
|
581
|
+
constructor(config?: IFlowGraphBlockConfiguration);
|
|
582
|
+
_updateOutputs(context: FlowGraphContext): void;
|
|
583
|
+
getClassName(): string;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Block that converts an OkLCh color (l, c, h) to linear sRGB (r, g, b). Hue is in radians.
|
|
587
|
+
*/
|
|
588
|
+
export declare class FlowGraphRGBFromOkLChBlock extends FlowGraphBlock {
|
|
589
|
+
/**
|
|
590
|
+
* Input connection: the OkLCh lightness.
|
|
591
|
+
*/
|
|
592
|
+
readonly l: FlowGraphDataConnection<number>;
|
|
593
|
+
/**
|
|
594
|
+
* Input connection: the OkLCh chroma.
|
|
595
|
+
*/
|
|
596
|
+
readonly c: FlowGraphDataConnection<number>;
|
|
597
|
+
/**
|
|
598
|
+
* Input connection: the OkLCh hue, in radians.
|
|
599
|
+
*/
|
|
600
|
+
readonly h: FlowGraphDataConnection<number>;
|
|
601
|
+
/**
|
|
602
|
+
* Output connection: the linear red component.
|
|
603
|
+
*/
|
|
604
|
+
readonly r: FlowGraphDataConnection<number>;
|
|
605
|
+
/**
|
|
606
|
+
* Output connection: the linear green component.
|
|
607
|
+
*/
|
|
608
|
+
readonly g: FlowGraphDataConnection<number>;
|
|
609
|
+
/**
|
|
610
|
+
* Output connection: the linear blue component.
|
|
611
|
+
*/
|
|
612
|
+
readonly b: FlowGraphDataConnection<number>;
|
|
613
|
+
constructor(config?: IFlowGraphBlockConfiguration);
|
|
614
|
+
_updateOutputs(context: FlowGraphContext): void;
|
|
615
|
+
getClassName(): string;
|
|
616
|
+
}
|
|
523
617
|
/**
|
|
524
618
|
* Register side effects for flowGraphMathBlocks.
|
|
525
619
|
* Safe to call multiple times; only the first call has an effect.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** This file must only contain pure code and pure imports */
|
|
2
|
+
import { FlowGraphBlock } from "../../../flowGraphBlock.js";
|
|
2
3
|
import { getRichTypeByFlowGraphType, RichTypeAny, RichTypeBoolean, RichTypeFlowGraphInteger, RichTypeNumber } from "../../../flowGraphRichTypes.pure.js";
|
|
3
4
|
import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock.js";
|
|
4
5
|
import { FlowGraphConstantOperationBlock } from "../flowGraphConstantOperationBlock.js";
|
|
@@ -246,6 +247,14 @@ export class FlowGraphPiBlock extends FlowGraphConstantOperationBlock {
|
|
|
246
247
|
super(RichTypeNumber, () => Math.PI, "FlowGraphPIBlock" /* FlowGraphBlockNames.PI */, config);
|
|
247
248
|
}
|
|
248
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Tau constant (2 * Pi), the ratio of a circle's circumference to its radius.
|
|
252
|
+
*/
|
|
253
|
+
export class FlowGraphTauBlock extends FlowGraphConstantOperationBlock {
|
|
254
|
+
constructor(config) {
|
|
255
|
+
super(RichTypeNumber, () => 2 * Math.PI, "FlowGraphTauBlock" /* FlowGraphBlockNames.Tau */, config);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
249
258
|
/**
|
|
250
259
|
* Positive inf constant.
|
|
251
260
|
*/
|
|
@@ -525,6 +534,25 @@ export class FlowGraphSaturateBlock extends FlowGraphUnaryOperationBlock {
|
|
|
525
534
|
function Interpolate(a, b, c) {
|
|
526
535
|
return (1 - c) * a + c * b;
|
|
527
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* Smooth step (Hermite interpolation) coefficient.
|
|
539
|
+
* Given the edges `a`/`b` and the value `c`, computes the smooth interpolation
|
|
540
|
+
* coefficient `t * t * (3 - 2 * t)` where `t = saturate((c - min(a, b)) / |b - a|)`.
|
|
541
|
+
* Note that this returns the coefficient in [0, 1]; it does not interpolate between `a` and `b`.
|
|
542
|
+
* @param a first edge
|
|
543
|
+
* @param b second edge
|
|
544
|
+
* @param c value to interpolate
|
|
545
|
+
* @returns the smooth-step interpolation coefficient
|
|
546
|
+
*/
|
|
547
|
+
function SmoothStep(a, b, c) {
|
|
548
|
+
// Degenerate edges: with a === b the transition is instantaneous, so return a step rather than
|
|
549
|
+
// dividing by zero (which would yield NaN and poison downstream math).
|
|
550
|
+
if (a === b) {
|
|
551
|
+
return c < a ? 0 : 1;
|
|
552
|
+
}
|
|
553
|
+
const t = Saturate((c - Math.min(a, b)) / Math.abs(b - a));
|
|
554
|
+
return t * t * (3 - 2 * t);
|
|
555
|
+
}
|
|
528
556
|
/**
|
|
529
557
|
* Interpolate block.
|
|
530
558
|
*/
|
|
@@ -536,6 +564,34 @@ export class FlowGraphMathInterpolationBlock extends FlowGraphTernaryOperationBl
|
|
|
536
564
|
return ComponentWiseTernaryOperation(a, b, c, Interpolate);
|
|
537
565
|
}
|
|
538
566
|
}
|
|
567
|
+
/**
|
|
568
|
+
* Spherical linear interpolation between two unit quaternions, matching the
|
|
569
|
+
* quaternion slerp operation. The two inputs are treated as
|
|
570
|
+
* Babylon `Quaternion` values regardless of their concrete class (the spec
|
|
571
|
+
* defines them as `float4`), and the output is a `Quaternion`.
|
|
572
|
+
*
|
|
573
|
+
* The underlying implementation is `Quaternion.Slerp`, whose algorithm matches
|
|
574
|
+
* the spec step-for-step (dot product, conditional sign-flip on `b`, sin-based
|
|
575
|
+
* weighting, and a near-identity short-circuit to a linear blend).
|
|
576
|
+
*/
|
|
577
|
+
export class FlowGraphMathSlerpBlock extends FlowGraphTernaryOperationBlock {
|
|
578
|
+
constructor(config) {
|
|
579
|
+
super(RichTypeAny, RichTypeAny, RichTypeNumber, RichTypeAny, (a, b, c) => Quaternion.Slerp(a, b, c), "FlowGraphMathSlerpBlock" /* FlowGraphBlockNames.MathSlerp */, config);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Smooth-step block, returning the Hermite interpolation coefficient.
|
|
584
|
+
* Operates component-wise over floatN inputs (the two edges `a`/`b` and the
|
|
585
|
+
* value `c`).
|
|
586
|
+
*/
|
|
587
|
+
export class FlowGraphMathSmoothStepBlock extends FlowGraphTernaryOperationBlock {
|
|
588
|
+
constructor(config) {
|
|
589
|
+
super(RichTypeAny, RichTypeAny, RichTypeAny, RichTypeAny, (a, b, c) => this._polymorphicSmoothStep(a, b, c), "FlowGraphSmoothStepBlock" /* FlowGraphBlockNames.SmoothStep */, config);
|
|
590
|
+
}
|
|
591
|
+
_polymorphicSmoothStep(a, b, c) {
|
|
592
|
+
return ComponentWiseTernaryOperation(a, b, c, SmoothStep);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
539
595
|
/**
|
|
540
596
|
* Equals block.
|
|
541
597
|
*/
|
|
@@ -546,15 +602,24 @@ export class FlowGraphEqualityBlock extends FlowGraphBinaryOperationBlock {
|
|
|
546
602
|
_polymorphicEq(a, b) {
|
|
547
603
|
const aClassName = _GetClassNameOf(a);
|
|
548
604
|
const bClassName = _GetClassNameOf(b);
|
|
549
|
-
|
|
550
|
-
|
|
605
|
+
// A rotation may arrive either as a Quaternion or as a four-component vector, so treat Quaternion and
|
|
606
|
+
// Vector4 (both four-component) as comparable so that, for example, a decomposed rotation can be compared
|
|
607
|
+
// against a float4 literal.
|
|
608
|
+
const isFourComponent = (className) => className === "Vector4" /* FlowGraphTypes.Vector4 */ || className === "Quaternion" /* FlowGraphTypes.Quaternion */;
|
|
609
|
+
if (isFourComponent(aClassName) && isFourComponent(bClassName)) {
|
|
610
|
+
return a.equals(b);
|
|
551
611
|
}
|
|
552
612
|
if (_AreSameVectorOrQuaternionClass(aClassName, bClassName) || _AreSameMatrixClass(aClassName, bClassName) || _AreSameIntegerClass(aClassName, bClassName)) {
|
|
553
613
|
return a.equals(b);
|
|
554
614
|
}
|
|
555
|
-
|
|
556
|
-
|
|
615
|
+
// Handle mixed number/FlowGraphInteger comparison
|
|
616
|
+
if (isNumeric(a) && isNumeric(b)) {
|
|
617
|
+
return getNumericValue(a) === getNumericValue(b);
|
|
618
|
+
}
|
|
619
|
+
if (typeof a !== typeof b) {
|
|
620
|
+
return false;
|
|
557
621
|
}
|
|
622
|
+
return a === b;
|
|
558
623
|
}
|
|
559
624
|
}
|
|
560
625
|
function ComparisonOperators(a, b, op) {
|
|
@@ -1029,6 +1094,101 @@ export class FlowGraphOneBitsCounterBlock extends FlowGraphUnaryOperationBlock {
|
|
|
1029
1094
|
super(RichTypeFlowGraphInteger, RichTypeFlowGraphInteger, (a) => new FlowGraphInteger(CountOnes(a.value)), "FlowGraphOneBitsCounterBlock" /* FlowGraphBlockNames.OneBitsCounter */, config);
|
|
1030
1095
|
}
|
|
1031
1096
|
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Converts a linear sRGB color to OkLCh (the polar form of the Oklab color space).
|
|
1099
|
+
* Uses Ottosson's original single-precision matrices.
|
|
1100
|
+
* The RGB inputs are treated as linear; hue is returned in radians.
|
|
1101
|
+
* @param r linear red component
|
|
1102
|
+
* @param g linear green component
|
|
1103
|
+
* @param b linear blue component
|
|
1104
|
+
* @returns the OkLCh lightness (l), chroma (c) and hue (h, radians)
|
|
1105
|
+
*/
|
|
1106
|
+
function RgbToOkLch(r, g, b) {
|
|
1107
|
+
// Linear sRGB -> LMS cone responses.
|
|
1108
|
+
const long = 0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b;
|
|
1109
|
+
const medium = 0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b;
|
|
1110
|
+
const short = 0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b;
|
|
1111
|
+
// Non-linearity (cube root) then LMS' -> Oklab.
|
|
1112
|
+
const lRoot = Math.cbrt(long);
|
|
1113
|
+
const mRoot = Math.cbrt(medium);
|
|
1114
|
+
const sRoot = Math.cbrt(short);
|
|
1115
|
+
const okL = 0.2104542553 * lRoot + 0.793617785 * mRoot - 0.0040720468 * sRoot;
|
|
1116
|
+
const okA = 1.9779984951 * lRoot - 2.428592205 * mRoot + 0.4505937099 * sRoot;
|
|
1117
|
+
const okB = 0.0259040371 * lRoot + 0.7827717662 * mRoot - 0.808675766 * sRoot;
|
|
1118
|
+
// Oklab -> OkLCh (polar form).
|
|
1119
|
+
return { l: okL, c: Math.hypot(okA, okB), h: Math.atan2(okB, okA) };
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Converts an OkLCh color to linear sRGB. Inverse of {@link RgbToOkLch}; hue is in radians.
|
|
1123
|
+
* @param l OkLCh lightness
|
|
1124
|
+
* @param c OkLCh chroma
|
|
1125
|
+
* @param h OkLCh hue in radians
|
|
1126
|
+
* @returns the linear sRGB red (r), green (g) and blue (b) components
|
|
1127
|
+
*/
|
|
1128
|
+
function OkLchToRgb(l, c, h) {
|
|
1129
|
+
// OkLCh -> Oklab.
|
|
1130
|
+
const okA = c * Math.cos(h);
|
|
1131
|
+
const okB = c * Math.sin(h);
|
|
1132
|
+
// Oklab -> LMS' then cube to LMS.
|
|
1133
|
+
const lPrime = l + 0.3963377774 * okA + 0.2158037573 * okB;
|
|
1134
|
+
const mPrime = l - 0.1055613458 * okA - 0.0638541728 * okB;
|
|
1135
|
+
const sPrime = l - 0.0894841775 * okA - 1.291485548 * okB;
|
|
1136
|
+
const long = lPrime * lPrime * lPrime;
|
|
1137
|
+
const medium = mPrime * mPrime * mPrime;
|
|
1138
|
+
const short = sPrime * sPrime * sPrime;
|
|
1139
|
+
// LMS -> linear sRGB.
|
|
1140
|
+
return {
|
|
1141
|
+
r: 4.0767416621 * long - 3.3077115913 * medium + 0.2309699292 * short,
|
|
1142
|
+
g: -1.2684380046 * long + 2.6097574011 * medium - 0.3413193965 * short,
|
|
1143
|
+
b: -0.0041960863 * long - 0.7034186147 * medium + 1.707614701 * short,
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Block that converts a linear sRGB color (r, g, b) to OkLCh (l, c, h). Hue is in radians.
|
|
1148
|
+
*/
|
|
1149
|
+
export class FlowGraphRGBToOkLChBlock extends FlowGraphBlock {
|
|
1150
|
+
constructor(config) {
|
|
1151
|
+
super(config);
|
|
1152
|
+
this.r = this.registerDataInput("r", RichTypeNumber, 0);
|
|
1153
|
+
this.g = this.registerDataInput("g", RichTypeNumber, 0);
|
|
1154
|
+
this.b = this.registerDataInput("b", RichTypeNumber, 0);
|
|
1155
|
+
this.l = this.registerDataOutput("l", RichTypeNumber, 0);
|
|
1156
|
+
this.c = this.registerDataOutput("c", RichTypeNumber, 0);
|
|
1157
|
+
this.h = this.registerDataOutput("h", RichTypeNumber, 0);
|
|
1158
|
+
}
|
|
1159
|
+
_updateOutputs(context) {
|
|
1160
|
+
const { l, c, h } = RgbToOkLch(this.r.getValue(context), this.g.getValue(context), this.b.getValue(context));
|
|
1161
|
+
this.l.setValue(l, context);
|
|
1162
|
+
this.c.setValue(c, context);
|
|
1163
|
+
this.h.setValue(h, context);
|
|
1164
|
+
}
|
|
1165
|
+
getClassName() {
|
|
1166
|
+
return "FlowGraphRGBToOkLChBlock" /* FlowGraphBlockNames.RGBToOkLCh */;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Block that converts an OkLCh color (l, c, h) to linear sRGB (r, g, b). Hue is in radians.
|
|
1171
|
+
*/
|
|
1172
|
+
export class FlowGraphRGBFromOkLChBlock extends FlowGraphBlock {
|
|
1173
|
+
constructor(config) {
|
|
1174
|
+
super(config);
|
|
1175
|
+
this.l = this.registerDataInput("l", RichTypeNumber, 0);
|
|
1176
|
+
this.c = this.registerDataInput("c", RichTypeNumber, 0);
|
|
1177
|
+
this.h = this.registerDataInput("h", RichTypeNumber, 0);
|
|
1178
|
+
this.r = this.registerDataOutput("r", RichTypeNumber, 0);
|
|
1179
|
+
this.g = this.registerDataOutput("g", RichTypeNumber, 0);
|
|
1180
|
+
this.b = this.registerDataOutput("b", RichTypeNumber, 0);
|
|
1181
|
+
}
|
|
1182
|
+
_updateOutputs(context) {
|
|
1183
|
+
const { r, g, b } = OkLchToRgb(this.l.getValue(context), this.c.getValue(context), this.h.getValue(context));
|
|
1184
|
+
this.r.setValue(r, context);
|
|
1185
|
+
this.g.setValue(g, context);
|
|
1186
|
+
this.b.setValue(b, context);
|
|
1187
|
+
}
|
|
1188
|
+
getClassName() {
|
|
1189
|
+
return "FlowGraphRGBFromOkLChBlock" /* FlowGraphBlockNames.RGBFromOkLCh */;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1032
1192
|
let _Registered = false;
|
|
1033
1193
|
/**
|
|
1034
1194
|
* Register side effects for flowGraphMathBlocks.
|
|
@@ -1046,6 +1206,7 @@ export function RegisterFlowGraphMathBlocks() {
|
|
|
1046
1206
|
RegisterClass("FlowGraphRandomBlock" /* FlowGraphBlockNames.Random */, FlowGraphRandomBlock);
|
|
1047
1207
|
RegisterClass("FlowGraphEBlock" /* FlowGraphBlockNames.E */, FlowGraphEBlock);
|
|
1048
1208
|
RegisterClass("FlowGraphPIBlock" /* FlowGraphBlockNames.PI */, FlowGraphPiBlock);
|
|
1209
|
+
RegisterClass("FlowGraphTauBlock" /* FlowGraphBlockNames.Tau */, FlowGraphTauBlock);
|
|
1049
1210
|
RegisterClass("FlowGraphInfBlock" /* FlowGraphBlockNames.Inf */, FlowGraphInfBlock);
|
|
1050
1211
|
RegisterClass("FlowGraphNaNBlock" /* FlowGraphBlockNames.NaN */, FlowGraphNaNBlock);
|
|
1051
1212
|
RegisterClass("FlowGraphAbsBlock" /* FlowGraphBlockNames.Abs */, FlowGraphAbsBlock);
|
|
@@ -1062,6 +1223,10 @@ export function RegisterFlowGraphMathBlocks() {
|
|
|
1062
1223
|
RegisterClass("FlowGraphClampBlock" /* FlowGraphBlockNames.Clamp */, FlowGraphClampBlock);
|
|
1063
1224
|
RegisterClass("FlowGraphSaturateBlock" /* FlowGraphBlockNames.Saturate */, FlowGraphSaturateBlock);
|
|
1064
1225
|
RegisterClass("FlowGraphMathInterpolationBlock" /* FlowGraphBlockNames.MathInterpolation */, FlowGraphMathInterpolationBlock);
|
|
1226
|
+
RegisterClass("FlowGraphMathSlerpBlock" /* FlowGraphBlockNames.MathSlerp */, FlowGraphMathSlerpBlock);
|
|
1227
|
+
RegisterClass("FlowGraphSmoothStepBlock" /* FlowGraphBlockNames.SmoothStep */, FlowGraphMathSmoothStepBlock);
|
|
1228
|
+
RegisterClass("FlowGraphRGBToOkLChBlock" /* FlowGraphBlockNames.RGBToOkLCh */, FlowGraphRGBToOkLChBlock);
|
|
1229
|
+
RegisterClass("FlowGraphRGBFromOkLChBlock" /* FlowGraphBlockNames.RGBFromOkLCh */, FlowGraphRGBFromOkLChBlock);
|
|
1065
1230
|
RegisterClass("FlowGraphEqualityBlock" /* FlowGraphBlockNames.Equality */, FlowGraphEqualityBlock);
|
|
1066
1231
|
RegisterClass("FlowGraphLessThanBlock" /* FlowGraphBlockNames.LessThan */, FlowGraphLessThanBlock);
|
|
1067
1232
|
RegisterClass("FlowGraphLessThanOrEqualBlock" /* FlowGraphBlockNames.LessThanOrEqual */, FlowGraphLessThanOrEqualBlock);
|